@absolutejs/absolute 0.19.0-beta.783 → 0.19.0-beta.785

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 (252) hide show
  1. package/dist/angular/browser.js +57 -9801
  2. package/dist/angular/browser.js.map +4 -246
  3. package/dist/angular/index.js +61 -14967
  4. package/dist/angular/index.js.map +4 -282
  5. package/dist/angular/server.js +45 -5699
  6. package/dist/angular/server.js.map +3 -52
  7. package/dist/build.js +45 -18021
  8. package/dist/build.js.map +3 -100
  9. package/dist/chunk-102fp7xe.js +63 -0
  10. package/dist/chunk-102fp7xe.js.map +10 -0
  11. package/dist/chunk-11zpfqz6.js +19 -0
  12. package/dist/chunk-11zpfqz6.js.map +10 -0
  13. package/dist/chunk-1e9vsfyh.js +100 -0
  14. package/dist/chunk-1e9vsfyh.js.map +10 -0
  15. package/dist/chunk-25v9t56f.js +29 -0
  16. package/dist/chunk-25v9t56f.js.map +11 -0
  17. package/dist/chunk-2f21eenc.js +21 -0
  18. package/dist/chunk-2f21eenc.js.map +10 -0
  19. package/dist/chunk-2ga2znex.js +13 -0
  20. package/dist/chunk-2ga2znex.js.map +9 -0
  21. package/dist/chunk-30yrw0f6.js +33 -0
  22. package/dist/chunk-30yrw0f6.js.map +10 -0
  23. package/dist/chunk-3c7mpj3m.js +784 -0
  24. package/dist/chunk-3c7mpj3m.js.map +10 -0
  25. package/dist/chunk-3g91wb4f.js +358 -0
  26. package/dist/chunk-3g91wb4f.js.map +10 -0
  27. package/dist/chunk-3yjzpcne.js +34 -0
  28. package/dist/chunk-3yjzpcne.js.map +10 -0
  29. package/dist/chunk-4bq79t8v.js +136 -0
  30. package/dist/chunk-4bq79t8v.js.map +10 -0
  31. package/dist/chunk-4d39r92n.js +81 -0
  32. package/dist/chunk-4d39r92n.js.map +10 -0
  33. package/dist/chunk-4m75s5xf.js +184 -0
  34. package/dist/chunk-4m75s5xf.js.map +11 -0
  35. package/dist/chunk-5003emhv.js +17 -0
  36. package/dist/chunk-5003emhv.js.map +10 -0
  37. package/dist/chunk-5fhp1jap.js +9169 -0
  38. package/dist/chunk-5fhp1jap.js.map +236 -0
  39. package/dist/chunk-6fkgm9s5.js +569 -0
  40. package/dist/chunk-6fkgm9s5.js.map +10 -0
  41. package/dist/chunk-6pdj08z3.js +73 -0
  42. package/dist/chunk-6pdj08z3.js.map +12 -0
  43. package/dist/chunk-6qjbrt0k.js +13 -0
  44. package/dist/chunk-6qjbrt0k.js.map +9 -0
  45. package/dist/chunk-6sccb4jr.js +14 -0
  46. package/dist/chunk-6sccb4jr.js.map +9 -0
  47. package/dist/chunk-73brtyw5.js +16 -0
  48. package/dist/chunk-73brtyw5.js.map +9 -0
  49. package/dist/chunk-77cqkarb.js +25 -0
  50. package/dist/chunk-77cqkarb.js.map +9 -0
  51. package/dist/chunk-798spvzv.js +50 -0
  52. package/dist/chunk-798spvzv.js.map +10 -0
  53. package/dist/chunk-7fw6x3js.js +131 -0
  54. package/dist/chunk-7fw6x3js.js.map +11 -0
  55. package/dist/chunk-7kjj42xm.js +11 -0
  56. package/dist/chunk-7kjj42xm.js.map +10 -0
  57. package/dist/chunk-851whwc7.js +17 -0
  58. package/dist/chunk-851whwc7.js.map +10 -0
  59. package/dist/chunk-85n68sy6.js +103 -0
  60. package/dist/chunk-85n68sy6.js.map +10 -0
  61. package/dist/chunk-8feq2qek.js +17 -0
  62. package/dist/chunk-8feq2qek.js.map +9 -0
  63. package/dist/chunk-8kcfffry.js +35 -0
  64. package/dist/chunk-8kcfffry.js.map +10 -0
  65. package/dist/chunk-93sqk7be.js +139 -0
  66. package/dist/chunk-93sqk7be.js.map +12 -0
  67. package/dist/chunk-97572s32.js +262 -0
  68. package/dist/chunk-97572s32.js.map +12 -0
  69. package/dist/chunk-9a307ca6.js +1742 -0
  70. package/dist/chunk-9a307ca6.js.map +11 -0
  71. package/dist/chunk-9c5tj4k3.js +130 -0
  72. package/dist/chunk-9c5tj4k3.js.map +10 -0
  73. package/dist/chunk-9xrsjeem.js +12 -0
  74. package/dist/chunk-9xrsjeem.js.map +9 -0
  75. package/dist/chunk-a9mvyp04.js +87 -0
  76. package/dist/chunk-a9mvyp04.js.map +10 -0
  77. package/dist/chunk-b3gbnrwe.js +21 -0
  78. package/dist/chunk-b3gbnrwe.js.map +10 -0
  79. package/dist/chunk-bmgqm774.js +65 -0
  80. package/dist/chunk-bmgqm774.js.map +9 -0
  81. package/dist/chunk-bxfghpma.js +69 -0
  82. package/dist/chunk-bxfghpma.js.map +10 -0
  83. package/dist/chunk-c1jfjnka.js +74 -0
  84. package/dist/chunk-c1jfjnka.js.map +10 -0
  85. package/dist/chunk-cbkrwmvh.js +80 -0
  86. package/dist/chunk-cbkrwmvh.js.map +10 -0
  87. package/dist/chunk-cdxd7sy2.js +71 -0
  88. package/dist/chunk-cdxd7sy2.js.map +10 -0
  89. package/dist/chunk-cg95827x.js +21 -0
  90. package/dist/chunk-cg95827x.js.map +10 -0
  91. package/dist/chunk-d9c0am65.js +12 -0
  92. package/dist/chunk-d9c0am65.js.map +10 -0
  93. package/dist/chunk-daqghmg8.js +12 -0
  94. package/dist/chunk-daqghmg8.js.map +9 -0
  95. package/dist/chunk-dr9yqsdb.js +203 -0
  96. package/dist/chunk-dr9yqsdb.js.map +10 -0
  97. package/dist/chunk-e8eecyrq.js +244 -0
  98. package/dist/chunk-e8eecyrq.js.map +10 -0
  99. package/dist/chunk-ex2hxe0v.js +160 -0
  100. package/dist/chunk-ex2hxe0v.js.map +11 -0
  101. package/dist/chunk-ey5hs6x6.js +253 -0
  102. package/dist/chunk-ey5hs6x6.js.map +11 -0
  103. package/dist/chunk-fak944et.js +91 -0
  104. package/dist/chunk-fak944et.js.map +10 -0
  105. package/dist/chunk-fygx2ymm.js +118 -0
  106. package/dist/chunk-fygx2ymm.js.map +12 -0
  107. package/dist/chunk-g15qj669.js +271 -0
  108. package/dist/chunk-g15qj669.js.map +11 -0
  109. package/dist/chunk-g3j22qf6.js +51 -0
  110. package/dist/chunk-g3j22qf6.js.map +9 -0
  111. package/dist/chunk-gd6wmknh.js +121 -0
  112. package/dist/chunk-gd6wmknh.js.map +11 -0
  113. package/dist/chunk-gf0ygptk.js +85 -0
  114. package/dist/chunk-gf0ygptk.js.map +11 -0
  115. package/dist/chunk-gq0zxpm0.js +90 -0
  116. package/dist/chunk-gq0zxpm0.js.map +10 -0
  117. package/dist/chunk-gytkmthr.js +220 -0
  118. package/dist/chunk-gytkmthr.js.map +10 -0
  119. package/dist/chunk-h5bbfn3n.js +28 -0
  120. package/dist/chunk-h5bbfn3n.js.map +11 -0
  121. package/dist/chunk-h6mye9r3.js +93 -0
  122. package/dist/chunk-h6mye9r3.js.map +10 -0
  123. package/dist/chunk-hcsmxw1v.js +85 -0
  124. package/dist/chunk-hcsmxw1v.js.map +10 -0
  125. package/dist/chunk-hep68ja7.js +4444 -0
  126. package/dist/chunk-hep68ja7.js.map +29 -0
  127. package/dist/chunk-hhqh49fz.js +149 -0
  128. package/dist/chunk-hhqh49fz.js.map +10 -0
  129. package/dist/chunk-hyjs4bqs.js +8 -0
  130. package/dist/chunk-hyjs4bqs.js.map +10 -0
  131. package/dist/chunk-hza0n8qm.js +20 -0
  132. package/dist/chunk-hza0n8qm.js.map +9 -0
  133. package/dist/chunk-jn91vzkh.js +66 -0
  134. package/dist/chunk-jn91vzkh.js.map +10 -0
  135. package/dist/chunk-jwxt8gnp.js +13 -0
  136. package/dist/chunk-jwxt8gnp.js.map +9 -0
  137. package/dist/chunk-kk8w9rh5.js +195 -0
  138. package/dist/chunk-kk8w9rh5.js.map +10 -0
  139. package/dist/chunk-kndkjsya.js +261 -0
  140. package/dist/chunk-kndkjsya.js.map +10 -0
  141. package/dist/chunk-kvq01j35.js +36 -0
  142. package/dist/chunk-kvq01j35.js.map +10 -0
  143. package/dist/chunk-mbazhahf.js +60 -0
  144. package/dist/chunk-mbazhahf.js.map +10 -0
  145. package/dist/chunk-mgfwq18r.js +15 -0
  146. package/dist/chunk-mgfwq18r.js.map +9 -0
  147. package/dist/chunk-mtgf69xn.js +88 -0
  148. package/dist/chunk-mtgf69xn.js.map +10 -0
  149. package/dist/chunk-nehhtthw.js +225 -0
  150. package/dist/chunk-nehhtthw.js.map +10 -0
  151. package/dist/chunk-nhzf4az4.js +149 -0
  152. package/dist/chunk-nhzf4az4.js.map +10 -0
  153. package/dist/chunk-p5504p14.js +16 -0
  154. package/dist/chunk-p5504p14.js.map +10 -0
  155. package/dist/chunk-pnscgw95.js +90 -0
  156. package/dist/chunk-pnscgw95.js.map +10 -0
  157. package/dist/chunk-pvpp4pvs.js +17 -0
  158. package/dist/chunk-pvpp4pvs.js.map +10 -0
  159. package/dist/chunk-qh75agse.js +95 -0
  160. package/dist/chunk-qh75agse.js.map +10 -0
  161. package/dist/chunk-qk8kd3hr.js +526 -0
  162. package/dist/chunk-qk8kd3hr.js.map +12 -0
  163. package/dist/chunk-qxq2zcty.js +52 -0
  164. package/dist/chunk-qxq2zcty.js.map +10 -0
  165. package/dist/chunk-r7jmgqnw.js +114 -0
  166. package/dist/chunk-r7jmgqnw.js.map +10 -0
  167. package/dist/chunk-s6defjk2.js +116 -0
  168. package/dist/chunk-s6defjk2.js.map +10 -0
  169. package/dist/chunk-sd39p726.js +619 -0
  170. package/dist/chunk-sd39p726.js.map +10 -0
  171. package/dist/chunk-smgj0epn.js +18 -0
  172. package/dist/chunk-smgj0epn.js.map +9 -0
  173. package/dist/chunk-swrnzs4c.js +63 -0
  174. package/dist/chunk-swrnzs4c.js.map +10 -0
  175. package/dist/chunk-t81a331y.js +27 -0
  176. package/dist/chunk-t81a331y.js.map +10 -0
  177. package/dist/chunk-tfe3sb44.js +33 -0
  178. package/dist/chunk-tfe3sb44.js.map +10 -0
  179. package/dist/chunk-tx9edm1x.js +34 -0
  180. package/dist/chunk-tx9edm1x.js.map +10 -0
  181. package/dist/chunk-vkrpm7kc.js +247 -0
  182. package/dist/chunk-vkrpm7kc.js.map +12 -0
  183. package/dist/chunk-vvz7dcvq.js +434 -0
  184. package/dist/chunk-vvz7dcvq.js.map +13 -0
  185. package/dist/chunk-w3m4m5we.js +4925 -0
  186. package/dist/chunk-w3m4m5we.js.map +12 -0
  187. package/dist/chunk-wrxtn9ve.js +18 -0
  188. package/dist/chunk-wrxtn9ve.js.map +10 -0
  189. package/dist/chunk-xpkjbmd3.js +428 -0
  190. package/dist/chunk-xpkjbmd3.js.map +14 -0
  191. package/dist/chunk-xrmjy8kk.js +454 -0
  192. package/dist/chunk-xrmjy8kk.js.map +10 -0
  193. package/dist/chunk-xw0tx842.js +13 -0
  194. package/dist/chunk-xw0tx842.js.map +9 -0
  195. package/dist/chunk-xx5b6b9m.js +69 -0
  196. package/dist/chunk-xx5b6b9m.js.map +10 -0
  197. package/dist/chunk-xz1kdswj.js +21 -0
  198. package/dist/chunk-xz1kdswj.js.map +9 -0
  199. package/dist/chunk-xzvy9hr4.js +377 -0
  200. package/dist/chunk-xzvy9hr4.js.map +10 -0
  201. package/dist/chunk-yfqhr31t.js +39 -0
  202. package/dist/chunk-yfqhr31t.js.map +9 -0
  203. package/dist/chunk-ygzd5s4z.js +184 -0
  204. package/dist/chunk-ygzd5s4z.js.map +10 -0
  205. package/dist/chunk-ywjn0rad.js +14 -0
  206. package/dist/chunk-ywjn0rad.js.map +9 -0
  207. package/dist/chunk-z9nvhm6r.js +13 -0
  208. package/dist/chunk-z9nvhm6r.js.map +9 -0
  209. package/dist/chunk-zhmvdpk6.js +15 -0
  210. package/dist/chunk-zhmvdpk6.js.map +9 -0
  211. package/dist/client/index.js +32 -1112
  212. package/dist/client/index.js.map +4 -22
  213. package/dist/core/streamingSlotRegistrar.js +11 -108
  214. package/dist/core/streamingSlotRegistrar.js.map +3 -4
  215. package/dist/core/streamingSlotRegistry.js +7 -169
  216. package/dist/core/streamingSlotRegistry.js.map +3 -5
  217. package/dist/index.js +536 -19835
  218. package/dist/index.js.map +3 -117
  219. package/dist/islands/browser.js +9 -228
  220. package/dist/islands/browser.js.map +4 -9
  221. package/dist/islands/index.js +17 -1986
  222. package/dist/islands/index.js.map +3 -28
  223. package/dist/react/browser.js +12 -328
  224. package/dist/react/browser.js.map +4 -12
  225. package/dist/react/components/index.js +16 -167
  226. package/dist/react/components/index.js.map +3 -6
  227. package/dist/react/hooks/index.js +8 -183
  228. package/dist/react/hooks/index.js.map +3 -7
  229. package/dist/react/index.js +36 -3705
  230. package/dist/react/index.js.map +4 -46
  231. package/dist/react/jsxDevRuntimeCompat.js +2 -61
  232. package/dist/react/jsxDevRuntimeCompat.js.map +2 -2
  233. package/dist/react/server.js +18 -1789
  234. package/dist/react/server.js.map +3 -21
  235. package/dist/src/core/index.d.ts +0 -2
  236. package/dist/svelte/browser.js +12 -247
  237. package/dist/svelte/browser.js.map +3 -10
  238. package/dist/svelte/index.js +37 -3810
  239. package/dist/svelte/index.js.map +4 -48
  240. package/dist/svelte/server.js +21 -2787
  241. package/dist/svelte/server.js.map +3 -27
  242. package/dist/vue/browser.js +12 -348
  243. package/dist/vue/browser.js.map +4 -12
  244. package/dist/vue/components/Image.js +7 -240
  245. package/dist/vue/components/Image.js.map +3 -6
  246. package/dist/vue/components/index.js +11 -544
  247. package/dist/vue/components/index.js.map +3 -9
  248. package/dist/vue/index.js +52 -4290
  249. package/dist/vue/index.js.map +4 -51
  250. package/dist/vue/server.js +18 -1849
  251. package/dist/vue/server.js.map +3 -21
  252. package/package.json +1 -1
