@marko/language-tools 2.1.9 → 2.1.11
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 +22 -9
- package/dist/index.mjs +22 -9
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1677,6 +1677,7 @@ var REG_OBJECT_PROPERTY = /^[_$a-z][_$a-z0-9]*$/i;
|
|
|
1677
1677
|
var REG_COMMENT_PRAGMA = /\/\/(?:\s*@ts-|\/\s*<)/y;
|
|
1678
1678
|
var IF_TAG_ALTERNATES = /* @__PURE__ */ new WeakMap();
|
|
1679
1679
|
var WROTE_COMMENT = /* @__PURE__ */ new WeakSet();
|
|
1680
|
+
var START_OF_FILE = { start: 0, end: 0 };
|
|
1680
1681
|
var ScriptLang = /* @__PURE__ */ ((ScriptLang2) => {
|
|
1681
1682
|
ScriptLang2["js"] = "js";
|
|
1682
1683
|
ScriptLang2["ts"] = "ts";
|
|
@@ -1907,6 +1908,7 @@ function ${templateName}() {
|
|
|
1907
1908
|
-1
|
|
1908
1909
|
)}>${renderAndReturn};` : `(): () => <${internalInputWithExtends}>${renderAndReturn};`}
|
|
1909
1910
|
}>`;
|
|
1911
|
+
this.#extractor.copy(START_OF_FILE);
|
|
1910
1912
|
if (this.#scriptLang === "ts" /* ts */) {
|
|
1911
1913
|
this.#extractor.write(`export default new (
|
|
1912
1914
|
class Template extends ${templateOverrideClass} {}
|
|
@@ -2549,9 +2551,7 @@ const attrTags = ${varShared(
|
|
|
2549
2551
|
this.#extractor.write(SEP_COMMA_NEW_LINE);
|
|
2550
2552
|
}
|
|
2551
2553
|
if (tag.type === 16 /* AttrTag */) {
|
|
2552
|
-
this.#extractor.write(
|
|
2553
|
-
`[Symbol.iterator]: ${varShared("any")}${SEP_COMMA_NEW_LINE}`
|
|
2554
|
-
);
|
|
2554
|
+
this.#extractor.write("[/*").copy(tag.name).write(`*/Symbol.iterator]: ${varShared("any")}${SEP_COMMA_NEW_LINE}`);
|
|
2555
2555
|
}
|
|
2556
2556
|
if (!hasInput) {
|
|
2557
2557
|
this.#writeTagNameComment(tag);
|
|
@@ -3175,6 +3175,23 @@ var marko_default = {
|
|
|
3175
3175
|
runtimeTypes.internalTypesFile,
|
|
3176
3176
|
runtimeTypes.markoTypesFile
|
|
3177
3177
|
];
|
|
3178
|
+
const compileConfig = {
|
|
3179
|
+
output: "source",
|
|
3180
|
+
stripTypes: true,
|
|
3181
|
+
sourceMaps: true,
|
|
3182
|
+
babelConfig: {
|
|
3183
|
+
babelrc: false,
|
|
3184
|
+
configFile: false,
|
|
3185
|
+
browserslistConfigFile: false,
|
|
3186
|
+
caller: {
|
|
3187
|
+
name: "@marko/type-check",
|
|
3188
|
+
supportsStaticESM: true,
|
|
3189
|
+
supportsDynamicImport: true,
|
|
3190
|
+
supportsTopLevelAwait: true,
|
|
3191
|
+
supportsExportNamespaceFrom: true
|
|
3192
|
+
}
|
|
3193
|
+
}
|
|
3194
|
+
};
|
|
3178
3195
|
if (runtimeTypes.markoRunTypesFile) {
|
|
3179
3196
|
rootNames.push(runtimeTypes.markoRunTypesFile);
|
|
3180
3197
|
}
|
|
@@ -3210,11 +3227,7 @@ var marko_default = {
|
|
|
3210
3227
|
print({ extracted: { parsed } }) {
|
|
3211
3228
|
const { code, map } = getCompiler(
|
|
3212
3229
|
import_path3.default.dirname(parsed.filename)
|
|
3213
|
-
).compileSync(parsed.code, parsed.filename,
|
|
3214
|
-
output: "source",
|
|
3215
|
-
stripTypes: true,
|
|
3216
|
-
sourceMaps: true
|
|
3217
|
-
});
|
|
3230
|
+
).compileSync(parsed.code, parsed.filename, compileConfig);
|
|
3218
3231
|
return { code, map };
|
|
3219
3232
|
},
|
|
3220
3233
|
printTypes({ printer, typeChecker, sourceFile, formatSettings }) {
|
|
@@ -3299,7 +3312,7 @@ var marko_default = {
|
|
|
3299
3312
|
return ts.isTypeAliasDeclaration(statement) && statement.name.escapedText === "Input" && ts.isIndexedAccessTypeNode(statement.type) && ts.isTypeReferenceNode(statement.type.objectType) && ts.isIdentifier(statement.type.objectType.typeName) && statement.type.objectType.typeName.escapedText === "Component" && ts.isLiteralTypeNode(statement.type.indexType) && ts.isStringLiteral(statement.type.indexType.literal) && statement.type.indexType.literal.text === "input";
|
|
3300
3313
|
}
|
|
3301
3314
|
function isExportEmptyInputType(statement) {
|
|
3302
|
-
return ts.isTypeAliasDeclaration(statement) && statement.name.escapedText === "Input" && ts.isTypeLiteralNode(statement.type) && !statement.typeParameters && statement.type.members.length === 0 || ts.isInterfaceDeclaration(statement) && statement.name.escapedText === "Input" && !statement.typeParameters && statement.members.length === 0;
|
|
3315
|
+
return ts.isTypeAliasDeclaration(statement) && statement.name.escapedText === "Input" && ts.isTypeLiteralNode(statement.type) && !statement.typeParameters && statement.type.members.length === 0 || ts.isInterfaceDeclaration(statement) && statement.name.escapedText === "Input" && !statement.heritageClauses && !statement.typeParameters && statement.members.length === 0;
|
|
3303
3316
|
}
|
|
3304
3317
|
function isExportComponentType(statement) {
|
|
3305
3318
|
return ts.isExportDeclaration(statement) && statement.exportClause && ts.isNamedExports(statement.exportClause) && statement.exportClause.elements.length === 1 && statement.exportClause.elements[0].name.escapedText === "Component";
|
package/dist/index.mjs
CHANGED
|
@@ -1645,6 +1645,7 @@ var REG_OBJECT_PROPERTY = /^[_$a-z][_$a-z0-9]*$/i;
|
|
|
1645
1645
|
var REG_COMMENT_PRAGMA = /\/\/(?:\s*@ts-|\/\s*<)/y;
|
|
1646
1646
|
var IF_TAG_ALTERNATES = /* @__PURE__ */ new WeakMap();
|
|
1647
1647
|
var WROTE_COMMENT = /* @__PURE__ */ new WeakSet();
|
|
1648
|
+
var START_OF_FILE = { start: 0, end: 0 };
|
|
1648
1649
|
var ScriptLang = /* @__PURE__ */ ((ScriptLang2) => {
|
|
1649
1650
|
ScriptLang2["js"] = "js";
|
|
1650
1651
|
ScriptLang2["ts"] = "ts";
|
|
@@ -1875,6 +1876,7 @@ function ${templateName}() {
|
|
|
1875
1876
|
-1
|
|
1876
1877
|
)}>${renderAndReturn};` : `(): () => <${internalInputWithExtends}>${renderAndReturn};`}
|
|
1877
1878
|
}>`;
|
|
1879
|
+
this.#extractor.copy(START_OF_FILE);
|
|
1878
1880
|
if (this.#scriptLang === "ts" /* ts */) {
|
|
1879
1881
|
this.#extractor.write(`export default new (
|
|
1880
1882
|
class Template extends ${templateOverrideClass} {}
|
|
@@ -2517,9 +2519,7 @@ const attrTags = ${varShared(
|
|
|
2517
2519
|
this.#extractor.write(SEP_COMMA_NEW_LINE);
|
|
2518
2520
|
}
|
|
2519
2521
|
if (tag.type === 16 /* AttrTag */) {
|
|
2520
|
-
this.#extractor.write(
|
|
2521
|
-
`[Symbol.iterator]: ${varShared("any")}${SEP_COMMA_NEW_LINE}`
|
|
2522
|
-
);
|
|
2522
|
+
this.#extractor.write("[/*").copy(tag.name).write(`*/Symbol.iterator]: ${varShared("any")}${SEP_COMMA_NEW_LINE}`);
|
|
2523
2523
|
}
|
|
2524
2524
|
if (!hasInput) {
|
|
2525
2525
|
this.#writeTagNameComment(tag);
|
|
@@ -3143,6 +3143,23 @@ var marko_default = {
|
|
|
3143
3143
|
runtimeTypes.internalTypesFile,
|
|
3144
3144
|
runtimeTypes.markoTypesFile
|
|
3145
3145
|
];
|
|
3146
|
+
const compileConfig = {
|
|
3147
|
+
output: "source",
|
|
3148
|
+
stripTypes: true,
|
|
3149
|
+
sourceMaps: true,
|
|
3150
|
+
babelConfig: {
|
|
3151
|
+
babelrc: false,
|
|
3152
|
+
configFile: false,
|
|
3153
|
+
browserslistConfigFile: false,
|
|
3154
|
+
caller: {
|
|
3155
|
+
name: "@marko/type-check",
|
|
3156
|
+
supportsStaticESM: true,
|
|
3157
|
+
supportsDynamicImport: true,
|
|
3158
|
+
supportsTopLevelAwait: true,
|
|
3159
|
+
supportsExportNamespaceFrom: true
|
|
3160
|
+
}
|
|
3161
|
+
}
|
|
3162
|
+
};
|
|
3146
3163
|
if (runtimeTypes.markoRunTypesFile) {
|
|
3147
3164
|
rootNames.push(runtimeTypes.markoRunTypesFile);
|
|
3148
3165
|
}
|
|
@@ -3178,11 +3195,7 @@ var marko_default = {
|
|
|
3178
3195
|
print({ extracted: { parsed } }) {
|
|
3179
3196
|
const { code, map } = getCompiler(
|
|
3180
3197
|
path3.dirname(parsed.filename)
|
|
3181
|
-
).compileSync(parsed.code, parsed.filename,
|
|
3182
|
-
output: "source",
|
|
3183
|
-
stripTypes: true,
|
|
3184
|
-
sourceMaps: true
|
|
3185
|
-
});
|
|
3198
|
+
).compileSync(parsed.code, parsed.filename, compileConfig);
|
|
3186
3199
|
return { code, map };
|
|
3187
3200
|
},
|
|
3188
3201
|
printTypes({ printer, typeChecker, sourceFile, formatSettings }) {
|
|
@@ -3267,7 +3280,7 @@ var marko_default = {
|
|
|
3267
3280
|
return ts.isTypeAliasDeclaration(statement) && statement.name.escapedText === "Input" && ts.isIndexedAccessTypeNode(statement.type) && ts.isTypeReferenceNode(statement.type.objectType) && ts.isIdentifier(statement.type.objectType.typeName) && statement.type.objectType.typeName.escapedText === "Component" && ts.isLiteralTypeNode(statement.type.indexType) && ts.isStringLiteral(statement.type.indexType.literal) && statement.type.indexType.literal.text === "input";
|
|
3268
3281
|
}
|
|
3269
3282
|
function isExportEmptyInputType(statement) {
|
|
3270
|
-
return ts.isTypeAliasDeclaration(statement) && statement.name.escapedText === "Input" && ts.isTypeLiteralNode(statement.type) && !statement.typeParameters && statement.type.members.length === 0 || ts.isInterfaceDeclaration(statement) && statement.name.escapedText === "Input" && !statement.typeParameters && statement.members.length === 0;
|
|
3283
|
+
return ts.isTypeAliasDeclaration(statement) && statement.name.escapedText === "Input" && ts.isTypeLiteralNode(statement.type) && !statement.typeParameters && statement.type.members.length === 0 || ts.isInterfaceDeclaration(statement) && statement.name.escapedText === "Input" && !statement.heritageClauses && !statement.typeParameters && statement.members.length === 0;
|
|
3271
3284
|
}
|
|
3272
3285
|
function isExportComponentType(statement) {
|
|
3273
3286
|
return ts.isExportDeclaration(statement) && statement.exportClause && ts.isNamedExports(statement.exportClause) && statement.exportClause.elements.length === 1 && statement.exportClause.elements[0].name.escapedText === "Component";
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marko/language-tools",
|
|
3
3
|
"description": "Marko Language Tools",
|
|
4
|
-
"version": "2.1.
|
|
4
|
+
"version": "2.1.11",
|
|
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.
|
|
11
|
+
"@babel/parser": "^7.23.6",
|
|
12
12
|
"htmljs-parser": "^5.5.1",
|
|
13
13
|
"strip-json-comments": "^3.1.1",
|
|
14
14
|
"relative-import-path": "^1.0.0"
|
|
@@ -20,7 +20,7 @@
|
|
|
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.
|
|
23
|
+
"marko": "^5.32.1",
|
|
24
24
|
"mitata": "^0.1.6",
|
|
25
25
|
"tsx": "^4.6.2"
|
|
26
26
|
},
|