funkscript 0.2.6 → 0.2.7
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/README.md +1 -1
- package/dist/cli/build-watch.d.ts.map +1 -1
- package/dist/cli/build-watch.js +4 -24
- package/dist/cli/build-watch.js.map +1 -1
- package/dist/cli/build.d.ts.map +1 -1
- package/dist/cli/build.js +3 -58
- package/dist/cli/build.js.map +1 -1
- package/dist/cli/check-policy.d.ts +9 -0
- package/dist/cli/check-policy.d.ts.map +1 -0
- package/dist/cli/check-policy.js +39 -0
- package/dist/cli/check-policy.js.map +1 -0
- package/dist/cli/check.d.ts.map +1 -1
- package/dist/cli/check.js +16 -30
- package/dist/cli/check.js.map +1 -1
- package/dist/cli/commands.d.ts.map +1 -1
- package/dist/cli/commands.js +11 -0
- package/dist/cli/commands.js.map +1 -1
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli/doctor.js +2 -6
- package/dist/cli/doctor.js.map +1 -1
- package/dist/cli/index.js +3 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/query.d.ts +3 -0
- package/dist/cli/query.d.ts.map +1 -0
- package/dist/cli/query.js +152 -0
- package/dist/cli/query.js.map +1 -0
- package/dist/cli/run.d.ts.map +1 -1
- package/dist/cli/run.js +2 -29
- package/dist/cli/run.js.map +1 -1
- package/dist/cli/tsc.d.ts.map +1 -1
- package/dist/cli/tsc.js +2 -6
- package/dist/cli/tsc.js.map +1 -1
- package/dist/compiler/check.d.ts.map +1 -1
- package/dist/compiler/check.js +18 -28
- package/dist/compiler/check.js.map +1 -1
- package/dist/compiler/diagnostics-json.d.ts +73 -0
- package/dist/compiler/diagnostics-json.d.ts.map +1 -0
- package/dist/compiler/diagnostics-json.js +957 -0
- package/dist/compiler/diagnostics-json.js.map +1 -0
- package/dist/compiler/escape-audit.d.ts +46 -0
- package/dist/compiler/escape-audit.d.ts.map +1 -0
- package/dist/compiler/escape-audit.js +682 -0
- package/dist/compiler/escape-audit.js.map +1 -0
- package/dist/compiler/modules/output-plan.d.ts.map +1 -1
- package/dist/compiler/modules/output-plan.js +10 -5
- package/dist/compiler/modules/output-plan.js.map +1 -1
- package/dist/compiler/modules/source-files.d.ts +2 -0
- package/dist/compiler/modules/source-files.d.ts.map +1 -1
- package/dist/compiler/modules/source-files.js +8 -0
- package/dist/compiler/modules/source-files.js.map +1 -1
- package/dist/compiler/numeric-comparisons.d.ts.map +1 -1
- package/dist/compiler/numeric-comparisons.js +13 -7
- package/dist/compiler/numeric-comparisons.js.map +1 -1
- package/dist/compiler/pipelines/resolution.d.ts.map +1 -1
- package/dist/compiler/pipelines/resolution.js +24 -23
- package/dist/compiler/pipelines/resolution.js.map +1 -1
- package/dist/compiler/query.d.ts +53 -0
- package/dist/compiler/query.d.ts.map +1 -0
- package/dist/compiler/query.js +781 -0
- package/dist/compiler/query.js.map +1 -0
- package/dist/compiler/source-map.d.ts.map +1 -1
- package/dist/compiler/source-map.js +2 -7
- package/dist/compiler/source-map.js.map +1 -1
- package/dist/compiler/type-view-paths.d.ts +2 -0
- package/dist/compiler/type-view-paths.d.ts.map +1 -1
- package/dist/compiler/type-view-paths.js +8 -0
- package/dist/compiler/type-view-paths.js.map +1 -1
- package/dist/compiler/typescript-context.d.ts.map +1 -1
- package/dist/compiler/typescript-context.js +5 -7
- package/dist/compiler/typescript-context.js.map +1 -1
- package/dist/emitter/assemblyscript.d.ts.map +1 -1
- package/dist/emitter/assemblyscript.js +120 -136
- package/dist/emitter/assemblyscript.js.map +1 -1
- package/dist/formatter/index.d.ts +9 -0
- package/dist/formatter/index.d.ts.map +1 -1
- package/dist/formatter/index.js +158 -2
- package/dist/formatter/index.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/lsp/completion.d.ts +25 -0
- package/dist/lsp/completion.d.ts.map +1 -1
- package/dist/lsp/completion.js +1114 -51
- package/dist/lsp/completion.js.map +1 -1
- package/dist/lsp/definition.d.ts +2 -0
- package/dist/lsp/definition.d.ts.map +1 -1
- package/dist/lsp/definition.js +52 -58
- package/dist/lsp/definition.js.map +1 -1
- package/dist/lsp/hover.d.ts +5 -1
- package/dist/lsp/hover.d.ts.map +1 -1
- package/dist/lsp/hover.js +1000 -41
- package/dist/lsp/hover.js.map +1 -1
- package/dist/lsp/imports.d.ts +2 -0
- package/dist/lsp/imports.d.ts.map +1 -1
- package/dist/lsp/imports.js +35 -20
- package/dist/lsp/imports.js.map +1 -1
- package/dist/lsp/navigation.d.ts +1 -1
- package/dist/lsp/navigation.d.ts.map +1 -1
- package/dist/lsp/navigation.js +30 -12
- package/dist/lsp/navigation.js.map +1 -1
- package/dist/lsp/range-format.d.ts +4 -0
- package/dist/lsp/range-format.d.ts.map +1 -0
- package/dist/lsp/range-format.js +88 -0
- package/dist/lsp/range-format.js.map +1 -0
- package/dist/lsp/schema-import-hover.d.ts +8 -0
- package/dist/lsp/schema-import-hover.d.ts.map +1 -0
- package/dist/lsp/schema-import-hover.js +52 -0
- package/dist/lsp/schema-import-hover.js.map +1 -0
- package/dist/lsp/server.d.ts +1 -0
- package/dist/lsp/server.d.ts.map +1 -1
- package/dist/lsp/server.js +53 -48
- package/dist/lsp/server.js.map +1 -1
- package/dist/lsp/workspace.d.ts +3 -1
- package/dist/lsp/workspace.d.ts.map +1 -1
- package/dist/lsp/workspace.js +66 -10
- package/dist/lsp/workspace.js.map +1 -1
- package/dist/plugins/bun.d.ts +2 -18
- package/dist/plugins/bun.d.ts.map +1 -1
- package/dist/plugins/bun.js +5 -30
- package/dist/plugins/bun.js.map +1 -1
- package/dist/plugins/esbuild.d.ts +1 -1
- package/dist/plugins/esbuild.d.ts.map +1 -1
- package/dist/plugins/esbuild.js +10 -36
- package/dist/plugins/esbuild.js.map +1 -1
- package/dist/plugins/server-boundary.d.ts +14 -0
- package/dist/plugins/server-boundary.d.ts.map +1 -0
- package/dist/plugins/server-boundary.js +25 -0
- package/dist/plugins/server-boundary.js.map +1 -0
- package/dist/plugins/vite.d.ts +2 -18
- package/dist/plugins/vite.d.ts.map +1 -1
- package/dist/plugins/vite.js +4 -29
- package/dist/plugins/vite.js.map +1 -1
- package/package.json +1 -1
- package/src/cli/build-watch.ts +4 -26
- package/src/cli/build.ts +9 -60
- package/src/cli/check-policy.ts +54 -0
- package/src/cli/check.ts +19 -31
- package/src/cli/commands.ts +13 -0
- package/src/cli/doctor.ts +2 -5
- package/src/cli/index.ts +3 -0
- package/src/cli/query.ts +191 -0
- package/src/cli/run.ts +5 -30
- package/src/cli/tsc.ts +2 -5
- package/src/compiler/check.ts +28 -48
- package/src/compiler/diagnostics-json.ts +1205 -0
- package/src/compiler/escape-audit.ts +913 -0
- package/src/compiler/modules/output-plan.ts +11 -9
- package/src/compiler/modules/source-files.ts +9 -0
- package/src/compiler/numeric-comparisons.ts +14 -8
- package/src/compiler/pipelines/resolution.ts +30 -26
- package/src/compiler/query.ts +1177 -0
- package/src/compiler/source-map.ts +3 -7
- package/src/compiler/type-view-paths.ts +7 -0
- package/src/compiler/typescript-context.ts +6 -7
- package/src/emitter/assemblyscript.ts +101 -147
- package/src/formatter/index.ts +229 -2
- package/src/index.ts +3 -0
- package/src/lsp/completion.ts +1452 -66
- package/src/lsp/definition.ts +50 -58
- package/src/lsp/hover.ts +1442 -40
- package/src/lsp/imports.ts +55 -21
- package/src/lsp/navigation.ts +41 -22
- package/src/lsp/range-format.ts +102 -0
- package/src/lsp/schema-import-hover.ts +76 -0
- package/src/lsp/server.ts +69 -69
- package/src/lsp/workspace.ts +63 -9
- package/src/plugins/bun.ts +14 -66
- package/src/plugins/esbuild.ts +16 -55
- package/src/plugins/server-boundary.ts +41 -0
- package/src/plugins/vite.ts +12 -62
package/src/lsp/definition.ts
CHANGED
|
@@ -10,6 +10,8 @@ import type {
|
|
|
10
10
|
BlockStatement,
|
|
11
11
|
Expression,
|
|
12
12
|
FunctionBody,
|
|
13
|
+
JSXAttribute,
|
|
14
|
+
JSXTagName,
|
|
13
15
|
NodeBase,
|
|
14
16
|
Pattern,
|
|
15
17
|
Program,
|
|
@@ -756,35 +758,10 @@ export class DefinitionFinder {
|
|
|
756
758
|
}
|
|
757
759
|
|
|
758
760
|
case "JSXElement": {
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
if (sym) {
|
|
764
|
-
this.found = {
|
|
765
|
-
originNode: expr.openingElement.name,
|
|
766
|
-
declarationNode: sym.declarationNode,
|
|
767
|
-
targetIdentifierNode: sym.identifierNode,
|
|
768
|
-
};
|
|
769
|
-
return;
|
|
770
|
-
}
|
|
771
|
-
}
|
|
772
|
-
for (const attr of expr.openingElement.attributes) {
|
|
773
|
-
if (attr.kind === "JSXSpreadAttribute") {
|
|
774
|
-
this.visitExpression(attr.argument, scope);
|
|
775
|
-
continue;
|
|
776
|
-
}
|
|
777
|
-
if (attr.value) {
|
|
778
|
-
if (attr.value.kind === "JSXExpressionContainer") {
|
|
779
|
-
this.visitExpression(attr.value.expression, scope);
|
|
780
|
-
} else if (
|
|
781
|
-
attr.value.kind === "Identifier" ||
|
|
782
|
-
attr.value.kind === "UpperIdentifier"
|
|
783
|
-
) {
|
|
784
|
-
this.visitExpression(attr.value, scope);
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
}
|
|
761
|
+
this.visitJsxTagName(expr.openingElement.name, scope);
|
|
762
|
+
if (this.found) return;
|
|
763
|
+
this.visitJsxAttributes(expr.openingElement.attributes, scope);
|
|
764
|
+
if (this.found) return;
|
|
788
765
|
for (const child of expr.children) {
|
|
789
766
|
if (
|
|
790
767
|
child.kind === "JSXElement" ||
|
|
@@ -794,40 +771,18 @@ export class DefinitionFinder {
|
|
|
794
771
|
} else if (child.kind === "JSXExpressionContainer") {
|
|
795
772
|
this.visitExpression(child.expression, scope);
|
|
796
773
|
}
|
|
774
|
+
if (this.found) return;
|
|
775
|
+
}
|
|
776
|
+
if (expr.closingElement) {
|
|
777
|
+
this.visitJsxTagName(expr.closingElement.name, scope);
|
|
797
778
|
}
|
|
798
779
|
break;
|
|
799
780
|
}
|
|
800
781
|
|
|
801
782
|
case "JSXSelfClosingElement": {
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
const sym = scope.lookup(expr.name.name);
|
|
806
|
-
if (sym) {
|
|
807
|
-
this.found = {
|
|
808
|
-
originNode: expr.name,
|
|
809
|
-
declarationNode: sym.declarationNode,
|
|
810
|
-
targetIdentifierNode: sym.identifierNode,
|
|
811
|
-
};
|
|
812
|
-
return;
|
|
813
|
-
}
|
|
814
|
-
}
|
|
815
|
-
for (const attr of expr.attributes) {
|
|
816
|
-
if (attr.kind === "JSXSpreadAttribute") {
|
|
817
|
-
this.visitExpression(attr.argument, scope);
|
|
818
|
-
continue;
|
|
819
|
-
}
|
|
820
|
-
if (attr.value) {
|
|
821
|
-
if (attr.value.kind === "JSXExpressionContainer") {
|
|
822
|
-
this.visitExpression(attr.value.expression, scope);
|
|
823
|
-
} else if (
|
|
824
|
-
attr.value.kind === "Identifier" ||
|
|
825
|
-
attr.value.kind === "UpperIdentifier"
|
|
826
|
-
) {
|
|
827
|
-
this.visitExpression(attr.value, scope);
|
|
828
|
-
}
|
|
829
|
-
}
|
|
830
|
-
}
|
|
783
|
+
this.visitJsxTagName(expr.name, scope);
|
|
784
|
+
if (this.found) return;
|
|
785
|
+
this.visitJsxAttributes(expr.attributes, scope);
|
|
831
786
|
break;
|
|
832
787
|
}
|
|
833
788
|
|
|
@@ -864,6 +819,43 @@ export class DefinitionFinder {
|
|
|
864
819
|
}
|
|
865
820
|
}
|
|
866
821
|
|
|
822
|
+
private visitJsxTagName(tagName: JSXTagName, scope: Scope): void {
|
|
823
|
+
if (this.found) return;
|
|
824
|
+
if (tagName.kind === "MemberExpression") {
|
|
825
|
+
this.visitExpression(tagName, scope);
|
|
826
|
+
return;
|
|
827
|
+
}
|
|
828
|
+
if (this.isCursorIn(tagName)) {
|
|
829
|
+
const sym = scope.lookup(tagName.name);
|
|
830
|
+
if (sym) {
|
|
831
|
+
this.found = {
|
|
832
|
+
originNode: tagName,
|
|
833
|
+
declarationNode: sym.declarationNode,
|
|
834
|
+
targetIdentifierNode: sym.identifierNode,
|
|
835
|
+
};
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
private visitJsxAttributes(attributes: JSXAttribute[], scope: Scope): void {
|
|
841
|
+
for (const attr of attributes) {
|
|
842
|
+
if (this.found) return;
|
|
843
|
+
if (attr.kind === "JSXSpreadAttribute") {
|
|
844
|
+
this.visitExpression(attr.argument, scope);
|
|
845
|
+
continue;
|
|
846
|
+
}
|
|
847
|
+
if (!attr.value) continue;
|
|
848
|
+
if (attr.value.kind === "JSXExpressionContainer") {
|
|
849
|
+
this.visitExpression(attr.value.expression, scope);
|
|
850
|
+
} else if (
|
|
851
|
+
attr.value.kind === "Identifier" ||
|
|
852
|
+
attr.value.kind === "UpperIdentifier"
|
|
853
|
+
) {
|
|
854
|
+
this.visitExpression(attr.value, scope);
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
|
|
867
859
|
private visitFunctionBody(body: FunctionBody, scope: Scope): void {
|
|
868
860
|
if (this.found) return;
|
|
869
861
|
if (body.kind === "BlockStatement") {
|