@vue-vine/eslint-parser 0.1.32 → 0.2.0
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.
- package/dist/index.d.mts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +180 -239
- package/dist/index.mjs +178 -237
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -2340,32 +2340,6 @@ var require_sortedLastIndex = __commonJS({
|
|
2340
2340
|
}
|
2341
2341
|
});
|
2342
2342
|
|
2343
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/sortedIndexBy.js
|
2344
|
-
var require_sortedIndexBy = __commonJS({
|
2345
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/sortedIndexBy.js"(exports, module) {
|
2346
|
-
"use strict";
|
2347
|
-
var baseIteratee = require_baseIteratee();
|
2348
|
-
var baseSortedIndexBy = require_baseSortedIndexBy();
|
2349
|
-
function sortedIndexBy4(array, value, iteratee) {
|
2350
|
-
return baseSortedIndexBy(array, value, baseIteratee(iteratee, 2));
|
2351
|
-
}
|
2352
|
-
module.exports = sortedIndexBy4;
|
2353
|
-
}
|
2354
|
-
});
|
2355
|
-
|
2356
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/sortedLastIndexBy.js
|
2357
|
-
var require_sortedLastIndexBy = __commonJS({
|
2358
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/sortedLastIndexBy.js"(exports, module) {
|
2359
|
-
"use strict";
|
2360
|
-
var baseIteratee = require_baseIteratee();
|
2361
|
-
var baseSortedIndexBy = require_baseSortedIndexBy();
|
2362
|
-
function sortedLastIndexBy2(array, value, iteratee) {
|
2363
|
-
return baseSortedIndexBy(array, value, baseIteratee(iteratee, 2), true);
|
2364
|
-
}
|
2365
|
-
module.exports = sortedLastIndexBy2;
|
2366
|
-
}
|
2367
|
-
});
|
2368
|
-
|
2369
2343
|
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/head.js
|
2370
2344
|
var require_head = __commonJS({
|
2371
2345
|
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/head.js"(exports, module) {
|
@@ -2385,6 +2359,19 @@ var require_first = __commonJS({
|
|
2385
2359
|
}
|
2386
2360
|
});
|
2387
2361
|
|
2362
|
+
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/sortedIndexBy.js
|
2363
|
+
var require_sortedIndexBy = __commonJS({
|
2364
|
+
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/sortedIndexBy.js"(exports, module) {
|
2365
|
+
"use strict";
|
2366
|
+
var baseIteratee = require_baseIteratee();
|
2367
|
+
var baseSortedIndexBy = require_baseSortedIndexBy();
|
2368
|
+
function sortedIndexBy2(array, value, iteratee) {
|
2369
|
+
return baseSortedIndexBy(array, value, baseIteratee(iteratee, 2));
|
2370
|
+
}
|
2371
|
+
module.exports = sortedIndexBy2;
|
2372
|
+
}
|
2373
|
+
});
|
2374
|
+
|
2388
2375
|
// src/parse.ts
|
2389
2376
|
var _parser = require('@typescript-eslint/parser');
|
2390
2377
|
|
@@ -3858,24 +3845,12 @@ var IntermediateTokenizer = class {
|
|
3858
3845
|
};
|
3859
3846
|
|
3860
3847
|
// src/common/error-utils.ts
|
3861
|
-
var import_sortedIndexBy = __toESM(require_sortedIndexBy());
|
3862
|
-
function byIndex(x) {
|
3863
|
-
return x.index;
|
3864
|
-
}
|
3865
3848
|
function insertError(templateMeta, error) {
|
3866
|
-
const index =
|
3849
|
+
const index = templateMeta.errors.findIndex((e) => e.index === error.index);
|
3867
3850
|
templateMeta.errors.splice(index, 0, error);
|
3868
3851
|
}
|
3869
3852
|
|
3870
3853
|
// src/common/token-utils.ts
|
3871
|
-
var import_sortedIndexBy2 = __toESM(require_sortedIndexBy());
|
3872
|
-
var import_sortedLastIndexBy = __toESM(require_sortedLastIndexBy());
|
3873
|
-
function byRange0(x) {
|
3874
|
-
return x.range[0];
|
3875
|
-
}
|
3876
|
-
function byRange1(x) {
|
3877
|
-
return x.range[1];
|
3878
|
-
}
|
3879
3854
|
function createSimpleToken(type, start, end, value, linesAndColumns) {
|
3880
3855
|
return {
|
3881
3856
|
type,
|
@@ -3891,144 +3866,22 @@ function insertComments(templateMeta, newComments) {
|
|
3891
3866
|
if (newComments.length === 0) {
|
3892
3867
|
return;
|
3893
3868
|
}
|
3894
|
-
const index =
|
3869
|
+
const index = templateMeta.comments.findIndex((comment) => comment.range[0] === newComments[0].range[0]);
|
3895
3870
|
templateMeta.comments.splice(index, 0, ...newComments);
|
3896
3871
|
}
|
3897
3872
|
function replaceTokens(templateMeta, node, newTokens) {
|
3898
|
-
const index =
|
3899
|
-
const count =
|
3873
|
+
const index = templateMeta.tokens.findIndex((token) => token.range[0] === node.range[0]);
|
3874
|
+
const count = templateMeta.tokens.findIndex((token) => token.range[1] === node.range[1]) - index + 1;
|
3900
3875
|
templateMeta.tokens.splice(index, count, ...newTokens);
|
3901
3876
|
}
|
3902
3877
|
|
3903
3878
|
// src/script/index.ts
|
3904
3879
|
var import_first = __toESM(require_first());
|
3905
3880
|
var import_last2 = __toESM(require_last());
|
3906
|
-
var
|
3881
|
+
var import_sortedIndexBy = __toESM(require_sortedIndexBy());
|
3907
3882
|
|
3908
3883
|
|
3909
|
-
// src/template/utils/process-vine-template-node.ts
|
3910
|
-
var _typescriptestree = require('@typescript-eslint/typescript-estree');
|
3911
|
-
function fixVineOffset(token, fixCtx) {
|
3912
|
-
const {
|
3913
|
-
posInfo: {
|
3914
|
-
templateStartOffset,
|
3915
|
-
templateStartLine,
|
3916
|
-
templateStartColumn
|
3917
|
-
},
|
3918
|
-
fixedCache: cache
|
3919
|
-
} = fixCtx;
|
3920
|
-
if (token.type !== "VTemplateRoot") {
|
3921
|
-
if (!cache.has(token.range)) {
|
3922
|
-
token.range[0] += templateStartOffset;
|
3923
|
-
token.range[1] += templateStartOffset;
|
3924
|
-
cache.add(token.range);
|
3925
|
-
}
|
3926
|
-
if (!cache.has(token.loc.start)) {
|
3927
|
-
token.loc.start.line += templateStartLine - 1;
|
3928
|
-
token.loc.start.column = token.loc.start.line === templateStartLine ? templateStartColumn + token.loc.start.column : token.loc.start.column;
|
3929
|
-
cache.add(token.loc.start);
|
3930
|
-
}
|
3931
|
-
if (!cache.has(token.loc.end)) {
|
3932
|
-
token.loc.end.line += templateStartLine - 1;
|
3933
|
-
token.loc.end.column = token.loc.end.line === templateStartLine ? templateStartColumn + token.loc.end.column : token.loc.end.column;
|
3934
|
-
cache.add(token.loc.end);
|
3935
|
-
}
|
3936
|
-
}
|
3937
|
-
}
|
3938
|
-
function extractForVineTemplate(ast) {
|
3939
|
-
const extractVineTemplateResult = [];
|
3940
|
-
const extractedTemplateNodes = /* @__PURE__ */ new WeakSet();
|
3941
|
-
try {
|
3942
|
-
_typescriptestree.simpleTraverse.call(void 0, ast, {
|
3943
|
-
enter(node, parent) {
|
3944
|
-
if (node.type === "TaggedTemplateExpression" && node.tag.type === "Identifier" && node.tag.name === "vine") {
|
3945
|
-
const templateNode = node;
|
3946
|
-
if (extractedTemplateNodes.has(templateNode)) {
|
3947
|
-
return;
|
3948
|
-
}
|
3949
|
-
extractedTemplateNodes.add(templateNode);
|
3950
|
-
let parentOfTemplate;
|
3951
|
-
let bindVineTemplateESTree;
|
3952
|
-
if (_optionalChain([parent, 'optionalAccess', _14 => _14.type]) === _typescriptestree.TSESTree.AST_NODE_TYPES.ReturnStatement) {
|
3953
|
-
parent.argument = null;
|
3954
|
-
parentOfTemplate = parent;
|
3955
|
-
bindVineTemplateESTree = ({ templateRootAST: vineESTree, templateMeta: _, ...templateInfo }) => {
|
3956
|
-
parent.argument = vineESTree;
|
3957
|
-
vineESTree.parent = parent;
|
3958
|
-
vineESTree.templateInfo = templateInfo;
|
3959
|
-
};
|
3960
|
-
} else if (_optionalChain([parent, 'optionalAccess', _15 => _15.type]) === _typescriptestree.TSESTree.AST_NODE_TYPES.ArrowFunctionExpression) {
|
3961
|
-
parent.body = null;
|
3962
|
-
parentOfTemplate = parent;
|
3963
|
-
bindVineTemplateESTree = ({ templateRootAST: vineESTree, templateMeta: _, ...templateInfo }) => {
|
3964
|
-
parent.body = vineESTree;
|
3965
|
-
vineESTree.parent = parent;
|
3966
|
-
vineESTree.templateInfo = templateInfo;
|
3967
|
-
};
|
3968
|
-
}
|
3969
|
-
ast.tokens = _optionalChain([ast, 'access', _16 => _16.tokens, 'optionalAccess', _17 => _17.filter, 'call', _18 => _18(
|
3970
|
-
(token) => token.range[0] < node.range[0] || token.range[1] > node.range[1]
|
3971
|
-
)]);
|
3972
|
-
if (parentOfTemplate && bindVineTemplateESTree) {
|
3973
|
-
extractVineTemplateResult.push({
|
3974
|
-
templateNode,
|
3975
|
-
parentOfTemplate,
|
3976
|
-
bindVineTemplateESTree
|
3977
|
-
});
|
3978
|
-
}
|
3979
|
-
}
|
3980
|
-
}
|
3981
|
-
}, true);
|
3982
|
-
} catch (err) {
|
3983
|
-
if (!(err instanceof Error) || err.message !== "BREAK_TRAVERSE") {
|
3984
|
-
throw err;
|
3985
|
-
}
|
3986
|
-
}
|
3987
|
-
return extractVineTemplateResult;
|
3988
|
-
}
|
3989
|
-
function prepareTemplate(templateNode) {
|
3990
|
-
const { quasi: { quasis } } = templateNode;
|
3991
|
-
const templateRawNode = quasis[0];
|
3992
|
-
const templateRawContent = templateRawNode.value.raw;
|
3993
|
-
const templateStartLine = templateRawNode.loc.start.line;
|
3994
|
-
const templateEndLine = templateRawNode.loc.end.line;
|
3995
|
-
const templateStartColumn = templateRawNode.loc.start.column + 1;
|
3996
|
-
const templateStartOffset = templateRawNode.range[0] + 1;
|
3997
|
-
const templateEndColumn = templateRawNode.loc.end.column - 1;
|
3998
|
-
const templateEndOffset = templateRawNode.range[1] - 1;
|
3999
|
-
return {
|
4000
|
-
templatePositionInfo: {
|
4001
|
-
templateStartLine,
|
4002
|
-
templateStartColumn,
|
4003
|
-
templateStartOffset,
|
4004
|
-
templateEndOffset,
|
4005
|
-
templateEndLine,
|
4006
|
-
templateEndColumn
|
4007
|
-
},
|
4008
|
-
templateRawContent
|
4009
|
-
};
|
4010
|
-
}
|
4011
|
-
|
4012
3884
|
// src/common/fix-locations.ts
|
4013
|
-
function fixVineOffsetForScript(result, vineFixLocationContext) {
|
4014
|
-
const traversed = /* @__PURE__ */ new WeakSet();
|
4015
|
-
traverseNodes(result.ast, {
|
4016
|
-
visitorKeys: result.visitorKeys,
|
4017
|
-
enterNode(node) {
|
4018
|
-
if (!traversed.has(node)) {
|
4019
|
-
fixVineOffset(node, vineFixLocationContext);
|
4020
|
-
}
|
4021
|
-
},
|
4022
|
-
leaveNode() {
|
4023
|
-
}
|
4024
|
-
});
|
4025
|
-
for (const token of result.ast.tokens || []) {
|
4026
|
-
fixVineOffset(token, vineFixLocationContext);
|
4027
|
-
}
|
4028
|
-
for (const comment of result.ast.comments || []) {
|
4029
|
-
fixVineOffset(comment, vineFixLocationContext);
|
4030
|
-
}
|
4031
|
-
}
|
4032
3885
|
function fixLocations(result, locationCalculator) {
|
4033
3886
|
fixNodeLocations(result.ast, result.visitorKeys, locationCalculator);
|
4034
3887
|
for (const token of result.ast.tokens || []) {
|
@@ -4141,7 +3994,7 @@ function processVForAliasAndIterator(code) {
|
|
4141
3994
|
};
|
4142
3995
|
}
|
4143
3996
|
function getCommaTokenBeforeNode(tokens, node) {
|
4144
|
-
let tokenIndex = (0,
|
3997
|
+
let tokenIndex = (0, import_sortedIndexBy.default)(
|
4145
3998
|
tokens,
|
4146
3999
|
{ range: node.range },
|
4147
4000
|
(t) => t.range[0]
|
@@ -4186,14 +4039,13 @@ function throwErrorAsAdjustingOutsideOfCode(err, code, locationCalculator) {
|
|
4186
4039
|
}
|
4187
4040
|
throw err;
|
4188
4041
|
}
|
4189
|
-
function parseScriptFragment(code, locationCalculator,
|
4042
|
+
function parseScriptFragment(code, locationCalculator, parserOptions) {
|
4190
4043
|
try {
|
4191
4044
|
const result = parseScript(
|
4192
4045
|
code,
|
4193
4046
|
parserOptions
|
4194
4047
|
);
|
4195
4048
|
fixLocations(result, locationCalculator);
|
4196
|
-
fixVineOffsetForScript(result, vineFixLocationContext);
|
4197
4049
|
return result;
|
4198
4050
|
} catch (err) {
|
4199
4051
|
const perr = ParseError.normalize(err);
|
@@ -4287,13 +4139,12 @@ function splitFilters(exp) {
|
|
4287
4139
|
result.push(exp.slice(lastFilterIndex));
|
4288
4140
|
return result;
|
4289
4141
|
}
|
4290
|
-
function parseExpressionBody(code, locationCalculator,
|
4142
|
+
function parseExpressionBody(code, locationCalculator, parserOptions, allowEmpty = false) {
|
4291
4143
|
debug('[script] parse expression: "0(%s)"', code);
|
4292
4144
|
try {
|
4293
4145
|
const result = parseScriptFragment(
|
4294
4146
|
`0(${code})`,
|
4295
4147
|
locationCalculator.getSubCalculatorShift(-2),
|
4296
|
-
vineFixLocationContext,
|
4297
4148
|
parserOptions
|
4298
4149
|
);
|
4299
4150
|
const { ast } = result;
|
@@ -4319,13 +4170,12 @@ function parseExpressionBody(code, locationCalculator, vineFixLocationContext, p
|
|
4319
4170
|
tokens.shift();
|
4320
4171
|
tokens.shift();
|
4321
4172
|
tokens.pop();
|
4322
|
-
fixVineOffset(expression, vineFixLocationContext);
|
4323
4173
|
return { expression, tokens, comments, references, variables: [] };
|
4324
4174
|
} catch (err) {
|
4325
4175
|
return throwErrorAsAdjustingOutsideOfCode(err, code, locationCalculator);
|
4326
4176
|
}
|
4327
4177
|
}
|
4328
|
-
function parseFilter(code, locationCalculator,
|
4178
|
+
function parseFilter(code, locationCalculator, parserOptions) {
|
4329
4179
|
debug('[script] parse filter: "%s"', code);
|
4330
4180
|
try {
|
4331
4181
|
const expression = {
|
@@ -4350,7 +4200,6 @@ function parseFilter(code, locationCalculator, vineFixLocationContext, parserOpt
|
|
4350
4200
|
const { ast } = parseScriptFragment(
|
4351
4201
|
`"${calleeCode.trim()}"`,
|
4352
4202
|
subCalculator,
|
4353
|
-
vineFixLocationContext,
|
4354
4203
|
parserOptions
|
4355
4204
|
);
|
4356
4205
|
const statement = ast.body[0];
|
@@ -4394,7 +4243,6 @@ function parseFilter(code, locationCalculator, vineFixLocationContext, parserOpt
|
|
4394
4243
|
const result = parseScriptFragment(
|
4395
4244
|
`0${argsCode}`,
|
4396
4245
|
locationCalculator.getSubCalculatorAfter(paren).getSubCalculatorShift(-1),
|
4397
|
-
vineFixLocationContext,
|
4398
4246
|
parserOptions
|
4399
4247
|
);
|
4400
4248
|
const { ast } = result;
|
@@ -4451,14 +4299,13 @@ function parseScript(code, parserOptions) {
|
|
4451
4299
|
}
|
4452
4300
|
return { ast: result };
|
4453
4301
|
}
|
4454
|
-
function parseExpression(code, locationCalculator,
|
4302
|
+
function parseExpression(code, locationCalculator, parserOptions, { allowEmpty = false, allowFilters = false } = {}) {
|
4455
4303
|
debug('[script] parse expression: "%s"', code);
|
4456
4304
|
const [mainCode, ...filterCodes] = allowFilters ? splitFilters(code) : [code];
|
4457
4305
|
if (filterCodes.length === 0) {
|
4458
4306
|
return parseExpressionBody(
|
4459
4307
|
code,
|
4460
4308
|
locationCalculator,
|
4461
|
-
vineFixLocationContext,
|
4462
4309
|
parserOptions,
|
4463
4310
|
allowEmpty
|
4464
4311
|
);
|
@@ -4466,7 +4313,6 @@ function parseExpression(code, locationCalculator, vineFixLocationContext, parse
|
|
4466
4313
|
const retB = parseExpressionBody(
|
4467
4314
|
mainCode,
|
4468
4315
|
locationCalculator,
|
4469
|
-
vineFixLocationContext,
|
4470
4316
|
parserOptions
|
4471
4317
|
);
|
4472
4318
|
if (!retB.expression) {
|
@@ -4498,7 +4344,6 @@ function parseExpression(code, locationCalculator, vineFixLocationContext, parse
|
|
4498
4344
|
const retF = parseFilter(
|
4499
4345
|
filterCode,
|
4500
4346
|
locationCalculator.getSubCalculatorShift(prevLoc + 1),
|
4501
|
-
vineFixLocationContext,
|
4502
4347
|
parserOptions
|
4503
4348
|
);
|
4504
4349
|
if (retF) {
|
@@ -4517,7 +4362,7 @@ function parseExpression(code, locationCalculator, vineFixLocationContext, parse
|
|
4517
4362
|
ret.expression.loc.end = lastToken.loc.end;
|
4518
4363
|
return ret;
|
4519
4364
|
}
|
4520
|
-
function parseVForExpression(code, locationCalculator,
|
4365
|
+
function parseVForExpression(code, locationCalculator, parserOptions) {
|
4521
4366
|
if (code.trim() === "") {
|
4522
4367
|
throwEmptyError(locationCalculator, "'<alias> in <expression>'");
|
4523
4368
|
}
|
@@ -4525,7 +4370,6 @@ function parseVForExpression(code, locationCalculator, vineFixLocationContext, p
|
|
4525
4370
|
return parseVForExpressionForEcmaVersion5(
|
4526
4371
|
code,
|
4527
4372
|
locationCalculator,
|
4528
|
-
vineFixLocationContext,
|
4529
4373
|
parserOptions
|
4530
4374
|
);
|
4531
4375
|
}
|
@@ -4545,7 +4389,6 @@ function parseVForExpression(code, locationCalculator, vineFixLocationContext, p
|
|
4545
4389
|
locationCalculator.getSubCalculatorShift(
|
4546
4390
|
processed.hasParens ? -8 : -9
|
4547
4391
|
),
|
4548
|
-
vineFixLocationContext,
|
4549
4392
|
parserOptions
|
4550
4393
|
);
|
4551
4394
|
const { ast } = result;
|
@@ -4602,7 +4445,6 @@ function parseVForExpression(code, locationCalculator, vineFixLocationContext, p
|
|
4602
4445
|
}
|
4603
4446
|
}
|
4604
4447
|
right.parent = expression;
|
4605
|
-
fixVineOffset(expression, vineFixLocationContext);
|
4606
4448
|
return { expression, tokens, comments, references, variables };
|
4607
4449
|
} catch (err) {
|
4608
4450
|
return throwErrorAsAdjustingOutsideOfCode(err, code, locationCalculator);
|
@@ -4612,7 +4454,7 @@ function isEcmaVersion5(parserOptions) {
|
|
4612
4454
|
const ecmaVersion = getEcmaVersionIfUseEspree(parserOptions);
|
4613
4455
|
return ecmaVersion != null && ecmaVersion <= 5;
|
4614
4456
|
}
|
4615
|
-
function parseVForExpressionForEcmaVersion5(code, locationCalculator,
|
4457
|
+
function parseVForExpressionForEcmaVersion5(code, locationCalculator, parserOptions) {
|
4616
4458
|
const processed = processVForAliasAndIterator(code);
|
4617
4459
|
if (!processed.aliases.trim()) {
|
4618
4460
|
return throwEmptyError(locationCalculator, "an alias");
|
@@ -4625,7 +4467,6 @@ function parseVForExpressionForEcmaVersion5(code, locationCalculator, vineFixLoc
|
|
4625
4467
|
locationCalculator.getSubCalculatorShift(
|
4626
4468
|
processed.hasParens ? 0 : -1
|
4627
4469
|
),
|
4628
|
-
vineFixLocationContext,
|
4629
4470
|
parserOptions
|
4630
4471
|
);
|
4631
4472
|
if (processed.hasParens) {
|
@@ -4665,7 +4506,6 @@ function parseVForExpressionForEcmaVersion5(code, locationCalculator, vineFixLoc
|
|
4665
4506
|
const parsedIterator = parseVForIteratorForEcmaVersion5(
|
4666
4507
|
processed.iterator,
|
4667
4508
|
locationCalculator.getSubCalculatorShift(delimiterEnd),
|
4668
|
-
vineFixLocationContext,
|
4669
4509
|
parserOptions
|
4670
4510
|
);
|
4671
4511
|
tokens.push(...parsedIterator.tokens);
|
@@ -4692,11 +4532,10 @@ function parseVForExpressionForEcmaVersion5(code, locationCalculator, vineFixLoc
|
|
4692
4532
|
return throwErrorAsAdjustingOutsideOfCode(err, code, locationCalculator);
|
4693
4533
|
}
|
4694
4534
|
}
|
4695
|
-
function parseVForAliasesForEcmaVersion5(code, locationCalculator,
|
4535
|
+
function parseVForAliasesForEcmaVersion5(code, locationCalculator, parserOptions) {
|
4696
4536
|
const result = parseScriptFragment(
|
4697
4537
|
`0(${code})`,
|
4698
4538
|
locationCalculator.getSubCalculatorShift(-2),
|
4699
|
-
vineFixLocationContext,
|
4700
4539
|
parserOptions
|
4701
4540
|
);
|
4702
4541
|
const { ast } = result;
|
@@ -4733,11 +4572,10 @@ function parseVForAliasesForEcmaVersion5(code, locationCalculator, vineFixLocati
|
|
4733
4572
|
return ret;
|
4734
4573
|
}
|
4735
4574
|
}
|
4736
|
-
function parseVForIteratorForEcmaVersion5(code, locationCalculator,
|
4575
|
+
function parseVForIteratorForEcmaVersion5(code, locationCalculator, parserOptions) {
|
4737
4576
|
const result = parseScriptFragment(
|
4738
4577
|
`0(${code})`,
|
4739
4578
|
locationCalculator.getSubCalculatorShift(-2),
|
4740
|
-
vineFixLocationContext,
|
4741
4579
|
parserOptions
|
4742
4580
|
);
|
4743
4581
|
const { ast } = result;
|
@@ -4759,23 +4597,21 @@ function parseVForIteratorForEcmaVersion5(code, locationCalculator, vineFixLocat
|
|
4759
4597
|
tokens.pop();
|
4760
4598
|
return { right, tokens, comments, references };
|
4761
4599
|
}
|
4762
|
-
function parseVOnExpression(code, locationCalculator,
|
4600
|
+
function parseVOnExpression(code, locationCalculator, parserOptions) {
|
4763
4601
|
if (IS_FUNCTION_EXPRESSION.test(code) || IS_SIMPLE_PATH.test(code)) {
|
4764
4602
|
return parseExpressionBody(
|
4765
4603
|
code,
|
4766
4604
|
locationCalculator,
|
4767
|
-
vineFixLocationContext,
|
4768
4605
|
parserOptions
|
4769
4606
|
);
|
4770
4607
|
}
|
4771
4608
|
return parseVOnExpressionBody(
|
4772
4609
|
code,
|
4773
4610
|
locationCalculator,
|
4774
|
-
vineFixLocationContext,
|
4775
4611
|
parserOptions
|
4776
4612
|
);
|
4777
4613
|
}
|
4778
|
-
function parseVOnExpressionBody(code, locationCalculator,
|
4614
|
+
function parseVOnExpressionBody(code, locationCalculator, parserOptions) {
|
4779
4615
|
debug('[script] parse v-on expression: "void function($event){%s}"', code);
|
4780
4616
|
if (code.trim() === "") {
|
4781
4617
|
throwEmptyError(locationCalculator, "statements");
|
@@ -4784,7 +4620,6 @@ function parseVOnExpressionBody(code, locationCalculator, vineFixLocationContext
|
|
4784
4620
|
const result = parseScriptFragment(
|
4785
4621
|
`void function($event){${code}}`,
|
4786
4622
|
locationCalculator.getSubCalculatorShift(-22),
|
4787
|
-
vineFixLocationContext,
|
4788
4623
|
parserOptions
|
4789
4624
|
);
|
4790
4625
|
const { ast } = result;
|
@@ -4815,13 +4650,12 @@ function parseVOnExpressionBody(code, locationCalculator, vineFixLocationContext
|
|
4815
4650
|
}
|
4816
4651
|
tokens.splice(0, 6);
|
4817
4652
|
tokens.pop();
|
4818
|
-
fixVineOffset(expression, vineFixLocationContext);
|
4819
4653
|
return { expression, tokens, comments, references, variables: [] };
|
4820
4654
|
} catch (err) {
|
4821
4655
|
return throwErrorAsAdjustingOutsideOfCode(err, code, locationCalculator);
|
4822
4656
|
}
|
4823
4657
|
}
|
4824
|
-
function parseSlotScopeExpression(code, locationCalculator,
|
4658
|
+
function parseSlotScopeExpression(code, locationCalculator, parserOptions) {
|
4825
4659
|
debug('[script] parse slot-scope expression: "void function(%s) {}"', code);
|
4826
4660
|
if (code.trim() === "") {
|
4827
4661
|
throwEmptyError(
|
@@ -4833,7 +4667,6 @@ function parseSlotScopeExpression(code, locationCalculator, vineFixLocationConte
|
|
4833
4667
|
const result = parseScriptFragment(
|
4834
4668
|
`void function(${code}) {}`,
|
4835
4669
|
locationCalculator.getSubCalculatorShift(-14),
|
4836
|
-
vineFixLocationContext,
|
4837
4670
|
parserOptions
|
4838
4671
|
);
|
4839
4672
|
const { ast } = result;
|
@@ -4906,7 +4739,7 @@ function getStandardDirectiveKind(element, directiveKey) {
|
|
4906
4739
|
}
|
4907
4740
|
return null;
|
4908
4741
|
}
|
4909
|
-
function parseAttributeValue(code, parserOptions, globalLocationCalculator,
|
4742
|
+
function parseAttributeValue(code, parserOptions, globalLocationCalculator, node, element, directiveKey) {
|
4910
4743
|
const firstChar = code[node.range[0]];
|
4911
4744
|
const quoted = firstChar === '"' || firstChar === "'";
|
4912
4745
|
const locationCalculator = globalLocationCalculator.getSubCalculatorAfter(
|
@@ -4929,28 +4762,24 @@ function parseAttributeValue(code, parserOptions, globalLocationCalculator, vine
|
|
4929
4762
|
result = parseVForExpression(
|
4930
4763
|
node.value,
|
4931
4764
|
locationCalculator,
|
4932
|
-
vineFixLocationContext,
|
4933
4765
|
parserOptions
|
4934
4766
|
);
|
4935
4767
|
} else if (directiveKind === "on" && directiveKey.argument != null) {
|
4936
4768
|
result = parseVOnExpression(
|
4937
4769
|
node.value,
|
4938
4770
|
locationCalculator,
|
4939
|
-
vineFixLocationContext,
|
4940
4771
|
parserOptions
|
4941
4772
|
);
|
4942
4773
|
} else if (directiveKind === "slot") {
|
4943
4774
|
result = parseSlotScopeExpression(
|
4944
4775
|
node.value,
|
4945
4776
|
locationCalculator,
|
4946
|
-
vineFixLocationContext,
|
4947
4777
|
parserOptions
|
4948
4778
|
);
|
4949
4779
|
} else if (directiveKind === "bind") {
|
4950
4780
|
result = parseExpression(
|
4951
4781
|
node.value,
|
4952
4782
|
locationCalculator,
|
4953
|
-
vineFixLocationContext,
|
4954
4783
|
parserOptions,
|
4955
4784
|
{ allowFilters: true }
|
4956
4785
|
);
|
@@ -4958,7 +4787,6 @@ function parseAttributeValue(code, parserOptions, globalLocationCalculator, vine
|
|
4958
4787
|
result = parseExpression(
|
4959
4788
|
node.value,
|
4960
4789
|
locationCalculator,
|
4961
|
-
vineFixLocationContext,
|
4962
4790
|
parserOptions
|
4963
4791
|
);
|
4964
4792
|
}
|
@@ -4984,7 +4812,7 @@ function parseAttributeValue(code, parserOptions, globalLocationCalculator, vine
|
|
4984
4812
|
}
|
4985
4813
|
return result;
|
4986
4814
|
}
|
4987
|
-
function parseDirectiveKeyStatically(node, templateMeta
|
4815
|
+
function parseDirectiveKeyStatically(node, templateMeta) {
|
4988
4816
|
const {
|
4989
4817
|
name: text,
|
4990
4818
|
rawName: rawText,
|
@@ -5002,9 +4830,8 @@ function parseDirectiveKeyStatically(node, templateMeta, vineFixLocationContext)
|
|
5002
4830
|
argument: null,
|
5003
4831
|
modifiers: []
|
5004
4832
|
};
|
5005
|
-
fixVineOffset(directiveKey, vineFixLocationContext);
|
5006
4833
|
let i = 0;
|
5007
|
-
function createIdentifier(
|
4834
|
+
function createIdentifier(start, end, name) {
|
5008
4835
|
const id = {
|
5009
4836
|
type: "VIdentifier",
|
5010
4837
|
parent: directiveKey,
|
@@ -5016,29 +4843,28 @@ function parseDirectiveKeyStatically(node, templateMeta, vineFixLocationContext)
|
|
5016
4843
|
name: name || text.slice(start, end),
|
5017
4844
|
rawName: rawText.slice(start, end)
|
5018
4845
|
};
|
5019
|
-
fixVineOffset(id, vineFixLocationContext2);
|
5020
4846
|
return id;
|
5021
4847
|
}
|
5022
4848
|
if (shorthandSign.test(text)) {
|
5023
4849
|
const sign = text[0];
|
5024
|
-
directiveKey.name = createIdentifier(
|
4850
|
+
directiveKey.name = createIdentifier(0, 1, shorthandNameMap[sign]);
|
5025
4851
|
i = 1;
|
5026
4852
|
} else {
|
5027
4853
|
const colon = text.indexOf(":");
|
5028
4854
|
if (colon !== -1) {
|
5029
|
-
directiveKey.name = createIdentifier(
|
4855
|
+
directiveKey.name = createIdentifier(0, colon);
|
5030
4856
|
i = colon + 1;
|
5031
4857
|
}
|
5032
4858
|
}
|
5033
4859
|
if (directiveKey.name != null && text[i] === "[") {
|
5034
4860
|
const len = text.slice(i).lastIndexOf("]");
|
5035
4861
|
if (len !== -1) {
|
5036
|
-
directiveKey.argument = createIdentifier(
|
4862
|
+
directiveKey.argument = createIdentifier(i, i + len + 1);
|
5037
4863
|
i = i + len + 1 + (text[i + len + 1] === "." ? 1 : 0);
|
5038
4864
|
}
|
5039
4865
|
}
|
5040
4866
|
const modifiers = text.slice(i).split(".").map((modifierName) => {
|
5041
|
-
const modifier = createIdentifier(
|
4867
|
+
const modifier = createIdentifier(i, i + modifierName.length);
|
5042
4868
|
if (modifierName === "" && i < text.length) {
|
5043
4869
|
insertError(
|
5044
4870
|
templateMeta,
|
@@ -5074,7 +4900,7 @@ function parseDirectiveKeyStatically(node, templateMeta, vineFixLocationContext)
|
|
5074
4900
|
}
|
5075
4901
|
if (directiveKey.name.rawName === "." && !directiveKey.modifiers.some(isPropModifier)) {
|
5076
4902
|
const pos = (directiveKey.argument || directiveKey.name).range[1] - offset;
|
5077
|
-
const propModifier = createIdentifier(
|
4903
|
+
const propModifier = createIdentifier(pos, pos, "prop");
|
5078
4904
|
directiveKey.modifiers.unshift(propModifier);
|
5079
4905
|
}
|
5080
4906
|
return directiveKey;
|
@@ -5137,7 +4963,7 @@ function parseDirectiveKeyTokens(node) {
|
|
5137
4963
|
}
|
5138
4964
|
return tokens;
|
5139
4965
|
}
|
5140
|
-
function convertDynamicArgument(node, templateMeta, parserOptions, locationCalculator
|
4966
|
+
function convertDynamicArgument(node, templateMeta, parserOptions, locationCalculator) {
|
5141
4967
|
const { argument } = node;
|
5142
4968
|
if (!(argument != null && argument.type === "VIdentifier" && argument.name.startsWith("[") && argument.name.endsWith("]"))) {
|
5143
4969
|
return;
|
@@ -5147,7 +4973,6 @@ function convertDynamicArgument(node, templateMeta, parserOptions, locationCalcu
|
|
5147
4973
|
const { comments, expression, references, tokens } = parseExpression(
|
5148
4974
|
rawName.slice(1, -1),
|
5149
4975
|
locationCalculator.getSubCalculatorAfter(range[0] + 1),
|
5150
|
-
vineFixLocationContext,
|
5151
4976
|
parserOptions
|
5152
4977
|
);
|
5153
4978
|
node.argument = {
|
@@ -5158,7 +4983,6 @@ function convertDynamicArgument(node, templateMeta, parserOptions, locationCalcu
|
|
5158
4983
|
expression,
|
5159
4984
|
references
|
5160
4985
|
};
|
5161
|
-
fixVineOffset(node.argument, vineFixLocationContext);
|
5162
4986
|
if (expression != null) {
|
5163
4987
|
expression.parent = node.argument;
|
5164
4988
|
}
|
@@ -5199,8 +5023,8 @@ function convertDynamicArgument(node, templateMeta, parserOptions, locationCalcu
|
|
5199
5023
|
}
|
5200
5024
|
}
|
5201
5025
|
}
|
5202
|
-
function createDirectiveKey(node, templateMeta, parserOptions, locationCalculator
|
5203
|
-
const directiveKey = parseDirectiveKeyStatically(node, templateMeta
|
5026
|
+
function createDirectiveKey(node, templateMeta, parserOptions, locationCalculator) {
|
5027
|
+
const directiveKey = parseDirectiveKeyStatically(node, templateMeta);
|
5204
5028
|
const tokens = parseDirectiveKeyTokens(directiveKey);
|
5205
5029
|
replaceTokens(templateMeta, directiveKey, tokens);
|
5206
5030
|
if (directiveKey.name.name.startsWith("v-")) {
|
@@ -5213,8 +5037,7 @@ function createDirectiveKey(node, templateMeta, parserOptions, locationCalculato
|
|
5213
5037
|
directiveKey,
|
5214
5038
|
templateMeta,
|
5215
5039
|
parserOptions,
|
5216
|
-
locationCalculator
|
5217
|
-
vineFixLocationContext
|
5040
|
+
locationCalculator
|
5218
5041
|
);
|
5219
5042
|
return directiveKey;
|
5220
5043
|
}
|
@@ -5231,12 +5054,7 @@ function convertToDirective(node, code, templateMeta, locationCalculator, vineFi
|
|
5231
5054
|
node.key,
|
5232
5055
|
templateMeta,
|
5233
5056
|
parserOptions,
|
5234
|
-
locationCalculator
|
5235
|
-
vineFixLocationContext
|
5236
|
-
);
|
5237
|
-
fixVineOffset(
|
5238
|
-
directive.key,
|
5239
|
-
vineFixLocationContext
|
5057
|
+
locationCalculator
|
5240
5058
|
);
|
5241
5059
|
const { argument } = directive.key;
|
5242
5060
|
if (argument && argument.type === "VIdentifier" && argument.name.startsWith("[")) {
|
@@ -5263,7 +5081,6 @@ function convertToDirective(node, code, templateMeta, locationCalculator, vineFi
|
|
5263
5081
|
code,
|
5264
5082
|
parserOptions,
|
5265
5083
|
locationCalculator,
|
5266
|
-
vineFixLocationContext,
|
5267
5084
|
node.value,
|
5268
5085
|
node.parent.parent,
|
5269
5086
|
directive.key
|
@@ -5276,10 +5093,6 @@ function convertToDirective(node, code, templateMeta, locationCalculator, vineFi
|
|
5276
5093
|
expression: ret.expression,
|
5277
5094
|
references: ret.references
|
5278
5095
|
};
|
5279
|
-
fixVineOffset(
|
5280
|
-
directive.value,
|
5281
|
-
vineFixLocationContext
|
5282
|
-
);
|
5283
5096
|
if (ret.expression != null) {
|
5284
5097
|
ret.expression.parent = directive.value;
|
5285
5098
|
}
|
@@ -5316,7 +5129,6 @@ function processMustache(parserOptions, globalLocationCalculator, vineFixLocatio
|
|
5316
5129
|
const ret = parseExpression(
|
5317
5130
|
mustache.value,
|
5318
5131
|
locationCalculator,
|
5319
|
-
vineFixLocationContext,
|
5320
5132
|
parserOptions,
|
5321
5133
|
{ allowEmpty: true, allowFilters: true }
|
5322
5134
|
);
|
@@ -5426,6 +5238,128 @@ var MATHML_ATTRIBUTE_NAME_MAP = /* @__PURE__ */ new Map([
|
|
5426
5238
|
["definitionurl", "definitionUrl"]
|
5427
5239
|
]);
|
5428
5240
|
|
5241
|
+
// src/template/utils/process-vine-template-node.ts
|
5242
|
+
var _typescriptestree = require('@typescript-eslint/typescript-estree');
|
5243
|
+
function fixVineOffset(token, fixCtx) {
|
5244
|
+
const {
|
5245
|
+
posInfo: {
|
5246
|
+
templateStartOffset,
|
5247
|
+
templateStartLine,
|
5248
|
+
templateStartColumn
|
5249
|
+
},
|
5250
|
+
fixedCache: cache
|
5251
|
+
} = fixCtx;
|
5252
|
+
if (!cache.has(token.range)) {
|
5253
|
+
token.range[0] += templateStartOffset;
|
5254
|
+
token.range[1] += templateStartOffset;
|
5255
|
+
cache.add(token.range);
|
5256
|
+
if ("start" in token) {
|
5257
|
+
token.start = token.range[0];
|
5258
|
+
}
|
5259
|
+
if ("end" in token) {
|
5260
|
+
token.end = token.range[1];
|
5261
|
+
}
|
5262
|
+
}
|
5263
|
+
if (!cache.has(token.loc.start)) {
|
5264
|
+
token.loc.start.line += templateStartLine - 1;
|
5265
|
+
token.loc.start.column = token.loc.start.line === templateStartLine ? templateStartColumn + token.loc.start.column : token.loc.start.column;
|
5266
|
+
cache.add(token.loc.start);
|
5267
|
+
}
|
5268
|
+
if (!cache.has(token.loc.end)) {
|
5269
|
+
token.loc.end.line += templateStartLine - 1;
|
5270
|
+
token.loc.end.column = token.loc.end.line === templateStartLine ? templateStartColumn + token.loc.end.column : token.loc.end.column;
|
5271
|
+
cache.add(token.loc.end);
|
5272
|
+
}
|
5273
|
+
}
|
5274
|
+
function fixFromVineTemplateRoot(root, fixCtx) {
|
5275
|
+
traverseNodes(
|
5276
|
+
root,
|
5277
|
+
{
|
5278
|
+
enterNode: (node) => {
|
5279
|
+
if (node.type === "VTemplateRoot") {
|
5280
|
+
return;
|
5281
|
+
}
|
5282
|
+
fixVineOffset(node, fixCtx);
|
5283
|
+
},
|
5284
|
+
leaveNode: () => {
|
5285
|
+
}
|
5286
|
+
}
|
5287
|
+
);
|
5288
|
+
}
|
5289
|
+
function extractForVineTemplate(ast) {
|
5290
|
+
const extractVineTemplateResult = [];
|
5291
|
+
const extractedTemplateNodes = /* @__PURE__ */ new WeakSet();
|
5292
|
+
try {
|
5293
|
+
_typescriptestree.simpleTraverse.call(void 0, ast, {
|
5294
|
+
enter(node, parent) {
|
5295
|
+
if (node.type === "TaggedTemplateExpression" && node.tag.type === "Identifier" && node.tag.name === "vine") {
|
5296
|
+
const templateNode = node;
|
5297
|
+
if (extractedTemplateNodes.has(templateNode)) {
|
5298
|
+
return;
|
5299
|
+
}
|
5300
|
+
extractedTemplateNodes.add(templateNode);
|
5301
|
+
let parentOfTemplate;
|
5302
|
+
let bindVineTemplateESTree;
|
5303
|
+
if (_optionalChain([parent, 'optionalAccess', _14 => _14.type]) === _typescriptestree.TSESTree.AST_NODE_TYPES.ReturnStatement) {
|
5304
|
+
parent.argument = null;
|
5305
|
+
parentOfTemplate = parent;
|
5306
|
+
bindVineTemplateESTree = ({ templateRootAST: vineESTree, templateMeta: _, ...templateInfo }) => {
|
5307
|
+
parent.argument = vineESTree;
|
5308
|
+
vineESTree.parent = parent;
|
5309
|
+
vineESTree.templateInfo = templateInfo;
|
5310
|
+
};
|
5311
|
+
} else if (_optionalChain([parent, 'optionalAccess', _15 => _15.type]) === _typescriptestree.TSESTree.AST_NODE_TYPES.ArrowFunctionExpression) {
|
5312
|
+
parent.body = null;
|
5313
|
+
parentOfTemplate = parent;
|
5314
|
+
bindVineTemplateESTree = ({ templateRootAST: vineESTree, templateMeta: _, ...templateInfo }) => {
|
5315
|
+
parent.body = vineESTree;
|
5316
|
+
vineESTree.parent = parent;
|
5317
|
+
vineESTree.templateInfo = templateInfo;
|
5318
|
+
};
|
5319
|
+
}
|
5320
|
+
ast.tokens = _optionalChain([ast, 'access', _16 => _16.tokens, 'optionalAccess', _17 => _17.filter, 'call', _18 => _18(
|
5321
|
+
(token) => token.range[0] < node.range[0] || token.range[1] > node.range[1]
|
5322
|
+
)]);
|
5323
|
+
if (parentOfTemplate && bindVineTemplateESTree) {
|
5324
|
+
extractVineTemplateResult.push({
|
5325
|
+
templateNode,
|
5326
|
+
parentOfTemplate,
|
5327
|
+
bindVineTemplateESTree
|
5328
|
+
});
|
5329
|
+
}
|
5330
|
+
}
|
5331
|
+
}
|
5332
|
+
}, true);
|
5333
|
+
} catch (err) {
|
5334
|
+
if (!(err instanceof Error) || err.message !== "BREAK_TRAVERSE") {
|
5335
|
+
throw err;
|
5336
|
+
}
|
5337
|
+
}
|
5338
|
+
return extractVineTemplateResult;
|
5339
|
+
}
|
5340
|
+
function prepareTemplate(templateNode) {
|
5341
|
+
const { quasi: { quasis } } = templateNode;
|
5342
|
+
const templateRawNode = quasis[0];
|
5343
|
+
const templateRawContent = templateRawNode.value.raw;
|
5344
|
+
const templateStartLine = templateRawNode.loc.start.line;
|
5345
|
+
const templateEndLine = templateRawNode.loc.end.line;
|
5346
|
+
const templateStartColumn = templateRawNode.loc.start.column + 1;
|
5347
|
+
const templateStartOffset = templateRawNode.range[0] + 1;
|
5348
|
+
const templateEndColumn = templateRawNode.loc.end.column - 1;
|
5349
|
+
const templateEndOffset = templateRawNode.range[1] - 1;
|
5350
|
+
return {
|
5351
|
+
templatePositionInfo: {
|
5352
|
+
templateStartLine,
|
5353
|
+
templateStartColumn,
|
5354
|
+
templateStartOffset,
|
5355
|
+
templateEndOffset,
|
5356
|
+
templateEndLine,
|
5357
|
+
templateEndColumn
|
5358
|
+
},
|
5359
|
+
templateRawContent
|
5360
|
+
};
|
5361
|
+
}
|
5362
|
+
|
5429
5363
|
// src/template/utils/tag-names.ts
|
5430
5364
|
var HTML_VOID_ELEMENT_TAGS = /* @__PURE__ */ new Set([
|
5431
5365
|
"area",
|
@@ -5686,9 +5620,10 @@ var VineTemplateParser = (_class = class {
|
|
5686
5620
|
|
5687
5621
|
|
5688
5622
|
__init() {this.postProcessForScript = []}
|
5689
|
-
|
5690
|
-
constructor(parserOptions, tokenizer, parentOfTemplate, templatePos) {;_class.prototype.__init.call(this);
|
5623
|
+
|
5624
|
+
constructor(parserOptions, tokenizer, parentOfTemplate, templatePos, offsetFixedTokenSet) {;_class.prototype.__init.call(this);
|
5691
5625
|
this.baseParserOptions = parserOptions;
|
5626
|
+
this.offsetFixedTokenSet = offsetFixedTokenSet;
|
5692
5627
|
this.tokenizer = new IntermediateTokenizer(tokenizer, parserOptions);
|
5693
5628
|
this.locationCalculator = new LocationCalculatorForHtml(
|
5694
5629
|
tokenizer.gaps,
|
@@ -5738,7 +5673,10 @@ var VineTemplateParser = (_class = class {
|
|
5738
5673
|
comment,
|
5739
5674
|
this.fixVineOffsetCtx
|
5740
5675
|
));
|
5741
|
-
|
5676
|
+
fixFromVineTemplateRoot(
|
5677
|
+
this.vTemplateRoot,
|
5678
|
+
this.fixVineOffsetCtx
|
5679
|
+
);
|
5742
5680
|
}
|
5743
5681
|
/**
|
5744
5682
|
* Get the current node.
|
@@ -6076,13 +6014,13 @@ var VineTemplateParser = (_class = class {
|
|
6076
6014
|
this[token.type](token);
|
6077
6015
|
} while (token != null);
|
6078
6016
|
this.popElementStackUntil(0);
|
6079
|
-
this.correctMetaTokenPos();
|
6080
6017
|
const templateRoot = this.vTemplateRoot;
|
6081
6018
|
const templateMeta = this.vTemplateMeta;
|
6082
6019
|
for (const proc of this.postProcessForScript) {
|
6083
6020
|
proc(this.baseParserOptions);
|
6084
6021
|
}
|
6085
6022
|
this.postProcessForScript = [];
|
6023
|
+
this.correctMetaTokenPos();
|
6086
6024
|
return [templateRoot, templateMeta];
|
6087
6025
|
}
|
6088
6026
|
}, _class);
|
@@ -8543,7 +8481,7 @@ var Tokenizer = (_class2 = class {
|
|
8543
8481
|
|
8544
8482
|
// Tokenizing
|
8545
8483
|
|
8546
|
-
|
8484
|
+
__init2() {this.vExpressionScriptState = null}
|
8547
8485
|
|
8548
8486
|
|
8549
8487
|
|
@@ -8577,7 +8515,7 @@ var Tokenizer = (_class2 = class {
|
|
8577
8515
|
* Initialize this tokenizer.
|
8578
8516
|
* @param text The source code to tokenize.
|
8579
8517
|
*/
|
8580
|
-
constructor(text) {;_class2.prototype.
|
8518
|
+
constructor(text) {;_class2.prototype.__init2.call(this);
|
8581
8519
|
debug("[html] the source code length: %d", text.length);
|
8582
8520
|
this.text = text;
|
8583
8521
|
this.gaps = [];
|
@@ -10066,7 +10004,7 @@ function prepareForTemplateRootAST(tsFileAST) {
|
|
10066
10004
|
};
|
10067
10005
|
});
|
10068
10006
|
}
|
10069
|
-
function getTemplateRootDataList(prepareResult, parserOptions) {
|
10007
|
+
function getTemplateRootDataList(prepareResult, offsetFixedTokenSet, parserOptions) {
|
10070
10008
|
if (!prepareResult) {
|
10071
10009
|
return null;
|
10072
10010
|
}
|
@@ -10076,7 +10014,8 @@ function getTemplateRootDataList(prepareResult, parserOptions) {
|
|
10076
10014
|
parserOptions,
|
10077
10015
|
tokenizer,
|
10078
10016
|
parentOfTemplate,
|
10079
|
-
templatePositionInfo
|
10017
|
+
templatePositionInfo,
|
10018
|
+
offsetFixedTokenSet
|
10080
10019
|
);
|
10081
10020
|
return templateParser.parse();
|
10082
10021
|
}
|
@@ -10097,6 +10036,7 @@ function runParse(code, parserOptions) {
|
|
10097
10036
|
code,
|
10098
10037
|
parserOptions
|
10099
10038
|
);
|
10039
|
+
const offsetFixedTokenSet = /* @__PURE__ */ new WeakSet();
|
10100
10040
|
const prepareResults = prepareForTemplateRootAST(tsESLintAST);
|
10101
10041
|
for (const prepareResult of prepareResults) {
|
10102
10042
|
const {
|
@@ -10106,6 +10046,7 @@ function runParse(code, parserOptions) {
|
|
10106
10046
|
} = prepareResult;
|
10107
10047
|
const rootData = getTemplateRootDataList(
|
10108
10048
|
prepareResult,
|
10049
|
+
offsetFixedTokenSet,
|
10109
10050
|
{
|
10110
10051
|
...parserOptions,
|
10111
10052
|
...forceEnableLocationOptions
|