zedbee 0.1.0-beta.16 → 0.1.0-beta.18
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/THIRD_PARTY_NOTICES.md +68 -74
- package/dist/attribution/metrics.d.ts.map +1 -1
- package/dist/attribution/metrics.js +8 -5
- package/dist/attribution/metrics.js.map +1 -1
- package/dist/attribution/pair-source-moves.d.ts +12 -0
- package/dist/attribution/pair-source-moves.d.ts.map +1 -0
- package/dist/attribution/pair-source-moves.js +108 -0
- package/dist/attribution/pair-source-moves.js.map +1 -0
- package/dist/attribution/source-moves.d.ts +47 -0
- package/dist/attribution/source-moves.d.ts.map +1 -0
- package/dist/attribution/source-moves.js +199 -0
- package/dist/attribution/source-moves.js.map +1 -0
- package/dist/cache/captured-dependencies.d.ts +24 -1
- package/dist/cache/captured-dependencies.d.ts.map +1 -1
- package/dist/cache/captured-dependencies.js +146 -25
- package/dist/cache/captured-dependencies.js.map +1 -1
- package/dist/cache/dependency-inputs.d.ts +3 -1
- package/dist/cache/dependency-inputs.d.ts.map +1 -1
- package/dist/cache/dependency-inputs.js +7 -3
- package/dist/cache/dependency-inputs.js.map +1 -1
- package/dist/checks/adapter.d.ts +1 -0
- package/dist/checks/adapter.d.ts.map +1 -1
- package/dist/checks/applicability.d.ts.map +1 -1
- package/dist/checks/applicability.js +1 -1
- package/dist/checks/applicability.js.map +1 -1
- package/dist/checks/changed-file-paths.d.ts.map +1 -1
- package/dist/checks/changed-file-paths.js +7 -1
- package/dist/checks/changed-file-paths.js.map +1 -1
- package/dist/checks/closed-compiler-project.d.ts +5 -0
- package/dist/checks/closed-compiler-project.d.ts.map +1 -0
- package/dist/checks/closed-compiler-project.js +106 -0
- package/dist/checks/closed-compiler-project.js.map +1 -0
- package/dist/checks/comparison-context.d.ts +3 -1
- package/dist/checks/comparison-context.d.ts.map +1 -1
- package/dist/checks/comparison-context.js +122 -7
- package/dist/checks/comparison-context.js.map +1 -1
- package/dist/checks/compiler-change-inputs.d.ts +12 -0
- package/dist/checks/compiler-change-inputs.d.ts.map +1 -0
- package/dist/checks/compiler-change-inputs.js +104 -0
- package/dist/checks/compiler-change-inputs.js.map +1 -0
- package/dist/checks/compiler-inputs.d.ts +1 -1
- package/dist/checks/compiler-inputs.d.ts.map +1 -1
- package/dist/checks/compiler-inputs.js +65 -5
- package/dist/checks/compiler-inputs.js.map +1 -1
- package/dist/checks/complexity/adapter.d.ts.map +1 -1
- package/dist/checks/complexity/adapter.js +21 -2
- package/dist/checks/complexity/adapter.js.map +1 -1
- package/dist/checks/dead-code/adapter.d.ts.map +1 -1
- package/dist/checks/dead-code/adapter.js +16 -5
- package/dist/checks/dead-code/adapter.js.map +1 -1
- package/dist/checks/dead-code/entry-configuration.d.ts +6 -0
- package/dist/checks/dead-code/entry-configuration.d.ts.map +1 -0
- package/dist/checks/dead-code/entry-configuration.js +48 -0
- package/dist/checks/dead-code/entry-configuration.js.map +1 -0
- package/dist/checks/dead-code/managed-config.d.ts +1 -1
- package/dist/checks/dead-code/managed-config.d.ts.map +1 -1
- package/dist/checks/dead-code/managed-config.js +24 -3
- package/dist/checks/dead-code/managed-config.js.map +1 -1
- package/dist/checks/dead-code/vite-entrypoints.d.ts +13 -0
- package/dist/checks/dead-code/vite-entrypoints.d.ts.map +1 -0
- package/dist/checks/dead-code/vite-entrypoints.js +314 -0
- package/dist/checks/dead-code/vite-entrypoints.js.map +1 -0
- package/dist/checks/diagnostic-details.d.ts.map +1 -1
- package/dist/checks/diagnostic-details.js +32 -0
- package/dist/checks/diagnostic-details.js.map +1 -1
- package/dist/checks/dispatch-cache.d.ts.map +1 -1
- package/dist/checks/dispatch-cache.js +9 -0
- package/dist/checks/dispatch-cache.js.map +1 -1
- package/dist/checks/dispatch-context.d.ts.map +1 -1
- package/dist/checks/dispatch-context.js +1 -0
- package/dist/checks/dispatch-context.js.map +1 -1
- package/dist/checks/dispatch-target.d.ts.map +1 -1
- package/dist/checks/dispatch-target.js +36 -5
- package/dist/checks/dispatch-target.js.map +1 -1
- package/dist/checks/dispatcher.d.ts.map +1 -1
- package/dist/checks/dispatcher.js +20 -7
- package/dist/checks/dispatcher.js.map +1 -1
- package/dist/checks/engine-identity.d.ts.map +1 -1
- package/dist/checks/engine-identity.js +9 -8
- package/dist/checks/engine-identity.js.map +1 -1
- package/dist/checks/eslint/convert-message.d.ts.map +1 -1
- package/dist/checks/eslint/convert-message.js +5 -2
- package/dist/checks/eslint/convert-message.js.map +1 -1
- package/dist/checks/incomplete-error.d.ts +3 -0
- package/dist/checks/incomplete-error.d.ts.map +1 -1
- package/dist/checks/incomplete-error.js +4 -0
- package/dist/checks/incomplete-error.js.map +1 -1
- package/dist/checks/incomplete-result.d.ts +1 -0
- package/dist/checks/incomplete-result.d.ts.map +1 -1
- package/dist/checks/incomplete-result.js +3 -0
- package/dist/checks/incomplete-result.js.map +1 -1
- package/dist/checks/installation-diagnostic.d.ts +11 -0
- package/dist/checks/installation-diagnostic.d.ts.map +1 -0
- package/dist/checks/installation-diagnostic.js +71 -0
- package/dist/checks/installation-diagnostic.js.map +1 -0
- package/dist/checks/observation-result.d.ts.map +1 -1
- package/dist/checks/observation-result.js +69 -7
- package/dist/checks/observation-result.js.map +1 -1
- package/dist/checks/prettier/settings.d.ts +2 -2
- package/dist/checks/project-inputs.d.ts +1 -1
- package/dist/checks/project-inputs.d.ts.map +1 -1
- package/dist/checks/project-inputs.js +13 -4
- package/dist/checks/project-inputs.js.map +1 -1
- package/dist/checks/react/adapter.d.ts.map +1 -1
- package/dist/checks/react/adapter.js +38 -5
- package/dist/checks/react/adapter.js.map +1 -1
- package/dist/checks/runner/envelope.d.ts.map +1 -1
- package/dist/checks/runner/envelope.js +1 -0
- package/dist/checks/runner/envelope.js.map +1 -1
- package/dist/checks/runner/worker.js +3 -0
- package/dist/checks/runner/worker.js.map +1 -1
- package/dist/checks/sanitize-result.d.ts +1 -0
- package/dist/checks/sanitize-result.d.ts.map +1 -1
- package/dist/checks/sanitize-result.js +7 -0
- package/dist/checks/sanitize-result.js.map +1 -1
- package/dist/checks/source-moves.d.ts +9 -0
- package/dist/checks/source-moves.d.ts.map +1 -0
- package/dist/checks/source-moves.js +184 -0
- package/dist/checks/source-moves.js.map +1 -0
- package/dist/checks/structural-security/adapter.d.ts.map +1 -1
- package/dist/checks/structural-security/adapter.js +35 -55
- package/dist/checks/structural-security/adapter.js.map +1 -1
- package/dist/checks/structural-security/parse-failures.d.ts +6 -0
- package/dist/checks/structural-security/parse-failures.d.ts.map +1 -0
- package/dist/checks/structural-security/parse-failures.js +76 -0
- package/dist/checks/structural-security/parse-failures.js.map +1 -0
- package/dist/checks/structural-security/parser.d.ts +18 -0
- package/dist/checks/structural-security/parser.d.ts.map +1 -0
- package/dist/checks/structural-security/parser.js +96 -0
- package/dist/checks/structural-security/parser.js.map +1 -0
- package/dist/checks/structural-security/rules.d.ts.map +1 -1
- package/dist/checks/structural-security/rules.js +67 -113
- package/dist/checks/structural-security/rules.js.map +1 -1
- package/dist/checks/typescript/compiler-host.d.ts.map +1 -1
- package/dist/checks/typescript/compiler-host.js +68 -49
- package/dist/checks/typescript/compiler-host.js.map +1 -1
- package/dist/checks/typescript/compiler-scope-graph.d.ts +11 -0
- package/dist/checks/typescript/compiler-scope-graph.d.ts.map +1 -0
- package/dist/checks/typescript/compiler-scope-graph.js +694 -0
- package/dist/checks/typescript/compiler-scope-graph.js.map +1 -0
- package/dist/checks/typescript/compiler-scope-inputs.d.ts +20 -0
- package/dist/checks/typescript/compiler-scope-inputs.d.ts.map +1 -0
- package/dist/checks/typescript/compiler-scope-inputs.js +183 -0
- package/dist/checks/typescript/compiler-scope-inputs.js.map +1 -0
- package/dist/checks/typescript/config.d.ts +3 -0
- package/dist/checks/typescript/config.d.ts.map +1 -1
- package/dist/checks/typescript/config.js +2 -2
- package/dist/checks/typescript/config.js.map +1 -1
- package/dist/checks/typescript/configuration-paths.d.ts +3 -2
- package/dist/checks/typescript/configuration-paths.d.ts.map +1 -1
- package/dist/checks/typescript/configuration-paths.js +67 -12
- package/dist/checks/typescript/configuration-paths.js.map +1 -1
- package/dist/checks/typescript/convert-diagnostic.d.ts +1 -2
- package/dist/checks/typescript/convert-diagnostic.d.ts.map +1 -1
- package/dist/checks/typescript/convert-diagnostic.js +2 -16
- package/dist/checks/typescript/convert-diagnostic.js.map +1 -1
- package/dist/checks/typescript/diagnostic-message.d.ts +3 -0
- package/dist/checks/typescript/diagnostic-message.d.ts.map +1 -0
- package/dist/checks/typescript/diagnostic-message.js +18 -0
- package/dist/checks/typescript/diagnostic-message.js.map +1 -0
- package/dist/checks/typescript/project-coverage.d.ts.map +1 -1
- package/dist/checks/typescript/project-coverage.js +3 -2
- package/dist/checks/typescript/project-coverage.js.map +1 -1
- package/dist/checks/typescript/reuse-inputs.d.ts +3 -0
- package/dist/checks/typescript/reuse-inputs.d.ts.map +1 -1
- package/dist/checks/typescript/reuse-inputs.js +14 -4
- package/dist/checks/typescript/reuse-inputs.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +2 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/checks.js +3 -3
- package/dist/commands/checks.js.map +1 -1
- package/dist/commands/diagnostics.d.ts +2 -0
- package/dist/commands/diagnostics.d.ts.map +1 -1
- package/dist/commands/diagnostics.js +34 -0
- package/dist/commands/diagnostics.js.map +1 -1
- package/dist/commands/fix.d.ts.map +1 -1
- package/dist/commands/fix.js +4 -1
- package/dist/commands/fix.js.map +1 -1
- package/dist/commands/scan.d.ts +1 -0
- package/dist/commands/scan.d.ts.map +1 -1
- package/dist/commands/scan.js +31 -3
- package/dist/commands/scan.js.map +1 -1
- package/dist/config/profiles.d.ts.map +1 -1
- package/dist/config/profiles.js +6 -0
- package/dist/config/profiles.js.map +1 -1
- package/dist/config/schema.d.ts +43 -23
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +16 -1
- package/dist/config/schema.js.map +1 -1
- package/dist/config/settings-registry.js +2 -2
- package/dist/config/settings-registry.js.map +1 -1
- package/dist/core/types.d.ts +14 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/diagnostics/local-scan-diagnostics.d.ts +12 -0
- package/dist/diagnostics/local-scan-diagnostics.d.ts.map +1 -0
- package/dist/diagnostics/local-scan-diagnostics.js +138 -0
- package/dist/diagnostics/local-scan-diagnostics.js.map +1 -0
- package/dist/diagnostics/scan-performance.d.ts +2 -0
- package/dist/diagnostics/scan-performance.d.ts.map +1 -1
- package/dist/diagnostics/scan-performance.js +22 -20
- package/dist/diagnostics/scan-performance.js.map +1 -1
- package/dist/doctor/diagnostics.d.ts.map +1 -1
- package/dist/doctor/diagnostics.js +22 -3
- package/dist/doctor/diagnostics.js.map +1 -1
- package/dist/doctor/workspace-installation.d.ts +9 -0
- package/dist/doctor/workspace-installation.d.ts.map +1 -0
- package/dist/doctor/workspace-installation.js +165 -0
- package/dist/doctor/workspace-installation.js.map +1 -0
- package/dist/hooks/detect.d.ts +4 -0
- package/dist/hooks/detect.d.ts.map +1 -1
- package/dist/hooks/detect.js +5 -4
- package/dist/hooks/detect.js.map +1 -1
- package/dist/hooks/update-notice.d.ts +5 -0
- package/dist/hooks/update-notice.d.ts.map +1 -0
- package/dist/hooks/update-notice.js +145 -0
- package/dist/hooks/update-notice.js.map +1 -0
- package/dist/init/presentation.d.ts +2 -2
- package/dist/renderers/incomplete.d.ts +5 -1
- package/dist/renderers/incomplete.d.ts.map +1 -1
- package/dist/renderers/incomplete.js +29 -2
- package/dist/renderers/incomplete.js.map +1 -1
- package/dist/renderers/json.d.ts.map +1 -1
- package/dist/renderers/json.js +20 -3
- package/dist/renderers/json.js.map +1 -1
- package/dist/renderers/sarif.d.ts.map +1 -1
- package/dist/renderers/sarif.js +7 -0
- package/dist/renderers/sarif.js.map +1 -1
- package/dist/renderers/text.d.ts.map +1 -1
- package/dist/renderers/text.js +20 -0
- package/dist/renderers/text.js.map +1 -1
- package/dist/reporting/agent-guidance.d.ts.map +1 -1
- package/dist/reporting/agent-guidance.js +7 -0
- package/dist/reporting/agent-guidance.js.map +1 -1
- package/dist/reporting/finding-priority.d.ts +6 -0
- package/dist/reporting/finding-priority.d.ts.map +1 -0
- package/dist/reporting/finding-priority.js +69 -0
- package/dist/reporting/finding-priority.js.map +1 -0
- package/dist/reporting/fix-plan-store.d.ts +2 -5
- package/dist/reporting/fix-plan-store.d.ts.map +1 -1
- package/dist/reporting/fix-plan-store.js +2 -1
- package/dist/reporting/fix-plan-store.js.map +1 -1
- package/dist/reporting/fix-presentation.d.ts +1 -1
- package/dist/reporting/hook-update-notice.d.ts +12 -0
- package/dist/reporting/hook-update-notice.d.ts.map +1 -0
- package/dist/reporting/hook-update-notice.js +13 -0
- package/dist/reporting/hook-update-notice.js.map +1 -0
- package/dist/reporting/presentation.d.ts +3 -1
- package/dist/reporting/presentation.d.ts.map +1 -1
- package/dist/reporting/presentation.js +19 -7
- package/dist/reporting/presentation.js.map +1 -1
- package/dist/reporting/result-sections.d.ts +1 -0
- package/dist/reporting/result-sections.d.ts.map +1 -1
- package/dist/reporting/result-sections.js +12 -0
- package/dist/reporting/result-sections.js.map +1 -1
- package/dist/reporting/temporary-report-common.d.ts +13 -1
- package/dist/reporting/temporary-report-common.d.ts.map +1 -1
- package/dist/reporting/temporary-report-common.js +4 -1
- package/dist/reporting/temporary-report-common.js.map +1 -1
- package/dist/reporting/temporary-report-lifecycle.d.ts +3 -3
- package/dist/reporting/temporary-report-lifecycle.d.ts.map +1 -1
- package/dist/reporting/temporary-report-lifecycle.js +18 -4
- package/dist/reporting/temporary-report-lifecycle.js.map +1 -1
- package/dist/reporting/temporary-reports.d.ts +1 -1
- package/dist/reporting/temporary-reports.d.ts.map +1 -1
- package/dist/reporting/temporary-reports.js +22 -3
- package/dist/reporting/temporary-reports.js.map +1 -1
- package/dist/scan/analysis-session.d.ts.map +1 -1
- package/dist/scan/analysis-session.js +15 -1
- package/dist/scan/analysis-session.js.map +1 -1
- package/dist/scan/report.d.ts +6 -0
- package/dist/scan/report.d.ts.map +1 -1
- package/dist/scan/run-scan.d.ts.map +1 -1
- package/dist/scan/run-scan.js +17 -8
- package/dist/scan/run-scan.js.map +1 -1
- package/dist/service/server-connection.d.ts.map +1 -1
- package/dist/service/server-connection.js +2 -1
- package/dist/service/server-connection.js.map +1 -1
- package/dist/telemetry/schema.d.ts +45 -45
- package/dist/telemetry/state.d.ts +5 -5
- package/dist/ui/incomplete-list.d.ts.map +1 -1
- package/dist/ui/incomplete-list.js +4 -2
- package/dist/ui/incomplete-list.js.map +1 -1
- package/dist/ui/scan-result-dashboard.d.ts.map +1 -1
- package/dist/ui/scan-result-dashboard.js +7 -3
- package/dist/ui/scan-result-dashboard.js.map +1 -1
- package/docs/checks.md +106 -2
- package/docs/cli-reference.md +7 -1
- package/docs/privacy.md +15 -0
- package/docs/react-analysis.md +7 -0
- package/docs/reporting.md +43 -1
- package/docs/support.md +19 -0
- package/{node_modules/dependency-cruiser/node_modules/picomatch/LICENSE → licenses/overrides/jscpd-5.4.2-LICENSE} +5 -5
- package/licenses/overrides/napi-rs-wasm-runtime-1.2.5-LICENSE +43 -0
- package/licenses/reviewed-overrides.json +70 -0
- package/node_modules/acorn/CHANGELOG.md +14 -0
- package/node_modules/acorn/dist/acorn.js +42 -14
- package/node_modules/acorn/dist/acorn.mjs +42 -14
- package/node_modules/acorn/package.json +1 -1
- package/node_modules/dependency-cruiser/README.md +7 -8
- package/node_modules/dependency-cruiser/bin/depcruise-baseline.mjs +12 -5
- package/node_modules/dependency-cruiser/bin/{dependency-cruise.mjs → dependency-cruiser.mjs} +24 -14
- package/node_modules/dependency-cruiser/configs/rules/no-duplicate-dependency-types.cjs +1 -1
- package/node_modules/dependency-cruiser/node_modules/ignore/README.md +138 -8
- package/node_modules/dependency-cruiser/node_modules/ignore/index.d.ts +56 -20
- package/node_modules/dependency-cruiser/node_modules/ignore/index.js +1032 -229
- package/node_modules/dependency-cruiser/node_modules/ignore/legacy.js +868 -184
- package/node_modules/dependency-cruiser/node_modules/ignore/package.json +10 -4
- package/node_modules/dependency-cruiser/node_modules/semver/LICENSE +15 -0
- package/node_modules/dependency-cruiser/node_modules/semver/README.md +680 -0
- package/node_modules/dependency-cruiser/node_modules/semver/bin/semver.js +195 -0
- package/node_modules/dependency-cruiser/node_modules/semver/classes/comparator.js +143 -0
- package/node_modules/dependency-cruiser/node_modules/semver/classes/index.js +7 -0
- package/node_modules/dependency-cruiser/node_modules/semver/classes/range.js +577 -0
- package/node_modules/dependency-cruiser/node_modules/semver/classes/semver.js +350 -0
- package/node_modules/dependency-cruiser/node_modules/semver/functions/clean.js +8 -0
- package/node_modules/dependency-cruiser/node_modules/semver/functions/cmp.js +54 -0
- package/node_modules/dependency-cruiser/node_modules/semver/functions/coerce.js +62 -0
- package/node_modules/dependency-cruiser/node_modules/semver/functions/compare-build.js +9 -0
- package/node_modules/dependency-cruiser/node_modules/semver/functions/compare-loose.js +5 -0
- package/node_modules/dependency-cruiser/node_modules/semver/functions/compare.js +7 -0
- package/node_modules/dependency-cruiser/node_modules/semver/functions/diff.js +60 -0
- package/node_modules/dependency-cruiser/node_modules/semver/functions/eq.js +5 -0
- package/node_modules/dependency-cruiser/node_modules/semver/functions/gt.js +5 -0
- package/node_modules/dependency-cruiser/node_modules/semver/functions/gte.js +5 -0
- package/node_modules/dependency-cruiser/node_modules/semver/functions/inc.js +21 -0
- package/node_modules/dependency-cruiser/node_modules/semver/functions/lt.js +5 -0
- package/node_modules/dependency-cruiser/node_modules/semver/functions/lte.js +5 -0
- package/node_modules/dependency-cruiser/node_modules/semver/functions/major.js +5 -0
- package/node_modules/dependency-cruiser/node_modules/semver/functions/minor.js +5 -0
- package/node_modules/dependency-cruiser/node_modules/semver/functions/neq.js +5 -0
- package/node_modules/dependency-cruiser/node_modules/semver/functions/parse.js +18 -0
- package/node_modules/dependency-cruiser/node_modules/semver/functions/patch.js +5 -0
- package/node_modules/dependency-cruiser/node_modules/semver/functions/prerelease.js +8 -0
- package/node_modules/dependency-cruiser/node_modules/semver/functions/rcompare.js +5 -0
- package/node_modules/dependency-cruiser/node_modules/semver/functions/rsort.js +5 -0
- package/node_modules/dependency-cruiser/node_modules/semver/functions/satisfies.js +12 -0
- package/node_modules/dependency-cruiser/node_modules/semver/functions/sort.js +5 -0
- package/node_modules/dependency-cruiser/node_modules/semver/functions/truncate.js +48 -0
- package/node_modules/dependency-cruiser/node_modules/semver/functions/valid.js +8 -0
- package/node_modules/dependency-cruiser/node_modules/semver/index.js +93 -0
- package/node_modules/dependency-cruiser/node_modules/semver/internal/constants.js +67 -0
- package/node_modules/dependency-cruiser/node_modules/semver/internal/debug.js +11 -0
- package/node_modules/dependency-cruiser/node_modules/semver/internal/identifiers.js +29 -0
- package/node_modules/dependency-cruiser/node_modules/semver/internal/lrucache.js +42 -0
- package/node_modules/dependency-cruiser/node_modules/semver/internal/parse-options.js +17 -0
- package/node_modules/dependency-cruiser/node_modules/semver/internal/re.js +223 -0
- package/node_modules/dependency-cruiser/node_modules/semver/internal/trim-comparator-whitespace.js +438 -0
- package/node_modules/dependency-cruiser/node_modules/semver/package.json +78 -0
- package/node_modules/dependency-cruiser/node_modules/semver/preload.js +4 -0
- package/node_modules/dependency-cruiser/node_modules/semver/range.bnf +17 -0
- package/node_modules/dependency-cruiser/node_modules/semver/ranges/gtr.js +6 -0
- package/node_modules/dependency-cruiser/node_modules/semver/ranges/intersects.js +9 -0
- package/node_modules/dependency-cruiser/node_modules/semver/ranges/ltr.js +6 -0
- package/node_modules/dependency-cruiser/node_modules/semver/ranges/max-satisfying.js +27 -0
- package/node_modules/dependency-cruiser/node_modules/semver/ranges/min-satisfying.js +26 -0
- package/node_modules/dependency-cruiser/node_modules/semver/ranges/min-version.js +63 -0
- package/node_modules/dependency-cruiser/node_modules/semver/ranges/outside.js +82 -0
- package/node_modules/dependency-cruiser/node_modules/semver/ranges/simplify.js +49 -0
- package/node_modules/dependency-cruiser/node_modules/semver/ranges/subset.js +249 -0
- package/node_modules/dependency-cruiser/node_modules/semver/ranges/to-comparators.js +10 -0
- package/node_modules/dependency-cruiser/node_modules/semver/ranges/valid.js +13 -0
- package/node_modules/dependency-cruiser/package.json +16 -10
- package/node_modules/dependency-cruiser/src/analyze/analyze-modules.mjs +5 -1
- package/node_modules/dependency-cruiser/src/analyze/index.mjs +3 -3
- package/node_modules/dependency-cruiser/src/analyze/soften-known-violations.mjs +4 -2
- package/node_modules/dependency-cruiser/src/analyze/summarize/get-stats.mjs +38 -3
- package/node_modules/dependency-cruiser/src/analyze/summarize/index.mjs +28 -105
- package/node_modules/dependency-cruiser/src/analyze/summarize/summarize-options.mjs +3 -0
- package/node_modules/dependency-cruiser/src/analyze/summarize/verify-environment.mjs +146 -0
- package/node_modules/dependency-cruiser/src/cache/cache.mjs +1 -1
- package/node_modules/dependency-cruiser/src/cache/options-compatible.mjs +3 -0
- package/node_modules/dependency-cruiser/src/cli/defaults.mjs +0 -1
- package/node_modules/dependency-cruiser/src/cli/index.mjs +11 -3
- package/node_modules/dependency-cruiser/src/cli/init-config/build-config.mjs +14 -0
- package/node_modules/dependency-cruiser/src/cli/init-config/config-template.mjs +7 -2
- package/node_modules/dependency-cruiser/src/cli/init-config/environment-helpers.mjs +5 -1
- package/node_modules/dependency-cruiser/src/cli/init-config/get-user-input.mjs +11 -0
- package/node_modules/dependency-cruiser/src/cli/init-config/index.mjs +1 -0
- package/node_modules/dependency-cruiser/src/cli/init-config/normalize-init-options.mjs +1 -1
- package/node_modules/dependency-cruiser/src/cli/init-config/types.d.mts +4 -0
- package/node_modules/dependency-cruiser/src/cli/init-config/write-run-scripts-to-manifest.mjs +7 -7
- package/node_modules/dependency-cruiser/src/cli/normalize-cli-options.mjs +63 -2
- package/node_modules/dependency-cruiser/src/config-utl/extract-ts-config.mjs +1 -1
- package/node_modules/dependency-cruiser/src/extract/helpers.mjs +1 -0
- package/node_modules/dependency-cruiser/src/extract/resolve/determine-dependency-types.mjs +15 -7
- package/node_modules/dependency-cruiser/src/extract/resolve/merge-manifests.mjs +6 -3
- package/node_modules/dependency-cruiser/src/extract/swc/dependency-visitor.mjs +21 -4
- package/node_modules/dependency-cruiser/src/extract/swc/parse.mjs +14 -4
- package/node_modules/dependency-cruiser/src/extract/transpile/index.mjs +1 -1
- package/node_modules/dependency-cruiser/src/extract/transpile/meta.mjs +15 -3
- package/node_modules/dependency-cruiser/src/extract/transpile/svelte-wrap.mjs +23 -2
- package/node_modules/dependency-cruiser/src/extract/transpile/try-import-available.mjs +2 -2
- package/node_modules/dependency-cruiser/src/extract/transpile/typescript-wrap.mjs +23 -1
- package/node_modules/dependency-cruiser/src/extract/tsc/extract-typescript-deps.mjs +57 -12
- package/node_modules/dependency-cruiser/src/extract/tsc/extract.mjs +2 -0
- package/node_modules/dependency-cruiser/src/graph-utl/add-focus.mjs +2 -2
- package/node_modules/dependency-cruiser/src/graph-utl/compare.mjs +113 -14
- package/node_modules/dependency-cruiser/src/main/cruise.mjs +1 -2
- package/node_modules/dependency-cruiser/src/main/format.mjs +1 -1
- package/node_modules/dependency-cruiser/src/main/options/defaults.mjs +1 -0
- package/node_modules/dependency-cruiser/src/main/options/normalize.mjs +13 -4
- package/node_modules/dependency-cruiser/src/main/report-wrap.mjs +4 -2
- package/node_modules/dependency-cruiser/src/main/resolve-options/normalize.mjs +0 -27
- package/node_modules/dependency-cruiser/src/meta.cjs +1 -1
- package/node_modules/dependency-cruiser/src/report/anon/index.mjs +1 -1
- package/node_modules/dependency-cruiser/src/report/azure-devops.mjs +15 -11
- package/node_modules/dependency-cruiser/src/report/baseline.mjs +67 -10
- package/node_modules/dependency-cruiser/src/report/csv.mjs +1 -1
- package/node_modules/dependency-cruiser/src/report/dot/index.mjs +1 -1
- package/node_modules/dependency-cruiser/src/report/dot-webpage/dot-module.mjs +1 -1
- package/node_modules/dependency-cruiser/src/report/error-html/error-html-template.mjs +2 -0
- package/node_modules/dependency-cruiser/src/report/error-html/index.mjs +84 -8
- package/node_modules/dependency-cruiser/src/report/error.mjs +62 -13
- package/node_modules/dependency-cruiser/src/report/html/index.mjs +1 -1
- package/node_modules/dependency-cruiser/src/report/index.mjs +3 -2
- package/node_modules/dependency-cruiser/src/report/markdown.mjs +89 -19
- package/node_modules/dependency-cruiser/src/report/metrics.mjs +3 -3
- package/node_modules/dependency-cruiser/src/report/null.mjs +6 -3
- package/node_modules/dependency-cruiser/src/report/teamcity.mjs +4 -1
- package/node_modules/dependency-cruiser/src/schema/configuration.validate.mjs +1 -1
- package/node_modules/dependency-cruiser/src/schema/cruise-result.validate.mjs +1 -1
- package/node_modules/dependency-cruiser/src/utl/try-import.mjs +1 -1
- package/node_modules/dependency-cruiser/types/cruise-result.d.mts +14 -0
- package/node_modules/dependency-cruiser/types/dependency-cruiser.d.mts +6 -0
- package/node_modules/dependency-cruiser/types/options.d.mts +37 -2
- package/node_modules/dependency-cruiser/types/reporter-options.d.mts +30 -5
- package/node_modules/dependency-cruiser/types/restrictions.d.mts +2 -2
- package/node_modules/dependency-cruiser/types/shared-types.d.mts +16 -13
- package/node_modules/enhanced-resolve/README.md +46 -1
- package/node_modules/enhanced-resolve/lib/ExportsFieldPlugin.js +31 -6
- package/node_modules/enhanced-resolve/lib/ImportsFieldPlugin.js +27 -6
- package/node_modules/enhanced-resolve/lib/PackageMapPlugin.js +297 -0
- package/node_modules/enhanced-resolve/lib/Resolver.js +37 -30
- package/node_modules/enhanced-resolve/lib/ResolverFactory.js +104 -11
- package/node_modules/enhanced-resolve/lib/getPaths.js +6 -1
- package/node_modules/enhanced-resolve/lib/index.js +4 -0
- package/node_modules/enhanced-resolve/lib/util/entrypoints.js +104 -0
- package/node_modules/enhanced-resolve/lib/util/graceful-fs-browser.js +5 -1
- package/node_modules/enhanced-resolve/lib/util/identifier.js +4 -2
- package/node_modules/enhanced-resolve/lib/util/packageMap.js +224 -0
- package/node_modules/enhanced-resolve/lib/util/path.js +29 -8
- package/node_modules/enhanced-resolve/lib/util/pathToFileURL.js +87 -0
- package/node_modules/enhanced-resolve/package.json +8 -9
- package/node_modules/enhanced-resolve/types/AliasFieldPlugin.d.ts +41 -0
- package/node_modules/enhanced-resolve/types/AliasPlugin.d.ts +32 -0
- package/node_modules/enhanced-resolve/types/AliasUtils.d.ts +128 -0
- package/node_modules/enhanced-resolve/types/AppendPlugin.d.ts +27 -0
- package/node_modules/enhanced-resolve/types/CachedInputFileSystem.d.ts +224 -0
- package/node_modules/enhanced-resolve/types/CloneBasenamePlugin.d.ts +24 -0
- package/node_modules/enhanced-resolve/types/ConditionalPlugin.d.ts +33 -0
- package/node_modules/enhanced-resolve/types/DescriptionFilePlugin.d.ts +30 -0
- package/node_modules/enhanced-resolve/types/DescriptionFileUtils.d.ts +83 -0
- package/node_modules/enhanced-resolve/types/DirectoryExistsPlugin.d.ts +23 -0
- package/node_modules/enhanced-resolve/types/ExportsFieldPlugin.d.ts +45 -0
- package/node_modules/enhanced-resolve/types/ExtensionAliasPlugin.d.ts +31 -0
- package/node_modules/enhanced-resolve/types/FileExistsPlugin.d.ts +23 -0
- package/node_modules/enhanced-resolve/types/ImportsFieldPlugin.d.ts +45 -0
- package/node_modules/enhanced-resolve/types/JoinRequestPartPlugin.d.ts +24 -0
- package/node_modules/enhanced-resolve/types/JoinRequestPlugin.d.ts +24 -0
- package/node_modules/enhanced-resolve/types/LogInfoPlugin.d.ts +18 -0
- package/node_modules/enhanced-resolve/types/MainFieldPlugin.d.ts +41 -0
- package/node_modules/enhanced-resolve/types/ModulesInHierachicDirectoriesPlugin.d.ts +2 -0
- package/node_modules/enhanced-resolve/types/ModulesInHierarchicalDirectoriesPlugin.d.ts +26 -0
- package/node_modules/enhanced-resolve/types/ModulesInRootPlugin.d.ts +27 -0
- package/node_modules/enhanced-resolve/types/ModulesUtils.d.ts +25 -0
- package/node_modules/enhanced-resolve/types/NextPlugin.d.ts +23 -0
- package/node_modules/enhanced-resolve/types/PackageMapPlugin.d.ts +85 -0
- package/node_modules/enhanced-resolve/types/ParsePlugin.d.ts +27 -0
- package/node_modules/enhanced-resolve/types/PnpPlugin.d.ts +42 -0
- package/node_modules/enhanced-resolve/types/Resolver.d.ts +1545 -0
- package/node_modules/enhanced-resolve/types/ResolverFactory.d.ts +340 -0
- package/node_modules/enhanced-resolve/types/RestrictionsPlugin.d.ts +52 -0
- package/node_modules/enhanced-resolve/types/ResultPlugin.d.ts +18 -0
- package/node_modules/enhanced-resolve/types/RootsPlugin.d.ts +30 -0
- package/node_modules/enhanced-resolve/types/SelfReferencePlugin.d.ts +31 -0
- package/node_modules/enhanced-resolve/types/SymlinkPlugin.d.ts +24 -0
- package/node_modules/enhanced-resolve/types/SyncAsyncFileSystemDecorator.d.ts +52 -0
- package/node_modules/enhanced-resolve/types/TryNextPlugin.d.ts +26 -0
- package/node_modules/enhanced-resolve/types/TsconfigPathsPlugin.d.ts +204 -0
- package/node_modules/enhanced-resolve/types/UnsafeCachePlugin.d.ts +43 -0
- package/node_modules/enhanced-resolve/types/UseFilePlugin.d.ts +27 -0
- package/node_modules/enhanced-resolve/types/createInnerContext.d.ts +10 -0
- package/node_modules/enhanced-resolve/types/forEachBail.d.ts +15 -0
- package/node_modules/enhanced-resolve/types/getInnerRequest.d.ts +7 -0
- package/node_modules/enhanced-resolve/types/getPaths.d.ts +34 -0
- package/node_modules/enhanced-resolve/types/index.d.ts +131 -0
- package/node_modules/enhanced-resolve/types/util/entrypoints.d.ts +62 -0
- package/node_modules/enhanced-resolve/types/util/fileURLToPath.d.ts +14 -0
- package/node_modules/enhanced-resolve/types/util/fs.d.ts +38 -0
- package/node_modules/enhanced-resolve/types/util/graceful-fs-browser.d.ts +22 -0
- package/node_modules/enhanced-resolve/types/util/identifier.d.ts +7 -0
- package/node_modules/enhanced-resolve/types/util/memoize.d.ts +15 -0
- package/node_modules/enhanced-resolve/types/util/module-browser.d.ts +1 -0
- package/node_modules/enhanced-resolve/types/util/packageMap.d.ts +118 -0
- package/node_modules/enhanced-resolve/types/util/path-browser.d.ts +45 -0
- package/node_modules/enhanced-resolve/types/util/path.d.ts +125 -0
- package/node_modules/enhanced-resolve/types/util/pathToFileURL.d.ts +14 -0
- package/node_modules/enhanced-resolve/types/util/process-browser.d.ts +3 -0
- package/node_modules/enhanced-resolve/types/util/strip-json-comments.d.ts +24 -0
- package/node_modules/enhanced-resolve/types/util/url-browser.d.ts +1 -0
- package/node_modules/enhanced-resolve/types.d.ts +5 -2057
- package/node_modules/is-installed-globally/index.js +26 -4
- package/node_modules/is-installed-globally/package.json +1 -1
- package/package.json +5 -5
- package/schema/zedbee.schema.json +12 -1
- package/node_modules/dependency-cruiser/node_modules/picomatch/README.md +0 -743
- package/node_modules/dependency-cruiser/node_modules/picomatch/index.js +0 -17
- package/node_modules/dependency-cruiser/node_modules/picomatch/lib/constants.js +0 -184
- package/node_modules/dependency-cruiser/node_modules/picomatch/lib/parse.js +0 -1416
- package/node_modules/dependency-cruiser/node_modules/picomatch/lib/picomatch.js +0 -361
- package/node_modules/dependency-cruiser/node_modules/picomatch/lib/scan.js +0 -391
- package/node_modules/dependency-cruiser/node_modules/picomatch/lib/utils.js +0 -72
- package/node_modules/dependency-cruiser/node_modules/picomatch/package.json +0 -83
- package/node_modules/dependency-cruiser/node_modules/picomatch/posix.js +0 -3
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
/*
|
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
"use strict";
|
|
6
|
+
|
|
7
|
+
const { readJson } = require("./util/fs");
|
|
8
|
+
const {
|
|
9
|
+
createError,
|
|
10
|
+
findPackageIds,
|
|
11
|
+
parsePackageMap,
|
|
12
|
+
} = require("./util/packageMap");
|
|
13
|
+
|
|
14
|
+
/** @typedef {import("./Resolver")} Resolver */
|
|
15
|
+
/** @typedef {import("./Resolver").ResolveContext} ResolveContext */
|
|
16
|
+
/** @typedef {import("./Resolver").ResolveRequest} ResolveRequest */
|
|
17
|
+
/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */
|
|
18
|
+
/** @typedef {import("./util/packageMap").PackageMap} PackageMap */
|
|
19
|
+
/** @typedef {import("./util/packageMap").PackageMapPackages} PackageMapPackages */
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @typedef {object} PackageMapOptions
|
|
23
|
+
* @property {string} configFile absolute path of the configuration file, read lazily when `packages` is not given
|
|
24
|
+
* @property {PackageMapPackages | null} packages an already-parsed `packages` object, used instead of reading `configFile`
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/** @typedef {(err: Error | null, packageMap?: PackageMap) => void} PackageMapCallback */
|
|
28
|
+
|
|
29
|
+
const PACKAGE_NAME_REGEXP = /^(@[^/]+\/)?[^/]+/;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Resolves bare specifiers through a Node.js package map instead of walking
|
|
33
|
+
* `node_modules`: the importing package's `dependencies` table names the
|
|
34
|
+
* package id to use, and that entry's location is handed to the regular
|
|
35
|
+
* resolution pipeline to finish the job (`exports`, `main`, extensions...).
|
|
36
|
+
*
|
|
37
|
+
* The importing package is taken from an explicit package id when the caller
|
|
38
|
+
* propagates one (`context.packageId`, or `packageId` carried over from a
|
|
39
|
+
* previous result) and located by path otherwise. Two situations are hard
|
|
40
|
+
* errors rather than a miss, because guessing would silently resolve to the
|
|
41
|
+
* wrong package: the importer sitting outside every mapped package, and
|
|
42
|
+
* several package entries sharing the importer's location. A specifier that is
|
|
43
|
+
* simply absent from `dependencies` is reported as unresolved, and no
|
|
44
|
+
* `node_modules` fallback is attempted.
|
|
45
|
+
* @experimental Package maps are stability 1 (experimental) in Node.js and are
|
|
46
|
+
* only reachable there behind `--experimental-package-map`. This plugin tracks
|
|
47
|
+
* that specification and may change with it, including in a patch release.
|
|
48
|
+
*/
|
|
49
|
+
module.exports = class PackageMapPlugin {
|
|
50
|
+
/**
|
|
51
|
+
* @param {string | ResolveStepHook} source source
|
|
52
|
+
* @param {PackageMapOptions} options package map options
|
|
53
|
+
* @param {boolean} symlinks whether the resolver resolves symlinks
|
|
54
|
+
* @param {string | ResolveStepHook} target target
|
|
55
|
+
*/
|
|
56
|
+
constructor(source, options, symlinks, target) {
|
|
57
|
+
this.source = source;
|
|
58
|
+
this.options = options;
|
|
59
|
+
this.symlinks = symlinks;
|
|
60
|
+
this.target = target;
|
|
61
|
+
/** @type {PackageMap | undefined} */
|
|
62
|
+
this._packageMap = undefined;
|
|
63
|
+
/** @type {PackageMapCallback[] | undefined} */
|
|
64
|
+
this._pending = undefined;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Read and parse the configuration file once, queueing every request that
|
|
69
|
+
* arrives while the read is in flight so a cold start does not re-read the
|
|
70
|
+
* same file for each of them.
|
|
71
|
+
* @param {Resolver} resolver the resolver
|
|
72
|
+
* @param {ResolveContext} resolveContext resolve context
|
|
73
|
+
* @param {PackageMapCallback} callback callback
|
|
74
|
+
* @returns {void}
|
|
75
|
+
*/
|
|
76
|
+
_getPackageMap(resolver, resolveContext, callback) {
|
|
77
|
+
const { configFile, packages } = this.options;
|
|
78
|
+
|
|
79
|
+
if (configFile && resolveContext.fileDependencies) {
|
|
80
|
+
resolveContext.fileDependencies.add(configFile);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (this._packageMap !== undefined) {
|
|
84
|
+
return callback(null, this._packageMap);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (this._pending) {
|
|
88
|
+
this._pending.push(callback);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
this._pending = [callback];
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* @param {Error | null} error error
|
|
95
|
+
* @param {PackageMap=} packageMap package map
|
|
96
|
+
* @returns {void}
|
|
97
|
+
*/
|
|
98
|
+
const finish = (error, packageMap) => {
|
|
99
|
+
const pending = /** @type {PackageMapCallback[]} */ (this._pending);
|
|
100
|
+
this._pending = undefined;
|
|
101
|
+
for (const pendingCallback of pending) {
|
|
102
|
+
pendingCallback(error, packageMap);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// Package locations are matched against the paths the pipeline hands
|
|
107
|
+
// over, and those have their symlinks resolved when `symlinks` is on.
|
|
108
|
+
// Resolve the configuration file the same way so both sides are spelled
|
|
109
|
+
// alike; with `symlinks` off both keep the symlinked spelling instead.
|
|
110
|
+
this._resolveConfigFile(resolver, (realConfigFile) => {
|
|
111
|
+
if (packages) {
|
|
112
|
+
/** @type {PackageMap} */
|
|
113
|
+
let packageMap;
|
|
114
|
+
try {
|
|
115
|
+
packageMap = parsePackageMap({ packages }, realConfigFile);
|
|
116
|
+
} catch (err) {
|
|
117
|
+
return finish(/** @type {Error} */ (err));
|
|
118
|
+
}
|
|
119
|
+
this._packageMap = packageMap;
|
|
120
|
+
return finish(null, packageMap);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
readJson(
|
|
124
|
+
resolver.fileSystem,
|
|
125
|
+
realConfigFile,
|
|
126
|
+
{ stripComments: false },
|
|
127
|
+
(err, content) => {
|
|
128
|
+
/** @type {Error | null} */
|
|
129
|
+
let error = err || null;
|
|
130
|
+
/** @type {PackageMap | undefined} */
|
|
131
|
+
let packageMap;
|
|
132
|
+
|
|
133
|
+
if (!error) {
|
|
134
|
+
try {
|
|
135
|
+
packageMap = parsePackageMap(
|
|
136
|
+
/** @type {import("./Resolver").JsonObject} */ (content),
|
|
137
|
+
realConfigFile,
|
|
138
|
+
);
|
|
139
|
+
this._packageMap = packageMap;
|
|
140
|
+
} catch (parseErr) {
|
|
141
|
+
error = /** @type {Error} */ (parseErr);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
finish(error, packageMap);
|
|
146
|
+
},
|
|
147
|
+
);
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Hand back the configuration file path package locations resolve against:
|
|
153
|
+
* its real path when the resolver follows symlinks, and the path as given
|
|
154
|
+
* otherwise. A configuration file whose real path cannot be read (it may not
|
|
155
|
+
* exist, or the file system may not implement it) is used as-is, so the
|
|
156
|
+
* read below reports the problem.
|
|
157
|
+
* @param {Resolver} resolver the resolver
|
|
158
|
+
* @param {(configFile: string) => void} callback callback
|
|
159
|
+
* @returns {void}
|
|
160
|
+
*/
|
|
161
|
+
_resolveConfigFile(resolver, callback) {
|
|
162
|
+
const { configFile } = this.options;
|
|
163
|
+
const { realpath } = resolver.fileSystem;
|
|
164
|
+
|
|
165
|
+
if (!this.symlinks || !realpath) return callback(configFile);
|
|
166
|
+
|
|
167
|
+
realpath(configFile, (err, result) => {
|
|
168
|
+
callback(err || !result ? configFile : String(result));
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* @param {Resolver} resolver the resolver
|
|
174
|
+
* @returns {void}
|
|
175
|
+
*/
|
|
176
|
+
apply(resolver) {
|
|
177
|
+
/** @type {ResolveStepHook} */
|
|
178
|
+
const target = resolver.ensureHook(this.target);
|
|
179
|
+
resolver
|
|
180
|
+
.getHook(this.source)
|
|
181
|
+
.tapAsync("PackageMapPlugin", (request, resolveContext, callback) => {
|
|
182
|
+
const req = request.request;
|
|
183
|
+
if (!req) return callback();
|
|
184
|
+
// Builtins are not affected by package maps.
|
|
185
|
+
if (req.startsWith("node:")) return callback();
|
|
186
|
+
|
|
187
|
+
const packageMatch = PACKAGE_NAME_REGEXP.exec(req);
|
|
188
|
+
if (!packageMatch) return callback();
|
|
189
|
+
|
|
190
|
+
const [packageName] = packageMatch;
|
|
191
|
+
const innerRequest = `.${req.slice(packageName.length)}`;
|
|
192
|
+
|
|
193
|
+
this._getPackageMap(resolver, resolveContext, (err, packageMap) => {
|
|
194
|
+
if (err) return callback(err);
|
|
195
|
+
|
|
196
|
+
const { packages } = /** @type {PackageMap} */ (packageMap);
|
|
197
|
+
const issuerPath = request.path;
|
|
198
|
+
// A package id may be any key of the `packages` object, the empty
|
|
199
|
+
// string included, so distinguish "not provided" from falsy.
|
|
200
|
+
const contextId =
|
|
201
|
+
request.context &&
|
|
202
|
+
/** @type {string | undefined} */ (request.context.packageId);
|
|
203
|
+
const explicitId =
|
|
204
|
+
request.packageId !== undefined ? request.packageId : contextId;
|
|
205
|
+
|
|
206
|
+
/** @type {string} */
|
|
207
|
+
let issuerId;
|
|
208
|
+
|
|
209
|
+
if (explicitId !== undefined && explicitId !== null) {
|
|
210
|
+
if (!packages.has(explicitId)) {
|
|
211
|
+
return callback(
|
|
212
|
+
createError(
|
|
213
|
+
`Unknown package id "${explicitId}" for request "${req}"`,
|
|
214
|
+
"ERR_PACKAGE_MAP_UNKNOWN_PACKAGE",
|
|
215
|
+
),
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
issuerId = explicitId;
|
|
219
|
+
} else {
|
|
220
|
+
const ids =
|
|
221
|
+
issuerPath === false
|
|
222
|
+
? []
|
|
223
|
+
: findPackageIds(
|
|
224
|
+
/** @type {PackageMap} */ (packageMap),
|
|
225
|
+
issuerPath,
|
|
226
|
+
);
|
|
227
|
+
|
|
228
|
+
if (ids.length === 0) {
|
|
229
|
+
return callback(
|
|
230
|
+
createError(
|
|
231
|
+
`Cannot resolve "${req}" from "${issuerPath}": the importing file is not inside any package of the package map`,
|
|
232
|
+
"ERR_PACKAGE_MAP_EXTERNAL_FILE",
|
|
233
|
+
),
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
if (ids.length > 1) {
|
|
237
|
+
return callback(
|
|
238
|
+
createError(
|
|
239
|
+
`Cannot resolve "${req}" from "${issuerPath}": the package ids ${ids
|
|
240
|
+
.map((id) => `"${id}"`)
|
|
241
|
+
.join(
|
|
242
|
+
", ",
|
|
243
|
+
)} share this location, so the importing package is ambiguous. Propagate the package id of the previous resolution to disambiguate.`,
|
|
244
|
+
"ERR_PACKAGE_MAP_AMBIGUOUS_PACKAGE",
|
|
245
|
+
),
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
[issuerId] = ids;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
const issuer =
|
|
252
|
+
/** @type {import("./util/packageMap").PackageMapEntry} */ (
|
|
253
|
+
packages.get(issuerId)
|
|
254
|
+
);
|
|
255
|
+
const targetId = issuer.dependencies.get(packageName);
|
|
256
|
+
|
|
257
|
+
if (targetId === undefined) {
|
|
258
|
+
if (resolveContext.log) {
|
|
259
|
+
resolveContext.log(
|
|
260
|
+
`"${packageName}" is not a dependency of package "${issuerId}" in the package map`,
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
|
+
// Bail without a result: the package map is authoritative, so
|
|
264
|
+
// there is no `node_modules` fallback to try.
|
|
265
|
+
return callback(null, null);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
const targetEntry =
|
|
269
|
+
/** @type {import("./util/packageMap").PackageMapEntry} */ (
|
|
270
|
+
packages.get(targetId)
|
|
271
|
+
);
|
|
272
|
+
|
|
273
|
+
/** @type {ResolveRequest} */
|
|
274
|
+
const obj = {
|
|
275
|
+
...request,
|
|
276
|
+
path: targetEntry.path,
|
|
277
|
+
request: innerRequest,
|
|
278
|
+
packageId: targetId,
|
|
279
|
+
fullySpecified: request.fullySpecified && innerRequest !== ".",
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
resolver.doResolve(
|
|
283
|
+
target,
|
|
284
|
+
obj,
|
|
285
|
+
`resolved "${packageName}" to package "${targetId}" by the package map`,
|
|
286
|
+
resolveContext,
|
|
287
|
+
(resolveErr, result) => {
|
|
288
|
+
if (resolveErr) return callback(resolveErr);
|
|
289
|
+
if (result) return callback(null, result);
|
|
290
|
+
// Skip alternatives
|
|
291
|
+
return callback(null, null);
|
|
292
|
+
},
|
|
293
|
+
);
|
|
294
|
+
});
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
};
|
|
@@ -14,6 +14,7 @@ const {
|
|
|
14
14
|
createCachedDirname,
|
|
15
15
|
createCachedJoin,
|
|
16
16
|
getType,
|
|
17
|
+
isFileURL,
|
|
17
18
|
normalize,
|
|
18
19
|
toPath,
|
|
19
20
|
} = require("./util/path");
|
|
@@ -97,6 +98,7 @@ const HASH_ESCAPE_RE = /#/g;
|
|
|
97
98
|
/**
|
|
98
99
|
* @typedef {object} KnownContext
|
|
99
100
|
* @property {string[]=} environments environments
|
|
101
|
+
* @property {string=} packageId package id of the importing file in the package map, propagated from a previous result to disambiguate package entries that share a location (`@experimental`, see the `packageMap` option)
|
|
100
102
|
*/
|
|
101
103
|
|
|
102
104
|
// eslint-disable-next-line jsdoc/reject-any-type
|
|
@@ -401,6 +403,7 @@ const HASH_ESCAPE_RE = /#/g;
|
|
|
401
403
|
* @property {string=} relativePath relative path
|
|
402
404
|
* @property {boolean=} ignoreSymlinks true when need to ignore symlinks, otherwise false
|
|
403
405
|
* @property {boolean=} fullySpecified true when full specified, otherwise false
|
|
406
|
+
* @property {string=} packageId package id the request was resolved to in the package map, to be propagated to resolutions made from the resulting file (`@experimental`, see the `packageMap` option)
|
|
404
407
|
* @property {string=} __innerRequest inner request for internal usage
|
|
405
408
|
* @property {string=} __innerRequest_request inner request for internal usage
|
|
406
409
|
* @property {string=} __innerRequest_relativePath inner relative path for internal usage
|
|
@@ -693,23 +696,23 @@ class Resolver {
|
|
|
693
696
|
|
|
694
697
|
/**
|
|
695
698
|
* @overload
|
|
696
|
-
* @param {string | URL} parent context path or a `file:` URL
|
|
697
|
-
* @param {string | URL} specifier request string or a `file:` URL
|
|
699
|
+
* @param {string | URL} parent context path or a `file:` URL
|
|
700
|
+
* @param {string | URL} specifier request string or a `file:` URL
|
|
698
701
|
* @param {ResolveContext=} resolveContext resolve context
|
|
699
702
|
* @returns {string | false} result
|
|
700
703
|
*/
|
|
701
704
|
/**
|
|
702
705
|
* @overload
|
|
703
706
|
* @param {Context} context context information object
|
|
704
|
-
* @param {string | URL} parent context path or a `file:` URL
|
|
705
|
-
* @param {string | URL} specifier request string or a `file:` URL
|
|
707
|
+
* @param {string | URL} parent context path or a `file:` URL
|
|
708
|
+
* @param {string | URL} specifier request string or a `file:` URL
|
|
706
709
|
* @param {ResolveContext=} resolveContext resolve context
|
|
707
710
|
* @returns {string | false} result
|
|
708
711
|
*/
|
|
709
712
|
/**
|
|
710
|
-
* @param {Context | string | URL} context context information object, or the context path (
|
|
711
|
-
* @param {string | URL | ResolveContext=} parent context path (
|
|
712
|
-
* @param {string | URL | ResolveContext=} specifier request string (or `file:` URL
|
|
713
|
+
* @param {Context | string | URL} context context information object, or the context path (a path or a `file:` URL) when no context is provided
|
|
714
|
+
* @param {string | URL | ResolveContext=} parent context path (a path or a `file:` URL) or resolve context when no context is provided
|
|
715
|
+
* @param {string | URL | ResolveContext=} specifier request string (or a `file:` URL) or resolve context when no context is provided
|
|
713
716
|
* @param {ResolveContext=} resolveContext resolve context
|
|
714
717
|
* @returns {string | false} result
|
|
715
718
|
*/
|
|
@@ -745,23 +748,23 @@ class Resolver {
|
|
|
745
748
|
|
|
746
749
|
/**
|
|
747
750
|
* @overload
|
|
748
|
-
* @param {string | URL} parent context path or a `file:` URL
|
|
749
|
-
* @param {string | URL} specifier request string or a `file:` URL
|
|
751
|
+
* @param {string | URL} parent context path or a `file:` URL
|
|
752
|
+
* @param {string | URL} specifier request string or a `file:` URL
|
|
750
753
|
* @param {ResolveContext=} resolveContext resolve context
|
|
751
754
|
* @returns {Promise<string | false>} result
|
|
752
755
|
*/
|
|
753
756
|
/**
|
|
754
757
|
* @overload
|
|
755
758
|
* @param {Context} context context information object
|
|
756
|
-
* @param {string | URL} parent context path or a `file:` URL
|
|
757
|
-
* @param {string | URL} specifier request string or a `file:` URL
|
|
759
|
+
* @param {string | URL} parent context path or a `file:` URL
|
|
760
|
+
* @param {string | URL} specifier request string or a `file:` URL
|
|
758
761
|
* @param {ResolveContext=} resolveContext resolve context
|
|
759
762
|
* @returns {Promise<string | false>} result
|
|
760
763
|
*/
|
|
761
764
|
/**
|
|
762
|
-
* @param {Context | string | URL} context context information object, or the context path (
|
|
763
|
-
* @param {string | URL | ResolveContext=} parent context path (
|
|
764
|
-
* @param {string | URL | ResolveContext=} specifier request string (or `file:` URL
|
|
765
|
+
* @param {Context | string | URL} context context information object, or the context path (a path or a `file:` URL) when no context is provided
|
|
766
|
+
* @param {string | URL | ResolveContext=} parent context path (a path or a `file:` URL) or resolve context when no context is provided
|
|
767
|
+
* @param {string | URL | ResolveContext=} specifier request string (or a `file:` URL) or resolve context when no context is provided
|
|
765
768
|
* @param {ResolveContext=} resolveContext resolve context
|
|
766
769
|
* @returns {Promise<string | false>} result
|
|
767
770
|
*/
|
|
@@ -779,15 +782,15 @@ class Resolver {
|
|
|
779
782
|
|
|
780
783
|
/**
|
|
781
784
|
* @overload
|
|
782
|
-
* @param {string | URL} parent context path or a `file:` URL
|
|
783
|
-
* @param {string | URL} specifier request string or a `file:` URL
|
|
785
|
+
* @param {string | URL} parent context path or a `file:` URL
|
|
786
|
+
* @param {string | URL} specifier request string or a `file:` URL
|
|
784
787
|
* @param {ResolveCallback} callback callback function
|
|
785
788
|
* @returns {void}
|
|
786
789
|
*/
|
|
787
790
|
/**
|
|
788
791
|
* @overload
|
|
789
|
-
* @param {string | URL} parent context path or a `file:` URL
|
|
790
|
-
* @param {string | URL} specifier request string or a `file:` URL
|
|
792
|
+
* @param {string | URL} parent context path or a `file:` URL
|
|
793
|
+
* @param {string | URL} specifier request string or a `file:` URL
|
|
791
794
|
* @param {ResolveContext} resolveContext resolve context
|
|
792
795
|
* @param {ResolveCallback} callback callback function
|
|
793
796
|
* @returns {void}
|
|
@@ -795,24 +798,24 @@ class Resolver {
|
|
|
795
798
|
/**
|
|
796
799
|
* @overload
|
|
797
800
|
* @param {Context} context context information object
|
|
798
|
-
* @param {string | URL} parent context path or a `file:` URL
|
|
799
|
-
* @param {string | URL} specifier request string or a `file:` URL
|
|
801
|
+
* @param {string | URL} parent context path or a `file:` URL
|
|
802
|
+
* @param {string | URL} specifier request string or a `file:` URL
|
|
800
803
|
* @param {ResolveCallback} callback callback function
|
|
801
804
|
* @returns {void}
|
|
802
805
|
*/
|
|
803
806
|
/**
|
|
804
807
|
* @overload
|
|
805
808
|
* @param {Context} context context information object
|
|
806
|
-
* @param {string | URL} parent context path or a `file:` URL
|
|
807
|
-
* @param {string | URL} specifier request string or a `file:` URL
|
|
809
|
+
* @param {string | URL} parent context path or a `file:` URL
|
|
810
|
+
* @param {string | URL} specifier request string or a `file:` URL
|
|
808
811
|
* @param {ResolveContext} resolveContext resolve context
|
|
809
812
|
* @param {ResolveCallback} callback callback function
|
|
810
813
|
* @returns {void}
|
|
811
814
|
*/
|
|
812
815
|
/**
|
|
813
|
-
* @param {Context | string | URL} context context information object, or the context path (
|
|
814
|
-
* @param {string | URL | ResolveContext | ResolveCallback=} parent context path (
|
|
815
|
-
* @param {string | URL | ResolveContext | ResolveCallback=} specifier request string (or `file:` URL
|
|
816
|
+
* @param {Context | string | URL} context context information object, or the context path (a path or a `file:` URL) when no context is provided
|
|
817
|
+
* @param {string | URL | ResolveContext | ResolveCallback=} parent context path (a path or a `file:` URL) or (when no context) resolve context or callback
|
|
818
|
+
* @param {string | URL | ResolveContext | ResolveCallback=} specifier request string (or a `file:` URL) or (when no context) resolve context or callback
|
|
816
819
|
* @param {ResolveContext | ResolveCallback=} resolveContext resolve context or callback when no resolve context is provided
|
|
817
820
|
* @param {ResolveCallback=} callback callback function
|
|
818
821
|
* @returns {void}
|
|
@@ -837,7 +840,7 @@ class Resolver {
|
|
|
837
840
|
} else {
|
|
838
841
|
// Slow path: shift positional args based on what was supplied.
|
|
839
842
|
// Shift when context is omitted (first positional arg is the parent,
|
|
840
|
-
// either a
|
|
843
|
+
// either a path or a `file:` URL).
|
|
841
844
|
if (typeof context === "string" || context instanceof URL) {
|
|
842
845
|
// Keep an already-supplied callback (resolveSync / resolvePromise
|
|
843
846
|
// always pass one in the 5th position).
|
|
@@ -868,13 +871,17 @@ class Resolver {
|
|
|
868
871
|
context = {};
|
|
869
872
|
}
|
|
870
873
|
}
|
|
871
|
-
// Accept `file:`
|
|
872
|
-
//
|
|
873
|
-
//
|
|
874
|
-
//
|
|
874
|
+
// Accept `file:` URLs for parent/specifier, converting to a filesystem
|
|
875
|
+
// path (mirrors the URL support in resolve options). The `instanceof`
|
|
876
|
+
// check sits on the error branch and `isFileURL` reads one character of
|
|
877
|
+
// a path, so the common string case stays cheap on this hot path.
|
|
878
|
+
// A `file:` specifier string needs nothing here — `parseIdentifier`
|
|
879
|
+
// converts it once the request is parsed.
|
|
875
880
|
if (typeof parent !== "string") {
|
|
876
881
|
if (parent instanceof URL) parent = toPath(parent);
|
|
877
882
|
else return callback(new Error("path argument is not a string"));
|
|
883
|
+
} else if (isFileURL(parent)) {
|
|
884
|
+
parent = toPath(parent);
|
|
878
885
|
}
|
|
879
886
|
if (typeof specifier !== "string") {
|
|
880
887
|
if (specifier instanceof URL) specifier = toPath(specifier);
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
8
|
// eslint-disable-next-line n/prefer-global/process
|
|
9
|
-
const { versions } = require("process");
|
|
9
|
+
const { cwd, versions } = require("process");
|
|
10
10
|
|
|
11
11
|
const AliasFieldPlugin = require("./AliasFieldPlugin");
|
|
12
12
|
const AliasPlugin = require("./AliasPlugin");
|
|
@@ -24,6 +24,7 @@ const MainFieldPlugin = require("./MainFieldPlugin");
|
|
|
24
24
|
const ModulesInHierarchicalDirectoriesPlugin = require("./ModulesInHierarchicalDirectoriesPlugin");
|
|
25
25
|
const ModulesInRootPlugin = require("./ModulesInRootPlugin");
|
|
26
26
|
const NextPlugin = require("./NextPlugin");
|
|
27
|
+
const PackageMapPlugin = require("./PackageMapPlugin");
|
|
27
28
|
const ParsePlugin = require("./ParsePlugin");
|
|
28
29
|
const PnpPlugin = require("./PnpPlugin");
|
|
29
30
|
const Resolver = require("./Resolver");
|
|
@@ -37,10 +38,12 @@ const TryNextPlugin = require("./TryNextPlugin");
|
|
|
37
38
|
const TsconfigPathsPlugin = require("./TsconfigPathsPlugin");
|
|
38
39
|
const UnsafeCachePlugin = require("./UnsafeCachePlugin");
|
|
39
40
|
const UseFilePlugin = require("./UseFilePlugin");
|
|
40
|
-
const { PathType, getType, toPath } = require("./util/path");
|
|
41
|
+
const { PathType, getType, join, toPath } = require("./util/path");
|
|
41
42
|
|
|
42
43
|
/** @typedef {import("./AliasPlugin").AliasOption} AliasOptionEntry */
|
|
43
44
|
/** @typedef {import("./ExtensionAliasPlugin").ExtensionAliasOption} ExtensionAliasOption */
|
|
45
|
+
/** @typedef {import("./PackageMapPlugin").PackageMapOptions} PackageMapOptions */
|
|
46
|
+
/** @typedef {import("./util/packageMap").PackageMapPackages} PackageMapPackages */
|
|
44
47
|
/** @typedef {import("./PnpPlugin").PnpApiImpl} PnpApi */
|
|
45
48
|
/** @typedef {import("./Resolver").EnsuredHooks} EnsuredHooks */
|
|
46
49
|
/** @typedef {import("./Resolver").FileSystem} FileSystem */
|
|
@@ -67,9 +70,21 @@ const { PathType, getType, toPath } = require("./util/path");
|
|
|
67
70
|
|
|
68
71
|
/**
|
|
69
72
|
* @typedef {object} UserTsconfigOptions
|
|
70
|
-
* @property {(string | URL)=} configFile A path, or `file:`
|
|
71
|
-
* @property {((string | URL)[] | "auto")=} references References to other tsconfig files. 'auto' inherits from TypeScript config, or an array of relative/absolute paths or `file:`
|
|
72
|
-
* @property {(string | URL)=} baseUrl Override baseUrl from tsconfig.json with a path or `file:`
|
|
73
|
+
* @property {(string | URL)=} configFile A path, or `file:` URL, pointing at the tsconfig file
|
|
74
|
+
* @property {((string | URL)[] | "auto")=} references References to other tsconfig files. 'auto' inherits from TypeScript config, or an array of relative/absolute paths or `file:` URLs
|
|
75
|
+
* @property {(string | URL)=} baseUrl Override baseUrl from tsconfig.json with a path or `file:` URL
|
|
76
|
+
*/
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* A Node.js package map (https://nodejs.org/api/packages.html#package-maps),
|
|
80
|
+
* either as the path of the configuration file or as its already-parsed
|
|
81
|
+
* contents.
|
|
82
|
+
* @experimental Package maps are stability 1 (experimental) in Node.js and are
|
|
83
|
+
* only reachable there behind `--experimental-package-map`. This option tracks
|
|
84
|
+
* that specification and may change with it, including in a patch release.
|
|
85
|
+
* @typedef {object} UserPackageMapOptions
|
|
86
|
+
* @property {(string | URL)=} configFile A path, or `file:` `URL` instance, pointing at the package map file. Required together with `packages`, whose relative `url` values are resolved against it
|
|
87
|
+
* @property {PackageMapPackages=} packages An already-parsed `packages` object, used instead of reading `configFile` from disk
|
|
73
88
|
*/
|
|
74
89
|
|
|
75
90
|
/**
|
|
@@ -91,19 +106,20 @@ const { PathType, getType, toPath } = require("./util/path");
|
|
|
91
106
|
* @property {(Cache | boolean)=} unsafeCache Use this cache object to unsafely cache the successful requests
|
|
92
107
|
* @property {boolean=} symlinks Resolve symlinks to their symlinked location
|
|
93
108
|
* @property {Resolver=} resolver A prepared Resolver to which the plugins are attached
|
|
94
|
-
* @property {(string | URL)[] | string | URL=} modules A list of directories to resolve modules from, can be absolute path, folder name, or a `file:`
|
|
109
|
+
* @property {(string | URL)[] | string | URL=} modules A list of directories to resolve modules from, can be absolute path, folder name, or a `file:` URL
|
|
95
110
|
* @property {(string | string[] | { name: string | string[], forceRelative: boolean })[]=} mainFields A list of main fields in description files
|
|
96
111
|
* @property {string[]=} mainFiles A list of main files in directories
|
|
97
112
|
* @property {Plugin[]=} plugins A list of additional resolve plugins which should be applied
|
|
113
|
+
* @property {(string | URL | UserPackageMapOptions)=} packageMap A Node.js package map file path (or `file:` `URL` instance), or an object with the already-parsed `packages`. When set, bare specifiers resolve through the map instead of `node_modules` (`@experimental`)
|
|
98
114
|
* @property {PnpApi | null=} pnpApi A PnP API that should be used - null is "never", undefined is "auto"
|
|
99
|
-
* @property {(string | URL)[]=} roots A list of root paths, each an absolute path or a `file:`
|
|
115
|
+
* @property {(string | URL)[]=} roots A list of root paths, each an absolute path or a `file:` URL
|
|
100
116
|
* @property {boolean=} fullySpecified The request is already fully specified and no extensions or directories are resolved for it
|
|
101
117
|
* @property {boolean=} resolveToContext Resolve to a context instead of a file
|
|
102
|
-
* @property {(string | URL | RegExp)[]=} restrictions A list of resolve restrictions, each an absolute path, a `file:`
|
|
118
|
+
* @property {(string | URL | RegExp)[]=} restrictions A list of resolve restrictions, each an absolute path, a `file:` URL, or a RegExp
|
|
103
119
|
* @property {boolean=} useSyncFileSystemCalls Use only the sync constraints of the file system calls
|
|
104
120
|
* @property {boolean=} preferRelative Prefer to resolve module requests as relative requests before falling back to modules
|
|
105
121
|
* @property {boolean=} preferAbsolute Prefer to resolve server-relative urls as absolute paths before falling back to resolve in roots
|
|
106
|
-
* @property {string | URL | boolean | UserTsconfigOptions=} tsconfig TypeScript config file path (or `file:`
|
|
122
|
+
* @property {string | URL | boolean | UserTsconfigOptions=} tsconfig TypeScript config file path (or `file:` URL) or config object with configFile and references
|
|
107
123
|
*/
|
|
108
124
|
|
|
109
125
|
/**
|
|
@@ -129,6 +145,7 @@ const { PathType, getType, toPath } = require("./util/path");
|
|
|
129
145
|
* @property {{ name: string[], forceRelative: boolean }[]} mainFields main fields
|
|
130
146
|
* @property {Set<string>} mainFiles main files
|
|
131
147
|
* @property {Plugin[]} plugins plugins
|
|
148
|
+
* @property {PackageMapOptions | null} packageMap package map
|
|
132
149
|
* @property {PnpApi | null} pnpApi pnp API
|
|
133
150
|
* @property {Set<string>} roots roots
|
|
134
151
|
* @property {boolean} fullySpecified fully specified
|
|
@@ -176,7 +193,7 @@ function processPnpApiOption(option) {
|
|
|
176
193
|
|
|
177
194
|
/**
|
|
178
195
|
* @param {UserAliasOptionNewRequest} alias alias target(s)
|
|
179
|
-
* @returns {AliasOptionNewRequest} target(s) with file
|
|
196
|
+
* @returns {AliasOptionNewRequest} target(s) with `file:` URLs converted to paths
|
|
180
197
|
*/
|
|
181
198
|
function toPathAlias(alias) {
|
|
182
199
|
if (alias === false) return false;
|
|
@@ -211,9 +228,68 @@ function normalizeAlias(alias) {
|
|
|
211
228
|
: [];
|
|
212
229
|
}
|
|
213
230
|
|
|
231
|
+
/**
|
|
232
|
+
* @param {string | URL} configFile the `packageMap` configuration file option
|
|
233
|
+
* @returns {string} the absolute path of the configuration file
|
|
234
|
+
*/
|
|
235
|
+
function toPackageMapConfigFile(configFile) {
|
|
236
|
+
const file = toPath(configFile);
|
|
237
|
+
const type = getType(file);
|
|
238
|
+
|
|
239
|
+
if (type === PathType.AbsolutePosix || type === PathType.AbsoluteWin) {
|
|
240
|
+
return file;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// The configuration file is the base every package `url` resolves against,
|
|
244
|
+
// so it has to be absolute before it is turned into a URL. Relative paths
|
|
245
|
+
// are taken from the working directory, like `tsconfig` — where there is no
|
|
246
|
+
// working directory to take them from (the resolver also runs in browsers),
|
|
247
|
+
// say so instead of silently resolving against the filesystem root.
|
|
248
|
+
if (typeof cwd !== "function") {
|
|
249
|
+
throw new Error(
|
|
250
|
+
"The 'packageMap' option needs an absolute 'configFile' in an environment without a working directory",
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
return join(cwd(), file);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* @param {string | URL | UserPackageMapOptions | undefined} packageMap package map option
|
|
259
|
+
* @returns {PackageMapOptions | null} normalized package map, or `null` when the option is unset
|
|
260
|
+
*/
|
|
261
|
+
function normalizePackageMap(packageMap) {
|
|
262
|
+
if (packageMap === undefined) return null;
|
|
263
|
+
if (typeof packageMap === "string" || packageMap instanceof URL) {
|
|
264
|
+
return { configFile: toPackageMapConfigFile(packageMap), packages: null };
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
const { configFile, packages } = packageMap;
|
|
268
|
+
|
|
269
|
+
// Relative `url` values are resolved against the configuration file, so an
|
|
270
|
+
// inline `packages` object still needs to say where it would have lived.
|
|
271
|
+
// There is no working directory to fall back on: the resolver runs in
|
|
272
|
+
// browsers too.
|
|
273
|
+
if (packages !== undefined && configFile === undefined) {
|
|
274
|
+
throw new Error(
|
|
275
|
+
"The 'packageMap' option needs a 'configFile' next to 'packages' to resolve the package urls against",
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
if (configFile === undefined) {
|
|
279
|
+
throw new Error(
|
|
280
|
+
"The 'packageMap' option needs either a 'configFile' or 'packages'",
|
|
281
|
+
);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
return {
|
|
285
|
+
configFile: toPackageMapConfigFile(configFile),
|
|
286
|
+
packages: packages === undefined ? null : packages,
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
|
|
214
290
|
/**
|
|
215
291
|
* @param {string | URL | boolean | UserTsconfigOptions | undefined} tsconfig tsconfig option
|
|
216
|
-
* @returns {string | boolean | TsconfigOptions} normalized tsconfig with file
|
|
292
|
+
* @returns {string | boolean | TsconfigOptions} normalized tsconfig with `file:` URLs converted to paths
|
|
217
293
|
*/
|
|
218
294
|
function normalizeTsconfig(tsconfig) {
|
|
219
295
|
if (tsconfig === undefined) return false;
|
|
@@ -356,6 +432,7 @@ function createOptions(options) {
|
|
|
356
432
|
mainFields,
|
|
357
433
|
mainFiles: new Set(options.mainFiles || ["index"]),
|
|
358
434
|
plugins: options.plugins || [],
|
|
435
|
+
packageMap: normalizePackageMap(options.packageMap),
|
|
359
436
|
pnpApi: processPnpApiOption(options.pnpApi),
|
|
360
437
|
roots: new Set(options.roots ? options.roots.map(toPath) : undefined),
|
|
361
438
|
fullySpecified: options.fullySpecified || false,
|
|
@@ -396,6 +473,7 @@ module.exports.createResolver = function createResolver(options) {
|
|
|
396
473
|
mainFields,
|
|
397
474
|
mainFiles,
|
|
398
475
|
modules,
|
|
476
|
+
packageMap,
|
|
399
477
|
plugins: userPlugins,
|
|
400
478
|
pnpApi,
|
|
401
479
|
resolveToContext,
|
|
@@ -576,6 +654,21 @@ module.exports.createResolver = function createResolver(options) {
|
|
|
576
654
|
plugins.push(new NextPlugin("imports-field-relative", "relative"));
|
|
577
655
|
|
|
578
656
|
// raw-module
|
|
657
|
+
// A package map is authoritative for every bare specifier that is not a
|
|
658
|
+
// builtin, so it runs ahead of both self-reference and the `modules`
|
|
659
|
+
// directories below: a package that does not declare a dependency on
|
|
660
|
+
// itself must not reach its own `exports` through the self-reference
|
|
661
|
+
// shortcut, and nothing falls back to `node_modules`.
|
|
662
|
+
if (packageMap) {
|
|
663
|
+
plugins.push(
|
|
664
|
+
new PackageMapPlugin(
|
|
665
|
+
"raw-module",
|
|
666
|
+
packageMap,
|
|
667
|
+
symlinks,
|
|
668
|
+
"undescribed-resolve-in-package",
|
|
669
|
+
),
|
|
670
|
+
);
|
|
671
|
+
}
|
|
579
672
|
for (const exportsField of exportsFields) {
|
|
580
673
|
plugins.push(
|
|
581
674
|
new SelfReferencePlugin("raw-module", exportsField, "resolve-as-module"),
|