Skip to content

Commit 531c9aa

Browse files
authored
chore: enable resource management/using polyfill in esbuild/felt (#1446)
1 parent 94c5fa8 commit 531c9aa

File tree

6 files changed

+18
-0
lines changed

6 files changed

+18
-0
lines changed

packages/deno-web-test/utils.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ export async function bundle(inputPath: string, outputPath: string) {
5151
plugins: [...denoPlugins()],
5252
entryPoints: [inputPath],
5353
outfile: outputPath,
54+
supported: {
55+
using: false,
56+
},
5457
bundle: true,
5558
format: "esm",
5659
});

packages/felt/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ export default {
2727
define: {
2828
"$DEBUG": Deno.env.get("DEBUG"),
2929
},
30+
// https://esbuild.github.io/api/#supported
31+
supported: {
32+
using: false,
33+
},
3034
tsconfigRaw: {
3135
compilerOptions: {
3236
useDefineForClassFields: false,

packages/felt/builder.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export class Builder extends EventTarget {
3737
external: this.manifest.esbuild.external,
3838
bundle: true,
3939
format: "esm",
40+
supported: this.manifest.esbuild.supported,
4041
// Explicitly compile decorators, as this what Jumble->Vite
4142
// does, and no browsers currently support (any form of) decorators,
4243
// and if we're bundling, we're probably running in a browser.

packages/felt/interface.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export interface ESBuildConfig {
3939
// global variables in the bundled code.
4040
define?: Record<string, string | undefined>;
4141
metafile?: string;
42+
supported?: Record<string, boolean>;
4243
tsconfigRaw: TsconfigRaw;
4344
}
4445

@@ -57,6 +58,7 @@ export class ResolvedConfig {
5758
minify: boolean;
5859
metafile?: string;
5960
define: Record<string, string | undefined>;
61+
supported?: Record<string, boolean>;
6062
tsconfigRaw?: TsconfigRaw;
6163
};
6264
cwd: string;
@@ -78,6 +80,7 @@ export class ResolvedConfig {
7880
metafile: partial?.esbuild?.metafile
7981
? join(cwd, partial.esbuild?.metafile)
8082
: undefined,
83+
supported: partial?.esbuild?.supported,
8184
tsconfigRaw: partial?.esbuild?.tsconfigRaw,
8285
};
8386
}

packages/jumble/vite.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ console.log("Build source maps:", buildSourcemaps);
1313
// https://vite.dev/config/
1414
export default defineConfig({
1515
esbuild: {
16+
supported: {
17+
using: false
18+
},
1619
tsconfigRaw: {
1720
compilerOptions: {
1821
experimentalDecorators: true,

packages/shell/felt.config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ const config: Config = {
2626
"$API_URL": Deno.env.get("API_URL"),
2727
"$COMMIT_SHA": Deno.env.get("COMMIT_SHA"),
2828
},
29+
supported: {
30+
// Provide polyfills for `using` resource management
31+
using: false,
32+
},
2933
tsconfigRaw: {
3034
compilerOptions: {
3135
// `useDefineForClassFields` is critical when using Lit

0 commit comments

Comments
 (0)