Skip to content

Commit

Permalink
pass validated svelte config to adapters (#1559)
Browse files Browse the repository at this point in the history
  • Loading branch information
jthegedus authored May 26, 2021
1 parent eb96322 commit 028abd9
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 9 deletions.
11 changes: 11 additions & 0 deletions .changeset/smooth-items-march.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
'@sveltejs/adapter-begin': patch
'@sveltejs/adapter-cloudflare-workers': patch
'@sveltejs/adapter-netlify': patch
'@sveltejs/adapter-node': patch
'@sveltejs/adapter-static': patch
'@sveltejs/adapter-vercel': patch
'@sveltejs/kit': patch
---

Pass validated svelte config to adapter adapt function
2 changes: 1 addition & 1 deletion packages/adapter-begin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default function () {
const adapter = {
name: '@sveltejs/adapter-begin',

async adapt(utils) {
async adapt({ utils }) {
utils.log.minor('Parsing app.arc file');
const { static: static_mount_point } = parse_arc('app.arc');

Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-cloudflare-workers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function () {
/** @type {import('@sveltejs/kit').Adapter} */
const adapter = {
name: '@sveltejs/adapter-cloudflare-workers',
async adapt(utils) {
async adapt({ utils }) {
const { site } = validate_config(utils);

const bucket = site.bucket;
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-netlify/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default function () {
const adapter = {
name: '@sveltejs/adapter-netlify',

async adapt(utils) {
async adapt({ utils }) {
const { publish, functions } = validate_config().build;

utils.rimraf(publish);
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function ({ out = 'build' } = {}) {
const adapter = {
name: '@sveltejs/adapter-node',

async adapt(utils) {
async adapt({ utils }) {
utils.log.minor('Copying assets');
const static_directory = join(out, 'assets');
utils.copy_client_files(static_directory);
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-static/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default function ({ pages = 'build', assets = pages, fallback = null } =
const adapter = {
name: '@sveltejs/adapter-static',

async adapt(utils) {
async adapt({ utils }) {
utils.copy_static_files(assets);
utils.copy_client_files(assets);

Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-vercel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function () {
const adapter = {
name: '@sveltejs/adapter-vercel',

async adapt(utils) {
async adapt({ utils }) {
const dir = '.vercel_build_output';
utils.rimraf(dir);

Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/core/adapt/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export async function adapt(config, build_data, { cwd = process.cwd(), verbose }

const log = logger({ verbose });
const utils = get_utils({ cwd, config, build_data, log });
await adapt(utils);
await adapt({ utils, config });

log.success('done');
}
2 changes: 1 addition & 1 deletion packages/kit/types/config.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export type AdapterUtils = {

export type Adapter = {
name: string;
adapt: (utils: AdapterUtils) => Promise<void>;
adapt: ({ utils, config }: { utils: AdapterUtils; config: ValidatedConfig }) => Promise<void>;
};

export type Config = {
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import './ambient-modules';

export { Adapter, AdapterUtils, Config } from './config';
export { Adapter, AdapterUtils, Config, ValidatedConfig } from './config';
export { EndpointOutput, RequestHandler } from './endpoint';
export { ErrorLoad, Load, Page } from './page';
export {
Expand Down

0 comments on commit 028abd9

Please sign in to comment.