@@ -0,0 +1,569 @@
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 findStyleEntriesImporting = (changedPath) => {
369
+ const target = resolve(changedPath);
370
+ const importers = [];
371
+ for (const [entry, deps] of styleDependencyGraph) {
372
+ if (deps.has(target))
373
+ importers.push(entry);
374
+ }
375
+ return importers;
376
+ };
377
+ var recordStyleOutput = (entry, css) => {
378
+ const key = resolve(entry);
379
+ const hash = createHash("sha1").update(css).digest("hex");
380
+ const previous = styleOutputHashes.get(key);
381
+ styleOutputHashes.set(key, hash);
382
+ return previous !== hash;
383
+ };
384
+ var forgetStyleEntry = (entry) => {
385
+ const key = resolve(entry);
386
+ styleDependencyGraph.delete(key);
387
+ styleOutputHashes.delete(key);
388
+ };
389
+ var compileStyleSource = async (filePath, source, languageHint, config) => {
390
+ const language = getStyleLanguage(languageHint ?? filePath);
391
+ const rawContents = source ?? await readFile(filePath, "utf-8");
392
+ const deps = new Set;
393
+ if (language === "scss" || language === "sass") {
394
+ const options = getSassOptions(config, language);
395
+ const packageName = options.implementation ?? "sass";
396
+ let sass;
397
+ try {
398
+ sass = await importOptionalPeer(packageName);
399
+ } catch {
400
+ throw missingDependencyError(packageName, filePath);
401
+ }
402
+ const contents = withAdditionalData(rawContents, options.additionalData);
403
+ const loadPaths = normalizeLoadPaths(filePath, options.loadPaths);
404
+ try {
405
+ const result = sass.compileString(contents, {
406
+ importers: [
407
+ createSassImporter(filePath, loadPaths, language, config, deps)
408
+ ],
409
+ loadPaths,
410
+ style: "expanded",
411
+ syntax: language === "sass" ? "indented" : "scss",
412
+ url: new URL(`file://${filePath}`)
413
+ });
414
+ const css = await runPostcss(result.css, filePath, config);
415
+ recordStyleDeps(filePath, deps);
416
+ return css;
417
+ } catch (error) {
418
+ throwPreprocessorError(error, filePath, language);
419
+ }
420
+ }
421
+ if (language === "less") {
422
+ const options = getLessOptions(config);
423
+ let lessModule;
424
+ try {
425
+ lessModule = await importOptionalPeer("less");
426
+ } catch {
427
+ throw missingDependencyError("less", filePath);
428
+ }
429
+ const less = lessModule.render ? lessModule : lessModule.default;
430
+ const render = less?.render;
431
+ if (!render)
432
+ throw missingDependencyError("less", filePath);
433
+ const contents = withAdditionalData(rawContents, options.additionalData);
434
+ const loadPaths = normalizeLoadPaths(filePath, options.paths);
435
+ try {
436
+ const result = await render(contents, {
437
+ ...options.options ?? {},
438
+ filename: filePath,
439
+ paths: loadPaths,
440
+ plugins: [
441
+ ...options.options?.plugins ?? [],
442
+ createLessFileManager(filePath, loadPaths, config, deps)
443
+ ]
444
+ });
445
+ const css = await runPostcss(result.css, filePath, config);
446
+ recordStyleDeps(filePath, deps);
447
+ return css;
448
+ } catch (error) {
449
+ throwPreprocessorError(error, filePath, "less");
450
+ }
451
+ }
452
+ if (language === "stylus") {
453
+ const options = getStylusOptions(config);
454
+ const loadPaths = normalizeLoadPaths(filePath, options.paths);
455
+ const contents = withAdditionalData(preprocessLoadedStyle(rawContents, filePath, filePath, loadPaths, "stylus", config), options.additionalData);
456
+ try {
457
+ const css = await runPostcss(await renderStylus(contents, filePath, loadPaths, options, deps), filePath, config);
458
+ recordStyleDeps(filePath, deps);
459
+ return css;
460
+ } catch (error) {
461
+ throwPreprocessorError(error, filePath, "stylus");
462
+ }
463
+ }
464
+ return runPostcss(rawContents, filePath, config);
465
+ };
466
+ var createStylePreprocessorPlugin = (config) => ({
467
+ name: "absolute-style-preprocessor",
468
+ setup(build) {
469
+ const cssModuleSources = new Map;
470
+ build.onResolve({ filter: /^absolute-style-module:/ }, ({ path }) => ({
471
+ namespace: "absolute-style-module",
472
+ path: path.slice("absolute-style-module:".length)
473
+ }));
474
+ build.onLoad({ filter: /\.module\.css$/i, namespace: "absolute-style-module" }, async ({ path }) => {
475
+ const source = cssModuleSources.get(path);
476
+ if (!source) {
477
+ throw new Error(`Unable to resolve CSS module source for ${path}`);
478
+ }
479
+ return {
480
+ contents: source.css,
481
+ loader: "css"
482
+ };
483
+ });
484
+ build.onLoad({ filter: STYLE_EXTENSION_PATTERN }, async ({ path }) => {
485
+ if (isStyleModulePath(path)) {
486
+ const cssModulePath = path.replace(STYLE_EXTENSION_PATTERN, ".css");
487
+ const compiled = await compileStyleSource(path, undefined, undefined, config);
488
+ const { css, exports } = extractCssModuleExports(compiled);
489
+ cssModuleSources.set(cssModulePath, { css, exports });
490
+ 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}`)};`;
491
+ return {
492
+ contents: exportSource,
493
+ loader: "js"
494
+ };
495
+ }
496
+ return {
497
+ contents: await compileStyleSource(path, undefined, undefined, config),
498
+ loader: "css"
499
+ };
500
+ });
501
+ build.onLoad({ filter: CSS_EXTENSION_PATTERN }, async ({ path }) => ({
502
+ contents: await compileStyleSource(path, undefined, undefined, config),
503
+ loader: "css"
504
+ }));
505
+ }
506
+ });
507
+ var stylePreprocessorPlugin = createStylePreprocessorPlugin();
508
+ var createSvelteStylePreprocessor = (config) => ({
509
+ style: async ({
510
+ attributes,
511
+ content,
512
+ filename
513
+ }) => {
514
+ const language = typeof attributes.lang === "string" ? attributes.lang : typeof attributes.type === "string" ? attributes.type.replace(/^text\//, "") : null;
515
+ if (!language || !STYLE_LANGUAGE_PATTERN.test(language))
516
+ return;
517
+ const path = filename ?? `style.${language}`;
518
+ return {
519
+ code: await compileStyleSource(path, content, language, config)
520
+ };
521
+ }
522
+ });
523
+ var compileStyleFileIfNeeded = async (filePath, config) => {
524
+ if (!isPreprocessableStylePath(filePath)) {
525
+ return runPostcss(await readFile(filePath, "utf-8"), filePath, config);
526
+ }
527
+ return compileStyleSource(filePath, undefined, undefined, config);
528
+ };
529
+ var compileStyleFileIfNeededSync = (filePath, config) => {
530
+ const rawContents = readFileSync(filePath, "utf-8");
531
+ const language = getStyleLanguage(filePath);
532
+ if (config?.postcss) {
533
+ throw new Error(`Unable to compile ${filePath}: PostCSS preprocessing is async-only.`);
534
+ }
535
+ if (language === "scss" || language === "sass") {
536
+ const options = getSassOptions(config, language);
537
+ const packageName = options.implementation ?? "sass";
538
+ let sass;
539
+ try {
540
+ sass = requireOptionalPeerSync(packageName);
541
+ } catch {
542
+ throw missingDependencyError(packageName, filePath);
543
+ }
544
+ const contents = withAdditionalData(rawContents, options.additionalData);
545
+ const loadPaths = normalizeLoadPaths(filePath, options.loadPaths);
546
+ return sass.compileString(contents, {
547
+ importers: [
548
+ createSassImporter(filePath, loadPaths, language, config)
549
+ ],
550
+ loadPaths,
551
+ style: "expanded",
552
+ syntax: language === "sass" ? "indented" : "scss",
553
+ url: new URL(`file://${filePath}`)
554
+ }).css;
555
+ }
556
+ if (language === "less") {
557
+ 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.`);
558
+ }
559
+ if (language === "stylus") {
560
+ 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.`);
561
+ }
562
+ return rawContents;
563
+ };
564
+ var getCssOutputExtension = (filePath) => isPreprocessableStylePath(filePath) ? ".css" : extname(filePath);
565
+
566
+ export { isPreprocessableStylePath, isStyleModulePath, isStylePath, getStyleBaseName, createStyleTransformConfig, findStyleEntriesImporting, recordStyleOutput, forgetStyleEntry, compileStyleSource, createStylePreprocessorPlugin, stylePreprocessorPlugin, createSvelteStylePreprocessor, compileStyleFileIfNeeded, compileStyleFileIfNeededSync, getCssOutputExtension };
567
+
568
+ //# debugId=6A75AC0A3B30DFD664756E2164756E21
569
+ //# sourceMappingURL=chunk-6fkgm9s5.js.map