@marko/language-tools 2.5.14 → 2.5.16
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 +20 -15
- package/dist/index.mjs +20 -15
- package/marko.internal.d.ts +15 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2431,31 +2431,36 @@ constructor(_?: Return) {}
|
|
|
2431
2431
|
const renderId = this.#getRenderId(tag);
|
|
2432
2432
|
const def = tagName ? this.#lookup.getTag(tagName) : void 0;
|
|
2433
2433
|
const isHTML = def == null ? void 0 : def.html;
|
|
2434
|
-
const importPath = !isHTML
|
|
2434
|
+
const importPath = !isHTML ? resolveTagImport(this.#filename, def) : void 0;
|
|
2435
2435
|
let tagIdentifier;
|
|
2436
2436
|
let isTemplate = false;
|
|
2437
2437
|
if (!isHTML && (!def || importPath)) {
|
|
2438
|
-
const
|
|
2439
|
-
|
|
2440
|
-
|
|
2438
|
+
const isIdentifier = tagName && REG_TAG_NAME_IDENTIFIER.test(tagName);
|
|
2439
|
+
const isMarkoFile = importPath == null ? void 0 : importPath.endsWith(".marko");
|
|
2440
|
+
if (isIdentifier || isMarkoFile || !importPath) {
|
|
2441
|
+
tagIdentifier = varLocal("tag_" + this.#ensureTagId(tag));
|
|
2442
|
+
this.#extractor.write(`const ${tagIdentifier} = (
|
|
2441
2443
|
`);
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
+
if (isIdentifier) {
|
|
2445
|
+
if (importPath) {
|
|
2446
|
+
this.#extractor.write(
|
|
2447
|
+
`${varShared("fallbackTemplate")}(${tagName},${isMarkoFile ? `import("${importPath}")` : varShared("any")})`
|
|
2448
|
+
);
|
|
2449
|
+
} else {
|
|
2450
|
+
this.#extractor.copy(tag.name);
|
|
2451
|
+
}
|
|
2452
|
+
} else if (isMarkoFile) {
|
|
2453
|
+
isTemplate = true;
|
|
2444
2454
|
this.#extractor.write(
|
|
2445
|
-
`${varShared("
|
|
2455
|
+
`${varShared("resolveTemplate")}(import("${importPath}"))`
|
|
2446
2456
|
);
|
|
2447
2457
|
} else {
|
|
2448
|
-
this.#
|
|
2458
|
+
this.#writeDynamicTagName(tag);
|
|
2449
2459
|
}
|
|
2450
|
-
|
|
2451
|
-
isTemplate = importPath.endsWith(".marko");
|
|
2452
|
-
this.#extractor.write(
|
|
2453
|
-
`${varShared("resolveTemplate")}(import("${importPath}"))`
|
|
2454
|
-
);
|
|
2460
|
+
this.#extractor.write("\n);\n");
|
|
2455
2461
|
} else {
|
|
2456
|
-
|
|
2462
|
+
tagIdentifier = varShared("missingTag");
|
|
2457
2463
|
}
|
|
2458
|
-
this.#extractor.write("\n);\n");
|
|
2459
2464
|
const attrTagTree = this.#getAttrTagTree(tag);
|
|
2460
2465
|
if (attrTagTree) {
|
|
2461
2466
|
this.#writeAttrTagTree(attrTagTree, tagIdentifier);
|
package/dist/index.mjs
CHANGED
|
@@ -2394,31 +2394,36 @@ constructor(_?: Return) {}
|
|
|
2394
2394
|
const renderId = this.#getRenderId(tag);
|
|
2395
2395
|
const def = tagName ? this.#lookup.getTag(tagName) : void 0;
|
|
2396
2396
|
const isHTML = def == null ? void 0 : def.html;
|
|
2397
|
-
const importPath = !isHTML
|
|
2397
|
+
const importPath = !isHTML ? resolveTagImport(this.#filename, def) : void 0;
|
|
2398
2398
|
let tagIdentifier;
|
|
2399
2399
|
let isTemplate = false;
|
|
2400
2400
|
if (!isHTML && (!def || importPath)) {
|
|
2401
|
-
const
|
|
2402
|
-
|
|
2403
|
-
|
|
2401
|
+
const isIdentifier = tagName && REG_TAG_NAME_IDENTIFIER.test(tagName);
|
|
2402
|
+
const isMarkoFile = importPath == null ? void 0 : importPath.endsWith(".marko");
|
|
2403
|
+
if (isIdentifier || isMarkoFile || !importPath) {
|
|
2404
|
+
tagIdentifier = varLocal("tag_" + this.#ensureTagId(tag));
|
|
2405
|
+
this.#extractor.write(`const ${tagIdentifier} = (
|
|
2404
2406
|
`);
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
+
if (isIdentifier) {
|
|
2408
|
+
if (importPath) {
|
|
2409
|
+
this.#extractor.write(
|
|
2410
|
+
`${varShared("fallbackTemplate")}(${tagName},${isMarkoFile ? `import("${importPath}")` : varShared("any")})`
|
|
2411
|
+
);
|
|
2412
|
+
} else {
|
|
2413
|
+
this.#extractor.copy(tag.name);
|
|
2414
|
+
}
|
|
2415
|
+
} else if (isMarkoFile) {
|
|
2416
|
+
isTemplate = true;
|
|
2407
2417
|
this.#extractor.write(
|
|
2408
|
-
`${varShared("
|
|
2418
|
+
`${varShared("resolveTemplate")}(import("${importPath}"))`
|
|
2409
2419
|
);
|
|
2410
2420
|
} else {
|
|
2411
|
-
this.#
|
|
2421
|
+
this.#writeDynamicTagName(tag);
|
|
2412
2422
|
}
|
|
2413
|
-
|
|
2414
|
-
isTemplate = importPath.endsWith(".marko");
|
|
2415
|
-
this.#extractor.write(
|
|
2416
|
-
`${varShared("resolveTemplate")}(import("${importPath}"))`
|
|
2417
|
-
);
|
|
2423
|
+
this.#extractor.write("\n);\n");
|
|
2418
2424
|
} else {
|
|
2419
|
-
|
|
2425
|
+
tagIdentifier = varShared("missingTag");
|
|
2420
2426
|
}
|
|
2421
|
-
this.#extractor.write("\n);\n");
|
|
2422
2427
|
const attrTagTree = this.#getAttrTagTree(tag);
|
|
2423
2428
|
if (attrTagTree) {
|
|
2424
2429
|
this.#writeAttrTagTree(attrTagTree, tagIdentifier);
|
package/marko.internal.d.ts
CHANGED
|
@@ -471,20 +471,21 @@ type ComponentEventHandlers<Component extends Marko.Component> = {
|
|
|
471
471
|
>]: Component[K] extends (...args: any) => any ? Component[K] : never;
|
|
472
472
|
};
|
|
473
473
|
|
|
474
|
-
type FlatScopes<Input
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
474
|
+
type FlatScopes<Input> = [0] extends [1 & Input]
|
|
475
|
+
? never
|
|
476
|
+
:
|
|
477
|
+
| (Input[("content" | "renderBody") & keyof Input] extends infer Prop
|
|
478
|
+
? Prop extends (...args: any[]) => { [Marko._.scope]: infer Scope }
|
|
479
|
+
? Scope
|
|
480
|
+
: never
|
|
481
|
+
: never)
|
|
482
|
+
| (Input[string & keyof Input] extends infer Prop
|
|
483
|
+
? Prop extends { [Symbol.iterator]: any }
|
|
484
|
+
? Prop extends readonly any[]
|
|
485
|
+
? never
|
|
486
|
+
: FlatScopes<Prop>
|
|
487
|
+
: never
|
|
488
|
+
: never);
|
|
488
489
|
|
|
489
490
|
type MergeScopes<Scopes> = {
|
|
490
491
|
[K in Scopes extends Scopes ? keyof Scopes : never]: Scopes extends Scopes
|
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.5.
|
|
4
|
+
"version": "2.5.16",
|
|
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"
|