add experimental option

aaa
Rich Harris 7 months ago
parent 00107cbfcf
commit b984bf0762

@ -263,7 +263,9 @@ export function analyze_module(ast, options) {
scope,
scopes,
// @ts-expect-error TODO
analysis
analysis,
// @ts-expect-error TODO
options
},
visitors
);

@ -32,8 +32,14 @@ export function AwaitExpression(node, context) {
}
}
if (suspend && !context.state.analysis.runes) {
e.legacy_await_invalid(node);
if (suspend) {
if (!context.state.options.experimental.async) {
e.experimental_async(node);
}
if (!context.state.analysis.runes) {
e.legacy_await_invalid(node);
}
}
if (preserve_context) {

@ -86,7 +86,8 @@ export async function compile_directory(
const compiled = compileModule(text, {
filename: opts.filename,
generate: opts.generate,
dev: opts.dev
dev: opts.dev,
experimental: opts.experimental
});
write(out, compiled.js.code.replace(`v${VERSION}`, 'VERSION'));
} else {

@ -157,6 +157,9 @@ async function common_setup(cwd: string, runes: boolean | undefined, config: Run
rootDir: cwd,
dev: force_hmr ? true : undefined,
hmr: force_hmr ? true : undefined,
experimental: {
async: true
},
...config.compileOptions,
immutable: config.immutable,
accessors: 'accessors' in config ? config.accessors : true,

Loading…
Cancel
Save