@statorjs/language-server 0.1.33-next.0 → 0.1.33-next.2
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/server.cjs +58 -35
- package/package.json +2 -2
package/dist/server.cjs
CHANGED
|
@@ -44494,6 +44494,29 @@ function scopeHash(input) {
|
|
|
44494
44494
|
|
|
44495
44495
|
// ../stator/src/compiler/lower.ts
|
|
44496
44496
|
var import_typescript3 = __toESM(require("typescript"), 1);
|
|
44497
|
+
|
|
44498
|
+
// ../stator/src/template/void-elements.ts
|
|
44499
|
+
var VOID_ELEMENTS = /* @__PURE__ */ new Set([
|
|
44500
|
+
"area",
|
|
44501
|
+
"base",
|
|
44502
|
+
"br",
|
|
44503
|
+
"col",
|
|
44504
|
+
"embed",
|
|
44505
|
+
"hr",
|
|
44506
|
+
"img",
|
|
44507
|
+
"input",
|
|
44508
|
+
"link",
|
|
44509
|
+
"meta",
|
|
44510
|
+
"param",
|
|
44511
|
+
"source",
|
|
44512
|
+
"track",
|
|
44513
|
+
"wbr"
|
|
44514
|
+
]);
|
|
44515
|
+
function isVoidElement(tag) {
|
|
44516
|
+
return VOID_ELEMENTS.has(tag.toLowerCase());
|
|
44517
|
+
}
|
|
44518
|
+
|
|
44519
|
+
// ../stator/src/compiler/lower.ts
|
|
44497
44520
|
function cleanJsxText(raw) {
|
|
44498
44521
|
const lines = raw.split(/\r\n|\n|\r/);
|
|
44499
44522
|
let lastNonEmpty = 0;
|
|
@@ -44741,7 +44764,8 @@ function lowerTemplate(template, opts = {}) {
|
|
|
44741
44764
|
return `\${${lowerComponent(tag, node.attributes, void 0)}}`;
|
|
44742
44765
|
}
|
|
44743
44766
|
if (meta && tag.includes("-")) meta.customElements.add(tag);
|
|
44744
|
-
|
|
44767
|
+
const open = `<${tag}${lowerAttributes(node.attributes)}${scopeSuffix}>`;
|
|
44768
|
+
return isVoidElement(tag) ? open : `${open}</${tag}>`;
|
|
44745
44769
|
}
|
|
44746
44770
|
if (import_typescript3.default.isJsxFragment(node)) return contentOfChildren(node.children);
|
|
44747
44771
|
throw new CompileError(
|
|
@@ -45213,28 +45237,42 @@ function scopeSelectorList(selector, attr) {
|
|
|
45213
45237
|
}
|
|
45214
45238
|
});
|
|
45215
45239
|
if (subjectIsGlobal) return;
|
|
45216
|
-
|
|
45217
|
-
let insertAfter;
|
|
45218
|
-
for (const node of nodes) {
|
|
45219
|
-
if (node.type === "combinator") {
|
|
45220
|
-
insertAfter = void 0;
|
|
45221
|
-
continue;
|
|
45222
|
-
}
|
|
45223
|
-
if (node.type === "pseudo" && node.value.startsWith("::")) continue;
|
|
45224
|
-
insertAfter = node;
|
|
45225
|
-
}
|
|
45226
|
-
const attrNode = import_postcss_selector_parser.default.attribute({
|
|
45227
|
-
attribute: attr,
|
|
45228
|
-
value: void 0,
|
|
45229
|
-
raws: {},
|
|
45230
|
-
quoteMark: null
|
|
45231
|
-
});
|
|
45232
|
-
if (insertAfter) sel.insertAfter(insertAfter, attrNode);
|
|
45233
|
-
else sel.append(attrNode);
|
|
45240
|
+
attachScopeAttr(sel, attr);
|
|
45234
45241
|
});
|
|
45235
45242
|
});
|
|
45236
45243
|
return transform.processSync(selector);
|
|
45237
45244
|
}
|
|
45245
|
+
function makeAttrNode(attr) {
|
|
45246
|
+
return import_postcss_selector_parser.default.attribute({
|
|
45247
|
+
attribute: attr,
|
|
45248
|
+
value: void 0,
|
|
45249
|
+
raws: {},
|
|
45250
|
+
quoteMark: null
|
|
45251
|
+
});
|
|
45252
|
+
}
|
|
45253
|
+
function attachScopeAttr(sel, attr) {
|
|
45254
|
+
const nodes = sel.nodes;
|
|
45255
|
+
let insertAfter;
|
|
45256
|
+
for (const node of nodes) {
|
|
45257
|
+
if (node.type === "combinator") {
|
|
45258
|
+
insertAfter = void 0;
|
|
45259
|
+
continue;
|
|
45260
|
+
}
|
|
45261
|
+
if (node.type === "pseudo" && node.value.startsWith("::")) continue;
|
|
45262
|
+
insertAfter = node;
|
|
45263
|
+
}
|
|
45264
|
+
if (!insertAfter) {
|
|
45265
|
+
sel.append(makeAttrNode(attr));
|
|
45266
|
+
return;
|
|
45267
|
+
}
|
|
45268
|
+
if (insertAfter.type === "pseudo" && insertAfter.value === ":where") {
|
|
45269
|
+
for (const inner of insertAfter.nodes) {
|
|
45270
|
+
attachScopeAttr(inner, attr);
|
|
45271
|
+
}
|
|
45272
|
+
return;
|
|
45273
|
+
}
|
|
45274
|
+
sel.insertAfter(insertAfter, makeAttrNode(attr));
|
|
45275
|
+
}
|
|
45238
45276
|
function isSubjectGlobal(sel) {
|
|
45239
45277
|
const nodes = sel.nodes;
|
|
45240
45278
|
let lastCombinator = -1;
|
|
@@ -45784,21 +45822,6 @@ function buildServerTsx(regions) {
|
|
|
45784
45822
|
code += "</>);\n}\n";
|
|
45785
45823
|
return { lang: "tsx", code, mappings };
|
|
45786
45824
|
}
|
|
45787
|
-
var VOID_TAGS = /* @__PURE__ */ new Set([
|
|
45788
|
-
"area",
|
|
45789
|
-
"base",
|
|
45790
|
-
"br",
|
|
45791
|
-
"col",
|
|
45792
|
-
"embed",
|
|
45793
|
-
"hr",
|
|
45794
|
-
"img",
|
|
45795
|
-
"input",
|
|
45796
|
-
"link",
|
|
45797
|
-
"meta",
|
|
45798
|
-
"source",
|
|
45799
|
-
"track",
|
|
45800
|
-
"wbr"
|
|
45801
|
-
]);
|
|
45802
45825
|
function appendTemplateTsx(code, mappings, tpl, tplOffset) {
|
|
45803
45826
|
let out = code;
|
|
45804
45827
|
let i = 0;
|
|
@@ -45846,7 +45869,7 @@ function appendTemplateTsx(code, mappings, tpl, tplOffset) {
|
|
|
45846
45869
|
if (ch === ">") break;
|
|
45847
45870
|
j++;
|
|
45848
45871
|
}
|
|
45849
|
-
if (
|
|
45872
|
+
if (VOID_ELEMENTS.has(tag.toLowerCase()) && j < tpl.length) {
|
|
45850
45873
|
let k = j - 1;
|
|
45851
45874
|
while (k > i && /\s/.test(tpl[k])) k--;
|
|
45852
45875
|
if (tpl[k] !== "/") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@statorjs/language-server",
|
|
3
|
-
"version": "0.1.33-next.
|
|
3
|
+
"version": "0.1.33-next.2",
|
|
4
4
|
"description": "Volar-based language server for .stator files.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"volar-service-typescript": "0.0.71",
|
|
34
34
|
"vscode-css-languageservice": "^6.3.0",
|
|
35
35
|
"vscode-uri": "^3.0.8",
|
|
36
|
-
"@statorjs/stator": "2.11.0-next.
|
|
36
|
+
"@statorjs/stator": "2.11.0-next.2"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"typescript": "^5.6.0"
|