Skip to content

Commit cdbce6b

Browse files
authored
adapters shouldn't pass arbitrary options to esbuild (#4639)
* dont pass arbitrary options to esbuild * on second thoughts * throw error if esbuild options are passed * note to self
1 parent 4f218a6 commit cdbce6b

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed

Diff for: .changeset/healthy-cows-walk.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@sveltejs/adapter-cloudflare': patch
3+
'@sveltejs/adapter-cloudflare-workers': patch
4+
---
5+
6+
[breaking] Don't pass arbitrary options to esbuild

Diff for: packages/adapter-cloudflare-workers/index.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,14 @@ import { fileURLToPath } from 'url';
1515
*/
1616

1717
/** @type {import('.').default} */
18-
export default function (options = {}) {
18+
export default function () {
19+
// TODO remove for 1.0
20+
if (arguments.length > 0) {
21+
throw new Error(
22+
'esbuild options can no longer be passed to adapter-cloudflare-workers — see https://github.com/sveltejs/kit/pull/4639'
23+
);
24+
}
25+
1926
return {
2027
name: '@sveltejs/adapter-cloudflare-workers',
2128

@@ -58,11 +65,10 @@ export default function (options = {}) {
5865
platform: 'browser',
5966
sourcemap: 'linked',
6067
target: 'es2020',
61-
...options,
6268
entryPoints: [`${tmp}/entry.js`],
6369
outfile: main,
6470
bundle: true,
65-
external: ['__STATIC_CONTENT_MANIFEST', ...(options?.external || [])],
71+
external: ['__STATIC_CONTENT_MANIFEST'],
6672
format: 'esm'
6773
});
6874

Diff for: packages/adapter-cloudflare/index.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@ import { fileURLToPath } from 'url';
44
import * as esbuild from 'esbuild';
55

66
/** @type {import('.').default} */
7-
export default function (options = {}) {
7+
export default function () {
8+
// TODO remove for 1.0
9+
if (arguments.length > 0) {
10+
throw new Error(
11+
'esbuild options can no longer be passed to adapter-cloudflare — see https://github.com/sveltejs/kit/pull/4639'
12+
);
13+
}
14+
815
return {
916
name: '@sveltejs/adapter-cloudflare',
1017
async adapt(builder) {
@@ -40,7 +47,6 @@ export default function (options = {}) {
4047
platform: 'browser',
4148
sourcemap: 'linked',
4249
target: 'es2020',
43-
...options,
4450
entryPoints: [`${tmp}/_worker.js`],
4551
outfile: `${dest}/_worker.js`,
4652
allowOverwrite: true,

0 commit comments

Comments
 (0)