Skip to content

Commit

Permalink
Move top-level await out of experimental (#3089)
Browse files Browse the repository at this point in the history
* move top-level await out of experimental

* Remove last traces of the `experimentalTopLevelAwait` option from docs and tests

Co-authored-by: Lukas Taegert-Atkinson <lukastaegert@users.noreply.github.com>
  • Loading branch information
guybedford and lukastaegert committed Jan 8, 2020
1 parent 7769fb9 commit 3ad2246
Show file tree
Hide file tree
Showing 10 changed files with 4 additions and 24 deletions.
1 change: 0 additions & 1 deletion docs/01-command-line-reference.md
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion docs/02-javascript-api.md
Expand Up @@ -99,7 +99,6 @@ const inputOptions = {
chunkGroupingSize,
experimentalCacheExpiry,
experimentalOptimizeChunks,
experimentalTopLevelAwait,
perf
};
```
Expand Down
7 changes: 0 additions & 7 deletions docs/999-big-list-of-options.md
Expand Up @@ -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`<br>
CLI: `--experimentalTopLevelAwait`/`--no-experimentalTopLevelAwait`<br>
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`<br>
CLI: `--perf`/`--no-perf`<br>
Expand Down
4 changes: 1 addition & 3 deletions src/Graph.ts
Expand Up @@ -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(
Expand Down
1 change: 0 additions & 1 deletion src/rollup/types.d.ts
Expand Up @@ -430,7 +430,6 @@ export interface InputOptions {
context?: string;
experimentalCacheExpiry?: number;
experimentalOptimizeChunks?: boolean;
experimentalTopLevelAwait?: boolean;
external?: ExternalOption;
inlineDynamicImports?: boolean;
input?: InputOption;
Expand Down
1 change: 0 additions & 1 deletion src/utils/mergeOptions.ts
Expand Up @@ -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', []),
Expand Down
5 changes: 1 addition & 4 deletions 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']
};
3 changes: 0 additions & 3 deletions 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:
Expand Down
1 change: 0 additions & 1 deletion test/misc/misc.js
Expand Up @@ -18,7 +18,6 @@ describe('misc', () => {
]),
acornInjectPlugins: freeze([]),
acorn: freeze({}),
experimentalTopLevelAwait: true,
treeshake: freeze({})
})
);
Expand Down
4 changes: 2 additions & 2 deletions test/misc/optionList.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3ad2246

Please sign in to comment.