repoburg 1.3.87 → 1.3.91
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/backend/.env +20 -0
- package/backend/.repoburg/hooks/README.md +53 -0
- package/backend/.repoburg/hooks/eslint-hook.ts +46 -0
- package/backend/.repoburg/hooks/example-hook.ts +62 -0
- package/backend/dist/src/ai-actions/ai-actions.controller.js +67 -0
- package/backend/dist/src/ai-actions/ai-actions.controller.js.map +1 -1
- package/backend/dist/src/app.module.d.ts +3 -1
- package/backend/dist/src/app.module.js +17 -1
- package/backend/dist/src/app.module.js.map +1 -1
- package/backend/dist/src/application-state/application-state.controller.js +123 -0
- package/backend/dist/src/application-state/application-state.controller.js.map +1 -1
- package/backend/dist/src/application-state/application-state.service.d.ts +3 -0
- package/backend/dist/src/application-state/application-state.service.js +18 -1
- package/backend/dist/src/application-state/application-state.service.js.map +1 -1
- package/backend/dist/src/application-state/dto/set-alibaba-config.dto.js +2 -0
- package/backend/dist/src/application-state/dto/set-alibaba-config.dto.js.map +1 -1
- package/backend/dist/src/application-state/dto/set-auto-context-fetch-enabled.dto.js +4 -0
- package/backend/dist/src/application-state/dto/set-auto-context-fetch-enabled.dto.js.map +1 -1
- package/backend/dist/src/application-state/dto/set-auto-send-to-ai-studio-enabled.dto.js +2 -0
- package/backend/dist/src/application-state/dto/set-auto-send-to-ai-studio-enabled.dto.js.map +1 -1
- package/backend/dist/src/application-state/dto/set-context-token-limit.dto.js +6 -0
- package/backend/dist/src/application-state/dto/set-context-token-limit.dto.js.map +1 -1
- package/backend/dist/src/application-state/dto/set-execution-strategy.dto.js +6 -0
- package/backend/dist/src/application-state/dto/set-execution-strategy.dto.js.map +1 -1
- package/backend/dist/src/application-state/dto/set-followup-token-limit.dto.js +5 -0
- package/backend/dist/src/application-state/dto/set-followup-token-limit.dto.js.map +1 -1
- package/backend/dist/src/application-state/dto/set-history-compression-enabled.dto.js +4 -0
- package/backend/dist/src/application-state/dto/set-history-compression-enabled.dto.js.map +1 -1
- package/backend/dist/src/application-state/dto/set-llm-retry-enabled.dto.js +4 -0
- package/backend/dist/src/application-state/dto/set-llm-retry-enabled.dto.js.map +1 -1
- package/backend/dist/src/application-state/dto/set-llm-retry-max-attempts.dto.js +6 -0
- package/backend/dist/src/application-state/dto/set-llm-retry-max-attempts.dto.js.map +1 -1
- package/backend/dist/src/application-state/dto/set-manual-llm-enabled.dto.js +4 -0
- package/backend/dist/src/application-state/dto/set-manual-llm-enabled.dto.js.map +1 -1
- package/backend/dist/src/application-state/dto/set-openrouter-config.dto.js +2 -0
- package/backend/dist/src/application-state/dto/set-openrouter-config.dto.js.map +1 -1
- package/backend/dist/src/application-state/dto/set-streaming-enabled.dto.js +2 -0
- package/backend/dist/src/application-state/dto/set-streaming-enabled.dto.js.map +1 -1
- package/backend/dist/src/application-state/dto/set-syntax-validation-enabled.dto.js +4 -0
- package/backend/dist/src/application-state/dto/set-syntax-validation-enabled.dto.js.map +1 -1
- package/backend/dist/src/application-state/dto/set-theme.dto.js +6 -0
- package/backend/dist/src/application-state/dto/set-theme.dto.js.map +1 -1
- package/backend/dist/src/application-state/dto/set-tools-enabled.dto.js +4 -0
- package/backend/dist/src/application-state/dto/set-tools-enabled.dto.js.map +1 -1
- package/backend/dist/src/application-state/dto/set-websocket-enabled.dto.js +2 -0
- package/backend/dist/src/application-state/dto/set-websocket-enabled.dto.js.map +1 -1
- package/backend/dist/src/application-state/dto/set-yolo-mode-message.dto.js +5 -0
- package/backend/dist/src/application-state/dto/set-yolo-mode-message.dto.js.map +1 -1
- package/backend/dist/src/application-state/dto/set-yolo-mode.dto.js +4 -0
- package/backend/dist/src/application-state/dto/set-yolo-mode.dto.js.map +1 -1
- package/backend/dist/src/application-state/dto/set-zai-config.dto.js +2 -0
- package/backend/dist/src/application-state/dto/set-zai-config.dto.js.map +1 -1
- package/backend/dist/src/common/cache/etag-cache.service.d.ts +18 -0
- package/backend/dist/src/common/cache/etag-cache.service.js +98 -0
- package/backend/dist/src/common/cache/etag-cache.service.js.map +1 -0
- package/backend/dist/src/common/common.module.d.ts +2 -0
- package/backend/dist/src/common/common.module.js +22 -0
- package/backend/dist/src/common/common.module.js.map +1 -0
- package/backend/dist/src/common/interceptors/etag-cache.interceptor.d.ts +14 -0
- package/backend/dist/src/common/interceptors/etag-cache.interceptor.js +69 -0
- package/backend/dist/src/common/interceptors/etag-cache.interceptor.js.map +1 -0
- package/backend/dist/src/common/middleware/cache.middleware.d.ts +8 -0
- package/backend/dist/src/common/middleware/cache.middleware.js +44 -0
- package/backend/dist/src/common/middleware/cache.middleware.js.map +1 -0
- package/backend/dist/src/context-snippets/context-snippets.controller.js +38 -0
- package/backend/dist/src/context-snippets/context-snippets.controller.js.map +1 -1
- package/backend/dist/src/context-templates/context-templates.controller.js +104 -0
- package/backend/dist/src/context-templates/context-templates.controller.js.map +1 -1
- package/backend/dist/src/context-templates/dto/context-template.dto.d.ts +1 -1
- package/backend/dist/src/context-templates/dto/context-template.dto.js +44 -1
- package/backend/dist/src/context-templates/dto/context-template.dto.js.map +1 -1
- package/backend/dist/src/core-entities/ai-action.entity.js +73 -0
- package/backend/dist/src/core-entities/ai-action.entity.js.map +1 -1
- package/backend/dist/src/core-entities/base.entity.js +18 -0
- package/backend/dist/src/core-entities/base.entity.js.map +1 -1
- package/backend/dist/src/core-entities/context-snippet.entity.js +12 -0
- package/backend/dist/src/core-entities/context-snippet.entity.js.map +1 -1
- package/backend/dist/src/core-entities/context-template.entity.d.ts +2 -4
- package/backend/dist/src/core-entities/context-template.entity.js +50 -7
- package/backend/dist/src/core-entities/context-template.entity.js.map +1 -1
- package/backend/dist/src/core-entities/custom-snippet.entity.js +16 -0
- package/backend/dist/src/core-entities/custom-snippet.entity.js.map +1 -1
- package/backend/dist/src/core-entities/custom-variable.entity.js +24 -0
- package/backend/dist/src/core-entities/custom-variable.entity.js.map +1 -1
- package/backend/dist/src/core-entities/enums.d.ts +64 -0
- package/backend/dist/src/core-entities/enums.js +77 -0
- package/backend/dist/src/core-entities/enums.js.map +1 -0
- package/backend/dist/src/core-entities/execution-log.entity.js +15 -0
- package/backend/dist/src/core-entities/execution-log.entity.js.map +1 -1
- package/backend/dist/src/core-entities/index.d.ts +1 -2
- package/backend/dist/src/core-entities/index.js +1 -2
- package/backend/dist/src/core-entities/index.js.map +1 -1
- package/backend/dist/src/core-entities/llm-call-log.entity.js +43 -0
- package/backend/dist/src/core-entities/llm-call-log.entity.js.map +1 -1
- package/backend/dist/src/core-entities/mcp-config.entity.js +27 -0
- package/backend/dist/src/core-entities/mcp-config.entity.js.map +1 -1
- package/backend/dist/src/core-entities/mcp-tool.entity.js +26 -0
- package/backend/dist/src/core-entities/mcp-tool.entity.js.map +1 -1
- package/backend/dist/src/core-entities/project.entity.js +13 -0
- package/backend/dist/src/core-entities/project.entity.js.map +1 -1
- package/backend/dist/src/core-entities/session-input.entity.js +95 -0
- package/backend/dist/src/core-entities/session-input.entity.js.map +1 -1
- package/backend/dist/src/core-entities/session.entity.d.ts +1 -1
- package/backend/dist/src/core-entities/session.entity.js +96 -1
- package/backend/dist/src/core-entities/session.entity.js.map +1 -1
- package/backend/dist/src/core-entities/system-prompt.entity.js +29 -0
- package/backend/dist/src/core-entities/system-prompt.entity.js.map +1 -1
- package/backend/dist/src/core-entities/tool-hook.entity.js +21 -0
- package/backend/dist/src/core-entities/tool-hook.entity.js.map +1 -1
- package/backend/dist/src/custom-snippets/custom-snippets.controller.js +48 -0
- package/backend/dist/src/custom-snippets/custom-snippets.controller.js.map +1 -1
- package/backend/dist/src/custom-variables/custom-variables.controller.js +46 -0
- package/backend/dist/src/custom-variables/custom-variables.controller.js.map +1 -1
- package/backend/dist/src/global-config/global-config.controller.js +12 -0
- package/backend/dist/src/global-config/global-config.controller.js.map +1 -1
- package/backend/dist/src/global-config/global-config.service.d.ts +1 -0
- package/backend/dist/src/global-config/global-config.service.js.map +1 -1
- package/backend/dist/src/interactive-chat/streaming.controller.js +38 -0
- package/backend/dist/src/interactive-chat/streaming.controller.js.map +1 -1
- package/backend/dist/src/llm-call-logs/llm-call-logs.controller.js +96 -0
- package/backend/dist/src/llm-call-logs/llm-call-logs.controller.js.map +1 -1
- package/backend/dist/src/llm-provider/llm-provider.controller.js +18 -0
- package/backend/dist/src/llm-provider/llm-provider.controller.js.map +1 -1
- package/backend/dist/src/llm-provider/zai-llm.provider.js +1 -1
- package/backend/dist/src/llm-provider/zai-llm.provider.js.map +1 -1
- package/backend/dist/src/llm-responses/dto/submit-llm-response.dto.js +45 -0
- package/backend/dist/src/llm-responses/dto/submit-llm-response.dto.js.map +1 -1
- package/backend/dist/src/llm-responses/dto/sync-conversation.dto.js +24 -0
- package/backend/dist/src/llm-responses/dto/sync-conversation.dto.js.map +1 -1
- package/backend/dist/src/llm-responses/llm-responses.controller.js +32 -0
- package/backend/dist/src/llm-responses/llm-responses.controller.js.map +1 -1
- package/backend/dist/src/main.js +9 -0
- package/backend/dist/src/main.js.map +1 -1
- package/backend/dist/src/mcp/dto/batch-update-mcp-tools.dto.js +8 -0
- package/backend/dist/src/mcp/dto/batch-update-mcp-tools.dto.js.map +1 -1
- package/backend/dist/src/mcp/dto/create-mcp-config.dto.js +5 -0
- package/backend/dist/src/mcp/dto/create-mcp-config.dto.js.map +1 -1
- package/backend/dist/src/mcp/dto/update-mcp-config.dto.js +2 -0
- package/backend/dist/src/mcp/dto/update-mcp-config.dto.js.map +1 -1
- package/backend/dist/src/mcp/mcp.controller.js +21 -0
- package/backend/dist/src/mcp/mcp.controller.js.map +1 -1
- package/backend/dist/src/projects/dto/project.dto.js +14 -0
- package/backend/dist/src/projects/dto/project.dto.js.map +1 -1
- package/backend/dist/src/projects/projects.controller.js +31 -0
- package/backend/dist/src/projects/projects.controller.js.map +1 -1
- package/backend/dist/src/session-inputs/dto/session-input.dto.d.ts +12 -1
- package/backend/dist/src/session-inputs/dto/session-input.dto.js +103 -1
- package/backend/dist/src/session-inputs/dto/session-input.dto.js.map +1 -1
- package/backend/dist/src/session-inputs/session-input.subscriber.js.map +1 -1
- package/backend/dist/src/session-inputs/session-inputs.controller.d.ts +2 -1
- package/backend/dist/src/session-inputs/session-inputs.controller.js +84 -0
- package/backend/dist/src/session-inputs/session-inputs.controller.js.map +1 -1
- package/backend/dist/src/session-inputs/session-inputs.module.js +1 -0
- package/backend/dist/src/session-inputs/session-inputs.module.js.map +1 -1
- package/backend/dist/src/session-inputs/session-inputs.service.d.ts +7 -3
- package/backend/dist/src/session-inputs/session-inputs.service.js +51 -4
- package/backend/dist/src/session-inputs/session-inputs.service.js.map +1 -1
- package/backend/dist/src/sessions/dto/session.dto.js +91 -0
- package/backend/dist/src/sessions/dto/session.dto.js.map +1 -1
- package/backend/dist/src/sessions/sessions.controller.d.ts +1 -1
- package/backend/dist/src/sessions/sessions.controller.js +123 -3
- package/backend/dist/src/sessions/sessions.controller.js.map +1 -1
- package/backend/dist/src/sessions/sessions.service.d.ts +2 -1
- package/backend/dist/src/sessions/sessions.service.js +47 -18
- package/backend/dist/src/sessions/sessions.service.js.map +1 -1
- package/backend/dist/src/sub-agents/dto/create-sub-agent.dto.js +26 -0
- package/backend/dist/src/sub-agents/dto/create-sub-agent.dto.js.map +1 -1
- package/backend/dist/src/sub-agents/dto/update-sub-agent.dto.js +22 -0
- package/backend/dist/src/sub-agents/dto/update-sub-agent.dto.js.map +1 -1
- package/backend/dist/src/sub-agents/sub-agent-run.entity.d.ts +2 -7
- package/backend/dist/src/sub-agents/sub-agent-run.entity.js +63 -9
- package/backend/dist/src/sub-agents/sub-agent-run.entity.js.map +1 -1
- package/backend/dist/src/sub-agents/sub-agent-runs.controller.js +63 -0
- package/backend/dist/src/sub-agents/sub-agent-runs.controller.js.map +1 -1
- package/backend/dist/src/sub-agents/sub-agent.entity.js +47 -0
- package/backend/dist/src/sub-agents/sub-agent.entity.js.map +1 -1
- package/backend/dist/src/sub-agents/sub-agents.controller.js +25 -0
- package/backend/dist/src/sub-agents/sub-agents.controller.js.map +1 -1
- package/backend/dist/src/system-prompts/dto/set-enabled-tools.dto.js +9 -0
- package/backend/dist/src/system-prompts/dto/set-enabled-tools.dto.js.map +1 -1
- package/backend/dist/src/system-prompts/dto/system-prompt.dto.js +43 -0
- package/backend/dist/src/system-prompts/dto/system-prompt.dto.js.map +1 -1
- package/backend/dist/src/system-prompts/dto/toggle-tool.dto.js +5 -0
- package/backend/dist/src/system-prompts/dto/toggle-tool.dto.js.map +1 -1
- package/backend/dist/src/system-prompts/system-prompts.controller.js +80 -0
- package/backend/dist/src/system-prompts/system-prompts.controller.js.map +1 -1
- package/backend/dist/src/tool-hooks/dto/create-tool-hook.dto.js +14 -0
- package/backend/dist/src/tool-hooks/dto/create-tool-hook.dto.js.map +1 -1
- package/backend/dist/src/tool-hooks/dto/update-tool-hook.dto.js +11 -0
- package/backend/dist/src/tool-hooks/dto/update-tool-hook.dto.js.map +1 -1
- package/backend/dist/src/tool-hooks/tool-hooks.controller.js +52 -0
- package/backend/dist/src/tool-hooks/tool-hooks.controller.js.map +1 -1
- package/backend/dist/src/visual-editor/visual-editor.controller.js +15 -0
- package/backend/dist/src/visual-editor/visual-editor.controller.js.map +1 -1
- package/backend/dist/src/workspace/workspace.controller.js +41 -0
- package/backend/dist/src/workspace/workspace.controller.js.map +1 -1
- package/backend/dist/tsconfig.build.tsbuildinfo +1 -1
- package/{daemon/node_modules/undici-types → backend/node_modules/@eslint/eslintrc}/LICENSE +5 -7
- package/backend/node_modules/@eslint/eslintrc/README.md +115 -0
- package/backend/node_modules/@eslint/eslintrc/conf/config-schema.js +79 -0
- package/backend/node_modules/@eslint/eslintrc/conf/environments.js +215 -0
- package/backend/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs +1104 -0
- package/backend/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs.map +1 -0
- package/backend/node_modules/@eslint/eslintrc/dist/eslintrc.cjs +4344 -0
- package/backend/node_modules/@eslint/eslintrc/dist/eslintrc.cjs.map +1 -0
- package/backend/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js +532 -0
- package/backend/node_modules/@eslint/eslintrc/lib/config-array/config-array.js +523 -0
- package/backend/node_modules/@eslint/eslintrc/lib/config-array/config-dependency.js +124 -0
- package/backend/node_modules/@eslint/eslintrc/lib/config-array/extracted-config.js +145 -0
- package/backend/node_modules/@eslint/eslintrc/lib/config-array/ignore-pattern.js +238 -0
- package/backend/node_modules/@eslint/eslintrc/lib/config-array/index.js +19 -0
- package/backend/node_modules/@eslint/eslintrc/lib/config-array/override-tester.js +225 -0
- package/backend/node_modules/@eslint/eslintrc/lib/config-array-factory.js +1151 -0
- package/backend/node_modules/@eslint/eslintrc/lib/flat-compat.js +318 -0
- package/backend/node_modules/@eslint/eslintrc/lib/index-universal.js +29 -0
- package/backend/node_modules/@eslint/eslintrc/lib/index.js +56 -0
- package/backend/node_modules/@eslint/eslintrc/lib/shared/ajv.js +191 -0
- package/backend/node_modules/@eslint/eslintrc/lib/shared/config-ops.js +135 -0
- package/backend/node_modules/@eslint/eslintrc/lib/shared/config-validator.js +325 -0
- package/backend/node_modules/@eslint/eslintrc/lib/shared/deprecation-warnings.js +63 -0
- package/backend/node_modules/@eslint/eslintrc/lib/shared/naming.js +96 -0
- package/backend/node_modules/@eslint/eslintrc/lib/shared/relative-module-resolver.js +42 -0
- package/backend/node_modules/@eslint/eslintrc/lib/shared/types.js +149 -0
- package/backend/node_modules/@eslint/eslintrc/package.json +82 -0
- package/backend/node_modules/@eslint/eslintrc/universal.js +9 -0
- package/backend/package.json +2 -4
- package/daemon/dist/api/system.js +25 -0
- package/daemon/dist/daemon.blob +0 -0
- package/daemon/dist/index.js +0 -0
- package/package.json +3 -1
- package/visual-editor-proxy/.repoburg/data.sqlite +0 -0
- package/visual-editor-proxy/dist/tsconfig.tsbuildinfo +1 -1
- package/backend/node_modules/@types/node/LICENSE +0 -21
- package/backend/node_modules/@types/node/README.md +0 -15
- package/backend/node_modules/@types/node/assert/strict.d.ts +0 -8
- package/backend/node_modules/@types/node/assert.d.ts +0 -1044
- package/backend/node_modules/@types/node/async_hooks.d.ts +0 -605
- package/backend/node_modules/@types/node/buffer.buffer.d.ts +0 -462
- package/backend/node_modules/@types/node/buffer.d.ts +0 -1932
- package/backend/node_modules/@types/node/child_process.d.ts +0 -1452
- package/backend/node_modules/@types/node/cluster.d.ts +0 -578
- package/backend/node_modules/@types/node/compatibility/disposable.d.ts +0 -16
- package/backend/node_modules/@types/node/compatibility/index.d.ts +0 -9
- package/backend/node_modules/@types/node/compatibility/indexable.d.ts +0 -20
- package/backend/node_modules/@types/node/compatibility/iterators.d.ts +0 -21
- package/backend/node_modules/@types/node/console.d.ts +0 -452
- package/backend/node_modules/@types/node/constants.d.ts +0 -21
- package/backend/node_modules/@types/node/crypto.d.ts +0 -4570
- package/backend/node_modules/@types/node/dgram.d.ts +0 -596
- package/backend/node_modules/@types/node/diagnostics_channel.d.ts +0 -578
- package/backend/node_modules/@types/node/dns/promises.d.ts +0 -479
- package/backend/node_modules/@types/node/dns.d.ts +0 -871
- package/backend/node_modules/@types/node/domain.d.ts +0 -170
- package/backend/node_modules/@types/node/events.d.ts +0 -931
- package/backend/node_modules/@types/node/fs/promises.d.ts +0 -1248
- package/backend/node_modules/@types/node/fs.d.ts +0 -4362
- package/backend/node_modules/@types/node/globals.d.ts +0 -170
- package/backend/node_modules/@types/node/globals.typedarray.d.ts +0 -21
- package/backend/node_modules/@types/node/http.d.ts +0 -2031
- package/backend/node_modules/@types/node/http2.d.ts +0 -2623
- package/backend/node_modules/@types/node/https.d.ts +0 -549
- package/backend/node_modules/@types/node/index.d.ts +0 -93
- package/backend/node_modules/@types/node/inspector.generated.d.ts +0 -3966
- package/backend/node_modules/@types/node/module.d.ts +0 -539
- package/backend/node_modules/@types/node/net.d.ts +0 -1011
- package/backend/node_modules/@types/node/os.d.ts +0 -495
- package/backend/node_modules/@types/node/package.json +0 -140
- package/backend/node_modules/@types/node/path.d.ts +0 -200
- package/backend/node_modules/@types/node/perf_hooks.d.ts +0 -963
- package/backend/node_modules/@types/node/process.d.ts +0 -1956
- package/backend/node_modules/@types/node/punycode.d.ts +0 -117
- package/backend/node_modules/@types/node/querystring.d.ts +0 -152
- package/backend/node_modules/@types/node/readline/promises.d.ts +0 -162
- package/backend/node_modules/@types/node/readline.d.ts +0 -589
- package/backend/node_modules/@types/node/repl.d.ts +0 -430
- package/backend/node_modules/@types/node/sea.d.ts +0 -153
- package/backend/node_modules/@types/node/stream/consumers.d.ts +0 -38
- package/backend/node_modules/@types/node/stream/promises.d.ts +0 -90
- package/backend/node_modules/@types/node/stream/web.d.ts +0 -533
- package/backend/node_modules/@types/node/stream.d.ts +0 -1668
- package/backend/node_modules/@types/node/string_decoder.d.ts +0 -67
- package/backend/node_modules/@types/node/test.d.ts +0 -1807
- package/backend/node_modules/@types/node/timers/promises.d.ts +0 -108
- package/backend/node_modules/@types/node/timers.d.ts +0 -286
- package/backend/node_modules/@types/node/tls.d.ts +0 -1231
- package/backend/node_modules/@types/node/trace_events.d.ts +0 -197
- package/backend/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +0 -460
- package/backend/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +0 -19
- package/backend/node_modules/@types/node/ts5.6/index.d.ts +0 -93
- package/backend/node_modules/@types/node/tty.d.ts +0 -208
- package/backend/node_modules/@types/node/url.d.ts +0 -964
- package/backend/node_modules/@types/node/util.d.ts +0 -2331
- package/backend/node_modules/@types/node/v8.d.ts +0 -808
- package/backend/node_modules/@types/node/vm.d.ts +0 -1030
- package/backend/node_modules/@types/node/wasi.d.ts +0 -181
- package/backend/node_modules/@types/node/web-globals/abortcontroller.d.ts +0 -34
- package/backend/node_modules/@types/node/web-globals/domexception.d.ts +0 -68
- package/backend/node_modules/@types/node/web-globals/events.d.ts +0 -94
- package/backend/node_modules/@types/node/web-globals/fetch.d.ts +0 -46
- package/backend/node_modules/@types/node/worker_threads.d.ts +0 -743
- package/backend/node_modules/@types/node/zlib.d.ts +0 -539
- package/backend/node_modules/debug/LICENSE +0 -20
- package/backend/node_modules/debug/README.md +0 -481
- package/backend/node_modules/debug/package.json +0 -64
- package/backend/node_modules/debug/src/browser.js +0 -272
- package/backend/node_modules/debug/src/common.js +0 -292
- package/backend/node_modules/debug/src/index.js +0 -10
- package/backend/node_modules/debug/src/node.js +0 -263
- package/backend/node_modules/undici-types/LICENSE +0 -21
- package/backend/node_modules/undici-types/README.md +0 -6
- package/backend/node_modules/undici-types/agent.d.ts +0 -31
- package/backend/node_modules/undici-types/api.d.ts +0 -43
- package/backend/node_modules/undici-types/balanced-pool.d.ts +0 -29
- package/backend/node_modules/undici-types/cache.d.ts +0 -36
- package/backend/node_modules/undici-types/client.d.ts +0 -108
- package/backend/node_modules/undici-types/connector.d.ts +0 -34
- package/backend/node_modules/undici-types/content-type.d.ts +0 -21
- package/backend/node_modules/undici-types/cookies.d.ts +0 -28
- package/backend/node_modules/undici-types/diagnostics-channel.d.ts +0 -66
- package/backend/node_modules/undici-types/dispatcher.d.ts +0 -256
- package/backend/node_modules/undici-types/env-http-proxy-agent.d.ts +0 -21
- package/backend/node_modules/undici-types/errors.d.ts +0 -149
- package/backend/node_modules/undici-types/eventsource.d.ts +0 -61
- package/backend/node_modules/undici-types/fetch.d.ts +0 -209
- package/backend/node_modules/undici-types/file.d.ts +0 -39
- package/backend/node_modules/undici-types/filereader.d.ts +0 -54
- package/backend/node_modules/undici-types/formdata.d.ts +0 -108
- package/backend/node_modules/undici-types/global-dispatcher.d.ts +0 -9
- package/backend/node_modules/undici-types/global-origin.d.ts +0 -7
- package/backend/node_modules/undici-types/handlers.d.ts +0 -15
- package/backend/node_modules/undici-types/header.d.ts +0 -4
- package/backend/node_modules/undici-types/index.d.ts +0 -71
- package/backend/node_modules/undici-types/interceptors.d.ts +0 -17
- package/backend/node_modules/undici-types/mock-agent.d.ts +0 -50
- package/backend/node_modules/undici-types/mock-client.d.ts +0 -25
- package/backend/node_modules/undici-types/mock-errors.d.ts +0 -12
- package/backend/node_modules/undici-types/mock-interceptor.d.ts +0 -93
- package/backend/node_modules/undici-types/mock-pool.d.ts +0 -25
- package/backend/node_modules/undici-types/package.json +0 -55
- package/backend/node_modules/undici-types/patch.d.ts +0 -33
- package/backend/node_modules/undici-types/pool-stats.d.ts +0 -19
- package/backend/node_modules/undici-types/pool.d.ts +0 -39
- package/backend/node_modules/undici-types/proxy-agent.d.ts +0 -28
- package/backend/node_modules/undici-types/readable.d.ts +0 -65
- package/backend/node_modules/undici-types/retry-agent.d.ts +0 -8
- package/backend/node_modules/undici-types/retry-handler.d.ts +0 -116
- package/backend/node_modules/undici-types/util.d.ts +0 -18
- package/backend/node_modules/undici-types/webidl.d.ts +0 -228
- package/backend/node_modules/undici-types/websocket.d.ts +0 -150
- package/daemon/node_modules/@types/node/LICENSE +0 -21
- package/daemon/node_modules/@types/node/README.md +0 -15
- package/daemon/node_modules/@types/node/assert/strict.d.ts +0 -8
- package/daemon/node_modules/@types/node/assert.d.ts +0 -1044
- package/daemon/node_modules/@types/node/async_hooks.d.ts +0 -605
- package/daemon/node_modules/@types/node/buffer.buffer.d.ts +0 -462
- package/daemon/node_modules/@types/node/buffer.d.ts +0 -1932
- package/daemon/node_modules/@types/node/child_process.d.ts +0 -1452
- package/daemon/node_modules/@types/node/cluster.d.ts +0 -578
- package/daemon/node_modules/@types/node/compatibility/disposable.d.ts +0 -16
- package/daemon/node_modules/@types/node/compatibility/index.d.ts +0 -9
- package/daemon/node_modules/@types/node/compatibility/indexable.d.ts +0 -20
- package/daemon/node_modules/@types/node/compatibility/iterators.d.ts +0 -21
- package/daemon/node_modules/@types/node/console.d.ts +0 -452
- package/daemon/node_modules/@types/node/constants.d.ts +0 -21
- package/daemon/node_modules/@types/node/crypto.d.ts +0 -4570
- package/daemon/node_modules/@types/node/dgram.d.ts +0 -596
- package/daemon/node_modules/@types/node/diagnostics_channel.d.ts +0 -578
- package/daemon/node_modules/@types/node/dns/promises.d.ts +0 -479
- package/daemon/node_modules/@types/node/dns.d.ts +0 -871
- package/daemon/node_modules/@types/node/domain.d.ts +0 -170
- package/daemon/node_modules/@types/node/events.d.ts +0 -931
- package/daemon/node_modules/@types/node/fs/promises.d.ts +0 -1248
- package/daemon/node_modules/@types/node/fs.d.ts +0 -4362
- package/daemon/node_modules/@types/node/globals.d.ts +0 -170
- package/daemon/node_modules/@types/node/globals.typedarray.d.ts +0 -21
- package/daemon/node_modules/@types/node/http.d.ts +0 -2031
- package/daemon/node_modules/@types/node/http2.d.ts +0 -2623
- package/daemon/node_modules/@types/node/https.d.ts +0 -549
- package/daemon/node_modules/@types/node/index.d.ts +0 -93
- package/daemon/node_modules/@types/node/inspector.generated.d.ts +0 -3966
- package/daemon/node_modules/@types/node/module.d.ts +0 -539
- package/daemon/node_modules/@types/node/net.d.ts +0 -1011
- package/daemon/node_modules/@types/node/os.d.ts +0 -495
- package/daemon/node_modules/@types/node/package.json +0 -140
- package/daemon/node_modules/@types/node/path.d.ts +0 -200
- package/daemon/node_modules/@types/node/perf_hooks.d.ts +0 -963
- package/daemon/node_modules/@types/node/process.d.ts +0 -1956
- package/daemon/node_modules/@types/node/punycode.d.ts +0 -117
- package/daemon/node_modules/@types/node/querystring.d.ts +0 -152
- package/daemon/node_modules/@types/node/readline/promises.d.ts +0 -162
- package/daemon/node_modules/@types/node/readline.d.ts +0 -589
- package/daemon/node_modules/@types/node/repl.d.ts +0 -430
- package/daemon/node_modules/@types/node/sea.d.ts +0 -153
- package/daemon/node_modules/@types/node/stream/consumers.d.ts +0 -38
- package/daemon/node_modules/@types/node/stream/promises.d.ts +0 -90
- package/daemon/node_modules/@types/node/stream/web.d.ts +0 -533
- package/daemon/node_modules/@types/node/stream.d.ts +0 -1668
- package/daemon/node_modules/@types/node/string_decoder.d.ts +0 -67
- package/daemon/node_modules/@types/node/test.d.ts +0 -1807
- package/daemon/node_modules/@types/node/timers/promises.d.ts +0 -108
- package/daemon/node_modules/@types/node/timers.d.ts +0 -286
- package/daemon/node_modules/@types/node/tls.d.ts +0 -1231
- package/daemon/node_modules/@types/node/trace_events.d.ts +0 -197
- package/daemon/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +0 -460
- package/daemon/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +0 -19
- package/daemon/node_modules/@types/node/ts5.6/index.d.ts +0 -93
- package/daemon/node_modules/@types/node/tty.d.ts +0 -208
- package/daemon/node_modules/@types/node/url.d.ts +0 -964
- package/daemon/node_modules/@types/node/util.d.ts +0 -2331
- package/daemon/node_modules/@types/node/v8.d.ts +0 -808
- package/daemon/node_modules/@types/node/vm.d.ts +0 -1030
- package/daemon/node_modules/@types/node/wasi.d.ts +0 -181
- package/daemon/node_modules/@types/node/web-globals/abortcontroller.d.ts +0 -34
- package/daemon/node_modules/@types/node/web-globals/domexception.d.ts +0 -68
- package/daemon/node_modules/@types/node/web-globals/events.d.ts +0 -94
- package/daemon/node_modules/@types/node/web-globals/fetch.d.ts +0 -46
- package/daemon/node_modules/@types/node/worker_threads.d.ts +0 -743
- package/daemon/node_modules/@types/node/zlib.d.ts +0 -539
- package/daemon/node_modules/undici-types/README.md +0 -6
- package/daemon/node_modules/undici-types/agent.d.ts +0 -31
- package/daemon/node_modules/undici-types/api.d.ts +0 -43
- package/daemon/node_modules/undici-types/balanced-pool.d.ts +0 -29
- package/daemon/node_modules/undici-types/cache.d.ts +0 -36
- package/daemon/node_modules/undici-types/client.d.ts +0 -108
- package/daemon/node_modules/undici-types/connector.d.ts +0 -34
- package/daemon/node_modules/undici-types/content-type.d.ts +0 -21
- package/daemon/node_modules/undici-types/cookies.d.ts +0 -28
- package/daemon/node_modules/undici-types/diagnostics-channel.d.ts +0 -66
- package/daemon/node_modules/undici-types/dispatcher.d.ts +0 -256
- package/daemon/node_modules/undici-types/env-http-proxy-agent.d.ts +0 -21
- package/daemon/node_modules/undici-types/errors.d.ts +0 -149
- package/daemon/node_modules/undici-types/eventsource.d.ts +0 -61
- package/daemon/node_modules/undici-types/fetch.d.ts +0 -209
- package/daemon/node_modules/undici-types/file.d.ts +0 -39
- package/daemon/node_modules/undici-types/filereader.d.ts +0 -54
- package/daemon/node_modules/undici-types/formdata.d.ts +0 -108
- package/daemon/node_modules/undici-types/global-dispatcher.d.ts +0 -9
- package/daemon/node_modules/undici-types/global-origin.d.ts +0 -7
- package/daemon/node_modules/undici-types/handlers.d.ts +0 -15
- package/daemon/node_modules/undici-types/header.d.ts +0 -4
- package/daemon/node_modules/undici-types/index.d.ts +0 -71
- package/daemon/node_modules/undici-types/interceptors.d.ts +0 -17
- package/daemon/node_modules/undici-types/mock-agent.d.ts +0 -50
- package/daemon/node_modules/undici-types/mock-client.d.ts +0 -25
- package/daemon/node_modules/undici-types/mock-errors.d.ts +0 -12
- package/daemon/node_modules/undici-types/mock-interceptor.d.ts +0 -93
- package/daemon/node_modules/undici-types/mock-pool.d.ts +0 -25
- package/daemon/node_modules/undici-types/package.json +0 -55
- package/daemon/node_modules/undici-types/patch.d.ts +0 -33
- package/daemon/node_modules/undici-types/pool-stats.d.ts +0 -19
- package/daemon/node_modules/undici-types/pool.d.ts +0 -39
- package/daemon/node_modules/undici-types/proxy-agent.d.ts +0 -28
- package/daemon/node_modules/undici-types/readable.d.ts +0 -65
- package/daemon/node_modules/undici-types/retry-agent.d.ts +0 -8
- package/daemon/node_modules/undici-types/retry-handler.d.ts +0 -116
- package/daemon/node_modules/undici-types/util.d.ts +0 -18
- package/daemon/node_modules/undici-types/webidl.d.ts +0 -228
- package/daemon/node_modules/undici-types/websocket.d.ts +0 -150
- package/visual-editor-proxy/node_modules/@types/node/LICENSE +0 -21
- package/visual-editor-proxy/node_modules/@types/node/README.md +0 -15
- package/visual-editor-proxy/node_modules/@types/node/assert/strict.d.ts +0 -8
- package/visual-editor-proxy/node_modules/@types/node/assert.d.ts +0 -1062
- package/visual-editor-proxy/node_modules/@types/node/async_hooks.d.ts +0 -605
- package/visual-editor-proxy/node_modules/@types/node/buffer.buffer.d.ts +0 -462
- package/visual-editor-proxy/node_modules/@types/node/buffer.d.ts +0 -1932
- package/visual-editor-proxy/node_modules/@types/node/child_process.d.ts +0 -1458
- package/visual-editor-proxy/node_modules/@types/node/cluster.d.ts +0 -577
- package/visual-editor-proxy/node_modules/@types/node/compatibility/disposable.d.ts +0 -16
- package/visual-editor-proxy/node_modules/@types/node/compatibility/index.d.ts +0 -9
- package/visual-editor-proxy/node_modules/@types/node/compatibility/indexable.d.ts +0 -20
- package/visual-editor-proxy/node_modules/@types/node/compatibility/iterators.d.ts +0 -21
- package/visual-editor-proxy/node_modules/@types/node/console.d.ts +0 -452
- package/visual-editor-proxy/node_modules/@types/node/constants.d.ts +0 -21
- package/visual-editor-proxy/node_modules/@types/node/crypto.d.ts +0 -4570
- package/visual-editor-proxy/node_modules/@types/node/dgram.d.ts +0 -596
- package/visual-editor-proxy/node_modules/@types/node/diagnostics_channel.d.ts +0 -578
- package/visual-editor-proxy/node_modules/@types/node/dns/promises.d.ts +0 -479
- package/visual-editor-proxy/node_modules/@types/node/dns.d.ts +0 -871
- package/visual-editor-proxy/node_modules/@types/node/domain.d.ts +0 -170
- package/visual-editor-proxy/node_modules/@types/node/events.d.ts +0 -977
- package/visual-editor-proxy/node_modules/@types/node/fs/promises.d.ts +0 -1248
- package/visual-editor-proxy/node_modules/@types/node/fs.d.ts +0 -4362
- package/visual-editor-proxy/node_modules/@types/node/globals.d.ts +0 -172
- package/visual-editor-proxy/node_modules/@types/node/globals.typedarray.d.ts +0 -21
- package/visual-editor-proxy/node_modules/@types/node/http.d.ts +0 -2030
- package/visual-editor-proxy/node_modules/@types/node/http2.d.ts +0 -2624
- package/visual-editor-proxy/node_modules/@types/node/https.d.ts +0 -546
- package/visual-editor-proxy/node_modules/@types/node/index.d.ts +0 -93
- package/visual-editor-proxy/node_modules/@types/node/inspector.generated.d.ts +0 -3966
- package/visual-editor-proxy/node_modules/@types/node/module.d.ts +0 -539
- package/visual-editor-proxy/node_modules/@types/node/net.d.ts +0 -1011
- package/visual-editor-proxy/node_modules/@types/node/os.d.ts +0 -505
- package/visual-editor-proxy/node_modules/@types/node/package.json +0 -140
- package/visual-editor-proxy/node_modules/@types/node/path.d.ts +0 -200
- package/visual-editor-proxy/node_modules/@types/node/perf_hooks.d.ts +0 -961
- package/visual-editor-proxy/node_modules/@types/node/process.d.ts +0 -1944
- package/visual-editor-proxy/node_modules/@types/node/punycode.d.ts +0 -117
- package/visual-editor-proxy/node_modules/@types/node/querystring.d.ts +0 -152
- package/visual-editor-proxy/node_modules/@types/node/readline/promises.d.ts +0 -162
- package/visual-editor-proxy/node_modules/@types/node/readline.d.ts +0 -589
- package/visual-editor-proxy/node_modules/@types/node/repl.d.ts +0 -430
- package/visual-editor-proxy/node_modules/@types/node/sea.d.ts +0 -153
- package/visual-editor-proxy/node_modules/@types/node/stream/consumers.d.ts +0 -38
- package/visual-editor-proxy/node_modules/@types/node/stream/promises.d.ts +0 -90
- package/visual-editor-proxy/node_modules/@types/node/stream/web.d.ts +0 -533
- package/visual-editor-proxy/node_modules/@types/node/stream.d.ts +0 -1675
- package/visual-editor-proxy/node_modules/@types/node/string_decoder.d.ts +0 -67
- package/visual-editor-proxy/node_modules/@types/node/test.d.ts +0 -1787
- package/visual-editor-proxy/node_modules/@types/node/timers/promises.d.ts +0 -108
- package/visual-editor-proxy/node_modules/@types/node/timers.d.ts +0 -286
- package/visual-editor-proxy/node_modules/@types/node/tls.d.ts +0 -1231
- package/visual-editor-proxy/node_modules/@types/node/trace_events.d.ts +0 -197
- package/visual-editor-proxy/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +0 -460
- package/visual-editor-proxy/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +0 -19
- package/visual-editor-proxy/node_modules/@types/node/ts5.6/index.d.ts +0 -93
- package/visual-editor-proxy/node_modules/@types/node/tty.d.ts +0 -208
- package/visual-editor-proxy/node_modules/@types/node/url.d.ts +0 -964
- package/visual-editor-proxy/node_modules/@types/node/util.d.ts +0 -2331
- package/visual-editor-proxy/node_modules/@types/node/v8.d.ts +0 -808
- package/visual-editor-proxy/node_modules/@types/node/vm.d.ts +0 -1000
- package/visual-editor-proxy/node_modules/@types/node/wasi.d.ts +0 -181
- package/visual-editor-proxy/node_modules/@types/node/web-globals/abortcontroller.d.ts +0 -34
- package/visual-editor-proxy/node_modules/@types/node/web-globals/domexception.d.ts +0 -68
- package/visual-editor-proxy/node_modules/@types/node/web-globals/events.d.ts +0 -97
- package/visual-editor-proxy/node_modules/@types/node/web-globals/fetch.d.ts +0 -46
- package/visual-editor-proxy/node_modules/@types/node/worker_threads.d.ts +0 -715
- package/visual-editor-proxy/node_modules/@types/node/zlib.d.ts +0 -539
- package/visual-editor-proxy/node_modules/undici-types/LICENSE +0 -21
- package/visual-editor-proxy/node_modules/undici-types/README.md +0 -6
- package/visual-editor-proxy/node_modules/undici-types/agent.d.ts +0 -31
- package/visual-editor-proxy/node_modules/undici-types/api.d.ts +0 -43
- package/visual-editor-proxy/node_modules/undici-types/balanced-pool.d.ts +0 -29
- package/visual-editor-proxy/node_modules/undici-types/cache.d.ts +0 -36
- package/visual-editor-proxy/node_modules/undici-types/client.d.ts +0 -108
- package/visual-editor-proxy/node_modules/undici-types/connector.d.ts +0 -34
- package/visual-editor-proxy/node_modules/undici-types/content-type.d.ts +0 -21
- package/visual-editor-proxy/node_modules/undici-types/cookies.d.ts +0 -28
- package/visual-editor-proxy/node_modules/undici-types/diagnostics-channel.d.ts +0 -66
- package/visual-editor-proxy/node_modules/undici-types/dispatcher.d.ts +0 -256
- package/visual-editor-proxy/node_modules/undici-types/env-http-proxy-agent.d.ts +0 -21
- package/visual-editor-proxy/node_modules/undici-types/errors.d.ts +0 -149
- package/visual-editor-proxy/node_modules/undici-types/eventsource.d.ts +0 -61
- package/visual-editor-proxy/node_modules/undici-types/fetch.d.ts +0 -209
- package/visual-editor-proxy/node_modules/undici-types/file.d.ts +0 -39
- package/visual-editor-proxy/node_modules/undici-types/filereader.d.ts +0 -54
- package/visual-editor-proxy/node_modules/undici-types/formdata.d.ts +0 -108
- package/visual-editor-proxy/node_modules/undici-types/global-dispatcher.d.ts +0 -9
- package/visual-editor-proxy/node_modules/undici-types/global-origin.d.ts +0 -7
- package/visual-editor-proxy/node_modules/undici-types/handlers.d.ts +0 -15
- package/visual-editor-proxy/node_modules/undici-types/header.d.ts +0 -4
- package/visual-editor-proxy/node_modules/undici-types/index.d.ts +0 -71
- package/visual-editor-proxy/node_modules/undici-types/interceptors.d.ts +0 -17
- package/visual-editor-proxy/node_modules/undici-types/mock-agent.d.ts +0 -50
- package/visual-editor-proxy/node_modules/undici-types/mock-client.d.ts +0 -25
- package/visual-editor-proxy/node_modules/undici-types/mock-errors.d.ts +0 -12
- package/visual-editor-proxy/node_modules/undici-types/mock-interceptor.d.ts +0 -93
- package/visual-editor-proxy/node_modules/undici-types/mock-pool.d.ts +0 -25
- package/visual-editor-proxy/node_modules/undici-types/package.json +0 -55
- package/visual-editor-proxy/node_modules/undici-types/patch.d.ts +0 -33
- package/visual-editor-proxy/node_modules/undici-types/pool-stats.d.ts +0 -19
- package/visual-editor-proxy/node_modules/undici-types/pool.d.ts +0 -39
- package/visual-editor-proxy/node_modules/undici-types/proxy-agent.d.ts +0 -28
- package/visual-editor-proxy/node_modules/undici-types/readable.d.ts +0 -65
- package/visual-editor-proxy/node_modules/undici-types/retry-agent.d.ts +0 -8
- package/visual-editor-proxy/node_modules/undici-types/retry-handler.d.ts +0 -116
- package/visual-editor-proxy/node_modules/undici-types/util.d.ts +0 -18
- package/visual-editor-proxy/node_modules/undici-types/webidl.d.ts +0 -228
- package/visual-editor-proxy/node_modules/undici-types/websocket.d.ts +0 -150
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview `ExtractedConfig` class.
|
|
3
|
+
*
|
|
4
|
+
* `ExtractedConfig` class expresses a final configuration for a specific file.
|
|
5
|
+
*
|
|
6
|
+
* It provides one method.
|
|
7
|
+
*
|
|
8
|
+
* - `toCompatibleObjectAsConfigFileContent()`
|
|
9
|
+
* Convert this configuration to the compatible object as the content of
|
|
10
|
+
* config files. It converts the loaded parser and plugins to strings.
|
|
11
|
+
* `CLIEngine#getConfigForFile(filePath)` method uses this method.
|
|
12
|
+
*
|
|
13
|
+
* `ConfigArray#extractConfig(filePath)` creates a `ExtractedConfig` instance.
|
|
14
|
+
*
|
|
15
|
+
* @author Toru Nagashima <https://github.com/mysticatea>
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { IgnorePattern } from "./ignore-pattern.js";
|
|
19
|
+
|
|
20
|
+
// For VSCode intellisense
|
|
21
|
+
/** @typedef {import("../../shared/types").ConfigData} ConfigData */
|
|
22
|
+
/** @typedef {import("../../shared/types").GlobalConf} GlobalConf */
|
|
23
|
+
/** @typedef {import("../../shared/types").SeverityConf} SeverityConf */
|
|
24
|
+
/** @typedef {import("./config-dependency").DependentParser} DependentParser */
|
|
25
|
+
/** @typedef {import("./config-dependency").DependentPlugin} DependentPlugin */
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Check if `xs` starts with `ys`.
|
|
29
|
+
* @template T
|
|
30
|
+
* @param {T[]} xs The array to check.
|
|
31
|
+
* @param {T[]} ys The array that may be the first part of `xs`.
|
|
32
|
+
* @returns {boolean} `true` if `xs` starts with `ys`.
|
|
33
|
+
*/
|
|
34
|
+
function startsWith(xs, ys) {
|
|
35
|
+
return xs.length >= ys.length && ys.every((y, i) => y === xs[i]);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The class for extracted config data.
|
|
40
|
+
*/
|
|
41
|
+
class ExtractedConfig {
|
|
42
|
+
constructor() {
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The config name what `noInlineConfig` setting came from.
|
|
46
|
+
* @type {string}
|
|
47
|
+
*/
|
|
48
|
+
this.configNameOfNoInlineConfig = "";
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Environments.
|
|
52
|
+
* @type {Record<string, boolean>}
|
|
53
|
+
*/
|
|
54
|
+
this.env = {};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Global variables.
|
|
58
|
+
* @type {Record<string, GlobalConf>}
|
|
59
|
+
*/
|
|
60
|
+
this.globals = {};
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* The glob patterns that ignore to lint.
|
|
64
|
+
* @type {(((filePath:string, dot?:boolean) => boolean) & { basePath:string; patterns:string[] }) | undefined}
|
|
65
|
+
*/
|
|
66
|
+
this.ignores = void 0;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* The flag that disables directive comments.
|
|
70
|
+
* @type {boolean|undefined}
|
|
71
|
+
*/
|
|
72
|
+
this.noInlineConfig = void 0;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Parser definition.
|
|
76
|
+
* @type {DependentParser|null}
|
|
77
|
+
*/
|
|
78
|
+
this.parser = null;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Options for the parser.
|
|
82
|
+
* @type {Object}
|
|
83
|
+
*/
|
|
84
|
+
this.parserOptions = {};
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Plugin definitions.
|
|
88
|
+
* @type {Record<string, DependentPlugin>}
|
|
89
|
+
*/
|
|
90
|
+
this.plugins = {};
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Processor ID.
|
|
94
|
+
* @type {string|null}
|
|
95
|
+
*/
|
|
96
|
+
this.processor = null;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* The flag that reports unused `eslint-disable` directive comments.
|
|
100
|
+
* @type {boolean|undefined}
|
|
101
|
+
*/
|
|
102
|
+
this.reportUnusedDisableDirectives = void 0;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Rule settings.
|
|
106
|
+
* @type {Record<string, [SeverityConf, ...any[]]>}
|
|
107
|
+
*/
|
|
108
|
+
this.rules = {};
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Shared settings.
|
|
112
|
+
* @type {Object}
|
|
113
|
+
*/
|
|
114
|
+
this.settings = {};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Convert this config to the compatible object as a config file content.
|
|
119
|
+
* @returns {ConfigData} The converted object.
|
|
120
|
+
*/
|
|
121
|
+
toCompatibleObjectAsConfigFileContent() {
|
|
122
|
+
const {
|
|
123
|
+
/* eslint-disable no-unused-vars */
|
|
124
|
+
configNameOfNoInlineConfig: _ignore1,
|
|
125
|
+
processor: _ignore2,
|
|
126
|
+
/* eslint-enable no-unused-vars */
|
|
127
|
+
ignores,
|
|
128
|
+
...config
|
|
129
|
+
} = this;
|
|
130
|
+
|
|
131
|
+
config.parser = config.parser && config.parser.filePath;
|
|
132
|
+
config.plugins = Object.keys(config.plugins).filter(Boolean).reverse();
|
|
133
|
+
config.ignorePatterns = ignores ? ignores.patterns : [];
|
|
134
|
+
|
|
135
|
+
// Strip the default patterns from `ignorePatterns`.
|
|
136
|
+
if (startsWith(config.ignorePatterns, IgnorePattern.DefaultPatterns)) {
|
|
137
|
+
config.ignorePatterns =
|
|
138
|
+
config.ignorePatterns.slice(IgnorePattern.DefaultPatterns.length);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return config;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export { ExtractedConfig };
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview `IgnorePattern` class.
|
|
3
|
+
*
|
|
4
|
+
* `IgnorePattern` class has the set of glob patterns and the base path.
|
|
5
|
+
*
|
|
6
|
+
* It provides two static methods.
|
|
7
|
+
*
|
|
8
|
+
* - `IgnorePattern.createDefaultIgnore(cwd)`
|
|
9
|
+
* Create the default predicate function.
|
|
10
|
+
* - `IgnorePattern.createIgnore(ignorePatterns)`
|
|
11
|
+
* Create the predicate function from multiple `IgnorePattern` objects.
|
|
12
|
+
*
|
|
13
|
+
* It provides two properties and a method.
|
|
14
|
+
*
|
|
15
|
+
* - `patterns`
|
|
16
|
+
* The glob patterns that ignore to lint.
|
|
17
|
+
* - `basePath`
|
|
18
|
+
* The base path of the glob patterns. If absolute paths existed in the
|
|
19
|
+
* glob patterns, those are handled as relative paths to the base path.
|
|
20
|
+
* - `getPatternsRelativeTo(basePath)`
|
|
21
|
+
* Get `patterns` as modified for a given base path. It modifies the
|
|
22
|
+
* absolute paths in the patterns as prepending the difference of two base
|
|
23
|
+
* paths.
|
|
24
|
+
*
|
|
25
|
+
* `ConfigArrayFactory` creates `IgnorePattern` objects when it processes
|
|
26
|
+
* `ignorePatterns` properties.
|
|
27
|
+
*
|
|
28
|
+
* @author Toru Nagashima <https://github.com/mysticatea>
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
//------------------------------------------------------------------------------
|
|
32
|
+
// Requirements
|
|
33
|
+
//------------------------------------------------------------------------------
|
|
34
|
+
|
|
35
|
+
import assert from "assert";
|
|
36
|
+
import path from "path";
|
|
37
|
+
import ignore from "ignore";
|
|
38
|
+
import debugOrig from "debug";
|
|
39
|
+
|
|
40
|
+
const debug = debugOrig("eslintrc:ignore-pattern");
|
|
41
|
+
|
|
42
|
+
/** @typedef {ReturnType<import("ignore").default>} Ignore */
|
|
43
|
+
|
|
44
|
+
//------------------------------------------------------------------------------
|
|
45
|
+
// Helpers
|
|
46
|
+
//------------------------------------------------------------------------------
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Get the path to the common ancestor directory of given paths.
|
|
50
|
+
* @param {string[]} sourcePaths The paths to calculate the common ancestor.
|
|
51
|
+
* @returns {string} The path to the common ancestor directory.
|
|
52
|
+
*/
|
|
53
|
+
function getCommonAncestorPath(sourcePaths) {
|
|
54
|
+
let result = sourcePaths[0];
|
|
55
|
+
|
|
56
|
+
for (let i = 1; i < sourcePaths.length; ++i) {
|
|
57
|
+
const a = result;
|
|
58
|
+
const b = sourcePaths[i];
|
|
59
|
+
|
|
60
|
+
// Set the shorter one (it's the common ancestor if one includes the other).
|
|
61
|
+
result = a.length < b.length ? a : b;
|
|
62
|
+
|
|
63
|
+
// Set the common ancestor.
|
|
64
|
+
for (let j = 0, lastSepPos = 0; j < a.length && j < b.length; ++j) {
|
|
65
|
+
if (a[j] !== b[j]) {
|
|
66
|
+
result = a.slice(0, lastSepPos);
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
if (a[j] === path.sep) {
|
|
70
|
+
lastSepPos = j;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
let resolvedResult = result || path.sep;
|
|
76
|
+
|
|
77
|
+
// if Windows common ancestor is root of drive must have trailing slash to be absolute.
|
|
78
|
+
if (resolvedResult && resolvedResult.endsWith(":") && process.platform === "win32") {
|
|
79
|
+
resolvedResult += path.sep;
|
|
80
|
+
}
|
|
81
|
+
return resolvedResult;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Make relative path.
|
|
86
|
+
* @param {string} from The source path to get relative path.
|
|
87
|
+
* @param {string} to The destination path to get relative path.
|
|
88
|
+
* @returns {string} The relative path.
|
|
89
|
+
*/
|
|
90
|
+
function relative(from, to) {
|
|
91
|
+
const relPath = path.relative(from, to);
|
|
92
|
+
|
|
93
|
+
if (path.sep === "/") {
|
|
94
|
+
return relPath;
|
|
95
|
+
}
|
|
96
|
+
return relPath.split(path.sep).join("/");
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Get the trailing slash if existed.
|
|
101
|
+
* @param {string} filePath The path to check.
|
|
102
|
+
* @returns {string} The trailing slash if existed.
|
|
103
|
+
*/
|
|
104
|
+
function dirSuffix(filePath) {
|
|
105
|
+
const isDir = (
|
|
106
|
+
filePath.endsWith(path.sep) ||
|
|
107
|
+
(process.platform === "win32" && filePath.endsWith("/"))
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
return isDir ? "/" : "";
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const DefaultPatterns = Object.freeze(["/**/node_modules/*"]);
|
|
114
|
+
const DotPatterns = Object.freeze([".*", "!.eslintrc.*", "!../"]);
|
|
115
|
+
|
|
116
|
+
//------------------------------------------------------------------------------
|
|
117
|
+
// Public
|
|
118
|
+
//------------------------------------------------------------------------------
|
|
119
|
+
|
|
120
|
+
class IgnorePattern {
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* The default patterns.
|
|
124
|
+
* @type {string[]}
|
|
125
|
+
*/
|
|
126
|
+
static get DefaultPatterns() {
|
|
127
|
+
return DefaultPatterns;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Create the default predicate function.
|
|
132
|
+
* @param {string} cwd The current working directory.
|
|
133
|
+
* @returns {((filePath:string, dot:boolean) => boolean) & {basePath:string; patterns:string[]}}
|
|
134
|
+
* The preficate function.
|
|
135
|
+
* The first argument is an absolute path that is checked.
|
|
136
|
+
* The second argument is the flag to not ignore dotfiles.
|
|
137
|
+
* If the predicate function returned `true`, it means the path should be ignored.
|
|
138
|
+
*/
|
|
139
|
+
static createDefaultIgnore(cwd) {
|
|
140
|
+
return this.createIgnore([new IgnorePattern(DefaultPatterns, cwd)]);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Create the predicate function from multiple `IgnorePattern` objects.
|
|
145
|
+
* @param {IgnorePattern[]} ignorePatterns The list of ignore patterns.
|
|
146
|
+
* @returns {((filePath:string, dot?:boolean) => boolean) & {basePath:string; patterns:string[]}}
|
|
147
|
+
* The preficate function.
|
|
148
|
+
* The first argument is an absolute path that is checked.
|
|
149
|
+
* The second argument is the flag to not ignore dotfiles.
|
|
150
|
+
* If the predicate function returned `true`, it means the path should be ignored.
|
|
151
|
+
*/
|
|
152
|
+
static createIgnore(ignorePatterns) {
|
|
153
|
+
debug("Create with: %o", ignorePatterns);
|
|
154
|
+
|
|
155
|
+
const basePath = getCommonAncestorPath(ignorePatterns.map(p => p.basePath));
|
|
156
|
+
const patterns = [].concat(
|
|
157
|
+
...ignorePatterns.map(p => p.getPatternsRelativeTo(basePath))
|
|
158
|
+
);
|
|
159
|
+
const ig = ignore({ allowRelativePaths: true }).add([...DotPatterns, ...patterns]);
|
|
160
|
+
const dotIg = ignore({ allowRelativePaths: true }).add(patterns);
|
|
161
|
+
|
|
162
|
+
debug(" processed: %o", { basePath, patterns });
|
|
163
|
+
|
|
164
|
+
return Object.assign(
|
|
165
|
+
(filePath, dot = false) => {
|
|
166
|
+
assert(path.isAbsolute(filePath), "'filePath' should be an absolute path.");
|
|
167
|
+
const relPathRaw = relative(basePath, filePath);
|
|
168
|
+
const relPath = relPathRaw && (relPathRaw + dirSuffix(filePath));
|
|
169
|
+
const adoptedIg = dot ? dotIg : ig;
|
|
170
|
+
const result = relPath !== "" && adoptedIg.ignores(relPath);
|
|
171
|
+
|
|
172
|
+
debug("Check", { filePath, dot, relativePath: relPath, result });
|
|
173
|
+
return result;
|
|
174
|
+
},
|
|
175
|
+
{ basePath, patterns }
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Initialize a new `IgnorePattern` instance.
|
|
181
|
+
* @param {string[]} patterns The glob patterns that ignore to lint.
|
|
182
|
+
* @param {string} basePath The base path of `patterns`.
|
|
183
|
+
*/
|
|
184
|
+
constructor(patterns, basePath) {
|
|
185
|
+
assert(path.isAbsolute(basePath), "'basePath' should be an absolute path.");
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* The glob patterns that ignore to lint.
|
|
189
|
+
* @type {string[]}
|
|
190
|
+
*/
|
|
191
|
+
this.patterns = patterns;
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* The base path of `patterns`.
|
|
195
|
+
* @type {string}
|
|
196
|
+
*/
|
|
197
|
+
this.basePath = basePath;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* If `true` then patterns which don't start with `/` will match the paths to the outside of `basePath`. Defaults to `false`.
|
|
201
|
+
*
|
|
202
|
+
* It's set `true` for `.eslintignore`, `package.json`, and `--ignore-path` for backward compatibility.
|
|
203
|
+
* It's `false` as-is for `ignorePatterns` property in config files.
|
|
204
|
+
* @type {boolean}
|
|
205
|
+
*/
|
|
206
|
+
this.loose = false;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Get `patterns` as modified for a given base path. It modifies the
|
|
211
|
+
* absolute paths in the patterns as prepending the difference of two base
|
|
212
|
+
* paths.
|
|
213
|
+
* @param {string} newBasePath The base path.
|
|
214
|
+
* @returns {string[]} Modifired patterns.
|
|
215
|
+
*/
|
|
216
|
+
getPatternsRelativeTo(newBasePath) {
|
|
217
|
+
assert(path.isAbsolute(newBasePath), "'newBasePath' should be an absolute path.");
|
|
218
|
+
const { basePath, loose, patterns } = this;
|
|
219
|
+
|
|
220
|
+
if (newBasePath === basePath) {
|
|
221
|
+
return patterns;
|
|
222
|
+
}
|
|
223
|
+
const prefix = `/${relative(newBasePath, basePath)}`;
|
|
224
|
+
|
|
225
|
+
return patterns.map(pattern => {
|
|
226
|
+
const negative = pattern.startsWith("!");
|
|
227
|
+
const head = negative ? "!" : "";
|
|
228
|
+
const body = negative ? pattern.slice(1) : pattern;
|
|
229
|
+
|
|
230
|
+
if (body.startsWith("/") || body.startsWith("../")) {
|
|
231
|
+
return `${head}${prefix}${body}`;
|
|
232
|
+
}
|
|
233
|
+
return loose ? pattern : `${head}${prefix}/**/${body}`;
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export { IgnorePattern };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview `ConfigArray` class.
|
|
3
|
+
* @author Toru Nagashima <https://github.com/mysticatea>
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { ConfigArray, getUsedExtractedConfigs } from "./config-array.js";
|
|
7
|
+
import { ConfigDependency } from "./config-dependency.js";
|
|
8
|
+
import { ExtractedConfig } from "./extracted-config.js";
|
|
9
|
+
import { IgnorePattern } from "./ignore-pattern.js";
|
|
10
|
+
import { OverrideTester } from "./override-tester.js";
|
|
11
|
+
|
|
12
|
+
export {
|
|
13
|
+
ConfigArray,
|
|
14
|
+
ConfigDependency,
|
|
15
|
+
ExtractedConfig,
|
|
16
|
+
IgnorePattern,
|
|
17
|
+
OverrideTester,
|
|
18
|
+
getUsedExtractedConfigs
|
|
19
|
+
};
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview `OverrideTester` class.
|
|
3
|
+
*
|
|
4
|
+
* `OverrideTester` class handles `files` property and `excludedFiles` property
|
|
5
|
+
* of `overrides` config.
|
|
6
|
+
*
|
|
7
|
+
* It provides one method.
|
|
8
|
+
*
|
|
9
|
+
* - `test(filePath)`
|
|
10
|
+
* Test if a file path matches the pair of `files` property and
|
|
11
|
+
* `excludedFiles` property. The `filePath` argument must be an absolute
|
|
12
|
+
* path.
|
|
13
|
+
*
|
|
14
|
+
* `ConfigArrayFactory` creates `OverrideTester` objects when it processes
|
|
15
|
+
* `overrides` properties.
|
|
16
|
+
*
|
|
17
|
+
* @author Toru Nagashima <https://github.com/mysticatea>
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import assert from "assert";
|
|
21
|
+
import path from "path";
|
|
22
|
+
import util from "util";
|
|
23
|
+
import minimatch from "minimatch";
|
|
24
|
+
|
|
25
|
+
const { Minimatch } = minimatch;
|
|
26
|
+
|
|
27
|
+
const minimatchOpts = { dot: true, matchBase: true };
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @typedef {Object} Pattern
|
|
31
|
+
* @property {InstanceType<Minimatch>[] | null} includes The positive matchers.
|
|
32
|
+
* @property {InstanceType<Minimatch>[] | null} excludes The negative matchers.
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Normalize a given pattern to an array.
|
|
37
|
+
* @param {string|string[]|undefined} patterns A glob pattern or an array of glob patterns.
|
|
38
|
+
* @returns {string[]|null} Normalized patterns.
|
|
39
|
+
* @private
|
|
40
|
+
*/
|
|
41
|
+
function normalizePatterns(patterns) {
|
|
42
|
+
if (Array.isArray(patterns)) {
|
|
43
|
+
return patterns.filter(Boolean);
|
|
44
|
+
}
|
|
45
|
+
if (typeof patterns === "string" && patterns) {
|
|
46
|
+
return [patterns];
|
|
47
|
+
}
|
|
48
|
+
return [];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Create the matchers of given patterns.
|
|
53
|
+
* @param {string[]} patterns The patterns.
|
|
54
|
+
* @returns {InstanceType<Minimatch>[] | null} The matchers.
|
|
55
|
+
*/
|
|
56
|
+
function toMatcher(patterns) {
|
|
57
|
+
if (patterns.length === 0) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
return patterns.map(pattern => {
|
|
61
|
+
if (/^\.[/\\]/u.test(pattern)) {
|
|
62
|
+
return new Minimatch(
|
|
63
|
+
pattern.slice(2),
|
|
64
|
+
|
|
65
|
+
// `./*.js` should not match with `subdir/foo.js`
|
|
66
|
+
{ ...minimatchOpts, matchBase: false }
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
return new Minimatch(pattern, minimatchOpts);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Convert a given matcher to string.
|
|
75
|
+
* @param {Pattern} matchers The matchers.
|
|
76
|
+
* @returns {string} The string expression of the matcher.
|
|
77
|
+
*/
|
|
78
|
+
function patternToJson({ includes, excludes }) {
|
|
79
|
+
return {
|
|
80
|
+
includes: includes && includes.map(m => m.pattern),
|
|
81
|
+
excludes: excludes && excludes.map(m => m.pattern)
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The class to test given paths are matched by the patterns.
|
|
87
|
+
*/
|
|
88
|
+
class OverrideTester {
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Create a tester with given criteria.
|
|
92
|
+
* If there are no criteria, returns `null`.
|
|
93
|
+
* @param {string|string[]} files The glob patterns for included files.
|
|
94
|
+
* @param {string|string[]} excludedFiles The glob patterns for excluded files.
|
|
95
|
+
* @param {string} basePath The path to the base directory to test paths.
|
|
96
|
+
* @returns {OverrideTester|null} The created instance or `null`.
|
|
97
|
+
*/
|
|
98
|
+
static create(files, excludedFiles, basePath) {
|
|
99
|
+
const includePatterns = normalizePatterns(files);
|
|
100
|
+
const excludePatterns = normalizePatterns(excludedFiles);
|
|
101
|
+
let endsWithWildcard = false;
|
|
102
|
+
|
|
103
|
+
if (includePatterns.length === 0) {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Rejects absolute paths or relative paths to parents.
|
|
108
|
+
for (const pattern of includePatterns) {
|
|
109
|
+
if (path.isAbsolute(pattern) || pattern.includes("..")) {
|
|
110
|
+
throw new Error(`Invalid override pattern (expected relative path not containing '..'): ${pattern}`);
|
|
111
|
+
}
|
|
112
|
+
if (pattern.endsWith("*")) {
|
|
113
|
+
endsWithWildcard = true;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
for (const pattern of excludePatterns) {
|
|
117
|
+
if (path.isAbsolute(pattern) || pattern.includes("..")) {
|
|
118
|
+
throw new Error(`Invalid override pattern (expected relative path not containing '..'): ${pattern}`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const includes = toMatcher(includePatterns);
|
|
123
|
+
const excludes = toMatcher(excludePatterns);
|
|
124
|
+
|
|
125
|
+
return new OverrideTester(
|
|
126
|
+
[{ includes, excludes }],
|
|
127
|
+
basePath,
|
|
128
|
+
endsWithWildcard
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Combine two testers by logical and.
|
|
134
|
+
* If either of the testers was `null`, returns the other tester.
|
|
135
|
+
* The `basePath` property of the two must be the same value.
|
|
136
|
+
* @param {OverrideTester|null} a A tester.
|
|
137
|
+
* @param {OverrideTester|null} b Another tester.
|
|
138
|
+
* @returns {OverrideTester|null} Combined tester.
|
|
139
|
+
*/
|
|
140
|
+
static and(a, b) {
|
|
141
|
+
if (!b) {
|
|
142
|
+
return a && new OverrideTester(
|
|
143
|
+
a.patterns,
|
|
144
|
+
a.basePath,
|
|
145
|
+
a.endsWithWildcard
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
if (!a) {
|
|
149
|
+
return new OverrideTester(
|
|
150
|
+
b.patterns,
|
|
151
|
+
b.basePath,
|
|
152
|
+
b.endsWithWildcard
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
assert.strictEqual(a.basePath, b.basePath);
|
|
157
|
+
return new OverrideTester(
|
|
158
|
+
a.patterns.concat(b.patterns),
|
|
159
|
+
a.basePath,
|
|
160
|
+
a.endsWithWildcard || b.endsWithWildcard
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Initialize this instance.
|
|
166
|
+
* @param {Pattern[]} patterns The matchers.
|
|
167
|
+
* @param {string} basePath The base path.
|
|
168
|
+
* @param {boolean} endsWithWildcard If `true` then a pattern ends with `*`.
|
|
169
|
+
*/
|
|
170
|
+
constructor(patterns, basePath, endsWithWildcard = false) {
|
|
171
|
+
|
|
172
|
+
/** @type {Pattern[]} */
|
|
173
|
+
this.patterns = patterns;
|
|
174
|
+
|
|
175
|
+
/** @type {string} */
|
|
176
|
+
this.basePath = basePath;
|
|
177
|
+
|
|
178
|
+
/** @type {boolean} */
|
|
179
|
+
this.endsWithWildcard = endsWithWildcard;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Test if a given path is matched or not.
|
|
184
|
+
* @param {string} filePath The absolute path to the target file.
|
|
185
|
+
* @returns {boolean} `true` if the path was matched.
|
|
186
|
+
*/
|
|
187
|
+
test(filePath) {
|
|
188
|
+
if (typeof filePath !== "string" || !path.isAbsolute(filePath)) {
|
|
189
|
+
throw new Error(`'filePath' should be an absolute path, but got ${filePath}.`);
|
|
190
|
+
}
|
|
191
|
+
const relativePath = path.relative(this.basePath, filePath);
|
|
192
|
+
|
|
193
|
+
return this.patterns.every(({ includes, excludes }) => (
|
|
194
|
+
(!includes || includes.some(m => m.match(relativePath))) &&
|
|
195
|
+
(!excludes || !excludes.some(m => m.match(relativePath)))
|
|
196
|
+
));
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// eslint-disable-next-line jsdoc/require-description
|
|
200
|
+
/**
|
|
201
|
+
* @returns {Object} a JSON compatible object.
|
|
202
|
+
*/
|
|
203
|
+
toJSON() {
|
|
204
|
+
if (this.patterns.length === 1) {
|
|
205
|
+
return {
|
|
206
|
+
...patternToJson(this.patterns[0]),
|
|
207
|
+
basePath: this.basePath
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
return {
|
|
211
|
+
AND: this.patterns.map(patternToJson),
|
|
212
|
+
basePath: this.basePath
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// eslint-disable-next-line jsdoc/require-description
|
|
217
|
+
/**
|
|
218
|
+
* @returns {Object} an object to display by `console.log()`.
|
|
219
|
+
*/
|
|
220
|
+
[util.inspect.custom]() {
|
|
221
|
+
return this.toJSON();
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export { OverrideTester };
|