@marko/language-tools 2.2.2 → 2.2.3

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
@@ -2320,39 +2320,43 @@ ${isMutatedVar(tag.parent, valueLiteral) ? `${varLocal("return")}.mutate.` : ""}
2320
2320
  break;
2321
2321
  }
2322
2322
  } else if (attr.args) {
2323
- const stringLiteralFirstArgMatch = this.#execAtIndex(
2324
- REG_ATTR_ARG_LITERAL,
2325
- attr.args.value.start
2326
- );
2327
2323
  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]
2324
+ if (typeof name !== "string" && this.#read(name).startsWith("on")) {
2325
+ const stringLiteralFirstArgMatch = this.#execAtIndex(
2326
+ REG_ATTR_ARG_LITERAL,
2327
+ attr.args.value.start
2334
2328
  );
2335
- if (isValidProperty) {
2336
- const propertNameStart = stringLiteralStart + 1;
2337
- this.#extractor.write("component.").copy({
2338
- start: propertNameStart,
2339
- end: propertNameStart + stringLiteralValue.length
2340
- });
2329
+ if (stringLiteralFirstArgMatch) {
2330
+ const hasPartialArgs = stringLiteralFirstArgMatch[3] === ",";
2331
+ const stringLiteralValue = stringLiteralFirstArgMatch[2];
2332
+ const stringLiteralStart = stringLiteralFirstArgMatch.index;
2333
+ const isValidProperty = REG_OBJECT_PROPERTY.test(
2334
+ stringLiteralFirstArgMatch[2]
2335
+ );
2336
+ if (isValidProperty) {
2337
+ const propertNameStart = stringLiteralStart + 1;
2338
+ this.#extractor.write("component.").copy({
2339
+ start: propertNameStart,
2340
+ end: propertNameStart + stringLiteralValue.length
2341
+ });
2342
+ } else {
2343
+ this.#extractor.write(`component[`).copy({
2344
+ start: stringLiteralStart,
2345
+ end: stringLiteralStart + stringLiteralValue.length + 2
2346
+ }).write("]");
2347
+ }
2348
+ if (hasPartialArgs) {
2349
+ this.#extractor.write(`.bind(component, `).copy({
2350
+ start: stringLiteralStart + stringLiteralFirstArgMatch[0].length,
2351
+ end: attr.args.value.end
2352
+ }).write(")");
2353
+ }
2341
2354
  } 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(")");
2355
+ this.#extractor.write(`${varShared("bind")}(component,
2356
+ `).copy(attr.args.value).write("\n)");
2352
2357
  }
2353
2358
  } else {
2354
- this.#extractor.write(`${varShared("bind")}(component,
2355
- `).copy(attr.args.value).write("\n)");
2359
+ this.#extractor.copy(attr.args);
2356
2360
  }
2357
2361
  } else {
2358
2362
  this.#extractor.write('"').copy(defaultMapPosition).copy(name).write(`": ${modifierIndex === false ? "true" : '""'}`);
package/dist/index.mjs CHANGED
@@ -2288,39 +2288,43 @@ ${isMutatedVar(tag.parent, valueLiteral) ? `${varLocal("return")}.mutate.` : ""}
2288
2288
  break;
2289
2289
  }
2290
2290
  } else if (attr.args) {
2291
- const stringLiteralFirstArgMatch = this.#execAtIndex(
2292
- REG_ATTR_ARG_LITERAL,
2293
- attr.args.value.start
2294
- );
2295
2291
  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]
2292
+ if (typeof name !== "string" && this.#read(name).startsWith("on")) {
2293
+ const stringLiteralFirstArgMatch = this.#execAtIndex(
2294
+ REG_ATTR_ARG_LITERAL,
2295
+ attr.args.value.start
2302
2296
  );
2303
- if (isValidProperty) {
2304
- const propertNameStart = stringLiteralStart + 1;
2305
- this.#extractor.write("component.").copy({
2306
- start: propertNameStart,
2307
- end: propertNameStart + stringLiteralValue.length
2308
- });
2297
+ if (stringLiteralFirstArgMatch) {
2298
+ const hasPartialArgs = stringLiteralFirstArgMatch[3] === ",";
2299
+ const stringLiteralValue = stringLiteralFirstArgMatch[2];
2300
+ const stringLiteralStart = stringLiteralFirstArgMatch.index;
2301
+ const isValidProperty = REG_OBJECT_PROPERTY.test(
2302
+ stringLiteralFirstArgMatch[2]
2303
+ );
2304
+ if (isValidProperty) {
2305
+ const propertNameStart = stringLiteralStart + 1;
2306
+ this.#extractor.write("component.").copy({
2307
+ start: propertNameStart,
2308
+ end: propertNameStart + stringLiteralValue.length
2309
+ });
2310
+ } else {
2311
+ this.#extractor.write(`component[`).copy({
2312
+ start: stringLiteralStart,
2313
+ end: stringLiteralStart + stringLiteralValue.length + 2
2314
+ }).write("]");
2315
+ }
2316
+ if (hasPartialArgs) {
2317
+ this.#extractor.write(`.bind(component, `).copy({
2318
+ start: stringLiteralStart + stringLiteralFirstArgMatch[0].length,
2319
+ end: attr.args.value.end
2320
+ }).write(")");
2321
+ }
2309
2322
  } 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(")");
2323
+ this.#extractor.write(`${varShared("bind")}(component,
2324
+ `).copy(attr.args.value).write("\n)");
2320
2325
  }
2321
2326
  } else {
2322
- this.#extractor.write(`${varShared("bind")}(component,
2323
- `).copy(attr.args.value).write("\n)");
2327
+ this.#extractor.copy(attr.args);
2324
2328
  }
2325
2329
  } else {
2326
2330
  this.#extractor.write('"').copy(defaultMapPosition).copy(name).write(`": ${modifierIndex === false ? "true" : '""'}`);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@marko/language-tools",
3
3
  "description": "Marko Language Tools",
4
- "version": "2.2.2",
4
+ "version": "2.2.3",
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"
@@ -9,20 +9,20 @@
9
9
  "dependencies": {
10
10
  "@babel/helper-validator-identifier": "^7.22.20",
11
11
  "@babel/parser": "^7.23.6",
12
- "htmljs-parser": "^5.5.1",
12
+ "htmljs-parser": "^5.5.2",
13
13
  "strip-json-comments": "^3.1.1",
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.3",
19
+ "@marko/translator-default": "^5.31.10",
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",
23
+ "marko": "^5.32.4",
24
24
  "mitata": "^0.1.6",
25
- "tsx": "^4.6.2"
25
+ "tsx": "^4.7.0"
26
26
  },
27
27
  "exports": {
28
28
  ".": {