funkscript 0.2.4 → 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 +23 -5
- package/dist/ast/types.d.ts.map +1 -1
- package/dist/ast/types.js.map +1 -1
- package/dist/ast/walk.d.ts.map +1 -1
- package/dist/ast/walk.js.map +1 -1
- package/dist/cli/build-bun.d.ts.map +1 -1
- package/dist/cli/build-bun.js.map +1 -1
- package/dist/cli/build-watch.d.ts.map +1 -1
- package/dist/cli/build-watch.js +9 -27
- package/dist/cli/build-watch.js.map +1 -1
- package/dist/cli/build.d.ts +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/doc.d.ts.map +1 -1
- package/dist/cli/doc.js.map +1 -1
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli/doctor.js +5 -7
- package/dist/cli/doctor.js.map +1 -1
- package/dist/cli/emit.d.ts +1 -1
- package/dist/cli/emit.d.ts.map +1 -1
- package/dist/cli/emit.js.map +1 -1
- package/dist/cli/explain.d.ts.map +1 -1
- package/dist/cli/explain.js.map +1 -1
- package/dist/cli/fmt.d.ts.map +1 -1
- package/dist/cli/fmt.js.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +3 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/init.d.ts +1 -1
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +66 -21
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/io.d.ts.map +1 -1
- package/dist/cli/io.js.map +1 -1
- package/dist/cli/pipeline-style.d.ts.map +1 -1
- package/dist/cli/pipeline-style.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/repl.d.ts.map +1 -1
- package/dist/cli/repl.js.map +1 -1
- 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/test.d.ts +1 -1
- package/dist/cli/test.d.ts.map +1 -1
- package/dist/cli/test.js.map +1 -1
- package/dist/cli/tsc.d.ts.map +1 -1
- package/dist/cli/tsc.js +6 -8
- package/dist/cli/tsc.js.map +1 -1
- package/dist/cli/typecheck.d.ts.map +1 -1
- package/dist/cli/typecheck.js.map +1 -1
- package/dist/compiler/ast-inspection.d.ts.map +1 -1
- package/dist/compiler/ast-inspection.js.map +1 -1
- package/dist/compiler/boolean-operators.d.ts.map +1 -1
- package/dist/compiler/boolean-operators.js +12 -2
- package/dist/compiler/boolean-operators.js.map +1 -1
- package/dist/compiler/check.d.ts.map +1 -1
- package/dist/compiler/check.js +113 -131
- 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/diagnostics.d.ts.map +1 -1
- package/dist/compiler/diagnostics.js.map +1 -1
- package/dist/compiler/effect-mutation-rule.d.ts.map +1 -1
- package/dist/compiler/effect-mutation-rule.js.map +1 -1
- package/dist/compiler/entry-rules.d.ts.map +1 -1
- package/dist/compiler/entry-rules.js.map +1 -1
- 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/incremental-build.d.ts.map +1 -1
- package/dist/compiler/incremental-build.js.map +1 -1
- package/dist/compiler/incremental-dependencies.d.ts.map +1 -1
- package/dist/compiler/incremental-dependencies.js.map +1 -1
- package/dist/compiler/js-interop-nullability.d.ts.map +1 -1
- package/dist/compiler/js-interop-nullability.js.map +1 -1
- package/dist/compiler/modules/output-collisions.d.ts.map +1 -1
- package/dist/compiler/modules/output-collisions.js.map +1 -1
- 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/resolution.d.ts.map +1 -1
- package/dist/compiler/modules/resolution.js +2 -1
- package/dist/compiler/modules/resolution.js.map +1 -1
- package/dist/compiler/modules/source-files.d.ts +5 -0
- package/dist/compiler/modules/source-files.d.ts.map +1 -0
- package/dist/compiler/modules/source-files.js +13 -0
- package/dist/compiler/modules/source-files.js.map +1 -0
- 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/optional-arguments.d.ts.map +1 -1
- package/dist/compiler/optional-arguments.js.map +1 -1
- package/dist/compiler/package-fingerprint.d.ts.map +1 -1
- package/dist/compiler/package-fingerprint.js.map +1 -1
- package/dist/compiler/package-record-contracts.d.ts.map +1 -1
- package/dist/compiler/package-record-contracts.js.map +1 -1
- package/dist/compiler/pipelines/catalog.d.ts.map +1 -1
- package/dist/compiler/pipelines/catalog.js.map +1 -1
- package/dist/compiler/pipelines/companions.d.ts.map +1 -1
- package/dist/compiler/pipelines/companions.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/project-config.d.ts.map +1 -1
- package/dist/compiler/project-config.js +29 -19
- package/dist/compiler/project-config.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/record-contracts.d.ts.map +1 -1
- package/dist/compiler/record-contracts.js.map +1 -1
- package/dist/compiler/rules/control-flow.d.ts.map +1 -1
- package/dist/compiler/rules/control-flow.js.map +1 -1
- package/dist/compiler/rules/diagnostic.d.ts.map +1 -1
- package/dist/compiler/rules/diagnostic.js.map +1 -1
- package/dist/compiler/rules/module-scope-refs.d.ts.map +1 -1
- package/dist/compiler/rules/module-scope-refs.js.map +1 -1
- package/dist/compiler/rules/resource-escape.d.ts +7 -0
- package/dist/compiler/rules/resource-escape.d.ts.map +1 -0
- package/dist/compiler/rules/resource-escape.js +146 -0
- package/dist/compiler/rules/resource-escape.js.map +1 -0
- package/dist/compiler/rules/resource-providers.d.ts +19 -0
- package/dist/compiler/rules/resource-providers.d.ts.map +1 -0
- package/dist/compiler/rules/resource-providers.js +222 -0
- package/dist/compiler/rules/resource-providers.js.map +1 -0
- package/dist/compiler/schemas/analysis.d.ts.map +1 -1
- package/dist/compiler/schemas/analysis.js.map +1 -1
- package/dist/compiler/schemas/imported-record-functions.d.ts.map +1 -1
- package/dist/compiler/schemas/imported-record-functions.js.map +1 -1
- package/dist/compiler/schemas/imported-schemas.d.ts.map +1 -1
- package/dist/compiler/schemas/imported-schemas.js.map +1 -1
- 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 +6 -0
- package/dist/compiler/type-view-paths.d.ts.map +1 -0
- package/dist/compiler/type-view-paths.js +12 -0
- package/dist/compiler/type-view-paths.js.map +1 -0
- 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/compiler.d.ts.map +1 -1
- package/dist/compiler.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/emitter/declarations.d.ts.map +1 -1
- package/dist/emitter/declarations.js.map +1 -1
- package/dist/emitter/emitter.d.ts +3 -1
- package/dist/emitter/emitter.d.ts.map +1 -1
- package/dist/emitter/emitter.js +10 -1
- package/dist/emitter/emitter.js.map +1 -1
- package/dist/emitter/imports.d.ts.map +1 -1
- package/dist/emitter/imports.js.map +1 -1
- package/dist/emitter/indent.d.ts.map +1 -1
- package/dist/emitter/indent.js.map +1 -1
- package/dist/emitter/jsx.d.ts.map +1 -1
- package/dist/emitter/jsx.js.map +1 -1
- package/dist/emitter/local-bindings.d.ts.map +1 -1
- package/dist/emitter/local-bindings.js.map +1 -1
- package/dist/emitter/match.d.ts.map +1 -1
- package/dist/emitter/match.js.map +1 -1
- package/dist/emitter/runtime-helpers.d.ts.map +1 -1
- package/dist/emitter/runtime-helpers.js.map +1 -1
- package/dist/emitter/schemas.d.ts.map +1 -1
- package/dist/emitter/schemas.js.map +1 -1
- package/dist/emitter/statements.d.ts +1 -0
- package/dist/emitter/statements.d.ts.map +1 -1
- package/dist/emitter/statements.js +1 -0
- package/dist/emitter/statements.js.map +1 -1
- package/dist/emitter/tagged-match.d.ts.map +1 -1
- package/dist/emitter/tagged-match.js.map +1 -1
- package/dist/emitter/types.d.ts.map +1 -1
- package/dist/emitter/types.js.map +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/formatter/comments.d.ts.map +1 -1
- package/dist/formatter/comments.js +13 -0
- package/dist/formatter/comments.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 +215 -5
- package/dist/formatter/index.js.map +1 -1
- package/dist/formatter/operator-precedence.d.ts.map +1 -1
- package/dist/formatter/operator-precedence.js.map +1 -1
- package/dist/formatter/prettier.d.ts.map +1 -1
- package/dist/formatter/prettier.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/interop/callback.d.ts.map +1 -1
- package/dist/interop/callback.js.map +1 -1
- package/dist/interop/js.d.ts.map +1 -1
- package/dist/interop/js.js.map +1 -1
- package/dist/interop/record.d.ts.map +1 -1
- package/dist/interop/record.js.map +1 -1
- package/dist/interop/valibot.d.ts.map +1 -1
- package/dist/interop/valibot.js.map +1 -1
- package/dist/interop/zod.d.ts.map +1 -1
- package/dist/interop/zod.js.map +1 -1
- package/dist/lexer/lexer.d.ts +1 -0
- package/dist/lexer/lexer.d.ts.map +1 -1
- package/dist/lexer/lexer.js +26 -10
- package/dist/lexer/lexer.js.map +1 -1
- package/dist/lexer/tokens.d.ts.map +1 -1
- package/dist/lexer/tokens.js.map +1 -1
- package/dist/lsp/code-action-worker.d.ts.map +1 -1
- package/dist/lsp/code-action-worker.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/diagnostics-worker.d.ts.map +1 -1
- package/dist/lsp/diagnostics-worker.js +1 -1
- package/dist/lsp/diagnostics-worker.js.map +1 -1
- package/dist/lsp/docs.d.ts +1 -1
- package/dist/lsp/docs.d.ts.map +1 -1
- package/dist/lsp/docs.js +4 -3
- package/dist/lsp/docs.js.map +1 -1
- package/dist/lsp/error-channel.d.ts.map +1 -1
- package/dist/lsp/error-channel.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 +1016 -46
- 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 +45 -21
- package/dist/lsp/imports.js.map +1 -1
- package/dist/lsp/index.d.ts.map +1 -1
- package/dist/lsp/index.js.map +1 -1
- package/dist/lsp/inlay-hints.d.ts.map +1 -1
- package/dist/lsp/inlay-hints.js.map +1 -1
- package/dist/lsp/interop-rename.d.ts.map +1 -1
- package/dist/lsp/interop-rename.js.map +1 -1
- package/dist/lsp/match-arms.d.ts.map +1 -1
- package/dist/lsp/match-arms.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/parsed-documents.d.ts.map +1 -1
- package/dist/lsp/parsed-documents.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/rename-worker.d.ts.map +1 -1
- package/dist/lsp/rename-worker.js.map +1 -1
- 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 +3 -1
- package/dist/lsp/server.d.ts.map +1 -1
- package/dist/lsp/server.js +73 -48
- package/dist/lsp/server.js.map +1 -1
- package/dist/lsp/signature-help.d.ts +6 -0
- package/dist/lsp/signature-help.d.ts.map +1 -0
- package/dist/lsp/signature-help.js +183 -0
- package/dist/lsp/signature-help.js.map +1 -0
- package/dist/lsp/thunk-pipeline.d.ts.map +1 -1
- package/dist/lsp/thunk-pipeline.js.map +1 -1
- package/dist/lsp/validation.d.ts.map +1 -1
- package/dist/lsp/validation.js +3 -2
- package/dist/lsp/validation.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/parser/declarations.d.ts.map +1 -1
- package/dist/parser/declarations.js +22 -1
- package/dist/parser/declarations.js.map +1 -1
- package/dist/parser/errors.d.ts.map +1 -1
- package/dist/parser/errors.js.map +1 -1
- package/dist/parser/jsx.d.ts.map +1 -1
- package/dist/parser/jsx.js.map +1 -1
- package/dist/parser/operator-expressions.d.ts.map +1 -1
- package/dist/parser/operator-expressions.js.map +1 -1
- package/dist/parser/parser.d.ts.map +1 -1
- package/dist/parser/parser.js.map +1 -1
- package/dist/parser/patterns.d.ts.map +1 -1
- package/dist/parser/patterns.js.map +1 -1
- package/dist/parser/pipeline-expressions.d.ts.map +1 -1
- package/dist/parser/pipeline-expressions.js.map +1 -1
- package/dist/parser/scope.d.ts.map +1 -1
- package/dist/parser/scope.js.map +1 -1
- package/dist/parser/statements.d.ts.map +1 -1
- package/dist/parser/statements.js.map +1 -1
- package/dist/parser/types.d.ts.map +1 -1
- package/dist/parser/types.js.map +1 -1
- package/dist/plugins/bun-preload.d.ts.map +1 -1
- package/dist/plugins/bun-preload.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/type-view.d.ts.map +1 -1
- package/dist/plugins/type-view.js +5 -3
- package/dist/plugins/type-view.js.map +1 -1
- 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/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/tooling/doc.d.ts.map +1 -1
- package/dist/tooling/doc.js.map +1 -1
- package/dist/tooling/idiomatic.d.ts.map +1 -1
- package/dist/tooling/idiomatic.js.map +1 -1
- package/dist/tooling/pipeline-style.d.ts.map +1 -1
- package/dist/tooling/pipeline-style.js.map +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +13 -6
- package/src/cli/build-watch.ts +10 -29
- 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 +10 -7
- package/src/cli/index.ts +3 -0
- package/src/cli/init.ts +66 -21
- package/src/cli/query.ts +191 -0
- package/src/cli/run.ts +5 -30
- package/src/cli/tsc.ts +10 -8
- package/src/compiler/boolean-operators.ts +11 -2
- package/src/compiler/check.ts +152 -180
- 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/resolution.ts +2 -1
- package/src/compiler/modules/source-files.ts +13 -0
- package/src/compiler/numeric-comparisons.ts +14 -8
- package/src/compiler/pipelines/resolution.ts +30 -26
- package/src/compiler/project-config.ts +30 -19
- package/src/compiler/query.ts +1177 -0
- package/src/compiler/rules/resource-escape.ts +223 -0
- package/src/compiler/rules/resource-providers.ts +293 -0
- package/src/compiler/source-map.ts +3 -7
- package/src/compiler/type-view-paths.ts +10 -0
- package/src/compiler/typescript-context.ts +6 -7
- package/src/emitter/assemblyscript.ts +101 -147
- package/src/emitter/emitter.ts +13 -1
- package/src/emitter/statements.ts +2 -0
- package/src/formatter/comments.ts +14 -0
- package/src/formatter/index.ts +299 -4
- package/src/index.ts +3 -0
- package/src/lexer/lexer.ts +39 -20
- package/src/lsp/completion.ts +1452 -66
- package/src/lsp/definition.ts +50 -58
- package/src/lsp/diagnostics-worker.ts +1 -4
- package/src/lsp/docs.ts +4 -3
- package/src/lsp/hover.ts +1465 -44
- package/src/lsp/imports.ts +75 -22
- 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 +99 -69
- package/src/lsp/signature-help.ts +226 -0
- package/src/lsp/validation.ts +3 -2
- package/src/lsp/workspace.ts +63 -9
- package/src/parser/declarations.ts +27 -1
- 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/type-view.ts +11 -3
- package/src/plugins/vite.ts +12 -62
- package/dist/Widget.tsx +0 -9
- package/dist/cli/output-collisions.d.ts +0 -2
- package/dist/cli/output-collisions.d.ts.map +0 -1
- package/dist/cli/output-collisions.js +0 -39
- package/dist/cli/output-collisions.js.map +0 -1
- package/dist/compiler/imported-record-functions.d.ts +0 -4
- package/dist/compiler/imported-record-functions.d.ts.map +0 -1
- package/dist/compiler/imported-record-functions.js +0 -706
- package/dist/compiler/imported-record-functions.js.map +0 -1
- package/dist/compiler/imported-schemas.d.ts +0 -21
- package/dist/compiler/imported-schemas.d.ts.map +0 -1
- package/dist/compiler/imported-schemas.js +0 -461
- package/dist/compiler/imported-schemas.js.map +0 -1
- package/dist/compiler/module-resolution.d.ts +0 -6
- package/dist/compiler/module-resolution.d.ts.map +0 -1
- package/dist/compiler/module-resolution.js +0 -44
- package/dist/compiler/module-resolution.js.map +0 -1
- package/dist/compiler/pipeline-companions.d.ts +0 -18
- package/dist/compiler/pipeline-companions.d.ts.map +0 -1
- package/dist/compiler/pipeline-companions.js +0 -1042
- package/dist/compiler/pipeline-companions.js.map +0 -1
- package/dist/compiler/providers.d.ts +0 -4
- package/dist/compiler/providers.d.ts.map +0 -1
- package/dist/compiler/providers.js +0 -101
- package/dist/compiler/providers.js.map +0 -1
- package/dist/emitter/pipeline-catalog.d.ts +0 -15
- package/dist/emitter/pipeline-catalog.d.ts.map +0 -1
- package/dist/emitter/pipeline-catalog.js +0 -55
- package/dist/emitter/pipeline-catalog.js.map +0 -1
- package/dist/emitter/pipeline-resolution.d.ts +0 -38
- package/dist/emitter/pipeline-resolution.d.ts.map +0 -1
- package/dist/emitter/pipeline-resolution.js +0 -571
- package/dist/emitter/pipeline-resolution.js.map +0 -1
- package/dist/interop/index.d.ts +0 -6
- package/dist/interop/index.d.ts.map +0 -1
- package/dist/interop/index.js +0 -6
- package/dist/interop/index.js.map +0 -1
- package/dist/math.ts +0 -1
- package/dist/parser/index.d.ts +0 -9
- package/dist/parser/index.d.ts.map +0 -1
- package/dist/parser/index.js +0 -9
- package/dist/parser/index.js.map +0 -1
- package/dist/service.ts +0 -3
- package/dist/service.ts.map +0 -1
- package/dist/tooling/migrate.d.ts +0 -62
- package/dist/tooling/migrate.d.ts.map +0 -1
- package/dist/tooling/migrate.js +0 -608
- package/dist/tooling/migrate.js.map +0 -1
package/src/lsp/imports.ts
CHANGED
|
@@ -14,6 +14,19 @@ import { COMPANION_IMPORT_SOURCE } from "../compiler/pipelines/catalog.js";
|
|
|
14
14
|
import { Lexer } from "../lexer/lexer.js";
|
|
15
15
|
import { TokenType, type Token } from "../lexer/tokens.js";
|
|
16
16
|
import { Parser } from "../parser/parser.js";
|
|
17
|
+
import { extractComments } from "../formatter/comments.js";
|
|
18
|
+
|
|
19
|
+
function hasImportComments(source: string, decl: ImportDeclaration): boolean {
|
|
20
|
+
const lineEnd = source.indexOf("\n", decl.span.end.offset);
|
|
21
|
+
return (
|
|
22
|
+
extractComments(
|
|
23
|
+
source.slice(
|
|
24
|
+
decl.span.start.offset,
|
|
25
|
+
lineEnd < 0 ? source.length : lineEnd,
|
|
26
|
+
),
|
|
27
|
+
).length > 0
|
|
28
|
+
);
|
|
29
|
+
}
|
|
17
30
|
|
|
18
31
|
export const EFFECT_MODULE_EXPORTS = new Set([
|
|
19
32
|
"Array",
|
|
@@ -80,23 +93,57 @@ function formatImportSpecifier(spec: ImportSpecifier): string {
|
|
|
80
93
|
return `${typePrefix}${binding}`;
|
|
81
94
|
}
|
|
82
95
|
|
|
83
|
-
|
|
96
|
+
type ImportAnalysis = { tokens: Token[]; program: Program };
|
|
97
|
+
|
|
98
|
+
function analyzeImports(
|
|
84
99
|
source: string,
|
|
85
100
|
uri: string,
|
|
86
|
-
|
|
87
|
-
)
|
|
88
|
-
if (!source || !source.trim()) return [];
|
|
89
|
-
|
|
90
|
-
let tokens: Token[];
|
|
91
|
-
let program: Program;
|
|
101
|
+
): ImportAnalysis | undefined {
|
|
102
|
+
if (!source.trim()) return undefined;
|
|
92
103
|
try {
|
|
93
|
-
tokens = new Lexer(source, uri).tokenize();
|
|
94
|
-
program = new Parser(tokens, uri, source).parse();
|
|
104
|
+
const tokens = new Lexer(source, uri).tokenize();
|
|
105
|
+
const program = new Parser(tokens, uri, source).parse();
|
|
106
|
+
return { tokens, program };
|
|
95
107
|
} catch (error) {
|
|
96
108
|
if (!isExpectedSyntaxError(error)) throw error;
|
|
97
|
-
return
|
|
109
|
+
return undefined;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** Compute both import actions from a single request-scoped parse. */
|
|
114
|
+
export function findImportCodeActions(
|
|
115
|
+
source: string,
|
|
116
|
+
uri: string,
|
|
117
|
+
range: Range,
|
|
118
|
+
): CodeAction[] {
|
|
119
|
+
const analysis = analyzeImports(source, uri);
|
|
120
|
+
if (!analysis) return [];
|
|
121
|
+
const actions: CodeAction[] = [];
|
|
122
|
+
for (const find of [autoImportActions, removeUnusedImportActions]) {
|
|
123
|
+
try {
|
|
124
|
+
actions.push(...find(source, uri, range, analysis));
|
|
125
|
+
} catch (error) {
|
|
126
|
+
if (!isExpectedSyntaxError(error)) throw error;
|
|
127
|
+
}
|
|
98
128
|
}
|
|
129
|
+
return actions;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export function findAutoImportCodeActions(
|
|
133
|
+
source: string,
|
|
134
|
+
uri: string,
|
|
135
|
+
range: Range,
|
|
136
|
+
): CodeAction[] {
|
|
137
|
+
const analysis = analyzeImports(source, uri);
|
|
138
|
+
return analysis ? autoImportActions(source, uri, range, analysis) : [];
|
|
139
|
+
}
|
|
99
140
|
|
|
141
|
+
function autoImportActions(
|
|
142
|
+
source: string,
|
|
143
|
+
uri: string,
|
|
144
|
+
range: Range,
|
|
145
|
+
{ tokens, program }: ImportAnalysis,
|
|
146
|
+
): CodeAction[] {
|
|
100
147
|
// Find identifier token under cursor/range
|
|
101
148
|
const targetToken = tokens.find((t) => {
|
|
102
149
|
if (
|
|
@@ -167,6 +214,7 @@ export function findAutoImportCodeActions(
|
|
|
167
214
|
if (
|
|
168
215
|
targetSource === "effect" &&
|
|
169
216
|
existingEffectImport &&
|
|
217
|
+
!hasImportComments(source, existingEffectImport) &&
|
|
170
218
|
existingEffectImport.specifiers.length > 0
|
|
171
219
|
) {
|
|
172
220
|
// Add to existing import { ... } from "effect"
|
|
@@ -251,18 +299,18 @@ export function findRemoveUnusedImportsCodeActions(
|
|
|
251
299
|
uri: string,
|
|
252
300
|
range: Range,
|
|
253
301
|
): CodeAction[] {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
tokens = new Lexer(source, uri).tokenize();
|
|
260
|
-
program = new Parser(tokens, uri, source).parse();
|
|
261
|
-
} catch (error) {
|
|
262
|
-
if (!isExpectedSyntaxError(error)) throw error;
|
|
263
|
-
return [];
|
|
264
|
-
}
|
|
302
|
+
const analysis = analyzeImports(source, uri);
|
|
303
|
+
return analysis
|
|
304
|
+
? removeUnusedImportActions(source, uri, range, analysis)
|
|
305
|
+
: [];
|
|
306
|
+
}
|
|
265
307
|
|
|
308
|
+
function removeUnusedImportActions(
|
|
309
|
+
source: string,
|
|
310
|
+
uri: string,
|
|
311
|
+
range: Range,
|
|
312
|
+
{ tokens, program }: ImportAnalysis,
|
|
313
|
+
): CodeAction[] {
|
|
266
314
|
const importDecls: ImportDeclaration[] = [];
|
|
267
315
|
for (const entry of program.body) {
|
|
268
316
|
if (entry.kind === "ImportDeclaration") {
|
|
@@ -295,7 +343,12 @@ export function findRemoveUnusedImportsCodeActions(
|
|
|
295
343
|
const organizeEdits: TextEdit[] = [];
|
|
296
344
|
|
|
297
345
|
for (const decl of importDecls) {
|
|
298
|
-
if (
|
|
346
|
+
if (
|
|
347
|
+
decl.isSideEffect ||
|
|
348
|
+
decl.defaultBinding ||
|
|
349
|
+
decl.namespaceBinding ||
|
|
350
|
+
hasImportComments(source, decl)
|
|
351
|
+
) {
|
|
299
352
|
continue;
|
|
300
353
|
}
|
|
301
354
|
|
package/src/lsp/navigation.ts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { dirname, resolve } from "node:path";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
import { realpathSync } from "node:fs";
|
|
3
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
4
|
+
import {
|
|
5
|
+
SymbolKind,
|
|
6
|
+
type DocumentSymbol,
|
|
7
|
+
type Location,
|
|
8
|
+
type LocationLink,
|
|
9
|
+
type PrepareRenameResult,
|
|
10
|
+
type SymbolInformation,
|
|
11
|
+
type TextDocumentItem,
|
|
12
|
+
type TextEdit,
|
|
13
|
+
type WorkspaceEdit,
|
|
12
14
|
} from "vscode-languageserver/node";
|
|
13
15
|
import type { Program } from "../ast/types.js";
|
|
14
16
|
import { isExpectedSyntaxError, isExpectedUriError } from "../errors.js";
|
|
@@ -25,6 +27,16 @@ import {
|
|
|
25
27
|
type Doc = Pick<TextDocumentItem, "uri" | "text">;
|
|
26
28
|
type AnalyzedDocument = ParsedDocument;
|
|
27
29
|
|
|
30
|
+
/** Treat symlink aliases of a file as one document when resolving symbols. */
|
|
31
|
+
function documentKey(uri: string): string {
|
|
32
|
+
if (!uri.startsWith("file:")) return uri;
|
|
33
|
+
try {
|
|
34
|
+
return realpathSync(fileURLToPath(uri));
|
|
35
|
+
} catch {
|
|
36
|
+
return uri;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
28
40
|
function parse(source: string, uri: string): Program | null {
|
|
29
41
|
try {
|
|
30
42
|
return new Parser(new Lexer(source, uri).tokenize(), uri, source).parse();
|
|
@@ -47,7 +59,7 @@ class NavigationAnalysis {
|
|
|
47
59
|
private readonly cache = new ParsedDocumentCache(),
|
|
48
60
|
) {
|
|
49
61
|
this.documents = [
|
|
50
|
-
...docs.filter((doc) => doc.uri !== uri),
|
|
62
|
+
...docs.filter((doc) => documentKey(doc.uri) !== documentKey(uri)),
|
|
51
63
|
{ uri, text: source },
|
|
52
64
|
];
|
|
53
65
|
}
|
|
@@ -97,6 +109,8 @@ class NavigationAnalysis {
|
|
|
97
109
|
if (!candidate.uri.startsWith("file:")) continue;
|
|
98
110
|
try {
|
|
99
111
|
available.set(fileURLToPath(candidate.uri), candidate);
|
|
112
|
+
const canonical = documentKey(candidate.uri);
|
|
113
|
+
available.set(canonical, candidate);
|
|
100
114
|
} catch (error) {
|
|
101
115
|
if (!isExpectedUriError(error)) throw error;
|
|
102
116
|
}
|
|
@@ -104,10 +118,16 @@ class NavigationAnalysis {
|
|
|
104
118
|
const funTarget = resolveFunModule(
|
|
105
119
|
fileURLToPath(doc.uri),
|
|
106
120
|
modulePath,
|
|
107
|
-
(file) =>
|
|
121
|
+
(file) =>
|
|
122
|
+
available.has(file) ||
|
|
123
|
+
available.has(documentKey(pathToFileURL(file).href)),
|
|
108
124
|
{ directories: true },
|
|
109
125
|
);
|
|
110
|
-
if (funTarget)
|
|
126
|
+
if (funTarget)
|
|
127
|
+
return (
|
|
128
|
+
available.get(funTarget) ??
|
|
129
|
+
available.get(documentKey(pathToFileURL(funTarget).href))
|
|
130
|
+
);
|
|
111
131
|
if (/\.funx?$/.test(modulePath)) return undefined;
|
|
112
132
|
const stem = base.endsWith(".js") ? base.slice(0, -3) : base;
|
|
113
133
|
const candidates = new Set([
|
|
@@ -424,7 +444,10 @@ export function rename(
|
|
|
424
444
|
const current = { uri, text: source };
|
|
425
445
|
const key = analysis.renameIdentity(current, selected);
|
|
426
446
|
if (!key) return null;
|
|
427
|
-
const allDocs = [
|
|
447
|
+
const allDocs = [
|
|
448
|
+
...docs.filter((doc) => documentKey(doc.uri) !== documentKey(uri)),
|
|
449
|
+
current,
|
|
450
|
+
];
|
|
428
451
|
const locations: Location[] = [];
|
|
429
452
|
for (const doc of allDocs) {
|
|
430
453
|
const analyzed = analysis.document(doc);
|
|
@@ -484,14 +507,10 @@ export function documentSymbols(source: string, uri: string): DocumentSymbol[] {
|
|
|
484
507
|
const decl = top.kind === "ExportDeclaration" ? top.declaration : top;
|
|
485
508
|
if (!("id" in decl) || !("name" in decl.id)) continue;
|
|
486
509
|
const id = decl.id;
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
? 11
|
|
492
|
-
: decl.kind === "ErrorDeclaration"
|
|
493
|
-
? 5
|
|
494
|
-
: 12;
|
|
510
|
+
let kind: DocumentSymbol["kind"] = SymbolKind.Function;
|
|
511
|
+
if (decl.kind === "SchemaDeclaration" || decl.kind === "ErrorDeclaration")
|
|
512
|
+
kind = SymbolKind.Class;
|
|
513
|
+
else if (decl.kind === "ServiceDeclaration") kind = SymbolKind.Interface;
|
|
495
514
|
symbols.push({
|
|
496
515
|
name: id.name,
|
|
497
516
|
kind,
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { diffChars } from "diff";
|
|
2
|
+
import type { Range, TextEdit } from "vscode-languageserver/node";
|
|
3
|
+
import { extractComments } from "../formatter/comments.js";
|
|
4
|
+
import { validateSyntax } from "./validation.js";
|
|
5
|
+
|
|
6
|
+
/** Limit full-document formatter changes to the selection, rejecting semantic changes. */
|
|
7
|
+
export function formatSelection(
|
|
8
|
+
source: string,
|
|
9
|
+
formatted: string,
|
|
10
|
+
uri: string,
|
|
11
|
+
range: Range,
|
|
12
|
+
): TextEdit[] | null {
|
|
13
|
+
const lines = source.split("\n");
|
|
14
|
+
const offset = (position: Range["start"]): number | null => {
|
|
15
|
+
if (
|
|
16
|
+
!Number.isInteger(position.line) ||
|
|
17
|
+
!Number.isInteger(position.character) ||
|
|
18
|
+
position.line < 0 ||
|
|
19
|
+
position.line >= lines.length ||
|
|
20
|
+
position.character < 0 ||
|
|
21
|
+
position.character > lines[position.line].length
|
|
22
|
+
)
|
|
23
|
+
return null;
|
|
24
|
+
let result = position.character;
|
|
25
|
+
for (let i = 0; i < position.line; i++) result += lines[i].length + 1;
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
if (!range?.start || !range?.end) return null;
|
|
29
|
+
const start = offset(range.start);
|
|
30
|
+
const end = offset(range.end);
|
|
31
|
+
if (start === null || end === null || start > end) return null;
|
|
32
|
+
if (start === end) return [];
|
|
33
|
+
|
|
34
|
+
const edits: Array<{ start: number; end: number; text: string }> = [];
|
|
35
|
+
let originalOffset = 0;
|
|
36
|
+
let pending: { start: number; end: number; text: string } | undefined;
|
|
37
|
+
const flush = (): void => {
|
|
38
|
+
if (pending) edits.push(pending);
|
|
39
|
+
pending = undefined;
|
|
40
|
+
};
|
|
41
|
+
const changes = diffChars(source, formatted, { timeout: 150 });
|
|
42
|
+
if (!changes) return null;
|
|
43
|
+
for (const change of changes) {
|
|
44
|
+
if (!change.added && !change.removed) {
|
|
45
|
+
flush();
|
|
46
|
+
originalOffset += change.value.length;
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
pending ??= { start: originalOffset, end: originalOffset, text: "" };
|
|
50
|
+
if (change.removed) {
|
|
51
|
+
originalOffset += change.value.length;
|
|
52
|
+
pending.end = originalOffset;
|
|
53
|
+
} else {
|
|
54
|
+
pending.text += change.value;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
flush();
|
|
58
|
+
const selected = edits.filter(
|
|
59
|
+
(edit) => edit.start >= start && edit.end <= end && edit.start < end,
|
|
60
|
+
);
|
|
61
|
+
if (!selected.length) return [];
|
|
62
|
+
if (
|
|
63
|
+
selected.some(
|
|
64
|
+
(edit) =>
|
|
65
|
+
/\S/.test(source.slice(edit.start, edit.end)) || /\S/.test(edit.text),
|
|
66
|
+
)
|
|
67
|
+
)
|
|
68
|
+
return null;
|
|
69
|
+
let replacement = "";
|
|
70
|
+
let cursor = start;
|
|
71
|
+
for (const edit of selected) {
|
|
72
|
+
replacement += source.slice(cursor, edit.start) + edit.text;
|
|
73
|
+
cursor = edit.end;
|
|
74
|
+
}
|
|
75
|
+
replacement += source.slice(cursor, end);
|
|
76
|
+
const candidate = source.slice(0, start) + replacement + source.slice(end);
|
|
77
|
+
const before = validateSyntax(source, uri);
|
|
78
|
+
const after = validateSyntax(candidate, uri);
|
|
79
|
+
if (
|
|
80
|
+
before.diagnostics.length ||
|
|
81
|
+
after.diagnostics.length ||
|
|
82
|
+
!before.ast ||
|
|
83
|
+
!after.ast
|
|
84
|
+
)
|
|
85
|
+
return null;
|
|
86
|
+
const comments = (text: string) =>
|
|
87
|
+
extractComments(text).map(({ text, line, isTrailing }) => ({
|
|
88
|
+
text,
|
|
89
|
+
line,
|
|
90
|
+
isTrailing,
|
|
91
|
+
}));
|
|
92
|
+
if (JSON.stringify(comments(source)) !== JSON.stringify(comments(candidate)))
|
|
93
|
+
return null;
|
|
94
|
+
const withoutSpans = (_key: string, value: unknown): unknown =>
|
|
95
|
+
_key === "span" ? undefined : value;
|
|
96
|
+
if (
|
|
97
|
+
JSON.stringify(before.ast, withoutSpans) !==
|
|
98
|
+
JSON.stringify(after.ast, withoutSpans)
|
|
99
|
+
)
|
|
100
|
+
return null;
|
|
101
|
+
return [{ range, newText: replacement }];
|
|
102
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
Hover,
|
|
3
|
+
Position,
|
|
4
|
+
TextDocumentItem,
|
|
5
|
+
} from "vscode-languageserver/node";
|
|
6
|
+
import { Lexer } from "../lexer/lexer.js";
|
|
7
|
+
import { Parser } from "../parser/parser.js";
|
|
8
|
+
import { isExpectedSyntaxError } from "../errors.js";
|
|
9
|
+
import { findWorkspaceDefinition } from "./navigation.js";
|
|
10
|
+
import { findHoverAsync } from "./hover.js";
|
|
11
|
+
|
|
12
|
+
type Doc = Pick<TextDocumentItem, "uri" | "text">;
|
|
13
|
+
|
|
14
|
+
/** Avoid scanning the workspace unless the selected name could be a local import. */
|
|
15
|
+
export function hasRelativeImportedName(
|
|
16
|
+
source: string,
|
|
17
|
+
uri: string,
|
|
18
|
+
name: string,
|
|
19
|
+
): boolean {
|
|
20
|
+
try {
|
|
21
|
+
const ast = new Parser(
|
|
22
|
+
new Lexer(source, uri).tokenize(),
|
|
23
|
+
uri,
|
|
24
|
+
source,
|
|
25
|
+
).parse();
|
|
26
|
+
return ast.body.some(
|
|
27
|
+
(entry) =>
|
|
28
|
+
entry.kind === "ImportDeclaration" &&
|
|
29
|
+
entry.source.parts[0]?.kind === "StringRawPart" &&
|
|
30
|
+
entry.source.parts[0].value.startsWith(".") &&
|
|
31
|
+
entry.specifiers.some((spec) => spec.local.name === name),
|
|
32
|
+
);
|
|
33
|
+
} catch (error) {
|
|
34
|
+
if (isExpectedSyntaxError(error)) return false;
|
|
35
|
+
throw error;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Resolve only imported schema symbols, leaving ordinary hover and shadowing intact. */
|
|
40
|
+
export async function importedFunSchemaHover(
|
|
41
|
+
source: string,
|
|
42
|
+
uri: string,
|
|
43
|
+
position: Position,
|
|
44
|
+
docs: Doc[],
|
|
45
|
+
): Promise<Hover | null> {
|
|
46
|
+
const links = findWorkspaceDefinition(source, uri, position, docs, true);
|
|
47
|
+
if (!Array.isArray(links) || links.length !== 1) return null;
|
|
48
|
+
const link = links[0];
|
|
49
|
+
if (link.targetUri === uri) return null;
|
|
50
|
+
const target = docs.find((doc) => doc.uri === link.targetUri);
|
|
51
|
+
if (!target) return null;
|
|
52
|
+
|
|
53
|
+
try {
|
|
54
|
+
const ast = new Parser(
|
|
55
|
+
new Lexer(target.text, target.uri).tokenize(),
|
|
56
|
+
target.uri,
|
|
57
|
+
target.text,
|
|
58
|
+
).parse();
|
|
59
|
+
const selected = link.targetSelectionRange.start;
|
|
60
|
+
const schema = ast.body.some((entry) => {
|
|
61
|
+
const decl =
|
|
62
|
+
entry.kind === "ExportDeclaration" ? entry.declaration : entry;
|
|
63
|
+
return (
|
|
64
|
+
decl.kind === "SchemaDeclaration" &&
|
|
65
|
+
decl.id.span.start.line - 1 === selected.line &&
|
|
66
|
+
decl.id.span.start.column - 1 === selected.character
|
|
67
|
+
);
|
|
68
|
+
});
|
|
69
|
+
if (!schema) return null;
|
|
70
|
+
const hover = await findHoverAsync(target.text, target.uri, selected);
|
|
71
|
+
return hover ? { ...hover, range: link.originSelectionRange } : null;
|
|
72
|
+
} catch (error) {
|
|
73
|
+
if (isExpectedSyntaxError(error)) return null;
|
|
74
|
+
throw error;
|
|
75
|
+
}
|
|
76
|
+
}
|