Merge branch 'master' into 7.0

This commit is contained in:
Daniel Tschinder 2017-03-19 14:21:00 +01:00
commit ae8728c146
No known key found for this signature in database
GPG Key ID: 46A883CAEC8A94BD
6 changed files with 16 additions and 2 deletions

View File

@ -108,8 +108,8 @@ Following is a table of the options you can use:
| `moduleRoot` | `(sourceRoot)` | Optional prefix for the AMD module formatter that will be prepend to the filename on module definitions. |
| `only` | `null` | A [glob](https://github.com/isaacs/minimatch), regex, or mixed array of both, matching paths to **only** compile. Can also be an array of arrays containing paths to explicitly match. When attempting to compile a non-matching file it's returned verbatim. |
| `parserOpts` | `{}` | An object containing the options to be passed down to the babel parser, babylon |
| `plugins` | `[]` | List of [plugins](/docs/plugins/) to load and use. |
| `presets` | `[]` | List of [presets](/docs/plugins/#presets) (a set of plugins) to load and use. |
| `plugins` | `[]` | List of [plugins](https://babeljs.io/docs/plugins/) to load and use. |
| `presets` | `[]` | List of [presets](https://babeljs.io/docs/plugins/#presets) (a set of plugins) to load and use. |
| `retainLines` | `false` | Retain line numbers. This will lead to wacky code but is handy for scenarios where you can't use source maps. (**NOTE:** This will not retain the columns) |
| `resolveModuleSource` | `null` | Resolve a module source ie. `import "SOURCE";` to a custom value. Called as `resolveModuleSource(source, filename)`. |
| `shouldPrintComment` | `null` | An optional callback that controls whether a comment should be output or not. Called as `shouldPrintComment(commentContents)`. **NOTE:** This overrides the `comment` option when used. |

View File

@ -37,6 +37,7 @@ minified | boolean | `false` | Should the output be minif
concise | boolean | `false` | Set to `true` to reduce whitespace (but not as much as `opts.compact`)
filename | string | | Used in warning messages
jsonCompatibleStrings | boolean | `false` | Set to true to run `jsesc` with "json": true to print "\u00A9" vs. "©";
Options for source maps:
name | type | default | description

View File

@ -0,0 +1,3 @@
export {};
var obj = { await: function () {} };

View File

@ -0,0 +1,3 @@
export {};
var obj = { await: function _await() {} };

View File

@ -167,6 +167,9 @@ export function isReferenced(node: Object, parent: Object): boolean {
export function isValidIdentifier(name: string): boolean {
if (typeof name !== "string" || esutils.keyword.isReservedWordES6(name, true)) {
return false;
} else if (name === "await") {
// invalid in module, valid in script; better be safe (see #4952)
return false;
} else {
return esutils.keyword.isIdentifierNameES6(name);
}

View File

@ -26,5 +26,9 @@ suite("validators", function () {
assert(t.isNodesEquivalent(parse(program), parse(program2)) === false);
});
it("rejects 'await' as an identifier", function () {
assert(t.isValidIdentifier("await") === false);
});
});
});