diff --git a/docs/01-command-line-reference.md b/docs/01-command-line-reference.md index 1bc68cd624f..7975b964731 100755 --- a/docs/01-command-line-reference.md +++ b/docs/01-command-line-reference.md @@ -56,7 +56,6 @@ export default { // can be an array (for multiple inputs) chunkGroupingSize, experimentalCacheExpiry, experimentalOptimizeChunks, - experimentalTopLevelAwait, perf, output: { // required (can be an array, for multiple outputs) diff --git a/docs/02-javascript-api.md b/docs/02-javascript-api.md index ffa16222774..ab5d3db7caa 100755 --- a/docs/02-javascript-api.md +++ b/docs/02-javascript-api.md @@ -99,7 +99,6 @@ const inputOptions = { chunkGroupingSize, experimentalCacheExpiry, experimentalOptimizeChunks, - experimentalTopLevelAwait, perf }; ``` diff --git a/docs/999-big-list-of-options.md b/docs/999-big-list-of-options.md index 0059c5841d0..d584349b690 100755 --- a/docs/999-big-list-of-options.md +++ b/docs/999-big-list-of-options.md @@ -1067,13 +1067,6 @@ Default: `false` Experimental feature to optimize chunk groupings. When a large number of chunks are generated, this allows smaller chunks to group together as long as they are within the `chunkGroupingSize` limit. It results in unnecessary code being loaded in some cases in order to have a smaller number of chunks overall. Disabled by default as it may cause unwanted side effects when loading unexpected code. -#### experimentalTopLevelAwait -Type: `boolean`
-CLI: `--experimentalTopLevelAwait`/`--no-experimentalTopLevelAwait`
-Default: `false` - -Whether to support top-level await statements. The generated code will follow [Variant A of the specification](https://github.com/tc39/proposal-top-level-await#variant-a-top-level-await-blocks-tree-execution). - #### perf Type: `boolean`
CLI: `--perf`/`--no-perf`
diff --git a/src/Graph.ts b/src/Graph.ts index b5f20987a65..378ed4a163b 100644 --- a/src/Graph.ts +++ b/src/Graph.ts @@ -176,9 +176,7 @@ export default class Graph { acornPluginsToInject.push(injectImportMeta, injectExportNsFrom); - if (options.experimentalTopLevelAwait) { - this.acornOptions.allowAwaitOutsideFunction = true; - } + (this.acornOptions as any).allowAwaitOutsideFunction = true; const acornInjectPlugins = options.acornInjectPlugins; acornPluginsToInject.push( diff --git a/src/rollup/types.d.ts b/src/rollup/types.d.ts index cc64901301e..064fa10709e 100644 --- a/src/rollup/types.d.ts +++ b/src/rollup/types.d.ts @@ -430,7 +430,6 @@ export interface InputOptions { context?: string; experimentalCacheExpiry?: number; experimentalOptimizeChunks?: boolean; - experimentalTopLevelAwait?: boolean; external?: ExternalOption; inlineDynamicImports?: boolean; input?: InputOption; diff --git a/src/utils/mergeOptions.ts b/src/utils/mergeOptions.ts index 064a685175f..ca62fc73dcd 100644 --- a/src/utils/mergeOptions.ts +++ b/src/utils/mergeOptions.ts @@ -227,7 +227,6 @@ function getInputOptions( context: getOption('context'), experimentalCacheExpiry: getOption('experimentalCacheExpiry', 10), experimentalOptimizeChunks: getOption('experimentalOptimizeChunks'), - experimentalTopLevelAwait: getOption('experimentalTopLevelAwait'), external: getExternal(config, command) as any, inlineDynamicImports: getOption('inlineDynamicImports', false), input: getOption('input', []), diff --git a/test/form/samples/top-level-await/_config.js b/test/form/samples/top-level-await/_config.js index 2d2a2d7dd67..a572b8a99f0 100644 --- a/test/form/samples/top-level-await/_config.js +++ b/test/form/samples/top-level-await/_config.js @@ -1,7 +1,4 @@ module.exports = { description: 'top-level await support', - formats: ['system', 'es'], - options: { - experimentalTopLevelAwait: true - } + formats: ['system', 'es'] }; diff --git a/test/function/samples/invalid-top-level-await/_config.js b/test/function/samples/invalid-top-level-await/_config.js index d0ffc48dbd9..57540628b06 100644 --- a/test/function/samples/invalid-top-level-await/_config.js +++ b/test/function/samples/invalid-top-level-await/_config.js @@ -1,8 +1,5 @@ module.exports = { description: 'throws for invalid top-level-await format', - options: { - experimentalTopLevelAwait: true - }, generateError: { code: 'INVALID_TLA_FORMAT', message: diff --git a/test/misc/misc.js b/test/misc/misc.js index f30f956b9df..e5c9950b6fb 100644 --- a/test/misc/misc.js +++ b/test/misc/misc.js @@ -18,7 +18,6 @@ describe('misc', () => { ]), acornInjectPlugins: freeze([]), acorn: freeze({}), - experimentalTopLevelAwait: true, treeshake: freeze({}) }) ); diff --git a/test/misc/optionList.js b/test/misc/optionList.js index 4ce0b814f34..256b2c2dbba 100644 --- a/test/misc/optionList.js +++ b/test/misc/optionList.js @@ -1,3 +1,3 @@ -exports.input = 'acorn, acornInjectPlugins, cache, chunkGroupingSize, context, experimentalCacheExpiry, experimentalOptimizeChunks, experimentalTopLevelAwait, external, inlineDynamicImports, input, manualChunks, moduleContext, onwarn, perf, plugins, preserveModules, preserveSymlinks, shimMissingExports, strictDeprecations, treeshake, watch'; -exports.flags = 'acorn, acornInjectPlugins, amd, assetFileNames, banner, c, cache, chunkFileNames, chunkGroupingSize, compact, config, context, d, dir, dynamicImportFunction, e, entryFileNames, environment, esModule, experimentalCacheExpiry, experimentalOptimizeChunks, experimentalTopLevelAwait, exports, extend, external, externalLiveBindings, f, file, footer, format, freeze, g, globals, h, i, indent, inlineDynamicImports, input, interop, intro, m, manualChunks, moduleContext, n, name, namespaceToStringTag, noConflict, o, onwarn, outro, paths, perf, plugins, preferConst, preserveModules, preserveSymlinks, shimMissingExports, silent, sourcemap, sourcemapExcludeSources, sourcemapFile, stdin, strict, strictDeprecations, treeshake, v, w, watch'; +exports.input = 'acorn, acornInjectPlugins, cache, chunkGroupingSize, context, experimentalCacheExpiry, experimentalOptimizeChunks, external, inlineDynamicImports, input, manualChunks, moduleContext, onwarn, perf, plugins, preserveModules, preserveSymlinks, shimMissingExports, strictDeprecations, treeshake, watch'; +exports.flags = 'acorn, acornInjectPlugins, amd, assetFileNames, banner, c, cache, chunkFileNames, chunkGroupingSize, compact, config, context, d, dir, dynamicImportFunction, e, entryFileNames, environment, esModule, experimentalCacheExpiry, experimentalOptimizeChunks, exports, extend, external, externalLiveBindings, f, file, footer, format, freeze, g, globals, h, i, indent, inlineDynamicImports, input, interop, intro, m, manualChunks, moduleContext, n, name, namespaceToStringTag, noConflict, o, onwarn, outro, paths, perf, plugins, preferConst, preserveModules, preserveSymlinks, shimMissingExports, silent, sourcemap, sourcemapExcludeSources, sourcemapFile, stdin, strict, strictDeprecations, treeshake, v, w, watch'; exports.output = 'amd, assetFileNames, banner, chunkFileNames, compact, dir, dynamicImportFunction, entryFileNames, esModule, exports, extend, externalLiveBindings, file, footer, format, freeze, globals, indent, interop, intro, name, namespaceToStringTag, noConflict, outro, paths, plugins, preferConst, sourcemap, sourcemapExcludeSources, sourcemapFile, sourcemapPathTransform, strict';