@absolutejs/absolute 0.19.0-beta.807 → 0.19.0-beta.809

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 (260) hide show
  1. package/dist/angular/browser.js +9801 -57
  2. package/dist/angular/browser.js.map +246 -4
  3. package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
  4. package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
  5. package/dist/angular/index.js +14877 -60
  6. package/dist/angular/index.js.map +281 -4
  7. package/dist/angular/server.js +5610 -45
  8. package/dist/angular/server.js.map +51 -3
  9. package/dist/build.js +18092 -45
  10. package/dist/build.js.map +99 -3
  11. package/dist/cli/index.js +317 -86
  12. package/dist/client/index.js +1091 -70
  13. package/dist/client/index.js.map +24 -4
  14. package/dist/core/streamingSlotRegistrar.js +108 -11
  15. package/dist/core/streamingSlotRegistrar.js.map +4 -3
  16. package/dist/core/streamingSlotRegistry.js +169 -7
  17. package/dist/core/streamingSlotRegistry.js.map +5 -3
  18. package/dist/index.js +19957 -547
  19. package/dist/index.js.map +116 -3
  20. package/dist/islands/browser.js +228 -9
  21. package/dist/islands/browser.js.map +9 -4
  22. package/dist/islands/index.js +1908 -17
  23. package/dist/islands/index.js.map +27 -3
  24. package/dist/react/browser.js +328 -12
  25. package/dist/react/browser.js.map +12 -4
  26. package/dist/react/components/index.js +167 -16
  27. package/dist/react/components/index.js.map +6 -3
  28. package/dist/react/hooks/index.js +183 -8
  29. package/dist/react/hooks/index.js.map +7 -3
  30. package/dist/react/index.js +3627 -36
  31. package/dist/react/index.js.map +45 -4
  32. package/dist/react/jsxDevRuntimeCompat.js +61 -2
  33. package/dist/react/jsxDevRuntimeCompat.js.map +2 -2
  34. package/dist/react/server.js +1789 -18
  35. package/dist/react/server.js.map +21 -3
  36. package/dist/src/angular/injectorPatch.d.ts +1 -0
  37. package/dist/src/angular/islands.d.ts +1 -0
  38. package/dist/src/client/hydrators/react.d.ts +3 -0
  39. package/dist/src/client/hydrators/svelte.d.ts +2 -0
  40. package/dist/src/client/hydrators/vue.d.ts +2 -0
  41. package/dist/src/index.d.ts +1 -0
  42. package/dist/svelte/browser.js +247 -12
  43. package/dist/svelte/browser.js.map +10 -3
  44. package/dist/svelte/index.js +3732 -37
  45. package/dist/svelte/index.js.map +47 -4
  46. package/dist/svelte/server.js +2794 -21
  47. package/dist/svelte/server.js.map +27 -3
  48. package/dist/vue/browser.js +348 -12
  49. package/dist/vue/browser.js.map +12 -4
  50. package/dist/vue/components/Image.js +240 -7
  51. package/dist/vue/components/Image.js.map +6 -3
  52. package/dist/vue/components/index.js +544 -11
  53. package/dist/vue/components/index.js.map +9 -3
  54. package/dist/vue/index.js +4212 -52
  55. package/dist/vue/index.js.map +50 -4
  56. package/dist/vue/server.js +1849 -18
  57. package/dist/vue/server.js.map +21 -3
  58. package/package.json +1 -1
  59. package/dist/chunk-0867j0r0.js +0 -136
  60. package/dist/chunk-0867j0r0.js.map +0 -10
  61. package/dist/chunk-102fp7xe.js +0 -63
  62. package/dist/chunk-102fp7xe.js.map +0 -10
  63. package/dist/chunk-11zpfqz6.js +0 -19
  64. package/dist/chunk-11zpfqz6.js.map +0 -10
  65. package/dist/chunk-1rfh7hw9.js +0 -319
  66. package/dist/chunk-1rfh7hw9.js.map +0 -11
  67. package/dist/chunk-1x4fxm57.js +0 -51
  68. package/dist/chunk-1x4fxm57.js.map +0 -9
  69. package/dist/chunk-25v9t56f.js +0 -29
  70. package/dist/chunk-25v9t56f.js.map +0 -11
  71. package/dist/chunk-2f21eenc.js +0 -21
  72. package/dist/chunk-2f21eenc.js.map +0 -10
  73. package/dist/chunk-2ga2znex.js +0 -13
  74. package/dist/chunk-2ga2znex.js.map +0 -9
  75. package/dist/chunk-30yrw0f6.js +0 -33
  76. package/dist/chunk-30yrw0f6.js.map +0 -10
  77. package/dist/chunk-3g91wb4f.js +0 -358
  78. package/dist/chunk-3g91wb4f.js.map +0 -10
  79. package/dist/chunk-3rea1gam.js +0 -4403
  80. package/dist/chunk-3rea1gam.js.map +0 -28
  81. package/dist/chunk-3yjzpcne.js +0 -34
  82. package/dist/chunk-3yjzpcne.js.map +0 -10
  83. package/dist/chunk-41bf6aqt.js +0 -17
  84. package/dist/chunk-41bf6aqt.js.map +0 -9
  85. package/dist/chunk-4d39r92n.js +0 -81
  86. package/dist/chunk-4d39r92n.js.map +0 -10
  87. package/dist/chunk-5003emhv.js +0 -17
  88. package/dist/chunk-5003emhv.js.map +0 -10
  89. package/dist/chunk-5f67rsed.js +0 -466
  90. package/dist/chunk-5f67rsed.js.map +0 -10
  91. package/dist/chunk-5fhp1jap.js +0 -9169
  92. package/dist/chunk-5fhp1jap.js.map +0 -236
  93. package/dist/chunk-629x0yh4.js +0 -20
  94. package/dist/chunk-629x0yh4.js.map +0 -9
  95. package/dist/chunk-6pdj08z3.js +0 -73
  96. package/dist/chunk-6pdj08z3.js.map +0 -12
  97. package/dist/chunk-6qjbrt0k.js +0 -13
  98. package/dist/chunk-6qjbrt0k.js.map +0 -9
  99. package/dist/chunk-6sccb4jr.js +0 -14
  100. package/dist/chunk-6sccb4jr.js.map +0 -9
  101. package/dist/chunk-798spvzv.js +0 -50
  102. package/dist/chunk-798spvzv.js.map +0 -10
  103. package/dist/chunk-7fw6x3js.js +0 -131
  104. package/dist/chunk-7fw6x3js.js.map +0 -11
  105. package/dist/chunk-7kjj42xm.js +0 -11
  106. package/dist/chunk-7kjj42xm.js.map +0 -10
  107. package/dist/chunk-7mtstdqn.js +0 -90
  108. package/dist/chunk-7mtstdqn.js.map +0 -10
  109. package/dist/chunk-851whwc7.js +0 -17
  110. package/dist/chunk-851whwc7.js.map +0 -10
  111. package/dist/chunk-85n68sy6.js +0 -103
  112. package/dist/chunk-85n68sy6.js.map +0 -10
  113. package/dist/chunk-8kcfffry.js +0 -35
  114. package/dist/chunk-8kcfffry.js.map +0 -10
  115. package/dist/chunk-92fsjfpp.js +0 -1731
  116. package/dist/chunk-92fsjfpp.js.map +0 -11
  117. package/dist/chunk-93sqk7be.js +0 -139
  118. package/dist/chunk-93sqk7be.js.map +0 -12
  119. package/dist/chunk-9c5tj4k3.js +0 -130
  120. package/dist/chunk-9c5tj4k3.js.map +0 -10
  121. package/dist/chunk-9j59emg3.js +0 -184
  122. package/dist/chunk-9j59emg3.js.map +0 -11
  123. package/dist/chunk-9ve9jq72.js +0 -203
  124. package/dist/chunk-9ve9jq72.js.map +0 -10
  125. package/dist/chunk-9xrsjeem.js +0 -12
  126. package/dist/chunk-9xrsjeem.js.map +0 -9
  127. package/dist/chunk-a9mvyp04.js +0 -87
  128. package/dist/chunk-a9mvyp04.js.map +0 -10
  129. package/dist/chunk-b3gbnrwe.js +0 -21
  130. package/dist/chunk-b3gbnrwe.js.map +0 -10
  131. package/dist/chunk-bgb8k1qs.js +0 -672
  132. package/dist/chunk-bgb8k1qs.js.map +0 -15
  133. package/dist/chunk-bmgqm774.js +0 -65
  134. package/dist/chunk-bmgqm774.js.map +0 -9
  135. package/dist/chunk-bxfghpma.js +0 -69
  136. package/dist/chunk-bxfghpma.js.map +0 -10
  137. package/dist/chunk-c1jfjnka.js +0 -74
  138. package/dist/chunk-c1jfjnka.js.map +0 -10
  139. package/dist/chunk-cbkrwmvh.js +0 -80
  140. package/dist/chunk-cbkrwmvh.js.map +0 -10
  141. package/dist/chunk-cdxd7sy2.js +0 -71
  142. package/dist/chunk-cdxd7sy2.js.map +0 -10
  143. package/dist/chunk-cg95827x.js +0 -21
  144. package/dist/chunk-cg95827x.js.map +0 -10
  145. package/dist/chunk-cm0g4q6w.js +0 -149
  146. package/dist/chunk-cm0g4q6w.js.map +0 -10
  147. package/dist/chunk-d7mwkzry.js +0 -261
  148. package/dist/chunk-d7mwkzry.js.map +0 -10
  149. package/dist/chunk-d9c0am65.js +0 -12
  150. package/dist/chunk-d9c0am65.js.map +0 -10
  151. package/dist/chunk-daqghmg8.js +0 -12
  152. package/dist/chunk-daqghmg8.js.map +0 -9
  153. package/dist/chunk-e3r9fxaa.js +0 -149
  154. package/dist/chunk-e3r9fxaa.js.map +0 -10
  155. package/dist/chunk-e8eecyrq.js +0 -244
  156. package/dist/chunk-e8eecyrq.js.map +0 -10
  157. package/dist/chunk-ex2hxe0v.js +0 -160
  158. package/dist/chunk-ex2hxe0v.js.map +0 -11
  159. package/dist/chunk-fak944et.js +0 -91
  160. package/dist/chunk-fak944et.js.map +0 -10
  161. package/dist/chunk-fygx2ymm.js +0 -118
  162. package/dist/chunk-fygx2ymm.js.map +0 -12
  163. package/dist/chunk-g15qj669.js +0 -271
  164. package/dist/chunk-g15qj669.js.map +0 -11
  165. package/dist/chunk-gd6wmknh.js +0 -121
  166. package/dist/chunk-gd6wmknh.js.map +0 -11
  167. package/dist/chunk-gf0ygptk.js +0 -85
  168. package/dist/chunk-gf0ygptk.js.map +0 -11
  169. package/dist/chunk-gytkmthr.js +0 -220
  170. package/dist/chunk-gytkmthr.js.map +0 -10
  171. package/dist/chunk-h5bbfn3n.js +0 -28
  172. package/dist/chunk-h5bbfn3n.js.map +0 -11
  173. package/dist/chunk-h6mye9r3.js +0 -93
  174. package/dist/chunk-h6mye9r3.js.map +0 -10
  175. package/dist/chunk-hcsmxw1v.js +0 -85
  176. package/dist/chunk-hcsmxw1v.js.map +0 -10
  177. package/dist/chunk-hyjs4bqs.js +0 -8
  178. package/dist/chunk-hyjs4bqs.js.map +0 -10
  179. package/dist/chunk-jn91vzkh.js +0 -66
  180. package/dist/chunk-jn91vzkh.js.map +0 -10
  181. package/dist/chunk-jpkjdgsk.js +0 -167
  182. package/dist/chunk-jpkjdgsk.js.map +0 -11
  183. package/dist/chunk-jwxt8gnp.js +0 -13
  184. package/dist/chunk-jwxt8gnp.js.map +0 -9
  185. package/dist/chunk-kk8w9rh5.js +0 -195
  186. package/dist/chunk-kk8w9rh5.js.map +0 -10
  187. package/dist/chunk-kwgh8rmg.js +0 -426
  188. package/dist/chunk-kwgh8rmg.js.map +0 -14
  189. package/dist/chunk-m97ze5hz.js +0 -46
  190. package/dist/chunk-m97ze5hz.js.map +0 -10
  191. package/dist/chunk-mbazhahf.js +0 -60
  192. package/dist/chunk-mbazhahf.js.map +0 -10
  193. package/dist/chunk-mgfwq18r.js +0 -15
  194. package/dist/chunk-mgfwq18r.js.map +0 -9
  195. package/dist/chunk-mtgf69xn.js +0 -88
  196. package/dist/chunk-mtgf69xn.js.map +0 -10
  197. package/dist/chunk-mtxzyxpg.js +0 -102
  198. package/dist/chunk-mtxzyxpg.js.map +0 -10
  199. package/dist/chunk-nehhtthw.js +0 -225
  200. package/dist/chunk-nehhtthw.js.map +0 -10
  201. package/dist/chunk-p5504p14.js +0 -16
  202. package/dist/chunk-p5504p14.js.map +0 -10
  203. package/dist/chunk-p5zgj77m.js +0 -184
  204. package/dist/chunk-p5zgj77m.js.map +0 -10
  205. package/dist/chunk-pnscgw95.js +0 -90
  206. package/dist/chunk-pnscgw95.js.map +0 -10
  207. package/dist/chunk-pvpp4pvs.js +0 -17
  208. package/dist/chunk-pvpp4pvs.js.map +0 -10
  209. package/dist/chunk-qh75agse.js +0 -95
  210. package/dist/chunk-qh75agse.js.map +0 -10
  211. package/dist/chunk-qxq2zcty.js +0 -52
  212. package/dist/chunk-qxq2zcty.js.map +0 -10
  213. package/dist/chunk-r6e8pytx.js +0 -22
  214. package/dist/chunk-r6e8pytx.js.map +0 -9
  215. package/dist/chunk-r7jmgqnw.js +0 -114
  216. package/dist/chunk-r7jmgqnw.js.map +0 -10
  217. package/dist/chunk-s6defjk2.js +0 -116
  218. package/dist/chunk-s6defjk2.js.map +0 -10
  219. package/dist/chunk-sd39p726.js +0 -619
  220. package/dist/chunk-sd39p726.js.map +0 -10
  221. package/dist/chunk-swrnzs4c.js +0 -63
  222. package/dist/chunk-swrnzs4c.js.map +0 -10
  223. package/dist/chunk-tfe3sb44.js +0 -33
  224. package/dist/chunk-tfe3sb44.js.map +0 -10
  225. package/dist/chunk-tjr0kcev.js +0 -41
  226. package/dist/chunk-tjr0kcev.js.map +0 -9
  227. package/dist/chunk-tx9edm1x.js +0 -34
  228. package/dist/chunk-tx9edm1x.js.map +0 -10
  229. package/dist/chunk-txhm2vb5.js +0 -18
  230. package/dist/chunk-txhm2vb5.js.map +0 -9
  231. package/dist/chunk-v5vmsxmy.js +0 -526
  232. package/dist/chunk-v5vmsxmy.js.map +0 -12
  233. package/dist/chunk-vjhxm8n2.js +0 -29
  234. package/dist/chunk-vjhxm8n2.js.map +0 -9
  235. package/dist/chunk-vkrpm7kc.js +0 -247
  236. package/dist/chunk-vkrpm7kc.js.map +0 -12
  237. package/dist/chunk-w3m4m5we.js +0 -4925
  238. package/dist/chunk-w3m4m5we.js.map +0 -12
  239. package/dist/chunk-wrxtn9ve.js +0 -18
  240. package/dist/chunk-wrxtn9ve.js.map +0 -10
  241. package/dist/chunk-x09cskqd.js +0 -377
  242. package/dist/chunk-x09cskqd.js.map +0 -10
  243. package/dist/chunk-xnt8c6h2.js +0 -576
  244. package/dist/chunk-xnt8c6h2.js.map +0 -10
  245. package/dist/chunk-xw0tx842.js +0 -13
  246. package/dist/chunk-xw0tx842.js.map +0 -9
  247. package/dist/chunk-xx5b6b9m.js +0 -69
  248. package/dist/chunk-xx5b6b9m.js.map +0 -10
  249. package/dist/chunk-xz1kdswj.js +0 -21
  250. package/dist/chunk-xz1kdswj.js.map +0 -9
  251. package/dist/chunk-y84qnsd3.js +0 -32
  252. package/dist/chunk-y84qnsd3.js.map +0 -10
  253. package/dist/chunk-ywjn0rad.js +0 -14
  254. package/dist/chunk-ywjn0rad.js.map +0 -9
  255. package/dist/chunk-z9nvhm6r.js +0 -13
  256. package/dist/chunk-z9nvhm6r.js.map +0 -9
  257. package/dist/chunk-zhmvdpk6.js +0 -15
  258. package/dist/chunk-zhmvdpk6.js.map +0 -9
  259. package/dist/chunk-zrg9d4zw.js +0 -784
  260. package/dist/chunk-zrg9d4zw.js.map +0 -10
