@lwc/template-compiler 2.6.1 → 2.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -26,10 +26,10 @@ exports.parseIdentifier = exports.parseExpression = exports.isPotentialExpressio
|
|
|
26
26
|
* SPDX-License-Identifier: MIT
|
|
27
27
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
28
28
|
*/
|
|
29
|
-
const esutils = __importStar(require("esutils"));
|
|
30
29
|
const acorn_1 = require("acorn");
|
|
31
30
|
const errors_1 = require("@lwc/errors");
|
|
32
31
|
const t = __importStar(require("../shared/estree"));
|
|
32
|
+
const javascript_1 = require("./utils/javascript");
|
|
33
33
|
exports.EXPRESSION_SYMBOL_START = '{';
|
|
34
34
|
exports.EXPRESSION_SYMBOL_END = '}';
|
|
35
35
|
const VALID_EXPRESSION_RE = /^{.+}$/;
|
|
@@ -97,7 +97,12 @@ function parseExpression(ctx, source, location) {
|
|
|
97
97
|
}
|
|
98
98
|
exports.parseExpression = parseExpression;
|
|
99
99
|
function parseIdentifier(ctx, source, location) {
|
|
100
|
-
|
|
100
|
+
let isValid = true;
|
|
101
|
+
isValid = (0, acorn_1.isIdentifierStart)(source.charCodeAt(0));
|
|
102
|
+
for (let i = 1; i < source.length && isValid; i++) {
|
|
103
|
+
isValid = (0, acorn_1.isIdentifierChar)(source.charCodeAt(i));
|
|
104
|
+
}
|
|
105
|
+
if (isValid && !(0, javascript_1.isReservedES6Keyword)(source)) {
|
|
101
106
|
return t.identifier(source);
|
|
102
107
|
}
|
|
103
108
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expression.js","sourceRoot":"","sources":["../../../src/parser/expression.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;GAKG;AACH,
|
|
1
|
+
{"version":3,"file":"expression.js","sourceRoot":"","sources":["../../../src/parser/expression.ts"],"names":[],"mappings":";;;;;;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+
* All rights reserved.
|
|
5
|
+
* SPDX-License-Identifier: MIT
|
|
6
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.isReservedES6Keyword = void 0;
|
|
10
|
+
// https://262.ecma-international.org/12.0/#sec-keywords-and-reserved-words
|
|
11
|
+
// prettier-ignore
|
|
12
|
+
const REVERSED_KEYWORDS = new Set([
|
|
13
|
+
// Reserved keywords
|
|
14
|
+
'await', 'break', 'case', 'catch', 'class', 'const', 'continue', 'debugger', 'default', 'delete',
|
|
15
|
+
'do', 'else', 'enum', 'export', 'extends', 'false', 'finally', 'for', 'function', 'if', 'import',
|
|
16
|
+
'in', 'instanceof', 'new', 'null', 'return', 'super', 'switch', 'this', 'throw', 'true', 'try',
|
|
17
|
+
'typeof', 'var', 'void', 'while', 'with', 'yield',
|
|
18
|
+
// Strict mode only reserved keywords
|
|
19
|
+
'let', 'static', 'implements', 'interface', 'package', 'private', 'protected', 'public'
|
|
20
|
+
]);
|
|
21
|
+
function isReservedES6Keyword(str) {
|
|
22
|
+
return REVERSED_KEYWORDS.has(str);
|
|
23
|
+
}
|
|
24
|
+
exports.isReservedES6Keyword = isReservedES6Keyword;
|
|
25
|
+
//# sourceMappingURL=javascript.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"javascript.js","sourceRoot":"","sources":["../../../../src/parser/utils/javascript.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,2EAA2E;AAC3E,kBAAkB;AAClB,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC;IAC9B,oBAAoB;IACpB,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ;IAChG,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ;IAChG,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK;IAC9F,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO;IAEjD,qCAAqC;IACrC,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ;CAC1F,CAAC,CAAC;AAEH,SAAgB,oBAAoB,CAAC,GAAW;IAC5C,OAAO,iBAAiB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACtC,CAAC;AAFD,oDAEC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isReservedES6Keyword(str: string): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lwc/template-compiler",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.2",
|
|
4
4
|
"description": "Template compiler package",
|
|
5
5
|
"homepage": "https://lwc.dev/",
|
|
6
6
|
"repository": {
|
|
@@ -25,12 +25,11 @@
|
|
|
25
25
|
},
|
|
26
26
|
"//": "Currently can't upgrade estree-walker to v3.0.0 because it dropped CommonJS support: https://git.io/JXguS",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@lwc/errors": "2.
|
|
29
|
-
"@lwc/shared": "2.
|
|
30
|
-
"acorn": "~8.
|
|
28
|
+
"@lwc/errors": "2.7.2",
|
|
29
|
+
"@lwc/shared": "2.7.2",
|
|
30
|
+
"acorn": "~8.7.0",
|
|
31
31
|
"astring": "~1.8.1",
|
|
32
32
|
"estree-walker": "~2.0.2",
|
|
33
|
-
"esutils": "~2.0.3",
|
|
34
33
|
"he": "~1.2.0",
|
|
35
34
|
"parse5": "~6.0.1"
|
|
36
35
|
},
|
|
@@ -40,5 +39,5 @@
|
|
|
40
39
|
"publishConfig": {
|
|
41
40
|
"access": "public"
|
|
42
41
|
},
|
|
43
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "f668a3ad36bbebbaa33a5863408a45bf4185d218"
|
|
44
43
|
}
|