@stylelint/language-server 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +39 -0
- package/bin/stylelint-language-server.mjs +25 -0
- package/build/di/container.d.ts +12 -0
- package/build/di/container.js +76 -0
- package/build/di/container.js.map +1 -0
- package/build/di/hooks.d.ts +16 -0
- package/build/di/hooks.js +25 -0
- package/build/di/hooks.js.map +1 -0
- package/build/di/index.d.ts +7 -0
- package/build/di/index.js +8 -0
- package/build/di/index.js.map +1 -0
- package/build/di/inject.d.ts +48 -0
- package/build/di/inject.js +55 -0
- package/build/di/inject.js.map +1 -0
- package/build/di/module.d.ts +51 -0
- package/build/di/module.js +93 -0
- package/build/di/module.js.map +1 -0
- package/build/di/runtime/application.d.ts +17 -0
- package/build/di/runtime/application.js +209 -0
- package/build/di/runtime/application.js.map +1 -0
- package/build/di/runtime/decorators.d.ts +14 -0
- package/build/di/runtime/decorators.js +26 -0
- package/build/di/runtime/decorators.js.map +1 -0
- package/build/di/runtime/index.d.ts +3 -0
- package/build/di/runtime/index.js +4 -0
- package/build/di/runtime/index.js.map +1 -0
- package/build/di/runtime/symbols.d.ts +1 -0
- package/build/di/runtime/symbols.js +2 -0
- package/build/di/runtime/symbols.js.map +1 -0
- package/build/di/runtime/types.d.ts +20 -0
- package/build/di/runtime/types.js +2 -0
- package/build/di/runtime/types.js.map +1 -0
- package/build/di/tokens.d.ts +8 -0
- package/build/di/tokens.js +7 -0
- package/build/di/tokens.js.map +1 -0
- package/build/di/types.d.ts +16 -0
- package/build/di/types.js +2 -0
- package/build/di/types.js.map +1 -0
- package/build/server/config/default-options.d.ts +2 -0
- package/build/server/config/default-options.js +29 -0
- package/build/server/config/default-options.js.map +1 -0
- package/build/server/decorators.d.ts +121 -0
- package/build/server/decorators.js +272 -0
- package/build/server/decorators.js.map +1 -0
- package/build/server/index.d.ts +2 -0
- package/build/server/index.js +3 -0
- package/build/server/index.js.map +1 -0
- package/build/server/modules/documents.module.d.ts +1 -0
- package/build/server/modules/documents.module.js +12 -0
- package/build/server/modules/documents.module.js.map +1 -0
- package/build/server/modules/index.d.ts +6 -0
- package/build/server/modules/index.js +7 -0
- package/build/server/modules/index.js.map +1 -0
- package/build/server/modules/infrastructure.module.d.ts +1 -0
- package/build/server/modules/infrastructure.module.js +7 -0
- package/build/server/modules/infrastructure.module.js.map +1 -0
- package/build/server/modules/lsp.module.d.ts +1 -0
- package/build/server/modules/lsp.module.js +18 -0
- package/build/server/modules/lsp.module.js.map +1 -0
- package/build/server/modules/platform.module.d.ts +4 -0
- package/build/server/modules/platform.module.js +33 -0
- package/build/server/modules/platform.module.js.map +1 -0
- package/build/server/modules/stylelint-runtime.module.d.ts +1 -0
- package/build/server/modules/stylelint-runtime.module.js +19 -0
- package/build/server/modules/stylelint-runtime.module.js.map +1 -0
- package/build/server/modules/workspace.module.d.ts +1 -0
- package/build/server/modules/workspace.module.js +7 -0
- package/build/server/modules/workspace.module.js.map +1 -0
- package/build/server/runtime/application.d.ts +19 -0
- package/build/server/runtime/application.js +22 -0
- package/build/server/runtime/application.js.map +1 -0
- package/build/server/runtime/language-server-feature.d.ts +13 -0
- package/build/server/runtime/language-server-feature.js +142 -0
- package/build/server/runtime/language-server-feature.js.map +1 -0
- package/build/server/runtime/lsp-service-runtime.d.ts +15 -0
- package/build/server/runtime/lsp-service-runtime.js +133 -0
- package/build/server/runtime/lsp-service-runtime.js.map +1 -0
- package/build/server/server.d.ts +13 -0
- package/build/server/server.js +38 -0
- package/build/server/server.js.map +1 -0
- package/build/server/server.module.d.ts +1 -0
- package/build/server/server.module.js +13 -0
- package/build/server/server.module.js.map +1 -0
- package/build/server/services/documents/document-diagnostics.service.d.ts +15 -0
- package/build/server/services/documents/document-diagnostics.service.js +88 -0
- package/build/server/services/documents/document-diagnostics.service.js.map +1 -0
- package/build/server/services/documents/document-fixes.service.d.ts +14 -0
- package/build/server/services/documents/document-fixes.service.js +94 -0
- package/build/server/services/documents/document-fixes.service.js.map +1 -0
- package/build/server/services/documents/index.d.ts +2 -0
- package/build/server/services/documents/index.js +3 -0
- package/build/server/services/documents/index.js.map +1 -0
- package/build/server/services/index.d.ts +5 -0
- package/build/server/services/index.js +6 -0
- package/build/server/services/index.js.map +1 -0
- package/build/server/services/infrastructure/command.service.d.ts +22 -0
- package/build/server/services/infrastructure/command.service.js +151 -0
- package/build/server/services/infrastructure/command.service.js.map +1 -0
- package/build/server/services/infrastructure/index.d.ts +4 -0
- package/build/server/services/infrastructure/index.js +5 -0
- package/build/server/services/infrastructure/index.js.map +1 -0
- package/build/server/services/infrastructure/logging.service.d.ts +6 -0
- package/build/server/services/infrastructure/logging.service.js +4 -0
- package/build/server/services/infrastructure/logging.service.js.map +1 -0
- package/build/server/services/infrastructure/notification.service.d.ts +24 -0
- package/build/server/services/infrastructure/notification.service.js +142 -0
- package/build/server/services/infrastructure/notification.service.js.map +1 -0
- package/build/server/services/infrastructure/winston-logging.service.d.ts +10 -0
- package/build/server/services/infrastructure/winston-logging.service.js +48 -0
- package/build/server/services/infrastructure/winston-logging.service.js.map +1 -0
- package/build/server/services/lsp/auto-fix.service.d.ts +15 -0
- package/build/server/services/lsp/auto-fix.service.js +142 -0
- package/build/server/services/lsp/auto-fix.service.js.map +1 -0
- package/build/server/services/lsp/code-actions/code-action.service.d.ts +18 -0
- package/build/server/services/lsp/code-actions/code-action.service.js +288 -0
- package/build/server/services/lsp/code-actions/code-action.service.js.map +1 -0
- package/build/server/services/lsp/code-actions/disable-rule-file-code-action.service.d.ts +11 -0
- package/build/server/services/lsp/code-actions/disable-rule-file-code-action.service.js +72 -0
- package/build/server/services/lsp/code-actions/disable-rule-file-code-action.service.js.map +1 -0
- package/build/server/services/lsp/code-actions/disable-rule-line-code-action.service.d.ts +12 -0
- package/build/server/services/lsp/code-actions/disable-rule-line-code-action.service.js +80 -0
- package/build/server/services/lsp/code-actions/disable-rule-line-code-action.service.js.map +1 -0
- package/build/server/services/lsp/code-actions/index.d.ts +3 -0
- package/build/server/services/lsp/code-actions/index.js +4 -0
- package/build/server/services/lsp/code-actions/index.js.map +1 -0
- package/build/server/services/lsp/completion.service.d.ts +12 -0
- package/build/server/services/lsp/completion.service.js +183 -0
- package/build/server/services/lsp/completion.service.js.map +1 -0
- package/build/server/services/lsp/empty-config-warning.service.d.ts +17 -0
- package/build/server/services/lsp/empty-config-warning.service.js +149 -0
- package/build/server/services/lsp/empty-config-warning.service.js.map +1 -0
- package/build/server/services/lsp/formatter.service.d.ts +16 -0
- package/build/server/services/lsp/formatter.service.js +215 -0
- package/build/server/services/lsp/formatter.service.js.map +1 -0
- package/build/server/services/lsp/index.d.ts +8 -0
- package/build/server/services/lsp/index.js +9 -0
- package/build/server/services/lsp/index.js.map +1 -0
- package/build/server/services/lsp/old-stylelint-warning.service.d.ts +13 -0
- package/build/server/services/lsp/old-stylelint-warning.service.js +186 -0
- package/build/server/services/lsp/old-stylelint-warning.service.js.map +1 -0
- package/build/server/services/lsp/validator.service.d.ts +19 -0
- package/build/server/services/lsp/validator.service.js +273 -0
- package/build/server/services/lsp/validator.service.js.map +1 -0
- package/build/server/services/lsp/workspace-activity.service.d.ts +10 -0
- package/build/server/services/lsp/workspace-activity.service.js +76 -0
- package/build/server/services/lsp/workspace-activity.service.js.map +1 -0
- package/build/server/services/services.module.d.ts +1 -0
- package/build/server/services/services.module.js +19 -0
- package/build/server/services/services.module.js.map +1 -0
- package/build/server/services/stylelint-runtime/global-path-resolver.service.d.ts +38 -0
- package/build/server/services/stylelint-runtime/global-path-resolver.service.js +223 -0
- package/build/server/services/stylelint-runtime/global-path-resolver.service.js.map +1 -0
- package/build/server/services/stylelint-runtime/index.d.ts +11 -0
- package/build/server/services/stylelint-runtime/index.js +12 -0
- package/build/server/services/stylelint-runtime/index.js.map +1 -0
- package/build/server/services/stylelint-runtime/package-root-cache.service.d.ts +9 -0
- package/build/server/services/stylelint-runtime/package-root-cache.service.js +141 -0
- package/build/server/services/stylelint-runtime/package-root-cache.service.js.map +1 -0
- package/build/server/services/stylelint-runtime/package-root.service.d.ts +8 -0
- package/build/server/services/stylelint-runtime/package-root.service.js +119 -0
- package/build/server/services/stylelint-runtime/package-root.service.js.map +1 -0
- package/build/server/services/stylelint-runtime/pnp-configuration-cache.service.d.ts +16 -0
- package/build/server/services/stylelint-runtime/pnp-configuration-cache.service.js +195 -0
- package/build/server/services/stylelint-runtime/pnp-configuration-cache.service.js.map +1 -0
- package/build/server/services/stylelint-runtime/process-runner.service.d.ts +30 -0
- package/build/server/services/stylelint-runtime/process-runner.service.js +149 -0
- package/build/server/services/stylelint-runtime/process-runner.service.js.map +1 -0
- package/build/server/services/stylelint-runtime/stylelint-options.service.d.ts +12 -0
- package/build/server/services/stylelint-runtime/stylelint-options.service.js +185 -0
- package/build/server/services/stylelint-runtime/stylelint-options.service.js.map +1 -0
- package/build/server/services/stylelint-runtime/stylelint-runner.service.d.ts +42 -0
- package/build/server/services/stylelint-runtime/stylelint-runner.service.js +478 -0
- package/build/server/services/stylelint-runtime/stylelint-runner.service.js.map +1 -0
- package/build/server/services/stylelint-runtime/worker-environment.service.d.ts +17 -0
- package/build/server/services/stylelint-runtime/worker-environment.service.js +135 -0
- package/build/server/services/stylelint-runtime/worker-environment.service.js.map +1 -0
- package/build/server/services/stylelint-runtime/worker-process.service.d.ts +8 -0
- package/build/server/services/stylelint-runtime/worker-process.service.js +66 -0
- package/build/server/services/stylelint-runtime/worker-process.service.js.map +1 -0
- package/build/server/services/stylelint-runtime/worker-registry.service.d.ts +19 -0
- package/build/server/services/stylelint-runtime/worker-registry.service.js +289 -0
- package/build/server/services/stylelint-runtime/worker-registry.service.js.map +1 -0
- package/build/server/services/stylelint-runtime/workspace-stylelint.service.d.ts +37 -0
- package/build/server/services/stylelint-runtime/workspace-stylelint.service.js +185 -0
- package/build/server/services/stylelint-runtime/workspace-stylelint.service.js.map +1 -0
- package/build/server/services/workspace/index.d.ts +2 -0
- package/build/server/services/workspace/index.js +3 -0
- package/build/server/services/workspace/index.js.map +1 -0
- package/build/server/services/workspace/workspace-folder.service.d.ts +18 -0
- package/build/server/services/workspace/workspace-folder.service.js +101 -0
- package/build/server/services/workspace/workspace-folder.service.js.map +1 -0
- package/build/server/services/workspace/workspace-options.service.d.ts +12 -0
- package/build/server/services/workspace/workspace-options.service.js +125 -0
- package/build/server/services/workspace/workspace-options.service.js.map +1 -0
- package/build/server/stylelint/disable-metadata-lookup-table.d.ts +20 -0
- package/build/server/stylelint/disable-metadata-lookup-table.js +68 -0
- package/build/server/stylelint/disable-metadata-lookup-table.js.map +1 -0
- package/build/server/stylelint/formatting-options-to-rules.d.ts +12 -0
- package/build/server/stylelint/formatting-options-to-rules.js +19 -0
- package/build/server/stylelint/formatting-options-to-rules.js.map +1 -0
- package/build/server/stylelint/get-disable-diagnostic-rule.d.ts +7 -0
- package/build/server/stylelint/get-disable-diagnostic-rule.js +22 -0
- package/build/server/stylelint/get-disable-diagnostic-rule.js.map +1 -0
- package/build/server/stylelint/index.d.ts +7 -0
- package/build/server/stylelint/index.js +8 -0
- package/build/server/stylelint/index.js.map +1 -0
- package/build/server/stylelint/is-disable-report-rule.d.ts +6 -0
- package/build/server/stylelint/is-disable-report-rule.js +17 -0
- package/build/server/stylelint/is-disable-report-rule.js.map +1 -0
- package/build/server/stylelint/load-stylelint.d.ts +23 -0
- package/build/server/stylelint/load-stylelint.js +173 -0
- package/build/server/stylelint/load-stylelint.js.map +1 -0
- package/build/server/stylelint/process-linter-result.d.ts +32 -0
- package/build/server/stylelint/process-linter-result.js +129 -0
- package/build/server/stylelint/process-linter-result.js.map +1 -0
- package/build/server/stylelint/types.d.ts +143 -0
- package/build/server/stylelint/types.js +47 -0
- package/build/server/stylelint/types.js.map +1 -0
- package/build/server/stylelint/warning-to-diagnostic.d.ts +46 -0
- package/build/server/stylelint/warning-to-diagnostic.js +143 -0
- package/build/server/stylelint/warning-to-diagnostic.js.map +1 -0
- package/build/server/tokens.d.ts +20 -0
- package/build/server/tokens.js +16 -0
- package/build/server/tokens.js.map +1 -0
- package/build/server/types.d.ts +74 -0
- package/build/server/types.js +18 -0
- package/build/server/types.js.map +1 -0
- package/build/server/utils/documents/create-text-edits.d.ts +10 -0
- package/build/server/utils/documents/create-text-edits.js +31 -0
- package/build/server/utils/documents/create-text-edits.js.map +1 -0
- package/build/server/utils/documents/get-disable-type.d.ts +26 -0
- package/build/server/utils/documents/get-disable-type.js +32 -0
- package/build/server/utils/documents/get-disable-type.js.map +1 -0
- package/build/server/utils/documents/get-edit-info.d.ts +14 -0
- package/build/server/utils/documents/get-edit-info.js +31 -0
- package/build/server/utils/documents/get-edit-info.js.map +1 -0
- package/build/server/utils/documents/get-fixes.d.ts +12 -0
- package/build/server/utils/documents/get-fixes.js +18 -0
- package/build/server/utils/documents/get-fixes.js.map +1 -0
- package/build/server/utils/documents/index.d.ts +4 -0
- package/build/server/utils/documents/index.js +5 -0
- package/build/server/utils/documents/index.js.map +1 -0
- package/build/server/utils/errors.d.ts +10 -0
- package/build/server/utils/errors.js +89 -0
- package/build/server/utils/errors.js.map +1 -0
- package/build/server/utils/fs.d.ts +4 -0
- package/build/server/utils/fs.js +11 -0
- package/build/server/utils/fs.js.map +1 -0
- package/build/server/utils/functions/get-first-return-value.d.ts +11 -0
- package/build/server/utils/functions/get-first-return-value.js +28 -0
- package/build/server/utils/functions/get-first-return-value.js.map +1 -0
- package/build/server/utils/functions/index.d.ts +2 -0
- package/build/server/utils/functions/index.js +3 -0
- package/build/server/utils/functions/index.js.map +1 -0
- package/build/server/utils/functions/lazy-call.d.ts +12 -0
- package/build/server/utils/functions/lazy-call.js +33 -0
- package/build/server/utils/functions/lazy-call.js.map +1 -0
- package/build/server/utils/index.d.ts +11 -0
- package/build/server/utils/index.js +12 -0
- package/build/server/utils/index.js.map +1 -0
- package/build/server/utils/iterables.d.ts +8 -0
- package/build/server/utils/iterables.js +15 -0
- package/build/server/utils/iterables.js.map +1 -0
- package/build/server/utils/logging/error-formatter.d.ts +7 -0
- package/build/server/utils/logging/error-formatter.js +14 -0
- package/build/server/utils/logging/error-formatter.js.map +1 -0
- package/build/server/utils/logging/get-log-function.d.ts +8 -0
- package/build/server/utils/logging/get-log-function.js +11 -0
- package/build/server/utils/logging/get-log-function.js.map +1 -0
- package/build/server/utils/logging/index.d.ts +4 -0
- package/build/server/utils/logging/index.js +5 -0
- package/build/server/utils/logging/index.js.map +1 -0
- package/build/server/utils/logging/language-server-formatter.d.ts +19 -0
- package/build/server/utils/logging/language-server-formatter.js +55 -0
- package/build/server/utils/logging/language-server-formatter.js.map +1 -0
- package/build/server/utils/logging/language-server-transport.d.ts +19 -0
- package/build/server/utils/logging/language-server-transport.js +39 -0
- package/build/server/utils/logging/language-server-transport.js.map +1 -0
- package/build/server/utils/lsp/create-disable-completion-item.d.ts +7 -0
- package/build/server/utils/lsp/create-disable-completion-item.js +32 -0
- package/build/server/utils/lsp/create-disable-completion-item.js.map +1 -0
- package/build/server/utils/lsp/display-error.d.ts +7 -0
- package/build/server/utils/lsp/display-error.js +24 -0
- package/build/server/utils/lsp/display-error.js.map +1 -0
- package/build/server/utils/lsp/index.d.ts +4 -0
- package/build/server/utils/lsp/index.js +5 -0
- package/build/server/utils/lsp/index.js.map +1 -0
- package/build/server/utils/lsp/rule-code-actions-collection.d.ts +29 -0
- package/build/server/utils/lsp/rule-code-actions-collection.js +61 -0
- package/build/server/utils/lsp/rule-code-actions-collection.js.map +1 -0
- package/build/server/utils/lsp/types.d.ts +22 -0
- package/build/server/utils/lsp/types.js +2 -0
- package/build/server/utils/lsp/types.js.map +1 -0
- package/build/server/utils/objects/index.d.ts +3 -0
- package/build/server/utils/objects/index.js +4 -0
- package/build/server/utils/objects/index.js.map +1 -0
- package/build/server/utils/objects/is-object.d.ts +8 -0
- package/build/server/utils/objects/is-object.js +13 -0
- package/build/server/utils/objects/is-object.js.map +1 -0
- package/build/server/utils/objects/merge-assign.d.ts +8 -0
- package/build/server/utils/objects/merge-assign.js +38 -0
- package/build/server/utils/objects/merge-assign.js.map +1 -0
- package/build/server/utils/objects/merge-options-with-defaults.d.ts +5 -0
- package/build/server/utils/objects/merge-options-with-defaults.js +56 -0
- package/build/server/utils/objects/merge-options-with-defaults.js.map +1 -0
- package/build/server/utils/sets.d.ts +6 -0
- package/build/server/utils/sets.js +22 -0
- package/build/server/utils/sets.js.map +1 -0
- package/build/server/utils/strings.d.ts +12 -0
- package/build/server/utils/strings.js +20 -0
- package/build/server/utils/strings.js.map +1 -0
- package/build/server/utils/types.d.ts +27 -0
- package/build/server/utils/types.js +2 -0
- package/build/server/utils/types.js.map +1 -0
- package/build/server/worker/types.d.ts +63 -0
- package/build/server/worker/types.js +2 -0
- package/build/server/worker/types.js.map +1 -0
- package/build/server/worker/worker-entry.d.ts +1 -0
- package/build/server/worker/worker-entry.js +320 -0
- package/build/server/worker/worker-entry.js.map +1 -0
- package/build/server/worker/worker-logging.service.d.ts +18 -0
- package/build/server/worker/worker-logging.service.js +61 -0
- package/build/server/worker/worker-logging.service.js.map +1 -0
- package/build/server/worker/worker-process.d.ts +54 -0
- package/build/server/worker/worker-process.js +266 -0
- package/build/server/worker/worker-process.js.map +1 -0
- package/build/shared/log-level.d.ts +5 -0
- package/build/shared/log-level.js +11 -0
- package/build/shared/log-level.js.map +1 -0
- package/build/shared/types.d.ts +9 -0
- package/build/shared/types.js +3 -0
- package/build/shared/types.js.map +1 -0
- package/package.json +89 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import os from 'node:os';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { PackageManager } from '../../stylelint/types.js';
|
|
4
|
+
import { type LoggingService } from '../infrastructure/logging.service.js';
|
|
5
|
+
import { ProcessRunnerService } from './process-runner.service.js';
|
|
6
|
+
type ProcessRunnerLike = Pick<ProcessRunnerService, 'runFindLine'>;
|
|
7
|
+
/**
|
|
8
|
+
* Resolves the global `node_modules` path for different package managers.
|
|
9
|
+
*/
|
|
10
|
+
export declare class GlobalPathResolverService {
|
|
11
|
+
#private;
|
|
12
|
+
/**
|
|
13
|
+
* Instantiates a new global path resolver.
|
|
14
|
+
*/
|
|
15
|
+
constructor(osModule: Pick<typeof os, 'platform'>, pathModule: typeof path, processRunner: ProcessRunnerLike, loggingService: LoggingService);
|
|
16
|
+
/**
|
|
17
|
+
* Attempts to resolve the global `node_modules` path for the given package
|
|
18
|
+
* manager.
|
|
19
|
+
*
|
|
20
|
+
* On a successful resolution, the method returns a promise that resolves to the
|
|
21
|
+
* package manager's global `node_modules` path. Paths are cached in the
|
|
22
|
+
* resolver on the first successful resolution.
|
|
23
|
+
*
|
|
24
|
+
* When a path cannot be resolved, the promise resolves to `undefined`.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```js
|
|
28
|
+
* const resolver = getGlobalPathResolver();
|
|
29
|
+
* const yarnGlobalPath = await resolver.resolve(
|
|
30
|
+
* 'yarn',
|
|
31
|
+
* message => connection && connection.tracer.log(message)
|
|
32
|
+
* );
|
|
33
|
+
* ```
|
|
34
|
+
* @param packageManager The package manager to resolve the path for.
|
|
35
|
+
*/
|
|
36
|
+
resolve(packageManager: PackageManager): Promise<string | undefined>;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
2
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
3
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
4
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6
|
+
var _, done = false;
|
|
7
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8
|
+
var context = {};
|
|
9
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
10
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
11
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
12
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13
|
+
if (kind === "accessor") {
|
|
14
|
+
if (result === void 0) continue;
|
|
15
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
16
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
17
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
18
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
19
|
+
}
|
|
20
|
+
else if (_ = accept(result)) {
|
|
21
|
+
if (kind === "field") initializers.unshift(_);
|
|
22
|
+
else descriptor[key] = _;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
+
done = true;
|
|
27
|
+
};
|
|
28
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
29
|
+
var useValue = arguments.length > 2;
|
|
30
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
31
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
32
|
+
}
|
|
33
|
+
return useValue ? value : void 0;
|
|
34
|
+
};
|
|
35
|
+
import { inject } from '../../../di/index.js';
|
|
36
|
+
import { OsModuleToken, PathModuleToken } from '../../tokens.js';
|
|
37
|
+
import { loggingServiceToken } from '../infrastructure/logging.service.js';
|
|
38
|
+
import { ProcessRunnerService } from './process-runner.service.js';
|
|
39
|
+
/**
|
|
40
|
+
* Resolves the global `node_modules` path for different package managers.
|
|
41
|
+
*/
|
|
42
|
+
let GlobalPathResolverService = (() => {
|
|
43
|
+
let _classDecorators = [inject({
|
|
44
|
+
inject: [OsModuleToken, PathModuleToken, ProcessRunnerService, loggingServiceToken],
|
|
45
|
+
})];
|
|
46
|
+
let _classDescriptor;
|
|
47
|
+
let _classExtraInitializers = [];
|
|
48
|
+
let _classThis;
|
|
49
|
+
var GlobalPathResolverService = class {
|
|
50
|
+
static { _classThis = this; }
|
|
51
|
+
static {
|
|
52
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
53
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
54
|
+
GlobalPathResolverService = _classThis = _classDescriptor.value;
|
|
55
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
56
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The logger to use for tracing resolution.
|
|
60
|
+
*/
|
|
61
|
+
#logger;
|
|
62
|
+
/**
|
|
63
|
+
* The cache of resolved paths.
|
|
64
|
+
*/
|
|
65
|
+
#cache = {
|
|
66
|
+
yarn: undefined,
|
|
67
|
+
npm: undefined,
|
|
68
|
+
pnpm: undefined,
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Whether or not the current platform is Windows.
|
|
72
|
+
*/
|
|
73
|
+
#isWindows;
|
|
74
|
+
/**
|
|
75
|
+
* Path utilities.
|
|
76
|
+
*/
|
|
77
|
+
#path;
|
|
78
|
+
/**
|
|
79
|
+
* Runner used to execute package-manager commands.
|
|
80
|
+
*/
|
|
81
|
+
#processRunner;
|
|
82
|
+
/**
|
|
83
|
+
* The resolvers by package manager.
|
|
84
|
+
*/
|
|
85
|
+
#resolvers = {
|
|
86
|
+
yarn: this.#yarn.bind(this),
|
|
87
|
+
npm: this.#npm.bind(this),
|
|
88
|
+
pnpm: this.#pnpm.bind(this),
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Instantiates a new global path resolver.
|
|
92
|
+
*/
|
|
93
|
+
constructor(osModule, pathModule, processRunner, loggingService) {
|
|
94
|
+
this.#logger = loggingService.createLogger(GlobalPathResolverService);
|
|
95
|
+
this.#isWindows = osModule.platform() === 'win32';
|
|
96
|
+
this.#path = pathModule;
|
|
97
|
+
this.#processRunner = processRunner;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Resolves the global `node_modules` path for Yarn.
|
|
101
|
+
*
|
|
102
|
+
* Note: Only Yarn 1.x is supported. Yarn 2.x and higher have removed
|
|
103
|
+
* support for globally installed packages.
|
|
104
|
+
*/
|
|
105
|
+
async #yarn() {
|
|
106
|
+
const tryParseLog = (line) => {
|
|
107
|
+
try {
|
|
108
|
+
return JSON.parse(line);
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
return undefined;
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
const yarnGlobalPath = await this.#processRunner.runFindLine('yarn', ['global', 'dir', '--json'], this.#isWindows ? { shell: true } : undefined, (line) => {
|
|
115
|
+
const log = tryParseLog(line);
|
|
116
|
+
if (!log || log.type !== 'log' || !log.data) {
|
|
117
|
+
return undefined;
|
|
118
|
+
}
|
|
119
|
+
const globalPath = this.#path.join(log.data, 'node_modules');
|
|
120
|
+
this.#logger?.debug('Yarn returned global node_modules path.', {
|
|
121
|
+
path: globalPath,
|
|
122
|
+
});
|
|
123
|
+
return globalPath;
|
|
124
|
+
});
|
|
125
|
+
if (!yarnGlobalPath) {
|
|
126
|
+
this.#logger?.warn('"yarn global dir --json" did not return a path.');
|
|
127
|
+
return undefined;
|
|
128
|
+
}
|
|
129
|
+
return yarnGlobalPath;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Resolves the global `node_modules` path for npm.
|
|
133
|
+
*/
|
|
134
|
+
async #npm() {
|
|
135
|
+
const npmGlobalPath = await this.#processRunner.runFindLine('npm', ['config', 'get', 'prefix'], this.#isWindows ? { shell: true } : undefined, (line) => {
|
|
136
|
+
const trimmed = line.trim();
|
|
137
|
+
if (!trimmed) {
|
|
138
|
+
return undefined;
|
|
139
|
+
}
|
|
140
|
+
const globalPath = this.#isWindows
|
|
141
|
+
? this.#path.join(trimmed, 'node_modules')
|
|
142
|
+
: this.#path.join(trimmed, 'lib/node_modules');
|
|
143
|
+
this.#logger?.debug('npm returned global node_modules path.', {
|
|
144
|
+
path: globalPath,
|
|
145
|
+
});
|
|
146
|
+
return globalPath;
|
|
147
|
+
});
|
|
148
|
+
if (!npmGlobalPath) {
|
|
149
|
+
this.#logger?.warn('"npm config get prefix" did not return a path.');
|
|
150
|
+
return undefined;
|
|
151
|
+
}
|
|
152
|
+
return npmGlobalPath;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Resolves the global `node_modules` path for pnpm.
|
|
156
|
+
*/
|
|
157
|
+
async #pnpm() {
|
|
158
|
+
const pnpmGlobalPath = await this.#processRunner.runFindLine('pnpm', ['root', '-g'], this.#isWindows ? { shell: true } : undefined, (line) => {
|
|
159
|
+
const trimmed = line.trim();
|
|
160
|
+
if (!trimmed) {
|
|
161
|
+
return undefined;
|
|
162
|
+
}
|
|
163
|
+
this.#logger?.debug('pnpm returned global node_modules path.', {
|
|
164
|
+
path: trimmed,
|
|
165
|
+
});
|
|
166
|
+
return trimmed;
|
|
167
|
+
});
|
|
168
|
+
if (!pnpmGlobalPath) {
|
|
169
|
+
this.#logger?.warn('"pnpm root -g" did not return a path.');
|
|
170
|
+
return undefined;
|
|
171
|
+
}
|
|
172
|
+
return pnpmGlobalPath;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Attempts to resolve the global `node_modules` path for the given package
|
|
176
|
+
* manager.
|
|
177
|
+
*
|
|
178
|
+
* On a successful resolution, the method returns a promise that resolves to the
|
|
179
|
+
* package manager's global `node_modules` path. Paths are cached in the
|
|
180
|
+
* resolver on the first successful resolution.
|
|
181
|
+
*
|
|
182
|
+
* When a path cannot be resolved, the promise resolves to `undefined`.
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* ```js
|
|
186
|
+
* const resolver = getGlobalPathResolver();
|
|
187
|
+
* const yarnGlobalPath = await resolver.resolve(
|
|
188
|
+
* 'yarn',
|
|
189
|
+
* message => connection && connection.tracer.log(message)
|
|
190
|
+
* );
|
|
191
|
+
* ```
|
|
192
|
+
* @param packageManager The package manager to resolve the path for.
|
|
193
|
+
*/
|
|
194
|
+
async resolve(packageManager) {
|
|
195
|
+
const cached = this.#cache[packageManager];
|
|
196
|
+
if (cached) {
|
|
197
|
+
return cached;
|
|
198
|
+
}
|
|
199
|
+
const resolver = this.#resolvers[packageManager];
|
|
200
|
+
if (!resolver) {
|
|
201
|
+
this.#logger?.warn('Unsupported package manager.', { packageManager });
|
|
202
|
+
return undefined;
|
|
203
|
+
}
|
|
204
|
+
try {
|
|
205
|
+
const globalPath = await resolver();
|
|
206
|
+
if (globalPath) {
|
|
207
|
+
this.#cache[packageManager] = globalPath;
|
|
208
|
+
}
|
|
209
|
+
return globalPath;
|
|
210
|
+
}
|
|
211
|
+
catch (error) {
|
|
212
|
+
this.#logger?.warn('Failed to resolve global node_modules path.', {
|
|
213
|
+
packageManager,
|
|
214
|
+
error,
|
|
215
|
+
});
|
|
216
|
+
return undefined;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
return GlobalPathResolverService = _classThis;
|
|
221
|
+
})();
|
|
222
|
+
export { GlobalPathResolverService };
|
|
223
|
+
//# sourceMappingURL=global-path-resolver.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global-path-resolver.service.js","sourceRoot":"","sources":["../../../../src/server/services/stylelint-runtime/global-path-resolver.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,iBAAi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YAChB,CAAC,CACD,CAAC;YAEF,IAAI,CAAC,cAAc,EAAE,CAAC;gBACrB,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,uCAAuC,CAAC,CAAC;gBAE5D,OAAO,SAAS,CAAC;YAClB,CAAC;YAED,OAAO,cAAc,CAAC;QACvB,CAAC;QAED;;;;;;;;;;;;;;;;;;;WAmBG;QACH,KAAK,CAAC,OAAO,CAAC,cAA8B;YAC3C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;YAE3C,IAAI,MAAM,EAAE,CAAC;gBACZ,OAAO,MAAM,CAAC;YACf,CAAC;YAED,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;YAEjD,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACf,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,8BAA8B,EAAE,EAAE,cAAc,EAAE,CAAC,CAAC;gBAEvE,OAAO,SAAS,CAAC;YAClB,CAAC;YAED,IAAI,CAAC;gBACJ,MAAM,UAAU,GAAG,MAAM,QAAQ,EAAE,CAAC;gBAEpC,IAAI,UAAU,EAAE,CAAC;oBAChB,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG,UAAU,CAAC;gBAC1C,CAAC;gBAED,OAAO,UAAU,CAAC;YACnB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,6CAA6C,EAAE;oBACjE,cAAc;oBACd,KAAK;iBACL,CAAC,CAAC;gBAEH,OAAO,SAAS,CAAC;YAClB,CAAC;QACF,CAAC;;;;SA1NW,yBAAyB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './global-path-resolver.service.js';
|
|
2
|
+
export * from './package-root-cache.service.js';
|
|
3
|
+
export * from './package-root.service.js';
|
|
4
|
+
export * from './process-runner.service.js';
|
|
5
|
+
export * from './pnp-configuration-cache.service.js';
|
|
6
|
+
export * from './stylelint-options.service.js';
|
|
7
|
+
export * from './stylelint-runner.service.js';
|
|
8
|
+
export * from './worker-environment.service.js';
|
|
9
|
+
export * from './worker-process.service.js';
|
|
10
|
+
export * from './worker-registry.service.js';
|
|
11
|
+
export * from './workspace-stylelint.service.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './global-path-resolver.service.js';
|
|
2
|
+
export * from './package-root-cache.service.js';
|
|
3
|
+
export * from './package-root.service.js';
|
|
4
|
+
export * from './process-runner.service.js';
|
|
5
|
+
export * from './pnp-configuration-cache.service.js';
|
|
6
|
+
export * from './stylelint-options.service.js';
|
|
7
|
+
export * from './stylelint-runner.service.js';
|
|
8
|
+
export * from './worker-environment.service.js';
|
|
9
|
+
export * from './worker-process.service.js';
|
|
10
|
+
export * from './worker-registry.service.js';
|
|
11
|
+
export * from './workspace-stylelint.service.js';
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/server/services/stylelint-runtime/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sCAAsC,CAAC;AACrD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PackageRootService } from './package-root.service.js';
|
|
2
|
+
export declare class PackageRootCacheService {
|
|
3
|
+
#private;
|
|
4
|
+
constructor(packageRootFinder: PackageRootService);
|
|
5
|
+
determineWorkerRoot(workspaceFolder: string, codeFilename?: string, stylelintPath?: string): Promise<string>;
|
|
6
|
+
invalidateForFile(filePath: string | undefined): void;
|
|
7
|
+
clearForWorkspace(workspaceFolder: string): void;
|
|
8
|
+
clear(): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
2
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
3
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
4
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6
|
+
var _, done = false;
|
|
7
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8
|
+
var context = {};
|
|
9
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
10
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
11
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
12
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13
|
+
if (kind === "accessor") {
|
|
14
|
+
if (result === void 0) continue;
|
|
15
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
16
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
17
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
18
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
19
|
+
}
|
|
20
|
+
else if (_ = accept(result)) {
|
|
21
|
+
if (kind === "field") initializers.unshift(_);
|
|
22
|
+
else descriptor[key] = _;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
+
done = true;
|
|
27
|
+
};
|
|
28
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
29
|
+
var useValue = arguments.length > 2;
|
|
30
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
31
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
32
|
+
}
|
|
33
|
+
return useValue ? value : void 0;
|
|
34
|
+
};
|
|
35
|
+
import path from 'node:path';
|
|
36
|
+
import process from 'node:process';
|
|
37
|
+
import { inject } from '../../../di/index.js';
|
|
38
|
+
import { normalizeFsPath } from '../../utils/index.js';
|
|
39
|
+
import { PackageRootService } from './package-root.service.js';
|
|
40
|
+
const packageManifestFilename = 'package.json';
|
|
41
|
+
let PackageRootCacheService = (() => {
|
|
42
|
+
let _classDecorators = [inject({
|
|
43
|
+
inject: [PackageRootService],
|
|
44
|
+
})];
|
|
45
|
+
let _classDescriptor;
|
|
46
|
+
let _classExtraInitializers = [];
|
|
47
|
+
let _classThis;
|
|
48
|
+
var PackageRootCacheService = class {
|
|
49
|
+
static { _classThis = this; }
|
|
50
|
+
static {
|
|
51
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
52
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
53
|
+
PackageRootCacheService = _classThis = _classDescriptor.value;
|
|
54
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
55
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
56
|
+
}
|
|
57
|
+
#packageRootFinder;
|
|
58
|
+
#cache = new Map();
|
|
59
|
+
constructor(packageRootFinder) {
|
|
60
|
+
this.#packageRootFinder = packageRootFinder;
|
|
61
|
+
}
|
|
62
|
+
async determineWorkerRoot(workspaceFolder, codeFilename, stylelintPath) {
|
|
63
|
+
if (codeFilename) {
|
|
64
|
+
const codeRoot = await this.#getCachedPackageRoot(codeFilename);
|
|
65
|
+
if (codeRoot) {
|
|
66
|
+
return codeRoot;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (stylelintPath) {
|
|
70
|
+
const absoluteStylelintPath = path.isAbsolute(stylelintPath)
|
|
71
|
+
? stylelintPath
|
|
72
|
+
: path.join(workspaceFolder, stylelintPath);
|
|
73
|
+
const stylelintRoot = await this.#getCachedPackageRoot(absoluteStylelintPath);
|
|
74
|
+
if (stylelintRoot) {
|
|
75
|
+
return stylelintRoot;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return workspaceFolder;
|
|
79
|
+
}
|
|
80
|
+
invalidateForFile(filePath) {
|
|
81
|
+
if (!filePath) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (path.basename(filePath) !== packageManifestFilename) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
this.#invalidatePackageRootCache(path.dirname(filePath));
|
|
88
|
+
}
|
|
89
|
+
clearForWorkspace(workspaceFolder) {
|
|
90
|
+
this.#deleteCacheEntriesWithinPath(workspaceFolder);
|
|
91
|
+
}
|
|
92
|
+
clear() {
|
|
93
|
+
this.#cache.clear();
|
|
94
|
+
}
|
|
95
|
+
async #getCachedPackageRoot(startPath) {
|
|
96
|
+
const cacheKey = this.#normalizeCachePath(startPath);
|
|
97
|
+
const cached = this.#cache.get(cacheKey);
|
|
98
|
+
if (cached !== undefined) {
|
|
99
|
+
return cached ?? undefined;
|
|
100
|
+
}
|
|
101
|
+
const result = await this.#packageRootFinder.find(startPath);
|
|
102
|
+
this.#cache.set(cacheKey, result ?? null);
|
|
103
|
+
return result;
|
|
104
|
+
}
|
|
105
|
+
#invalidatePackageRootCache(directory) {
|
|
106
|
+
const normalizedDir = this.#normalizeCachePath(directory);
|
|
107
|
+
for (const [key, value] of this.#cache.entries()) {
|
|
108
|
+
const matchesKey = this.#isWithinNormalizedPath(normalizedDir, key);
|
|
109
|
+
const normalizedValue = value ? this.#normalizeCachePath(value) : undefined;
|
|
110
|
+
const matchesValue = normalizedValue !== undefined &&
|
|
111
|
+
this.#isWithinNormalizedPath(normalizedDir, normalizedValue);
|
|
112
|
+
if (matchesKey || matchesValue) {
|
|
113
|
+
this.#cache.delete(key);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
#deleteCacheEntriesWithinPath(rootPath) {
|
|
118
|
+
const normalizedRoot = this.#normalizeCachePath(rootPath);
|
|
119
|
+
for (const key of this.#cache.keys()) {
|
|
120
|
+
if (this.#isWithinNormalizedPath(normalizedRoot, key)) {
|
|
121
|
+
this.#cache.delete(key);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
#normalizeCachePath(value) {
|
|
126
|
+
const absolute = path.isAbsolute(value) ? value : path.resolve(value);
|
|
127
|
+
return normalizeFsPath(absolute) ?? absolute;
|
|
128
|
+
}
|
|
129
|
+
#isWithinNormalizedPath(normalizedRoot, candidateNormalized) {
|
|
130
|
+
const comparableRoot = process.platform === 'win32' ? normalizedRoot.toLowerCase() : normalizedRoot;
|
|
131
|
+
const comparableCandidate = process.platform === 'win32' ? candidateNormalized.toLowerCase() : candidateNormalized;
|
|
132
|
+
if (comparableCandidate === comparableRoot) {
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
135
|
+
return comparableCandidate.startsWith(`${comparableRoot}${path.sep}`);
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
return PackageRootCacheService = _classThis;
|
|
139
|
+
})();
|
|
140
|
+
export { PackageRootCacheService };
|
|
141
|
+
//# sourceMappingURL=package-root-cache.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-root-cache.service.js","sourceRoot":"","sources":["../../../../src/server/services/stylelint-runtime/package-root-cache.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC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AC;YACb,CAAC;YAED,OAAO,mBAAmB,CAAC,UAAU,CAAC,GAAG,cAAc,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QACvE,CAAC;;;;SAjHW,uBAAuB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import fs from 'fs/promises';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
export declare class PackageRootService {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(fsModule?: Pick<typeof fs, 'stat' | 'readdir'>, pathModule?: Pick<typeof path, 'dirname' | 'join' | 'relative'>);
|
|
6
|
+
find(startPath: string, rootFile?: string): Promise<string | undefined>;
|
|
7
|
+
findSubPackages(rootDir: string, rootFile?: string): Promise<string[]>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
2
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
3
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
4
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6
|
+
var _, done = false;
|
|
7
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8
|
+
var context = {};
|
|
9
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
10
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
11
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
12
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13
|
+
if (kind === "accessor") {
|
|
14
|
+
if (result === void 0) continue;
|
|
15
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
16
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
17
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
18
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
19
|
+
}
|
|
20
|
+
else if (_ = accept(result)) {
|
|
21
|
+
if (kind === "field") initializers.unshift(_);
|
|
22
|
+
else descriptor[key] = _;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
+
done = true;
|
|
27
|
+
};
|
|
28
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
29
|
+
var useValue = arguments.length > 2;
|
|
30
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
31
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
32
|
+
}
|
|
33
|
+
return useValue ? value : void 0;
|
|
34
|
+
};
|
|
35
|
+
import fs from 'fs/promises';
|
|
36
|
+
import path from 'path';
|
|
37
|
+
import { inject } from '../../../di/index.js';
|
|
38
|
+
import { FsPromisesModuleToken, PathModuleToken } from '../../tokens.js';
|
|
39
|
+
let PackageRootService = (() => {
|
|
40
|
+
let _classDecorators = [inject({
|
|
41
|
+
inject: [FsPromisesModuleToken, PathModuleToken],
|
|
42
|
+
})];
|
|
43
|
+
let _classDescriptor;
|
|
44
|
+
let _classExtraInitializers = [];
|
|
45
|
+
let _classThis;
|
|
46
|
+
var PackageRootService = class {
|
|
47
|
+
static { _classThis = this; }
|
|
48
|
+
static {
|
|
49
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
50
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
51
|
+
PackageRootService = _classThis = _classDescriptor.value;
|
|
52
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
53
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
54
|
+
}
|
|
55
|
+
#fs;
|
|
56
|
+
#path;
|
|
57
|
+
constructor(fsModule, pathModule) {
|
|
58
|
+
this.#fs = fsModule ?? fs;
|
|
59
|
+
this.#path = pathModule ?? path;
|
|
60
|
+
}
|
|
61
|
+
async find(startPath, rootFile = 'package.json') {
|
|
62
|
+
let currentDirectory = startPath;
|
|
63
|
+
while (true) {
|
|
64
|
+
const manifestPath = this.#path.join(currentDirectory, rootFile);
|
|
65
|
+
try {
|
|
66
|
+
const stat = await this.#fs.stat(manifestPath);
|
|
67
|
+
if (stat.isFile()) {
|
|
68
|
+
return currentDirectory;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
const code = error.code;
|
|
73
|
+
if (code !== 'ENOENT' && code !== 'ENOTDIR') {
|
|
74
|
+
throw error;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const parent = this.#path.dirname(currentDirectory);
|
|
78
|
+
if (!this.#path.relative(parent, currentDirectory)) {
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
currentDirectory = parent;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
async findSubPackages(rootDir, rootFile = 'package.json') {
|
|
85
|
+
const results = [];
|
|
86
|
+
const walk = async (dir) => {
|
|
87
|
+
let entries;
|
|
88
|
+
try {
|
|
89
|
+
entries = await this.#fs.readdir(dir, { withFileTypes: true });
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
for (const entry of entries) {
|
|
95
|
+
if (!entry.isDirectory() || entry.name === 'node_modules') {
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
const childDir = this.#path.join(dir, entry.name);
|
|
99
|
+
const manifestPath = this.#path.join(childDir, rootFile);
|
|
100
|
+
try {
|
|
101
|
+
const stat = await this.#fs.stat(manifestPath);
|
|
102
|
+
if (stat.isFile()) {
|
|
103
|
+
results.push(childDir);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
// No package.json here, keep walking.
|
|
108
|
+
}
|
|
109
|
+
await walk(childDir);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
await walk(rootDir);
|
|
113
|
+
return results;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
return PackageRootService = _classThis;
|
|
117
|
+
})();
|
|
118
|
+
export { PackageRootService };
|
|
119
|
+
//# sourceMappingURL=package-root.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-root.service.js","sourceRoot":"","sources":["../../../../src/server/services/stylelint-runtime/package-root.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;IAK5D,kBAAkB;4BAH9B,MAAM,CAAC;YACP,MAAM,EAAE,CAAC,qBAAqB,EAAE,eAAe,CAAC;SAChD,CAAC;;;;;;;;YACF,6KAgFC;;;YAhFY,uDAAkB;;QACrB,GAAG,CAAsC;QACzC,KAAK,CAAqD;QAEnE,YACC,QAA8C,EAC9C,UAA+D;YAE/D,IAAI,CAAC,GAAG,GAAG,QAAQ,IAAI,EAAE,CAAC;YAC1B,IAAI,CAAC,KAAK,GAAG,UAAU,IAAI,IAAI,CAAC;QACjC,CAAC;QAED,KAAK,CAAC,IAAI,CAAC,SAAiB,EAAE,QAAQ,GAAG,cAAc;YACtD,IAAI,gBAAgB,GAAG,SAAS,CAAC;YAEjC,OAAO,IAAI,EAAE,CAAC;gBACb,MAAM,YAAY,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AK,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;wBAC3D,SAAS;oBACV,CAAC;oBAED,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;oBAClD,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;oBAEzD,IAAI,CAAC;wBACJ,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;wBAE/C,IAAI,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;4BACnB,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;wBACxB,CAAC;oBACF,CAAC;oBAAC,MAAM,CAAC;wBACR,sCAAsC;oBACvC,CAAC;oBAED,MAAM,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACtB,CAAC;YACF,CAAC,CAAC;YAEF,MAAM,IAAI,CAAC,OAAO,CAAC,CAAC;YAEpB,OAAO,OAAO,CAAC;QAChB,CAAC;;;;SA/EW,kBAAkB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { PnPConfiguration } from '../../types.js';
|
|
4
|
+
type FsModule = Pick<typeof fs, 'stat'>;
|
|
5
|
+
type PathModule = Pick<typeof path, 'basename' | 'dirname' | 'isAbsolute' | 'join' | 'resolve'>;
|
|
6
|
+
export declare const resolvePnPConfigKey: (config?: PnPConfiguration) => string;
|
|
7
|
+
export declare class PnPConfigurationCacheService {
|
|
8
|
+
#private;
|
|
9
|
+
constructor(fsModule?: FsModule, pathModule?: PathModule);
|
|
10
|
+
findConfiguration(codeFilename?: string): Promise<PnPConfiguration | undefined>;
|
|
11
|
+
invalidateForFile(filePath: string | undefined): void;
|
|
12
|
+
clearForWorkspace(workspaceFolder: string): void;
|
|
13
|
+
clear(): void;
|
|
14
|
+
resolveConfigKey(config?: PnPConfiguration): string;
|
|
15
|
+
}
|
|
16
|
+
export {};
|