@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.
Files changed (334) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +39 -0
  3. package/bin/stylelint-language-server.mjs +25 -0
  4. package/build/di/container.d.ts +12 -0
  5. package/build/di/container.js +76 -0
  6. package/build/di/container.js.map +1 -0
  7. package/build/di/hooks.d.ts +16 -0
  8. package/build/di/hooks.js +25 -0
  9. package/build/di/hooks.js.map +1 -0
  10. package/build/di/index.d.ts +7 -0
  11. package/build/di/index.js +8 -0
  12. package/build/di/index.js.map +1 -0
  13. package/build/di/inject.d.ts +48 -0
  14. package/build/di/inject.js +55 -0
  15. package/build/di/inject.js.map +1 -0
  16. package/build/di/module.d.ts +51 -0
  17. package/build/di/module.js +93 -0
  18. package/build/di/module.js.map +1 -0
  19. package/build/di/runtime/application.d.ts +17 -0
  20. package/build/di/runtime/application.js +209 -0
  21. package/build/di/runtime/application.js.map +1 -0
  22. package/build/di/runtime/decorators.d.ts +14 -0
  23. package/build/di/runtime/decorators.js +26 -0
  24. package/build/di/runtime/decorators.js.map +1 -0
  25. package/build/di/runtime/index.d.ts +3 -0
  26. package/build/di/runtime/index.js +4 -0
  27. package/build/di/runtime/index.js.map +1 -0
  28. package/build/di/runtime/symbols.d.ts +1 -0
  29. package/build/di/runtime/symbols.js +2 -0
  30. package/build/di/runtime/symbols.js.map +1 -0
  31. package/build/di/runtime/types.d.ts +20 -0
  32. package/build/di/runtime/types.js +2 -0
  33. package/build/di/runtime/types.js.map +1 -0
  34. package/build/di/tokens.d.ts +8 -0
  35. package/build/di/tokens.js +7 -0
  36. package/build/di/tokens.js.map +1 -0
  37. package/build/di/types.d.ts +16 -0
  38. package/build/di/types.js +2 -0
  39. package/build/di/types.js.map +1 -0
  40. package/build/server/config/default-options.d.ts +2 -0
  41. package/build/server/config/default-options.js +29 -0
  42. package/build/server/config/default-options.js.map +1 -0
  43. package/build/server/decorators.d.ts +121 -0
  44. package/build/server/decorators.js +272 -0
  45. package/build/server/decorators.js.map +1 -0
  46. package/build/server/index.d.ts +2 -0
  47. package/build/server/index.js +3 -0
  48. package/build/server/index.js.map +1 -0
  49. package/build/server/modules/documents.module.d.ts +1 -0
  50. package/build/server/modules/documents.module.js +12 -0
  51. package/build/server/modules/documents.module.js.map +1 -0
  52. package/build/server/modules/index.d.ts +6 -0
  53. package/build/server/modules/index.js +7 -0
  54. package/build/server/modules/index.js.map +1 -0
  55. package/build/server/modules/infrastructure.module.d.ts +1 -0
  56. package/build/server/modules/infrastructure.module.js +7 -0
  57. package/build/server/modules/infrastructure.module.js.map +1 -0
  58. package/build/server/modules/lsp.module.d.ts +1 -0
  59. package/build/server/modules/lsp.module.js +18 -0
  60. package/build/server/modules/lsp.module.js.map +1 -0
  61. package/build/server/modules/platform.module.d.ts +4 -0
  62. package/build/server/modules/platform.module.js +33 -0
  63. package/build/server/modules/platform.module.js.map +1 -0
  64. package/build/server/modules/stylelint-runtime.module.d.ts +1 -0
  65. package/build/server/modules/stylelint-runtime.module.js +19 -0
  66. package/build/server/modules/stylelint-runtime.module.js.map +1 -0
  67. package/build/server/modules/workspace.module.d.ts +1 -0
  68. package/build/server/modules/workspace.module.js +7 -0
  69. package/build/server/modules/workspace.module.js.map +1 -0
  70. package/build/server/runtime/application.d.ts +19 -0
  71. package/build/server/runtime/application.js +22 -0
  72. package/build/server/runtime/application.js.map +1 -0
  73. package/build/server/runtime/language-server-feature.d.ts +13 -0
  74. package/build/server/runtime/language-server-feature.js +142 -0
  75. package/build/server/runtime/language-server-feature.js.map +1 -0
  76. package/build/server/runtime/lsp-service-runtime.d.ts +15 -0
  77. package/build/server/runtime/lsp-service-runtime.js +133 -0
  78. package/build/server/runtime/lsp-service-runtime.js.map +1 -0
  79. package/build/server/server.d.ts +13 -0
  80. package/build/server/server.js +38 -0
  81. package/build/server/server.js.map +1 -0
  82. package/build/server/server.module.d.ts +1 -0
  83. package/build/server/server.module.js +13 -0
  84. package/build/server/server.module.js.map +1 -0
  85. package/build/server/services/documents/document-diagnostics.service.d.ts +15 -0
  86. package/build/server/services/documents/document-diagnostics.service.js +88 -0
  87. package/build/server/services/documents/document-diagnostics.service.js.map +1 -0
  88. package/build/server/services/documents/document-fixes.service.d.ts +14 -0
  89. package/build/server/services/documents/document-fixes.service.js +94 -0
  90. package/build/server/services/documents/document-fixes.service.js.map +1 -0
  91. package/build/server/services/documents/index.d.ts +2 -0
  92. package/build/server/services/documents/index.js +3 -0
  93. package/build/server/services/documents/index.js.map +1 -0
  94. package/build/server/services/index.d.ts +5 -0
  95. package/build/server/services/index.js +6 -0
  96. package/build/server/services/index.js.map +1 -0
  97. package/build/server/services/infrastructure/command.service.d.ts +22 -0
  98. package/build/server/services/infrastructure/command.service.js +151 -0
  99. package/build/server/services/infrastructure/command.service.js.map +1 -0
  100. package/build/server/services/infrastructure/index.d.ts +4 -0
  101. package/build/server/services/infrastructure/index.js +5 -0
  102. package/build/server/services/infrastructure/index.js.map +1 -0
  103. package/build/server/services/infrastructure/logging.service.d.ts +6 -0
  104. package/build/server/services/infrastructure/logging.service.js +4 -0
  105. package/build/server/services/infrastructure/logging.service.js.map +1 -0
  106. package/build/server/services/infrastructure/notification.service.d.ts +24 -0
  107. package/build/server/services/infrastructure/notification.service.js +142 -0
  108. package/build/server/services/infrastructure/notification.service.js.map +1 -0
  109. package/build/server/services/infrastructure/winston-logging.service.d.ts +10 -0
  110. package/build/server/services/infrastructure/winston-logging.service.js +48 -0
  111. package/build/server/services/infrastructure/winston-logging.service.js.map +1 -0
  112. package/build/server/services/lsp/auto-fix.service.d.ts +15 -0
  113. package/build/server/services/lsp/auto-fix.service.js +142 -0
  114. package/build/server/services/lsp/auto-fix.service.js.map +1 -0
  115. package/build/server/services/lsp/code-actions/code-action.service.d.ts +18 -0
  116. package/build/server/services/lsp/code-actions/code-action.service.js +288 -0
  117. package/build/server/services/lsp/code-actions/code-action.service.js.map +1 -0
  118. package/build/server/services/lsp/code-actions/disable-rule-file-code-action.service.d.ts +11 -0
  119. package/build/server/services/lsp/code-actions/disable-rule-file-code-action.service.js +72 -0
  120. package/build/server/services/lsp/code-actions/disable-rule-file-code-action.service.js.map +1 -0
  121. package/build/server/services/lsp/code-actions/disable-rule-line-code-action.service.d.ts +12 -0
  122. package/build/server/services/lsp/code-actions/disable-rule-line-code-action.service.js +80 -0
  123. package/build/server/services/lsp/code-actions/disable-rule-line-code-action.service.js.map +1 -0
  124. package/build/server/services/lsp/code-actions/index.d.ts +3 -0
  125. package/build/server/services/lsp/code-actions/index.js +4 -0
  126. package/build/server/services/lsp/code-actions/index.js.map +1 -0
  127. package/build/server/services/lsp/completion.service.d.ts +12 -0
  128. package/build/server/services/lsp/completion.service.js +183 -0
  129. package/build/server/services/lsp/completion.service.js.map +1 -0
  130. package/build/server/services/lsp/empty-config-warning.service.d.ts +17 -0
  131. package/build/server/services/lsp/empty-config-warning.service.js +149 -0
  132. package/build/server/services/lsp/empty-config-warning.service.js.map +1 -0
  133. package/build/server/services/lsp/formatter.service.d.ts +16 -0
  134. package/build/server/services/lsp/formatter.service.js +215 -0
  135. package/build/server/services/lsp/formatter.service.js.map +1 -0
  136. package/build/server/services/lsp/index.d.ts +8 -0
  137. package/build/server/services/lsp/index.js +9 -0
  138. package/build/server/services/lsp/index.js.map +1 -0
  139. package/build/server/services/lsp/old-stylelint-warning.service.d.ts +13 -0
  140. package/build/server/services/lsp/old-stylelint-warning.service.js +186 -0
  141. package/build/server/services/lsp/old-stylelint-warning.service.js.map +1 -0
  142. package/build/server/services/lsp/validator.service.d.ts +19 -0
  143. package/build/server/services/lsp/validator.service.js +273 -0
  144. package/build/server/services/lsp/validator.service.js.map +1 -0
  145. package/build/server/services/lsp/workspace-activity.service.d.ts +10 -0
  146. package/build/server/services/lsp/workspace-activity.service.js +76 -0
  147. package/build/server/services/lsp/workspace-activity.service.js.map +1 -0
  148. package/build/server/services/services.module.d.ts +1 -0
  149. package/build/server/services/services.module.js +19 -0
  150. package/build/server/services/services.module.js.map +1 -0
  151. package/build/server/services/stylelint-runtime/global-path-resolver.service.d.ts +38 -0
  152. package/build/server/services/stylelint-runtime/global-path-resolver.service.js +223 -0
  153. package/build/server/services/stylelint-runtime/global-path-resolver.service.js.map +1 -0
  154. package/build/server/services/stylelint-runtime/index.d.ts +11 -0
  155. package/build/server/services/stylelint-runtime/index.js +12 -0
  156. package/build/server/services/stylelint-runtime/index.js.map +1 -0
  157. package/build/server/services/stylelint-runtime/package-root-cache.service.d.ts +9 -0
  158. package/build/server/services/stylelint-runtime/package-root-cache.service.js +141 -0
  159. package/build/server/services/stylelint-runtime/package-root-cache.service.js.map +1 -0
  160. package/build/server/services/stylelint-runtime/package-root.service.d.ts +8 -0
  161. package/build/server/services/stylelint-runtime/package-root.service.js +119 -0
  162. package/build/server/services/stylelint-runtime/package-root.service.js.map +1 -0
  163. package/build/server/services/stylelint-runtime/pnp-configuration-cache.service.d.ts +16 -0
  164. package/build/server/services/stylelint-runtime/pnp-configuration-cache.service.js +195 -0
  165. package/build/server/services/stylelint-runtime/pnp-configuration-cache.service.js.map +1 -0
  166. package/build/server/services/stylelint-runtime/process-runner.service.d.ts +30 -0
  167. package/build/server/services/stylelint-runtime/process-runner.service.js +149 -0
  168. package/build/server/services/stylelint-runtime/process-runner.service.js.map +1 -0
  169. package/build/server/services/stylelint-runtime/stylelint-options.service.d.ts +12 -0
  170. package/build/server/services/stylelint-runtime/stylelint-options.service.js +185 -0
  171. package/build/server/services/stylelint-runtime/stylelint-options.service.js.map +1 -0
  172. package/build/server/services/stylelint-runtime/stylelint-runner.service.d.ts +42 -0
  173. package/build/server/services/stylelint-runtime/stylelint-runner.service.js +478 -0
  174. package/build/server/services/stylelint-runtime/stylelint-runner.service.js.map +1 -0
  175. package/build/server/services/stylelint-runtime/worker-environment.service.d.ts +17 -0
  176. package/build/server/services/stylelint-runtime/worker-environment.service.js +135 -0
  177. package/build/server/services/stylelint-runtime/worker-environment.service.js.map +1 -0
  178. package/build/server/services/stylelint-runtime/worker-process.service.d.ts +8 -0
  179. package/build/server/services/stylelint-runtime/worker-process.service.js +66 -0
  180. package/build/server/services/stylelint-runtime/worker-process.service.js.map +1 -0
  181. package/build/server/services/stylelint-runtime/worker-registry.service.d.ts +19 -0
  182. package/build/server/services/stylelint-runtime/worker-registry.service.js +289 -0
  183. package/build/server/services/stylelint-runtime/worker-registry.service.js.map +1 -0
  184. package/build/server/services/stylelint-runtime/workspace-stylelint.service.d.ts +37 -0
  185. package/build/server/services/stylelint-runtime/workspace-stylelint.service.js +185 -0
  186. package/build/server/services/stylelint-runtime/workspace-stylelint.service.js.map +1 -0
  187. package/build/server/services/workspace/index.d.ts +2 -0
  188. package/build/server/services/workspace/index.js +3 -0
  189. package/build/server/services/workspace/index.js.map +1 -0
  190. package/build/server/services/workspace/workspace-folder.service.d.ts +18 -0
  191. package/build/server/services/workspace/workspace-folder.service.js +101 -0
  192. package/build/server/services/workspace/workspace-folder.service.js.map +1 -0
  193. package/build/server/services/workspace/workspace-options.service.d.ts +12 -0
  194. package/build/server/services/workspace/workspace-options.service.js +125 -0
  195. package/build/server/services/workspace/workspace-options.service.js.map +1 -0
  196. package/build/server/stylelint/disable-metadata-lookup-table.d.ts +20 -0
  197. package/build/server/stylelint/disable-metadata-lookup-table.js +68 -0
  198. package/build/server/stylelint/disable-metadata-lookup-table.js.map +1 -0
  199. package/build/server/stylelint/formatting-options-to-rules.d.ts +12 -0
  200. package/build/server/stylelint/formatting-options-to-rules.js +19 -0
  201. package/build/server/stylelint/formatting-options-to-rules.js.map +1 -0
  202. package/build/server/stylelint/get-disable-diagnostic-rule.d.ts +7 -0
  203. package/build/server/stylelint/get-disable-diagnostic-rule.js +22 -0
  204. package/build/server/stylelint/get-disable-diagnostic-rule.js.map +1 -0
  205. package/build/server/stylelint/index.d.ts +7 -0
  206. package/build/server/stylelint/index.js +8 -0
  207. package/build/server/stylelint/index.js.map +1 -0
  208. package/build/server/stylelint/is-disable-report-rule.d.ts +6 -0
  209. package/build/server/stylelint/is-disable-report-rule.js +17 -0
  210. package/build/server/stylelint/is-disable-report-rule.js.map +1 -0
  211. package/build/server/stylelint/load-stylelint.d.ts +23 -0
  212. package/build/server/stylelint/load-stylelint.js +173 -0
  213. package/build/server/stylelint/load-stylelint.js.map +1 -0
  214. package/build/server/stylelint/process-linter-result.d.ts +32 -0
  215. package/build/server/stylelint/process-linter-result.js +129 -0
  216. package/build/server/stylelint/process-linter-result.js.map +1 -0
  217. package/build/server/stylelint/types.d.ts +143 -0
  218. package/build/server/stylelint/types.js +47 -0
  219. package/build/server/stylelint/types.js.map +1 -0
  220. package/build/server/stylelint/warning-to-diagnostic.d.ts +46 -0
  221. package/build/server/stylelint/warning-to-diagnostic.js +143 -0
  222. package/build/server/stylelint/warning-to-diagnostic.js.map +1 -0
  223. package/build/server/tokens.d.ts +20 -0
  224. package/build/server/tokens.js +16 -0
  225. package/build/server/tokens.js.map +1 -0
  226. package/build/server/types.d.ts +74 -0
  227. package/build/server/types.js +18 -0
  228. package/build/server/types.js.map +1 -0
  229. package/build/server/utils/documents/create-text-edits.d.ts +10 -0
  230. package/build/server/utils/documents/create-text-edits.js +31 -0
  231. package/build/server/utils/documents/create-text-edits.js.map +1 -0
  232. package/build/server/utils/documents/get-disable-type.d.ts +26 -0
  233. package/build/server/utils/documents/get-disable-type.js +32 -0
  234. package/build/server/utils/documents/get-disable-type.js.map +1 -0
  235. package/build/server/utils/documents/get-edit-info.d.ts +14 -0
  236. package/build/server/utils/documents/get-edit-info.js +31 -0
  237. package/build/server/utils/documents/get-edit-info.js.map +1 -0
  238. package/build/server/utils/documents/get-fixes.d.ts +12 -0
  239. package/build/server/utils/documents/get-fixes.js +18 -0
  240. package/build/server/utils/documents/get-fixes.js.map +1 -0
  241. package/build/server/utils/documents/index.d.ts +4 -0
  242. package/build/server/utils/documents/index.js +5 -0
  243. package/build/server/utils/documents/index.js.map +1 -0
  244. package/build/server/utils/errors.d.ts +10 -0
  245. package/build/server/utils/errors.js +89 -0
  246. package/build/server/utils/errors.js.map +1 -0
  247. package/build/server/utils/fs.d.ts +4 -0
  248. package/build/server/utils/fs.js +11 -0
  249. package/build/server/utils/fs.js.map +1 -0
  250. package/build/server/utils/functions/get-first-return-value.d.ts +11 -0
  251. package/build/server/utils/functions/get-first-return-value.js +28 -0
  252. package/build/server/utils/functions/get-first-return-value.js.map +1 -0
  253. package/build/server/utils/functions/index.d.ts +2 -0
  254. package/build/server/utils/functions/index.js +3 -0
  255. package/build/server/utils/functions/index.js.map +1 -0
  256. package/build/server/utils/functions/lazy-call.d.ts +12 -0
  257. package/build/server/utils/functions/lazy-call.js +33 -0
  258. package/build/server/utils/functions/lazy-call.js.map +1 -0
  259. package/build/server/utils/index.d.ts +11 -0
  260. package/build/server/utils/index.js +12 -0
  261. package/build/server/utils/index.js.map +1 -0
  262. package/build/server/utils/iterables.d.ts +8 -0
  263. package/build/server/utils/iterables.js +15 -0
  264. package/build/server/utils/iterables.js.map +1 -0
  265. package/build/server/utils/logging/error-formatter.d.ts +7 -0
  266. package/build/server/utils/logging/error-formatter.js +14 -0
  267. package/build/server/utils/logging/error-formatter.js.map +1 -0
  268. package/build/server/utils/logging/get-log-function.d.ts +8 -0
  269. package/build/server/utils/logging/get-log-function.js +11 -0
  270. package/build/server/utils/logging/get-log-function.js.map +1 -0
  271. package/build/server/utils/logging/index.d.ts +4 -0
  272. package/build/server/utils/logging/index.js +5 -0
  273. package/build/server/utils/logging/index.js.map +1 -0
  274. package/build/server/utils/logging/language-server-formatter.d.ts +19 -0
  275. package/build/server/utils/logging/language-server-formatter.js +55 -0
  276. package/build/server/utils/logging/language-server-formatter.js.map +1 -0
  277. package/build/server/utils/logging/language-server-transport.d.ts +19 -0
  278. package/build/server/utils/logging/language-server-transport.js +39 -0
  279. package/build/server/utils/logging/language-server-transport.js.map +1 -0
  280. package/build/server/utils/lsp/create-disable-completion-item.d.ts +7 -0
  281. package/build/server/utils/lsp/create-disable-completion-item.js +32 -0
  282. package/build/server/utils/lsp/create-disable-completion-item.js.map +1 -0
  283. package/build/server/utils/lsp/display-error.d.ts +7 -0
  284. package/build/server/utils/lsp/display-error.js +24 -0
  285. package/build/server/utils/lsp/display-error.js.map +1 -0
  286. package/build/server/utils/lsp/index.d.ts +4 -0
  287. package/build/server/utils/lsp/index.js +5 -0
  288. package/build/server/utils/lsp/index.js.map +1 -0
  289. package/build/server/utils/lsp/rule-code-actions-collection.d.ts +29 -0
  290. package/build/server/utils/lsp/rule-code-actions-collection.js +61 -0
  291. package/build/server/utils/lsp/rule-code-actions-collection.js.map +1 -0
  292. package/build/server/utils/lsp/types.d.ts +22 -0
  293. package/build/server/utils/lsp/types.js +2 -0
  294. package/build/server/utils/lsp/types.js.map +1 -0
  295. package/build/server/utils/objects/index.d.ts +3 -0
  296. package/build/server/utils/objects/index.js +4 -0
  297. package/build/server/utils/objects/index.js.map +1 -0
  298. package/build/server/utils/objects/is-object.d.ts +8 -0
  299. package/build/server/utils/objects/is-object.js +13 -0
  300. package/build/server/utils/objects/is-object.js.map +1 -0
  301. package/build/server/utils/objects/merge-assign.d.ts +8 -0
  302. package/build/server/utils/objects/merge-assign.js +38 -0
  303. package/build/server/utils/objects/merge-assign.js.map +1 -0
  304. package/build/server/utils/objects/merge-options-with-defaults.d.ts +5 -0
  305. package/build/server/utils/objects/merge-options-with-defaults.js +56 -0
  306. package/build/server/utils/objects/merge-options-with-defaults.js.map +1 -0
  307. package/build/server/utils/sets.d.ts +6 -0
  308. package/build/server/utils/sets.js +22 -0
  309. package/build/server/utils/sets.js.map +1 -0
  310. package/build/server/utils/strings.d.ts +12 -0
  311. package/build/server/utils/strings.js +20 -0
  312. package/build/server/utils/strings.js.map +1 -0
  313. package/build/server/utils/types.d.ts +27 -0
  314. package/build/server/utils/types.js +2 -0
  315. package/build/server/utils/types.js.map +1 -0
  316. package/build/server/worker/types.d.ts +63 -0
  317. package/build/server/worker/types.js +2 -0
  318. package/build/server/worker/types.js.map +1 -0
  319. package/build/server/worker/worker-entry.d.ts +1 -0
  320. package/build/server/worker/worker-entry.js +320 -0
  321. package/build/server/worker/worker-entry.js.map +1 -0
  322. package/build/server/worker/worker-logging.service.d.ts +18 -0
  323. package/build/server/worker/worker-logging.service.js +61 -0
  324. package/build/server/worker/worker-logging.service.js.map +1 -0
  325. package/build/server/worker/worker-process.d.ts +54 -0
  326. package/build/server/worker/worker-process.js +266 -0
  327. package/build/server/worker/worker-process.js.map +1 -0
  328. package/build/shared/log-level.d.ts +5 -0
  329. package/build/shared/log-level.js +11 -0
  330. package/build/shared/log-level.js.map +1 -0
  331. package/build/shared/types.d.ts +9 -0
  332. package/build/shared/types.js +3 -0
  333. package/build/shared/types.js.map +1 -0
  334. package/package.json +89 -0
