@vue-vine/eslint-parser 0.1.32 → 0.1.33

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.js CHANGED
@@ -2346,23 +2346,10 @@ var require_sortedIndexBy = __commonJS({
2346
2346
  "use strict";
2347
2347
  var baseIteratee = require_baseIteratee();
2348
2348
  var baseSortedIndexBy = require_baseSortedIndexBy();
2349
- function sortedIndexBy4(array, value, iteratee) {
2349
+ function sortedIndexBy3(array, value, iteratee) {
2350
2350
  return baseSortedIndexBy(array, value, baseIteratee(iteratee, 2));
2351
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;
2352
+ module.exports = sortedIndexBy3;
2366
2353
  }
2367
2354
  });
2368
2355
 
@@ -3868,14 +3855,6 @@ function insertError(templateMeta, error) {
3868
3855
  }
3869
3856
 
3870
3857
  // 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
3858
  function createSimpleToken(type, start, end, value, linesAndColumns) {
3880
3859
  return {
3881
3860
  type,
@@ -3891,19 +3870,19 @@ function insertComments(templateMeta, newComments) {
3891
3870
  if (newComments.length === 0) {
3892
3871
  return;
3893
3872
  }
3894
- const index = (0, import_sortedIndexBy2.default)(templateMeta.comments, newComments[0], byRange0);
3873
+ const index = templateMeta.comments.findIndex((comment) => comment.range[0] === newComments[0].range[0]);
3895
3874
  templateMeta.comments.splice(index, 0, ...newComments);
3896
3875
  }
3897
3876
  function replaceTokens(templateMeta, node, newTokens) {
3898
- const index = (0, import_sortedIndexBy2.default)(templateMeta.tokens, node, byRange0);
3899
- const count = (0, import_sortedLastIndexBy.default)(templateMeta.tokens, node, byRange1) - index;
3877
+ const index = templateMeta.tokens.findIndex((token) => token.range[0] === node.range[0]);
3878
+ const count = templateMeta.tokens.findIndex((token) => token.range[1] === node.range[1]) - index + 1;
3900
3879
  templateMeta.tokens.splice(index, count, ...newTokens);
3901
3880
  }
3902
3881
 
3903
3882
  // src/script/index.ts
3904
3883
  var import_first = __toESM(require_first());
3905
3884
  var import_last2 = __toESM(require_last());
3906
- var import_sortedIndexBy3 = __toESM(require_sortedIndexBy());
3885
+ var import_sortedIndexBy2 = __toESM(require_sortedIndexBy());
3907
3886
 
3908
3887
 
3909
3888
  // src/template/utils/process-vine-template-node.ts
@@ -4141,7 +4120,7 @@ function processVForAliasAndIterator(code) {
4141
4120
  };
4142
4121
  }
4143
4122
  function getCommaTokenBeforeNode(tokens, node) {
4144
- let tokenIndex = (0, import_sortedIndexBy3.default)(
4123
+ let tokenIndex = (0, import_sortedIndexBy2.default)(
4145
4124
  tokens,
4146
4125
  { range: node.range },
4147
4126
  (t) => t.range[0]
@@ -6076,13 +6055,13 @@ var VineTemplateParser = (_class = class {
6076
6055
  this[token.type](token);
6077
6056
  } while (token != null);
6078
6057
  this.popElementStackUntil(0);
6079
- this.correctMetaTokenPos();
6080
6058
  const templateRoot = this.vTemplateRoot;
6081
6059
  const templateMeta = this.vTemplateMeta;
6082
6060
  for (const proc of this.postProcessForScript) {
6083
6061
  proc(this.baseParserOptions);
6084
6062
  }
6085
6063
  this.postProcessForScript = [];
6064
+ this.correctMetaTokenPos();
6086
6065
  return [templateRoot, templateMeta];
6087
6066
  }
6088
6067
  }, _class);
package/dist/index.mjs CHANGED
@@ -2346,23 +2346,10 @@ var require_sortedIndexBy = __commonJS({
2346
2346
  "use strict";
2347
2347
  var baseIteratee = require_baseIteratee();
2348
2348
  var baseSortedIndexBy = require_baseSortedIndexBy();
2349
- function sortedIndexBy4(array, value, iteratee) {
2349
+ function sortedIndexBy3(array, value, iteratee) {
2350
2350
  return baseSortedIndexBy(array, value, baseIteratee(iteratee, 2));
2351
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;
2352
+ module.exports = sortedIndexBy3;
2366
2353
  }
2367
2354
  });
2368
2355
 
@@ -3868,14 +3855,6 @@ function insertError(templateMeta, error) {
3868
3855
  }
3869
3856
 
3870
3857
  // 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
3858
  function createSimpleToken(type, start, end, value, linesAndColumns) {
3880
3859
  return {
3881
3860
  type,
@@ -3891,19 +3870,19 @@ function insertComments(templateMeta, newComments) {
3891
3870
  if (newComments.length === 0) {
3892
3871
  return;
3893
3872
  }
3894
- const index = (0, import_sortedIndexBy2.default)(templateMeta.comments, newComments[0], byRange0);
3873
+ const index = templateMeta.comments.findIndex((comment) => comment.range[0] === newComments[0].range[0]);
3895
3874
  templateMeta.comments.splice(index, 0, ...newComments);
3896
3875
  }
3897
3876
  function replaceTokens(templateMeta, node, newTokens) {
3898
- const index = (0, import_sortedIndexBy2.default)(templateMeta.tokens, node, byRange0);
3899
- const count = (0, import_sortedLastIndexBy.default)(templateMeta.tokens, node, byRange1) - index;
3877
+ const index = templateMeta.tokens.findIndex((token) => token.range[0] === node.range[0]);
3878
+ const count = templateMeta.tokens.findIndex((token) => token.range[1] === node.range[1]) - index + 1;
3900
3879
  templateMeta.tokens.splice(index, count, ...newTokens);
3901
3880
  }
3902
3881
 
3903
3882
  // src/script/index.ts
3904
3883
  var import_first = __toESM(require_first());
3905
3884
  var import_last2 = __toESM(require_last());
3906
- var import_sortedIndexBy3 = __toESM(require_sortedIndexBy());
3885
+ var import_sortedIndexBy2 = __toESM(require_sortedIndexBy());
3907
3886
  import { fileURLToPath as fileURLToPath2 } from "node:url";
3908
3887
 
3909
3888
  // src/template/utils/process-vine-template-node.ts
@@ -4141,7 +4120,7 @@ function processVForAliasAndIterator(code) {
4141
4120
  };
4142
4121
  }
4143
4122
  function getCommaTokenBeforeNode(tokens, node) {
4144
- let tokenIndex = (0, import_sortedIndexBy3.default)(
4123
+ let tokenIndex = (0, import_sortedIndexBy2.default)(
4145
4124
  tokens,
4146
4125
  { range: node.range },
4147
4126
  (t) => t.range[0]
@@ -6076,13 +6055,13 @@ var VineTemplateParser = class {
6076
6055
  this[token.type](token);
6077
6056
  } while (token != null);
6078
6057
  this.popElementStackUntil(0);
6079
- this.correctMetaTokenPos();
6080
6058
  const templateRoot = this.vTemplateRoot;
6081
6059
  const templateMeta = this.vTemplateMeta;
6082
6060
  for (const proc of this.postProcessForScript) {
6083
6061
  proc(this.baseParserOptions);
6084
6062
  }
6085
6063
  this.postProcessForScript = [];
6064
+ this.correctMetaTokenPos();
6086
6065
  return [templateRoot, templateMeta];
6087
6066
  }
6088
6067
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue-vine/eslint-parser",
3
- "version": "0.1.32",
3
+ "version": "0.1.33",
4
4
  "description": "ESLint parser for Vue Vine",
5
5
  "author": "ShenQingchuan",
6
6
  "license": "MIT",