Open
Description
Please only file bugs/feature requests for rollup-plugin-closure-compiler here.
What's the issue?
Briefly describe the bug/feature request.
When Computed property names contain invalid javascript identifiers, like '#', '!',
acron parser fails because of forgetting to preserve quotation marks.
How do we reproduce the issue?
We'll likely need to know:
- Your Rollup configuration.
the test fixtures:
mixed-keys.test.js
console.log({
['foo#']:'value',
});
- Error logs from your console when invoking Rollup with this plugin present.
Unhandled rejection in test/literal-computed-keys/mixed-keys.test.js
/Users/icyflzhang/Documents/web/rollup-plugin-closure-compiler/node_modules/acorn/dist/acorn.js:2927
SyntaxError: Unexpected character '#' (1:54)
Parser.pp$4.raise (node_modules/acorn/dist/acorn.js:2927:15)
Parser.pp$9.getTokenFromCode (node_modules/acorn/dist/acorn.js:4695:10)
Parser.pp$9.readToken (node_modules/acorn/dist/acorn.js:4409:17)
Parser.pp$9.nextToken (node_modules/acorn/dist/acorn.js:4400:17)
Parser.pp$9.next (node_modules/acorn/dist/acorn.js:4357:10)
Parser.pp$3.parseIdent (node_modules/acorn/dist/acorn.js:2880:10)
Parser.pp$3.parsePropertyName (node_modules/acorn/dist/acorn.js:2686:107)
Parser.pp$3.parseProperty (node_modules/acorn/dist/acorn.js:2613:10)
Parser.pp$3.parseObj (node_modules/acorn/dist/acorn.js:2567:23)
Parser.pp$3.parseExprAtom (node_modules/acorn/dist/acorn.js:2302:19)
If this is a feature request you can use this section to point to a prototype/mockup that will help us understand the request.
Additional context
This is because LiteralComputedKeys
transformer use property.key.value
, which strip off quotation marks.
Could we use property.key.raw
instead when present?
Metadata
Assignees
Labels
No labels
Activity