zedbee 0.1.0-beta.15 → 0.1.0-beta.17
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 +70 -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-locations.d.ts.map +1 -1
- package/dist/attribution/pair-locations.js +20 -10
- package/dist/attribution/pair-locations.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/store.d.ts +1 -0
- package/dist/cache/store.d.ts.map +1 -1
- package/dist/cache/store.js +2 -0
- package/dist/cache/store.js.map +1 -1
- package/dist/checks/adapter.d.ts +3 -0
- package/dist/checks/adapter.d.ts.map +1 -1
- package/dist/checks/applicability.d.ts.map +1 -1
- package/dist/checks/applicability.js +14 -2
- 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 +26 -0
- package/dist/checks/comparison-context.d.ts.map +1 -0
- package/dist/checks/comparison-context.js +187 -0
- package/dist/checks/comparison-context.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 +39 -2
- 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 +28 -0
- package/dist/checks/diagnostic-details.d.ts.map +1 -0
- package/dist/checks/diagnostic-details.js +442 -0
- package/dist/checks/diagnostic-details.js.map +1 -0
- package/dist/checks/dispatch-cache.d.ts.map +1 -1
- package/dist/checks/dispatch-cache.js +64 -5
- package/dist/checks/dispatch-cache.js.map +1 -1
- package/dist/checks/dispatch-target.d.ts.map +1 -1
- package/dist/checks/dispatch-target.js +6 -0
- package/dist/checks/dispatch-target.js.map +1 -1
- package/dist/checks/dispatcher.d.ts.map +1 -1
- package/dist/checks/dispatcher.js +14 -2
- 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 -7
- 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 +9 -3
- package/dist/checks/eslint/convert-message.js.map +1 -1
- package/dist/checks/eslint/lint-adapter.d.ts.map +1 -1
- package/dist/checks/eslint/lint-adapter.js +7 -0
- package/dist/checks/eslint/lint-adapter.js.map +1 -1
- package/dist/checks/eslint/managed-config.d.ts +3 -0
- package/dist/checks/eslint/managed-config.d.ts.map +1 -1
- package/dist/checks/eslint/managed-config.js +18 -3
- package/dist/checks/eslint/managed-config.js.map +1 -1
- package/dist/checks/eslint/project/adapter.d.ts +3 -0
- package/dist/checks/eslint/project/adapter.d.ts.map +1 -0
- package/dist/checks/eslint/project/adapter.js +143 -0
- package/dist/checks/eslint/project/adapter.js.map +1 -0
- package/dist/checks/eslint/project/diagnostics.d.ts +15 -0
- package/dist/checks/eslint/project/diagnostics.d.ts.map +1 -0
- package/dist/checks/eslint/project/diagnostics.js +38 -0
- package/dist/checks/eslint/project/diagnostics.js.map +1 -0
- package/dist/checks/eslint/project/engine.d.ts +5 -0
- package/dist/checks/eslint/project/engine.d.ts.map +1 -0
- package/dist/checks/eslint/project/engine.js +207 -0
- package/dist/checks/eslint/project/engine.js.map +1 -0
- package/dist/checks/eslint/project/installation.d.ts +3 -0
- package/dist/checks/eslint/project/installation.d.ts.map +1 -0
- package/dist/checks/eslint/project/installation.js +118 -0
- package/dist/checks/eslint/project/installation.js.map +1 -0
- package/dist/checks/eslint/project/protocol.d.ts +6 -0
- package/dist/checks/eslint/project/protocol.d.ts.map +1 -0
- package/dist/checks/eslint/project/protocol.js +90 -0
- package/dist/checks/eslint/project/protocol.js.map +1 -0
- package/dist/checks/eslint/project/trust.d.ts +18 -0
- package/dist/checks/eslint/project/trust.d.ts.map +1 -0
- package/dist/checks/eslint/project/trust.js +93 -0
- package/dist/checks/eslint/project/trust.js.map +1 -0
- package/dist/checks/eslint/project/types.d.ts +53 -0
- package/dist/checks/eslint/project/types.d.ts.map +1 -0
- package/dist/checks/eslint/project/types.js +24 -0
- package/dist/checks/eslint/project/types.js.map +1 -0
- package/dist/checks/eslint/project/worker.d.ts +2 -0
- package/dist/checks/eslint/project/worker.d.ts.map +1 -0
- package/dist/checks/eslint/project/worker.js +89 -0
- package/dist/checks/eslint/project/worker.js.map +1 -0
- package/dist/checks/eslint/project/workspace.d.ts +7 -0
- package/dist/checks/eslint/project/workspace.d.ts.map +1 -0
- package/dist/checks/eslint/project/workspace.js +100 -0
- package/dist/checks/eslint/project/workspace.js.map +1 -0
- package/dist/checks/eslint/rule-settings.d.ts.map +1 -1
- package/dist/checks/eslint/rule-settings.js +2 -2
- package/dist/checks/eslint/rule-settings.js.map +1 -1
- package/dist/checks/observation-result.d.ts.map +1 -1
- package/dist/checks/observation-result.js +89 -9
- package/dist/checks/observation-result.js.map +1 -1
- package/dist/checks/policy-scheduling.d.ts.map +1 -1
- package/dist/checks/policy-scheduling.js +6 -0
- package/dist/checks/policy-scheduling.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 +10 -1
- package/dist/checks/project-inputs.js.map +1 -1
- package/dist/checks/react/accessibility-settings.d.ts +14 -0
- package/dist/checks/react/accessibility-settings.d.ts.map +1 -0
- package/dist/checks/react/accessibility-settings.js +37 -0
- package/dist/checks/react/accessibility-settings.js.map +1 -0
- package/dist/checks/react/adapter.d.ts.map +1 -1
- package/dist/checks/react/adapter.js +28 -3
- package/dist/checks/react/adapter.js.map +1 -1
- package/dist/checks/react/config.d.ts +2 -1
- package/dist/checks/react/config.d.ts.map +1 -1
- package/dist/checks/react/config.js +9 -3
- package/dist/checks/react/config.js.map +1 -1
- package/dist/checks/react/managed-accessibility-plugin.d.ts +21 -0
- package/dist/checks/react/managed-accessibility-plugin.d.ts.map +1 -0
- package/dist/checks/react/managed-accessibility-plugin.js +83 -0
- package/dist/checks/react/managed-accessibility-plugin.js.map +1 -0
- package/dist/checks/react/managed-hooks-identity.d.ts +3 -0
- package/dist/checks/react/managed-hooks-identity.d.ts.map +1 -0
- package/dist/checks/react/managed-hooks-identity.js +4 -0
- package/dist/checks/react/managed-hooks-identity.js.map +1 -0
- package/dist/checks/react/managed-hooks-plugin.d.ts +5 -0
- package/dist/checks/react/managed-hooks-plugin.d.ts.map +1 -0
- package/dist/checks/react/managed-hooks-plugin.js +45 -0
- package/dist/checks/react/managed-hooks-plugin.js.map +1 -0
- package/dist/checks/runner/executor.d.ts +2 -0
- package/dist/checks/runner/executor.d.ts.map +1 -1
- package/dist/checks/runner/executor.js +16 -0
- package/dist/checks/runner/executor.js.map +1 -1
- package/dist/checks/runner/protocol.d.ts.map +1 -1
- package/dist/checks/runner/protocol.js +8 -0
- package/dist/checks/runner/protocol.js.map +1 -1
- package/dist/checks/runner/run-job.d.ts +1 -0
- package/dist/checks/runner/run-job.d.ts.map +1 -1
- package/dist/checks/runner/run-job.js +8 -1
- package/dist/checks/runner/run-job.js.map +1 -1
- package/dist/checks/runner/worker-slot.d.ts.map +1 -1
- package/dist/checks/runner/worker-slot.js +17 -1
- package/dist/checks/runner/worker-slot.js.map +1 -1
- package/dist/checks/runner/worker.js +4 -1
- package/dist/checks/runner/worker.js.map +1 -1
- package/dist/checks/sanitize-result.d.ts +4 -0
- package/dist/checks/sanitize-result.d.ts.map +1 -1
- package/dist/checks/sanitize-result.js +45 -0
- package/dist/checks/sanitize-result.js.map +1 -1
- package/dist/checks/secrets/normalize.js +1 -1
- package/dist/checks/secrets/normalize.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/typescript/adapter.d.ts.map +1 -1
- package/dist/checks/typescript/adapter.js +2 -0
- package/dist/checks/typescript/adapter.js.map +1 -1
- package/dist/checks/typescript/compiler-host.d.ts.map +1 -1
- package/dist/checks/typescript/compiler-host.js +2 -0
- package/dist/checks/typescript/compiler-host.js.map +1 -1
- package/dist/checks/typescript/compiler-options-provenance.d.ts +4 -0
- package/dist/checks/typescript/compiler-options-provenance.d.ts.map +1 -0
- package/dist/checks/typescript/compiler-options-provenance.js +13 -0
- package/dist/checks/typescript/compiler-options-provenance.js.map +1 -0
- package/dist/checks/typescript/convert-diagnostic.d.ts.map +1 -1
- package/dist/checks/typescript/convert-diagnostic.js +4 -1
- package/dist/checks/typescript/convert-diagnostic.js.map +1 -1
- package/dist/checks/typescript/project-coverage.d.ts.map +1 -1
- package/dist/checks/typescript/project-coverage.js +19 -2
- package/dist/checks/typescript/project-coverage.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +22 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/checks.d.ts.map +1 -1
- package/dist/commands/checks.js +12 -7
- package/dist/commands/checks.js.map +1 -1
- package/dist/commands/diagnostics.d.ts +1 -0
- package/dist/commands/diagnostics.d.ts.map +1 -1
- package/dist/commands/diagnostics.js +28 -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/init.d.ts +4 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +13 -0
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/scan.d.ts +2 -1
- package/dist/commands/scan.d.ts.map +1 -1
- package/dist/commands/scan.js +10 -0
- package/dist/commands/scan.js.map +1 -1
- package/dist/config/immutable-configuration.d.ts +2 -0
- package/dist/config/immutable-configuration.d.ts.map +1 -0
- package/dist/config/immutable-configuration.js +81 -0
- package/dist/config/immutable-configuration.js.map +1 -0
- package/dist/config/load-config.d.ts.map +1 -1
- package/dist/config/load-config.js +8 -1
- package/dist/config/load-config.js.map +1 -1
- package/dist/config/profiles.d.ts.map +1 -1
- package/dist/config/profiles.js +30 -3
- package/dist/config/profiles.js.map +1 -1
- package/dist/config/schema.d.ts +152 -26
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +47 -3
- package/dist/config/schema.js.map +1 -1
- package/dist/config/settings-registry.d.ts +3 -1
- package/dist/config/settings-registry.d.ts.map +1 -1
- package/dist/config/settings-registry.js +9 -81
- package/dist/config/settings-registry.js.map +1 -1
- package/dist/config/target-policy.d.ts +4 -1
- package/dist/config/target-policy.d.ts.map +1 -1
- package/dist/config/target-policy.js +96 -0
- package/dist/config/target-policy.js.map +1 -1
- package/dist/core/types.d.ts +15 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/diagnostics/scan-performance.d.ts +50 -0
- package/dist/diagnostics/scan-performance.d.ts.map +1 -0
- package/dist/diagnostics/scan-performance.js +153 -0
- package/dist/diagnostics/scan-performance.js.map +1 -0
- package/dist/doctor/diagnostics.d.ts +2 -1
- package/dist/doctor/diagnostics.d.ts.map +1 -1
- package/dist/doctor/diagnostics.js +5 -0
- package/dist/doctor/diagnostics.js.map +1 -1
- package/dist/doctor/project-eslint.d.ts +4 -0
- package/dist/doctor/project-eslint.d.ts.map +1 -0
- package/dist/doctor/project-eslint.js +98 -0
- package/dist/doctor/project-eslint.js.map +1 -0
- package/dist/hooks/command.d.ts.map +1 -1
- package/dist/hooks/command.js +2 -4
- package/dist/hooks/command.js.map +1 -1
- package/dist/hooks/husky.d.ts.map +1 -1
- package/dist/hooks/husky.js +7 -1
- package/dist/hooks/husky.js.map +1 -1
- package/dist/hooks/install.d.ts.map +1 -1
- package/dist/hooks/install.js +5 -0
- package/dist/hooks/install.js.map +1 -1
- package/dist/hooks/installed-command.d.ts +11 -0
- package/dist/hooks/installed-command.d.ts.map +1 -0
- package/dist/hooks/installed-command.js +36 -0
- package/dist/hooks/installed-command.js.map +1 -0
- package/dist/init/eslint-setup.d.ts +16 -0
- package/dist/init/eslint-setup.d.ts.map +1 -0
- package/dist/init/eslint-setup.js +98 -0
- package/dist/init/eslint-setup.js.map +1 -0
- package/dist/init/presentation.d.ts +9 -2
- package/dist/init/presentation.d.ts.map +1 -1
- package/dist/init/presentation.js +20 -0
- package/dist/init/presentation.js.map +1 -1
- package/dist/init/recommend.d.ts.map +1 -1
- package/dist/init/recommend.js +28 -0
- package/dist/init/recommend.js.map +1 -1
- package/dist/init/selection-policy.d.ts +4 -0
- package/dist/init/selection-policy.d.ts.map +1 -1
- package/dist/init/selection-policy.js +17 -0
- package/dist/init/selection-policy.js.map +1 -1
- package/dist/init/types.d.ts +14 -0
- package/dist/init/types.d.ts.map +1 -1
- package/dist/init/write-config.d.ts.map +1 -1
- package/dist/init/write-config.js +34 -0
- package/dist/init/write-config.js.map +1 -1
- package/dist/policy/evaluate.d.ts.map +1 -1
- package/dist/policy/evaluate.js +19 -4
- package/dist/policy/evaluate.js.map +1 -1
- package/dist/renderers/json.d.ts.map +1 -1
- package/dist/renderers/json.js +21 -0
- package/dist/renderers/json.js.map +1 -1
- package/dist/renderers/text.d.ts.map +1 -1
- package/dist/renderers/text.js +45 -7
- package/dist/renderers/text.js.map +1 -1
- package/dist/reporting/agent-guidance.d.ts +1 -0
- package/dist/reporting/agent-guidance.d.ts.map +1 -1
- package/dist/reporting/agent-guidance.js +25 -0
- package/dist/reporting/agent-guidance.js.map +1 -1
- package/dist/reporting/check-coverage.d.ts +9 -0
- package/dist/reporting/check-coverage.d.ts.map +1 -0
- package/dist/reporting/check-coverage.js +38 -0
- package/dist/reporting/check-coverage.js.map +1 -0
- 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/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/project-eslint-notices.d.ts +3 -0
- package/dist/reporting/project-eslint-notices.d.ts.map +1 -0
- package/dist/reporting/project-eslint-notices.js +9 -0
- package/dist/reporting/project-eslint-notices.js.map +1 -0
- package/dist/reporting/report-callouts.d.ts +2 -2
- package/dist/reporting/report-callouts.d.ts.map +1 -1
- package/dist/reporting/report-callouts.js +5 -2
- package/dist/reporting/report-callouts.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/source-identity.d.ts +1 -0
- package/dist/reporting/source-identity.d.ts.map +1 -1
- package/dist/reporting/source-identity.js +6 -0
- package/dist/reporting/source-identity.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 +3 -0
- package/dist/scan/analysis-session.d.ts.map +1 -1
- package/dist/scan/analysis-session.js +28 -1
- package/dist/scan/analysis-session.js.map +1 -1
- package/dist/scan/change-summary.d.ts +9 -0
- package/dist/scan/change-summary.d.ts.map +1 -0
- package/dist/scan/change-summary.js +7 -0
- package/dist/scan/change-summary.js.map +1 -0
- package/dist/scan/incomplete-report.d.ts +2 -0
- package/dist/scan/incomplete-report.d.ts.map +1 -1
- package/dist/scan/incomplete-report.js +3 -0
- package/dist/scan/incomplete-report.js.map +1 -1
- package/dist/scan/merge-scan.d.ts.map +1 -1
- package/dist/scan/merge-scan.js +2 -1
- package/dist/scan/merge-scan.js.map +1 -1
- package/dist/scan/report.d.ts +2 -0
- package/dist/scan/report.d.ts.map +1 -1
- package/dist/scan/run-scan.d.ts +3 -0
- package/dist/scan/run-scan.d.ts.map +1 -1
- package/dist/scan/run-scan.js +57 -3
- package/dist/scan/run-scan.js.map +1 -1
- package/dist/scan/source-excerpts.d.ts.map +1 -1
- package/dist/scan/source-excerpts.js +7 -0
- package/dist/scan/source-excerpts.js.map +1 -1
- package/dist/service/client-connection.js +1 -1
- package/dist/service/client-connection.js.map +1 -1
- package/dist/service/client-executor.d.ts.map +1 -1
- package/dist/service/client-executor.js +35 -2
- package/dist/service/client-executor.js.map +1 -1
- package/dist/service/server-connection.d.ts.map +1 -1
- package/dist/service/server-connection.js +11 -2
- package/dist/service/server-connection.js.map +1 -1
- package/dist/telemetry/client.d.ts +5 -1
- package/dist/telemetry/client.d.ts.map +1 -1
- package/dist/telemetry/client.js +20 -3
- package/dist/telemetry/client.js.map +1 -1
- package/dist/telemetry/details-store.d.ts +8 -4
- package/dist/telemetry/details-store.d.ts.map +1 -1
- package/dist/telemetry/details-store.js +28 -5
- package/dist/telemetry/details-store.js.map +1 -1
- package/dist/telemetry/performance-summary.d.ts +7 -0
- package/dist/telemetry/performance-summary.d.ts.map +1 -0
- package/dist/telemetry/performance-summary.js +49 -0
- package/dist/telemetry/performance-summary.js.map +1 -0
- package/dist/telemetry/schema.d.ts +813 -166
- package/dist/telemetry/schema.d.ts.map +1 -1
- package/dist/telemetry/schema.js +78 -0
- package/dist/telemetry/schema.js.map +1 -1
- package/dist/telemetry/state.d.ts +12 -12
- package/dist/ui/init-app.d.ts.map +1 -1
- package/dist/ui/init-app.js +41 -1
- package/dist/ui/init-app.js.map +1 -1
- package/dist/ui/init-view.d.ts.map +1 -1
- package/dist/ui/init-view.js +14 -4
- package/dist/ui/init-view.js.map +1 -1
- package/dist/ui/outcome-strip.d.ts.map +1 -1
- package/dist/ui/outcome-strip.js +7 -3
- package/dist/ui/outcome-strip.js.map +1 -1
- package/dist/ui/scan-app.d.ts.map +1 -1
- package/dist/ui/scan-app.js +2 -1
- package/dist/ui/scan-app.js.map +1 -1
- package/dist/ui/scan-result-dashboard.d.ts.map +1 -1
- package/dist/ui/scan-result-dashboard.js +7 -6
- package/dist/ui/scan-result-dashboard.js.map +1 -1
- package/dist/vendor/react-hooks/7.1.1/LICENSE +21 -0
- package/dist/vendor/react-hooks/7.1.1/development.cjs +55824 -0
- package/dist/vendor/react-hooks/7.1.1/index.cjs +2 -0
- package/dist/vendor/react-hooks/7.1.1/production.cjs +55649 -0
- package/dist/vendor/react-hooks/7.1.1/provenance.json +26 -0
- package/docs/checks.md +213 -4
- package/docs/cli-reference.md +28 -1
- package/docs/privacy.md +31 -1
- package/docs/react-analysis.md +66 -0
- package/docs/reporting.md +52 -1
- package/docs/support.md +23 -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 +12 -6
- package/plugins/swarm/references/scan.md +2 -0
- package/schema/zedbee.schema.json +146 -3
- 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
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _TRAILING_WILD_CARD_R;
|
|
4
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
5
4
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
6
5
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
7
6
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
7
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
8
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
9
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
9
10
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
11
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
11
12
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
12
13
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
13
14
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
15
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
16
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
17
15
|
// A simple implementation of make-array
|
|
18
16
|
function makeArray(subject) {
|
|
19
17
|
return Array.isArray(subject) ? subject : [subject];
|
|
@@ -22,8 +20,14 @@ var UNDEFINED = undefined;
|
|
|
22
20
|
var EMPTY = '';
|
|
23
21
|
var SPACE = ' ';
|
|
24
22
|
var ESCAPE = '\\';
|
|
25
|
-
|
|
23
|
+
|
|
24
|
+
// The characters that carry a meaning of their own inside a regular
|
|
25
|
+
// expression, so a literal one has to be escaped before it is emitted.
|
|
26
|
+
var REGEX_LITERAL_SPECIAL = /[.*+?()[\]{}^$|\\/]/;
|
|
27
|
+
var BOM = "\uFEFF";
|
|
26
28
|
var REGEX_INVALID_TRAILING_BACKSLASH = /(?:[^\\]|^)\\$/;
|
|
29
|
+
// A run of two or more asterisks is a globstar (#175)
|
|
30
|
+
var REGEX_ANCHORED_GLOBSTAR = /^\/\*{2,}$/;
|
|
27
31
|
var REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/;
|
|
28
32
|
var REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/;
|
|
29
33
|
var REGEX_SPLITALL_CRLF = /\r?\n/g;
|
|
@@ -36,8 +40,9 @@ var REGEX_SPLITALL_CRLF = /\r?\n/g;
|
|
|
36
40
|
// - ..
|
|
37
41
|
// Valid:
|
|
38
42
|
// - .foo
|
|
39
|
-
var
|
|
40
|
-
var
|
|
43
|
+
var DOUBLE_SLASH = '//';
|
|
44
|
+
var SLASH_CODE = 47;
|
|
45
|
+
var DOT_CODE = 46;
|
|
41
46
|
var SLASH = '/';
|
|
42
47
|
|
|
43
48
|
// Do not use ternary expression here, since "istanbul ignore next" is buggy
|
|
@@ -53,37 +58,295 @@ var define = function define(object, key, value) {
|
|
|
53
58
|
});
|
|
54
59
|
return value;
|
|
55
60
|
};
|
|
56
|
-
var REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g;
|
|
57
61
|
var RETURN_FALSE = function RETURN_FALSE() {
|
|
58
62
|
return false;
|
|
59
63
|
};
|
|
60
64
|
|
|
61
|
-
//
|
|
62
|
-
//
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
// > The range notation, e.g. [a-zA-Z],
|
|
66
|
+
// > can be used to match one of the characters in a range.
|
|
67
|
+
//
|
|
68
|
+
// gitignore(5) defers to fnmatch(3) for this, and git implements it in
|
|
69
|
+
// `wildmatch.c`. A bracket expression has a sub-grammar of its own, which
|
|
70
|
+
// is neither the surrounding pattern grammar nor the JavaScript one:
|
|
71
|
+
//
|
|
72
|
+
// - a `]` right after `[` or `[!` is a literal member, not the terminator
|
|
73
|
+
// - `[:alpha:]` names one of twelve POSIX classes
|
|
74
|
+
// - `\` escapes the next member, `]` included
|
|
75
|
+
// - `*`, `?` and `.` are plain literal members
|
|
76
|
+
// - an unterminated expression makes the whole pattern match nothing
|
|
77
|
+
//
|
|
78
|
+
// which means the expression can not be located -- let alone translated -- by
|
|
79
|
+
// a regular expression. It is scanned out of the pattern before the
|
|
80
|
+
// replacers below run, and put back once they are done, so that neither the
|
|
81
|
+
// metacharacter escaper nor the `?` / `*` replacers ever see its body.
|
|
82
|
+
|
|
83
|
+
// git classifies with its own ASCII-only ctype macros (`wildmatch.c`), never
|
|
84
|
+
// with the C library ones, so these must not be mapped onto `\d` / `\w` /
|
|
85
|
+
// `\s`, which are wider. `/` is left out of every expansion, because a
|
|
86
|
+
// bracket expression never matches a path separator.
|
|
87
|
+
var POSIX_CLASSES = {
|
|
88
|
+
alnum: '0-9A-Za-z',
|
|
89
|
+
alpha: 'A-Za-z',
|
|
90
|
+
blank: ' \\t',
|
|
91
|
+
cntrl: '\\x00-\\x1f\\x7f',
|
|
92
|
+
digit: '0-9',
|
|
93
|
+
graph: '!-.0-~',
|
|
94
|
+
lower: 'a-z',
|
|
95
|
+
print: ' -.0-~',
|
|
96
|
+
punct: '!-.:-@\\[-`{-~',
|
|
97
|
+
// git's `sane-ctype.h` classifies \v and \f as control, not space,
|
|
98
|
+
// unlike C's `isspace`
|
|
99
|
+
space: ' \\t\\n\\r',
|
|
100
|
+
upper: 'A-Z',
|
|
101
|
+
xdigit: '0-9A-Fa-f'
|
|
102
|
+
};
|
|
103
|
+
var CLASS_MEMBERS_TO_ESCAPE = '\\]^-[';
|
|
104
|
+
var escapeMember = function escapeMember(_char) {
|
|
105
|
+
return CLASS_MEMBERS_TO_ESCAPE.indexOf(_char) < 0 ? _char : ESCAPE + _char;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
// > if (matched == negated || ((flags & WM_PATHNAME) && text_ch == '/'))
|
|
109
|
+
// > return WM_ABORT_TO_STARSTAR; (git, `wildmatch.c`)
|
|
110
|
+
// A bracket expression never matches a path separator, whatever its members
|
|
111
|
+
// say, so a negated class gets `/` as one more excluded character, while a
|
|
112
|
+
// plain one -- where a literal member or a range could still let `/` in --
|
|
113
|
+
// is guarded with a lookahead, `/` being impossible to subtract from a
|
|
114
|
+
// JavaScript character class.
|
|
115
|
+
var NON_SLASH = '(?!\\/)';
|
|
116
|
+
var classSource = function classSource(negated, body) {
|
|
117
|
+
if (negated) {
|
|
118
|
+
return "[^\\/".concat(body, "]");
|
|
119
|
+
}
|
|
120
|
+
var source = "[".concat(body, "]");
|
|
121
|
+
return new RegExp(source).test('/') ? NON_SLASH + source : source;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
// Scan the bracket expression that starts at `pattern[start] === '['`,
|
|
125
|
+
// mirroring the member loop of git's `wildmatch.c`.
|
|
126
|
+
// @returns {{end: number, source: string} | null} `null` if the expression is
|
|
127
|
+
// never terminated, which makes the whole pattern match nothing.
|
|
128
|
+
var scanBracket = function scanBracket(pattern, start) {
|
|
129
|
+
var length = pattern.length;
|
|
130
|
+
var index = start + 1;
|
|
131
|
+
var negated = EMPTY;
|
|
132
|
+
var lead = pattern[index];
|
|
133
|
+
if (lead === '!' || lead === '^') {
|
|
134
|
+
negated = '^';
|
|
135
|
+
index++;
|
|
136
|
+
}
|
|
137
|
+
var body = EMPTY;
|
|
138
|
+
|
|
139
|
+
// The member a `-` could start a range from, or EMPTY when the previous
|
|
140
|
+
// member can not open one (start of the body, or a range / POSIX class
|
|
141
|
+
// that has just closed)
|
|
142
|
+
var prev = EMPTY;
|
|
143
|
+
|
|
144
|
+
// git scans the members with a do-while, so the first one is consumed
|
|
145
|
+
// unconditionally. That is the whole reason a leading `]` is a member
|
|
146
|
+
// and not the terminator.
|
|
147
|
+
for (;;) {
|
|
148
|
+
var _char2 = pattern[index];
|
|
149
|
+
if (_char2 === UNDEFINED) {
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
if (_char2 === ESCAPE) {
|
|
153
|
+
var escaped = pattern[index + 1];
|
|
154
|
+
if (escaped === UNDEFINED) {
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
body += escapeMember(escaped);
|
|
158
|
+
prev = escaped;
|
|
159
|
+
index++;
|
|
160
|
+
} else if (_char2 === '-' && prev && index + 1 < length && pattern[index + 1] !== ']') {
|
|
161
|
+
index++;
|
|
162
|
+
var to = pattern[index];
|
|
163
|
+
if (to === ESCAPE) {
|
|
164
|
+
// A pattern can not end on a lone backslash -- `checkPattern` has
|
|
165
|
+
// already thrown it away -- so there is an upper bound to read.
|
|
166
|
+
to = pattern[index += 1];
|
|
167
|
+
}
|
|
168
|
+
// An out-of-order range matches nothing in git but is a syntax error in
|
|
169
|
+
// JavaScript, so it is dropped. Its lower bound stays: git tests it
|
|
170
|
+
// as a plain member before it ever looks at the `-`, so `[c-a]` does
|
|
171
|
+
// match `c`.
|
|
172
|
+
if (prev <= to) {
|
|
173
|
+
body += "-".concat(escapeMember(to));
|
|
174
|
+
}
|
|
175
|
+
prev = EMPTY;
|
|
176
|
+
} else if (_char2 === '[' && pattern[index + 1] === ':') {
|
|
177
|
+
var nameStart = index + 2;
|
|
178
|
+
var end = nameStart;
|
|
179
|
+
while (end < length && pattern[end] !== ']') {
|
|
180
|
+
end++;
|
|
181
|
+
}
|
|
182
|
+
if (end === length) {
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
if (end > nameStart && pattern[end - 1] === ':') {
|
|
186
|
+
var name = pattern.slice(nameStart, end - 1);
|
|
187
|
+
|
|
188
|
+
// An unknown class name makes the whole pattern match nothing
|
|
189
|
+
if (!Object.prototype.hasOwnProperty.call(POSIX_CLASSES, name)) {
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
body += POSIX_CLASSES[name];
|
|
193
|
+
prev = EMPTY;
|
|
194
|
+
index = end;
|
|
195
|
+
} else {
|
|
196
|
+
// No `:]` to close it, so the `[` is a plain member and scanning
|
|
197
|
+
// resumes right after it.
|
|
198
|
+
body += escapeMember('[');
|
|
199
|
+
prev = '[';
|
|
200
|
+
index = nameStart - 2;
|
|
201
|
+
}
|
|
202
|
+
} else {
|
|
203
|
+
body += escapeMember(_char2);
|
|
204
|
+
prev = _char2;
|
|
205
|
+
}
|
|
206
|
+
index++;
|
|
207
|
+
if (pattern[index] === ']') {
|
|
208
|
+
return {
|
|
209
|
+
end: index,
|
|
210
|
+
source: classSource(negated, body)
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
}
|
|
70
214
|
};
|
|
71
215
|
|
|
72
|
-
//
|
|
73
|
-
//
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
//
|
|
77
|
-
|
|
78
|
-
|
|
216
|
+
// An empty JavaScript class can never match, which is how a pattern that git
|
|
217
|
+
// gives up on (`WM_ABORT_ALL`) is expressed here.
|
|
218
|
+
var NEVER_MATCH = '[]';
|
|
219
|
+
|
|
220
|
+
// A NUL can appear in neither a `.gitignore` line nor a path, which makes it
|
|
221
|
+
// the one safe placeholder character. A literal one in the pattern is
|
|
222
|
+
// held aside all the same, so a collision is impossible by construction.
|
|
223
|
+
var PLACEHOLDER = "\0";
|
|
224
|
+
var REGEX_RESTORE_PLACEHOLDER = new RegExp("".concat(PLACEHOLDER, "(\\d+)").concat(PLACEHOLDER), 'g');
|
|
225
|
+
|
|
226
|
+
// The one wildcard the chain does not expand for itself is a trailing `*`. How
|
|
227
|
+
// it expands depends on the mode (`regex` vs `checkRegex`), so `_make` is
|
|
228
|
+
// left to do it, and until then the pending wildcard travels as this marker.
|
|
229
|
+
// That is what keeps it apart from a user-escaped literal `\*`: the unescape
|
|
230
|
+
// steps collapse the escaped one to the exact `\*` a wildcard would leave
|
|
231
|
+
// behind, so by the time `_make` runs the two are otherwise the same string
|
|
232
|
+
// and a literal star gets wrongly rewritten into a wildcard. The marker is a
|
|
233
|
+
// private-use character, and `extractBrackets` keeps one that came out of the
|
|
234
|
+
// pattern apart from it, so the only marker `_make` ever turns back into a
|
|
235
|
+
// real wildcard is the one this chain put there itself.
|
|
236
|
+
var TRAILING_WILDCARD = "\uE000";
|
|
237
|
+
|
|
238
|
+
// A trailing "/**" is deferred the same way, because `checkRegex` has to tell
|
|
239
|
+
// it apart from a trailing "/*" (see `checkSourceOf`). For `.ignores()` it
|
|
240
|
+
// still never matches the folder itself (#21).
|
|
241
|
+
var TRAILING_DOUBLESTAR = "\uE001";
|
|
242
|
+
|
|
243
|
+
// The three characters above mean something to the chain that builds the
|
|
244
|
+
// source rather than to the path, so one that came out of the pattern is
|
|
245
|
+
// held aside like a bracket expression instead of going straight out. Being
|
|
246
|
+
// held is what makes it safe: the restore runs after the step that anchors
|
|
247
|
+
// the source, so the character comes back in the middle of the source and
|
|
248
|
+
// not at its end, which is the one place `_make` and `checkSourceOf` look
|
|
249
|
+
// for a marker. Without it a pattern's own character lands where a pending
|
|
250
|
+
// marker sits, and `_make` turns it into a real trailing wildcard.
|
|
251
|
+
//
|
|
252
|
+
// It is held as a one-member class rather than bare, in both of the branches
|
|
253
|
+
// a reserved character can reach, so that the property can be
|
|
254
|
+
// read off this function alone -- a reserved character never goes out on
|
|
255
|
+
// its own -- rather than depending on where in the chain the restore
|
|
256
|
+
// happens to run. In the expression built here `[x]` matches exactly what
|
|
257
|
+
// `x` matches, none of the three being special to a regular expression or
|
|
258
|
+
// inside a class, so no test can tell the two apart: the class is insurance,
|
|
259
|
+
// and the paragraph above is the reason it is not needed.
|
|
260
|
+
var isReserved = function isReserved(_char3) {
|
|
261
|
+
return _char3 === PLACEHOLDER || _char3 === TRAILING_WILDCARD || _char3 === TRAILING_DOUBLESTAR;
|
|
79
262
|
};
|
|
80
263
|
|
|
81
|
-
//
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
264
|
+
// Replace every bracket expression with a placeholder the replacers below
|
|
265
|
+
// leave alone, and translate it separately.
|
|
266
|
+
var extractBrackets = function extractBrackets(pattern) {
|
|
267
|
+
var sources = [];
|
|
268
|
+
var hold = function hold(source) {
|
|
269
|
+
return "".concat(PLACEHOLDER).concat(sources.push(source) - 1).concat(PLACEHOLDER);
|
|
270
|
+
};
|
|
271
|
+
var length = pattern.length;
|
|
272
|
+
var out = EMPTY;
|
|
273
|
+
var index = 0;
|
|
274
|
+
while (index < length) {
|
|
275
|
+
var _char4 = pattern[index];
|
|
276
|
+
if (_char4 === ESCAPE) {
|
|
277
|
+
// > Put a backslash ("\") in front of ... a character to make it literal.
|
|
278
|
+
// (gitignore(5) -> fnmatch(3))
|
|
279
|
+
// A backslash quotes the next character, whatever it is, so `\d` is a
|
|
280
|
+
// literal `d`, not the regex digit class, and `\?` is a literal `?`,
|
|
281
|
+
// not a wildcard. Held aside as its literal here, the escape never
|
|
282
|
+
// reaches the replacers below, which would otherwise let `\d`, `\b`,
|
|
283
|
+
// `\1`, `\/` keep their regular-expression meaning, and would turn a
|
|
284
|
+
// `\?` into `[^\/]`.
|
|
285
|
+
//
|
|
286
|
+
// Three escapes are still left for the chain: `\*` (a literal star,
|
|
287
|
+
// told apart from a wildcard by `TRAILING_WILDCARD` and the wildcard
|
|
288
|
+
// replacers), `\[` (a literal bracket, the one `[` the bracket
|
|
289
|
+
// replacer still expects), and `\ ` (a quoted space, which one pass
|
|
290
|
+
// below rewrites in bulk -- holding each one aside instead costs more
|
|
291
|
+
// on a pattern built out of them). A lone trailing backslash can reach
|
|
292
|
+
// here after line-ending cleanup.
|
|
293
|
+
//
|
|
294
|
+
// A quoted backslash is not among them. The chain doubles every
|
|
295
|
+
// backslash, then takes the doubling back out again, and a quoted one
|
|
296
|
+
// standing next to a character the chain also escapes left the two
|
|
297
|
+
// counts sharing a run, so one of the escapes was lost. Held here as
|
|
298
|
+
// the literal it means, it never joins that run.
|
|
299
|
+
var escaped = pattern[index + 1];
|
|
300
|
+
if (escaped === UNDEFINED || escaped === SLASH && index + 2 === length) {
|
|
301
|
+
// Git removes a final directory slash before matching. An escape
|
|
302
|
+
// without a character after that removal makes the pattern invalid.
|
|
303
|
+
out += hold(NEVER_MATCH);
|
|
304
|
+
} else if (escaped === '*' || escaped === '[' || escaped === SPACE) {
|
|
305
|
+
out += pattern.slice(index, index + 2);
|
|
306
|
+
} else {
|
|
307
|
+
out += hold(REGEX_LITERAL_SPECIAL.test(escaped) ? ESCAPE + escaped : isReserved(escaped) ? "[".concat(escaped, "]") : escaped);
|
|
308
|
+
}
|
|
309
|
+
index += 2;
|
|
310
|
+
} else if (isReserved(_char4)) {
|
|
311
|
+
out += hold("[".concat(_char4, "]"));
|
|
312
|
+
index++;
|
|
313
|
+
} else if (_char4 === '[') {
|
|
314
|
+
var scanned = scanBracket(pattern, index);
|
|
315
|
+
if (scanned === null) {
|
|
316
|
+
// git gives up on the whole pattern (`WM_ABORT_ALL`), so whatever
|
|
317
|
+
// follows can not make it match either.
|
|
318
|
+
out += hold(NEVER_MATCH);
|
|
319
|
+
index = length;
|
|
320
|
+
} else {
|
|
321
|
+
out += hold(scanned.source);
|
|
322
|
+
index = scanned.end + 1;
|
|
323
|
+
}
|
|
324
|
+
} else {
|
|
325
|
+
out += _char4;
|
|
326
|
+
index++;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
return {
|
|
330
|
+
source: out,
|
|
331
|
+
sources: sources
|
|
332
|
+
};
|
|
85
333
|
};
|
|
86
334
|
|
|
335
|
+
// A step of the chain below is normally a `[matcher, replacer]` pair handed
|
|
336
|
+
// to `String.replace`. `DIRECT` marks the ones that are plain string work
|
|
337
|
+
// instead, and take `(source, pattern)`.
|
|
338
|
+
//
|
|
339
|
+
// Anchoring the two ends is exactly that -- a test of one character and a
|
|
340
|
+
// concatenation -- and putting it through the regular expression engine
|
|
341
|
+
// cost a third of this chain for nothing: 167ns where 10ns does the same
|
|
342
|
+
// job. The two are still steps in the same list, in the same places,
|
|
343
|
+
// because their position in the order is part of what they mean.
|
|
344
|
+
var DIRECT = null;
|
|
345
|
+
|
|
346
|
+
// A separator at the beginning or in the middle of a pattern, as opposed to
|
|
347
|
+
// one at the very end.
|
|
348
|
+
var REGEX_INNER_SLASH = /\/(?!$)/;
|
|
349
|
+
|
|
87
350
|
// > If the pattern ends with a slash,
|
|
88
351
|
// > it is removed for the purpose of the following description,
|
|
89
352
|
// > but it would only find a match with a directory.
|
|
@@ -95,30 +358,48 @@ var cleanRangeBackSlash = function cleanRangeBackSlash(slashes) {
|
|
|
95
358
|
// you could use option `mark: true` with `glob`
|
|
96
359
|
|
|
97
360
|
// '`foo/`' should not continue with the '`..`'
|
|
98
|
-
|
|
99
|
-
//
|
|
100
|
-
//
|
|
101
|
-
//
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
//
|
|
106
|
-
|
|
107
|
-
//
|
|
108
|
-
//
|
|
109
|
-
//
|
|
110
|
-
//
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
361
|
+
// The chain that turns one gitignore pattern into a regular expression
|
|
362
|
+
// source, in order. A step is either
|
|
363
|
+
//
|
|
364
|
+
// [matcher, replacer] handed to `String.replace`
|
|
365
|
+
// [matcher, replacer, required] the same, but skipped outright unless
|
|
366
|
+
// `required` appears in the string, which
|
|
367
|
+
// the matcher cannot match without
|
|
368
|
+
// [DIRECT, transform] plain string work, taking (source, pattern)
|
|
369
|
+
//
|
|
370
|
+
// The `required` character is only ever a shortcut: finding it does not mean
|
|
371
|
+
// the matcher will match, and not finding it means it cannot. It is there
|
|
372
|
+
// because scanning for one character costs a fraction of running a matcher
|
|
373
|
+
// that then finds nothing -- for the wildcard step, whose `[^\\]+`
|
|
374
|
+
// backtracks its way through the whole string before giving up, 11ns
|
|
375
|
+
// against 400ns.
|
|
376
|
+
var REPLACERS = [
|
|
114
377
|
// Replace (\ ) with ' '
|
|
378
|
+
// Only a space: an escaped tab or other whitespace is already a literal by
|
|
379
|
+
// the time it reaches here, and a bare tab must be left as one, not turned
|
|
380
|
+
// into a space.
|
|
115
381
|
// (\ ) -> ' '
|
|
116
382
|
// (\\ ) -> '\\ '
|
|
117
383
|
// (\\\ ) -> '\\ '
|
|
118
|
-
[
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
384
|
+
[
|
|
385
|
+
// A run of backslashes is taken whole, from its first one, so no match
|
|
386
|
+
// ever starts again inside it -- `(\\+?) ` did, which made a long run
|
|
387
|
+
// quadratic.
|
|
388
|
+
/(\\+)( ?)/g, function (_, run, space) {
|
|
389
|
+
return space ? run.slice(0, run.length - run.length % 2) + SPACE : run;
|
|
390
|
+
}, ESCAPE + SPACE],
|
|
391
|
+
// git's wildmatch() reads a run of two or more asterisks as one globstar
|
|
392
|
+
// whenever the run fills a path segment: it starts the pattern or follows
|
|
393
|
+
// a `/`, and it ends the pattern or comes before a `/`. A run of two is
|
|
394
|
+
// already `**`; a longer one is folded into `**` here, so the steps
|
|
395
|
+
// below only ever have to know `**`.
|
|
396
|
+
// `***/foo` -> `**/foo`, `a/***/b` -> `a/**/b`, `a/***` -> `a/**`
|
|
397
|
+
// git also takes a run beside a literal prefix (`a***/b`) or beside an
|
|
398
|
+
// escaped slash (`***\/b`) as a globstar, and this does not; the README
|
|
399
|
+
// lists both, under "A run of asterisks".
|
|
400
|
+
[/(^|\/)\*{3,}(?=\/|$)/g, function (_, start) {
|
|
401
|
+
return "".concat(start, "**");
|
|
402
|
+
}, '*'],
|
|
122
403
|
// Escape metacharacters
|
|
123
404
|
// which is written down by users but means special for regular expressions.
|
|
124
405
|
|
|
@@ -142,7 +423,7 @@ var REPLACERS = [[
|
|
|
142
423
|
// > a question mark (?) matches a single character
|
|
143
424
|
/(?!\\)\?/g, function () {
|
|
144
425
|
return '[^/]';
|
|
145
|
-
}],
|
|
426
|
+
}, '?'],
|
|
146
427
|
// leading slash
|
|
147
428
|
[
|
|
148
429
|
// > A leading slash matches the beginning of the pathname.
|
|
@@ -150,11 +431,11 @@ var REPLACERS = [[
|
|
|
150
431
|
// A leading slash matches the beginning of the pathname
|
|
151
432
|
/^\//, function () {
|
|
152
433
|
return '^';
|
|
153
|
-
}],
|
|
434
|
+
}, SLASH],
|
|
154
435
|
// replace special metacharacter slash after the leading slash
|
|
155
436
|
[/\//g, function () {
|
|
156
437
|
return '\\/';
|
|
157
|
-
}], [
|
|
438
|
+
}, SLASH], [
|
|
158
439
|
// > A leading "**" followed by a slash means match in all directories.
|
|
159
440
|
// > For example, "**/foo" matches file or directory "foo" anywhere,
|
|
160
441
|
// > the same as pattern "foo".
|
|
@@ -165,15 +446,20 @@ var REPLACERS = [[
|
|
|
165
446
|
// '**/foo' <-> 'foo'
|
|
166
447
|
function () {
|
|
167
448
|
return '^(?:.*\\/)?';
|
|
168
|
-
}],
|
|
449
|
+
}, '*'],
|
|
169
450
|
// starting
|
|
170
451
|
[
|
|
171
452
|
// there will be no leading '/'
|
|
172
453
|
// (which has been replaced by section "leading slash")
|
|
173
454
|
// If starts with '**', adding a '^' to the regular expression also works
|
|
174
|
-
|
|
455
|
+
DIRECT, function (source, pattern) {
|
|
456
|
+
// Nothing to anchor to, or already anchored
|
|
457
|
+
if (!source || source[0] === '^') {
|
|
458
|
+
return source;
|
|
459
|
+
}
|
|
460
|
+
|
|
175
461
|
// If has a slash `/` at the beginning or middle
|
|
176
|
-
|
|
462
|
+
var anchor = !REGEX_INNER_SLASH.test(pattern)
|
|
177
463
|
// > Prior to 2.22.1
|
|
178
464
|
// > If the pattern does not contain a slash /,
|
|
179
465
|
// > Git treats it as a shell glob pattern
|
|
@@ -191,6 +477,7 @@ function () {
|
|
|
191
477
|
// > Otherwise, Git treats the pattern as a shell glob suitable for
|
|
192
478
|
// > consumption by fnmatch(3)
|
|
193
479
|
: '^';
|
|
480
|
+
return anchor + source;
|
|
194
481
|
}],
|
|
195
482
|
// two globstars
|
|
196
483
|
[
|
|
@@ -203,19 +490,27 @@ function () {
|
|
|
203
490
|
function (_, index, str) {
|
|
204
491
|
return index + 6 < str.length
|
|
205
492
|
|
|
493
|
+
// case: /**/ at the end of the pattern, i.e. a trailing `'/**/'`
|
|
494
|
+
// > A trailing `"/**/"` (a trailing `"/**"` restricted to directories)
|
|
495
|
+
// > matches everything inside, but it should not match the current
|
|
496
|
+
// > folder itself, so it requires at least one directory segment.
|
|
497
|
+
// 'a/**/' matches 'a/b/', 'a/x/y/' but not 'a/'
|
|
498
|
+
? str.slice(index + 6) === '\\/' ? '(?:\\/[^\\/]+)+'
|
|
499
|
+
|
|
206
500
|
// case: /**/
|
|
207
501
|
// > A slash followed by two consecutive asterisks then a slash matches
|
|
208
502
|
// > zero or more directories.
|
|
209
503
|
// > For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on.
|
|
210
504
|
// '/**/'
|
|
211
|
-
|
|
505
|
+
: '(?:\\/[^\\/]+)*'
|
|
212
506
|
|
|
213
507
|
// case: /**
|
|
214
508
|
// > A trailing `"/**"` matches everything inside.
|
|
215
509
|
|
|
216
|
-
// #21: everything inside but it should not include the current folder
|
|
217
|
-
|
|
218
|
-
|
|
510
|
+
// #21: everything inside but it should not include the current folder,
|
|
511
|
+
// resolved by `_make`
|
|
512
|
+
: "\\/".concat(TRAILING_DOUBLESTAR);
|
|
513
|
+
}, '*'],
|
|
219
514
|
// normal intermediate wildcards
|
|
220
515
|
[
|
|
221
516
|
// Never replace escaped '*'
|
|
@@ -235,37 +530,54 @@ function (_, p1, p2) {
|
|
|
235
530
|
// > and will match according to the previous rules.
|
|
236
531
|
var unescaped = p2.replace(/\\\*/g, '[^\\/]*');
|
|
237
532
|
return p1 + unescaped;
|
|
238
|
-
}],
|
|
533
|
+
}, '*'],
|
|
534
|
+
// trailing wildcard, held apart from a literal star
|
|
535
|
+
[
|
|
536
|
+
// The step above leaves a trailing `*` alone, so a single `\*` is all that
|
|
537
|
+
// can be left at the end here, and what stands in front of it says which
|
|
538
|
+
// kind it is. A wildcard arrives as the escaper wrote it, `\*` with
|
|
539
|
+
// nothing before it; a literal arrives as the user's own escape, which
|
|
540
|
+
// the escaper doubled, and then the star's own -- `\\` and then `\*`.
|
|
541
|
+
// There is no third case: every backslash still reaching the chain is
|
|
542
|
+
// one `\*`, `\[` or `\ ` carries itself, and each is followed by its
|
|
543
|
+
// own character, so a longer run can never form. This runs while the
|
|
544
|
+
// two are still distinct, before the unescape steps below collapse the
|
|
545
|
+
// literal onto the very `\*` a wildcard leaves behind.
|
|
546
|
+
/(^|[^\\])((?:\\\\)*)\\\*$/, function (match, p1, p2) {
|
|
547
|
+
return p2 === EMPTY
|
|
548
|
+
// A real wildcard: carry it to `_make` as the marker, so the unescape
|
|
549
|
+
// steps and the trailing-wildcard rewrite can never mistake it for a
|
|
550
|
+
// literal `\*` (nor the reverse).
|
|
551
|
+
? p1 + TRAILING_WILDCARD
|
|
552
|
+
// A literal star: leave it exactly as it stands for the unescape steps.
|
|
553
|
+
: match;
|
|
554
|
+
}, '*'], [
|
|
239
555
|
// unescape, revert step 3 except for back slash
|
|
240
556
|
// For example, if a user escape a '\\*',
|
|
241
557
|
// after step 3, the result will be '\\\\\\*'
|
|
242
558
|
/\\\\\\(?=[$.|*+(){^])/g, function () {
|
|
243
559
|
return ESCAPE;
|
|
244
|
-
}], [
|
|
560
|
+
}, ESCAPE + ESCAPE], [
|
|
245
561
|
// '\\\\' -> '\\'
|
|
246
562
|
/\\\\/g, function () {
|
|
247
563
|
return ESCAPE;
|
|
248
|
-
}], [
|
|
249
|
-
//
|
|
250
|
-
//
|
|
564
|
+
}, ESCAPE + ESCAPE], [
|
|
565
|
+
// Every real bracket expression -- POSIX classes included -- has already
|
|
566
|
+
// been held aside by `extractBrackets`, so the only `[` left in the
|
|
567
|
+
// pattern is an escaped, literal one.
|
|
251
568
|
|
|
252
|
-
//
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
// '[bar\\\\]'
|
|
260
|
-
? "[".concat(negateRange(sanitizeRange(range))).concat(endEscape, "]") // Invalid range notaton
|
|
261
|
-
// '[bar\\]' -> '[bar\\\\]'
|
|
262
|
-
: '[]' : '[]';
|
|
263
|
-
}],
|
|
569
|
+
// A backslash could only stand at the end of the range if it quoted the
|
|
570
|
+
// `]`, and `\]` is held aside long before this.
|
|
571
|
+
/\\\[([^\]/]*?)($|\])/g,
|
|
572
|
+
// '\\[bar]' -> '\\\\[bar]'
|
|
573
|
+
function (match, range, close) {
|
|
574
|
+
return "\\[".concat(range).concat(close);
|
|
575
|
+
}, '['],
|
|
264
576
|
// ending
|
|
265
577
|
[
|
|
266
578
|
// 'js' will not match 'js.'
|
|
267
579
|
// 'ab' will not match 'abc'
|
|
268
|
-
|
|
580
|
+
DIRECT,
|
|
269
581
|
// WTF!
|
|
270
582
|
// https://git-scm.com/docs/gitignore
|
|
271
583
|
// changes in [2.22.1](https://git-scm.com/docs/gitignore/2.22.1)
|
|
@@ -278,17 +590,26 @@ function (_, p1, p2) {
|
|
|
278
590
|
// 'js*' will not match 'a.js'
|
|
279
591
|
// 'js/' will not match 'a.js'
|
|
280
592
|
// 'js' will match 'a.js' and 'a.js/'
|
|
281
|
-
function (
|
|
282
|
-
|
|
593
|
+
function (source) {
|
|
594
|
+
var last = source[source.length - 1];
|
|
595
|
+
|
|
596
|
+
// The pattern is empty, or ends in a pending marker `_make` owns --
|
|
597
|
+
// the trailing wildcard, or a trailing "/**". A trailing `*` that is
|
|
598
|
+
// not the marker is a literal star, which anchors like any other
|
|
599
|
+
// final character.
|
|
600
|
+
if (!last || last === TRAILING_WILDCARD || last === TRAILING_DOUBLESTAR) {
|
|
601
|
+
return source;
|
|
602
|
+
}
|
|
603
|
+
return last === SLASH
|
|
283
604
|
// foo/ will not match 'foo'
|
|
284
|
-
? "".concat(
|
|
285
|
-
: "".concat(
|
|
605
|
+
? "".concat(source, "$") // foo matches 'foo' and 'foo/'
|
|
606
|
+
: "".concat(source, "(?=$|\\/$)");
|
|
286
607
|
}]];
|
|
287
|
-
var REGEX_REPLACE_TRAILING_WILDCARD = /(^|\\\/)
|
|
608
|
+
var REGEX_REPLACE_TRAILING_WILDCARD = /(^|\\\/)?\uE000$/;
|
|
288
609
|
var MODE_IGNORE = 'regex';
|
|
289
610
|
var MODE_CHECK_IGNORE = 'checkRegex';
|
|
290
611
|
var UNDERSCORE = '_';
|
|
291
|
-
var
|
|
612
|
+
var replaceTrailingWildcard = function replaceTrailingWildcard(_, p1) {
|
|
292
613
|
var prefix = p1
|
|
293
614
|
// '\^':
|
|
294
615
|
// '/*' does not match EMPTY
|
|
@@ -300,36 +621,268 @@ var TRAILING_WILD_CARD_REPLACERS = (_TRAILING_WILD_CARD_R = {}, _defineProperty(
|
|
|
300
621
|
// 'a*' matches 'aa'
|
|
301
622
|
: '[^/]*';
|
|
302
623
|
return "".concat(prefix, "(?=$|\\/$)");
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
624
|
+
};
|
|
625
|
+
var REGEX_REPLACE_TRAILING_DOUBLESTAR = /\uE001$/;
|
|
626
|
+
|
|
627
|
+
// 'abc/**' matches everything under 'abc', but not 'abc/' itself (#21)
|
|
628
|
+
var replaceTrailingDoublestar = function replaceTrailingDoublestar() {
|
|
629
|
+
return '.+(?=$|\\/$)';
|
|
630
|
+
};
|
|
631
|
+
var WILDCARD = '[^\\/]*';
|
|
632
|
+
|
|
633
|
+
// The fixed piece between the wildcard at `at` and the next wildcard of the
|
|
634
|
+
// run: the tokens that separate them, joined as they appear in the source.
|
|
635
|
+
// A run never holds two wildcards in a row, so there is always at least one
|
|
636
|
+
// token.
|
|
637
|
+
var separatorAfter = function separatorAfter(run, at) {
|
|
638
|
+
var separator = EMPTY;
|
|
639
|
+
for (var index = at + 1; index < run.length && !run[index].wildcard; index++) {
|
|
640
|
+
separator += run[index].single;
|
|
641
|
+
}
|
|
642
|
+
return separator;
|
|
643
|
+
};
|
|
644
|
+
|
|
645
|
+
// Where a run of non-slash wildcards is split by fixed pieces --
|
|
646
|
+
// `[^/]*ab[^/]*cd...` -- the engine has many equivalent ways to lay the
|
|
647
|
+
// input across the wildcards, and on input that does not match it works
|
|
648
|
+
// through all of them, so the time grows with the number of wildcards
|
|
649
|
+
// rather than the length of the path. Every wildcard but the last in such a
|
|
650
|
+
// run can be pinned to stop where the piece after it begins, which leaves
|
|
651
|
+
// one way to lay out the input and no rewinding, without changing which
|
|
652
|
+
// paths match: the fixed pieces still bound the count, and the last
|
|
653
|
+
// wildcard still absorbs the rest.
|
|
654
|
+
//
|
|
655
|
+
// A wildcard is pinned to the whole piece, never to the piece's first
|
|
656
|
+
// character. The pin leaves no way back, so a wildcard that stopped at that
|
|
657
|
+
// first character would hand over wherever the character happens to turn
|
|
658
|
+
// up, including the places the rest of the piece cannot follow -- which is
|
|
659
|
+
// how `f*o/*/*` came to miss `foo/b/c`, the first `o` of `foo` not being
|
|
660
|
+
// the one the `o/` after it needs. Every token of a piece matches exactly
|
|
661
|
+
// one character, so the first place the whole piece fits is the leftmost
|
|
662
|
+
// place it can sit, and whatever is left over goes to the wildcards that
|
|
663
|
+
// follow.
|
|
664
|
+
//
|
|
665
|
+
// The source is read one token at a time -- a wildcard, a single-character
|
|
666
|
+
// piece (a literal, an escape, a class), or a parenthesised group or anchor
|
|
667
|
+
// that ends the run -- so only a genuine wildcard is touched.
|
|
668
|
+
var pinWildcards = function pinWildcards(source) {
|
|
669
|
+
if (source.indexOf(WILDCARD) < 0) {
|
|
670
|
+
return source;
|
|
671
|
+
}
|
|
672
|
+
var tokens = [];
|
|
673
|
+
var length = source.length;
|
|
674
|
+
var index = 0;
|
|
675
|
+
while (index < length) {
|
|
676
|
+
var _char5 = source[index];
|
|
677
|
+
if (source.startsWith(WILDCARD, index)) {
|
|
678
|
+
tokens.push({
|
|
679
|
+
wildcard: true
|
|
680
|
+
});
|
|
681
|
+
index += WILDCARD.length;
|
|
682
|
+
} else if (_char5 === '[') {
|
|
683
|
+
var end = index + 1;
|
|
684
|
+
if (source[end] === '^') {
|
|
685
|
+
end++;
|
|
686
|
+
}
|
|
687
|
+
if (source[end] === ']') {
|
|
688
|
+
end++;
|
|
689
|
+
}
|
|
690
|
+
while (end < length && source[end] !== ']') {
|
|
691
|
+
end += source[end] === ESCAPE ? 2 : 1;
|
|
692
|
+
}
|
|
693
|
+
end++;
|
|
694
|
+
tokens.push({
|
|
695
|
+
single: source.slice(index, end)
|
|
696
|
+
});
|
|
697
|
+
index = end;
|
|
698
|
+
} else if (_char5 === ESCAPE) {
|
|
699
|
+
tokens.push({
|
|
700
|
+
single: source.slice(index, index + 2)
|
|
701
|
+
});
|
|
702
|
+
index += 2;
|
|
703
|
+
} else if (_char5 === '(') {
|
|
704
|
+
var depth = 0;
|
|
705
|
+
var _end = index;
|
|
706
|
+
do {
|
|
707
|
+
if (source[_end] === ESCAPE) {
|
|
708
|
+
_end++;
|
|
709
|
+
} else if (source[_end] === '(') {
|
|
710
|
+
depth++;
|
|
711
|
+
} else if (source[_end] === ')') {
|
|
712
|
+
depth--;
|
|
713
|
+
}
|
|
714
|
+
_end++;
|
|
715
|
+
} while (_end < length && depth > 0);
|
|
716
|
+
if ('*+?'.indexOf(source[_end]) >= 0) {
|
|
717
|
+
_end++;
|
|
718
|
+
}
|
|
719
|
+
tokens.push({
|
|
720
|
+
boundary: source.slice(index, _end)
|
|
721
|
+
});
|
|
722
|
+
index = _end;
|
|
723
|
+
} else if (_char5 === '^' || _char5 === '$') {
|
|
724
|
+
tokens.push({
|
|
725
|
+
boundary: _char5
|
|
726
|
+
});
|
|
727
|
+
index++;
|
|
728
|
+
} else {
|
|
729
|
+
tokens.push({
|
|
730
|
+
single: _char5
|
|
731
|
+
});
|
|
732
|
+
index++;
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
var out = EMPTY;
|
|
736
|
+
var run = [];
|
|
737
|
+
var flush = function flush() {
|
|
738
|
+
var lastWildcard;
|
|
739
|
+
run.forEach(function (token, at) {
|
|
740
|
+
if (token.wildcard) {
|
|
741
|
+
lastWildcard = at;
|
|
742
|
+
}
|
|
743
|
+
});
|
|
744
|
+
run.forEach(function (token, at) {
|
|
745
|
+
if (!token.wildcard) {
|
|
746
|
+
out += token.single;
|
|
747
|
+
return;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
// Every wildcard but the last is pinned to the whole piece that
|
|
751
|
+
// follows it, for the reason set out above this function. The last
|
|
752
|
+
// one stays as it is and takes up the rest.
|
|
753
|
+
out += at === lastWildcard ? WILDCARD : "(?:(?!".concat(separatorAfter(run, at), ")[^\\/])*");
|
|
754
|
+
});
|
|
755
|
+
run = [];
|
|
756
|
+
};
|
|
757
|
+
tokens.forEach(function (token) {
|
|
758
|
+
if (token.boundary === undefined) {
|
|
759
|
+
run.push(token);
|
|
760
|
+
return;
|
|
761
|
+
}
|
|
762
|
+
flush();
|
|
763
|
+
out += token.boundary;
|
|
764
|
+
});
|
|
765
|
+
flush();
|
|
766
|
+
return out;
|
|
767
|
+
};
|
|
313
768
|
|
|
314
769
|
// @param {pattern}
|
|
315
770
|
var makeRegexPrefix = function makeRegexPrefix(pattern) {
|
|
316
|
-
|
|
317
|
-
|
|
771
|
+
// `/**` matches every path, as `**` does. The translation below only finds
|
|
772
|
+
// a globstar beside a slash it keeps, and the leading one is turned into
|
|
773
|
+
// an anchor, so `/**` would come out as `/*` and match one level only.
|
|
774
|
+
// Here rather than in `createRule`, so that `checkSourceOf`, which
|
|
775
|
+
// compiles `/**/` again without its trailing slash, gets it too.
|
|
776
|
+
if (REGEX_ANCHORED_GLOBSTAR.test(pattern)) {
|
|
777
|
+
pattern = '**';
|
|
778
|
+
}
|
|
779
|
+
var _extractBrackets = extractBrackets(pattern),
|
|
780
|
+
source = _extractBrackets.source,
|
|
781
|
+
sources = _extractBrackets.sources;
|
|
782
|
+
var replaced = REPLACERS.reduce(
|
|
783
|
+
// A pass whose matcher finds nothing hands back the very string it was
|
|
784
|
+
// given, so asking first costs a search and saves a rewrite. Ten of the
|
|
785
|
+
// fifteen passes never fire for a typical .gitignore line, and between
|
|
786
|
+
// them they were 45% of this chain.
|
|
787
|
+
function (prev, _ref) {
|
|
788
|
+
var _ref2 = _slicedToArray(_ref, 3),
|
|
318
789
|
matcher = _ref2[0],
|
|
319
|
-
replacer = _ref2[1]
|
|
320
|
-
|
|
321
|
-
|
|
790
|
+
replacer = _ref2[1],
|
|
791
|
+
required = _ref2[2];
|
|
792
|
+
if (matcher === DIRECT) {
|
|
793
|
+
return replacer(prev, pattern);
|
|
794
|
+
}
|
|
795
|
+
if (required !== UNDEFINED && prev.indexOf(required) < 0) {
|
|
796
|
+
return prev;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
// A pass whose matcher finds nothing hands back the very string it was
|
|
800
|
+
// given, so asking first costs a search and saves a rewrite.
|
|
801
|
+
return matcher.test(prev) ? prev.replace(matcher, replacer.bind(pattern)) : prev;
|
|
802
|
+
}, source);
|
|
803
|
+
|
|
804
|
+
// Most patterns hold no bracket expression at all, and then there is
|
|
805
|
+
// nothing to put back.
|
|
806
|
+
return sources.length ? replaced.replace(REGEX_RESTORE_PLACEHOLDER, function (match, index) {
|
|
807
|
+
return sources[index];
|
|
808
|
+
}) : replaced;
|
|
809
|
+
};
|
|
810
|
+
|
|
811
|
+
// `checkRegex` tests a path with a trailing slash, 'abc/', the way
|
|
812
|
+
// `git check-ignore` matches that literal string once the directory itself
|
|
813
|
+
// is known not to be excluded (see `checkIgnore`): a trailing '/' of the
|
|
814
|
+
// pattern is dropped, a basename pattern sees an empty basename, and only a
|
|
815
|
+
// pattern whose last segment is a pending wildcard can match what is left
|
|
816
|
+
// after the final slash -- 'abc/*' and 'abc/**' match 'abc/', and 'abc/**'
|
|
817
|
+
// also matches 'abc/d/' (#77, #169).
|
|
818
|
+
var checkSourceOf = function checkSourceOf(body, prefix) {
|
|
819
|
+
if (body[body.length - 1] === SLASH) {
|
|
820
|
+
prefix = makeRegexPrefix(body.slice(0, -1));
|
|
821
|
+
}
|
|
822
|
+
var head = prefix.slice(0, -1);
|
|
823
|
+
var last = prefix[prefix.length - 1];
|
|
824
|
+
return last === TRAILING_WILDCARD ? "".concat(head, "$") : last === TRAILING_DOUBLESTAR ? "".concat(head, ".*$") : NEVER_MATCH;
|
|
825
|
+
};
|
|
826
|
+
|
|
827
|
+
// A trailing slash does not stop a pattern being basename-only: it restricts
|
|
828
|
+
// the match to a directory, it does not let the pattern reach across one.
|
|
829
|
+
// Everything else a pattern can hold -- a wildcard, a character class, an
|
|
830
|
+
// escape -- stays inside a single path segment too, so a pattern with no
|
|
831
|
+
// separator in it can only ever describe the last one.
|
|
832
|
+
var matchesBasename = function matchesBasename(body) {
|
|
833
|
+
var index = body.indexOf(SLASH);
|
|
834
|
+
return index < 0 || index === body.length - 1;
|
|
835
|
+
};
|
|
836
|
+
|
|
837
|
+
// The last segment of a path, keeping a trailing slash, because a pattern that
|
|
838
|
+
// ends in one matches only a directory.
|
|
839
|
+
// 'a/b/c.js' -> 'c.js'; 'a/b/' -> 'b/'; 'c.js' -> 'c.js' (no copy made)
|
|
840
|
+
var basenameOf = function basenameOf(path) {
|
|
841
|
+
var end = path.length - 1;
|
|
842
|
+
var index = path.lastIndexOf(SLASH, path[end] === SLASH ? end - 1 : end);
|
|
843
|
+
return index < 0 ? path : path.slice(index + 1);
|
|
844
|
+
};
|
|
845
|
+
|
|
846
|
+
// The parent directory of a path, with its trailing separator, or EMPTY when
|
|
847
|
+
// the path has none.
|
|
848
|
+
// 'a/b/c' -> 'a/b/'; 'a/b/' -> 'a/'; 'a' -> EMPTY; 'a/' -> EMPTY
|
|
849
|
+
//
|
|
850
|
+
// A path holding an empty segment has to be taken apart, because its
|
|
851
|
+
// ancestors are not prefixes of it: the parent of 'a//b' is 'a/', not
|
|
852
|
+
// 'a//', and the parent of '/a/' is nothing at all. Both shapes reach here
|
|
853
|
+
// -- 'a//b' is accepted outright, and `checkIgnore` does not put the path
|
|
854
|
+
// it is given through the relative-path check.
|
|
855
|
+
//
|
|
856
|
+
// Every other path is a prefix of itself, and cutting one costs a fraction of
|
|
857
|
+
// splitting it into an array and joining that back at every level: 73ns
|
|
858
|
+
// against 207ns.
|
|
859
|
+
var parentOf = function parentOf(path) {
|
|
860
|
+
if (path.charCodeAt(0) === SLASH_CODE || path.indexOf(DOUBLE_SLASH) >= 0) {
|
|
861
|
+
var slices = path.split(SLASH).filter(Boolean);
|
|
862
|
+
slices.pop();
|
|
863
|
+
return slices.length ? slices.join(SLASH) + SLASH : EMPTY;
|
|
864
|
+
}
|
|
865
|
+
var end = path.length - 1;
|
|
866
|
+
|
|
867
|
+
// Look back from before a trailing separator, since that one belongs to the
|
|
868
|
+
// path itself.
|
|
869
|
+
//
|
|
870
|
+
// A negative place to start would be a trap here: `lastIndexOf` clamps one
|
|
871
|
+
// to 0 and searches there rather than reporting no match, so '/' would
|
|
872
|
+
// come back as its own parent and the walk would never end. It cannot
|
|
873
|
+
// happen -- that is the only path short enough to produce one, and the
|
|
874
|
+
// test above has already sent it the other way.
|
|
875
|
+
var cut = path.lastIndexOf(SLASH, path.charCodeAt(end) === SLASH_CODE ? end - 1 : end);
|
|
876
|
+
return cut < 0 ? EMPTY : path.slice(0, cut + 1);
|
|
322
877
|
};
|
|
323
878
|
var isString = function isString(subject) {
|
|
324
879
|
return typeof subject === 'string';
|
|
325
880
|
};
|
|
326
881
|
|
|
327
|
-
//
|
|
882
|
+
// Blank lines and comments are told by `createRule`, once the pattern is
|
|
883
|
+
// normalized.
|
|
328
884
|
var checkPattern = function checkPattern(pattern) {
|
|
329
|
-
return pattern && isString(pattern) && !
|
|
330
|
-
|
|
331
|
-
// > A line starting with # serves as a comment.
|
|
332
|
-
&& pattern.indexOf('#') !== 0;
|
|
885
|
+
return pattern && isString(pattern) && !REGEX_INVALID_TRAILING_BACKSLASH.test(pattern);
|
|
333
886
|
};
|
|
334
887
|
var splitPattern = function splitPattern(pattern) {
|
|
335
888
|
return pattern.split(REGEX_SPLITALL_CRLF).filter(Boolean);
|
|
@@ -344,7 +897,18 @@ var IgnoreRule = /*#__PURE__*/function () {
|
|
|
344
897
|
define(this, 'ignoreCase', ignoreCase);
|
|
345
898
|
define(this, 'regexPrefix', prefix);
|
|
346
899
|
}
|
|
900
|
+
|
|
901
|
+
// Worked out on first use and kept behind an own property, the way `regex`
|
|
902
|
+
// caches itself in `_regex`. Deciding it in the constructor instead would
|
|
903
|
+
// add a fourth `defineProperty` to every rule ever built, which cost 4% of
|
|
904
|
+
// every compile -- including the compiles of rules that are never matched
|
|
905
|
+
// against anything.
|
|
347
906
|
_createClass(IgnoreRule, [{
|
|
907
|
+
key: "_basenameOnly",
|
|
908
|
+
get: function get() {
|
|
909
|
+
return define(this, '_basenameOnly', matchesBasename(this.body));
|
|
910
|
+
}
|
|
911
|
+
}, {
|
|
348
912
|
key: "regex",
|
|
349
913
|
get: function get() {
|
|
350
914
|
var key = UNDERSCORE + MODE_IGNORE;
|
|
@@ -365,25 +929,73 @@ var IgnoreRule = /*#__PURE__*/function () {
|
|
|
365
929
|
}, {
|
|
366
930
|
key: "_make",
|
|
367
931
|
value: function _make(mode, key) {
|
|
368
|
-
var str = this.regexPrefix.replace(REGEX_REPLACE_TRAILING_WILDCARD,
|
|
369
|
-
// It does not need to bind pattern
|
|
370
|
-
TRAILING_WILD_CARD_REPLACERS[mode]);
|
|
932
|
+
var str = pinWildcards(mode === MODE_IGNORE ? this.regexPrefix.replace(REGEX_REPLACE_TRAILING_WILDCARD, replaceTrailingWildcard).replace(REGEX_REPLACE_TRAILING_DOUBLESTAR, replaceTrailingDoublestar) : checkSourceOf(this.body, this.regexPrefix));
|
|
371
933
|
var regex = this.ignoreCase ? new RegExp(str, 'i') : new RegExp(str);
|
|
372
934
|
return define(this, key, regex);
|
|
373
935
|
}
|
|
374
936
|
}]);
|
|
375
937
|
return IgnoreRule;
|
|
376
938
|
}();
|
|
939
|
+
var isLineEnd = function isLineEnd(_char6) {
|
|
940
|
+
return _char6 === '\r' || _char6 === '\n';
|
|
941
|
+
};
|
|
942
|
+
|
|
943
|
+
// Drop a line terminator, which can remain when patterns are passed as an
|
|
944
|
+
// array, and then the trailing spaces. Git trims spaces only, and a space
|
|
945
|
+
// escaped by an odd run of backslashes stays, unescaped, as the last one.
|
|
946
|
+
// Scanned from the end: a regular expression can only try each start in
|
|
947
|
+
// turn, which is quadratic over a long run of spaces or backslashes.
|
|
948
|
+
// 'a ' -> 'a'; 'a\ ' -> 'a '; 'a\\ ' -> 'a\\'; 'a\t' -> 'a\t'
|
|
949
|
+
var trimEnd = function trimEnd(body) {
|
|
950
|
+
var end = body.length;
|
|
951
|
+
while (end && isLineEnd(body[end - 1])) {
|
|
952
|
+
end--;
|
|
953
|
+
}
|
|
954
|
+
var lineEnd = end;
|
|
955
|
+
while (end && body[end - 1] === SPACE) {
|
|
956
|
+
end--;
|
|
957
|
+
}
|
|
958
|
+
if (end === lineEnd) {
|
|
959
|
+
return body.slice(0, end);
|
|
960
|
+
}
|
|
961
|
+
var backslashes = 0;
|
|
962
|
+
while (backslashes < end && body[end - backslashes - 1] === ESCAPE) {
|
|
963
|
+
backslashes++;
|
|
964
|
+
}
|
|
965
|
+
return backslashes % 2 ? body.slice(0, end - 1) + SPACE : body.slice(0, end);
|
|
966
|
+
};
|
|
377
967
|
var createRule = function createRule(_ref3, ignoreCase) {
|
|
378
968
|
var pattern = _ref3.pattern,
|
|
379
969
|
mark = _ref3.mark;
|
|
970
|
+
// Git drops a BOM before it reads the first line, so before anything else.
|
|
971
|
+
var body = pattern[0] === BOM ? pattern.slice(1) : pattern;
|
|
972
|
+
|
|
973
|
+
// > A line starting with # serves as a comment.
|
|
974
|
+
if (body[0] === '#') {
|
|
975
|
+
return;
|
|
976
|
+
}
|
|
380
977
|
var negative = false;
|
|
381
|
-
var body = pattern;
|
|
382
978
|
|
|
383
979
|
// > An optional prefix "!" which negates the pattern;
|
|
384
|
-
if (body
|
|
980
|
+
if (body[0] === '!') {
|
|
385
981
|
negative = true;
|
|
386
|
-
body = body.
|
|
982
|
+
body = body.slice(1);
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
// Normalize the body before checking which slashes anchor the pattern.
|
|
986
|
+
// Otherwise `bar/ ` is mistaken for a pattern containing an inner slash.
|
|
987
|
+
// Only a body ending in a space or a line terminator has anything to trim.
|
|
988
|
+
var last = body[body.length - 1];
|
|
989
|
+
if (last === SPACE || last === '\r' || last === '\n') {
|
|
990
|
+
body = trimEnd(body);
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
// > A blank line matches no files, so it can serve as a separator for
|
|
994
|
+
// > readability.
|
|
995
|
+
// Nor does a lone "!", or anything else left empty here: an empty pattern
|
|
996
|
+
// would compile to a regex matching every path.
|
|
997
|
+
if (!body) {
|
|
998
|
+
return;
|
|
387
999
|
}
|
|
388
1000
|
body = body
|
|
389
1001
|
// > Put a backslash ("\") in front of the first "!" for patterns that
|
|
@@ -400,6 +1012,21 @@ var RuleManager = /*#__PURE__*/function () {
|
|
|
400
1012
|
_classCallCheck(this, RuleManager);
|
|
401
1013
|
this._ignoreCase = ignoreCase;
|
|
402
1014
|
this._rules = [];
|
|
1015
|
+
|
|
1016
|
+
// How many of the rules git would tag `EXC_FLAG_NODIR`.
|
|
1017
|
+
//
|
|
1018
|
+
// The scan uses it to decide, once for the whole set, whether handing
|
|
1019
|
+
// those rules the basename is worth what it costs the others. The
|
|
1020
|
+
// shortcut saves a full-path scan on every rule it applies to and costs
|
|
1021
|
+
// a check on every rule it does not, so a set where almost nothing is
|
|
1022
|
+
// basename-only comes out behind -- a 955 pattern set with 44 of them
|
|
1023
|
+
// measured 19% slower with the shortcut always on.
|
|
1024
|
+
//
|
|
1025
|
+
// Deciding this by measurement rather than by meaning is safe: a
|
|
1026
|
+
// basename-only pattern gives the very same answer against the whole
|
|
1027
|
+
// path, it just takes longer to say so. The choice can only change how
|
|
1028
|
+
// fast the scan runs, never what it returns.
|
|
1029
|
+
this._basenameCount = 0;
|
|
403
1030
|
}
|
|
404
1031
|
_createClass(RuleManager, [{
|
|
405
1032
|
key: "_add",
|
|
@@ -407,6 +1034,7 @@ var RuleManager = /*#__PURE__*/function () {
|
|
|
407
1034
|
// #32
|
|
408
1035
|
if (pattern && pattern[KEY_IGNORE]) {
|
|
409
1036
|
this._rules = this._rules.concat(pattern._rules._rules);
|
|
1037
|
+
this._basenameCount += pattern._rules._basenameCount;
|
|
410
1038
|
this._added = true;
|
|
411
1039
|
return;
|
|
412
1040
|
}
|
|
@@ -415,10 +1043,17 @@ var RuleManager = /*#__PURE__*/function () {
|
|
|
415
1043
|
pattern: pattern
|
|
416
1044
|
};
|
|
417
1045
|
}
|
|
418
|
-
|
|
419
|
-
|
|
1046
|
+
var rule = checkPattern(pattern.pattern) && createRule(pattern, this._ignoreCase);
|
|
1047
|
+
if (rule) {
|
|
420
1048
|
this._added = true;
|
|
421
1049
|
this._rules.push(rule);
|
|
1050
|
+
|
|
1051
|
+
// Deliberately not `rule._basenameOnly`: reading that would materialise
|
|
1052
|
+
// the rule's own copy, and the whole point of leaving it lazy is that
|
|
1053
|
+
// a rule which is compiled and never matched never pays for it.
|
|
1054
|
+
if (matchesBasename(rule.body)) {
|
|
1055
|
+
this._basenameCount++;
|
|
1056
|
+
}
|
|
422
1057
|
}
|
|
423
1058
|
}
|
|
424
1059
|
|
|
@@ -428,48 +1063,34 @@ var RuleManager = /*#__PURE__*/function () {
|
|
|
428
1063
|
value: function add(pattern) {
|
|
429
1064
|
this._added = false;
|
|
430
1065
|
makeArray(isString(pattern) ? splitPattern(pattern) : pattern).forEach(this._add, this);
|
|
1066
|
+
if (this._added) {
|
|
1067
|
+
this._literalRules = UNDEFINED;
|
|
1068
|
+
}
|
|
431
1069
|
return this._added;
|
|
432
1070
|
}
|
|
433
1071
|
|
|
434
|
-
//
|
|
435
|
-
//
|
|
436
|
-
//
|
|
437
|
-
// setting `checkUnignored` to `false` could reduce additional
|
|
438
|
-
// path matching.
|
|
439
|
-
// - check `string` either `MODE_IGNORE` or `MODE_CHECK_IGNORE`
|
|
440
|
-
|
|
441
|
-
// @returns {TestResult} true if a file is ignored
|
|
1072
|
+
// Match the literal 'abc/' for `checkIgnore`, last rule wins. Only a rule
|
|
1073
|
+
// ending in a wildcard can match it (see `checkSourceOf`), so the rest
|
|
1074
|
+
// are left out once, rather than tested or compiled for every path.
|
|
442
1075
|
}, {
|
|
443
|
-
key: "
|
|
444
|
-
value: function
|
|
1076
|
+
key: "testLiteral",
|
|
1077
|
+
value: function testLiteral(path) {
|
|
1078
|
+
var rules = this._literalRules || (this._literalRules = this._rules.filter(function (_ref4) {
|
|
1079
|
+
var body = _ref4.body;
|
|
1080
|
+
return body[body.length - (body[body.length - 1] === SLASH ? 2 : 1)] === '*';
|
|
1081
|
+
}));
|
|
445
1082
|
var ignored = false;
|
|
446
1083
|
var unignored = false;
|
|
447
1084
|
var matchedRule;
|
|
448
|
-
|
|
449
|
-
var
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
// 0 | TEST | TEST | SKIP | X
|
|
456
|
-
// 1 | TESTIF | SKIP | TEST | X
|
|
457
|
-
|
|
458
|
-
// - SKIP: always skip
|
|
459
|
-
// - TEST: always test
|
|
460
|
-
// - TESTIF: only test if checkUnignored
|
|
461
|
-
// - X: that never happen
|
|
462
|
-
if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
|
|
463
|
-
return;
|
|
1085
|
+
for (var index = rules.length - 1; index >= 0; index--) {
|
|
1086
|
+
var rule = rules[index];
|
|
1087
|
+
if (rule.checkRegex.test(path)) {
|
|
1088
|
+
ignored = !rule.negative;
|
|
1089
|
+
unignored = rule.negative;
|
|
1090
|
+
matchedRule = rule.negative ? UNDEFINED : rule;
|
|
1091
|
+
break;
|
|
464
1092
|
}
|
|
465
|
-
|
|
466
|
-
if (!matched) {
|
|
467
|
-
return;
|
|
468
|
-
}
|
|
469
|
-
ignored = !negative;
|
|
470
|
-
unignored = negative;
|
|
471
|
-
matchedRule = negative ? UNDEFINED : rule;
|
|
472
|
-
});
|
|
1093
|
+
}
|
|
473
1094
|
var ret = {
|
|
474
1095
|
ignored: ignored,
|
|
475
1096
|
unignored: unignored
|
|
@@ -479,6 +1100,51 @@ var RuleManager = /*#__PURE__*/function () {
|
|
|
479
1100
|
}
|
|
480
1101
|
return ret;
|
|
481
1102
|
}
|
|
1103
|
+
|
|
1104
|
+
// Test one single path without recursively checking parent directories
|
|
1105
|
+
//
|
|
1106
|
+
// - mode `string` either `MODE_IGNORE` or `MODE_CHECK_IGNORE`
|
|
1107
|
+
|
|
1108
|
+
// @returns {TestResult}
|
|
1109
|
+
}, {
|
|
1110
|
+
key: "test",
|
|
1111
|
+
value: function test(path, mode) {
|
|
1112
|
+
// Most of a .gitignore is patterns with no slash in them, and running
|
|
1113
|
+
// those against the whole path makes the regular expression engine walk
|
|
1114
|
+
// every directory name on the way to the only segment that could match.
|
|
1115
|
+
// Handing them the basename instead is what git does, and it is where
|
|
1116
|
+
// the time in a directory walk goes: the rule scan was two thirds of it.
|
|
1117
|
+
var rules = this._rules;
|
|
1118
|
+
var length = rules.length;
|
|
1119
|
+
var shortcut = this._basenameCount * 2 >= length;
|
|
1120
|
+
var basename = shortcut ? basenameOf(path) : path;
|
|
1121
|
+
|
|
1122
|
+
// The last rule to match decides, as in git, and it is the rule
|
|
1123
|
+
// `git check-ignore -v` reports, so the scan runs from the end and stops
|
|
1124
|
+
// at the first match.
|
|
1125
|
+
// A plain loop rather than `forEach`, so that `path`, `basename` and
|
|
1126
|
+
// `shortcut` are locals. As a callback they became closure variables,
|
|
1127
|
+
// and reaching for one of those once per rule cost 10% of a scan over a
|
|
1128
|
+
// large rule set -- more than the shortcut they were there to serve.
|
|
1129
|
+
for (var index = length - 1; index >= 0; index--) {
|
|
1130
|
+
var rule = rules[index];
|
|
1131
|
+
if (rule[mode].test(shortcut && rule._basenameOnly ? basename : path)) {
|
|
1132
|
+
var negative = rule.negative;
|
|
1133
|
+
var ret = {
|
|
1134
|
+
ignored: !negative,
|
|
1135
|
+
unignored: negative
|
|
1136
|
+
};
|
|
1137
|
+
if (!negative) {
|
|
1138
|
+
ret.rule = rule;
|
|
1139
|
+
}
|
|
1140
|
+
return ret;
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
return {
|
|
1144
|
+
ignored: false,
|
|
1145
|
+
unignored: false
|
|
1146
|
+
};
|
|
1147
|
+
}
|
|
482
1148
|
}]);
|
|
483
1149
|
return RuleManager;
|
|
484
1150
|
}();
|
|
@@ -502,8 +1168,39 @@ var checkPath = function checkPath(path, originalPath, doThrow) {
|
|
|
502
1168
|
}
|
|
503
1169
|
return true;
|
|
504
1170
|
};
|
|
1171
|
+
|
|
1172
|
+
// > pathname should be a `path.relative()`d one
|
|
1173
|
+
//
|
|
1174
|
+
// The same thing `REGEX_TEST_INVALID_PATH` says, spelled out: a path is not
|
|
1175
|
+
// relative if it begins with a separator, or with `./` or `../`, or is
|
|
1176
|
+
// nothing but `.` or `..`. Every match is decided by the first three
|
|
1177
|
+
// characters, and this runs on every path handed to the library -- where it
|
|
1178
|
+
// was 55% of a cached lookup, more than the cache lookup itself.
|
|
505
1179
|
var isNotRelative = function isNotRelative(path) {
|
|
506
|
-
|
|
1180
|
+
var first = path.charCodeAt(0);
|
|
1181
|
+
if (first === SLASH_CODE) {
|
|
1182
|
+
return true;
|
|
1183
|
+
}
|
|
1184
|
+
if (first !== DOT_CODE) {
|
|
1185
|
+
return false;
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
// '.'
|
|
1189
|
+
if (path.length === 1) {
|
|
1190
|
+
return true;
|
|
1191
|
+
}
|
|
1192
|
+
var second = path.charCodeAt(1);
|
|
1193
|
+
|
|
1194
|
+
// './'
|
|
1195
|
+
if (second === SLASH_CODE) {
|
|
1196
|
+
return true;
|
|
1197
|
+
}
|
|
1198
|
+
if (second !== DOT_CODE) {
|
|
1199
|
+
return false;
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
// '..' or '../'
|
|
1203
|
+
return path.length === 2 || path.charCodeAt(2) === SLASH_CODE;
|
|
507
1204
|
};
|
|
508
1205
|
checkPath.isNotRelative = isNotRelative;
|
|
509
1206
|
|
|
@@ -514,13 +1211,13 @@ checkPath.convert = function (p) {
|
|
|
514
1211
|
};
|
|
515
1212
|
var Ignore = /*#__PURE__*/function () {
|
|
516
1213
|
function Ignore() {
|
|
517
|
-
var
|
|
518
|
-
|
|
519
|
-
ignorecase =
|
|
520
|
-
|
|
521
|
-
ignoreCase =
|
|
522
|
-
|
|
523
|
-
allowRelativePaths =
|
|
1214
|
+
var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
1215
|
+
_ref5$ignorecase = _ref5.ignorecase,
|
|
1216
|
+
ignorecase = _ref5$ignorecase === void 0 ? true : _ref5$ignorecase,
|
|
1217
|
+
_ref5$ignoreCase = _ref5.ignoreCase,
|
|
1218
|
+
ignoreCase = _ref5$ignoreCase === void 0 ? ignorecase : _ref5$ignoreCase,
|
|
1219
|
+
_ref5$allowRelativePa = _ref5.allowRelativePaths,
|
|
1220
|
+
allowRelativePaths = _ref5$allowRelativePa === void 0 ? false : _ref5$allowRelativePa;
|
|
524
1221
|
_classCallCheck(this, Ignore);
|
|
525
1222
|
define(this, KEY_IGNORE, true);
|
|
526
1223
|
this._rules = new RuleManager(ignoreCase);
|
|
@@ -558,30 +1255,31 @@ var Ignore = /*#__PURE__*/function () {
|
|
|
558
1255
|
// @returns {TestResult}
|
|
559
1256
|
}, {
|
|
560
1257
|
key: "_test",
|
|
561
|
-
value: function _test(originalPath, cache
|
|
1258
|
+
value: function _test(originalPath, cache) {
|
|
562
1259
|
var path = originalPath
|
|
563
1260
|
// Supports nullable path
|
|
564
1261
|
&& checkPath.convert(originalPath);
|
|
565
1262
|
checkPath(path, originalPath, this._strictPathCheck ? throwError : RETURN_FALSE);
|
|
566
|
-
return this._t(path, cache
|
|
1263
|
+
return this._t(path, cache);
|
|
567
1264
|
}
|
|
568
1265
|
}, {
|
|
569
1266
|
key: "checkIgnore",
|
|
570
1267
|
value: function checkIgnore(path) {
|
|
571
1268
|
// If the path doest not end with a slash, `.ignores()` is much equivalent
|
|
572
1269
|
// to `git check-ignore`
|
|
573
|
-
if (
|
|
1270
|
+
if (path.charCodeAt(path.length - 1) !== SLASH_CODE) {
|
|
574
1271
|
return this.test(path);
|
|
575
1272
|
}
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
1273
|
+
|
|
1274
|
+
// Like `git check-ignore`: a directory excluded by itself or by an
|
|
1275
|
+
// ancestor settles it, and only then is the literal 'abc/' matched
|
|
1276
|
+
// against the rules (see `checkSourceOf`).
|
|
1277
|
+
var dir = this._t(path, this._testCache);
|
|
1278
|
+
if (dir.ignored) {
|
|
1279
|
+
return dir;
|
|
583
1280
|
}
|
|
584
|
-
|
|
1281
|
+
var literal = this._rules.testLiteral(path);
|
|
1282
|
+
return literal.ignored || literal.unignored ? literal : dir;
|
|
585
1283
|
}
|
|
586
1284
|
}, {
|
|
587
1285
|
key: "_t",
|
|
@@ -589,37 +1287,23 @@ var Ignore = /*#__PURE__*/function () {
|
|
|
589
1287
|
// The path to be tested
|
|
590
1288
|
path,
|
|
591
1289
|
// The cache for the result of a certain checking
|
|
592
|
-
cache
|
|
593
|
-
// Whether should check if the path is unignored
|
|
594
|
-
checkUnignored,
|
|
595
|
-
// The path slices
|
|
596
|
-
slices) {
|
|
1290
|
+
cache) {
|
|
597
1291
|
if (path in cache) {
|
|
598
1292
|
return cache[path];
|
|
599
1293
|
}
|
|
600
|
-
|
|
601
|
-
// path/to/a.js
|
|
602
|
-
// ['path', 'to', 'a.js']
|
|
603
|
-
slices = path.split(SLASH).filter(Boolean);
|
|
604
|
-
}
|
|
605
|
-
slices.pop();
|
|
606
|
-
|
|
607
|
-
// If the path has no parent directory, just test it
|
|
608
|
-
if (!slices.length) {
|
|
609
|
-
return cache[path] = this._rules.test(path, checkUnignored, MODE_IGNORE);
|
|
610
|
-
}
|
|
611
|
-
var parent = this._t(slices.join(SLASH) + SLASH, cache, checkUnignored, slices);
|
|
1294
|
+
var parentPath = parentOf(path);
|
|
612
1295
|
|
|
613
1296
|
// If the path contains a parent directory, check the parent first
|
|
614
|
-
|
|
1297
|
+
var parent = parentPath ? this._t(parentPath, cache) : UNDEFINED;
|
|
1298
|
+
return cache[path] = parent && parent.ignored
|
|
615
1299
|
// > It is not possible to re-include a file if a parent directory of
|
|
616
1300
|
// > that file is excluded.
|
|
617
|
-
? parent : this._rules.test(path,
|
|
1301
|
+
? parent : this._rules.test(path, MODE_IGNORE);
|
|
618
1302
|
}
|
|
619
1303
|
}, {
|
|
620
1304
|
key: "ignores",
|
|
621
1305
|
value: function ignores(path) {
|
|
622
|
-
return this._test(path, this._ignoreCache
|
|
1306
|
+
return this._test(path, this._ignoreCache).ignored;
|
|
623
1307
|
}
|
|
624
1308
|
}, {
|
|
625
1309
|
key: "createFilter",
|
|
@@ -639,7 +1323,7 @@ var Ignore = /*#__PURE__*/function () {
|
|
|
639
1323
|
}, {
|
|
640
1324
|
key: "test",
|
|
641
1325
|
value: function test(path) {
|
|
642
|
-
return this._test(path, this._testCache
|
|
1326
|
+
return this._test(path, this._testCache);
|
|
643
1327
|
}
|
|
644
1328
|
}]);
|
|
645
1329
|
return Ignore;
|