@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,3 @@
1
+ export * from './workspace-folder.service.js';
2
+ export * from './workspace-options.service.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/server/services/workspace/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { URI } from 'vscode-uri';
2
+ import type { Connection } from 'vscode-languageserver';
3
+ import type { TextDocument } from 'vscode-languageserver-textdocument';
4
+ import { normalizeFsPath } from '../../utils/index.js';
5
+ type PathIsInside = (path: string, potentialParent: string) => boolean;
6
+ export declare class WorkspaceFolderService {
7
+ #private;
8
+ constructor(pathIsInsideFn: PathIsInside, uriModule: typeof URI, normalizeFsPathFn: typeof normalizeFsPath);
9
+ /**
10
+ * Gets the workspace folder for a given document. If the document is an
11
+ * untitled file, then the first open workspace folder is returned.
12
+ * @param connection The language server connection to use to get available
13
+ * workspace folders.
14
+ * @param document The document to get the workspace folder for.
15
+ */
16
+ getWorkspaceFolder(connection: Connection, document: TextDocument): Promise<string | undefined>;
17
+ }
18
+ export {};
@@ -0,0 +1,101 @@
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, UriModuleToken } from '../../tokens.js';
37
+ let WorkspaceFolderService = (() => {
38
+ let _classDecorators = [inject({
39
+ inject: [PathIsInsideToken, UriModuleToken, NormalizeFsPathToken],
40
+ })];
41
+ let _classDescriptor;
42
+ let _classExtraInitializers = [];
43
+ let _classThis;
44
+ var WorkspaceFolderService = class {
45
+ static { _classThis = this; }
46
+ static {
47
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
48
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
49
+ WorkspaceFolderService = _classThis = _classDescriptor.value;
50
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
51
+ __runInitializers(_classThis, _classExtraInitializers);
52
+ }
53
+ #pathIsInside;
54
+ #uri;
55
+ #normalizeFsPath;
56
+ constructor(pathIsInsideFn, uriModule, normalizeFsPathFn) {
57
+ this.#pathIsInside = pathIsInsideFn;
58
+ this.#uri = uriModule;
59
+ this.#normalizeFsPath = normalizeFsPathFn;
60
+ }
61
+ /**
62
+ * Gets the workspace folder for a given document. If the document is an
63
+ * untitled file, then the first open workspace folder is returned.
64
+ * @param connection The language server connection to use to get available
65
+ * workspace folders.
66
+ * @param document The document to get the workspace folder for.
67
+ */
68
+ async getWorkspaceFolder(connection, document) {
69
+ const { scheme, fsPath } = this.#uri.parse(document.uri);
70
+ if (scheme === 'untitled') {
71
+ const uri = (await connection.workspace.getWorkspaceFolders())?.[0]?.uri;
72
+ return uri ? this.#uri.parse(uri).fsPath : undefined;
73
+ }
74
+ if (!fsPath) {
75
+ return undefined;
76
+ }
77
+ const normalizedDocumentPath = this.#normalizeFsPath(fsPath);
78
+ if (!normalizedDocumentPath) {
79
+ return undefined;
80
+ }
81
+ const workspaceFolders = await connection.workspace.getWorkspaceFolders();
82
+ if (!workspaceFolders) {
83
+ return undefined;
84
+ }
85
+ for (const { uri } of workspaceFolders) {
86
+ const workspacePath = this.#uri.parse(uri).fsPath;
87
+ const normalizedWorkspacePath = this.#normalizeFsPath(workspacePath);
88
+ if (!normalizedWorkspacePath) {
89
+ continue;
90
+ }
91
+ if (this.#pathIsInside(normalizedDocumentPath, normalizedWorkspacePath)) {
92
+ return workspacePath;
93
+ }
94
+ }
95
+ return undefined;
96
+ }
97
+ };
98
+ return WorkspaceFolderService = _classThis;
99
+ })();
100
+ export { WorkspaceFolderService };
101
+ //# sourceMappingURL=workspace-folder.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-folder.service.js","sourceRoot":"","sources":["../../../../src/server/services/workspace/workspace-folder.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;IAO7E,sBAAsB;4BAHlC,MAAM,CAAC;YACP,MAAM,EAAE,CAAC,iBAAiB,EAAE,cAAc,EAAE,oBAAoB,CAAC;SACjE,CAAC;;;;;;;;YACF,6KAiEC;;;YAjEY,uDAAsB;;QACzB,aAAa,CAAe;QAC5B,IAAI,CAAa;QACjB,gBAAgB,CAAyB;QAElD,YACC,cAA4B,EAC5B,SAAqB,EACrB,iBAAyC;YAEzC,IAAI,CAAC,aAAa,GAAG,cAAc,CAAC;YACpC,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;YACtB,IAAI,CAAC,gBAAgB,GAAG,iBAAiB,CAAC;QAC3C,CAAC;QAED;;;;;;WAMG;QACH,KAAK,CAAC,kBAAkB,CACvB,UAAsB,EACtB,QAAsB;YAEtB,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;YAEzD,IAAI,MAAM,KAAK,UAAU,EAAE,CAAC;gBAC3B,MAAM,GAAG,GAAG,CAAC,MAAM,UAAU,CAAC,SAAS,CAAC,mBAAmB,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC;gBAEzE,OAAO,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;YACtD,CAAC;YAED,IAAI,CAAC,MAAM,EAAE,CAAC;gBACb,OAAO,SAAS,CAAC;YAClB,CAAC;YAED,MAAM,sBAAsB,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;YAE7D,IAAI,CAAC,sBAAsB,EAAE,CAAC;gBAC7B,OAAO,SAAS,CAAC;YAClB,CAAC;YAED,MAAM,gBAAgB,GAAG,MAAM,UAAU,CAAC,SAAS,CAAC,mBAAmB,EAAE,CAAC;YAE1E,IAAI,CAAC,gBAAgB,EAAE,CAAC;gBACvB,OAAO,SAAS,CAAC;YAClB,CAAC;YAED,KAAK,MAAM,EAAE,GAAG,EAAE,IAAI,gBAAgB,EAAE,CAAC;gBACxC,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC;gBAClD,MAAM,uBAAuB,GAAG,IAAI,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC;gBAErE,IAAI,CAAC,uBAAuB,EAAE,CAAC;oBAC9B,SAAS;gBACV,CAAC;gBAED,IAAI,IAAI,CAAC,aAAa,CAAC,sBAAsB,EAAE,uBAAuB,CAAC,EAAE,CAAC;oBACzE,OAAO,aAAa,CAAC;gBACtB,CAAC;YACF,CAAC;YAED,OAAO,SAAS,CAAC;QAClB,CAAC;;;;SAhEW,sBAAsB"}
@@ -0,0 +1,12 @@
1
+ import type { Connection } from 'vscode-languageserver';
2
+ import type { LanguageServerOptions } from '../../types.js';
3
+ import { type LoggingService } from '../infrastructure/logging.service.js';
4
+ export declare class WorkspaceOptionsService {
5
+ #private;
6
+ constructor(connection: Connection, loggingService: LoggingService);
7
+ setSupportsWorkspaceConfiguration(supported: boolean): void;
8
+ updateGlobalOptions(settings: unknown): void;
9
+ clearCache(): void;
10
+ delete(resource: string): void;
11
+ getOptions(resource: string): Promise<LanguageServerOptions>;
12
+ }
@@ -0,0 +1,125 @@
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 { mergeOptionsWithDefaults } from '../../utils/index.js';
37
+ import { defaultLanguageServerOptions } from '../../config/default-options.js';
38
+ import { lspConnectionToken } from '../../tokens.js';
39
+ import { loggingServiceToken } from '../infrastructure/logging.service.js';
40
+ /**
41
+ * Extracts Stylelint settings from the given configuration object.
42
+ */
43
+ function extractStylelintSettings(settings) {
44
+ if (!settings || typeof settings !== 'object') {
45
+ return undefined;
46
+ }
47
+ if ('stylelint' in settings) {
48
+ return settings.stylelint;
49
+ }
50
+ return settings;
51
+ }
52
+ let WorkspaceOptionsService = (() => {
53
+ let _classDecorators = [inject({
54
+ inject: [lspConnectionToken, loggingServiceToken],
55
+ })];
56
+ let _classDescriptor;
57
+ let _classExtraInitializers = [];
58
+ let _classThis;
59
+ var WorkspaceOptionsService = class {
60
+ static { _classThis = this; }
61
+ static {
62
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
63
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
64
+ WorkspaceOptionsService = _classThis = _classDescriptor.value;
65
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
66
+ __runInitializers(_classThis, _classExtraInitializers);
67
+ }
68
+ #connection;
69
+ #logger;
70
+ #supportsScopedConfiguration = false;
71
+ #globalOptions = mergeOptionsWithDefaults({}, defaultLanguageServerOptions);
72
+ #inFlightRequests = new Map();
73
+ constructor(connection, loggingService) {
74
+ this.#connection = connection;
75
+ this.#logger = loggingService.createLogger(WorkspaceOptionsService);
76
+ }
77
+ setSupportsWorkspaceConfiguration(supported) {
78
+ this.#supportsScopedConfiguration = supported;
79
+ if (!supported) {
80
+ this.clearCache();
81
+ }
82
+ }
83
+ #buildOptions(configuration) {
84
+ const merged = mergeOptionsWithDefaults(extractStylelintSettings(configuration) ?? {}, defaultLanguageServerOptions);
85
+ Object.freeze(merged);
86
+ return merged;
87
+ }
88
+ updateGlobalOptions(settings) {
89
+ this.#globalOptions = this.#buildOptions(settings);
90
+ }
91
+ clearCache() {
92
+ this.#inFlightRequests.clear();
93
+ }
94
+ delete(resource) {
95
+ this.#inFlightRequests.delete(resource);
96
+ }
97
+ async getOptions(resource) {
98
+ if (!this.#supportsScopedConfiguration) {
99
+ return this.#globalOptions;
100
+ }
101
+ let request = this.#inFlightRequests.get(resource);
102
+ if (!request) {
103
+ request = this.#requestScopedOptions(resource);
104
+ this.#inFlightRequests.set(resource, request);
105
+ request
106
+ .catch(() => undefined)
107
+ .finally(() => {
108
+ this.#inFlightRequests.delete(resource);
109
+ });
110
+ }
111
+ return request;
112
+ }
113
+ async #requestScopedOptions(resource) {
114
+ this.#logger?.debug('Requesting workspace options from client', { resource });
115
+ const configuration = (await this.#connection.workspace.getConfiguration({
116
+ scopeUri: resource,
117
+ section: 'stylelint',
118
+ }));
119
+ return this.#buildOptions(configuration);
120
+ }
121
+ };
122
+ return WorkspaceOptionsService = _classThis;
123
+ })();
124
+ export { WorkspaceOptionsService };
125
+ //# sourceMappingURL=workspace-options.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-options.service.js","sourceRoot":"","sources":["../../../../src/server/services/workspace/workspace-options.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,EAAuB,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAEhG;;GAEG;AACH,SAAS,wBAAwB,CAAC,QAAiB;IAClD,IAAI,CAAC,QAAQ,IAAI,OA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disable reports by type, rule, or range.
5
+ */
6
+ export declare class DisableMetadataLookupTable {
7
+ #private;
8
+ /**
9
+ * @param diagnostics The diagnostics to build the lookup table from.
10
+ */
11
+ constructor(diagnostics: LSP.Diagnostic[]);
12
+ /**
13
+ * Finds the reports that match the given type, rule, and range.
14
+ */
15
+ find({ type, rule, range, }: {
16
+ type?: DisableReportRuleNames;
17
+ rule?: string;
18
+ range?: LSP.Range;
19
+ }): Set<LSP.Diagnostic>;
20
+ }
@@ -0,0 +1,68 @@
1
+ import { intersect } from '../utils/index.js';
2
+ import { getDisableDiagnosticRule } from './get-disable-diagnostic-rule.js';
3
+ /**
4
+ * Helps lookup disable reports by type, rule, or range.
5
+ */
6
+ export class DisableMetadataLookupTable {
7
+ /**
8
+ * Reports by type.
9
+ */
10
+ #reportsByType = new Map();
11
+ /**
12
+ * Reports by type.
13
+ */
14
+ #reportsByRule = new Map();
15
+ /**
16
+ * Reports by type.
17
+ */
18
+ #reportsByRange = new Map();
19
+ /**
20
+ * @param diagnostics The diagnostics to build the lookup table from.
21
+ */
22
+ constructor(diagnostics) {
23
+ for (const diagnostic of diagnostics) {
24
+ const rule = getDisableDiagnosticRule(diagnostic);
25
+ if (!rule) {
26
+ continue;
27
+ }
28
+ // If getDisableDiagnosticRule returns a rule, the diagnostic code
29
+ // must be a string.
30
+ const code = diagnostic.code;
31
+ const existingByType = this.#reportsByType.get(code);
32
+ if (existingByType) {
33
+ existingByType.add(diagnostic);
34
+ }
35
+ else {
36
+ this.#reportsByType.set(code, new Set([diagnostic]));
37
+ }
38
+ const existingByRule = this.#reportsByRule.get(rule);
39
+ if (existingByRule) {
40
+ existingByRule.add(diagnostic);
41
+ }
42
+ else {
43
+ this.#reportsByRule.set(rule, new Set([diagnostic]));
44
+ }
45
+ const rangeKey = this.#getRangeKey(diagnostic.range);
46
+ const existingByRange = this.#reportsByRange.get(rangeKey);
47
+ if (existingByRange) {
48
+ existingByRange.add(diagnostic);
49
+ }
50
+ else {
51
+ this.#reportsByRange.set(rangeKey, new Set([diagnostic]));
52
+ }
53
+ }
54
+ }
55
+ #getRangeKey({ start, end }) {
56
+ return `${start.line}:${start.character}:${end.line}:${end.character}`;
57
+ }
58
+ /**
59
+ * Finds the reports that match the given type, rule, and range.
60
+ */
61
+ find({ type, rule, range, }) {
62
+ const reportsByType = type ? this.#reportsByType.get(type) : undefined;
63
+ const reportsByRule = rule ? this.#reportsByRule.get(rule) : undefined;
64
+ const reportsByRange = range ? this.#reportsByRange.get(this.#getRangeKey(range)) : undefined;
65
+ return intersect(intersect(reportsByType, reportsByRule), reportsByRange) ?? new Set();
66
+ }
67
+ }
68
+ //# sourceMappingURL=disable-metadata-lookup-table.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"disable-metadata-lookup-table.js","sourceRoot":"","sources":["../../../src/server/stylelint/disable-metadata-lookup-table.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAG5E;;GAEG;AACH,MAAM,OAAO,0BAA0B;IACtC;;OAEG;IACH,cAAc,GAAG,IAAI,GAAG,EAA+B,CAAC;IAExD;;OAEG;IACH,cAAc,GAAG,IAAI,GAAG,EAA+B,CAAC;IAExD;;OAEG;IACH,eAAe,GAAG,IAAI,GAAG,EAA+B,CAAC;IAEzD;;OAEG;IACH,YAAY,WAA6B;QACxC,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;YACtC,MAAM,IAAI,GAAG,wBAAwB,CAAC,UAAU,CAAC,CAAC;YAElD,IAAI,CAAC,IAAI,EAAE,CAAC;gBACX,SAAS;YACV,CAAC;YAED,kEAAkE;YAClE,oBAAoB;YACpB,MAAM,IAAI,GAAG,UAAU,CAAC,IAAc,CAAC;YAEvC,MAAM,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAErD,IAAI,cAAc,EAAE,CA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AG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACvE,MAAM,aAAa,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACvE,MAAM,cAAc,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAE9F,OAAO,SAAS,CAAC,SAAS,CAAC,aAAa,EAAE,aAAa,CAAC,EAAE,cAAc,CAAC,IAAI,IAAI,GAAG,EAAE,CAAC;IACxF,CAAC;CACD"}
@@ -0,0 +1,12 @@
1
+ import type LSP from 'vscode-languageserver-protocol';
2
+ export type FormattingRules = {
3
+ indentation?: [number | string];
4
+ 'no-missing-end-of-source-newline'?: true | null;
5
+ 'no-eol-whitespace'?: true | null;
6
+ };
7
+ /**
8
+ * Converts the given formatting options to rules.
9
+ * @param options The formatting options.
10
+ * @returns The rules.
11
+ */
12
+ export declare function formattingOptionsToRules({ insertSpaces, tabSize, insertFinalNewline, trimTrailingWhitespace, }: LSP.FormattingOptions): FormattingRules;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Converts the given formatting options to rules.
3
+ * @param options The formatting options.
4
+ * @returns The rules.
5
+ */
6
+ export function formattingOptionsToRules({ insertSpaces, tabSize, insertFinalNewline, trimTrailingWhitespace, }) {
7
+ // NOTE: There is no equivalent rule for trimFinalNewlines, so it is not respected.
8
+ const rules = {
9
+ indentation: [insertSpaces ? tabSize : 'tab'],
10
+ };
11
+ if (insertFinalNewline !== undefined) {
12
+ rules['no-missing-end-of-source-newline'] = insertFinalNewline || null;
13
+ }
14
+ if (trimTrailingWhitespace !== undefined) {
15
+ rules['no-eol-whitespace'] = trimTrailingWhitespace || null;
16
+ }
17
+ return rules;
18
+ }
19
+ //# sourceMappingURL=formatting-options-to-rules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatting-options-to-rules.js","sourceRoot":"","sources":["../../../src/server/stylelint/formatting-options-to-rules.ts"],"names":[],"mappings":"AAQA;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAC,EACxC,YAAY,EACZ,OAAO,EACP,kBAAkB,EAClB,sBAAsB,GACC;IACvB,mFAAmF;IAEnF,MAAM,KAAK,GAAoB;QAC9B,WAAW,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;KAC7C,CAAC;IAEF,IAAI,kBAAkB,KAAK,SAAS,EAAE,CAAC;QACtC,KAAK,CAAC,kCAAkC,CAAC,GAAG,kBAAkB,IAAI,IAAI,CAAC;IACxE,CAAC;IAED,IAAI,sBAAsB,KAAK,SAAS,EAAE,CAAC;QAC1C,KAAK,CAAC,mBAAmB,CAAC,GAAG,sBAAsB,IAAI,IAAI,CAAC;IAC7D,CAAC;IAED,OAAO,KAAK,CAAC;AACd,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type LSP from 'vscode-languageserver-protocol';
2
+ /**
3
+ * Gets the rule name to which a disable diagnostic applies. Returns `undefined`
4
+ * if the diagnostic is not a disable diagnostic.
5
+ * @param diagnostic The diagnostic corresponding to the Stylelint warning.
6
+ */
7
+ export declare function getDisableDiagnosticRule(diagnostic: LSP.Diagnostic): string | undefined;
@@ -0,0 +1,22 @@
1
+ import { DisableReportRuleNames } from './types.js';
2
+ /**
3
+ * Gets the rule name to which a disable diagnostic applies. Returns `undefined`
4
+ * if the diagnostic is not a disable diagnostic.
5
+ * @param diagnostic The diagnostic corresponding to the Stylelint warning.
6
+ */
7
+ export function getDisableDiagnosticRule(diagnostic) {
8
+ // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
9
+ switch (diagnostic.code) {
10
+ case DisableReportRuleNames.Needless:
11
+ return diagnostic.message.match(/^Needless disable for "(.+)"$/)?.[1];
12
+ case DisableReportRuleNames.InvalidScope:
13
+ return diagnostic.message.match(/^Rule "(.+)" isn't enabled$/)?.[1];
14
+ case DisableReportRuleNames.Descriptionless:
15
+ return diagnostic.message.match(/^Disable for "(.+)" is missing a description$/)?.[1];
16
+ case DisableReportRuleNames.Illegal:
17
+ return diagnostic.message.match(/^Rule "(.+)" may not be disabled$/)?.[1];
18
+ default:
19
+ return undefined;
20
+ }
21
+ }
22
+ //# sourceMappingURL=get-disable-diagnostic-rule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-disable-diagnostic-rule.js","sourceRoot":"","sources":["../../../src/server/stylelint/get-disable-diagnostic-rule.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEpD;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAC,UAA0B;IAClE,0EAA0E;IAC1E,QAAQ,UAAU,CAAC,IAAI,EAAE,CAAC;QACzB,KAAK,sBAAsB,CAAC,QAAQ;YACnC,OAAO,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,+BAA+B,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAEvE,KAAK,sBAAsB,CAAC,YAAY;YACvC,OAAO,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,6BAA6B,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAErE,KAAK,sBAAsB,CAAC,eAAe;YAC1C,OAAO,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,+CAA+C,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAEvF,KAAK,sBAAsB,CAAC,OAAO;YAClC,OAAO,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,mCAAmC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAE3E;YACC,OAAO,SAAS,CAAC;IACnB,CAAC;AACF,CAAC"}
@@ -0,0 +1,7 @@
1
+ export * from './disable-metadata-lookup-table.js';
2
+ export * from './formatting-options-to-rules.js';
3
+ export * from './get-disable-diagnostic-rule.js';
4
+ export * from './is-disable-report-rule.js';
5
+ export * from './process-linter-result.js';
6
+ export * from './types.js';
7
+ export * from './warning-to-diagnostic.js';
@@ -0,0 +1,8 @@
1
+ export * from './disable-metadata-lookup-table.js';
2
+ export * from './formatting-options-to-rules.js';
3
+ export * from './get-disable-diagnostic-rule.js';
4
+ export * from './is-disable-report-rule.js';
5
+ export * from './process-linter-result.js';
6
+ export * from './types.js';
7
+ export * from './warning-to-diagnostic.js';
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/server/stylelint/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,YAAY,CAAC;AAC3B,cAAc,4BAA4B,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { DisableReportRuleNames } from './types.js';
2
+ /**
3
+ * Returns whether or not the given rule is a disable report rule.
4
+ * @param rule The rule to check.
5
+ */
6
+ export declare function isDisableReportRule(rule: unknown): rule is DisableReportRuleNames;
@@ -0,0 +1,17 @@
1
+ import { DisableReportRuleNames } from './types.js';
2
+ /**
3
+ * Returns whether or not the given rule is a disable report rule.
4
+ * @param rule The rule to check.
5
+ */
6
+ export function isDisableReportRule(rule) {
7
+ switch (rule) {
8
+ case DisableReportRuleNames.Descriptionless:
9
+ case DisableReportRuleNames.Illegal:
10
+ case DisableReportRuleNames.InvalidScope:
11
+ case DisableReportRuleNames.Needless:
12
+ return true;
13
+ default:
14
+ return false;
15
+ }
16
+ }
17
+ //# sourceMappingURL=is-disable-report-rule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-disable-report-rule.js","sourceRoot":"","sources":["../../../src/server/stylelint/is-disable-report-rule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEpD;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAa;IAChD,QAAQ,IAA8B,EAAE,CAAC;QACxC,KAAK,sBAAsB,CAAC,eAAe,CAAC;QAC5C,KAAK,sBAAsB,CAAC,OAAO,CAAC;QACpC,KAAK,sBAAsB,CAAC,YAAY,CAAC;QACzC,KAAK,sBAAsB,CAAC,QAAQ;YACnC,OAAO,IAAI,CAAC;QAEb;YACC,OAAO,KAAK,CAAC;IACf,CAAC;AACF,CAAC"}
@@ -0,0 +1,23 @@
1
+ import type { PackageRootService } from '../services/stylelint-runtime/package-root.service.js';
2
+ import type { Stylelint } from './index.js';
3
+ export type StylelintModuleType = 'cjs' | 'esm';
4
+ export type LoadStylelintResult = {
5
+ stylelint: Stylelint;
6
+ moduleType: StylelintModuleType;
7
+ };
8
+ type DynamicImportFn = (specifier: string) => Promise<unknown>;
9
+ /**
10
+ * Loads the Stylelint module, supporting both CommonJS and ESM builds.
11
+ * @param specifier Path or specifier that can be resolved by the provided require function.
12
+ * @param requireFn Custom require implementation, defaults to the global require.
13
+ * @param resolvedPath Optional pre-resolved module path used when falling back to ESM imports.
14
+ */
15
+ export declare const loadStylelint: (packageRootFinder: PackageRootService, specifier: string, requireFn: NodeJS.Require, resolvedPath: string) => Promise<LoadStylelintResult>;
16
+ /**
17
+ * Internal hooks used by the unit tests to control the dynamic import helper.
18
+ */
19
+ export declare const __loadStylelintTestApi: {
20
+ setDynamicImport(mock: DynamicImportFn): void;
21
+ resetDynamicImport(): void;
22
+ };
23
+ export {};