@stacksjs/stx-vscode 0.2.412 → 0.2.414
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
|
@@ -1,20 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
enumerable: true,
|
|
12
|
-
configurable: true,
|
|
13
|
-
set: __exportSetter.bind(all, name)
|
|
14
|
-
});
|
|
1
|
+
var __esm = (fn, res, err) => () => {
|
|
2
|
+
if (fn)
|
|
3
|
+
try {
|
|
4
|
+
res = fn(fn = 0);
|
|
5
|
+
} catch (e) {
|
|
6
|
+
err = [e];
|
|
7
|
+
}
|
|
8
|
+
if (err)
|
|
9
|
+
throw err[0];
|
|
10
|
+
return res;
|
|
15
11
|
};
|
|
16
|
-
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
17
|
-
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
18
12
|
|
|
19
13
|
// ../vscode/src/ts-css/utils/class-matcher.ts
|
|
20
14
|
function extractClassesFromDocument(document, position) {
|
|
@@ -667,12 +661,12 @@ async function sortClasses(classes) {
|
|
|
667
661
|
const css = await importCssEngine().catch(() => null);
|
|
668
662
|
if (!css?.parseClass)
|
|
669
663
|
return classes;
|
|
670
|
-
const { builtInRules
|
|
664
|
+
const { builtInRules, parseClass, defaultConfig } = css;
|
|
671
665
|
const classesWithPriority = classes.map((className) => {
|
|
672
|
-
const parsed =
|
|
666
|
+
const parsed = parseClass(className);
|
|
673
667
|
let priority = Number.MAX_SAFE_INTEGER;
|
|
674
|
-
for (let i = 0;i <
|
|
675
|
-
const rule =
|
|
668
|
+
for (let i = 0;i < builtInRules.length; i++) {
|
|
669
|
+
const rule = builtInRules[i];
|
|
676
670
|
const result = rule(parsed, defaultConfig);
|
|
677
671
|
if (result) {
|
|
678
672
|
priority = i;
|
|
@@ -739,12 +733,6 @@ function createSortClassesCommand(vscodeModule) {
|
|
|
739
733
|
var init_sort_provider = () => {};
|
|
740
734
|
|
|
741
735
|
// ../vscode/src/ts-css/index.ts
|
|
742
|
-
var exports_ts_css = {};
|
|
743
|
-
__export(exports_ts_css, {
|
|
744
|
-
deactivateCss: () => deactivateCss,
|
|
745
|
-
activateCss: () => activateCss,
|
|
746
|
-
CssContext: () => CssContext
|
|
747
|
-
});
|
|
748
736
|
import * as vscode13 from "vscode";
|
|
749
737
|
async function activateCss(extensionContext) {
|
|
750
738
|
console.log("[ts-css] Activating utility class features...");
|
|
@@ -789,27 +777,27 @@ import * as vscode2 from "vscode";
|
|
|
789
777
|
|
|
790
778
|
// ../vscode/src/interfaces/animation-types.ts
|
|
791
779
|
var TransitionType;
|
|
792
|
-
((
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
780
|
+
((TransitionType) => {
|
|
781
|
+
TransitionType["Fade"] = "fade";
|
|
782
|
+
TransitionType["Slide"] = "slide";
|
|
783
|
+
TransitionType["Scale"] = "scale";
|
|
784
|
+
TransitionType["Flip"] = "flip";
|
|
785
|
+
TransitionType["Rotate"] = "rotate";
|
|
786
|
+
TransitionType["Custom"] = "custom";
|
|
799
787
|
})(TransitionType ||= {});
|
|
800
788
|
var TransitionDirection;
|
|
801
|
-
((
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
789
|
+
((TransitionDirection) => {
|
|
790
|
+
TransitionDirection["In"] = "in";
|
|
791
|
+
TransitionDirection["Out"] = "out";
|
|
792
|
+
TransitionDirection["Both"] = "both";
|
|
805
793
|
})(TransitionDirection ||= {});
|
|
806
794
|
var TransitionEase;
|
|
807
|
-
((
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
795
|
+
((TransitionEase) => {
|
|
796
|
+
TransitionEase["Linear"] = "linear";
|
|
797
|
+
TransitionEase["Ease"] = "ease";
|
|
798
|
+
TransitionEase["EaseIn"] = "ease-in";
|
|
799
|
+
TransitionEase["EaseOut"] = "ease-out";
|
|
800
|
+
TransitionEase["EaseInOut"] = "ease-in-out";
|
|
813
801
|
})(TransitionEase ||= {});
|
|
814
802
|
var DEFAULT_TRANSITION_OPTIONS = {
|
|
815
803
|
duration: 300,
|
|
@@ -1680,8 +1668,8 @@ ${propDetail.description}`);
|
|
|
1680
1668
|
switch (foundParamIndex) {
|
|
1681
1669
|
case 0:
|
|
1682
1670
|
if (Object.values(TransitionType).includes(fullParam)) {
|
|
1683
|
-
const
|
|
1684
|
-
hover.appendMarkdown(`**Transition Type**: ${
|
|
1671
|
+
const description = getTransitionTypeDescription(fullParam);
|
|
1672
|
+
hover.appendMarkdown(`**Transition Type**: ${description}`);
|
|
1685
1673
|
hover.appendMarkdown(`
|
|
1686
1674
|
|
|
1687
1675
|
**Available Types**:`);
|
|
@@ -1751,8 +1739,8 @@ ${propDetail.description}`);
|
|
|
1751
1739
|
return createHoverWithDiagnostics(hover, document, position);
|
|
1752
1740
|
case 4:
|
|
1753
1741
|
if (Object.values(TransitionDirection).includes(fullParam)) {
|
|
1754
|
-
const
|
|
1755
|
-
hover.appendMarkdown(`**Direction**: ${
|
|
1742
|
+
const description = getTransitionDirectionDescription(fullParam);
|
|
1743
|
+
hover.appendMarkdown(`**Direction**: ${description}`);
|
|
1756
1744
|
hover.appendMarkdown(`
|
|
1757
1745
|
|
|
1758
1746
|
**Available Directions**:`);
|
|
@@ -3906,14 +3894,14 @@ errors.notFound: "Page not found"`, "yaml");
|
|
|
3906
3894
|
if (propertyAccessMatch) {
|
|
3907
3895
|
const parentObject = propertyAccessMatch[1];
|
|
3908
3896
|
const propertyName = word;
|
|
3909
|
-
const
|
|
3910
|
-
if (
|
|
3897
|
+
const globalObjects = ["window", "document", "console", "navigator", "location", "localStorage", "sessionStorage", "history", "Math", "JSON"];
|
|
3898
|
+
if (globalObjects.includes(parentObject)) {} else {
|
|
3911
3899
|
const parentTypeMatch = tsContent.match(new RegExp(`(?:const|let|var)\\s+${parentObject}\\s*:\\s*([\\w\\[\\]<>]+)`, "i"));
|
|
3912
3900
|
if (parentTypeMatch) {
|
|
3913
3901
|
const parentType = parentTypeMatch[1].replace("[]", "");
|
|
3914
|
-
const
|
|
3915
|
-
const
|
|
3916
|
-
const typeBody =
|
|
3902
|
+
const interfaceMatch = tsContent.match(new RegExp(`interface\\s+${parentType}\\s*\\{([^}]*)\\}`, "s"));
|
|
3903
|
+
const typeMatch = tsContent.match(new RegExp(`type\\s+${parentType}\\s*=\\s*\\{([^}]*)\\}`, "s"));
|
|
3904
|
+
const typeBody = interfaceMatch ? interfaceMatch[1] : typeMatch ? typeMatch[1] : null;
|
|
3917
3905
|
if (typeBody) {
|
|
3918
3906
|
const propMatch = typeBody.match(new RegExp(`${propertyName}\\s*:\\s*([^;,\\n]+)`, "i"));
|
|
3919
3907
|
if (propMatch) {
|
|
@@ -3927,21 +3915,21 @@ errors.notFound: "Page not found"`, "yaml");
|
|
|
3927
3915
|
actualValue = valueMatch[1].trim();
|
|
3928
3916
|
}
|
|
3929
3917
|
}
|
|
3930
|
-
const
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3918
|
+
const hoverContent = new vscode2.MarkdownString;
|
|
3919
|
+
hoverContent.isTrusted = true;
|
|
3920
|
+
hoverContent.supportHtml = true;
|
|
3921
|
+
hoverContent.appendCodeblock(`(property) ${parentObject}.${propertyName}: ${propType}`, "typescript");
|
|
3934
3922
|
if (actualValue) {
|
|
3935
|
-
|
|
3923
|
+
hoverContent.appendText(`
|
|
3936
3924
|
|
|
3937
3925
|
`);
|
|
3938
|
-
|
|
3926
|
+
hoverContent.appendMarkdown(`**Value:** \`${actualValue}\``);
|
|
3939
3927
|
}
|
|
3940
|
-
|
|
3928
|
+
hoverContent.appendText(`
|
|
3941
3929
|
|
|
3942
3930
|
`);
|
|
3943
|
-
|
|
3944
|
-
return new vscode2.Hover(
|
|
3931
|
+
hoverContent.appendMarkdown(`Property of \`${parentType}\``);
|
|
3932
|
+
return new vscode2.Hover(hoverContent, wordRange);
|
|
3945
3933
|
}
|
|
3946
3934
|
}
|
|
3947
3935
|
}
|
|
@@ -3959,18 +3947,18 @@ errors.notFound: "Page not found"`, "yaml");
|
|
|
3959
3947
|
if (tsHovers && tsHovers.length > 0) {
|
|
3960
3948
|
const tsHover = tsHovers[0];
|
|
3961
3949
|
if (tsHover.contents && tsHover.contents.length > 0) {
|
|
3962
|
-
const
|
|
3963
|
-
|
|
3964
|
-
|
|
3950
|
+
const hoverContent = new vscode2.MarkdownString;
|
|
3951
|
+
hoverContent.isTrusted = true;
|
|
3952
|
+
hoverContent.supportHtml = true;
|
|
3965
3953
|
for (const content of tsHover.contents) {
|
|
3966
3954
|
if (typeof content === "string") {
|
|
3967
|
-
|
|
3955
|
+
hoverContent.appendMarkdown(content);
|
|
3968
3956
|
} else if (content instanceof vscode2.MarkdownString) {
|
|
3969
|
-
|
|
3957
|
+
hoverContent.appendMarkdown(content.value);
|
|
3970
3958
|
}
|
|
3971
3959
|
}
|
|
3972
|
-
if (
|
|
3973
|
-
return new vscode2.Hover(
|
|
3960
|
+
if (hoverContent.value && hoverContent.value.trim().length > 0) {
|
|
3961
|
+
return new vscode2.Hover(hoverContent);
|
|
3974
3962
|
}
|
|
3975
3963
|
}
|
|
3976
3964
|
}
|
|
@@ -4149,10 +4137,10 @@ errors.notFound: "Page not found"`, "yaml");
|
|
|
4149
4137
|
let arrowFunctionSignature = null;
|
|
4150
4138
|
if (isArrowFunction) {
|
|
4151
4139
|
console.log(`Processing arrow function: ${word}`);
|
|
4152
|
-
const
|
|
4153
|
-
if (
|
|
4154
|
-
const params =
|
|
4155
|
-
const returnTypeStr =
|
|
4140
|
+
const arrowFunctionMatch = tsContent.match(new RegExp(`const\\s+${word}\\s*=\\s*(\\([^)]*\\))\\s*:\\s*([\\w\\[\\]<>|\\s]+)\\s*=>`, "s"));
|
|
4141
|
+
if (arrowFunctionMatch) {
|
|
4142
|
+
const params = arrowFunctionMatch[1];
|
|
4143
|
+
const returnTypeStr = arrowFunctionMatch[2].trim();
|
|
4156
4144
|
arrowFunctionSignature = `${params}: ${returnTypeStr}`;
|
|
4157
4145
|
console.log(`Extracted arrow function signature: ${arrowFunctionSignature}`);
|
|
4158
4146
|
}
|
|
@@ -4165,17 +4153,17 @@ errors.notFound: "Page not found"`, "yaml");
|
|
|
4165
4153
|
console.log(`Displaying arrow function signature: ${arrowFunctionSignature}`);
|
|
4166
4154
|
} else if (functionInfo) {
|
|
4167
4155
|
const returnType = functionInfo.returnType;
|
|
4168
|
-
const
|
|
4156
|
+
const isArrowFunction = constMatch || letMatch || varMatch;
|
|
4169
4157
|
const functionSignatureInfo = allJsDocs.find((doc) => doc.symbol === word && doc.symbolType === "function-signature" && doc.fullSignature);
|
|
4170
4158
|
console.log(`Function hover for ${word}:`, functionSignatureInfo ? "Found signature info" : "No signature info");
|
|
4171
4159
|
if (functionSignatureInfo && functionSignatureInfo.fullSignature) {
|
|
4172
4160
|
console.log(`Using full signature for ${word}: ${functionSignatureInfo.fullSignature}`);
|
|
4173
|
-
if (
|
|
4161
|
+
if (isArrowFunction) {
|
|
4174
4162
|
hoverContent.appendCodeblock(`${symbolType} ${word} = ${functionSignatureInfo.fullSignature} => { ... }`, "typescript");
|
|
4175
4163
|
} else {
|
|
4176
4164
|
hoverContent.appendCodeblock(`function ${word}${functionSignatureInfo.fullSignature}`, "typescript");
|
|
4177
4165
|
}
|
|
4178
|
-
} else if (
|
|
4166
|
+
} else if (isArrowFunction) {
|
|
4179
4167
|
hoverContent.appendCodeblock(`${symbolType} ${word} = (): ${returnType} => { ... }`, "typescript");
|
|
4180
4168
|
} else {
|
|
4181
4169
|
hoverContent.appendCodeblock(`function ${word}(): ${returnType}`, "typescript");
|
|
@@ -4999,10 +4987,10 @@ function createDefinitionProvider(virtualTsDocumentProvider) {
|
|
|
4999
4987
|
const tsLines = tsContent.split(`
|
|
5000
4988
|
`);
|
|
5001
4989
|
for (let i = 0;i < tsLines.length; i++) {
|
|
5002
|
-
const
|
|
5003
|
-
const isDeclaration =
|
|
4990
|
+
const line = tsLines[i];
|
|
4991
|
+
const isDeclaration = line.includes(`interface ${word}`) || line.includes(`type ${word}`) || line.includes(`const ${word}`) || line.includes(`let ${word}`) || line.includes(`function ${word}`);
|
|
5004
4992
|
if (isDeclaration) {
|
|
5005
|
-
const tsPosition = new vscode5.Position(i,
|
|
4993
|
+
const tsPosition = new vscode5.Position(i, line.indexOf(word));
|
|
5006
4994
|
const stxPosition = virtualTsDocumentProvider.getStxPositionFromTs(document.uri, tsPosition);
|
|
5007
4995
|
if (stxPosition) {
|
|
5008
4996
|
return new vscode5.Location(document.uri, new vscode5.Range(stxPosition, stxPosition.translate(0, word.length)));
|
|
@@ -5470,8 +5458,8 @@ function createCodeActionsProvider() {
|
|
|
5470
5458
|
fix.isPreferred = true;
|
|
5471
5459
|
let insertLine = document.lineCount - 1;
|
|
5472
5460
|
for (let i = diagnostic.range.start.line + 1;i < document.lineCount; i++) {
|
|
5473
|
-
const
|
|
5474
|
-
if (
|
|
5461
|
+
const line = document.lineAt(i).text.trim();
|
|
5462
|
+
if (line.match(/^@\w+/) && !line.startsWith(`@end`)) {
|
|
5475
5463
|
insertLine = i - 1;
|
|
5476
5464
|
break;
|
|
5477
5465
|
}
|
|
@@ -5503,9 +5491,9 @@ function createCodeActionsProvider() {
|
|
|
5503
5491
|
const directiveName = match[1];
|
|
5504
5492
|
const removeFix = new vscode9.CodeAction(`Remove @${directiveName}`, vscode9.CodeActionKind.QuickFix);
|
|
5505
5493
|
removeFix.diagnostics = [diagnostic];
|
|
5506
|
-
const
|
|
5494
|
+
const line = document.lineAt(diagnostic.range.start.line);
|
|
5507
5495
|
removeFix.edit = new vscode9.WorkspaceEdit;
|
|
5508
|
-
removeFix.edit.delete(document.uri,
|
|
5496
|
+
removeFix.edit.delete(document.uri, line.range);
|
|
5509
5497
|
actions.push(removeFix);
|
|
5510
5498
|
}
|
|
5511
5499
|
}
|
|
@@ -5555,7 +5543,7 @@ function createFoldingRangeProvider() {
|
|
|
5555
5543
|
return [];
|
|
5556
5544
|
}
|
|
5557
5545
|
const foldingRanges = [];
|
|
5558
|
-
const
|
|
5546
|
+
const directivePairs = {
|
|
5559
5547
|
if: "endif",
|
|
5560
5548
|
unless: "endunless",
|
|
5561
5549
|
for: "endfor",
|
|
@@ -5611,7 +5599,7 @@ function createFoldingRangeProvider() {
|
|
|
5611
5599
|
match = directiveRegex.exec(text);
|
|
5612
5600
|
while (match !== null) {
|
|
5613
5601
|
const directiveName = match[1];
|
|
5614
|
-
if (
|
|
5602
|
+
if (directivePairs[directiveName]) {
|
|
5615
5603
|
stack.push({
|
|
5616
5604
|
name: directiveName,
|
|
5617
5605
|
line: lineNum,
|
|
@@ -5620,7 +5608,7 @@ function createFoldingRangeProvider() {
|
|
|
5620
5608
|
} else {
|
|
5621
5609
|
const isEndDirective = directiveName.startsWith("end");
|
|
5622
5610
|
if (isEndDirective) {
|
|
5623
|
-
const openingName = Object.keys(
|
|
5611
|
+
const openingName = Object.keys(directivePairs).find((key) => directivePairs[key] === directiveName);
|
|
5624
5612
|
if (openingName && stack.length > 0) {
|
|
5625
5613
|
const lastOpening = stack[stack.length - 1];
|
|
5626
5614
|
if (lastOpening.name === openingName) {
|
|
@@ -6893,8 +6881,8 @@ async function activateStxLanguage(context, options) {
|
|
|
6893
6881
|
const utilityClassesEnabled = vscode15.workspace.getConfiguration("stx.utilityClasses").get("enable", true);
|
|
6894
6882
|
if (utilityClassesEnabled) {
|
|
6895
6883
|
try {
|
|
6896
|
-
|
|
6897
|
-
await
|
|
6884
|
+
await Promise.resolve().then(() => init_ts_css());
|
|
6885
|
+
await activateCss(context);
|
|
6898
6886
|
console.log("stx Extension - Css utility class features activated");
|
|
6899
6887
|
} catch (error) {
|
|
6900
6888
|
console.error("stx Extension - Failed to activate Css features:", error);
|
|
@@ -6967,67 +6955,67 @@ function deactivate() {
|
|
|
6967
6955
|
deactivateStxLanguage();
|
|
6968
6956
|
}
|
|
6969
6957
|
export {
|
|
6970
|
-
|
|
6971
|
-
tokenModifiers,
|
|
6972
|
-
stacksProvidesStx,
|
|
6973
|
-
sortClasses,
|
|
6974
|
-
snippetCompletionItems,
|
|
6975
|
-
resolveTemplatePath,
|
|
6976
|
-
registerSnippetCompletions,
|
|
6977
|
-
registerColorDecorations,
|
|
6978
|
-
prettifyCSS,
|
|
6979
|
-
normalizeTemplatePath,
|
|
6980
|
-
loadCssEngineConfig,
|
|
6981
|
-
legend,
|
|
6982
|
-
isInStyleTag,
|
|
6983
|
-
isInScriptTag,
|
|
6984
|
-
isCssClassName,
|
|
6985
|
-
isColorClass,
|
|
6986
|
-
getTemplatePathRange,
|
|
6987
|
-
getDefaultConfig as getCssDefaultConfig,
|
|
6988
|
-
getClassAtPosition,
|
|
6989
|
-
formatJSDoc,
|
|
6990
|
-
formatCSSDeclarations,
|
|
6991
|
-
findForeachDeclarationForVariable,
|
|
6992
|
-
findCssStylesForClass,
|
|
6993
|
-
findCssDefinitionForClass,
|
|
6994
|
-
extractTemplatePath,
|
|
6995
|
-
extractRuleForClass,
|
|
6996
|
-
extractColorFromCSS,
|
|
6997
|
-
extractClassesFromLine,
|
|
6998
|
-
extractClassesFromDocument,
|
|
6999
|
-
extractAllColors,
|
|
7000
|
-
deactivateStxLanguage,
|
|
7001
|
-
deactivateCss,
|
|
7002
|
-
deactivate,
|
|
7003
|
-
createSortClassesCommand,
|
|
7004
|
-
createSemanticTokensProvider,
|
|
7005
|
-
createPathCompletionProvider,
|
|
7006
|
-
createHoverProvider,
|
|
7007
|
-
createFoldingRangeProvider,
|
|
7008
|
-
createDocumentLinkProvider,
|
|
7009
|
-
createDiagnosticsProvider,
|
|
7010
|
-
createDefinitionProvider,
|
|
7011
|
-
createCssHoverProvider,
|
|
7012
|
-
createCssCompletionProvider,
|
|
7013
|
-
createCompletionProvider,
|
|
7014
|
-
createCodeActionsProvider,
|
|
7015
|
-
configureTypeScriptPlugin,
|
|
7016
|
-
addRemToPxComment,
|
|
7017
|
-
activateStxLanguage,
|
|
7018
|
-
activateCss,
|
|
7019
|
-
activate,
|
|
7020
|
-
VirtualTsDocumentProvider,
|
|
7021
|
-
TransitionType,
|
|
7022
|
-
TransitionEase,
|
|
7023
|
-
TransitionDirection,
|
|
7024
|
-
TYPESCRIPT_EXTENSION_ID,
|
|
7025
|
-
TS_PLUGIN_SETTINGS,
|
|
7026
|
-
TS_PLUGIN_NAME,
|
|
7027
|
-
STX_EXTENSION_ID,
|
|
7028
|
-
STACKS_EXTENSION_ID,
|
|
7029
|
-
PropsTypeExtractor,
|
|
7030
|
-
DEFAULT_TRANSITION_OPTIONS,
|
|
6958
|
+
ComponentRegistry,
|
|
7031
6959
|
CssContext,
|
|
7032
|
-
|
|
6960
|
+
DEFAULT_TRANSITION_OPTIONS,
|
|
6961
|
+
PropsTypeExtractor,
|
|
6962
|
+
STACKS_EXTENSION_ID,
|
|
6963
|
+
STX_EXTENSION_ID,
|
|
6964
|
+
TS_PLUGIN_NAME,
|
|
6965
|
+
TS_PLUGIN_SETTINGS,
|
|
6966
|
+
TYPESCRIPT_EXTENSION_ID,
|
|
6967
|
+
TransitionDirection,
|
|
6968
|
+
TransitionEase,
|
|
6969
|
+
TransitionType,
|
|
6970
|
+
VirtualTsDocumentProvider,
|
|
6971
|
+
activate,
|
|
6972
|
+
activateCss,
|
|
6973
|
+
activateStxLanguage,
|
|
6974
|
+
addRemToPxComment,
|
|
6975
|
+
configureTypeScriptPlugin,
|
|
6976
|
+
createCodeActionsProvider,
|
|
6977
|
+
createCompletionProvider,
|
|
6978
|
+
createCssCompletionProvider,
|
|
6979
|
+
createCssHoverProvider,
|
|
6980
|
+
createDefinitionProvider,
|
|
6981
|
+
createDiagnosticsProvider,
|
|
6982
|
+
createDocumentLinkProvider,
|
|
6983
|
+
createFoldingRangeProvider,
|
|
6984
|
+
createHoverProvider,
|
|
6985
|
+
createPathCompletionProvider,
|
|
6986
|
+
createSemanticTokensProvider,
|
|
6987
|
+
createSortClassesCommand,
|
|
6988
|
+
deactivate,
|
|
6989
|
+
deactivateCss,
|
|
6990
|
+
deactivateStxLanguage,
|
|
6991
|
+
extractAllColors,
|
|
6992
|
+
extractClassesFromDocument,
|
|
6993
|
+
extractClassesFromLine,
|
|
6994
|
+
extractColorFromCSS,
|
|
6995
|
+
extractRuleForClass,
|
|
6996
|
+
extractTemplatePath,
|
|
6997
|
+
findCssDefinitionForClass,
|
|
6998
|
+
findCssStylesForClass,
|
|
6999
|
+
findForeachDeclarationForVariable,
|
|
7000
|
+
formatCSSDeclarations,
|
|
7001
|
+
formatJSDoc,
|
|
7002
|
+
getClassAtPosition,
|
|
7003
|
+
getDefaultConfig as getCssDefaultConfig,
|
|
7004
|
+
getTemplatePathRange,
|
|
7005
|
+
isColorClass,
|
|
7006
|
+
isCssClassName,
|
|
7007
|
+
isInScriptTag,
|
|
7008
|
+
isInStyleTag,
|
|
7009
|
+
legend,
|
|
7010
|
+
loadCssEngineConfig,
|
|
7011
|
+
normalizeTemplatePath,
|
|
7012
|
+
prettifyCSS,
|
|
7013
|
+
registerColorDecorations,
|
|
7014
|
+
registerSnippetCompletions,
|
|
7015
|
+
resolveTemplatePath,
|
|
7016
|
+
snippetCompletionItems,
|
|
7017
|
+
sortClasses,
|
|
7018
|
+
stacksProvidesStx,
|
|
7019
|
+
tokenModifiers,
|
|
7020
|
+
tokenTypes
|
|
7033
7021
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var
|
|
2
|
-
`)
|
|
3
|
-
`)return-1;if(
|
|
4
|
-
`)
|
|
1
|
+
var xt=Object.create;var{getPrototypeOf:St,defineProperty:Ee,getOwnPropertyNames:bt}=Object;var ve=Object.prototype.hasOwnProperty;function yt(e){return this[e]}var wt,Et,V=(e,s,t)=>{var n=e!=null&&typeof e==="object";if(n){var r=s?wt??=new WeakMap:Et??=new WeakMap,a=r.get(e);if(a)return a}t=e!=null?xt(St(e)):{};let o=s||!e||!e.__esModule||!ve.call(e,"default")?Ee(t,"default",{value:e,enumerable:!0}):t;if(e&&typeof e==="object"||typeof e==="function"){for(let i of bt(e))if(!ve.call(o,i))Ee(o,i,{get:yt.bind(e,i),enumerable:!0})}if(n)r.set(e,o);return o};var ot=require("node:crypto"),N=require("node:fs"),at=require("node:os"),P=V(require("node:path"));var ae=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl","useTimeoutFn"];var ue=V(require("node:path"),1);function vt(e,s){let t=e[s],n=s+1;while(n<e.length){if(e[n]==="\\"){n+=2;continue}if(e[n]===t)return n+1;n++}return e.length}function _t(e,s){let t=s+1;while(t<e.length){if(e[t]==="\\"){t+=2;continue}if(e[t]==="`")return t+1;if(e[t]==="$"&&e[t+1]==="{"){if(t=_e(e,t+2),t<e.length)t++;continue}t++}return e.length}function _e(e,s){let t=1,n=s;while(n<e.length){let r=e[n];if(r==="\\"){n+=2;continue}if(r==='"'||r==="'"){n=vt(e,n);continue}if(r==="`"){n=_t(e,n);continue}if(r==="/"&&e[n+1]==="/"){while(n<e.length&&e[n]!==`
|
|
2
|
+
`)n++;continue}if(r==="/"&&e[n+1]==="*"){n+=2;while(n<e.length&&e.slice(n,n+2)!=="*/")n++;n+=2;continue}if(r==="{"){t++,n++;continue}if(r==="}"){if(t--,t===0)return n;n++;continue}n++}return e.length}var Tt=new Set(["return","typeof","instanceof","in","of","new","delete","void","throw","case","do","else","yield","await"]);function $t(e,s){if(s)return Tt.has(s);return!(e===")"||e==="]"||e===Q)}var Q="\x00";function Ct(e,s){let t=s+1,n=!1;while(t<e.length){let r=e[t];if(r===`
|
|
3
|
+
`)return-1;if(r==="\\"){t+=2;continue}if(r==="[")n=!0;else if(r==="]")n=!1;else if(r==="/"&&!n){t++;while(t<e.length&&/[a-z]/i.test(e[t]))t++;return t}t++}return-1}function L(e){let s="",t=0,n="",r="";while(t<e.length){let a=e.slice(t,t+2);if(a==="//"){while(t<e.length&&e[t]!==`
|
|
4
|
+
`)s+=" ",t++;continue}if(a==="/*"){while(t<e.length&&e.slice(t,t+2)!=="*/")s+=e[t]===`
|
|
5
5
|
`?`
|
|
6
|
-
`:" ",
|
|
6
|
+
`:" ",t++;s+=" ",t+=2;continue}let o=e[t];if(o==='"'||o==="'"){let i=o;s+=" ",t++;while(t<e.length&&e[t]!==i){if(e[t]==="\\"){s+=" ",t+=2;continue}s+=e[t]===`
|
|
7
7
|
`?`
|
|
8
|
-
`:" ",
|
|
8
|
+
`:" ",t++}s+=" ",t++,n=Q,r="";continue}if(o==="/"&&$t(n,r)){let i=Ct(e,t);if(i!==-1){s+=`/${" ".repeat(i-t-2)}/`,t=i,n=Q,r="";continue}}if(o==="`"){s+=" ",t++;while(t<e.length&&e[t]!=="`"){if(e[t]==="\\"){s+=" ",t+=2;continue}if(e[t]==="$"&&e[t+1]==="{"){let i=t+2,c=_e(e,i);if(s+=" ",s+=L(e.slice(i,c)),c<e.length)s+=" ";t=c+1;continue}s+=e[t]===`
|
|
9
9
|
`?`
|
|
10
|
-
`:" ",
|
|
10
|
+
`:" ",t++}s+=" ",t++,n=Q,r="";continue}if(s+=o,t++,/[\w$]/.test(o))r=/[\w$]/.test(n)?r+o:o,n=o;else if(!/\s/.test(o))n=o,r=""}return s}function Y(e){let s=new Uint16Array(e.length),t=0,n=!0;for(let r=0;r<e.length;r++){let a=e[r];if(a===")"||a==="]"||a==="}")if(t===0)n=!1;else t--;if(s[r]=t,a==="("||a==="["||a==="{")t++}return{depths:s,balanced:n&&t===0}}function Te(e){let s=e.indexOf(" as ");if(s!==-1){let a=e.slice(0,s).trim(),o=e.slice(s+4).trim();return a&&o?{arrayExpr:a,itemVar:o}:null}let t=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(e);if(!t)return null;let n=t[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),r=t[2].trim();return n&&r?{arrayExpr:r,itemVar:n}:null}var G=["batch","cachedQuery","clearServerData","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","flushKeptState","forgetKeptState","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","keptState","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refresh","registerStoresClient","setKeptScope","setRouteParams","state","untrack","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useDocumentVisibility","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useModel","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"];var At=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"];var _n=G.filter((e)=>!At.includes(e));var Rt=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],kt=["x-init","x-transition","x-effect","x-on"],Tn=[...Rt,...kt];var J=V(require("node:fs"),1),W=V(require("node:path"),1);function $e(e,s,t,n){let r=0;for(let a=s;a<e.length;a++)if(e[a]===t)r++;else if(e[a]===n&&!(n===">"&&e[a-1]==="=")){if(--r===0)return a}return-1}function Dt(e){let s=L(e),t=0,n=0,r=[];for(let a=0;a<s.length;a++)if("([{".includes(s[a]))t++;else if(")]}".includes(s[a]))t--;else if(s[a]===","&&t===0)r.push(e.slice(n,a).trim()),n=a+1;return r.push(e.slice(n).trim()),r}function ce(e,s){let t=L(e),n=new RegExp(`\\b(?:${s.map((r)=>r.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let r of t.matchAll(n)){let a=r.index+r[0].length,o="";if(t[a]==="<"){let c=$e(t,a,"<",">");if(c<0)continue;o=e.slice(a+1,c),a=c+1;while(/\s/.test(t[a]||"")&&a<t.length)a++}if(t[a]!=="(")continue;let i=$e(t,a,"(",")");if(i>=0)return{type:o,args:Dt(e.slice(a+1,i))}}return null}var Ce=`
|
|
11
11
|
type __StxCtor<T> = T extends StringConstructor ? string : T extends NumberConstructor ? number : T extends BooleanConstructor ? boolean : T extends ArrayConstructor ? unknown[] : T extends ObjectConstructor ? object : T extends readonly unknown[] ? __StxCtor<T[number]> : T extends abstract new (...args: any[]) => infer V ? V : unknown;
|
|
12
12
|
type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
|
|
13
13
|
type __StxOption<T> = T extends { type: infer C } ? __StxCtor<C> : T extends { default: infer D } ? D extends (...args: any[]) => infer V ? V : __StxWiden<D> : __StxCtor<T>;
|
|
@@ -15,28 +15,28 @@ type __StxRequired<O> = { [K in keyof O]-?: O[K] extends { required: true } ? K
|
|
|
15
15
|
type __StxDefaulted<O> = { [K in keyof O]-?: O[K] extends { default: unknown } ? K : never }[keyof O];
|
|
16
16
|
type __StxOptions<O> = { [K in Exclude<__StxRequired<O>, __StxDefaulted<O>>]: __StxOption<O[K]> } & { [K in Exclude<keyof O, Exclude<__StxRequired<O>, __StxDefaulted<O>>>]?: __StxOption<O[K]> };
|
|
17
17
|
type __StxDefaults<P, K> = Omit<P, Extract<keyof P, K>> & Partial<Pick<P, Extract<keyof P, K>>>;
|
|
18
|
-
`;function
|
|
19
|
-
`)}),
|
|
18
|
+
`;function Ae(e,s){let t=[],n={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},r=L(e),a=e.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(g,b,y,S,w)=>{if(r.slice(w,w+6)!=="import")return g;if(S.endsWith(".stx"))return"";let v=`${s}Import${t.length}`;if(t.push(`import * as ${v} from ${JSON.stringify(S)};`),b.startsWith("*"))return`import ${b.replace(/^\*\s+as\s+/,"")} = ${v};`;if(!b.startsWith("{"))return`import ${b} = ${v}.default;`;return b.slice(1,-1).split(",").map((T)=>{let[_,C=_]=T.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!_)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(S)&&_ in n)n[_].push(C);return`import ${C} = ${v}.${_};`}).join(`
|
|
19
|
+
`)}),o=ce(e,n.defineProps),i=ce(e,n.defineEmits),c=ce(e,n.withDefaults);if(!o&&!i)return{declarations:"",props:null,events:null};let u=[],p=null,m=null;if(o){u.push(`const __options = (${o.args[0]||"{}"}) as const;`),u.push(`const __defaults = (${c?.args[1]||"{}"});`);let g=o.type||"__StxOptions<typeof __options>";u.push(`export type __StxProps = __StxDefaults<${g}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),p=`${s}.__StxProps`}if(i)u.push(`const __events = (${i.args[0]||"[]"}) as const;`),u.push(`export type __StxEvents = ${i.type||"Record<(typeof __events)[number], any[]>"};`),m=`${s}.__StxEvents`;return{declarations:`${t.join(`
|
|
20
20
|
`)}
|
|
21
|
-
namespace ${
|
|
22
|
-
${
|
|
23
|
-
${
|
|
21
|
+
namespace ${s} {
|
|
22
|
+
${a}
|
|
23
|
+
${u.join(`
|
|
24
24
|
`)}
|
|
25
|
-
}`,props:
|
|
26
|
-
`).length,column:
|
|
27
|
-
`)}},
|
|
28
|
-
`):"",checks:
|
|
29
|
-
`,
|
|
30
|
-
`)
|
|
31
|
-
`).length-1,
|
|
32
|
-
`.repeat(
|
|
33
|
-
`),
|
|
34
|
-
`)}):void 0,
|
|
35
|
-
`);
|
|
36
|
-
`).entries())if(
|
|
37
|
-
`))
|
|
38
|
-
`),lineMap:
|
|
39
|
-
`).length;
|
|
40
|
-
`)+1)+1,offset:
|
|
25
|
+
}`,props:p,events:m}}var z=V(require("node:fs"),1),R=V(require("node:path"),1),Re=new Map;function ke(e,s=!0){let t=Re.get(e);if(s&&t)return t;let n=new Map,r=[R.default.join(e,"src"),R.default.join(e,"dist"),e];function a(o,i){if(i>6)return;let c;try{c=z.default.readdirSync(o,{withFileTypes:!0})}catch{return}for(let u of c){let p=R.default.join(o,u.name);if(u.isDirectory()){if(u.name==="node_modules"||u.name.startsWith("."))continue;a(p,i+1)}else if(u.isFile()&&u.name.endsWith(".stx")){let m=u.name.slice(0,-4);if(!n.has(m))n.set(m,p);let g=m.toLowerCase();if(!n.has(g))n.set(g,p);let b=m.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!n.has(b))n.set(b,p)}}}for(let o of r)if(a(o,0),n.size>0)break;if(s)Re.set(e,n);return n}function De(e,s){if(e.startsWith(".")||e.startsWith("/"))return null;let t=s;while(!0){let n=R.default.join(t,"node_modules",e);try{if(z.default.statSync(n).isDirectory())return n}catch{}let r=R.default.dirname(t);if(r===t)return null;t=r}}function Pe(e,s,t={}){return[R.default.resolve(R.default.dirname(s),`${e}.stx`),R.default.resolve(R.default.dirname(s),e),R.default.resolve(t.componentsDir||"components",`${e}.stx`),R.default.resolve(t.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function Ie(e){let s=e.endsWith(".stx")?e.slice(0,-4):e,t=s.split("-").map((r)=>r.charAt(0).toUpperCase()+r.slice(1)).join(""),n=s.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return[s,t,n]}function Pt(e,s){let[t,n,r]=Ie(e);for(let a of[t,t.toLowerCase(),n,r]){let o=s?.__importedComponents?.get(a);if(o!==void 0)return o}}function*It(e,s,t={},n){let r=Ie(e);if(r[0].startsWith("./")||r[0].startsWith("../")){yield R.default.resolve(R.default.dirname(s),`${r[0]}.stx`);return}let a=[...new Set(r.map((c)=>`${c}.stx`))],o=t.projectRoot||process.cwd(),i=[...n?.__originalFilePath?[R.default.join(R.default.dirname(n.__originalFilePath),"components")]:[],...t.componentsDir?[t.componentsDir]:[],R.default.join(R.default.dirname(s),"components"),R.default.resolve(o,"src/components"),R.default.resolve(o,"components"),R.default.resolve("/home/runner/work/stx/stx/packages/stx/src","components")];for(let c of new Set(i)){for(let u of a)yield R.default.join(c,u);try{for(let u of z.default.readdirSync(c,{withFileTypes:!0}))if(u.isDirectory())for(let p of a)yield R.default.join(c,u.name,p)}catch{}}}function Le(e,s,t={},n){let r=Pt(e,n);if(r!==void 0)return r;for(let a of It(e,s,t,n))try{if(z.default.statSync(a,{throwIfNoEntry:!1})?.isFile())return a}catch{}return null}var Oe=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);function Me(e){if(e.includes("-")||e==="component")return!1;if(/^[A-Z]/.test(e))return!/[a-z]/.test(e)&&[...Oe].some((s)=>s.toLowerCase()===e.toLowerCase());return Oe.has(e)||/[A-Z]/.test(e)}function*Lt(e){let s=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,t;while(t=s.exec(e)){let n=s.lastIndex,r=[];while(n<e.length){while(/\s/.test(e[n]||""))n++;if(e[n]===">"||e.slice(n,n+2)==="/>"){n+=e[n]===">"?1:2;break}let a=/^[^\s=/>]+/.exec(e.slice(n))?.[0];if(!a){n++;continue}let o=n;n+=a.length;while(/\s/.test(e[n]||""))n++;if(e[n]!=="="){r.push({name:a,value:!0,offset:o,braced:!1});continue}n++;while(/\s/.test(e[n]||""))n++;let i=e[n],c=i==="{",u=i==='"'||i==="'";if(u||c)n++;let p=n;if(c){let m=L(e.slice(n)),g=1,b=0;for(;b<m.length;b++){if(m[b]==="{")g++;if(m[b]==="}"&&--g===0)break}n+=b}else if(u)while(n<e.length&&e[n]!==i)n++;else while(n<e.length&&!/[\s/>]/.test(e[n]))n++;if(r.push({name:a,value:e.slice(p,n),offset:p,braced:c}),u||c)n++}s.lastIndex=n,yield{name:t[1],offset:t.index,attributes:r}}}function je(e,s,t){let n=[],r=[Ce,"type __StxAssignedValue<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? T extends () => infer V ? V : T : T;","type __StxProp<P, K> = K extends keyof P ? P[K] : unknown;",'type __StxEvent<E, K> = K extends keyof E ? E[K] extends readonly unknown[] ? Exclude<E[K]["length"], 0 | 1> extends never ? E[K][0] : E[K] : E[K] : any;'],a=new Map,o=new Map,i=new Map,c=t.scriptCode(e,t.filePath),u=L(c);for(let y of c.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(u.slice(y.index,y.index+6)!=="import")continue;let S=y[2],w=W.default.isAbsolute(S)||S.startsWith(".")?W.default.resolve(W.default.dirname(t.filePath),S):De(S,W.default.dirname(t.filePath));if(!w)continue;let v=w.endsWith(".stx")?w:J.default.existsSync(`${w}.stx`)?`${w}.stx`:void 0,T=v?null:ke(w,!1),_=y[1].startsWith("{")?y[1].slice(1,-1).split(","):[y[1]];for(let C of _){let[I,A=I]=C.trim().split(/\s+as\s+/),O=v||T?.get(I)||T?.get(I.toLowerCase());if(O)i.set(A,O),i.set(A.toLowerCase(),O),i.set(A.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),O)}}for(let y of s.matchAll(/@import\s*\(([^)]+)\)/g))for(let S of y[1].matchAll(/['"]([^'"]+)['"]/g)){let w=Pe(S[1],t.filePath,t).find((v)=>J.default.statSync(v,{throwIfNoEntry:!1})?.isFile());if(w)i.set(W.default.basename(S[1]).replace(/\.stx$/,""),w)}let p={__importedComponents:i},m=new Map,g=(y,S,w)=>{let v=e.slice(0,y);return{code:S,offset:y,attribute:w,anchor:!0,kind:"directive",line:v.split(`
|
|
26
|
+
`).length,column:y-v.lastIndexOf(`
|
|
27
|
+
`)}},b=(y,S,w)=>n.push({expression:y,statement:{text:S+y.code+w,prefixLength:S.length}});for(let y of Lt(s)){if(Me(y.name)||y.name==="component")continue;let S=Le(y.name,t.filePath,t,p);if(!S)continue;let w=m.get(S);if(!w){let T;try{T=t.readComponent?t.readComponent(S):J.default.readFileSync(S,"utf8")}catch{continue}if(T===void 0)continue;o.set(S,T),w=Ae(t.scriptCode(T,S),`__StxComponent${m.size}`),m.set(S,w),r.push(w.declarations)}let v=[];for(let T of y.attributes){let{name:_,offset:C}=T,I=T.value===!0?"true":T.value;if(_.startsWith("@")||_.startsWith("v-on:")){if(w.events&&T.value!==!0)a.set(C,`__StxEvent<${w.events}, ${JSON.stringify(_.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let A=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(_);if(_.startsWith("v-")&&!_.startsWith("v-bind:")&&!A)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(_))continue;let O=(A?A[1]||"modelValue":_.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(j,H)=>H.toUpperCase());if(v.push(O),!w.props)continue;let M=_.startsWith(":")||_.startsWith("v-bind:")||!!A||T.braced?I:T.value!==!0?JSON.stringify(I):"true";b(g(C,M,_),";void ((",`) satisfies __StxProp<${w.props}, ${JSON.stringify(O)}>);`)}if(w.props){let T=[...new Set(v)].map((C)=>`${JSON.stringify(C)}: undefined as any`).join(", "),_=g(y.offset,`<${y.name}>`);n.push({expression:_,statement:{text:`;void ({ ${T} } satisfies ${w.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:m.size?r.join(`
|
|
28
|
+
`):"",checks:n,events:a,dependencies:o}}var Ne=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function Ot(e){let s=(t)=>t.replace(/[^\n]/g," ");return e.replace(/<!--[\s\S]*?-->/g,s).replace(/\{\{--[\s\S]*?--\}\}/g,s)}function te(e){let s=[],t=Ot(e);Ne.lastIndex=0;let n;while((n=Ne.exec(t))!==null){let r=(n[1]||"").trim(),a=(n[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,o=(n[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,i=n.index+a,c=n.index+n[0].length-o,u=e.slice(i,c);if(/\bsrc\s*=/.test(r))continue;let p=r.match(/\btype\s*=\s*["']([^"']+)["']/i);if(p&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(p[1]))continue;let m=/\bserver\b/.test(r)?"server":/\bclient\b/.test(r)?"client":"plain",g=X(e,i);s.push({kind:m,code:u,startLine:g,startColumn:U(e,i),offset:i,attrs:r})}return s}function X(e,s){let t=1;for(let n=0;n<s&&n<e.length;n++)if(e.charCodeAt(n)===10)t++;return t}function U(e,s){let t=e.lastIndexOf(`
|
|
29
|
+
`,s-1)+1;return s-t+1}function ne(e){let s=e.split(""),t=(r,a)=>{for(let o=r;o<a&&o<s.length;o++)if(s[o]!==`
|
|
30
|
+
`)s[o]=" "},n=[/<script(?:\s[^>]*)?>[\s\S]*?<\/script>/gi,/<style(?:\s[^>]*)?>[\s\S]*?<\/style>/gi,/<!--[\s\S]*?-->/g,/\{\{--[\s\S]*?--\}\}/g,/@verbatim\b[\s\S]*?@endverbatim\b/g];for(let r of n){r.lastIndex=0;let a;while((a=r.exec(e))!==null)t(a.index,a.index+a[0].length)}return s.join("")}function Mt(e){let s=0,t="";for(let n=0;n<e.length;n++){let r=e[n];if(t){if(r==="\\"){n++;continue}if(r===t)t="";continue}if(r==='"'||r==="'"||r==="`"){t=r;continue}if(r==="("||r==="["||r==="{"){s++;continue}if(r===")"||r==="]"||r==="}"){s--;continue}if(r==="|"&&s===0){if(e[n+1]==="|"){n++;continue}if(e[n-1]==="|")continue;return e.slice(0,n)}}return e}var Ke=new Set([":for","x-for","v-for"]),se=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,le="__stx_interpolated",Be="__StxElement",ze="__StxTemplateValue",jt=`type ${ze}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function Fe(e){return e.replace(/\{\{[\s\S]*?\}\}/g,le).replace(/\{!![\s\S]*?!!\}/g,le)}function Nt(e){return e.replace(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/g,(s)=>{let t=s.split(`
|
|
31
|
+
`).length-1,n=s.length-t;return`0${" ".repeat(Math.max(0,n-1))}${`
|
|
32
|
+
`.repeat(t)}`})}var Bt=["foreach","endforeach","forelse","endforelse","for","endfor","while","endwhile","empty","if","elseif","else","endif","unless","endunless","isset","endisset","switch","case","default","endswitch","auth","endauth","guest","endguest","env","endenv","once","endonce","break","continue"],Ft=new RegExp(String.raw`^[ \t]*@(?:${Bt.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function Vt(e){return e.replace(Ft,(s)=>s.replace(/[^\n]/g," "))}var Ve=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function Gt(e){let s=ne(e),t=[],n=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,r;while((r=n.exec(s))!==null){if(r[1]||r[3])continue;let i=r[2]??r[4]??"",c=r[2]!==void 0?2:3,u=Mt(i);if(!u.trim())continue;let p=r.index+c+(u.length-u.trimStart().length);t.push({code:u.trim(),line:X(s,p),column:U(s,p),offset:p,kind:"interpolation"})}let a=/@(if|elseif|else\s+if|unless)\b\s*\(/g;while((r=a.exec(s))!==null){let o=r.index+r[0].length-1,i=0,c=o;for(;c<s.length;c++){let g=s[c];if(g==="(")i++;else if(g===")"){if(i--,i===0)break}}if(i!==0)continue;let u=s.slice(o+1,c),p=u.trim();if(a.lastIndex=c+1,!p)continue;let m=o+1+(u.length-u.trimStart().length);t.push({code:p,line:X(s,m),column:U(s,m),offset:r.index,kind:"condition"})}se.lastIndex=0;while((r=se.exec(s))!==null){let o=r[1],i=r[3]??"",c=o.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(Ve.has(c)||Ve.has(o))continue;if(!i.trim())continue;let u=r.index+r[0].indexOf(r[2],r[0].indexOf(o)+o.length)+1;if(Ke.has(c)){let m=i.match(/\s+(?:in|of)\s+/);if(!m||m.index===void 0)continue;let g=i.slice(m.index+m[0].length),b=m.index+m[0].length+(g.length-g.trimStart().length);t.push({code:Fe(g.trim()),line:X(s,u+b),column:U(s,u+b),offset:u+b,kind:"directive",attribute:c});continue}let p=i.length-i.trimStart().length;t.push({code:Fe(i.trim()),line:X(s,u+p),column:U(s,u+p),offset:u+p,kind:"directive",attribute:c})}return t.sort((o,i)=>o.line-i.line||o.column-i.column),t}var Wt=2000;function Ht(e,s){let t=0,n=Math.min(e.length,s+Wt);for(let r=s;r<n;r++){let a=e[r];if(a==="(")t++;else if(a===")"){if(t--,t===0)return e.slice(s+1,r)}}return null}function Kt(e){let s=new Map,t=(i,c)=>{let u=i.split(/[,[\]{}()\s]+/).filter(Boolean);for(let p of u){let m=p.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(m))continue;let g=u.length===1?c:void 0,b=s.get(m);if(!b)s.set(m,{name:m,iterable:g});else if(b.iterable!==g)b.iterable=void 0}},n=/^\$?[A-Z_$][\w$]*$/i,r=(i)=>{let c=i.trim();return n.test(c)?c:void 0};for(let i of e.matchAll(/@for(?:each|else)\s*\(/g)){let c=Ht(e,i.index+i[0].length-1);if(c===null)continue;let u=Te(c);if(!u)continue;t(u.itemVar.replace(/=>/g," "),r(u.arrayExpr))}for(let i of e.matchAll(/@for\s*\(\s*(?:(?:let|const|var)\s+)?([\w$]+|\[[^\]]*\]|\{[^}]*\})\s+(of|in)\s+([^)]*)/g))t(i[1],i[2]==="of"?r(i[3]):void 0);for(let i of e.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)\s*[=;]/g))t(i[1]);let a=ne(e);se.lastIndex=0;let o;while((o=se.exec(a))!==null){let i=o[1].replace(/\..*$/,"");if(!Ke.has(i))continue;let c=o[3].match(/\s+(?:in|of)\s+/);if(!c||c.index===void 0)continue;t(o[3].slice(0,c.index),r(o[3].slice(c.index+c[0].length)))}for(let i of e.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let c of i[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))t(c[1]);return[...s.values()].sort((i,c)=>i.name.localeCompare(c.name))}function ee(e){let s=new Set;for(let t of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))s.add(t[1]);for(let t of e.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))s.add(t[1]);for(let t of e.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))s.add(t[1]);for(let t of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))for(let n of t[1].split(",")){let r=n.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(r))s.add(r)}return[...s].sort()}var Ge=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"];var We=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","props","slot"];function Xe(e){let s=new Set,t=new Set;for(let n of e){let r=n.kind==="server"?s:t;for(let a of ee(n.code))r.add(a)}return[...s].filter((n)=>t.has(n)).sort()}var zt=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function Xt(e){let s=new Map,t=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let n of e){let r=L(n),{depths:a,balanced:o}=Y(r);if(!o)continue;let i=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let c of r.matchAll(i)){let u=c.index??0;if(a[u+c[1].length]!==0)continue;let p=c[2],m=u+c[0].length-c[3].length,g=n.slice(m,u+c[0].length).trim().replace(/;$/,"").trim(),b=c[3],y=t.test(b)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(b)&&!/[,+\-*/%&|?:=]$/.test(g)&&Y(b).balanced;s.set(p,s.has(p)||!y?null:g)}}return new Map([...s].filter((n)=>n[1]!==null))}function Ue(e,s,t=0,n=new Set){if(s.size===0||t>=5)return e;let r=L(e),a="",o=0;for(let i of r.matchAll(/[A-Za-z_$][\w$]*/g)){let c=i.index??0,u=i[0],p=s.get(u);if(!p||n.has(u))continue;let m=r.slice(0,c).trimEnd(),g=r.slice(c+u.length).trimStart();if(m.endsWith(".")||/^:(?!:)/.test(g)&&/[{,]$/.test(m))continue;if(c>0&&/[\w$]/.test(r[c-1]))continue;a+=`${e.slice(o,c)}(${Ue(p,s,t+1,new Set([...n,u]))})`,o=c+u.length}return a+e.slice(o)}function Ut(e,s){let t=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,n=[],r;while((r=t.exec(e))!==null){if(r.index>s)break;let a=r[1];if(r.index===s){if(a==="elseif"){let i=n[n.length-1];if(i?.current)i.seen.push(i.current);if(i)i.current=null}break}if(a==="endif"||a==="endunless"){n.pop();continue}let o="";if(r[2]==="("){let i=0,c=r.index+r[0].length-1,u=c+1;for(;c<e.length;c++){let p=e[c];if(p==="(")i++;else if(p===")"){if(i--,i===0)break}}o=e.slice(u,c).trim(),t.lastIndex=c+1}if(a==="if")n.push({seen:[],current:o});else if(a==="unless")n.push({seen:[],current:`!(${o})`});else if(a==="elseif"||a==="else"){let i=n[n.length-1];if(!i)continue;if(i.current)i.seen.push(i.current);i.current=a==="elseif"?o:null}}return n.flatMap((a)=>[...a.seen.map((o)=>`!(${o})`),...a.current?[a.current]:[]]).filter(Boolean)}function Zt(e){let s=e.code.trim();if(!s)return null;if(e.attribute?.startsWith("@")){if(zt.test(s))return null;let n=";(($event: any): void => { ";return{text:`${n}${s} });`,prefixLength:n.length}}let t=";void ((";return{text:`${t}${s}));`,prefixLength:t.length}}var qt=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function He(e,s){if(!s)return e;return e.replace(qt,(t,n,r,a)=>{let o=ue.default.resolve(s,a).replace(/\\/g,"/");return`${n}${r}${o}${r}`})}function Qt(e){return" ".repeat(Math.max(0,(e.startColumn??1)-1))}function Yt(e){let s=new Set,t=L(e);for(let n of t.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let r=n[1],a=/\{([^}]*)\}/.exec(r);for(let u of a?.[1].split(",")??[]){let p=u.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(p&&/^[A-Z_$][\w$]*$/i.test(p))s.add(p)}let o=r.replace(/\{[^}]*\}/,""),i=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(o);if(i)s.add(i[1]);let c=/^\s*([A-Z_$][\w$]*)/i.exec(o);if(c&&c[1]!=="type")s.add(c[1])}return[...s].sort()}function Ze(e,s={}){let t=te(e),n=e.split(`
|
|
33
|
+
`),r=Array.from({length:n.length},()=>""),a=new Map,o=s.filePath&&s.templateExpressions!==!1?je(e,ne(e),{filePath:s.filePath,componentsDir:s.componentsDir,projectRoot:s.projectRoot,readComponent:s.readComponent,scriptCode:(m,g)=>te(m).map((b)=>He(b.code,ue.default.dirname(g))).join(`
|
|
34
|
+
`)}):void 0,i=new Set,c=[];for(let m of t){let g=Vt(Nt(m.code)),b=He(g,s.originDir??"").split(`
|
|
35
|
+
`);b.forEach((y,S)=>{let w=m.startLine-1+S;if(w<r.length)r[w]=S===0?Qt(m)+y:y,i.add(w)}),c.push(m.startLine-1+b.length-1)}for(let m of c){let g=r[m]?.trim()===""?m:m+1;if(g<r.length&&r[g].trim()===""&&(g===m||!i.has(g)))r[g]=";"}let u=(m,g)=>{for(let[b,y]of m.split(`
|
|
36
|
+
`).entries())if(r.push(y),g)a.set(r.length,b===0?g:{...g,line:g.line+b,column:1,prefixLength:0})};if(s.globals!==!1){u("");let m=new Set([...t.flatMap((S)=>ee(S.code)),...t.flatMap((S)=>Yt(S.code))]),g=(S)=>{if(!m.has(S))u(`declare var ${S}: any`)};if(s.runtimeGlobals!==!1){if(!m.has("window"))u("declare var window: any");for(let S of G)g(S)}let b=[...new Set([...Ge,...ae,...We])].filter((S)=>s.runtimeGlobals!==!1||!G.includes(S));if(s.contextScope==="global"){u("declare global {");for(let S of b)u(` var ${S}: any`);u("}")}else{for(let S of Ge)g(S);for(let S of ae)g(S);for(let S of We)g(S)}u(`declare var ${le}: any`);let y=new Set(t.flatMap((S)=>ee(S.code)));u(`type ${Be}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let S of Kt(e)){if(y.has(S.name))continue;let w=S.iterable&&y.has(S.iterable)?`${Be}<typeof ${S.iterable}>`:"any";u(`declare var ${S.name}: ${w}`)}}if(s.templateExpressions!==!1){if(o?.declarations)for(let g of o.declarations.split(`
|
|
37
|
+
`))u(g);let m=Gt(e).map((g)=>{let b=o?.events.get(g.offset??-1);if(b){g.anchor=!0;let y=g.code.trim(),S=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(y),w=S?`void ((${S[2]}) satisfies __StxAssignedValue<typeof ${S[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(y)?`${y} satisfies (($event: ${b}) => unknown)`:y,v=`;(($event: ${b}): void => { `;return{expression:g,statement:{text:`${v}${w} });`,prefixLength:v.length}}}return{expression:g,statement:Zt(g)}}).filter((g)=>g.statement!==null);if(m.push(...o?.checks||[]),m.length>0){let g=ne(e),b=Xt(t.map((v)=>v.code)),S=[...new Set(t.flatMap((v)=>ee(v.code)))].filter((v)=>/^[A-Z_$][\w$]*$/i.test(v)),w=0;if(S.length>0){u(jt);for(let v of S)u(`type __StxT_${v} = ${ze}<typeof ${v}>`);u(`;((${S.map((v)=>`${v}: __StxT_${v}`).join(", ")}) => {`),w=1}for(let{expression:v,statement:T}of m){let _=" ".repeat(w),C=v.offset===void 0?[]:Ut(g,v.offset),I=C.length>0?`${C.map((O)=>`if (${Ue(O,b)}) `).join("")}{ `:"",A=C.length>0?" }":"";u(_+I+T.text+A,{line:v.line,column:v.column,expression:v,prefixLength:T.prefixLength+_.length+I.length,guardPrefixLength:_.length+I.length})}if(w>0)u("});")}}let p=!1;if(s.reference&&r[0]!==void 0&&r[0].trim()==="")r[0]=`/// <reference path=${JSON.stringify(s.reference.replace(/\\/g,"/"))} />`,p=!0;return u("export {}"),{text:r.join(`
|
|
38
|
+
`),lineMap:a,sourceLineCount:n.length,componentDependencies:o?.dependencies,referenced:p}}function fe(e){let s=[0];for(let t=0;t<e.length;t++)if(e.charCodeAt(t)===10)s.push(t+1);return s}function re(e,s){let t=0,n=e.length-1;while(t<n){let r=Math.ceil((t+n)/2);if(e[r]<=s)t=r;else n=r-1}return{line:t+1,column:s-e[t]+1}}function ie(e,s,t){let n=Math.min(Math.max(s,1),e.length)-1,r=n+1<e.length?e[n+1]-1:Number.MAX_SAFE_INTEGER;return Math.min(e[n]+Math.max(t,1)-1,r)}function qe(e,s){if(!e.expression)return!1;return e.inGuard===!0||s===2774}function Qe(e,s,t){let n=e.lineMap.get(s);if(!n)return s<=e.sourceLineCount?{line:s,column:t}:null;let r=n.expression?.anchor?0:Math.max(0,t-1-(n.prefixLength??0));return{line:n.line,column:n.column+r,expression:n.expression,inGuard:t<=(n.guardPrefixLength??0)}}var Ye=["module","exports","require","props","$props","$bool","$num","defineProps","withDefaults","defineClientPayload","useServerData","useRuntimeConfig","useServerRuntimeConfig","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","setResponseStatus","setResponseHeader","notFound","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params"];var Jt=new Set(["module","exports","require","$bool","$num","window","document","console","confirm","alert","fetch"]),et=Ye.filter((e)=>!Jt.has(e)).sort(),tt=[...G].sort(),en=[...new Set([...et,...tt])].sort(),tn=new Set(et),nn=new Set(tt),sn=new Set(en),Je=/\bimport\s+(?!type[\s{])\{([^}]*)\}\s*from\s*(['"])stx\2/g;function rn(e,s){if(s==="server")return`'${e}' is not provided by 'stx' in a <script server> block. The engine binds only its own names there (defineProps, state, useHead, ...); any other name becomes \`await import('stx')\`, which does not resolve, so the whole script fails when the page renders. Import it from '@stacksjs/stx' instead.`;return`'${e}' is not provided by 'stx' in a client <script> block. The import is replaced by the window.stx runtime, which has no '${e}', so it is undefined in the browser.`}function nt(e,s){let t=[];for(let n of s){if(n.offset===void 0)continue;let r=n.kind==="server"?tn:nn;Je.lastIndex=0;for(let a of n.code.matchAll(Je)){let o=a.index+a[0].indexOf("{")+1;for(let i of a[1].matchAll(/[^,]+/g)){let c=i[0];if(/^\s*type\s/.test(c))continue;let u=/^\s*([A-Za-z_$][\w$]*)/.exec(c);if(!u)continue;let p=u[1];if(!sn.has(p)||r.has(p))continue;let m=n.offset+o+i.index+u[0].length-p.length,g=e.slice(0,m),b=g.split(`
|
|
39
|
+
`).length;t.push({line:b,column:m-(g.lastIndexOf(`
|
|
40
|
+
`)+1)+1,offset:m,length:p.length,name:p,kind:n.kind,message:rn(p,n.kind)})}}}return t}var F=V(require("node:path"),1),on="@stacksjs/stx-typescript-plugin";function an(e,s){let t=F.default.resolve(e);for(;;){let n=F.default.join(t,"tsconfig.json");if(s(n))return n;let r=F.default.dirname(t);if(r===t)return;t=r}}function st(e,s,t){let n=an(e,t);if(!n)return;let r=new Set,a=(o)=>{if(r.has(o))return;r.add(o);let i=s(o);if(!i)return;let c=i.compilerOptions?.plugins;if(Array.isArray(c)){let p=c.find((g)=>g?.name===on),m=Array.isArray(p?.libs)?p.libs.filter((g)=>typeof g==="string"):[];return p?{configPath:o,libs:m.map((g)=>F.default.resolve(F.default.dirname(o),g))}:null}let u=typeof i.extends==="string"?[i.extends]:Array.isArray(i.extends)?i.extends:[];for(let p of[...u].reverse()){if(typeof p!=="string"||!p.startsWith("."))continue;let m=F.default.resolve(F.default.dirname(o),p.endsWith(".json")?p:`${p}.json`),g=a(m);if(g!==void 0)return g}return};return a(n)??void 0}var rt=Symbol.for("@stacksjs/stx-typescript-plugin"),cn=new Set([2300,2451,2403]);function Z(e){return e.endsWith(".stx")}function it(e){return Z(e)||e.endsWith(".md")}function ln(e){if(!e)return;return N.existsSync(P.default.join(e,"stx-module.d.ts"))&&N.existsSync(P.default.join(e,"stx.d.ts"))?P.default.join(e,"stx-module.d.ts"):void 0}function un(e,s=N.existsSync){let t=e;for(;;){let n=P.default.join(t,"node_modules","@stacksjs","stx","stx-module.d.ts");if(s(n))return n;let r=P.default.dirname(t);if(r===t)return;t=r}}function fn(e,s=P.default.join(at.tmpdir(),"stx-typescript-plugin")){let t=e.map((r)=>`/// <reference path=${JSON.stringify(r.replace(/\\/g,"/"))} />`).join(`
|
|
41
41
|
`)+`
|
|
42
|
-
`,
|
|
42
|
+
`,n=P.default.join(s,`${ot.createHash("sha1").update(t).digest("hex").slice(0,16)}.d.ts`);if(!N.existsSync(n))N.mkdirSync(s,{recursive:!0}),N.writeFileSync(n,t);return n}function dn(e,s,t,n){let r=(i)=>Ze(s,{templateExpressions:Z(e),originDir:P.default.dirname(e),filePath:e,readComponent:n.readComponent,componentsDir:n.componentsDir,projectRoot:n.projectRoot,reference:i,runtimeGlobals:!i,contextScope:"global"}),a=r(n.declarations);if(n.declarations&&!a.referenced)a=r(void 0);let o=te(s);return{version:t,source:s,virtual:a,blocks:o,sourceStarts:fe(s),virtualStarts:fe(a.text),collisions:new Set(Xe(o))}}function pn(e,s){let t=e.findConfigFile(s,e.sys.fileExists);if(!t)return;let n=e.readConfigFile(t,e.sys.readFile);if(n.error)return;let r=e.parseJsonConfigFileContent(n.config,e.sys,P.default.dirname(t),void 0,t),a={};if(r.options.types)a.types=r.options.types;let o=r.options.paths;if(o){let i=r.options.baseUrl??r.options.pathsBasePath??P.default.dirname(t);a.paths={};for(let[c,u]of Object.entries(o))a.paths[c]=u.map((p)=>P.default.isAbsolute(p)?p:P.default.resolve(i,p))}return a}function gn(e,s={}){let t=e.typescript,n={},r=new Set,a=new WeakSet;return{create(o){let i=(l)=>{o.project.projectService.logger.info(`[stx-plugin] ${l}`)};if(o.languageService[rt])return a.add(o.project),i("already applied to this project by another registration of the plugin; leaving it as it is"),o.languageService;i("TypeScript stx plugin initialized");let{languageService:c,languageServiceHost:u}=o,p=(l)=>{let d=c[l];return typeof d==="function"?d.bind(c):()=>{return}},m=u.getScriptSnapshot?.bind(u),g=u.getScriptVersion?.bind(u),b=ln(s.declarationsDir);if(!b)i("the bundled stx declarations were not found; apps without their own fall back to `any`");let y=(l)=>t.sys?.fileExists(l)??N.existsSync(l),S=(l)=>{let d=t.readConfigFile?.(l,(f)=>t.sys.readFile(f));return d&&!d.error?d.config:void 0},w=new Map,v=(l)=>{let d=P.default.dirname(l);if(!w.has(d)){let f=un(d,y)??b,x=[];try{x=(st(d,S,y)?.libs??[]).filter(y)}catch(h){i(`could not read the stx entry of the project's tsconfig: ${String(h)}`)}w.set(d,f&&x.length>0?fn([f,...x]):f)}return w.get(d)},T=new Map,_=(l)=>{let d=m?.(l);return d?d.getText(0,d.getLength()):t.sys?.readFile(l)},C=()=>n.enabled!==!1;r.add(()=>{T.clear(),o.project.refreshDiagnostics?.()});let I=(l)=>{if(!it(l)||!m)return;let d=`${g?.(l)||"0"}:${u.getProjectVersion?.()||""}`,f=T.get(l);if(f&&f.version===d&&[...f.virtual.componentDependencies||[]].every(([h,E])=>_(h)===E))return f;let x=m(l);if(!x)return;try{let h=o.project.getCurrentDirectory?.(),E=h?P.default.resolve(h,typeof o.config?.componentsDir==="string"?o.config.componentsDir:"components"):void 0,k=dn(l,x.getText(0,x.getLength()),d,{declarations:v(l),readComponent:_,componentsDir:E,projectRoot:h});return T.set(l,k),k}catch(h){i(`failed to build virtual document for ${l}: ${String(h)}`);return}},A=(l)=>Z(l)?I(l):void 0,O=(l,d)=>{let f=re(l.virtualStarts,d);return Qe(l.virtual,f.line,f.column)},q=(l,d)=>{let f=O(l,d);if(!f)return;return ie(l.sourceStarts,f.line,f.column)},M=(l,d)=>{let f=re(l.sourceStarts,d);return ie(l.virtualStarts,f.line,f.column)},j=(l,d)=>{let f=q(l,d.start);if(f===void 0)return;let x=q(l,d.start+d.length);return{start:f,length:x!==void 0&&x>=f?x-f:d.length}},H=(l,d)=>l.blocks.some((f)=>f.offset!==void 0&&d>=f.offset&&d<=f.offset+f.code.length),de=(l)=>{let d=A(l.fileName);if(!d)return l;let f=j(d,l.textSpan);if(!f)return;let x=l.contextSpan?j(d,l.contextSpan):void 0;return{...l,textSpan:f,contextSpan:x}},pe=(l)=>l?.map(de).filter((d)=>d!==void 0),ge=(l)=>l?.filter((d)=>{let f=A(d.fileName);if(!f)return!0;let{line:x}=re(f.virtualStarts,d.textSpan.start);return x<=f.virtual.sourceLineCount&&!f.virtual.lineMap.has(x)});if(m)u.getScriptSnapshot=(l)=>{let d=I(l);if(d)return t.ScriptSnapshot.fromString(d.virtual.text);return m(l)};let me=u.getCompilationSettings?.bind(u),lt=t.server?.ProjectKind!==void 0&&o.project.projectKind===t.server.ProjectKind.Inferred;if(me&<){let l=null,d;u.getCompilationSettings=()=>{let f=me();if(l===null)try{l=pn(t,o.project.getCurrentDirectory())}catch(x){i(`could not read the project's tsconfig: ${String(x)}`),l=void 0}if(!l)return f;if(d?.from!==f)d={from:f,options:{...f,...l.paths&&!f.paths?{paths:l.paths}:{},...l.types&&!f.types?{types:l.types}:{}}};return d.options}}let oe=(l,d)=>{let f=I(l);if(!f)return d;if(Z(l)&&!C())return[];let x=[];for(let h of d){let E=typeof h.messageText==="string"?h.messageText:h.messageText.messageText;if(cn.has(h.code)){let B=E.match(/'([^']+)'/)?.[1];if(B&&f.collisions.has(B))continue}if(h.start===void 0){x.push(h);continue}let k=O(f,h.start);if(!k||qe(k,h.code))continue;let D=ie(f.sourceStarts,k.line,k.column),K=q(f,h.start+(h.length??0));x.push({...h,start:D,length:K!==void 0&&K>D?K-D:h.length??0})}return x},ut=p("getSemanticDiagnostics");c.getSemanticDiagnostics=(l)=>{let d=oe(l,ut(l)),f=A(l);if(!f||!C())return d;let x=c.getProgram?.()?.getSourceFile(l);for(let h of nt(f.source,f.blocks))d.push({file:x,start:h.offset,length:h.length,messageText:h.message,category:t.DiagnosticCategory?.Error??1,code:0,source:"stx"});return d};let ft=p("getSyntacticDiagnostics");c.getSyntacticDiagnostics=(l)=>oe(l,ft(l));let dt=p("getSuggestionDiagnostics");c.getSuggestionDiagnostics=(l)=>oe(l,dt(l));let he=p("getQuickInfoAtPosition");c.getQuickInfoAtPosition=(l,d,...f)=>{let x=A(l);if(!x)return he(l,d,...f);if(!C())return;let h=he(l,M(x,d),...f);if(!h)return h;let E=j(x,h.textSpan);return E?{...h,textSpan:E}:void 0};let xe=p("getCompletionsAtPosition");c.getCompletionsAtPosition=(l,d,f,...x)=>{let h=A(l);if(!h)return xe(l,d,f,...x);if(!C()||!H(h,d))return;let E=xe(l,M(h,d),{...f,includeCompletionsForModuleExports:!1},...x);if(!E)return E;let k=(D)=>D&&j(h,D);return{...E,optionalReplacementSpan:k(E.optionalReplacementSpan),entries:E.entries.filter((D)=>!D.name.startsWith("__stx")&&!D.name.startsWith("__Stx")).map((D)=>D.replacementSpan?{...D,replacementSpan:k(D.replacementSpan)}:D)}};let Se=p("getCompletionEntryDetails");c.getCompletionEntryDetails=(l,d,...f)=>{let x=A(l);if(!x)return Se(l,d,...f);let h=Se(l,M(x,d),...f);return h?{...h,codeActions:void 0}:h};let be=p("getSignatureHelpItems");c.getSignatureHelpItems=(l,d,...f)=>{let x=A(l);if(!x)return be(l,d,...f);if(!C()||!H(x,d))return;let h=be(l,M(x,d),...f),E=h&&j(x,h.applicableSpan);return h&&E?{...h,applicableSpan:E}:void 0};let ye=p("getDefinitionAndBoundSpan");c.getDefinitionAndBoundSpan=(l,d)=>{let f=A(l);if(!f)return we(ye(l,d));if(!C())return;let x=ye(l,M(f,d)),h=x&&j(f,x.textSpan);return x&&h?{...we(x),textSpan:h}:void 0};let we=(l)=>l&&{...l,definitions:ge(l.definitions)};for(let l of["getDefinitionAtPosition","getTypeDefinitionAtPosition","getImplementationAtPosition"]){let d=p(l);c[l]=(f,x,...h)=>{let E=A(f);if(E&&!C())return;return ge(d(f,E?M(E,x):x,...h))}}for(let l of["getReferencesAtPosition"]){let d=p(l);c[l]=(f,x,...h)=>{let E=A(f);if(E&&!C())return;return pe(d(f,E?M(E,x):x,...h))}}let pt=p("findReferences");c.findReferences=(l,d)=>{let f=A(l);if(f&&!C())return;return pt(l,f?M(f,d):d)?.map((x)=>{let h=de(x.definition);return h?{definition:h,references:pe(x.references)}:void 0}).filter((x)=>x!==void 0)};let gt=p("getDocumentHighlights");c.getDocumentHighlights=(l,d,f)=>{let x=A(l);if(x&&(!C()||!H(x,d)))return;return gt(l,x?M(x,d):d,f)?.map((h)=>{let E=A(h.fileName);if(!E)return h;return{...h,highlightSpans:h.highlightSpans.map((k)=>{let D=j(E,k.textSpan);return D?{...k,textSpan:D,contextSpan:k.contextSpan&&j(E,k.contextSpan)}:void 0}).filter((k)=>k!==void 0)}})};let mt=p("getNavigationTree");c.getNavigationTree=(l)=>{let d=mt(l),f=A(l);if(!f)return d;let x=(E)=>{let k=E.spans.map((B)=>j(f,B)).filter((B)=>B!==void 0);if(k.length===0)return;let D=E.nameSpan&&j(f,E.nameSpan),K=E.childItems?.map(x).filter((B)=>B!==void 0);return{...E,spans:k,nameSpan:D,childItems:K}},h={...d,spans:[{start:0,length:f.source.length}]};return C()?{...h,childItems:d.childItems?.map(x).filter((E)=>E!==void 0)}:{...h,childItems:[]}};let ht={getEncodedSemanticClassifications:()=>{return},getEncodedSyntacticClassifications:()=>{return},getSemanticClassifications:()=>[],getSyntacticClassifications:()=>[],getFormattingEditsForDocument:()=>[],getFormattingEditsForRange:()=>[],getFormattingEditsAfterKeystroke:()=>[],getNavigationBarItems:()=>[],getOutliningSpans:()=>[],getBraceMatchingAtPosition:()=>[],getTodoComments:()=>[],getDocCommentTemplateAtPosition:()=>{return},getJsxClosingTagAtPosition:()=>{return},getLinkedEditingRangeAtPosition:()=>{return},getSpanOfEnclosingComment:()=>{return},getCodeFixesAtPosition:()=>[],getApplicableRefactors:()=>[],getEditsForRefactor:()=>{return},getRenameInfo:()=>({canRename:!1,localizedErrorMessage:"Rename is not supported in .stx files."}),findRenameLocations:()=>{return},provideInlayHints:()=>[],prepareCallHierarchy:()=>{return},provideCallHierarchyIncomingCalls:()=>[],provideCallHierarchyOutgoingCalls:()=>[],getFileReferences:()=>[]};for(let[l,d]of Object.entries(ht)){let f=c[l];if(typeof f!=="function")continue;let x=f.bind(c);c[l]=(h,...E)=>typeof h==="string"&&Z(h)?d():x(h,...E)}return c[rt]=!0,i("Language service proxy created"),c},getExternalFiles(o){if(a.has(o))return[];return o.getFileNames().filter(it)},onConfigurationChanged(o){n={...n,...o};for(let i of r)i()}}}var ct=gn;module.exports=ct;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/stx-vscode",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.414",
|
|
5
5
|
"description": "stx language support for VS Code extensions to embed: the hovers, completions, diagnostics, grammar, snippets, language configuration and TypeScript server plugin behind the stx extension.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|