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/compiler/check.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { checkControlFlowRules } from "./rules/control-flow.js";
|
|
2
2
|
import { checkModuleScopeRefs } from "./rules/module-scope-refs.js";
|
|
3
|
+
import { findScopedResourceEscape } from "./rules/resource-escape.js";
|
|
4
|
+
import {
|
|
5
|
+
createResourceProviderResolver,
|
|
6
|
+
effectImportNames,
|
|
7
|
+
} from "./rules/resource-providers.js";
|
|
3
8
|
import { isEntryModule, getEffectRunnerName } from "./entry-rules.js";
|
|
4
9
|
export { isEntryModule } from "./entry-rules.js";
|
|
5
10
|
import { checkCapturedMutInEffect } from "./effect-mutation-rule.js";
|
|
@@ -1970,56 +1975,36 @@ export const typeCheckVirtualFiles = (
|
|
|
1970
1975
|
return false;
|
|
1971
1976
|
};
|
|
1972
1977
|
|
|
1978
|
+
let succeedCallee: AstInspectNode | null = null;
|
|
1979
|
+
let succeedValue: AstInspectNode | null = null;
|
|
1973
1980
|
if (node.kind === "CallExpression") {
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
const isSucceed =
|
|
1977
|
-
(calleeMember?.object === "Effect" &&
|
|
1978
|
-
calleeMember.property === "succeed") ||
|
|
1979
|
-
(callee?.kind === "Identifier" &&
|
|
1980
|
-
astName(callee) === "succeed");
|
|
1981
|
-
const args = astChildren(node, "args");
|
|
1982
|
-
if (isSucceed && args.length > 0) {
|
|
1983
|
-
const arg = args[0];
|
|
1984
|
-
if (
|
|
1985
|
-
(arg.kind === "CallExpression" &&
|
|
1986
|
-
!isPureDataConstructor(arg)) ||
|
|
1987
|
-
arg.kind === "NewExpression"
|
|
1988
|
-
) {
|
|
1989
|
-
addAstDiag(
|
|
1990
|
-
arg.span || node.span,
|
|
1991
|
-
"EAGER_SUCCEED",
|
|
1992
|
-
"`Effect.succeed` evaluates its argument eagerly at construction time. If the expression contains function calls or side effects, use `Effect.sync(() => ...)` for deferred evaluation.",
|
|
1993
|
-
"warning",
|
|
1994
|
-
"Passing a function call or constructor to Effect.succeed executes it immediately upon effect construction, not when the effect runs.",
|
|
1995
|
-
"Use `Effect.sync(() => ...)` or `Effect.try(...)` to defer evaluation until the effect is executed.",
|
|
1996
|
-
);
|
|
1997
|
-
}
|
|
1998
|
-
}
|
|
1981
|
+
succeedCallee = astChild(node, "callee");
|
|
1982
|
+
succeedValue = astChildren(node, "args")[0] ?? null;
|
|
1999
1983
|
} else if (node.kind === "PipelineExpression") {
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
1984
|
+
succeedCallee = astChild(node, "right");
|
|
1985
|
+
succeedValue = astChild(node, "left");
|
|
1986
|
+
}
|
|
1987
|
+
const succeedMember = getMemberNames(succeedCallee);
|
|
1988
|
+
const isSucceed =
|
|
1989
|
+
(succeedMember?.object === "Effect" &&
|
|
1990
|
+
succeedMember.property === "succeed") ||
|
|
1991
|
+
(succeedCallee?.kind === "Identifier" &&
|
|
1992
|
+
astName(succeedCallee) === "succeed");
|
|
1993
|
+
if (
|
|
1994
|
+
isSucceed &&
|
|
1995
|
+
succeedValue &&
|
|
1996
|
+
((succeedValue.kind === "CallExpression" &&
|
|
1997
|
+
!isPureDataConstructor(succeedValue)) ||
|
|
1998
|
+
succeedValue.kind === "NewExpression")
|
|
1999
|
+
) {
|
|
2000
|
+
addAstDiag(
|
|
2001
|
+
succeedValue.span || node.span,
|
|
2002
|
+
"EAGER_SUCCEED",
|
|
2003
|
+
"`Effect.succeed` evaluates its argument eagerly at construction time. If the expression contains function calls or side effects, use `Effect.sync(() => ...)` for deferred evaluation.",
|
|
2004
|
+
"warning",
|
|
2005
|
+
"Passing a function call or constructor to Effect.succeed executes it immediately upon effect construction, not when the effect runs.",
|
|
2006
|
+
"Use `Effect.sync(() => ...)` or `Effect.try(...)` to defer evaluation until the effect is executed.",
|
|
2007
|
+
);
|
|
2023
2008
|
}
|
|
2024
2009
|
|
|
2025
2010
|
if (
|
|
@@ -2100,8 +2085,85 @@ export const typeCheckVirtualFiles = (
|
|
|
2100
2085
|
(finalExpr?.kind === "Identifier" ||
|
|
2101
2086
|
finalExpr?.kind === "UpperIdentifier") &&
|
|
2102
2087
|
astName(finalExpr) === "Void";
|
|
2088
|
+
const isIndependentLiteral = (
|
|
2089
|
+
expr: AstInspectNode | null,
|
|
2090
|
+
): boolean => {
|
|
2091
|
+
if (!expr) return false;
|
|
2092
|
+
if (
|
|
2093
|
+
[
|
|
2094
|
+
"NumberLiteral",
|
|
2095
|
+
"StringLiteral",
|
|
2096
|
+
"BooleanLiteral",
|
|
2097
|
+
"TemplateLiteral",
|
|
2098
|
+
].includes(expr.kind)
|
|
2099
|
+
)
|
|
2100
|
+
return true;
|
|
2101
|
+
if (expr.kind === "ArrayExpression")
|
|
2102
|
+
return astChildren(expr, "elements").every(
|
|
2103
|
+
isIndependentLiteral,
|
|
2104
|
+
);
|
|
2105
|
+
if (expr.kind === "RecordExpression")
|
|
2106
|
+
return astChildren(expr, "entries").every(
|
|
2107
|
+
(entry) =>
|
|
2108
|
+
(entry.kind === "FieldEntry" ||
|
|
2109
|
+
entry.kind === "DotPathEntry") &&
|
|
2110
|
+
isIndependentLiteral(astChild(entry, "value")),
|
|
2111
|
+
);
|
|
2112
|
+
return false;
|
|
2113
|
+
};
|
|
2103
2114
|
|
|
2104
|
-
if (!isUnit) {
|
|
2115
|
+
if (!isUnit && !isIndependentLiteral(finalExpr)) {
|
|
2116
|
+
// Function parameters shadow module bindings, including
|
|
2117
|
+
// inside nested functions. Never follow a shadowed name.
|
|
2118
|
+
const shadowed = new Set<string>();
|
|
2119
|
+
const collectEnclosingParams = (
|
|
2120
|
+
candidate: AstInspectNode,
|
|
2121
|
+
): void => {
|
|
2122
|
+
if (
|
|
2123
|
+
!candidate.span ||
|
|
2124
|
+
!node.span ||
|
|
2125
|
+
candidate.span.start.offset > node.span.start.offset ||
|
|
2126
|
+
candidate.span.end.offset < node.span.end.offset
|
|
2127
|
+
)
|
|
2128
|
+
return;
|
|
2129
|
+
if (candidate.kind === "FunctionExpression") {
|
|
2130
|
+
for (const param of astChildren(candidate, "params")) {
|
|
2131
|
+
for (const name of collectPatternVars(
|
|
2132
|
+
astChild(param, "name"),
|
|
2133
|
+
))
|
|
2134
|
+
shadowed.add(name);
|
|
2135
|
+
}
|
|
2136
|
+
}
|
|
2137
|
+
for (const [key, value] of Object.entries(
|
|
2138
|
+
asRecord(candidate),
|
|
2139
|
+
)) {
|
|
2140
|
+
if (key === "span") continue;
|
|
2141
|
+
if (Array.isArray(value)) {
|
|
2142
|
+
for (const item of value)
|
|
2143
|
+
if (isAstNode(item)) collectEnclosingParams(item);
|
|
2144
|
+
} else if (isAstNode(value))
|
|
2145
|
+
collectEnclosingParams(value);
|
|
2146
|
+
}
|
|
2147
|
+
};
|
|
2148
|
+
if (meta.ast) collectEnclosingParams(meta.ast);
|
|
2149
|
+
for (const statement of astChildren(node, "body")) {
|
|
2150
|
+
if (
|
|
2151
|
+
statement.kind === "BindingDeclaration" ||
|
|
2152
|
+
statement.kind === "EffectBindStatement"
|
|
2153
|
+
) {
|
|
2154
|
+
for (const name of collectPatternVars(
|
|
2155
|
+
astChild(statement, "id"),
|
|
2156
|
+
))
|
|
2157
|
+
shadowed.add(name);
|
|
2158
|
+
}
|
|
2159
|
+
}
|
|
2160
|
+
const imports = effectImportNames(meta.ast);
|
|
2161
|
+
for (const name of shadowed) {
|
|
2162
|
+
imports.effect.delete(name);
|
|
2163
|
+
imports.scope.delete(name);
|
|
2164
|
+
imports.acquire.delete(name);
|
|
2165
|
+
imports.finalizer.delete(name);
|
|
2166
|
+
}
|
|
2105
2167
|
const findFinalizer = (
|
|
2106
2168
|
n: unknown,
|
|
2107
2169
|
allowAcquire: boolean,
|
|
@@ -2121,7 +2183,8 @@ export const typeCheckVirtualFiles = (
|
|
|
2121
2183
|
callee.property as { name?: string } | undefined
|
|
2122
2184
|
)?.name;
|
|
2123
2185
|
if (
|
|
2124
|
-
|
|
2186
|
+
!!obj &&
|
|
2187
|
+
(imports.effect.has(obj) || imports.scope.has(obj)) &&
|
|
2125
2188
|
(prop === "addFinalizer" ||
|
|
2126
2189
|
(allowAcquire && prop === "acquireRelease"))
|
|
2127
2190
|
) {
|
|
@@ -2133,8 +2196,10 @@ export const typeCheckVirtualFiles = (
|
|
|
2133
2196
|
} else if (callee?.kind === "Identifier") {
|
|
2134
2197
|
const calleeName = (callee as { name?: string }).name;
|
|
2135
2198
|
if (
|
|
2136
|
-
calleeName
|
|
2137
|
-
(allowAcquire &&
|
|
2199
|
+
(!!calleeName && imports.finalizer.has(calleeName)) ||
|
|
2200
|
+
(allowAcquire &&
|
|
2201
|
+
!!calleeName &&
|
|
2202
|
+
imports.acquire.has(calleeName))
|
|
2138
2203
|
) {
|
|
2139
2204
|
return {
|
|
2140
2205
|
name: calleeName,
|
|
@@ -2175,10 +2240,11 @@ export const typeCheckVirtualFiles = (
|
|
|
2175
2240
|
detectedCall = findFinalizer(finalExpr, false);
|
|
2176
2241
|
}
|
|
2177
2242
|
|
|
2178
|
-
// Follow
|
|
2179
|
-
//
|
|
2180
|
-
//
|
|
2181
|
-
|
|
2243
|
+
// Follow resources through aliases, returned containers and
|
|
2244
|
+
// captured closures. An eagerly read property can be an
|
|
2245
|
+
// independent value, but a closure reading it captures the
|
|
2246
|
+
// resource itself for later use.
|
|
2247
|
+
if (!detectedCall && finalExpr) {
|
|
2182
2248
|
const bindings = new Map<string, AstInspectNode>();
|
|
2183
2249
|
for (const item of meta.ast?.body ?? []) {
|
|
2184
2250
|
const decl =
|
|
@@ -2192,39 +2258,6 @@ export const typeCheckVirtualFiles = (
|
|
|
2192
2258
|
bindings.set(decl.id.name, decl.init);
|
|
2193
2259
|
}
|
|
2194
2260
|
}
|
|
2195
|
-
// Function parameters shadow module bindings, including
|
|
2196
|
-
// inside nested functions. Never follow a shadowed name.
|
|
2197
|
-
const shadowed = new Set<string>();
|
|
2198
|
-
const collectEnclosingParams = (
|
|
2199
|
-
candidate: AstInspectNode,
|
|
2200
|
-
): void => {
|
|
2201
|
-
if (
|
|
2202
|
-
!candidate.span ||
|
|
2203
|
-
!node.span ||
|
|
2204
|
-
candidate.span.start.offset > node.span.start.offset ||
|
|
2205
|
-
candidate.span.end.offset < node.span.end.offset
|
|
2206
|
-
)
|
|
2207
|
-
return;
|
|
2208
|
-
if (candidate.kind === "FunctionExpression") {
|
|
2209
|
-
for (const param of astChildren(candidate, "params")) {
|
|
2210
|
-
for (const name of collectPatternVars(
|
|
2211
|
-
astChild(param, "name"),
|
|
2212
|
-
))
|
|
2213
|
-
shadowed.add(name);
|
|
2214
|
-
}
|
|
2215
|
-
}
|
|
2216
|
-
for (const [key, value] of Object.entries(
|
|
2217
|
-
asRecord(candidate),
|
|
2218
|
-
)) {
|
|
2219
|
-
if (key === "span") continue;
|
|
2220
|
-
if (Array.isArray(value)) {
|
|
2221
|
-
for (const item of value)
|
|
2222
|
-
if (isAstNode(item)) collectEnclosingParams(item);
|
|
2223
|
-
} else if (isAstNode(value))
|
|
2224
|
-
collectEnclosingParams(value);
|
|
2225
|
-
}
|
|
2226
|
-
};
|
|
2227
|
-
if (meta.ast) collectEnclosingParams(meta.ast);
|
|
2228
2261
|
for (const name of shadowed) bindings.delete(name);
|
|
2229
2262
|
for (const stmt of astChildren(node, "body")) {
|
|
2230
2263
|
if (stmt.kind === "BindingDeclaration") {
|
|
@@ -2233,96 +2266,33 @@ export const typeCheckVirtualFiles = (
|
|
|
2233
2266
|
if (name && init) bindings.set(name, init);
|
|
2234
2267
|
}
|
|
2235
2268
|
}
|
|
2236
|
-
const
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
const bind = stmts.find(
|
|
2243
|
-
(stmt) =>
|
|
2244
|
-
stmt.kind === "EffectBindStatement" &&
|
|
2245
|
-
astName(astChild(stmt, "id")) === name,
|
|
2246
|
-
);
|
|
2247
|
-
if (bind) return bind;
|
|
2248
|
-
const alias = stmts.find(
|
|
2249
|
-
(stmt) =>
|
|
2250
|
-
stmt.kind === "BindingDeclaration" &&
|
|
2251
|
-
astName(astChild(stmt, "id")) === name,
|
|
2252
|
-
);
|
|
2253
|
-
const init = astChild(alias, "init");
|
|
2254
|
-
return init?.kind === "Identifier"
|
|
2255
|
-
? resolveReturned(
|
|
2256
|
-
astName(init),
|
|
2257
|
-
new Set([...seen, name]),
|
|
2258
|
-
)
|
|
2259
|
-
: undefined;
|
|
2260
|
-
};
|
|
2261
|
-
const bind = resolveReturned(astName(finalExpr), new Set());
|
|
2262
|
-
const source = astChild(bind, "effect");
|
|
2263
|
-
const followsAcquire = (
|
|
2264
|
-
expr: AstInspectNode | null,
|
|
2265
|
-
seen: Set<string>,
|
|
2266
|
-
): boolean => {
|
|
2267
|
-
if (!expr) return false;
|
|
2268
|
-
if (expr.kind === "Identifier") {
|
|
2269
|
-
const name = astName(expr);
|
|
2270
|
-
if (!name || seen.has(name)) return false;
|
|
2271
|
-
const next = bindings.get(name);
|
|
2272
|
-
if (!next) return false;
|
|
2273
|
-
return followsAcquire(next, new Set([...seen, name]));
|
|
2274
|
-
}
|
|
2275
|
-
if (expr.kind === "FunctionExpression") {
|
|
2276
|
-
const nestedSeen = new Set(seen);
|
|
2277
|
-
for (const param of astChildren(expr, "params")) {
|
|
2278
|
-
for (const name of collectPatternVars(
|
|
2279
|
-
astChild(param, "name"),
|
|
2280
|
-
))
|
|
2281
|
-
nestedSeen.add(name);
|
|
2282
|
-
}
|
|
2283
|
-
return followsAcquire(
|
|
2284
|
-
astChild(expr, "body"),
|
|
2285
|
-
nestedSeen,
|
|
2286
|
-
);
|
|
2287
|
-
}
|
|
2288
|
-
if (expr.kind === "BlockStatement") {
|
|
2289
|
-
return followsAcquire(
|
|
2290
|
-
astChild(expr, "finalExpression"),
|
|
2291
|
-
seen,
|
|
2269
|
+
const programs = new Map<string, Program>();
|
|
2270
|
+
for (const entry of virtualSourceMap.values()) {
|
|
2271
|
+
if (entry.ast)
|
|
2272
|
+
programs.set(
|
|
2273
|
+
path.resolve(cwd, entry.funPath),
|
|
2274
|
+
entry.ast,
|
|
2292
2275
|
);
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
(member?.object === "Effect" &&
|
|
2312
|
-
member.property === "acquireRelease") ||
|
|
2313
|
-
(callee?.kind === "Identifier" &&
|
|
2314
|
-
astName(callee) === "acquireRelease")
|
|
2315
|
-
)
|
|
2316
|
-
return true;
|
|
2317
|
-
if (callee?.kind === "Identifier") {
|
|
2318
|
-
return followsAcquire(callee, seen);
|
|
2319
|
-
}
|
|
2320
|
-
}
|
|
2321
|
-
return false;
|
|
2322
|
-
};
|
|
2323
|
-
if (source && followsAcquire(source, new Set())) {
|
|
2276
|
+
}
|
|
2277
|
+
const followsAcquire = createResourceProviderResolver({
|
|
2278
|
+
rootFile: path.resolve(cwd, meta.funPath),
|
|
2279
|
+
rootAst: meta.ast!,
|
|
2280
|
+
rootBindings: bindings,
|
|
2281
|
+
rootImports: imports,
|
|
2282
|
+
shadowed,
|
|
2283
|
+
sources: virtualSources,
|
|
2284
|
+
programs,
|
|
2285
|
+
});
|
|
2286
|
+
const source = findScopedResourceEscape(
|
|
2287
|
+
node,
|
|
2288
|
+
finalExpr,
|
|
2289
|
+
sf,
|
|
2290
|
+
checker,
|
|
2291
|
+
followsAcquire,
|
|
2292
|
+
);
|
|
2293
|
+
if (source) {
|
|
2324
2294
|
detectedCall = {
|
|
2325
|
-
name: "
|
|
2295
|
+
name: "a scope-bound provider",
|
|
2326
2296
|
span: source.span ?? node.span!,
|
|
2327
2297
|
};
|
|
2328
2298
|
}
|
|
@@ -2333,10 +2303,12 @@ export const typeCheckVirtualFiles = (
|
|
|
2333
2303
|
addAstDiag(
|
|
2334
2304
|
callInfo.span,
|
|
2335
2305
|
"PREMATURE_FINALIZER_CLOSE",
|
|
2336
|
-
|
|
2306
|
+
callInfo.name === "a scope-bound provider"
|
|
2307
|
+
? "A scope-bound resource escapes this effect through the returned value. Its scope closes before the caller can use it."
|
|
2308
|
+
: `Finalizer registered with '${callInfo.name}' in a scoped effect block will execute immediately when this function returns, closing the returned resource or a resource it captures.`,
|
|
2337
2309
|
"error",
|
|
2338
|
-
"By default, 'effect' blocks create a scoped boundary ('Effect.scoped').
|
|
2339
|
-
"Change 'effect' to 'effect (unscoped)' so the resource's lifetime is bound to the caller's scope, or
|
|
2310
|
+
"By default, 'effect' blocks create a scoped boundary ('Effect.scoped'). Scope-bound resources are finalized as soon as the block returns, before the caller can use them.",
|
|
2311
|
+
"Change 'effect' to 'effect (unscoped)' so the resource's lifetime is bound to the caller's scope, or finish using the resource inside this block and return an independent value.",
|
|
2340
2312
|
);
|
|
2341
2313
|
}
|
|
2342
2314
|
}
|