@@ -0,0 +1,195 @@
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 'node:fs/promises';
36
+ import path from 'node:path';
37
+ import process from 'node:process';
38
+ import { inject } from '../../../di/index.js';
39
+ import { normalizeFsPath } from '../../utils/index.js';
40
+ import { FsPromisesModuleToken, PathModuleToken } from '../../tokens.js';
41
+ const pnpRegisterFilenames = ['.pnp.cjs', '.pnp.js'];
42
+ const pnpLoaderFilename = '.pnp.loader.mjs';
43
+ const pnpConfigFilenames = new Set([...pnpRegisterFilenames, pnpLoaderFilename]);
44
+ export const resolvePnPConfigKey = (config) => `${config?.registerPath ?? ''}|${config?.loaderPath ?? ''}`;
45
+ let PnPConfigurationCacheService = (() => {
46
+ let _classDecorators = [inject({
47
+ inject: [FsPromisesModuleToken, PathModuleToken],
48
+ })];
49
+ let _classDescriptor;
50
+ let _classExtraInitializers = [];
51
+ let _classThis;
52
+ var PnPConfigurationCacheService = class {
53
+ static { _classThis = this; }
54
+ static {
55
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
56
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
57
+ PnPConfigurationCacheService = _classThis = _classDescriptor.value;
58
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
59
+ __runInitializers(_classThis, _classExtraInitializers);
60
+ }
61
+ #fs;
62
+ #path;
63
+ #cache = new Map();
64
+ constructor(fsModule, pathModule) {
65
+ this.#fs = fsModule ?? fs;
66
+ this.#path = pathModule ?? path;
67
+ }
68
+ async findConfiguration(codeFilename) {
69
+ if (!codeFilename) {
70
+ return undefined;
71
+ }
72
+ let currentDir = this.#path.dirname(codeFilename);
73
+ const visitedKeys = [];
74
+ while (true) {
75
+ const cacheKey = this.#normalizeCachePath(currentDir);
76
+ visitedKeys.push(cacheKey);
77
+ const cached = this.#cache.get(cacheKey);
78
+ if (cached !== undefined) {
79
+ if (cached) {
80
+ this.#populateCache(visitedKeys, cached);
81
+ return cached;
82
+ }
83
+ }
84
+ else {
85
+ const config = await this.#readPnPConfiguration(currentDir);
86
+ if (config) {
87
+ this.#cache.set(cacheKey, config);
88
+ this.#populateCache(visitedKeys, config);
89
+ return config;
90
+ }
91
+ this.#cache.set(cacheKey, null);
92
+ }
93
+ const parent = this.#path.dirname(currentDir);
94
+ if (parent === currentDir) {
95
+ return undefined;
96
+ }
97
+ currentDir = parent;
98
+ }
99
+ }
100
+ invalidateForFile(filePath) {
101
+ if (!filePath) {
102
+ return;
103
+ }
104
+ const baseName = this.#path.basename(filePath);
105
+ if (!pnpConfigFilenames.has(baseName)) {
106
+ return;
107
+ }
108
+ this.#invalidatePnPConfigCache(this.#path.dirname(filePath));
109
+ }
110
+ clearForWorkspace(workspaceFolder) {
111
+ this.#deleteCacheEntriesWithinPath(workspaceFolder);
112
+ }
113
+ clear() {
114
+ this.#cache.clear();
115
+ }
116
+ resolveConfigKey(config) {
117
+ return resolvePnPConfigKey(config);
118
+ }
119
+ async #readPnPConfiguration(directory) {
120
+ for (const filename of pnpRegisterFilenames) {
121
+ const registerPath = await this.#statIfFile(this.#path.join(directory, filename));
122
+ if (registerPath) {
123
+ const loaderPath = await this.#statIfFile(this.#path.join(directory, pnpLoaderFilename));
124
+ return { registerPath, loaderPath };
125
+ }
126
+ }
127
+ return undefined;
128
+ }
129
+ async #statIfFile(filePath) {
130
+ try {
131
+ const stats = await this.#fs.stat(filePath);
132
+ if (stats.isFile()) {
133
+ return filePath;
134
+ }
135
+ }
136
+ catch {
137
+ // ignore
138
+ }
139
+ return undefined;
140
+ }
141
+ #populateCache(visitedKeys, config) {
142
+ for (const key of visitedKeys) {
143
+ this.#cache.set(key, config);
144
+ }
145
+ }
146
+ #invalidatePnPConfigCache(directory) {
147
+ const normalizedDir = this.#normalizeCachePath(directory);
148
+ for (const [key, value] of this.#cache.entries()) {
149
+ const matchesKey = this.#isWithinNormalizedPath(normalizedDir, key);
150
+ const matchesConfig = value ? this.#pnpConfigMatchesDirectory(value, normalizedDir) : false;
151
+ if (matchesKey || matchesConfig) {
152
+ this.#cache.delete(key);
153
+ }
154
+ }
155
+ }
156
+ #pnpConfigMatchesDirectory(config, normalizedDir) {
157
+ if (config.registerPath) {
158
+ const registerDir = this.#normalizeCachePath(this.#path.dirname(config.registerPath));
159
+ if (this.#isWithinNormalizedPath(normalizedDir, registerDir)) {
160
+ return true;
161
+ }
162
+ }
163
+ if (config.loaderPath) {
164
+ const loaderDir = this.#normalizeCachePath(this.#path.dirname(config.loaderPath));
165
+ if (this.#isWithinNormalizedPath(normalizedDir, loaderDir)) {
166
+ return true;
167
+ }
168
+ }
169
+ return false;
170
+ }
171
+ #deleteCacheEntriesWithinPath(rootPath) {
172
+ const normalizedRoot = this.#normalizeCachePath(rootPath);
173
+ for (const key of this.#cache.keys()) {
174
+ if (this.#isWithinNormalizedPath(normalizedRoot, key)) {
175
+ this.#cache.delete(key);
176
+ }
177
+ }
178
+ }
179
+ #normalizeCachePath(value) {
180
+ const absolute = this.#path.isAbsolute(value) ? value : this.#path.resolve(value);
181
+ return normalizeFsPath(absolute) ?? absolute;
182
+ }
183
+ #isWithinNormalizedPath(normalizedRoot, candidateNormalized) {
184
+ const comparableRoot = process.platform === 'win32' ? normalizedRoot.toLowerCase() : normalizedRoot;
185
+ const comparableCandidate = process.platform === 'win32' ? candidateNormalized.toLowerCase() : candidateNormalized;
186
+ if (comparableCandidate === comparableRoot) {
187
+ return true;
188
+ }
189
+ return comparableCandidate.startsWith(`${comparableRoot}${path.sep}`);
190
+ }
191
+ };
192
+ return PnPConfigurationCacheService = _classThis;
193
+ })();
194
+ export { PnPConfigurationCacheService };
195
+ //# sourceMappingURL=pnp-configuration-cache.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pnp-configuration-cache.service.js","sourceRoot":"","sources":["../../../../src/server/services/stylelint-runtime/pnp-configuration-cache.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,OAAO,MAAM,cAAc,CAAC;AAEnC,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEzE,MAAM,oBAAoB,GAAG,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;AACrD,MAAM,iBAAiB,GAAG,iBAAiB,CAAC;AAC5C,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,oBAAoB,EAAE,iBAAiB,CAAC,CAAC,CAAC;AAKjF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,MAAyB,EAAU,EAAE,CACxE,GAAG,MAAM,EAAE,YAAY,IAAI,EAAE,IAAI,MAAM,EAAE,UAAU,IAAI,EAAE,EAAE,CAAC;IAKhD,4BAA4B;4BAHxC,MAAM,CAAC;YACP,MAAM,EAAE,CAAC,qBAAqB,EAAE,eAAe,CAAC;SAChD,CAAC;;;;;;;;YACF,6KA+KC;;;YA/KY,uDAA4B;;QAC/B,GAAG,CAAW;QACd,KAAK,CAAa;QAClB,MAAM,GAAG,IAAI,GAAG,EAAmC,CAAC;QAE7D,YAAY,QAAm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,cAAc,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,cAAc,CAAC;YAC9E,MAAM,mBAAmB,GACxB,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,mBAAmB,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,mBAAmB,CAAC;YAExF,IAAI,mBAAmB,KAAK,cAAc,EAAE,CAAC;gBAC5C,OAAO,IAAI,CAAC;YACb,CAAC;YAED,OAAO,mBAAmB,CAAC,UAAU,CAAC,GAAG,cAAc,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QACvE,CAAC;;;;SA9KW,4BAA4B"}
@@ -0,0 +1,30 @@
1
+ import cp, { type SpawnOptionsWithoutStdio } from 'node:child_process';
2
+ import readline from 'node:readline';
3
+ /**
4
+ * Executes processes and searches their stdout for matching lines.
5
+ */
6
+ export declare class ProcessRunnerService {
7
+ #private;
8
+ constructor(childProcessModule?: Pick<typeof cp, 'spawn'>, readlineModule?: Pick<typeof readline, 'createInterface'>);
9
+ /**
10
+ * Runs a process and returns the output as read by the given matcher. The
11
+ * matcher is called for each line of the output with the line. The promise
12
+ * returned by this function is resolved to the first value returned by the
13
+ * matcher once the process has exited.
14
+ *
15
+ * If the matcher returns `undefined`, the line is ignored.
16
+ *
17
+ * If the matcher never returns a value, the promise is resolved to `undefined`.
18
+ *
19
+ * If the matcher throws an error, the promise is rejected with the error and
20
+ * an attempt is made to kill the process.
21
+ *
22
+ * If the process exits with a non-zero exit code or if the child process API
23
+ * emits an error, the promise is rejected with the exit code or error.
24
+ * @param command Shell command or path to executable
25
+ * @param args Arguments to pass to the command
26
+ * @param options Options to pass to the spawner
27
+ * @param matcher Function to match the output line
28
+ */
29
+ runFindLine<T>(command: string, args: string[], options: SpawnOptionsWithoutStdio | undefined, matcher: (line: string) => T | undefined): Promise<T | undefined>;
30
+ }
@@ -0,0 +1,149 @@
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 cp from 'node:child_process';
36
+ import readline from 'node:readline';
37
+ import { inject } from '../../../di/index.js';
38
+ import { ChildProcessModuleToken, ReadlineModuleToken } from '../../tokens.js';
39
+ /**
40
+ * Executes processes and searches their stdout for matching lines.
41
+ */
42
+ let ProcessRunnerService = (() => {
43
+ let _classDecorators = [inject({
44
+ inject: [ChildProcessModuleToken, ReadlineModuleToken],
45
+ })];
46
+ let _classDescriptor;
47
+ let _classExtraInitializers = [];
48
+ let _classThis;
49
+ var ProcessRunnerService = 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
+ ProcessRunnerService = _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
+ #childProcess;
59
+ #readline;
60
+ constructor(childProcessModule, readlineModule) {
61
+ this.#childProcess = childProcessModule ?? cp;
62
+ this.#readline = readlineModule ?? readline;
63
+ }
64
+ /**
65
+ * Runs a process and returns the output as read by the given matcher. The
66
+ * matcher is called for each line of the output with the line. The promise
67
+ * returned by this function is resolved to the first value returned by the
68
+ * matcher once the process has exited.
69
+ *
70
+ * If the matcher returns `undefined`, the line is ignored.
71
+ *
72
+ * If the matcher never returns a value, the promise is resolved to `undefined`.
73
+ *
74
+ * If the matcher throws an error, the promise is rejected with the error and
75
+ * an attempt is made to kill the process.
76
+ *
77
+ * If the process exits with a non-zero exit code or if the child process API
78
+ * emits an error, the promise is rejected with the exit code or error.
79
+ * @param command Shell command or path to executable
80
+ * @param args Arguments to pass to the command
81
+ * @param options Options to pass to the spawner
82
+ * @param matcher Function to match the output line
83
+ */
84
+ async runFindLine(command, args, options, matcher) {
85
+ return await new Promise((resolve, reject) => {
86
+ const childProcess = this.#childProcess.spawn(command, args, options);
87
+ const stdoutReader = this.#readline.createInterface({ input: childProcess.stdout });
88
+ let returnValue;
89
+ let exitCode;
90
+ let resolved = false;
91
+ let streamClosed = false;
92
+ const resolveOrRejectIfNeeded = () => {
93
+ if (resolved || exitCode === undefined || !streamClosed) {
94
+ return;
95
+ }
96
+ resolved = true;
97
+ if (exitCode === 0) {
98
+ resolve(returnValue);
99
+ }
100
+ else {
101
+ reject(new Error(`Command "${command}" exited with code ${exitCode}.`));
102
+ }
103
+ };
104
+ const handleError = (error) => {
105
+ resolved = true;
106
+ childProcess.removeAllListeners();
107
+ stdoutReader.close();
108
+ try {
109
+ childProcess.kill();
110
+ }
111
+ catch {
112
+ // ignore
113
+ }
114
+ reject(error); // eslint-disable-line @typescript-eslint/prefer-promise-reject-errors
115
+ };
116
+ stdoutReader.on('line', (line) => {
117
+ if (resolved || returnValue !== undefined) {
118
+ return;
119
+ }
120
+ try {
121
+ const matched = matcher(line);
122
+ if (matched !== undefined) {
123
+ returnValue = matched;
124
+ }
125
+ resolveOrRejectIfNeeded();
126
+ }
127
+ catch (error) {
128
+ handleError(error);
129
+ }
130
+ });
131
+ stdoutReader.on('close', () => {
132
+ if (resolved) {
133
+ return;
134
+ }
135
+ streamClosed = true;
136
+ resolveOrRejectIfNeeded();
137
+ });
138
+ childProcess.on('error', handleError);
139
+ childProcess.on('exit', (code, signal) => {
140
+ exitCode = code ?? signal;
141
+ resolveOrRejectIfNeeded();
142
+ });
143
+ });
144
+ }
145
+ };
146
+ return ProcessRunnerService = _classThis;
147
+ })();
148
+ export { ProcessRunnerService };
149
+ //# sourceMappingURL=process-runner.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process-runner.service.js","sourceRoot":"","sources":["../../../../src/server/services/stylelint-runtime/process-runner.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAqC,MAAM,oBAAoB,CAAC;AACvE,OAAO,QAAQ,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAE/E;;GAEG;IAIU,oBAAoB;4BAHh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CAAC;gBAC3B,CAAC,CAAC,CAAC;YACJ,CAAC,CAAC,CAAC;QACJ,CAAC;;;;SA9GW,oBAAoB"}
@@ -0,0 +1,12 @@
1
+ import path from 'path';
2
+ import pathIsInside from 'path-is-inside';
3
+ import type stylelint from 'stylelint';
4
+ import { URI } from 'vscode-uri';
5
+ import { normalizeFsPath } from '../../utils/index.js';
6
+ import type { RunnerOptions } from '../../stylelint/types.js';
7
+ import { PackageRootService } from './package-root.service.js';
8
+ export declare class StylelintOptionsService {
9
+ #private;
10
+ constructor(pathModule: typeof path, pathIsInsideFn: typeof pathIsInside, uriModule: typeof URI, packageRootFinder: PackageRootService, normalizeFsPathFn: typeof normalizeFsPath);
11
+ build(uri: string, workspaceFolder?: string, baseOptions?: Partial<stylelint.LinterOptions>, runnerOptions?: RunnerOptions): Promise<Partial<stylelint.LinterOptions>>;
12
+ }
@@ -0,0 +1,185 @@
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 { NormalizeFsPathToken, PathIsInsideToken, PathModuleToken, UriModuleToken, } from '../../tokens.js';
37
+ import { PackageRootService } from './package-root.service.js';
38
+ let StylelintOptionsService = (() => {
39
+ let _classDecorators = [inject({
40
+ inject: [
41
+ PathModuleToken,
42
+ PathIsInsideToken,
43
+ UriModuleToken,
44
+ PackageRootService,
45
+ NormalizeFsPathToken,
46
+ ],
47
+ })];
48
+ let _classDescriptor;
49
+ let _classExtraInitializers = [];
50
+ let _classThis;
51
+ var StylelintOptionsService = class {
52
+ static { _classThis = this; }
53
+ static {
54
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
55
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
56
+ StylelintOptionsService = _classThis = _classDescriptor.value;
57
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
58
+ __runInitializers(_classThis, _classExtraInitializers);
59
+ }
60
+ #path;
61
+ #pathIsInside;
62
+ #uri;
63
+ #packageRootFinder;
64
+ #normalizeFsPath;
65
+ constructor(pathModule, pathIsInsideFn, uriModule, packageRootFinder, normalizeFsPathFn) {
66
+ this.#path = pathModule;
67
+ this.#pathIsInside = pathIsInsideFn;
68
+ this.#uri = uriModule;
69
+ this.#packageRootFinder = packageRootFinder;
70
+ this.#normalizeFsPath = normalizeFsPathFn;
71
+ }
72
+ async build(uri, workspaceFolder, baseOptions = {}, runnerOptions = {}) {
73
+ const { config, configFile, configBasedir, customSyntax, ignoreDisables, ignorePath, reportDescriptionlessDisables, reportNeedlessDisables, reportInvalidScopeDisables, } = runnerOptions;
74
+ const runnerOptionsProvided = Object.keys(runnerOptions).length > 0;
75
+ const pathModule = this.#path;
76
+ const options = {
77
+ ...baseOptions,
78
+ config: config ?? baseOptions.config,
79
+ configFile: this.#resolvePathTemplate(configFile, workspaceFolder) ?? baseOptions.configFile,
80
+ configBasedir: this.#resolveConfigBasedir(configBasedir, workspaceFolder, baseOptions.configBasedir),
81
+ customSyntax: this.#resolvePathTemplate(customSyntax, workspaceFolder) ?? baseOptions.customSyntax,
82
+ ignoreDisables: ignoreDisables ?? baseOptions.ignoreDisables,
83
+ ignorePath: this.#resolvePathTemplate(ignorePath, workspaceFolder) ?? baseOptions.ignorePath,
84
+ reportDescriptionlessDisables: reportDescriptionlessDisables ?? baseOptions.reportDescriptionlessDisables,
85
+ reportNeedlessDisables: reportNeedlessDisables ?? baseOptions.reportNeedlessDisables,
86
+ reportInvalidScopeDisables: reportInvalidScopeDisables ?? baseOptions.reportInvalidScopeDisables,
87
+ };
88
+ const documentPath = this.#uri.parse(uri).fsPath;
89
+ const normalizedDocumentPath = documentPath ? this.#normalizeFsPath(documentPath) : undefined;
90
+ const normalizedWorkspaceFolder = workspaceFolder
91
+ ? this.#normalizeFsPath(workspaceFolder)
92
+ : undefined;
93
+ const packageRoot = normalizedDocumentPath
94
+ ? await this.#packageRootFinder.find(normalizedDocumentPath)
95
+ : undefined;
96
+ const normalizedPackageRoot = packageRoot ? this.#normalizeFsPath(packageRoot) : undefined;
97
+ const normalizedDocumentDir = normalizedDocumentPath
98
+ ? pathModule.dirname(normalizedDocumentPath)
99
+ : undefined;
100
+ const packageWithinWorkspace = Boolean(normalizedPackageRoot &&
101
+ normalizedWorkspaceFolder &&
102
+ this.#pathIsInside(normalizedPackageRoot, normalizedWorkspaceFolder));
103
+ const documentInWorkspace = Boolean(normalizedDocumentPath &&
104
+ normalizedWorkspaceFolder &&
105
+ this.#pathIsInside(normalizedDocumentPath, normalizedWorkspaceFolder));
106
+ // Working directory selection rules:
107
+ //
108
+ // - If caller provided cwd and the document is inside the workspace,
109
+ // keep the caller's cwd.
110
+ // - If caller provided cwd and the document is outside the workspace,
111
+ // prefer the package root if it exists and is not inside the
112
+ // workspace, otherwise use the workspace folder if given.
113
+ // - If caller did not provide cwd, prefer the package root.
114
+ // - If no package root is found, use the workspace folder when
115
+ // available.
116
+ // - Fall back to the document directory as a last resort.
117
+ //
118
+ // This ensures that linting is done relative to the correct context,
119
+ // which in turn makes sure that .stylelintignore and local configs
120
+ // work as expected in monorepos and packages otherwise deeper in the
121
+ // workspace tree.
122
+ const cwd = (() => {
123
+ if (options.cwd && runnerOptionsProvided) {
124
+ return options.cwd;
125
+ }
126
+ if (options.cwd) {
127
+ if (documentInWorkspace) {
128
+ return options.cwd;
129
+ }
130
+ if (normalizedPackageRoot && !packageWithinWorkspace) {
131
+ return normalizedPackageRoot;
132
+ }
133
+ return normalizedWorkspaceFolder ?? normalizedPackageRoot ?? normalizedDocumentDir;
134
+ }
135
+ if (!documentInWorkspace && normalizedPackageRoot && !packageWithinWorkspace) {
136
+ return normalizedPackageRoot;
137
+ }
138
+ const preferredPackageRoot = normalizedPackageRoot && (!normalizedWorkspaceFolder || packageWithinWorkspace)
139
+ ? normalizedPackageRoot
140
+ : undefined;
141
+ return preferredPackageRoot ?? normalizedWorkspaceFolder ?? normalizedDocumentDir;
142
+ })();
143
+ if (cwd) {
144
+ const absoluteCwd = this.#path.isAbsolute(cwd) ? cwd : this.#path.resolve(cwd);
145
+ options.cwd = this.#normalizeDriveCase(absoluteCwd);
146
+ }
147
+ return options;
148
+ }
149
+ // Workaround for Stylelint treating paths as case-sensitive on Windows
150
+ // If the drive letter is lowercase, we need to convert it to uppercase
151
+ // See https://github.com/stylelint/stylelint/issues/5594
152
+ // TODO: Remove once fixed upstream
153
+ #normalizeDriveCase(value) {
154
+ if (this.#path.sep !== '\\') {
155
+ return value;
156
+ }
157
+ return value.replace(/^[a-z]:/, (match) => match.toUpperCase());
158
+ }
159
+ #resolvePathTemplate(value, workspaceFolder) {
160
+ if (!value) {
161
+ return undefined;
162
+ }
163
+ if (!workspaceFolder) {
164
+ return value;
165
+ }
166
+ return value.replace(/\$\{workspaceFolder\}/gu, workspaceFolder);
167
+ }
168
+ #resolveConfigBasedir(value, workspaceFolder, fallback) {
169
+ if (!value) {
170
+ return fallback;
171
+ }
172
+ const pathModule = this.#path;
173
+ if (pathModule.isAbsolute(value)) {
174
+ return value;
175
+ }
176
+ if (!workspaceFolder) {
177
+ return value.replace(/^\.\//u, '');
178
+ }
179
+ return pathModule.join(workspaceFolder, value);
180
+ }
181
+ };
182
+ return StylelintOptionsService = _classThis;
183
+ })();
184
+ export { StylelintOptionsService };
185
+ //# sourceMappingURL=stylelint-options.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stylelint-options.service.js","sourceRoot":"","sources":["../../../../src/server/services/stylelint-runtime/stylelint-options.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAG9C,OAAO,EACN,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EACf,cAAc,GACd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;IAWlD,uBAAuB;4BATnC,MAAM,CAAC;YACP,MAAM,EAAE;gBACP,eAAe;gBACf,iBAAiB;gBACjB,cAAc;gBACd,kBAAkB;gBAClB,oBAAoB;aACpB;SACD,CAAC;;;;;;;;YACF,6KAuLC;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
2
+ import os from 'os';
3
+ import path from 'path';
4
+ import type stylelint from 'stylelint';
5
+ import type { Connection } from 'vscode-languageserver';
6
+ import * as LSP from 'vscode-languageserver-protocol';
7
+ import type { TextDocument } from 'vscode-languageserver-textdocument';
8
+ import { URI } from 'vscode-uri';
9
+ import { type LintDiagnostics, type MultiFileLintDiagnostics, type RunnerOptions, type StylelintResolutionResult } from '../../stylelint/types.js';
10
+ import { LoggingService } from '../infrastructure/logging.service.js';
11
+ import { PackageRootService } from './package-root.service.js';
12
+ import { StylelintOptionsService } from './stylelint-options.service.js';
13
+ import { WorkspaceFolderService } from '../workspace/workspace-folder.service.js';
14
+ import { WorkspaceStylelintService } from './workspace-stylelint.service.js';
15
+ /**
16
+ * Runs Stylelint in VS Code.
17
+ */
18
+ export declare class StylelintRunnerService {
19
+ #private;
20
+ constructor(osModule: typeof os, pathModule: typeof path, uriModule: typeof URI, fsModule: Pick<typeof fs, 'glob'>, connection: Connection, loggingService: LoggingService, workspaceService: WorkspaceStylelintService, workspaceFolderService: WorkspaceFolderService, optionsBuilder: StylelintOptionsService, packageRootFinder: PackageRootService);
21
+ /**
22
+ * Lints the given document using Stylelint. The linting result is then
23
+ * converted to LSP diagnostics and returned.
24
+ * @param document
25
+ * @param linterOptions
26
+ * @param extensionOptions
27
+ */
28
+ lintDocument(document: TextDocument, linterOptions?: stylelint.LinterOptions, runnerOptions?: RunnerOptions): Promise<LintDiagnostics>;
29
+ /**
30
+ * Lint all files in a workspace folder.
31
+ * @param workspaceFolder Absolute path to the workspace folder.
32
+ * @param runnerOptions Extension options derived from settings.
33
+ */
34
+ lintWorkspaceFolder(workspaceFolder: string, runnerOptions?: RunnerOptions): Promise<MultiFileLintDiagnostics>;
35
+ resolve(document: TextDocument, runnerOptions?: RunnerOptions): Promise<StylelintResolutionResult | undefined>;
36
+ resolveConfig(document: TextDocument, runnerOptions?: RunnerOptions): Promise<stylelint.Config | undefined>;
37
+ handleDocumentOpened(document: TextDocument): Promise<void>;
38
+ notifyWorkspaceActivity(workspaceFolder: string): void;
39
+ handleWatchedFilesChanged(changes: LSP.FileEvent[]): void;
40
+ disposeWorkspace(workspaceFolder: string): void;
41
+ dispose(): void;
42
+ }