mootant 0.1.0 → 0.3.0
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/bin/mootant.js +3 -2
- package/dist/adapters/jest/build-dry-file.d.ts +12 -12
- package/dist/adapters/jest/collect-jest-dependencies.d.ts +15 -12
- package/dist/adapters/jest/collect-jest-dependencies.js +20 -14
- package/dist/adapters/jest/get-jest-cache-inputs.d.ts +14 -13
- package/dist/adapters/jest/index.d.ts +3 -1
- package/dist/adapters/jest/run-dry.js +20 -20
- package/dist/adapters/jest/runner.d.ts +1 -1
- package/dist/adapters/jest/runner.js +1 -1
- package/dist/adapters/jest/start-jest-session.d.ts +6 -2
- package/dist/adapters/jest/start-jest-session.js +9 -2
- package/dist/adapters/jest/types/jest-handle.d.ts +2 -1
- package/dist/adapters/jest/types/jest-record.d.ts +5 -4
- package/dist/adapters/jest/types/unit-worker.d.ts +16 -8
- package/dist/adapters/jest/types/worker-channel.d.ts +7 -0
- package/dist/adapters/jest/types/worker-session.d.ts +6 -7
- package/dist/adapters/jest/worker/boot-worker.d.ts +5 -3
- package/dist/adapters/jest/worker/create-test-runner.d.ts +4 -1
- package/dist/adapters/jest/worker/keep-reset-loads.d.ts +13 -0
- package/dist/adapters/jest/worker/list-runtime-files.d.ts +13 -0
- package/dist/adapters/jest/worker/run-unit.d.ts +24 -17
- package/dist/adapters/jest/worker/vm-setup.js +1 -1
- package/dist/adapters/jest/worker/worker.js +1 -1
- package/dist/adapters/jest/write-worker-session.d.ts +1 -2
- package/dist/adapters/jest/write-worker-session.js +2 -2
- package/dist/adapters/node-test/check-typescript.js +2 -2
- package/dist/adapters/node-test/collect-node-dependencies.d.ts +7 -5
- package/dist/adapters/node-test/collect-node-dependencies.js +26 -20
- package/dist/adapters/node-test/create-spare-processes.d.ts +26 -0
- package/dist/adapters/node-test/create-spare-processes.js +53 -0
- package/dist/adapters/node-test/filter-exec-argv.d.ts +2 -1
- package/dist/adapters/node-test/filter-exec-argv.js +13 -12
- package/dist/adapters/node-test/get-node-cache-inputs.js +1 -1
- package/dist/adapters/node-test/get-unit-deadline.d.ts +6 -5
- package/dist/adapters/node-test/index.d.ts +2 -2
- package/dist/adapters/node-test/index.js +1 -0
- package/dist/adapters/node-test/is-group-alive.d.ts +8 -0
- package/dist/adapters/node-test/is-group-alive.js +8 -0
- package/dist/adapters/node-test/list-setup-files.js +2 -2
- package/dist/adapters/node-test/place-preload.d.ts +2 -1
- package/dist/adapters/node-test/place-preload.js +24 -18
- package/dist/adapters/node-test/preload/create-commonjs-route.js +1 -1
- package/dist/adapters/node-test/preload/preload.js +54 -49
- package/dist/adapters/node-test/preload/read-line-sync.d.ts +11 -0
- package/dist/adapters/node-test/preload/read-line-sync.js +25 -0
- package/dist/adapters/node-test/preload/read-unit.d.ts +11 -5
- package/dist/adapters/node-test/preload/read-unit.js +5 -4
- package/dist/adapters/node-test/run-isolated.d.ts +19 -10
- package/dist/adapters/node-test/run-isolated.js +68 -52
- package/dist/adapters/node-test/run-test-file.d.ts +12 -4
- package/dist/adapters/node-test/run-test-file.js +19 -14
- package/dist/adapters/node-test/run-test-process.d.ts +30 -13
- package/dist/adapters/node-test/run-test-process.js +38 -40
- package/dist/adapters/node-test/start-node-test-session.d.ts +10 -2
- package/dist/adapters/node-test/start-node-test-session.js +90 -84
- package/dist/adapters/node-test/start-test-process.d.ts +30 -0
- package/dist/adapters/node-test/start-test-process.js +27 -0
- package/dist/adapters/node-test/types/node-test-handle.d.ts +14 -1
- package/dist/adapters/node-test/types/node-test-record.d.ts +3 -3
- package/dist/adapters/node-test/types/node-test-unit.d.ts +6 -1
- package/dist/adapters/node-test/types/process-watch.d.ts +4 -3
- package/dist/adapters/node-test/types/spare-processes.d.ts +20 -0
- package/dist/adapters/node-test/types/test-process-outcome.d.ts +8 -1
- package/dist/adapters/shared/allows-spares.d.ts +11 -0
- package/dist/adapters/shared/allows-spares.js +23 -0
- package/dist/adapters/shared/create-environment-proxy.d.ts +4 -3
- package/dist/adapters/shared/create-input-filter.d.ts +29 -0
- package/dist/adapters/shared/create-input-filter.js +32 -0
- package/dist/adapters/shared/enable-compile-cache.d.ts +32 -0
- package/dist/adapters/shared/enable-compile-cache.js +7 -0
- package/dist/adapters/shared/find-tsconfig-property.d.ts +13 -0
- package/dist/adapters/shared/find-tsconfig-property.js +6 -0
- package/dist/adapters/shared/get-spare-limit.d.ts +10 -0
- package/dist/adapters/shared/get-spare-limit.js +5 -0
- package/dist/adapters/shared/index-environment-hashes.d.ts +2 -2
- package/dist/adapters/shared/index-environment-hashes.js +5 -13
- package/dist/adapters/{node-test → shared}/list-flag-values.d.ts +2 -1
- package/dist/adapters/shared/list-flag-values.js +10 -0
- package/dist/adapters/shared/list-tsconfig-files.d.ts +14 -5
- package/dist/adapters/shared/list-tsconfig-files.js +15 -13
- package/dist/adapters/shared/parse-tsconfig.d.ts +10 -0
- package/dist/adapters/shared/parse-tsconfig.js +19 -0
- package/dist/adapters/shared/read-flag-name.d.ts +9 -0
- package/dist/adapters/shared/read-flag-name.js +5 -0
- package/dist/adapters/shared/read-node-options.d.ts +11 -0
- package/dist/adapters/shared/read-node-options.js +6 -0
- package/dist/adapters/shared/read-prefork-switch.d.ts +10 -0
- package/dist/adapters/shared/read-prefork-switch.js +5 -0
- package/dist/adapters/shared/read-tsconfig-extends.d.ts +2 -5
- package/dist/adapters/shared/read-tsconfig-extends.js +16 -31
- package/dist/adapters/shared/read-tsconfig-references.d.ts +12 -0
- package/dist/adapters/shared/read-tsconfig-references.js +13 -0
- package/dist/adapters/shared/track-file-inputs.d.ts +7 -3
- package/dist/adapters/shared/track-file-inputs.js +16 -7
- package/dist/adapters/shared/track-file-reads.d.ts +13 -8
- package/dist/adapters/shared/track-file-reads.js +122 -69
- package/dist/adapters/shared/track-inputs.d.ts +13 -6
- package/dist/adapters/shared/track-inputs.js +7 -7
- package/dist/adapters/shared/track-process-group.d.ts +2 -1
- package/dist/adapters/shared/track-process-group.js +7 -2
- package/dist/adapters/shared/types/file-input-tracking.d.ts +6 -0
- package/dist/adapters/shared/types/input-tracking.d.ts +3 -3
- package/dist/adapters/vitest/build-isolated-facts.d.ts +4 -3
- package/dist/adapters/vitest/collect-dependencies.d.ts +10 -3
- package/dist/adapters/vitest/collect-dependencies.js +36 -26
- package/dist/adapters/vitest/configure-project.d.ts +3 -2
- package/dist/adapters/vitest/configure-project.js +1 -1
- package/dist/adapters/vitest/create-forks-pool.d.ts +34 -7
- package/dist/adapters/vitest/create-forks-pool.js +102 -24
- package/dist/adapters/vitest/create-interleaved-sequencer.d.ts +3 -2
- package/dist/adapters/vitest/drop-signal-listeners.d.ts +14 -0
- package/dist/adapters/vitest/drop-signal-listeners.js +15 -0
- package/dist/adapters/vitest/get-cache-inputs.d.ts +3 -1
- package/dist/adapters/vitest/get-cache-inputs.js +46 -29
- package/dist/adapters/vitest/get-module-file.d.ts +3 -5
- package/dist/adapters/vitest/get-module-file.js +1 -1
- package/dist/adapters/vitest/get-spare-key.d.ts +15 -0
- package/dist/adapters/vitest/get-spare-key.js +15 -0
- package/dist/adapters/vitest/index.d.ts +2 -1
- package/dist/adapters/vitest/index.js +1 -0
- package/dist/adapters/vitest/is-virtual-module.d.ts +10 -0
- package/dist/adapters/vitest/is-virtual-module.js +8 -0
- package/dist/adapters/vitest/list-script-defines.d.ts +13 -0
- package/dist/adapters/vitest/list-script-defines.js +22 -0
- package/dist/adapters/vitest/read-out-files.d.ts +7 -2
- package/dist/adapters/vitest/read-out-files.js +5 -5
- package/dist/adapters/vitest/read-out-records.d.ts +17 -0
- package/dist/adapters/vitest/read-out-records.js +27 -0
- package/dist/adapters/vitest/read-strays.d.ts +20 -0
- package/dist/adapters/vitest/read-strays.js +53 -0
- package/dist/adapters/vitest/read-unit-inputs.d.ts +9 -2
- package/dist/adapters/vitest/read-unit-inputs.js +1 -1
- package/dist/adapters/vitest/run-dry.js +17 -17
- package/dist/adapters/vitest/run-plan.d.ts +10 -6
- package/dist/adapters/vitest/run-plan.js +16 -16
- package/dist/adapters/vitest/run-specifications.d.ts +11 -3
- package/dist/adapters/vitest/run-specifications.js +22 -12
- package/dist/adapters/vitest/runner.d.ts +92 -46
- package/dist/adapters/vitest/runner.js +126 -104
- package/dist/adapters/vitest/start-vitest-session.d.ts +5 -1
- package/dist/adapters/vitest/start-vitest-session.js +64 -59
- package/dist/adapters/vitest/stop-hung-worker.d.ts +11 -4
- package/dist/adapters/vitest/stop-hung-worker.js +20 -7
- package/dist/adapters/vitest/types/mootant-forks-pool.d.ts +47 -0
- package/dist/adapters/vitest/types/stray-decisions.d.ts +8 -0
- package/dist/adapters/vitest/types/unit-outcome.d.ts +2 -1
- package/dist/adapters/vitest/types/vitest-session-state.d.ts +9 -8
- package/dist/adapters/vitest/types/vitest-worker.d.ts +118 -32
- package/dist/adapters/vitest/wait-for-workers.d.ts +5 -2
- package/dist/adapters/vitest/wait-for-workers.js +15 -15
- package/dist/adapters/vitest/worker/encode-stray.d.ts +16 -0
- package/dist/adapters/vitest/worker/encode-stray.js +16 -0
- package/dist/adapters/vitest/worker/intercept-strays.d.ts +26 -0
- package/dist/adapters/vitest/worker/intercept-strays.js +13 -0
- package/dist/adapters/vitest/worker/read-try-facts.d.ts +5 -4
- package/dist/adapters/vitest/worker/track-meta-defines.d.ts +39 -0
- package/dist/adapters/vitest/worker/track-meta-defines.js +23 -0
- package/dist/adapters/vitest/worker/track-values.d.ts +38 -0
- package/dist/adapters/vitest/worker/track-values.js +45 -0
- package/dist/adapters/vitest/worker/value-prefixes.d.ts +12 -0
- package/dist/adapters/vitest/worker/value-prefixes.js +6 -0
- package/dist/adapters/vitest/worker/wait-for-turn.d.ts +8 -6
- package/dist/adapters/vitest/worker/watch-property.d.ts +17 -0
- package/dist/adapters/vitest/worker/watch-property.js +27 -0
- package/dist/adapters/vitest/worker/write-out-record.d.ts +2 -2
- package/dist/cli/create-run-progress.d.ts +8 -1
- package/dist/cli/create-run-progress.js +4 -1
- package/dist/cli/ensure-exit.d.ts +11 -0
- package/dist/cli/ensure-exit.js +15 -0
- package/dist/cli/html/build-html-report.js +2 -1
- package/dist/cli/html/client/main.js +1 -1
- package/dist/cli/html/client/render-change.d.ts +3 -2
- package/dist/cli/html/client/render-code.d.ts +1 -1
- package/dist/cli/html/client/render-overview.d.ts +3 -3
- package/dist/cli/html/pack-replacement.d.ts +1 -1
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +3 -2
- package/dist/cli/parse-arguments.d.ts +4 -0
- package/dist/cli/parse-arguments.js +4 -1
- package/dist/cli/report/build-list-report.js +1 -1
- package/dist/cli/report/build-run-report.js +2 -1
- package/dist/cli/report/format-command.d.ts +5 -0
- package/dist/cli/report/format-command.js +1 -1
- package/dist/cli/report/format-file-groups.d.ts +1 -1
- package/dist/cli/report/format-run-text-report.d.ts +5 -4
- package/dist/cli/report/format-run-text-report.js +10 -10
- package/dist/cli/report/slim-run-report.d.ts +10 -10
- package/dist/cli/report/slim-run-report.js +1 -0
- package/dist/cli/run-mutation.d.ts +5 -1
- package/dist/cli/run-mutation.js +55 -47
- package/dist/cli/terminal/create-spinner.d.ts +2 -3
- package/dist/cli/terminal/create-spinner.js +23 -32
- package/dist/cli/terminal/get-text-style.js +4 -4
- package/dist/cli/watch-interrupts.d.ts +41 -0
- package/dist/cli/watch-interrupts.js +32 -0
- package/dist/core/cache/apply-cached-units.d.ts +8 -7
- package/dist/core/cache/build-hash.d.ts +9 -0
- package/dist/core/cache/build-hash.js +2 -0
- package/dist/core/cache/cache-version.d.ts +4 -4
- package/dist/core/cache/check-dry-snapshot.d.ts +25 -0
- package/dist/core/cache/check-dry-snapshot.js +13 -0
- package/dist/core/cache/create-dry-reuse-miss.d.ts +12 -0
- package/dist/core/cache/create-dry-reuse-miss.js +7 -0
- package/dist/core/cache/create-dry-snapshot.d.ts +71 -0
- package/dist/core/cache/create-dry-snapshot.js +27 -0
- package/dist/core/cache/create-run-cache.d.ts +20 -2
- package/dist/core/cache/create-run-cache.js +31 -22
- package/dist/core/cache/create-snapshot-session.d.ts +12 -0
- package/dist/core/cache/create-snapshot-session.js +19 -0
- package/dist/core/cache/get-build-id.d.ts +11 -0
- package/dist/core/cache/get-build-id.js +7 -0
- package/dist/core/cache/get-cache-path.d.ts +1 -1
- package/dist/core/cache/get-cache-path.js +1 -1
- package/dist/core/cache/get-dry-snapshot-key.d.ts +47 -0
- package/dist/core/cache/get-dry-snapshot-key.js +43 -0
- package/dist/core/cache/get-dry-snapshot-path.d.ts +9 -0
- package/dist/core/cache/get-dry-snapshot-path.js +5 -0
- package/dist/core/cache/get-environment-key.d.ts +9 -4
- package/dist/core/cache/get-environment-key.js +5 -4
- package/dist/core/cache/get-test-file-keys.d.ts +2 -1
- package/dist/core/cache/get-test-file-keys.js +11 -10
- package/dist/core/cache/hash-files.d.ts +11 -6
- package/dist/core/cache/hash-files.js +22 -17
- package/dist/core/cache/hash-project-tree.d.ts +22 -0
- package/dist/core/cache/hash-project-tree.js +69 -0
- package/dist/core/cache/is-dry-reuse-miss.d.ts +8 -0
- package/dist/core/cache/is-dry-reuse-miss.js +4 -0
- package/dist/core/cache/list-file-hashes.d.ts +4 -0
- package/dist/core/cache/list-file-hashes.js +5 -2
- package/dist/core/cache/list-install-states.d.ts +12 -0
- package/dist/core/cache/list-install-states.js +19 -0
- package/dist/core/cache/list-variable-hashes.d.ts +15 -0
- package/dist/core/cache/list-variable-hashes.js +14 -0
- package/dist/core/cache/prepare-run-cache.d.ts +64 -16
- package/dist/core/cache/prepare-run-cache.js +109 -62
- package/dist/core/cache/read-dry-snapshot.d.ts +10 -0
- package/dist/core/cache/read-dry-snapshot.js +15 -0
- package/dist/core/cache/read-run-cache.js +6 -2
- package/dist/core/cache/save-dry-snapshot.d.ts +34 -0
- package/dist/core/cache/save-dry-snapshot.js +32 -0
- package/dist/core/cache/save-run-cache.d.ts +8 -7
- package/dist/core/cache/save-run-cache.js +2 -1
- package/dist/core/cache/unknown-hash.d.ts +7 -0
- package/dist/core/cache/unknown-hash.js +2 -0
- package/dist/core/cache/volatile-variables.d.ts +7 -0
- package/dist/core/cache/volatile-variables.js +11 -0
- package/dist/core/cache/write-run-cache.js +1 -1
- package/dist/core/config/load-typescript-config.d.ts +6 -1
- package/dist/core/config/load-typescript-config.js +26 -10
- package/dist/core/config/prepare-run.d.ts +7 -3
- package/dist/core/config/prepare-run.js +1 -0
- package/dist/core/config/resolve-run-settings.d.ts +3 -2
- package/dist/core/config/resolve-run-settings.js +1 -0
- package/dist/core/config/validate-config.js +3 -2
- package/dist/core/files/get-package-manifest.d.ts +12 -0
- package/dist/core/files/get-package-manifest.js +7 -0
- package/dist/core/files/select-changed-mutants.d.ts +11 -6
- package/dist/core/files/select-changed-mutants.js +38 -13
- package/dist/core/generate/apply-solitary-rule.d.ts +8 -5
- package/dist/core/generate/apply-solitary-rule.js +36 -29
- package/dist/core/generate/collect-candidates.d.ts +23 -5
- package/dist/core/generate/collect-candidates.js +202 -92
- package/dist/core/generate/compare-targets.d.ts +14 -0
- package/dist/core/generate/compare-targets.js +6 -0
- package/dist/core/generate/deduplicate-candidates.d.ts +6 -4
- package/dist/core/generate/deduplicate-candidates.js +11 -9
- package/dist/core/generate/find-list-removal.d.ts +20 -0
- package/dist/core/generate/find-list-removal.js +26 -0
- package/dist/core/generate/generate-file-mutants.js +49 -47
- package/dist/core/generate/get-mutant-site.d.ts +18 -0
- package/dist/core/generate/get-mutant-site.js +4 -0
- package/dist/core/generate/get-target.d.ts +14 -0
- package/dist/core/generate/get-target.js +4 -0
- package/dist/core/generate/pick-host.d.ts +10 -0
- package/dist/core/generate/pick-host.js +16 -0
- package/dist/core/generate/validate-replacement.d.ts +15 -4
- package/dist/core/generate/validate-replacement.js +28 -13
- package/dist/core/ignore/find-ignore-rule.d.ts +8 -7
- package/dist/core/index.d.ts +18 -0
- package/dist/core/instrument/find-attribute-values.d.ts +12 -0
- package/dist/core/instrument/find-attribute-values.js +13 -0
- package/dist/core/instrument/get-site-syntax.d.ts +14 -0
- package/dist/core/instrument/get-site-syntax.js +12 -0
- package/dist/core/instrument/group-mutant-ranges.d.ts +7 -3
- package/dist/core/instrument/group-mutant-ranges.js +25 -19
- package/dist/core/instrument/instrument-file.d.ts +5 -3
- package/dist/core/instrument/instrument-file.js +10 -9
- package/dist/core/instrument/instrumenter-version.d.ts +1 -1
- package/dist/core/instrument/render-branch.d.ts +17 -0
- package/dist/core/instrument/render-branch.js +81 -0
- package/dist/core/instrument/render-mutant-range.d.ts +17 -6
- package/dist/core/instrument/render-mutant-range.js +39 -13
- package/dist/core/list-mutants.d.ts +7 -5
- package/dist/core/list-mutants.js +2 -2
- package/dist/core/mutators/array-element.d.ts +7 -6
- package/dist/core/mutators/array-element.js +13 -13
- package/dist/core/mutators/assignment-operator.js +34 -33
- package/dist/core/mutators/boolean-literal.d.ts +3 -2
- package/dist/core/mutators/number-literal.d.ts +1 -1
- package/dist/core/mutators/object-property.d.ts +4 -3
- package/dist/core/mutators/object-property.js +7 -8
- package/dist/core/mutators/return-value.js +65 -33
- package/dist/core/mutators/shared/get-branch-copy-skip.d.ts +14 -9
- package/dist/core/mutators/shared/get-branch-copy-skip.js +34 -35
- package/dist/core/mutators/shared/get-canonical-falsy-default.d.ts +32 -0
- package/dist/core/mutators/shared/get-canonical-falsy-default.js +11 -0
- package/dist/core/mutators/shared/get-comparison-plan.d.ts +2 -2
- package/dist/core/mutators/shared/get-comparison-plan.js +86 -85
- package/dist/core/mutators/shared/get-condition-constants.d.ts +8 -8
- package/dist/core/mutators/shared/get-condition-constants.js +3 -3
- package/dist/core/mutators/shared/get-default-option-skip.d.ts +2 -2
- package/dist/core/mutators/shared/get-endless-value.d.ts +20 -0
- package/dist/core/mutators/shared/get-endless-value.js +25 -0
- package/dist/core/mutators/shared/get-forced-test-justifier.d.ts +44 -0
- package/dist/core/mutators/shared/get-forced-test-justifier.js +25 -0
- package/dist/core/mutators/shared/get-group-constant.d.ts +6 -6
- package/dist/core/mutators/shared/get-group-constant.js +2 -2
- package/dist/core/mutators/shared/get-literal-skip.d.ts +9 -9
- package/dist/core/mutators/shared/get-literal-skip.js +2 -2
- package/dist/core/mutators/shared/get-logical-drops.d.ts +8 -8
- package/dist/core/mutators/shared/get-logical-drops.js +80 -82
- package/dist/core/mutators/shared/get-loop-running-skip.d.ts +2 -2
- package/dist/core/mutators/shared/get-nullish-swap-skip.d.ts +2 -2
- package/dist/core/mutators/shared/get-or-default-skip.d.ts +2 -2
- package/dist/core/mutators/shared/get-owned-constants.d.ts +2 -2
- package/dist/core/mutators/shared/get-owner-constant.d.ts +3 -1
- package/dist/core/mutators/shared/get-running-value.d.ts +5 -4
- package/dist/core/mutators/shared/get-toward-mutant.d.ts +10 -2
- package/dist/core/mutators/shared/get-toward-mutant.js +45 -40
- package/dist/core/mutators/shared/has-other-exit.js +16 -36
- package/dist/core/mutators/shared/is-loop-exit.d.ts +20 -0
- package/dist/core/mutators/shared/is-loop-exit.js +32 -0
- package/dist/core/mutators/shared/is-read-only.d.ts +26 -0
- package/dist/core/mutators/shared/is-read-only.js +53 -0
- package/dist/core/mutators/shared/leave-now-skip.d.ts +2 -2
- package/dist/core/mutators/shared/no-op-callback-skip.d.ts +2 -2
- package/dist/core/mutators/statement-removal.d.ts +4 -3
- package/dist/core/mutators/statement-removal.js +69 -73
- package/dist/core/mutators/string-literal.d.ts +15 -5
- package/dist/core/mutators/string-literal.js +79 -50
- package/dist/core/plugins/create-mutator-registry.d.ts +4 -2
- package/dist/core/plugins/create-mutator-registry.js +15 -5
- package/dist/core/plugins/validate-plugin.d.ts +3 -3
- package/dist/core/plugins/validate-plugin.js +32 -10
- package/dist/core/presets/recommended.d.ts +2 -2
- package/dist/core/presets/strict.d.ts +4 -2
- package/dist/core/regex/collect-pattern-changes.d.ts +2 -2
- package/dist/core/regex/create-regex-replacement.d.ts +2 -2
- package/dist/core/run/apply-batch-result.d.ts +23 -22
- package/dist/core/run/apply-batch-result.js +5 -5
- package/dist/core/run/apply-isolated-result.d.ts +21 -12
- package/dist/core/run/apply-isolated-result.js +45 -25
- package/dist/core/run/classify-try.d.ts +9 -8
- package/dist/core/run/count-run.d.ts +2 -1
- package/dist/core/run/create-run-state.d.ts +5 -0
- package/dist/core/run/create-run-state.js +1 -0
- package/dist/core/run/create-work-directory.d.ts +4 -1
- package/dist/core/run/create-work-directory.js +15 -12
- package/dist/core/run/decide-evidence.d.ts +4 -3
- package/dist/core/run/get-test-file-limits.d.ts +13 -0
- package/dist/core/run/get-test-file-limits.js +13 -0
- package/dist/core/run/get-unit-evidence.d.ts +12 -3
- package/dist/core/run/get-unit-evidence.js +1 -1
- package/dist/core/run/guard-session.d.ts +18 -0
- package/dist/core/run/guard-session.js +30 -0
- package/dist/core/run/live-work-directories.d.ts +5 -0
- package/dist/core/run/live-work-directories.js +2 -0
- package/dist/core/run/plan-batch.d.ts +6 -3
- package/dist/core/run/plan-batch.js +36 -31
- package/dist/core/run/plan-isolated.d.ts +3 -1
- package/dist/core/run/plan-isolated.js +8 -14
- package/dist/core/run/read-isolated-unit.d.ts +9 -6
- package/dist/core/run/read-isolated-unit.js +77 -38
- package/dist/core/run/remove-live-work-directories.d.ts +7 -0
- package/dist/core/run/remove-live-work-directories.js +12 -0
- package/dist/core/run/run-batch-phases.d.ts +4 -3
- package/dist/core/run/run-dry-phase.d.ts +35 -19
- package/dist/core/run/run-dry-phase.js +127 -77
- package/dist/core/run/run-isolated-rounds.d.ts +15 -10
- package/dist/core/run/run-isolated-rounds.js +4 -2
- package/dist/core/run/validate-adapter.d.ts +1 -1
- package/dist/core/run/validate-adapter.js +1 -1
- package/dist/core/run-mutants.d.ts +59 -22
- package/dist/core/run-mutants.js +356 -208
- package/dist/core/runtime/create-hit-limit-error.d.ts +5 -3
- package/dist/core/runtime/create-hit-limit-error.js +1 -1
- package/dist/core/runtime/install-mutant-runtime.js +23 -6
- package/dist/core/runtime/runtime-version.d.ts +4 -4
- package/dist/core/skips/skip-rules.d.ts +7 -1
- package/dist/core/skips/skip-rules.js +4 -0
- package/dist/core/syntax/is-brace-sensitive-attribute.d.ts +18 -0
- package/dist/core/syntax/is-brace-sensitive-attribute.js +28 -0
- package/dist/core/syntax/is-spread-safe-member.d.ts +18 -0
- package/dist/core/syntax/is-spread-safe-member.js +18 -0
- package/dist/core/syntax/is-value-position.d.ts +3 -1
- package/dist/core/text/get-list-removal-range.d.ts +22 -0
- package/dist/core/text/get-list-removal-range.js +46 -0
- package/dist/core/text/is-plain-attribute-string.d.ts +10 -0
- package/dist/core/text/is-plain-attribute-string.js +5 -0
- package/dist/core/text/parse-expression.d.ts +8 -4
- package/dist/core/text/parse-expression.js +1 -0
- package/dist/core/text/remove-list-element.d.ts +2 -4
- package/dist/core/text/remove-list-element.js +4 -45
- package/dist/docs/styles/colors.js +1 -1
- package/dist/package.js +1 -1
- package/dist/types/adapter/adapter-context.d.ts +20 -0
- package/dist/types/adapter/adapter-session.d.ts +2 -1
- package/dist/types/adapter/cache-inputs.d.ts +3 -2
- package/dist/types/adapter/dry-file.d.ts +6 -3
- package/dist/types/adapter/dry-run-request.d.ts +5 -4
- package/dist/types/adapter/isolated-plan.d.ts +2 -1
- package/dist/types/adapter/isolated-result.d.ts +3 -1
- package/dist/types/adapter/mutant-runtime.d.ts +30 -1
- package/dist/types/adapter/run-inputs.d.ts +5 -4
- package/dist/types/adapter/test-adapter.d.ts +7 -0
- package/dist/types/cache/cache-entry.d.ts +9 -7
- package/dist/types/cache/cached-inputs.d.ts +2 -2
- package/dist/types/cache/dry-snapshot.d.ts +76 -0
- package/dist/types/cache/project-tree.d.ts +16 -0
- package/dist/types/cache/run-cache-file.d.ts +1 -1
- package/dist/types/cache/run-cache.d.ts +6 -5
- package/dist/types/cli/text-style.d.ts +1 -1
- package/dist/types/config/plugin.d.ts +11 -2
- package/dist/types/config/preset-settings.d.ts +2 -2
- package/dist/types/config/run-config.d.ts +22 -4
- package/dist/types/config/run-settings.d.ts +6 -0
- package/dist/types/html/indexed-mutant.d.ts +4 -2
- package/dist/types/html/shown-change.d.ts +4 -3
- package/dist/types/mutant/core-note.d.ts +12 -0
- package/dist/types/mutant/diagnostic.d.ts +1 -0
- package/dist/types/mutant/list-removal.d.ts +37 -0
- package/dist/types/mutant/mutant-candidate.d.ts +11 -17
- package/dist/types/mutant/mutant-host.d.ts +49 -0
- package/dist/types/mutant/mutant-kind.d.ts +18 -0
- package/dist/types/mutant/mutant-range.d.ts +15 -8
- package/dist/types/mutant/mutant.d.ts +9 -15
- package/dist/types/mutant/registered-skip-rule.d.ts +11 -0
- package/dist/types/mutant/site-syntax.d.ts +14 -0
- package/dist/types/mutant/skip-justifier.d.ts +3 -1
- package/dist/types/mutant/skip-note.d.ts +7 -6
- package/dist/types/mutant/skip-rule-id.d.ts +3 -2
- package/dist/types/mutant/skip-rule.d.ts +2 -1
- package/dist/types/mutant/skipped-candidate.d.ts +27 -17
- package/dist/types/mutant/skipped-mutant.d.ts +15 -12
- package/dist/types/mutator/mutator.d.ts +3 -2
- package/dist/types/mutator/registered-mutator.d.ts +8 -0
- package/dist/types/mutator/replacement.d.ts +14 -3
- package/dist/types/regex/regex-change.d.ts +2 -2
- package/dist/types/report/html-report.d.ts +13 -9
- package/dist/types/report/list-report-focus.d.ts +3 -2
- package/dist/types/report/list-report-justifier.d.ts +4 -2
- package/dist/types/report/list-report-mutant.d.ts +15 -9
- package/dist/types/report/list-report-skipped.d.ts +6 -4
- package/dist/types/report/list-report.d.ts +1 -1
- package/dist/types/report/run-report.d.ts +13 -4
- package/dist/types/report/slim-list-report.d.ts +6 -3
- package/dist/types/report/slim-run-report.d.ts +2 -2
- package/dist/types/run/isolated-evidence.d.ts +3 -2
- package/dist/types/run/isolated-reason.d.ts +6 -4
- package/dist/types/run/mutant-state.d.ts +1 -1
- package/dist/types/run/run-durations.d.ts +8 -3
- package/dist/types/run/run-event.d.ts +11 -8
- package/dist/types/run/run-kind.d.ts +3 -2
- package/dist/types/run/run-result.d.ts +17 -5
- package/dist/types/run/run-state.d.ts +30 -1
- package/dist/types/run/run-status.d.ts +2 -2
- package/dist/types/run/try-cause.d.ts +10 -7
- package/dist/types/syntax/syntax-helpers.d.ts +5 -3
- package/package.json +5 -5
- package/readme.md +85 -68
- package/skills/mootant/SKILL.md +50 -31
- package/skills/mootant/references/mutators.md +31 -23
- package/dist/adapters/node-test/list-flag-values.js +0 -9
- package/dist/core/instrument/get-site-check.d.ts +0 -9
- package/dist/core/instrument/get-site-check.js +0 -5
- package/dist/core/instrument/get-template-site-check.d.ts +0 -12
- package/dist/core/instrument/get-template-site-check.js +0 -5
- /package/dist/adapters/{node-test → shared}/loader-flags.d.ts +0 -0
- /package/dist/adapters/{node-test → shared}/loader-flags.js +0 -0
- /package/dist/cli/{built-in-adapters.d.ts → get-built-in-adapters.d.ts} +0 -0
- /package/dist/cli/{built-in-adapters.js → get-built-in-adapters.js} +0 -0
- /package/dist/cli/terminal/{colors.d.ts → create-colors.d.ts} +0 -0
- /package/dist/cli/terminal/{colors.js → create-colors.js} +0 -0
- /package/dist/{adapters/shared → core/files}/list-package-files.d.ts +0 -0
- /package/dist/{adapters/shared → core/files}/list-package-files.js +0 -0
- /package/dist/{adapters/shared → core/files}/read-package-type.d.ts +0 -0
- /package/dist/{adapters/shared → core/files}/read-package-type.js +0 -0
|
@@ -10,13 +10,14 @@ export interface ProcessWatch {
|
|
|
10
10
|
records: NodeTestRecord[]
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* Epoch milliseconds when the process was started
|
|
13
|
+
* Epoch milliseconds when the process was started, or got its unit as a
|
|
14
|
+
* spare.
|
|
14
15
|
*/
|
|
15
16
|
spawned: number
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
|
-
* Epoch milliseconds when the last record arrived, or
|
|
19
|
-
*
|
|
19
|
+
* Epoch milliseconds when the last record arrived, or `spawned` before any
|
|
20
|
+
* did.
|
|
20
21
|
*/
|
|
21
22
|
last: number
|
|
22
23
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ChildProcess } from 'node:child_process';
|
|
2
|
+
/**
|
|
3
|
+
* Spare test processes of a run (`createSpareProcesses`).
|
|
4
|
+
*/
|
|
5
|
+
export interface SpareProcesses {
|
|
6
|
+
/**
|
|
7
|
+
* Gives a spare of its test file to a job that starts, if one is alive and
|
|
8
|
+
* the job may take one, and starts the spares the next jobs need.
|
|
9
|
+
*
|
|
10
|
+
* @param index - Position of the job in the order given.
|
|
11
|
+
* @param fresh - Whether the job must start a new process.
|
|
12
|
+
* @returns The spare, or null to start a new process.
|
|
13
|
+
*/
|
|
14
|
+
take(index: number, fresh: boolean): ChildProcess | null
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Stops the spares no job took.
|
|
18
|
+
*/
|
|
19
|
+
stop(): void
|
|
20
|
+
}
|
|
@@ -20,7 +20,14 @@ export interface TestProcessOutcome {
|
|
|
20
20
|
code: number | null
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* Whether a process of its group outlived it, or the watchdog stopped it:
|
|
24
|
+
* either way what that group held, such as a port, may stay taken for a
|
|
25
|
+
* moment after the group was stopped.
|
|
26
|
+
*/
|
|
27
|
+
lingering: boolean
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Epoch milliseconds when it was started, or got its unit as a spare.
|
|
24
31
|
*/
|
|
25
32
|
spawned: number
|
|
26
33
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tells whether Node flags let a test process start before its unit, as a
|
|
3
|
+
* spare: none of them takes flags or code from a file before the modules of the
|
|
4
|
+
* command line, which mootant cannot see, and none makes an idle process listen
|
|
5
|
+
* for a debugger, write a profile or spend its time limit. Names are read as
|
|
6
|
+
* Node's option parser reads them (`readFlagName`).
|
|
7
|
+
*
|
|
8
|
+
* @param flags - Node flags of the process, those of `NODE_OPTIONS` too.
|
|
9
|
+
* @returns Whether the process may start as a spare.
|
|
10
|
+
*/
|
|
11
|
+
export declare function allowsSpares(flags: readonly string[]): boolean;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { readFlagName as e } from "./read-flag-name.js";
|
|
2
|
+
const t = /* @__PURE__ */ new Set([
|
|
3
|
+
"--experimental-default-config-file",
|
|
4
|
+
"--experimental-config-file",
|
|
5
|
+
"--env-file-if-exists",
|
|
6
|
+
"--snapshot-blob",
|
|
7
|
+
"--config-file",
|
|
8
|
+
"--env-file"
|
|
9
|
+
]), n = [
|
|
10
|
+
"--process-timeout",
|
|
11
|
+
"--diagnostic-dir",
|
|
12
|
+
"--heap-prof",
|
|
13
|
+
"--cpu-prof",
|
|
14
|
+
"--inspect",
|
|
15
|
+
"--prof"
|
|
16
|
+
];
|
|
17
|
+
function r(r) {
|
|
18
|
+
return r.every((r) => {
|
|
19
|
+
let i = e(r);
|
|
20
|
+
return !t.has(i) && n.every((e) => !i.startsWith(e));
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
export { r as allowsSpares };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { EnvironmentProxyState } from './types/environment-proxy-state.js';
|
|
2
2
|
/**
|
|
3
|
-
* Wraps an object of environment variables
|
|
4
|
-
* receiver of the state the names read and
|
|
5
|
-
* of the state are read at every trap,
|
|
3
|
+
* Wraps an object of environment variables, or of other values code reads by
|
|
4
|
+
* name, in a proxy that reports to the receiver of the state the names read and
|
|
5
|
+
* `*` when they are listed. The fields of the state are read at every trap,
|
|
6
|
+
* since their owner replaces them later.
|
|
6
7
|
*
|
|
7
8
|
* @param target - Object to wrap.
|
|
8
9
|
* @param state - Tracking state; `listing` is written here too.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Makes the filter that tells which paths test code reads count as inputs of
|
|
3
|
+
* its verdicts. A path counts wherever it is, outside the project root, in the
|
|
4
|
+
* temporary directory and in `node_modules` too, but not when it is a
|
|
5
|
+
* `node_modules` directory itself, whose names an install changes as the files
|
|
6
|
+
* that tell what was installed show, when it lies in a `node_modules/.cache`
|
|
7
|
+
* directory, where tools keep the caches they write as they run, mootant's own
|
|
8
|
+
* among them, when it lies in mootant's work directory, when it is a directory
|
|
9
|
+
* that holds the root, as tools look through those on their way up to their
|
|
10
|
+
* configuration while their names change with whatever lies beside the project,
|
|
11
|
+
* or when it lies in the cache tsx keeps in the temporary directory, `tsx-<user
|
|
12
|
+
* id>` and the `tsx` of older versions, which follows the sources and the
|
|
13
|
+
* `tsconfig` files that count while any process that compiles something new
|
|
14
|
+
* changes it. What the code wrote or made itself is left to `trackFileInputs`.
|
|
15
|
+
* The directories are taken now, before test code runs, as given and by their
|
|
16
|
+
* real paths, and those that hold the root also in the other form of the
|
|
17
|
+
* temporary directory when the root lies in it, so a test that changes `TMPDIR`
|
|
18
|
+
* or replaces a function of `node:path` changes nothing; a call of the filter
|
|
19
|
+
* compares strings only.
|
|
20
|
+
*
|
|
21
|
+
* @param places - Where the run is.
|
|
22
|
+
* @param places.directory - Work directory of the run.
|
|
23
|
+
* @param places.root - Project root.
|
|
24
|
+
* @returns Whether an absolute path that was read counts.
|
|
25
|
+
*/
|
|
26
|
+
export declare function createInputFilter(places: {
|
|
27
|
+
directory: string;
|
|
28
|
+
root: string;
|
|
29
|
+
}): (file: string) => boolean;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { realpathSync as e } from "node:fs";
|
|
2
|
+
import t from "node:path";
|
|
3
|
+
import { tmpdir as n, userInfo as r } from "node:os";
|
|
4
|
+
let { sep: i } = t;
|
|
5
|
+
function a(e) {
|
|
6
|
+
let { root: a } = e, u = l(t.resolve(n())), d = c(l(e.directory)), { geteuid: f } = process, p = f === void 0 ? r().username : f(), m = c(u.flatMap((e) => [t.join(e, `tsx-${p}`), t.join(e, "tsx")])), h = new Set(o(a, u).flatMap((e) => [...s(e)])), g = `${i}node_modules`, _ = `${g}${i}.cache`;
|
|
7
|
+
return (e) => !e.endsWith(g) && !e.endsWith(_) && !e.includes(`${_}${i}`) && !h.has(e) && !d(e) && !m(e);
|
|
8
|
+
}
|
|
9
|
+
function o(e, t) {
|
|
10
|
+
let n = l(e), r = n.flatMap((e) => {
|
|
11
|
+
let n = t.find((t) => c([t])(e));
|
|
12
|
+
return n === void 0 ? [] : t.map((t) => `${t}${e.slice(n.length)}`);
|
|
13
|
+
});
|
|
14
|
+
return [.../* @__PURE__ */ new Set([...n, ...r])];
|
|
15
|
+
}
|
|
16
|
+
function s(e) {
|
|
17
|
+
let n = /* @__PURE__ */ new Set(), r = e, i = t.dirname(r);
|
|
18
|
+
for (; i !== r;) n.add(i), r = i, i = t.dirname(r);
|
|
19
|
+
return n;
|
|
20
|
+
}
|
|
21
|
+
function c(e) {
|
|
22
|
+
let t = e.map((e) => `${e}${i}`);
|
|
23
|
+
return (n) => e.includes(n) || t.some((e) => n.startsWith(e));
|
|
24
|
+
}
|
|
25
|
+
function l(t) {
|
|
26
|
+
try {
|
|
27
|
+
return [t, e(t)];
|
|
28
|
+
} catch {
|
|
29
|
+
return [t];
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export { a as createInputFilter };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function of `node:module` that turns the compile cache on, which older Node
|
|
3
|
+
* versions lack.
|
|
4
|
+
*/
|
|
5
|
+
interface CompileCacheApi {
|
|
6
|
+
/**
|
|
7
|
+
* Turns the compile cache of the process on (Node 22.8 and later).
|
|
8
|
+
*/
|
|
9
|
+
enableCompileCache?(directory: string): unknown;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Turns on Node's compile cache of a test process, in the `compile-cache`
|
|
13
|
+
* folder of the work directory, so the process takes the code V8 compiled for a
|
|
14
|
+
* module in an earlier process of the run instead of compiling it again. It
|
|
15
|
+
* covers what Node's own loaders compile, not code run through `vm`, such as
|
|
16
|
+
* the modules Vite's module runner evaluates. Node keeps an entry per path and
|
|
17
|
+
* compiles a text again when its size or hash differs, so a switched text never
|
|
18
|
+
* runs the code of the original, and the other way round. It holds for this
|
|
19
|
+
* process only: no variable or flag changes, so the processes the tests start
|
|
20
|
+
* compile as before. `NODE_DISABLE_COMPILE_CACHE=1` turns it off, and a
|
|
21
|
+
* `NODE_COMPILE_CACHE` the process has stays in use. Node 26 reads
|
|
22
|
+
* `NODE_COMPILE_CACHE_PORTABLE` and `NODE_COMPILE_CACHE_READONLY` through
|
|
23
|
+
* `process.env` here, so a test process turns the cache on before it tracks
|
|
24
|
+
* what the code reads. The folder goes with the work directory. Without the
|
|
25
|
+
* function, as on Node 20 and before 22.8, or when Node cannot turn the cache
|
|
26
|
+
* on, the process compiles as before: the cache only saves time.
|
|
27
|
+
*
|
|
28
|
+
* @param api - `node:module`.
|
|
29
|
+
* @param directory - Work directory of the run.
|
|
30
|
+
*/
|
|
31
|
+
export declare function enableCompileCache(api: CompileCacheApi, directory: string): void;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SpreadElement, Expression } from 'oxc-parser';
|
|
2
|
+
/**
|
|
3
|
+
* Finds a property of an object of a `tsconfig.json` file by its name, given as
|
|
4
|
+
* a string or an identifier: the last one, as TypeScript keeps the last of
|
|
5
|
+
* duplicate keys. Computed keys and spread elements do not count.
|
|
6
|
+
*
|
|
7
|
+
* @param node - Node of the file, which has properties only when it is an
|
|
8
|
+
* object.
|
|
9
|
+
* @param name - Key to look for, such as `references`.
|
|
10
|
+
* @returns Value of the property, or null when the node is no object or has no
|
|
11
|
+
* such property.
|
|
12
|
+
*/
|
|
13
|
+
export declare function findTsconfigProperty(node: SpreadElement | Expression | null, name: string): Expression | null;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
function e(e, t) {
|
|
2
|
+
if (e?.type !== "ObjectExpression") return null;
|
|
3
|
+
let n = e.properties.findLast((e) => e.type === "Property" && !e.computed && (e.key.type === "Literal" && e.key.value === t || e.key.type === "Identifier" && e.key.name === t));
|
|
4
|
+
return n?.type === "Property" ? n.value : null;
|
|
5
|
+
}
|
|
6
|
+
export { e as findTsconfigProperty };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gives the most spare test processes alive at once: as many as the CPU cores
|
|
3
|
+
* that the processes which run units leave free, so starting spares slows the
|
|
4
|
+
* units little, but at least one, and no more than the processes which run
|
|
5
|
+
* units.
|
|
6
|
+
*
|
|
7
|
+
* @param workers - Most processes that run units at once.
|
|
8
|
+
* @returns Most spare processes at once.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getSpareLimit(workers: number): number;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Indexes the hashes of the environment variables of a test runner for the
|
|
3
3
|
* cache: the hash of each variable by name, and under `*` a hash of all of them
|
|
4
|
-
* but those that change from one shell to another and
|
|
5
|
-
* sets itself.
|
|
4
|
+
* but those that change from one shell to another (`VOLATILE_VARIABLES`) and
|
|
5
|
+
* those the test runner sets itself.
|
|
6
6
|
*
|
|
7
7
|
* @param hashes - Hash of the value of each variable, with its name, in any
|
|
8
8
|
* order.
|
|
@@ -1,19 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
"ITERM_SESSION_ID",
|
|
5
|
-
"TERM_SESSION_ID",
|
|
6
|
-
"WINDOWID",
|
|
7
|
-
"OLDPWD",
|
|
8
|
-
"SHLVL",
|
|
9
|
-
"PWD",
|
|
10
|
-
"_"
|
|
11
|
-
]);
|
|
1
|
+
import { VOLATILE_VARIABLES as e } from "../../core/cache/volatile-variables.js";
|
|
2
|
+
import { compareCodeUnits as t } from "../../core/compare-code-units.js";
|
|
3
|
+
import { createDigest as n } from "../../core/cache/create-digest.js";
|
|
12
4
|
function r(r, i) {
|
|
13
|
-
let a = r.toSorted(([
|
|
5
|
+
let a = r.toSorted(([e], [n]) => t(e, n));
|
|
14
6
|
return {
|
|
15
7
|
...Object.fromEntries(a),
|
|
16
|
-
"*":
|
|
8
|
+
"*": n(a.filter(([t]) => !e.has(t) && !i.includes(t)))
|
|
17
9
|
};
|
|
18
10
|
}
|
|
19
11
|
export { r as indexEnvironmentHashes };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Lists the values Node flags give to the given flags, as the next word or
|
|
3
3
|
* after `=`, in order; such a flag that is the last word and has no `=` gives
|
|
4
|
-
* none.
|
|
4
|
+
* none. Names are read as Node's option parser reads them (`readFlagName`), so
|
|
5
|
+
* `--experimental_loader` gives its value to `--experimental-loader`.
|
|
5
6
|
*
|
|
6
7
|
* @param execArgv - Node flags.
|
|
7
8
|
* @param flags - Flags whose values to list.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { readFlagName as e } from "./read-flag-name.js";
|
|
2
|
+
function t(t, n) {
|
|
3
|
+
let r = [];
|
|
4
|
+
for (let [i, a] of t.entries()) {
|
|
5
|
+
let [o, ...s] = a.split("=");
|
|
6
|
+
n.has(e(o)) && (s.length > 0 ? r.push(s.join("=")) : i + 1 < t.length && r.push(t[i + 1]));
|
|
7
|
+
}
|
|
8
|
+
return r;
|
|
9
|
+
}
|
|
10
|
+
export { t as listFlagValues };
|
|
@@ -2,11 +2,20 @@
|
|
|
2
2
|
* Lists the `tsconfig.json` files that may decide how a loader, such as Vite or
|
|
3
3
|
* tsx, transforms the files of a directory: the path of a `tsconfig.json` in
|
|
4
4
|
* the directory and in every directory above it up to the first that has one,
|
|
5
|
-
* so creating a closer one changes the list
|
|
6
|
-
*
|
|
5
|
+
* so creating a closer one changes the list; with `references`, every file the
|
|
6
|
+
* found one references, as Vite takes the options of a referenced file that
|
|
7
|
+
* includes the module, and the files those reference in turn, which Vue's
|
|
8
|
+
* compiler reads to resolve types; and every file any of them extends, through
|
|
9
|
+
* the whole chain.
|
|
7
10
|
*
|
|
8
11
|
* @param directory - Absolute path of the directory.
|
|
9
|
-
* @param cache - Lists found before, by directory
|
|
10
|
-
*
|
|
12
|
+
* @param cache - Lists found before, by directory, with the same options;
|
|
13
|
+
* filled here.
|
|
14
|
+
* @param options - What to follow.
|
|
15
|
+
* @param options.references - Whether to follow `references`, which tsx never
|
|
16
|
+
* reads; off when omitted.
|
|
17
|
+
* @returns Absolute paths, each once, missing files included.
|
|
11
18
|
*/
|
|
12
|
-
export declare function listTsconfigFiles(directory: string, cache: Map<string, string[]
|
|
19
|
+
export declare function listTsconfigFiles(directory: string, cache: Map<string, string[]>, options?: {
|
|
20
|
+
references?: boolean;
|
|
21
|
+
}): string[];
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import n from "node:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { readTsconfigReferences as e } from "./read-tsconfig-references.js";
|
|
2
|
+
import { readTsconfigExtends as t } from "./read-tsconfig-extends.js";
|
|
3
|
+
import { existsSync as n } from "node:fs";
|
|
4
|
+
import r from "node:path";
|
|
5
|
+
function i(o, s, c = {}) {
|
|
6
|
+
let l = s.get(o);
|
|
7
|
+
if (l !== void 0) return l;
|
|
8
|
+
let u = r.join(o, "tsconfig.json"), d = r.dirname(o), f = [u];
|
|
9
|
+
return n(u) ? (c.references && a(f, e), a(f, t)) : d !== o && f.push(...i(d, s, c).filter((e) => e !== u)), s.set(o, f), f;
|
|
10
|
+
}
|
|
11
|
+
function a(e, t) {
|
|
12
|
+
for (let n = 0; n < e.length; n++) {
|
|
13
|
+
let r = t(e[n]);
|
|
14
|
+
for (let t of r) e.includes(t) || e.push(t);
|
|
11
15
|
}
|
|
12
|
-
else c !== i && l.push(...r(c, a));
|
|
13
|
-
return a.set(i, l), l;
|
|
14
16
|
}
|
|
15
|
-
export {
|
|
17
|
+
export { i as listTsconfigFiles };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Expression } from 'oxc-parser';
|
|
2
|
+
/**
|
|
3
|
+
* Parses a `tsconfig.json` file. The file is JSON with comments and trailing
|
|
4
|
+
* commas, as TypeScript reads it, so it is parsed as a JavaScript expression.
|
|
5
|
+
*
|
|
6
|
+
* @param file - Absolute path of the file.
|
|
7
|
+
* @returns Expression the file holds, or null when the file cannot be read or
|
|
8
|
+
* parsed or holds more than one.
|
|
9
|
+
*/
|
|
10
|
+
export declare function parseTsconfig(file: string): Expression | null;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { readFileSync as e } from "node:fs";
|
|
2
|
+
import { parseSync as t } from "oxc-parser";
|
|
3
|
+
const n = String.fromCodePoint(65279);
|
|
4
|
+
function r(r) {
|
|
5
|
+
let i;
|
|
6
|
+
try {
|
|
7
|
+
i = e(r, "utf8");
|
|
8
|
+
} catch {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
let { program: a, errors: o } = t("tsconfig.js", `(\n${i.startsWith(n) ? i.slice(1) : i}\n)`, {
|
|
12
|
+
preserveParens: !1,
|
|
13
|
+
lang: "js"
|
|
14
|
+
});
|
|
15
|
+
if (o.length > 0 || a.body.length !== 1) return null;
|
|
16
|
+
let [s] = a.body;
|
|
17
|
+
return s.expression;
|
|
18
|
+
}
|
|
19
|
+
export { r as parseTsconfig };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads the name of a Node flag as Node's option parser reads it: the part
|
|
3
|
+
* before `=`, with `_` after the first two characters taken as `-`, so
|
|
4
|
+
* `--experimental_loader=./hooks.mjs` is `--experimental-loader`.
|
|
5
|
+
*
|
|
6
|
+
* @param flag - Word of Node flags, such as `--import=tsx`.
|
|
7
|
+
* @returns What Node calls the flag, such as `--experimental-loader`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function readFlagName(flag: string): string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Splits `NODE_OPTIONS` into words as Node does: a space outside double quotes
|
|
3
|
+
* ends a word, a double quote opens or closes a quoted part and is dropped, and
|
|
4
|
+
* inside quotes a backslash keeps the character after it. Tabs and line breaks
|
|
5
|
+
* belong to words, as in Node.
|
|
6
|
+
*
|
|
7
|
+
* @param nodeOptions - Value of `NODE_OPTIONS`.
|
|
8
|
+
* @returns Words in order, such as `--require` and `./my setup.cjs` for
|
|
9
|
+
* `--require "./my setup.cjs"`.
|
|
10
|
+
*/
|
|
11
|
+
export declare function readNodeOptions(nodeOptions: string): string[];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
function e(e) {
|
|
2
|
+
let t = [], n = null, r = !1, i = !1;
|
|
3
|
+
for (let a of e) i ? (n = `${n ?? ""}${a}`, i = !1) : r && a === "\\" ? i = !0 : a === "\"" ? r = !r : a === " " && !r ? (n !== null && t.push(n), n = null) : n = `${n ?? ""}${a}`;
|
|
4
|
+
return n !== null && t.push(n), t;
|
|
5
|
+
}
|
|
6
|
+
export { e as readNodeOptions };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tells whether the adapters may start spare test processes: processes started
|
|
3
|
+
* ahead of the unit that will run in them, which load no module of the project
|
|
4
|
+
* before it. `MOOTANT_PREFORK=0` turns them off, for comparing runs with and
|
|
5
|
+
* without them. The variable is read once per process and removed, so the test
|
|
6
|
+
* processes never see it.
|
|
7
|
+
*
|
|
8
|
+
* @returns Whether spare processes may start.
|
|
9
|
+
*/
|
|
10
|
+
export declare function readPreforkSwitch(): boolean;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Lists the configuration files a `tsconfig.json` file extends, directly: those
|
|
3
|
-
* given by a path, and those of packages
|
|
4
|
-
*
|
|
5
|
-
* lockfile stands for them; so are files that cannot be read or parsed. The
|
|
6
|
-
* file is JSON with comments and trailing commas, as TypeScript reads it, so it
|
|
7
|
-
* is parsed as a JavaScript expression.
|
|
3
|
+
* given by a path, and those of packages, in a workspace or in `node_modules`.
|
|
4
|
+
* Files that cannot be read or parsed (`parseTsconfig`) are left out.
|
|
8
5
|
*
|
|
9
6
|
* @param file - Absolute path of the `tsconfig.json` file.
|
|
10
7
|
* @returns Absolute paths of the extended files that exist.
|
|
@@ -1,39 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
function
|
|
7
|
-
let
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return [];
|
|
1
|
+
import { findTsconfigProperty as e } from "./find-tsconfig-property.js";
|
|
2
|
+
import { parseTsconfig as t } from "./parse-tsconfig.js";
|
|
3
|
+
import { createRequire as n } from "node:module";
|
|
4
|
+
import { existsSync as r, realpathSync as i } from "node:fs";
|
|
5
|
+
import a from "node:path";
|
|
6
|
+
function o(n) {
|
|
7
|
+
let i = e(t(n), "extends"), o = (i?.type === "ArrayExpression" ? i.elements : [i]).flatMap((e) => e?.type === "Literal" && typeof e.value == "string" ? [e.value] : []), c = a.dirname(n), l = [];
|
|
8
|
+
for (let e of o) {
|
|
9
|
+
let t = (/^\.{1,2}(?:[/\\]|$)/u.test(e) || a.isAbsolute(e) ? [a.resolve(c, e)] : s(n, e)).flatMap((e) => [e, `${e}.json`]).find((e) => e.endsWith(".json") && r(e));
|
|
10
|
+
t !== void 0 && l.push(t);
|
|
12
11
|
}
|
|
13
|
-
|
|
14
|
-
for (let n of a) {
|
|
15
|
-
let r = (/^\.{1,2}(?:[/\\]|$)/u.test(n) || i.isAbsolute(n) ? [i.resolve(o, n)] : l(e, n)).flatMap((e) => [e, `${e}.json`]).find((e) => e.endsWith(".json") && t(e));
|
|
16
|
-
r !== void 0 && !r.includes("/node_modules/") && s.push(r);
|
|
17
|
-
}
|
|
18
|
-
return s;
|
|
19
|
-
}
|
|
20
|
-
function c(e) {
|
|
21
|
-
let { program: t, errors: n } = a("tsconfig.js", `(\n${e.startsWith(o) ? e.slice(1) : e}\n)`, {
|
|
22
|
-
preserveParens: !1,
|
|
23
|
-
lang: "js"
|
|
24
|
-
}), [r] = t.body;
|
|
25
|
-
if (n.length > 0 || t.body.length !== 1 || r?.expression.type !== "ObjectExpression") return [];
|
|
26
|
-
let i = r.expression.properties.findLast((e) => e.type === "Property" && !e.computed && (e.key.type === "Literal" && e.key.value === "extends" || e.key.type === "Identifier" && e.key.name === "extends"));
|
|
27
|
-
return i?.type === "Property" ? (i.value.type === "ArrayExpression" ? i.value.elements : [i.value]).flatMap((e) => e?.type === "Literal" && typeof e.value == "string" ? [e.value] : []) : [];
|
|
12
|
+
return l;
|
|
28
13
|
}
|
|
29
|
-
function
|
|
30
|
-
let
|
|
31
|
-
return [
|
|
14
|
+
function s(e, t) {
|
|
15
|
+
let r = n(e);
|
|
16
|
+
return [t, `${t}/tsconfig.json`].flatMap((e) => {
|
|
32
17
|
try {
|
|
33
|
-
return [r
|
|
18
|
+
return [i(r.resolve(e))];
|
|
34
19
|
} catch {
|
|
35
20
|
return [];
|
|
36
21
|
}
|
|
37
22
|
});
|
|
38
23
|
}
|
|
39
|
-
export {
|
|
24
|
+
export { o as readTsconfigExtends };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lists the configuration files a `tsconfig.json` file references, directly, as
|
|
3
|
+
* TypeScript resolves them: the path of a reference, from the directory of the
|
|
4
|
+
* file, names the file itself when it ends with `.json`, and otherwise a
|
|
5
|
+
* directory whose `tsconfig.json` it means. Files that do not exist are listed
|
|
6
|
+
* too, as creating one changes what a loader does. A file that cannot be read
|
|
7
|
+
* or parsed references nothing.
|
|
8
|
+
*
|
|
9
|
+
* @param file - Absolute path of the `tsconfig.json` file.
|
|
10
|
+
* @returns Absolute paths, missing files included.
|
|
11
|
+
*/
|
|
12
|
+
export declare function readTsconfigReferences(file: string): string[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { findTsconfigProperty as e } from "./find-tsconfig-property.js";
|
|
2
|
+
import { parseTsconfig as t } from "./parse-tsconfig.js";
|
|
3
|
+
import n from "node:path";
|
|
4
|
+
function r(r) {
|
|
5
|
+
let i = e(t(r), "references"), a = i?.type === "ArrayExpression" ? i.elements : [], o = n.dirname(r);
|
|
6
|
+
return a.flatMap((t) => {
|
|
7
|
+
let r = e(t, "path");
|
|
8
|
+
if (r?.type !== "Literal" || typeof r.value != "string") return [];
|
|
9
|
+
let i = n.resolve(o, r.value);
|
|
10
|
+
return [i.endsWith(".json") ? i : n.join(i, "tsconfig.json")];
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
export { r as readTsconfigReferences };
|
|
@@ -3,10 +3,14 @@ import { FileInputTracking } from './types/file-input-tracking.js';
|
|
|
3
3
|
* Starts recording the files and directories code reads through `node:fs`, and
|
|
4
4
|
* which of them it changed itself: the path it wrote or the directory that path
|
|
5
5
|
* is in. A read counts unless the code wrote that path earlier, since then it
|
|
6
|
-
* reads its own output and not an input
|
|
6
|
+
* reads its own output and not an input, as with a directory `mkdtemp` made or
|
|
7
|
+
* a copy `cp` wrote; anything else in a directory the code made counts, as it
|
|
8
|
+
* may come from what no read names, such as a child process or a link. A path
|
|
9
|
+
* written is taken as given and by the real path of its directory, so a read or
|
|
10
|
+
* a module that names it by that path, as `require` does, is the same.
|
|
7
11
|
*
|
|
8
12
|
* @param accept - Tells whether a path counts when it is read.
|
|
9
|
-
* @returns The files read so far
|
|
10
|
-
* returns what was read.
|
|
13
|
+
* @returns The files read so far, whether a path is one the code wrote, and the
|
|
14
|
+
* function that stops recording and returns what was read.
|
|
11
15
|
*/
|
|
12
16
|
export declare function trackFileInputs(accept: (file: string) => boolean): FileInputTracking;
|
|
@@ -1,21 +1,30 @@
|
|
|
1
1
|
import { trackFileReads as e } from "./track-file-reads.js";
|
|
2
|
-
import t from "node:
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { realpathSync as t } from "node:fs";
|
|
3
|
+
import n from "node:path";
|
|
4
|
+
let r = n.dirname, i = n.basename, a = n.join, o = t;
|
|
5
|
+
function s(t) {
|
|
6
|
+
let n = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
|
|
6
7
|
return e({
|
|
7
8
|
write: (e) => {
|
|
8
|
-
|
|
9
|
+
for (let t of [e, c(e)]) n.add(t), i.add(t), i.add(r(t));
|
|
9
10
|
},
|
|
10
11
|
read: (e) => {
|
|
11
|
-
t(e) && !
|
|
12
|
+
t(e) && !n.has(e) && a.add(e);
|
|
12
13
|
}
|
|
13
14
|
}), {
|
|
14
15
|
stop: () => (e(null), {
|
|
15
16
|
modified: [...a].filter((e) => i.has(e)).toSorted(),
|
|
16
17
|
files: [...a].toSorted()
|
|
17
18
|
}),
|
|
19
|
+
owns: (e) => n.has(e),
|
|
18
20
|
files: a
|
|
19
21
|
};
|
|
20
22
|
}
|
|
21
|
-
|
|
23
|
+
function c(e) {
|
|
24
|
+
try {
|
|
25
|
+
return a(o(r(e)), i(e));
|
|
26
|
+
} catch {
|
|
27
|
+
return e;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export { s as trackFileInputs };
|