Skip to content

Commit

Permalink
adapters shouldn't pass arbitrary options to esbuild (#4639)
Browse files Browse the repository at this point in the history
* dont pass arbitrary options to esbuild

* on second thoughts

* throw error if esbuild options are passed

* note to self
  • Loading branch information
Rich-Harris committed Jul 13, 2022
1 parent 4f218a6 commit cdbce6b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .changeset/healthy-cows-walk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@sveltejs/adapter-cloudflare': patch
'@sveltejs/adapter-cloudflare-workers': patch
---

[breaking] Don't pass arbitrary options to esbuild
12 changes: 9 additions & 3 deletions packages/adapter-cloudflare-workers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@ import { fileURLToPath } from 'url';
*/

/** @type {import('.').default} */
export default function (options = {}) {
export default function () {
// TODO remove for 1.0
if (arguments.length > 0) {
throw new Error(
'esbuild options can no longer be passed to adapter-cloudflare-workers — see https://github.com/sveltejs/kit/pull/4639'
);
}

return {
name: '@sveltejs/adapter-cloudflare-workers',

Expand Down Expand Up @@ -58,11 +65,10 @@ export default function (options = {}) {
platform: 'browser',
sourcemap: 'linked',
target: 'es2020',
...options,
entryPoints: [`${tmp}/entry.js`],
outfile: main,
bundle: true,
external: ['__STATIC_CONTENT_MANIFEST', ...(options?.external || [])],
external: ['__STATIC_CONTENT_MANIFEST'],
format: 'esm'
});

Expand Down
10 changes: 8 additions & 2 deletions packages/adapter-cloudflare/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ import { fileURLToPath } from 'url';
import * as esbuild from 'esbuild';

/** @type {import('.').default} */
export default function (options = {}) {
export default function () {
// TODO remove for 1.0
if (arguments.length > 0) {
throw new Error(
'esbuild options can no longer be passed to adapter-cloudflare — see https://github.com/sveltejs/kit/pull/4639'
);
}

return {
name: '@sveltejs/adapter-cloudflare',
async adapt(builder) {
Expand Down Expand Up @@ -40,7 +47,6 @@ export default function (options = {}) {
platform: 'browser',
sourcemap: 'linked',
target: 'es2020',
...options,
entryPoints: [`${tmp}/_worker.js`],
outfile: `${dest}/_worker.js`,
allowOverwrite: true,
Expand Down

0 comments on commit cdbce6b

Please sign in to comment.