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/cli/init.ts
CHANGED
|
@@ -67,17 +67,17 @@ dist/
|
|
|
67
67
|
check: "funkscript check",
|
|
68
68
|
},
|
|
69
69
|
dependencies: {
|
|
70
|
-
effect: "^
|
|
70
|
+
effect: "^4.1.2",
|
|
71
|
+
funkscript: `^${FUNSCRIPT_VERSION}`,
|
|
71
72
|
},
|
|
72
73
|
devDependencies: {
|
|
73
|
-
"@types/bun": "
|
|
74
|
-
funkscript: `^${FUNSCRIPT_VERSION}`,
|
|
74
|
+
"@types/bun": "^1.4.4",
|
|
75
75
|
},
|
|
76
76
|
},
|
|
77
77
|
null,
|
|
78
78
|
2,
|
|
79
79
|
),
|
|
80
|
-
"bunfig.toml": `preload = ["funkscript/bun"]\n`,
|
|
80
|
+
"bunfig.toml": `preload = ["funkscript/bun/preload"]\n`,
|
|
81
81
|
"tsconfig.json": JSON.stringify(
|
|
82
82
|
{
|
|
83
83
|
compilerOptions: {
|
|
@@ -94,21 +94,18 @@ dist/
|
|
|
94
94
|
2,
|
|
95
95
|
),
|
|
96
96
|
".gitignore": gitignore,
|
|
97
|
-
"src/index.fun": `
|
|
97
|
+
"src/index.fun": `ts { const startServer = (handler: (req: Request) => Response) => Bun.serve({ port: 3000, fetch: handler }); }
|
|
98
98
|
|
|
99
|
-
export handleRequest = (
|
|
100
|
-
new Response("Hello from FunkScript on Bun!", {
|
|
101
|
-
headers: { "content-type": "text/plain" }
|
|
102
|
-
})
|
|
99
|
+
export handleRequest = (_req: Request): Response => Response("Hello from FunkScript on Bun!")
|
|
103
100
|
|
|
104
|
-
export main =
|
|
101
|
+
export main = () => startServer(handleRequest)
|
|
105
102
|
`,
|
|
106
103
|
"tests/server.test.fun": `import { describe, it, expect } from "funkscript/test"
|
|
107
104
|
import { handleRequest } from "../src/index.fun"
|
|
108
105
|
|
|
109
106
|
suite = describe("HTTP Server", () =>
|
|
110
107
|
it("returns 200 OK greeting", () =>
|
|
111
|
-
req =
|
|
108
|
+
req = Request("http://localhost:3000/")
|
|
112
109
|
res = handleRequest(req)
|
|
113
110
|
=> expect(res.status).toBe(200)
|
|
114
111
|
)
|
|
@@ -123,7 +120,7 @@ FunkScript application running on the Bun runtime with native \`bunfig.toml\` pr
|
|
|
123
120
|
bun install
|
|
124
121
|
bun run dev # run live in watch mode with Bun
|
|
125
122
|
bun run test # run tests with native bun test
|
|
126
|
-
bun run build # bundle
|
|
123
|
+
bun run build # bundle an executable for Bun
|
|
127
124
|
\`\`\`
|
|
128
125
|
`,
|
|
129
126
|
};
|
|
@@ -137,11 +134,13 @@ bun run build # bundle standalone executable with fast native Bun
|
|
|
137
134
|
type: "module",
|
|
138
135
|
scripts: {
|
|
139
136
|
dev: "vite",
|
|
140
|
-
build: "vite build",
|
|
137
|
+
build: "vite build && tsc --noEmit",
|
|
141
138
|
test: "funkscript test",
|
|
142
139
|
fmt: "funkscript fmt src",
|
|
143
140
|
},
|
|
144
141
|
dependencies: {
|
|
142
|
+
effect: "^4.1.2",
|
|
143
|
+
funkscript: `^${FUNSCRIPT_VERSION}`,
|
|
145
144
|
react: "^19.0.0",
|
|
146
145
|
"react-dom": "^19.0.0",
|
|
147
146
|
},
|
|
@@ -149,7 +148,6 @@ bun run build # bundle standalone executable with fast native Bun
|
|
|
149
148
|
"@types/react": "^19.0.0",
|
|
150
149
|
"@types/react-dom": "^19.0.0",
|
|
151
150
|
"@vitejs/plugin-react": "^4.3.4",
|
|
152
|
-
funkscript: `^${FUNSCRIPT_VERSION}`,
|
|
153
151
|
typescript: "^5.6.3",
|
|
154
152
|
vite: "^5.4.11",
|
|
155
153
|
vitest: "^2.1.8",
|
|
@@ -163,7 +161,7 @@ import react from "@vitejs/plugin-react";
|
|
|
163
161
|
import { funscriptPlugin } from "funkscript/vite";
|
|
164
162
|
|
|
165
163
|
export default defineConfig({
|
|
166
|
-
plugins: [funscriptPlugin(), react()],
|
|
164
|
+
plugins: [funscriptPlugin({ types: { include: ["src"] } }), react()],
|
|
167
165
|
});
|
|
168
166
|
`,
|
|
169
167
|
"index.html": `<!DOCTYPE html>
|
|
@@ -186,6 +184,8 @@ export default defineConfig({
|
|
|
186
184
|
module: "ESNext",
|
|
187
185
|
moduleResolution: "bundler",
|
|
188
186
|
jsx: "react-jsx",
|
|
187
|
+
allowArbitraryExtensions: true,
|
|
188
|
+
rootDirs: [".", "./.funscript/types"],
|
|
189
189
|
strict: true,
|
|
190
190
|
skipLibCheck: true,
|
|
191
191
|
},
|
|
@@ -217,6 +217,19 @@ ReactDOM.createRoot(document.getElementById("root")!).render(
|
|
|
217
217
|
<App />
|
|
218
218
|
</React.StrictMode>
|
|
219
219
|
);
|
|
220
|
+
`,
|
|
221
|
+
"tests/app.test.ts": `import { describe, it, expect } from "vitest";
|
|
222
|
+
import React from "react";
|
|
223
|
+
import { renderToStaticMarkup } from "react-dom/server";
|
|
224
|
+
import { App } from "../src/App.funx";
|
|
225
|
+
|
|
226
|
+
describe("App", () => {
|
|
227
|
+
it("renders the initial page", () => {
|
|
228
|
+
const html = renderToStaticMarkup(React.createElement(App));
|
|
229
|
+
expect(html).toContain("FunkScript + React");
|
|
230
|
+
expect(html).toContain("Count: 0");
|
|
231
|
+
});
|
|
232
|
+
});
|
|
220
233
|
`,
|
|
221
234
|
"README.md": `# ${projectName}
|
|
222
235
|
|
|
@@ -240,15 +253,16 @@ npm run build # build production bundle
|
|
|
240
253
|
type: "module",
|
|
241
254
|
scripts: {
|
|
242
255
|
dev: "vite",
|
|
243
|
-
build: "vite build",
|
|
256
|
+
build: "vite build && tsc --noEmit",
|
|
244
257
|
test: "funkscript test",
|
|
245
258
|
fmt: "funkscript fmt src",
|
|
246
259
|
},
|
|
247
260
|
dependencies: {
|
|
261
|
+
effect: "^4.1.2",
|
|
262
|
+
funkscript: `^${FUNSCRIPT_VERSION}`,
|
|
248
263
|
"solid-js": "^1.9.3",
|
|
249
264
|
},
|
|
250
265
|
devDependencies: {
|
|
251
|
-
funkscript: `^${FUNSCRIPT_VERSION}`,
|
|
252
266
|
typescript: "^5.6.3",
|
|
253
267
|
vite: "^5.4.11",
|
|
254
268
|
"vite-plugin-solid": "^2.11.0",
|
|
@@ -263,7 +277,16 @@ import solid from "vite-plugin-solid";
|
|
|
263
277
|
import { funscriptPlugin } from "funkscript/vite";
|
|
264
278
|
|
|
265
279
|
export default defineConfig({
|
|
266
|
-
plugins: [funscriptPlugin(), solid()],
|
|
280
|
+
plugins: [funscriptPlugin({ types: { include: ["src"] } }), solid({ extensions: [[".funx", { typescript: true }]] })],
|
|
281
|
+
});
|
|
282
|
+
`,
|
|
283
|
+
"vitest.config.ts": `import { defineConfig } from "vitest/config";
|
|
284
|
+
import solid from "vite-plugin-solid";
|
|
285
|
+
import { funscriptPlugin } from "funkscript/vite";
|
|
286
|
+
|
|
287
|
+
export default defineConfig({
|
|
288
|
+
plugins: [funscriptPlugin(), solid({ ssr: true, extensions: [[".funx", { typescript: true }]] })],
|
|
289
|
+
test: { environment: "node" },
|
|
267
290
|
});
|
|
268
291
|
`,
|
|
269
292
|
"index.html": `<!DOCTYPE html>
|
|
@@ -287,6 +310,8 @@ export default defineConfig({
|
|
|
287
310
|
moduleResolution: "bundler",
|
|
288
311
|
jsx: "preserve",
|
|
289
312
|
jsxImportSource: "solid-js",
|
|
313
|
+
allowArbitraryExtensions: true,
|
|
314
|
+
rootDirs: [".", "./.funscript/types"],
|
|
290
315
|
strict: true,
|
|
291
316
|
skipLibCheck: true,
|
|
292
317
|
},
|
|
@@ -301,7 +326,7 @@ export default defineConfig({
|
|
|
301
326
|
export App = () =>
|
|
302
327
|
[count, setCount] = createSignal(0)
|
|
303
328
|
|
|
304
|
-
=> <div style=
|
|
329
|
+
=> <div style="padding: 2rem; font-family: sans-serif">
|
|
305
330
|
<h1>FunkScript + Solid</h1>
|
|
306
331
|
<p>Fine-grained reactive UI built with FunkScript JSX.</p>
|
|
307
332
|
<button onClick={() => setCount(count() + 1)}>
|
|
@@ -313,6 +338,18 @@ export App = () =>
|
|
|
313
338
|
import { App } from "./App.funx";
|
|
314
339
|
|
|
315
340
|
render(() => <App />, document.getElementById("root")!);
|
|
341
|
+
`,
|
|
342
|
+
"tests/app.test.ts": `import { describe, it, expect } from "vitest";
|
|
343
|
+
import { renderToString } from "solid-js/web";
|
|
344
|
+
import { App } from "../src/App.funx";
|
|
345
|
+
|
|
346
|
+
describe("App", () => {
|
|
347
|
+
it("renders the initial page", () => {
|
|
348
|
+
const html = renderToString(() => App());
|
|
349
|
+
expect(html).toContain("FunkScript + Solid");
|
|
350
|
+
expect(html).toContain("Count:");
|
|
351
|
+
});
|
|
352
|
+
});
|
|
316
353
|
`,
|
|
317
354
|
"README.md": `# ${projectName}
|
|
318
355
|
|
|
@@ -343,10 +380,10 @@ npm run build # build production bundle
|
|
|
343
380
|
check: "funkscript check",
|
|
344
381
|
},
|
|
345
382
|
dependencies: {
|
|
346
|
-
effect: "^
|
|
383
|
+
effect: "^4.1.2",
|
|
384
|
+
funkscript: `^${FUNSCRIPT_VERSION}`,
|
|
347
385
|
},
|
|
348
386
|
devDependencies: {
|
|
349
|
-
funkscript: `^${FUNSCRIPT_VERSION}`,
|
|
350
387
|
typescript: "^5.6.3",
|
|
351
388
|
vitest: "^2.1.8",
|
|
352
389
|
},
|
|
@@ -369,6 +406,14 @@ npm run build # build production bundle
|
|
|
369
406
|
null,
|
|
370
407
|
2,
|
|
371
408
|
),
|
|
409
|
+
"vitest.config.ts": `import { defineConfig, configDefaults } from "vitest/config";
|
|
410
|
+
import { funscriptPlugin } from "funkscript/vite";
|
|
411
|
+
|
|
412
|
+
export default defineConfig({
|
|
413
|
+
plugins: [funscriptPlugin()],
|
|
414
|
+
test: { globals: true, include: [...configDefaults.include, "**/*.{test,spec}.{fun,funx}"] },
|
|
415
|
+
});
|
|
416
|
+
`,
|
|
372
417
|
".gitignore": gitignore,
|
|
373
418
|
"src/main.fun": `import { Console, pipe, Array } from "effect"
|
|
374
419
|
|
package/src/cli/query.ts
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import * as Console from "effect/Console";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as fs from "node:fs/promises";
|
|
4
|
+
import {
|
|
5
|
+
auditEscapeHatchesFiles,
|
|
6
|
+
formatEscapeAudit,
|
|
7
|
+
type EscapeAuditReport,
|
|
8
|
+
} from "../compiler/escape-audit.js";
|
|
9
|
+
import { formatQueryReport, queryFiles } from "../compiler/query.js";
|
|
10
|
+
import { toErrorMessage } from "../errors.js";
|
|
11
|
+
import { findFunFiles } from "./io.js";
|
|
12
|
+
|
|
13
|
+
const USAGE =
|
|
14
|
+
"Usage: funkscript query [file.fun|file.funx...] [--symbol <name>] [--escapes] [--json]";
|
|
15
|
+
|
|
16
|
+
interface ParsedQueryArgs {
|
|
17
|
+
files: string[];
|
|
18
|
+
symbol?: string;
|
|
19
|
+
escapes: boolean;
|
|
20
|
+
json: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function parseQueryArgs(args: string[]): ParsedQueryArgs | string {
|
|
24
|
+
const files: string[] = [];
|
|
25
|
+
let symbol: string | undefined;
|
|
26
|
+
let escapes = false;
|
|
27
|
+
let json = false;
|
|
28
|
+
|
|
29
|
+
for (let i = 0; i < args.length; i++) {
|
|
30
|
+
const arg = args[i];
|
|
31
|
+
if (arg === "--json") {
|
|
32
|
+
json = true;
|
|
33
|
+
} else if (arg === "--escapes") {
|
|
34
|
+
escapes = true;
|
|
35
|
+
} else if (arg === "--symbol") {
|
|
36
|
+
const value = args[i + 1];
|
|
37
|
+
if (!value || value.startsWith("-")) {
|
|
38
|
+
return "Option '--symbol' requires a value.";
|
|
39
|
+
}
|
|
40
|
+
symbol = value;
|
|
41
|
+
i++;
|
|
42
|
+
} else if (arg.startsWith("--symbol=")) {
|
|
43
|
+
const value = arg.slice("--symbol=".length);
|
|
44
|
+
if (!value) {
|
|
45
|
+
return "Option '--symbol' requires a value.";
|
|
46
|
+
}
|
|
47
|
+
symbol = value;
|
|
48
|
+
} else if (arg.startsWith("-")) {
|
|
49
|
+
return `Unknown option '${arg}' for 'query'. ${USAGE}`;
|
|
50
|
+
} else {
|
|
51
|
+
files.push(arg);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return { files, symbol, escapes, json };
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function filterEscapeReportBySymbol(
|
|
59
|
+
report: EscapeAuditReport,
|
|
60
|
+
symbol: string,
|
|
61
|
+
): EscapeAuditReport {
|
|
62
|
+
const counts = {
|
|
63
|
+
rawTs: 0,
|
|
64
|
+
jsInterop: 0,
|
|
65
|
+
wildcardMatch: 0,
|
|
66
|
+
typedHole: 0,
|
|
67
|
+
total: 0,
|
|
68
|
+
};
|
|
69
|
+
const files = report.files.map((fileReport) => {
|
|
70
|
+
const findings = fileReport.findings.filter(
|
|
71
|
+
(f) => f.declaration === symbol,
|
|
72
|
+
);
|
|
73
|
+
const fileCounts = {
|
|
74
|
+
rawTs: 0,
|
|
75
|
+
jsInterop: 0,
|
|
76
|
+
wildcardMatch: 0,
|
|
77
|
+
typedHole: 0,
|
|
78
|
+
total: findings.length,
|
|
79
|
+
};
|
|
80
|
+
for (const finding of findings) {
|
|
81
|
+
switch (finding.kind) {
|
|
82
|
+
case "raw-ts":
|
|
83
|
+
fileCounts.rawTs += 1;
|
|
84
|
+
counts.rawTs += 1;
|
|
85
|
+
break;
|
|
86
|
+
case "js-interop":
|
|
87
|
+
fileCounts.jsInterop += 1;
|
|
88
|
+
counts.jsInterop += 1;
|
|
89
|
+
break;
|
|
90
|
+
case "wildcard-match":
|
|
91
|
+
fileCounts.wildcardMatch += 1;
|
|
92
|
+
counts.wildcardMatch += 1;
|
|
93
|
+
break;
|
|
94
|
+
case "typed-hole":
|
|
95
|
+
fileCounts.typedHole += 1;
|
|
96
|
+
counts.typedHole += 1;
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
counts.total += fileCounts.total;
|
|
101
|
+
return {
|
|
102
|
+
file: fileReport.file,
|
|
103
|
+
counts: fileCounts,
|
|
104
|
+
findings,
|
|
105
|
+
};
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
return {
|
|
109
|
+
schemaVersion: 1,
|
|
110
|
+
counts,
|
|
111
|
+
files,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function resolveQueryTargets(
|
|
116
|
+
rawTargets: string[],
|
|
117
|
+
): Effect.Effect<string[], Error> {
|
|
118
|
+
return Effect.gen(function* () {
|
|
119
|
+
if (rawTargets.length === 0) {
|
|
120
|
+
const hasSrc = yield* Effect.promise(() =>
|
|
121
|
+
fs
|
|
122
|
+
.stat("src")
|
|
123
|
+
.then((stat) => stat.isDirectory())
|
|
124
|
+
.catch(() => false),
|
|
125
|
+
);
|
|
126
|
+
const searchDir = hasSrc ? "src" : ".";
|
|
127
|
+
return yield* Effect.tryPromise({
|
|
128
|
+
try: () => findFunFiles(searchDir),
|
|
129
|
+
catch: (error: unknown) =>
|
|
130
|
+
new Error(
|
|
131
|
+
`Failed to scan files in '${searchDir}': ${toErrorMessage(error)}`,
|
|
132
|
+
),
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const resolved: string[] = [];
|
|
137
|
+
for (const target of rawTargets) {
|
|
138
|
+
const stat = yield* Effect.tryPromise({
|
|
139
|
+
try: () => fs.stat(target),
|
|
140
|
+
catch: (error: unknown) =>
|
|
141
|
+
new Error(
|
|
142
|
+
`File or directory '${target}' not found: ${toErrorMessage(error)}`,
|
|
143
|
+
),
|
|
144
|
+
});
|
|
145
|
+
if (stat.isDirectory()) {
|
|
146
|
+
const nested = yield* Effect.tryPromise({
|
|
147
|
+
try: () => findFunFiles(target),
|
|
148
|
+
catch: (error: unknown) =>
|
|
149
|
+
new Error(
|
|
150
|
+
`Failed to scan files in '${target}': ${toErrorMessage(error)}`,
|
|
151
|
+
),
|
|
152
|
+
});
|
|
153
|
+
resolved.push(...nested);
|
|
154
|
+
} else {
|
|
155
|
+
resolved.push(target);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return resolved;
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export const queryCommand = (args: string[]): Effect.Effect<void, Error> =>
|
|
163
|
+
Effect.gen(function* () {
|
|
164
|
+
const parsed = parseQueryArgs(args);
|
|
165
|
+
if (typeof parsed === "string") {
|
|
166
|
+
process.exitCode = 1;
|
|
167
|
+
yield* Console.error(parsed);
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const filesToQuery = yield* resolveQueryTargets(parsed.files);
|
|
172
|
+
if (filesToQuery.length === 0) {
|
|
173
|
+
yield* Console.error(USAGE);
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (parsed.escapes) {
|
|
178
|
+
const rawReport = yield* auditEscapeHatchesFiles(filesToQuery);
|
|
179
|
+
const report = parsed.symbol
|
|
180
|
+
? filterEscapeReportBySymbol(rawReport, parsed.symbol)
|
|
181
|
+
: rawReport;
|
|
182
|
+
yield* Console.log(formatEscapeAudit(report, { json: parsed.json }));
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const report = yield* queryFiles(
|
|
187
|
+
filesToQuery,
|
|
188
|
+
parsed.symbol ? { symbol: parsed.symbol } : undefined,
|
|
189
|
+
);
|
|
190
|
+
yield* Console.log(formatQueryReport(report, { json: parsed.json }));
|
|
191
|
+
});
|
package/src/cli/run.ts
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
import { buildRunBundle, isBunAvailable } from "./build-bun.js";
|
|
11
11
|
import { checkNoTsPaths } from "./io.js";
|
|
12
12
|
import { checkCliFiles } from "./typecheck.js";
|
|
13
|
+
import { commandCheckOptions } from "./check-policy.js";
|
|
13
14
|
|
|
14
15
|
let projectPolicy: FunScriptProjectConfig = {};
|
|
15
16
|
const checkNoTsPathsProxy = (
|
|
@@ -69,36 +70,10 @@ export const runCommand = (
|
|
|
69
70
|
return;
|
|
70
71
|
if (
|
|
71
72
|
!commandArgs.includes("--no-check") &&
|
|
72
|
-
!(yield* checkCliFiles(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
noDeepDestructure:
|
|
77
|
-
commandArgs.includes("--no-deep-destructure") ||
|
|
78
|
-
projectPolicy.noDeepDestructure === true,
|
|
79
|
-
maxDestructureDepth: projectPolicy.maxDestructureDepth,
|
|
80
|
-
effectOnly: projectPolicy.effectOnly,
|
|
81
|
-
noTsPaths: Array.isArray(projectPolicy.noTs)
|
|
82
|
-
? projectPolicy.noTs
|
|
83
|
-
: undefined,
|
|
84
|
-
noGlobalThisPaths: Array.isArray(projectPolicy.noGlobalThis)
|
|
85
|
-
? projectPolicy.noGlobalThis
|
|
86
|
-
: undefined,
|
|
87
|
-
barePipelinesPaths: Array.isArray(projectPolicy.barePipelines)
|
|
88
|
-
? projectPolicy.barePipelines
|
|
89
|
-
: undefined,
|
|
90
|
-
noDeepDestructurePaths: Array.isArray(projectPolicy.noDeepDestructure)
|
|
91
|
-
? projectPolicy.noDeepDestructure
|
|
92
|
-
: undefined,
|
|
93
|
-
allowHoles: projectPolicy.allowHoles === true,
|
|
94
|
-
allowHolesPaths: Array.isArray(projectPolicy.allowHoles)
|
|
95
|
-
? projectPolicy.allowHoles
|
|
96
|
-
: undefined,
|
|
97
|
-
allowEarlyReturns: projectPolicy.allowEarlyReturns === true,
|
|
98
|
-
allowEarlyReturnsPaths: Array.isArray(projectPolicy.allowEarlyReturns)
|
|
99
|
-
? projectPolicy.allowEarlyReturns
|
|
100
|
-
: undefined,
|
|
101
|
-
}))
|
|
73
|
+
!(yield* checkCliFiles(
|
|
74
|
+
[filePath],
|
|
75
|
+
commandCheckOptions(projectPolicy, commandArgs),
|
|
76
|
+
))
|
|
102
77
|
)
|
|
103
78
|
return;
|
|
104
79
|
|
package/src/cli/tsc.ts
CHANGED
|
@@ -12,6 +12,12 @@ import {
|
|
|
12
12
|
typeCheckFiles,
|
|
13
13
|
} from "../compiler/check.js";
|
|
14
14
|
import { FunScriptError, isFileNotFoundError } from "../errors.js";
|
|
15
|
+
import {
|
|
16
|
+
DEFAULT_TYPE_VIEW_DIR,
|
|
17
|
+
TYPE_VIEW_MANIFEST,
|
|
18
|
+
typeViewManifestSources,
|
|
19
|
+
} from "../compiler/type-view-paths.js";
|
|
20
|
+
import { isFunSourceFile } from "../compiler/modules/source-files.js";
|
|
15
21
|
import { rewriteRelativeImports } from "../plugins/type-view.js";
|
|
16
22
|
|
|
17
23
|
/** Run the project's TypeScript compiler, mapping verified type-view diagnostics. */
|
|
@@ -46,9 +52,9 @@ export async function runTsc(
|
|
|
46
52
|
child.on("close", (code) => resolve({ stdout, stderr, code: code ?? 1 }));
|
|
47
53
|
});
|
|
48
54
|
|
|
49
|
-
const outDir = path.join(cwd,
|
|
55
|
+
const outDir = path.join(cwd, DEFAULT_TYPE_VIEW_DIR);
|
|
50
56
|
const manifest: unknown = await fs
|
|
51
|
-
.readFile(path.join(outDir,
|
|
57
|
+
.readFile(path.join(outDir, TYPE_VIEW_MANIFEST), "utf8")
|
|
52
58
|
.then(
|
|
53
59
|
(text) => {
|
|
54
60
|
try {
|
|
@@ -61,13 +67,9 @@ export async function runTsc(
|
|
|
61
67
|
() => [],
|
|
62
68
|
);
|
|
63
69
|
const views = new Map<string, string>();
|
|
64
|
-
const manifestFiles =
|
|
65
|
-
? manifest
|
|
66
|
-
: manifest && typeof manifest === "object"
|
|
67
|
-
? Object.keys(manifest)
|
|
68
|
-
: [];
|
|
70
|
+
const manifestFiles = typeViewManifestSources(manifest);
|
|
69
71
|
for (const item of manifestFiles) {
|
|
70
|
-
if (typeof item !== "string" ||
|
|
72
|
+
if (typeof item !== "string" || !isFunSourceFile(item)) continue;
|
|
71
73
|
const original = path.resolve(cwd, item);
|
|
72
74
|
const relative = path.relative(cwd, original);
|
|
73
75
|
if (relative.startsWith("..") || path.isAbsolute(relative)) continue;
|
|
@@ -92,8 +92,17 @@ export function validateBooleanOperators(
|
|
|
92
92
|
ts.isNumericLiteral(node.arguments[0]) &&
|
|
93
93
|
ts.isStringLiteral(node.arguments[1])
|
|
94
94
|
) {
|
|
95
|
-
const
|
|
96
|
-
|
|
95
|
+
const operand = node.arguments[2];
|
|
96
|
+
const type = checker.getTypeAtLocation(operand);
|
|
97
|
+
let definitelyBoolean = isDefinitelyBoolean(type);
|
|
98
|
+
if (!definitelyBoolean && ts.isCallExpression(operand)) {
|
|
99
|
+
const signature = checker.getResolvedSignature(operand);
|
|
100
|
+
const predicate = signature
|
|
101
|
+
? checker.getTypePredicateOfSignature(signature)
|
|
102
|
+
: undefined;
|
|
103
|
+
if (predicate) definitelyBoolean = true;
|
|
104
|
+
}
|
|
105
|
+
if (!definitelyBoolean) {
|
|
97
106
|
const operator = node.arguments[1].text;
|
|
98
107
|
const received = checker.typeToString(type);
|
|
99
108
|
throw new FunScriptError(
|