@@ -1,576 +0,0 @@
1
- // @bun
2
- // src/build/stylePreprocessor.ts
3
- import { createHash } from "crypto";
4
- import { existsSync, readFileSync } from "fs";
5
- import { readFile } from "fs/promises";
6
- import { createRequire } from "module";
7
- import {
8
- dirname,
9
- extname,
10
- isAbsolute,
11
- join,
12
- relative,
13
- resolve
14
- } from "path";
15
- import { fileURLToPath } from "url";
16
- var CSS_EXTENSION_PATTERN = /\.css$/i;
17
- var STYLE_EXTENSION_PATTERN = /\.(s[ac]ss|less|styl(?:us)?)$/i;
18
- var STYLE_MODULE_EXTENSION_PATTERN = /\.module\.(s[ac]ss|less|styl(?:us)?)$/i;
19
- var STYLE_LANGUAGE_PATTERN = /^(s[ac]ss|less|styl(?:us)?)$/i;
20
- var importOptionalPeer = new Function("specifier", "return import(specifier)");
21
- var requireOptionalPeer = new Function("specifier", "return require(specifier)");
22
- var requireFromCwd = createRequire(join(process.cwd(), "package.json"));
23
- var isPreprocessableStylePath = (filePath) => STYLE_EXTENSION_PATTERN.test(filePath);
24
- var isStyleModulePath = (filePath) => STYLE_MODULE_EXTENSION_PATTERN.test(filePath);
25
- var isStylePath = (filePath) => /\.(css|s[ac]ss|less|styl(?:us)?)$/i.test(filePath);
26
- var getStyleBaseName = (filePath) => filePath.replace(/\.(css|s[ac]ss|less|styl(?:us)?)$/i, "");
27
- var getStyleLanguage = (filePathOrLanguage) => {
28
- const normalized = filePathOrLanguage.toLowerCase();
29
- if (normalized === "scss" || normalized.endsWith(".scss"))
30
- return "scss";
31
- if (normalized === "sass" || normalized.endsWith(".sass"))
32
- return "sass";
33
- if (normalized === "less" || normalized.endsWith(".less"))
34
- return "less";
35
- if (normalized === "styl" || normalized === "stylus" || normalized.endsWith(".styl") || normalized.endsWith(".stylus"))
36
- return "stylus";
37
- return null;
38
- };
39
- var missingDependencyError = (name, filePath) => new Error(`Unable to compile ${filePath}: install optional dependency "${name}" to use this stylesheet preprocessor.`);
40
- var throwPreprocessorError = (error, filePath, language) => {
41
- if (!(error instanceof Error)) {
42
- throw new Error(`${language} compile failed in ${filePath}: ${String(error)}`);
43
- }
44
- const detail = error;
45
- const sassLine = detail.span?.start?.line;
46
- const sassCol = detail.span?.start?.column;
47
- const line = detail.line ?? sassLine;
48
- const column = detail.column ?? sassCol;
49
- const location = typeof line === "number" ? `:${line}${typeof column === "number" ? `:${column}` : ""}` : "";
50
- const message = detail.formatted ?? detail.message;
51
- const wrapped = new Error(`${language} compile failed in ${filePath}${location}
52
- ${message}`);
53
- wrapped.cause = error;
54
- throw wrapped;
55
- };
56
- var requireOptionalPeerSync = (specifier) => {
57
- try {
58
- return requireFromCwd(specifier);
59
- } catch {
60
- return requireOptionalPeer(specifier);
61
- }
62
- };
63
- var normalizeLoadPaths = (filePath, paths = []) => [
64
- dirname(filePath),
65
- process.cwd(),
66
- ...paths.map((path) => resolve(process.cwd(), path))
67
- ];
68
- var tsconfigAliasCache;
69
- var stripJsonComments = (source) => source.replace(/\/\*[\s\S]*?\*\//g, "").replace(/(^|[^:])\/\/.*$/gm, "$1");
70
- var normalizeAliasEntries = (aliases) => Object.entries(aliases ?? {}).map(([pattern, value]) => ({
71
- pattern,
72
- replacements: Array.isArray(value) ? value : [value]
73
- }));
74
- var readTsconfigAliases = () => {
75
- const cwd = process.cwd();
76
- if (tsconfigAliasCache?.cwd === cwd)
77
- return tsconfigAliasCache;
78
- const tsconfigPath = resolve(cwd, "tsconfig.json");
79
- const empty = { aliases: [], baseUrl: cwd, cwd };
80
- if (!existsSync(tsconfigPath)) {
81
- tsconfigAliasCache = empty;
82
- return empty;
83
- }
84
- try {
85
- const parsed = JSON.parse(stripJsonComments(readFileSync(tsconfigPath, "utf-8")));
86
- const compilerOptions = parsed.compilerOptions ?? {};
87
- const baseUrl = resolve(cwd, compilerOptions.baseUrl ?? ".");
88
- tsconfigAliasCache = {
89
- aliases: normalizeAliasEntries(compilerOptions.paths),
90
- baseUrl,
91
- cwd
92
- };
93
- } catch {
94
- tsconfigAliasCache = empty;
95
- }
96
- return tsconfigAliasCache;
97
- };
98
- var getAliasEntries = (config) => {
99
- const tsconfig = readTsconfigAliases();
100
- return {
101
- aliases: [
102
- ...normalizeAliasEntries(config?.aliases),
103
- ...tsconfig.aliases
104
- ],
105
- baseUrl: tsconfig.baseUrl
106
- };
107
- };
108
- var aliasPatternToRegExp = (pattern) => new RegExp(`^${pattern.split("*").map((part) => part.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("(.+)")}$`);
109
- var resolveAliasTargets = (specifier, config) => {
110
- const { aliases, baseUrl } = getAliasEntries(config);
111
- const targets = [];
112
- for (const alias of aliases) {
113
- const match = specifier.match(aliasPatternToRegExp(alias.pattern));
114
- if (!match)
115
- continue;
116
- const wildcard = match[1] ?? "";
117
- for (const replacement of alias.replacements) {
118
- targets.push(resolve(baseUrl, replacement.replace("*", wildcard)));
119
- }
120
- }
121
- return targets;
122
- };
123
- var getLanguageExtensions = (language) => {
124
- if (language === "less")
125
- return [".less", ".css"];
126
- if (language === "stylus")
127
- return [".styl", ".stylus", ".css"];
128
- return [".scss", ".sass", ".css"];
129
- };
130
- var getCandidatePaths = (basePath, language) => {
131
- const ext = extname(basePath);
132
- const paths = ext ? [basePath] : getLanguageExtensions(language).flatMap((extension) => [
133
- `${basePath}${extension}`,
134
- join(basePath, `index${extension}`)
135
- ]);
136
- if (language === "scss" || language === "sass") {
137
- return paths.flatMap((path) => {
138
- const dir = dirname(path);
139
- const base = path.slice(dir.length + 1);
140
- return [path, join(dir, `_${base}`)];
141
- });
142
- }
143
- return paths;
144
- };
145
- var resolveImportPath = (specifier, fromDirectory, loadPaths, language, config) => {
146
- const rawCandidates = [
147
- ...resolveAliasTargets(specifier, config),
148
- isAbsolute(specifier) ? specifier : resolve(fromDirectory, specifier),
149
- ...loadPaths.map((path) => resolve(path, specifier))
150
- ];
151
- for (const candidate of rawCandidates.flatMap((path) => getCandidatePaths(path, language))) {
152
- if (existsSync(candidate))
153
- return candidate;
154
- }
155
- return null;
156
- };
157
- var isExternalCssUrl = (url) => /^(?:[a-z][a-z0-9+.-]*:|\/\/|#|\/)/i.test(url);
158
- var splitCssUrl = (url) => {
159
- const markerIndex = url.search(/[?#]/);
160
- if (markerIndex === -1)
161
- return { marker: "", path: url };
162
- return {
163
- marker: url.slice(markerIndex),
164
- path: url.slice(0, markerIndex)
165
- };
166
- };
167
- var rebaseCssUrls = (contents, sourceFile, entryFile) => {
168
- const sourceDir = dirname(sourceFile);
169
- const entryDir = dirname(entryFile);
170
- if (sourceDir === entryDir)
171
- return contents;
172
- return contents.replace(/url\(\s*(['"]?)([^'")]+)\1\s*\)/gi, (match, quote, rawUrl) => {
173
- const trimmedUrl = rawUrl.trim();
174
- if (!trimmedUrl || isExternalCssUrl(trimmedUrl))
175
- return match;
176
- const { marker, path } = splitCssUrl(trimmedUrl);
177
- const rebased = relative(entryDir, resolve(sourceDir, path)).replace(/\\/g, "/");
178
- const normalized = rebased.startsWith(".") ? rebased : `./${rebased}`;
179
- const nextQuote = quote || '"';
180
- return `url(${nextQuote}${normalized}${marker}${nextQuote})`;
181
- });
182
- };
183
- var rewriteAliasedStyleImports = (contents, sourceFile, loadPaths, language, config) => contents.replace(/(@(?:use|forward|import|require)\s+)(["'])([^"']+)\2/g, (match, prefix, quote, specifier) => {
184
- if (specifier.startsWith(".") || isAbsolute(specifier) || isExternalCssUrl(specifier))
185
- return match;
186
- const resolved = resolveImportPath(specifier, dirname(sourceFile), loadPaths, language, config);
187
- return resolved ? `${prefix}${quote}${resolved}${quote}` : match;
188
- });
189
- var preprocessLoadedStyle = (contents, sourceFile, entryFile, loadPaths = [], language, config) => {
190
- const rebased = rebaseCssUrls(contents, sourceFile, entryFile);
191
- return language ? rewriteAliasedStyleImports(rebased, sourceFile, loadPaths, language, config) : rebased;
192
- };
193
- var extractCssModuleExports = (css) => {
194
- const exports = {};
195
- const nextCss = css.replace(/:export\s*\{([^}]*)\}/g, (_, body) => {
196
- for (const declaration of body.split(";")) {
197
- const separator = declaration.indexOf(":");
198
- if (separator === -1)
199
- continue;
200
- const key = declaration.slice(0, separator).trim();
201
- const value = declaration.slice(separator + 1).trim();
202
- if (key && value)
203
- exports[key] = value;
204
- }
205
- return "";
206
- });
207
- return { css: nextCss, exports };
208
- };
209
- var getSassOptions = (config, language) => ({
210
- ...config?.sass ?? {},
211
- ...language === "scss" ? config?.scss ?? {} : {}
212
- });
213
- var getLessOptions = (config) => config?.less ?? {};
214
- var getStylusOptions = (config) => config?.stylus ?? {};
215
- var createStyleTransformConfig = (stylePreprocessors, postcss) => postcss === undefined ? stylePreprocessors : { ...stylePreprocessors ?? {}, postcss };
216
- var withAdditionalData = (contents, additionalData) => additionalData ? `${additionalData}
217
- ${contents}` : contents;
218
- var normalizePostcssModule = (mod) => {
219
- if (mod && typeof mod === "object" && "default" in mod) {
220
- return mod.default ?? mod;
221
- }
222
- return mod;
223
- };
224
- var loadPostcssConfigFile = async (configPath) => {
225
- const resolved = resolve(process.cwd(), configPath);
226
- const loaded = resolved.endsWith(".cjs") || resolved.endsWith(".cts") ? requireOptionalPeerSync(resolved) : await importOptionalPeer(`${new URL(`file://${resolved}`).href}?t=${Date.now()}`);
227
- const config = normalizePostcssModule(loaded);
228
- const value = typeof config === "function" ? await config({
229
- cwd: process.cwd(),
230
- env: "development"
231
- }) : config;
232
- return normalizePostcssModule(value) ?? {};
233
- };
234
- var normalizePostcssPlugins = (plugins) => {
235
- if (!plugins)
236
- return [];
237
- if (Array.isArray(plugins))
238
- return plugins.filter(Boolean);
239
- const resolved = [];
240
- for (const [specifier, options] of Object.entries(plugins)) {
241
- if (options === false)
242
- continue;
243
- const mod = normalizePostcssModule(requireOptionalPeerSync(specifier));
244
- const plugin = typeof mod === "function" ? mod(options === true ? undefined : options) : mod;
245
- if (plugin)
246
- resolved.push(plugin);
247
- }
248
- return resolved;
249
- };
250
- var resolvePostcssConfig = async (config) => {
251
- const inlineConfig = config?.postcss;
252
- if (!inlineConfig)
253
- return null;
254
- const fileConfig = inlineConfig.config ? await loadPostcssConfigFile(inlineConfig.config) : {};
255
- const plugins = [
256
- ...normalizePostcssPlugins(fileConfig.plugins),
257
- ...normalizePostcssPlugins(inlineConfig.plugins)
258
- ];
259
- if (plugins.length === 0)
260
- return null;
261
- return {
262
- options: {
263
- ...fileConfig.options ?? {},
264
- ...inlineConfig.options ?? {}
265
- },
266
- plugins
267
- };
268
- };
269
- var runPostcss = async (css, filePath, config) => {
270
- const postcssConfig = await resolvePostcssConfig(config);
271
- if (!postcssConfig)
272
- return css;
273
- let postcssModule;
274
- try {
275
- postcssModule = await importOptionalPeer("postcss");
276
- } catch {
277
- throw missingDependencyError("postcss", filePath);
278
- }
279
- const postcss = postcssModule.default ?? postcssModule;
280
- const result = await postcss(postcssConfig.plugins).process(css, {
281
- from: filePath,
282
- map: false,
283
- ...postcssConfig.options
284
- });
285
- return result.css;
286
- };
287
- var createSassImporter = (entryFile, loadPaths, language, config, deps) => ({
288
- canonicalize(specifier, options) {
289
- const fromDirectory = options.containingUrl ? dirname(fileURLToPath(options.containingUrl)) : dirname(entryFile);
290
- const resolved = resolveImportPath(specifier, fromDirectory, loadPaths, language, config);
291
- return resolved ? new URL(`file://${resolved}`) : null;
292
- },
293
- load(canonicalUrl) {
294
- const filePath = fileURLToPath(canonicalUrl);
295
- deps?.add(filePath);
296
- const fileLanguage = getStyleLanguage(filePath);
297
- if (fileLanguage !== "scss" && fileLanguage !== "sass" && fileLanguage !== null)
298
- return null;
299
- return {
300
- contents: preprocessLoadedStyle(readFileSync(filePath, "utf-8"), filePath, entryFile, loadPaths, language, config),
301
- syntax: filePath.endsWith(".sass") ? "indented" : "scss"
302
- };
303
- }
304
- });
305
- var createLessFileManager = (entryFile, loadPaths, config, deps) => ({
306
- install(less, pluginManager) {
307
- const baseManager = new less.FileManager;
308
- const manager = Object.create(baseManager);
309
- manager.supports = (filename, currentDirectory) => Boolean(resolveImportPath(filename, resolve(currentDirectory), loadPaths, "less", config));
310
- manager.loadFile = async (filename, currentDirectory) => {
311
- const resolved = resolveImportPath(filename, resolve(currentDirectory), loadPaths, "less", config);
312
- if (!resolved) {
313
- throw new Error(`Unable to resolve Less import "${filename}"`);
314
- }
315
- deps?.add(resolved);
316
- return {
317
- contents: preprocessLoadedStyle(await readFile(resolved, "utf-8"), resolved, entryFile, loadPaths, "less", config),
318
- filename: resolved
319
- };
320
- };
321
- pluginManager.addFileManager(manager);
322
- }
323
- });
324
- var renderStylus = async (contents, filePath, loadPaths, options, deps) => {
325
- let stylus;
326
- try {
327
- const stylusModule = await importOptionalPeer("stylus");
328
- stylus = stylusModule.default ?? stylusModule;
329
- } catch {
330
- throw missingDependencyError("stylus", filePath);
331
- }
332
- return new Promise((resolveCss, reject) => {
333
- const renderer = stylus(contents);
334
- renderer.set("filename", filePath);
335
- for (const [key, value] of Object.entries(options.options ?? {})) {
336
- renderer.set(key, value);
337
- }
338
- for (const path of loadPaths)
339
- renderer.include(path);
340
- renderer.render((error, css) => {
341
- if (error) {
342
- reject(error);
343
- return;
344
- }
345
- if (deps) {
346
- const stylusDeps = renderer.deps?.();
347
- if (Array.isArray(stylusDeps)) {
348
- for (const dep of stylusDeps)
349
- deps.add(resolve(dep));
350
- }
351
- }
352
- resolveCss(css ?? "");
353
- });
354
- });
355
- };
356
- var styleDependencyGraph = new Map;
357
- var styleOutputHashes = new Map;
358
- var recordStyleDeps = (entry, deps) => {
359
- const key = resolve(entry);
360
- const stripped = new Set;
361
- for (const dep of deps) {
362
- const resolved = resolve(dep);
363
- if (resolved !== key)
364
- stripped.add(resolved);
365
- }
366
- styleDependencyGraph.set(key, stripped);
367
- };
368
- var addStyleImporter = (importerPath, stylePath) => {
369
- const key = resolve(importerPath);
370
- const target = resolve(stylePath);
371
- const deps = styleDependencyGraph.get(key) ?? new Set;
372
- deps.add(target);
373
- styleDependencyGraph.set(key, deps);
374
- };
375
- var findStyleEntriesImporting = (changedPath) => {
376
- const target = resolve(changedPath);
377
- const importers = [];
378
- for (const [entry, deps] of styleDependencyGraph) {
379
- if (deps.has(target))
380
- importers.push(entry);
381
- }
382
- return importers;
383
- };
384
- var recordStyleOutput = (entry, css) => {
385
- const key = resolve(entry);
386
- const hash = createHash("sha1").update(css).digest("hex");
387
- const previous = styleOutputHashes.get(key);
388
- styleOutputHashes.set(key, hash);
389
- return previous !== hash;
390
- };
391
- var forgetStyleEntry = (entry) => {
392
- const key = resolve(entry);
393
- styleDependencyGraph.delete(key);
394
- styleOutputHashes.delete(key);
395
- };
396
- var compileStyleSource = async (filePath, source, languageHint, config) => {
397
- const language = getStyleLanguage(languageHint ?? filePath);
398
- const rawContents = source ?? await readFile(filePath, "utf-8");
399
- const deps = new Set;
400
- if (language === "scss" || language === "sass") {
401
- const options = getSassOptions(config, language);
402
- const packageName = options.implementation ?? "sass";
403
- let sass;
404
- try {
405
- sass = await importOptionalPeer(packageName);
406
- } catch {
407
- throw missingDependencyError(packageName, filePath);
408
- }
409
- const contents = withAdditionalData(rawContents, options.additionalData);
410
- const loadPaths = normalizeLoadPaths(filePath, options.loadPaths);
411
- try {
412
- const result = sass.compileString(contents, {
413
- importers: [
414
- createSassImporter(filePath, loadPaths, language, config, deps)
415
- ],
416
- loadPaths,
417
- style: "expanded",
418
- syntax: language === "sass" ? "indented" : "scss",
419
- url: new URL(`file://${filePath}`)
420
- });
421
- const css = await runPostcss(result.css, filePath, config);
422
- recordStyleDeps(filePath, deps);
423
- return css;
424
- } catch (error) {
425
- throwPreprocessorError(error, filePath, language);
426
- }
427
- }
428
- if (language === "less") {
429
- const options = getLessOptions(config);
430
- let lessModule;
431
- try {
432
- lessModule = await importOptionalPeer("less");
433
- } catch {
434
- throw missingDependencyError("less", filePath);
435
- }
436
- const less = lessModule.render ? lessModule : lessModule.default;
437
- const render = less?.render;
438
- if (!render)
439
- throw missingDependencyError("less", filePath);
440
- const contents = withAdditionalData(rawContents, options.additionalData);
441
- const loadPaths = normalizeLoadPaths(filePath, options.paths);
442
- try {
443
- const result = await render(contents, {
444
- ...options.options ?? {},
445
- filename: filePath,
446
- paths: loadPaths,
447
- plugins: [
448
- ...options.options?.plugins ?? [],
449
- createLessFileManager(filePath, loadPaths, config, deps)
450
- ]
451
- });
452
- const css = await runPostcss(result.css, filePath, config);
453
- recordStyleDeps(filePath, deps);
454
- return css;
455
- } catch (error) {
456
- throwPreprocessorError(error, filePath, "less");
457
- }
458
- }
459
- if (language === "stylus") {
460
- const options = getStylusOptions(config);
461
- const loadPaths = normalizeLoadPaths(filePath, options.paths);
462
- const contents = withAdditionalData(preprocessLoadedStyle(rawContents, filePath, filePath, loadPaths, "stylus", config), options.additionalData);
463
- try {
464
- const css = await runPostcss(await renderStylus(contents, filePath, loadPaths, options, deps), filePath, config);
465
- recordStyleDeps(filePath, deps);
466
- return css;
467
- } catch (error) {
468
- throwPreprocessorError(error, filePath, "stylus");
469
- }
470
- }
471
- return runPostcss(rawContents, filePath, config);
472
- };
473
- var createStylePreprocessorPlugin = (config) => ({
474
- name: "absolute-style-preprocessor",
475
- setup(build) {
476
- const cssModuleSources = new Map;
477
- build.onResolve({ filter: /^absolute-style-module:/ }, ({ path }) => ({
478
- namespace: "absolute-style-module",
479
- path: path.slice("absolute-style-module:".length)
480
- }));
481
- build.onLoad({ filter: /\.module\.css$/i, namespace: "absolute-style-module" }, async ({ path }) => {
482
- const source = cssModuleSources.get(path);
483
- if (!source) {
484
- throw new Error(`Unable to resolve CSS module source for ${path}`);
485
- }
486
- return {
487
- contents: source.css,
488
- loader: "css"
489
- };
490
- });
491
- build.onLoad({ filter: STYLE_EXTENSION_PATTERN }, async ({ path }) => {
492
- if (isStyleModulePath(path)) {
493
- const cssModulePath = path.replace(STYLE_EXTENSION_PATTERN, ".css");
494
- const compiled = await compileStyleSource(path, undefined, undefined, config);
495
- const { css, exports } = extractCssModuleExports(compiled);
496
- cssModuleSources.set(cssModulePath, { css, exports });
497
- const exportSource = Object.keys(exports).length > 0 ? `import styles from ${JSON.stringify(`absolute-style-module:${cssModulePath}`)}; export default Object.assign({}, styles, ${JSON.stringify(exports)});` : `export { default } from ${JSON.stringify(`absolute-style-module:${cssModulePath}`)};`;
498
- return {
499
- contents: exportSource,
500
- loader: "js"
501
- };
502
- }
503
- return {
504
- contents: await compileStyleSource(path, undefined, undefined, config),
505
- loader: "css"
506
- };
507
- });
508
- build.onLoad({ filter: CSS_EXTENSION_PATTERN }, async ({ path }) => ({
509
- contents: await compileStyleSource(path, undefined, undefined, config),
510
- loader: "css"
511
- }));
512
- }
513
- });
514
- var stylePreprocessorPlugin = createStylePreprocessorPlugin();
515
- var createSvelteStylePreprocessor = (config) => ({
516
- style: async ({
517
- attributes,
518
- content,
519
- filename
520
- }) => {
521
- const language = typeof attributes.lang === "string" ? attributes.lang : typeof attributes.type === "string" ? attributes.type.replace(/^text\//, "") : null;
522
- if (!language || !STYLE_LANGUAGE_PATTERN.test(language))
523
- return;
524
- const path = filename ?? `style.${language}`;
525
- return {
526
- code: await compileStyleSource(path, content, language, config)
527
- };
528
- }
529
- });
530
- var compileStyleFileIfNeeded = async (filePath, config) => {
531
- if (!isPreprocessableStylePath(filePath)) {
532
- return runPostcss(await readFile(filePath, "utf-8"), filePath, config);
533
- }
534
- return compileStyleSource(filePath, undefined, undefined, config);
535
- };
536
- var compileStyleFileIfNeededSync = (filePath, config) => {
537
- const rawContents = readFileSync(filePath, "utf-8");
538
- const language = getStyleLanguage(filePath);
539
- if (config?.postcss) {
540
- throw new Error(`Unable to compile ${filePath}: PostCSS preprocessing is async-only.`);
541
- }
542
- if (language === "scss" || language === "sass") {
543
- const options = getSassOptions(config, language);
544
- const packageName = options.implementation ?? "sass";
545
- let sass;
546
- try {
547
- sass = requireOptionalPeerSync(packageName);
548
- } catch {
549
- throw missingDependencyError(packageName, filePath);
550
- }
551
- const contents = withAdditionalData(rawContents, options.additionalData);
552
- const loadPaths = normalizeLoadPaths(filePath, options.loadPaths);
553
- return sass.compileString(contents, {
554
- importers: [
555
- createSassImporter(filePath, loadPaths, language, config)
556
- ],
557
- loadPaths,
558
- style: "expanded",
559
- syntax: language === "sass" ? "indented" : "scss",
560
- url: new URL(`file://${filePath}`)
561
- }).css;
562
- }
563
- if (language === "less") {
564
- throw new Error(`Unable to compile ${filePath}: Less styleUrl preprocessing is async-only. Import the Less file from a bundled entrypoint or use SCSS/CSS for Angular styleUrl.`);
565
- }
566
- if (language === "stylus") {
567
- throw new Error(`Unable to compile ${filePath}: Stylus styleUrl preprocessing is async-only. Import the Stylus file from a bundled entrypoint or use SCSS/CSS for Angular styleUrl.`);
568
- }
569
- return rawContents;
570
- };
571
- var getCssOutputExtension = (filePath) => isPreprocessableStylePath(filePath) ? ".css" : extname(filePath);
572
-
573
- export { isPreprocessableStylePath, isStyleModulePath, isStylePath, getStyleBaseName, createStyleTransformConfig, addStyleImporter, findStyleEntriesImporting, recordStyleOutput, forgetStyleEntry, compileStyleSource, createStylePreprocessorPlugin, stylePreprocessorPlugin, createSvelteStylePreprocessor, compileStyleFileIfNeeded, compileStyleFileIfNeededSync, getCssOutputExtension };
574
-
575
- //# debugId=634C187AA2D5975464756E2164756E21
576
- //# sourceMappingURL=chunk-xnt8c6h2.js.map