@marko/language-tools 2.2.2 → 2.2.4

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
@@ -1864,6 +1864,7 @@ function ${templateName}() {
1864
1864
  this.#extractor.write(` const input = ${this.#getCastedType(`Input${typeArgsStr}`)};
1865
1865
  const component = ${this.#getCastedType(`Component${typeArgsStr}`)};
1866
1866
  const state = ${varShared("state")}(component);
1867
+ const $signal = ${this.#getCastedType("AbortSignal")};
1867
1868
  const $global = ${varShared("getGlobal")}(
1868
1869
  // @ts-expect-error We expect the compiler to error because we are checking if the MarkoRun.Context is defined.
1869
1870
  (${varShared("error")}, ${this.#getCastedType("MarkoRun.Context")})
@@ -2320,39 +2321,43 @@ ${isMutatedVar(tag.parent, valueLiteral) ? `${varLocal("return")}.mutate.` : ""}
2320
2321
  break;
2321
2322
  }
2322
2323
  } else if (attr.args) {
2323
- const stringLiteralFirstArgMatch = this.#execAtIndex(
2324
- REG_ATTR_ARG_LITERAL,
2325
- attr.args.value.start
2326
- );
2327
2324
  this.#extractor.write('"').copy(name).write('": ');
2328
- if (stringLiteralFirstArgMatch) {
2329
- const hasPartialArgs = stringLiteralFirstArgMatch[3] === ",";
2330
- const stringLiteralValue = stringLiteralFirstArgMatch[2];
2331
- const stringLiteralStart = stringLiteralFirstArgMatch.index;
2332
- const isValidProperty = REG_OBJECT_PROPERTY.test(
2333
- stringLiteralFirstArgMatch[2]
2325
+ if (typeof name !== "string" && this.#read(name).startsWith("on")) {
2326
+ const stringLiteralFirstArgMatch = this.#execAtIndex(
2327
+ REG_ATTR_ARG_LITERAL,
2328
+ attr.args.value.start
2334
2329
  );
2335
- if (isValidProperty) {
2336
- const propertNameStart = stringLiteralStart + 1;
2337
- this.#extractor.write("component.").copy({
2338
- start: propertNameStart,
2339
- end: propertNameStart + stringLiteralValue.length
2340
- });
2330
+ if (stringLiteralFirstArgMatch) {
2331
+ const hasPartialArgs = stringLiteralFirstArgMatch[3] === ",";
2332
+ const stringLiteralValue = stringLiteralFirstArgMatch[2];
2333
+ const stringLiteralStart = stringLiteralFirstArgMatch.index;
2334
+ const isValidProperty = REG_OBJECT_PROPERTY.test(
2335
+ stringLiteralFirstArgMatch[2]
2336
+ );
2337
+ if (isValidProperty) {
2338
+ const propertNameStart = stringLiteralStart + 1;
2339
+ this.#extractor.write("component.").copy({
2340
+ start: propertNameStart,
2341
+ end: propertNameStart + stringLiteralValue.length
2342
+ });
2343
+ } else {
2344
+ this.#extractor.write(`component[`).copy({
2345
+ start: stringLiteralStart,
2346
+ end: stringLiteralStart + stringLiteralValue.length + 2
2347
+ }).write("]");
2348
+ }
2349
+ if (hasPartialArgs) {
2350
+ this.#extractor.write(`.bind(component, `).copy({
2351
+ start: stringLiteralStart + stringLiteralFirstArgMatch[0].length,
2352
+ end: attr.args.value.end
2353
+ }).write(")");
2354
+ }
2341
2355
  } else {
2342
- this.#extractor.write(`component[`).copy({
2343
- start: stringLiteralStart,
2344
- end: stringLiteralStart + stringLiteralValue.length + 2
2345
- }).write("]");
2346
- }
2347
- if (hasPartialArgs) {
2348
- this.#extractor.write(`.bind(component, `).copy({
2349
- start: stringLiteralStart + stringLiteralFirstArgMatch[0].length,
2350
- end: attr.args.value.end
2351
- }).write(")");
2356
+ this.#extractor.write(`${varShared("bind")}(component,
2357
+ `).copy(attr.args.value).write("\n)");
2352
2358
  }
2353
2359
  } else {
2354
- this.#extractor.write(`${varShared("bind")}(component,
2355
- `).copy(attr.args.value).write("\n)");
2360
+ this.#extractor.copy(attr.args);
2356
2361
  }
2357
2362
  } else {
2358
2363
  this.#extractor.write('"').copy(defaultMapPosition).copy(name).write(`": ${modifierIndex === false ? "true" : '""'}`);
@@ -2937,7 +2942,7 @@ __export(project_exports, {
2937
2942
  });
2938
2943
  var import_path2 = __toESM(require("path"));
2939
2944
  var import_module = require("module");
2940
- var import_strip_json_comments = __toESM(require("strip-json-comments"));
2945
+ var import_strip_json_comments = require("@luxass/strip-json-comments");
2941
2946
  var defaultTypeLibs = {};
2942
2947
  var defaultMeta;
2943
2948
  var ignoreErrors = (_err) => {
@@ -3142,7 +3147,7 @@ function clearCacheForMeta(meta) {
3142
3147
  }
3143
3148
  function tryParseJSONWithComments(content) {
3144
3149
  try {
3145
- return JSON.parse((0, import_strip_json_comments.default)(content));
3150
+ return JSON.parse((0, import_strip_json_comments.strip)(content));
3146
3151
  } catch {
3147
3152
  return void 0;
3148
3153
  }
package/dist/index.mjs CHANGED
@@ -1832,6 +1832,7 @@ function ${templateName}() {
1832
1832
  this.#extractor.write(` const input = ${this.#getCastedType(`Input${typeArgsStr}`)};
1833
1833
  const component = ${this.#getCastedType(`Component${typeArgsStr}`)};
1834
1834
  const state = ${varShared("state")}(component);
1835
+ const $signal = ${this.#getCastedType("AbortSignal")};
1835
1836
  const $global = ${varShared("getGlobal")}(
1836
1837
  // @ts-expect-error We expect the compiler to error because we are checking if the MarkoRun.Context is defined.
1837
1838
  (${varShared("error")}, ${this.#getCastedType("MarkoRun.Context")})
@@ -2288,39 +2289,43 @@ ${isMutatedVar(tag.parent, valueLiteral) ? `${varLocal("return")}.mutate.` : ""}
2288
2289
  break;
2289
2290
  }
2290
2291
  } else if (attr.args) {
2291
- const stringLiteralFirstArgMatch = this.#execAtIndex(
2292
- REG_ATTR_ARG_LITERAL,
2293
- attr.args.value.start
2294
- );
2295
2292
  this.#extractor.write('"').copy(name).write('": ');
2296
- if (stringLiteralFirstArgMatch) {
2297
- const hasPartialArgs = stringLiteralFirstArgMatch[3] === ",";
2298
- const stringLiteralValue = stringLiteralFirstArgMatch[2];
2299
- const stringLiteralStart = stringLiteralFirstArgMatch.index;
2300
- const isValidProperty = REG_OBJECT_PROPERTY.test(
2301
- stringLiteralFirstArgMatch[2]
2293
+ if (typeof name !== "string" && this.#read(name).startsWith("on")) {
2294
+ const stringLiteralFirstArgMatch = this.#execAtIndex(
2295
+ REG_ATTR_ARG_LITERAL,
2296
+ attr.args.value.start
2302
2297
  );
2303
- if (isValidProperty) {
2304
- const propertNameStart = stringLiteralStart + 1;
2305
- this.#extractor.write("component.").copy({
2306
- start: propertNameStart,
2307
- end: propertNameStart + stringLiteralValue.length
2308
- });
2298
+ if (stringLiteralFirstArgMatch) {
2299
+ const hasPartialArgs = stringLiteralFirstArgMatch[3] === ",";
2300
+ const stringLiteralValue = stringLiteralFirstArgMatch[2];
2301
+ const stringLiteralStart = stringLiteralFirstArgMatch.index;
2302
+ const isValidProperty = REG_OBJECT_PROPERTY.test(
2303
+ stringLiteralFirstArgMatch[2]
2304
+ );
2305
+ if (isValidProperty) {
2306
+ const propertNameStart = stringLiteralStart + 1;
2307
+ this.#extractor.write("component.").copy({
2308
+ start: propertNameStart,
2309
+ end: propertNameStart + stringLiteralValue.length
2310
+ });
2311
+ } else {
2312
+ this.#extractor.write(`component[`).copy({
2313
+ start: stringLiteralStart,
2314
+ end: stringLiteralStart + stringLiteralValue.length + 2
2315
+ }).write("]");
2316
+ }
2317
+ if (hasPartialArgs) {
2318
+ this.#extractor.write(`.bind(component, `).copy({
2319
+ start: stringLiteralStart + stringLiteralFirstArgMatch[0].length,
2320
+ end: attr.args.value.end
2321
+ }).write(")");
2322
+ }
2309
2323
  } else {
2310
- this.#extractor.write(`component[`).copy({
2311
- start: stringLiteralStart,
2312
- end: stringLiteralStart + stringLiteralValue.length + 2
2313
- }).write("]");
2314
- }
2315
- if (hasPartialArgs) {
2316
- this.#extractor.write(`.bind(component, `).copy({
2317
- start: stringLiteralStart + stringLiteralFirstArgMatch[0].length,
2318
- end: attr.args.value.end
2319
- }).write(")");
2324
+ this.#extractor.write(`${varShared("bind")}(component,
2325
+ `).copy(attr.args.value).write("\n)");
2320
2326
  }
2321
2327
  } else {
2322
- this.#extractor.write(`${varShared("bind")}(component,
2323
- `).copy(attr.args.value).write("\n)");
2328
+ this.#extractor.copy(attr.args);
2324
2329
  }
2325
2330
  } else {
2326
2331
  this.#extractor.write('"').copy(defaultMapPosition).copy(name).write(`": ${modifierIndex === false ? "true" : '""'}`);
@@ -2905,7 +2910,7 @@ __export(project_exports, {
2905
2910
  });
2906
2911
  import path2 from "path";
2907
2912
  import { createRequire } from "module";
2908
- import stripJSONComments from "strip-json-comments";
2913
+ import { strip as stripJSONComments } from "@luxass/strip-json-comments";
2909
2914
  var defaultTypeLibs = {};
2910
2915
  var defaultMeta;
2911
2916
  var ignoreErrors = (_err) => {
package/package.json CHANGED
@@ -1,28 +1,28 @@
1
1
  {
2
2
  "name": "@marko/language-tools",
3
3
  "description": "Marko Language Tools",
4
- "version": "2.2.2",
4
+ "version": "2.2.4",
5
5
  "bugs": "https://github.com/marko-js/language-server/issues/new?template=Bug_report.md",
6
6
  "peerDependencies": {
7
7
  "@marko/compiler": "^5.28.4"
8
8
  },
9
9
  "dependencies": {
10
10
  "@babel/helper-validator-identifier": "^7.22.20",
11
- "@babel/parser": "^7.23.6",
12
- "htmljs-parser": "^5.5.1",
13
- "strip-json-comments": "^3.1.1",
11
+ "@babel/parser": "^7.23.9",
12
+ "@luxass/strip-json-comments": "^1.2.0",
13
+ "htmljs-parser": "^5.5.2",
14
14
  "relative-import-path": "^1.0.0"
15
15
  },
16
16
  "devDependencies": {
17
17
  "@babel/code-frame": "^7.23.5",
18
- "@marko/compiler": "^5.34.1",
19
- "@marko/translator-default": "^5.31.8",
18
+ "@marko/compiler": "^5.34.6",
19
+ "@marko/translator-default": "^5.31.13",
20
20
  "@types/babel__code-frame": "^7.0.6",
21
21
  "@types/babel__helper-validator-identifier": "^7.15.2",
22
22
  "@typescript/vfs": "^1.5.0",
23
- "marko": "^5.32.1",
24
- "mitata": "^0.1.6",
25
- "tsx": "^4.6.2"
23
+ "marko": "^5.32.7",
24
+ "mitata": "^0.1.8",
25
+ "tsx": "^4.7.0"
26
26
  },
27
27
  "exports": {
28
28
  ".": {