weapp-tailwindcss 5.0.0-next.9 → 5.0.1

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 (167) hide show
  1. package/README.md +2 -2
  2. package/dist/auto-DEHRmEAx.mjs +200 -0
  3. package/dist/auto-dPpsm6FB.js +238 -0
  4. package/dist/bundle-state-CBF5YX1m.js +529 -0
  5. package/dist/bundle-state-CQmxxx0R.mjs +413 -0
  6. package/dist/bundlers/shared/cache.d.ts +9 -7
  7. package/dist/bundlers/shared/css-cleanup/at-rules.d.ts +1 -2
  8. package/dist/bundlers/shared/css-cleanup.d.ts +1 -3
  9. package/dist/bundlers/shared/css-imports.d.ts +3 -3
  10. package/dist/bundlers/shared/generated-css-marker.d.ts +3 -0
  11. package/dist/bundlers/shared/generator-css/directives.d.ts +11 -3
  12. package/dist/bundlers/shared/generator-css/markers.d.ts +12 -0
  13. package/dist/bundlers/shared/generator-css/source-files.d.ts +9 -6
  14. package/dist/bundlers/shared/generator-css/source-resolver.d.ts +16 -2
  15. package/dist/bundlers/shared/generator-css/user-layer-order.d.ts +10 -0
  16. package/dist/bundlers/shared/generator-css.d.ts +6 -2
  17. package/dist/bundlers/shared/hmr-timing.d.ts +22 -0
  18. package/dist/bundlers/shared/style-requests.d.ts +2 -0
  19. package/dist/bundlers/vite/bundle-state.d.ts +1 -0
  20. package/dist/bundlers/vite/css-finalizer.d.ts +6 -0
  21. package/dist/bundlers/vite/generate-bundle/candidates.d.ts +1 -1
  22. package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +5 -1
  23. package/dist/bundlers/vite/generate-bundle/css-share-scope.d.ts +1 -0
  24. package/dist/bundlers/vite/generate-bundle.d.ts +13 -1
  25. package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +10 -2
  26. package/dist/bundlers/vite/index.d.ts +5 -2
  27. package/dist/bundlers/vite/processed-css-assets.d.ts +32 -0
  28. package/dist/bundlers/vite/rewrite-css-imports.d.ts +8 -5
  29. package/dist/bundlers/vite/runtime-class-set.d.ts +5 -1
  30. package/dist/bundlers/vite/serve-css-generation.d.ts +11 -0
  31. package/dist/bundlers/vite/source-candidates.d.ts +24 -2
  32. package/dist/bundlers/vite/source-scan.d.ts +26 -0
  33. package/dist/bundlers/vite/static-config-content.d.ts +5 -0
  34. package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +5 -0
  35. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +5 -1
  36. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +8 -3
  37. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +1 -1
  38. package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +31 -0
  39. package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +2 -8
  40. package/dist/bundlers/webpack/loaders/weapp-tw-runtime-classset-loader.d.ts +3 -7
  41. package/dist/cache/index.d.ts +6 -6
  42. package/dist/{chunk-8l464Juk.js → chunk-C5U5_Hdc.js} +14 -0
  43. package/dist/cli/context.d.ts +1 -11
  44. package/dist/cli/doctor/types.d.ts +11 -11
  45. package/dist/cli/vscode-entry.d.ts +3 -3
  46. package/dist/cli.js +684 -41
  47. package/dist/cli.mjs +682 -40
  48. package/dist/context/runtime-package-replacements.d.ts +2 -0
  49. package/dist/context/style-options.d.ts +3 -0
  50. package/dist/context/tailwindcss.d.ts +1 -1
  51. package/dist/core.js +1 -2
  52. package/dist/core.mjs +1 -1
  53. package/dist/css-macro/auto.d.ts +11 -0
  54. package/dist/css-macro/constants.d.ts +5 -2
  55. package/dist/css-macro/postcss.d.ts +1 -0
  56. package/dist/css-macro/postcss.js +7 -46
  57. package/dist/css-macro/postcss.mjs +2 -46
  58. package/dist/css-macro.js +16 -7
  59. package/dist/css-macro.mjs +15 -6
  60. package/dist/defaults-8xrgzxFY.mjs +151 -0
  61. package/dist/defaults-zKUH2mDe.js +193 -0
  62. package/dist/defaults.js +6 -150
  63. package/dist/defaults.mjs +1 -143
  64. package/dist/escape.js +10 -2
  65. package/dist/escape.mjs +10 -2
  66. package/dist/generator/options.d.ts +11 -6
  67. package/dist/generator/types.d.ts +3 -3
  68. package/dist/generator-CvmsIQFI.js +92 -0
  69. package/dist/generator-DDtsUvkH.mjs +67 -0
  70. package/dist/generator.js +12 -12
  71. package/dist/generator.mjs +2 -1
  72. package/dist/gulp.js +163 -40
  73. package/dist/gulp.mjs +155 -32
  74. package/dist/incremental-runtime-class-set-BffodqHh.js +2366 -0
  75. package/dist/incremental-runtime-class-set-DArodvWs.mjs +2291 -0
  76. package/dist/index.d.ts +2 -1
  77. package/dist/index.js +17 -5
  78. package/dist/index.mjs +6 -5
  79. package/dist/js/babel/cache-options.d.ts +3 -0
  80. package/dist/js/babel/parse.d.ts +7 -4
  81. package/dist/js/precheck.d.ts +2 -2
  82. package/dist/js/replacement-cache.d.ts +5 -0
  83. package/dist/{postcss-w48mGIhe.mjs → postcss-BzNYQUOH.mjs} +54 -114
  84. package/dist/postcss-C7BMYpEF.mjs +169 -0
  85. package/dist/postcss-CiYLsqZn.js +192 -0
  86. package/dist/{postcss-QIXwT40c.js → postcss-DE0TOtV9.js} +60 -121
  87. package/dist/postcss-html-transform.js +1 -1
  88. package/dist/postcss.js +1 -1
  89. package/dist/postcss.mjs +1 -1
  90. package/dist/precheck-BzYPm-EG.js +4842 -0
  91. package/dist/precheck-jZvTVXXG.mjs +4716 -0
  92. package/dist/presets/index.d.ts +1 -0
  93. package/dist/presets/uni-app-x.d.ts +1 -0
  94. package/dist/presets.js +27 -13
  95. package/dist/presets.mjs +25 -13
  96. package/dist/reset.js +1 -1
  97. package/dist/runtime-registry-DpcR3IHI.js +5496 -0
  98. package/dist/shared/mpx.d.ts +1 -0
  99. package/dist/source-candidates-BuTlMabx.mjs +322 -0
  100. package/dist/source-candidates-CxoIaS88.js +335 -0
  101. package/dist/tailwindcss/miniprogram.d.ts +1 -5
  102. package/dist/tailwindcss/remove-unsupported-css.d.ts +1 -2
  103. package/dist/tailwindcss/runtime/cache.d.ts +4 -3
  104. package/dist/tailwindcss/runtime.d.ts +9 -9
  105. package/dist/tailwindcss/source-scan.d.ts +35 -0
  106. package/dist/tailwindcss/v3-engine/types.d.ts +19 -14
  107. package/dist/tailwindcss/v4/css-entries.d.ts +2 -2
  108. package/dist/tailwindcss/v4/patcher.d.ts +1 -1
  109. package/dist/tailwindcss/v4-engine/source.d.ts +2 -2
  110. package/dist/tailwindcss/v4-engine/types.d.ts +18 -5
  111. package/dist/{tailwindcss-C5IgPlQ0.mjs → tailwindcss-CCZcu0lr.mjs} +75 -98
  112. package/dist/{tailwindcss-Bu-RWIHx.js → tailwindcss-DZckITp1.js} +83 -106
  113. package/dist/typedoc.export.d.ts +1 -1
  114. package/dist/types/index.d.ts +51 -41
  115. package/dist/types/shared.d.ts +3 -0
  116. package/dist/types/typedoc-tailwindcss-patch.d.ts +67 -0
  117. package/dist/types/user-defined-options/general.d.ts +25 -22
  118. package/dist/types/user-defined-options/important.d.ts +32 -27
  119. package/dist/types/user-defined-options/lifecycle.d.ts +4 -4
  120. package/dist/types/user-defined-options/matcher.d.ts +6 -6
  121. package/dist/unocss/index.d.ts +2 -0
  122. package/dist/utils/object.d.ts +9 -0
  123. package/dist/utils/options.d.ts +2 -0
  124. package/dist/utils/regex.d.ts +1 -0
  125. package/dist/{utils-BiShvil9.js → utils-D7Ygohep.js} +2 -2
  126. package/dist/{utils-Btw1iOVV.mjs → utils-DsaS975I.mjs} +1 -1
  127. package/dist/v3-engine-DGBhUnjn.mjs +3419 -0
  128. package/dist/v3-engine-M6Aqru5T.js +3714 -0
  129. package/dist/vite-BBcQIJpD.mjs +24493 -0
  130. package/dist/vite-DgRkWVPG.js +24507 -0
  131. package/dist/vite.js +1 -1
  132. package/dist/vite.mjs +1 -1
  133. package/dist/weapp-tw-css-import-rewrite-loader.js +5456 -22
  134. package/dist/weapp-tw-runtime-classset-loader.js +32 -9
  135. package/dist/{webpack-BzN2ly34.js → webpack-D-gb4ZvO.js} +341 -96
  136. package/dist/{webpack-DJazm5sT.mjs → webpack-D43aMQzO.mjs} +323 -79
  137. package/dist/webpack.d.ts +1 -3
  138. package/dist/webpack.js +3 -4
  139. package/dist/webpack.mjs +2 -2
  140. package/dist/wxml/utils/codegen/legacy-visitor.d.ts +2 -4
  141. package/package.json +22 -20
  142. package/dist/bundlers/shared/css-cleanup/color-gamut.d.ts +0 -3
  143. package/dist/bundlers/shared/css-cleanup/root-cleanups.d.ts +0 -4
  144. package/dist/bundlers/shared/css-cleanup/selectors.d.ts +0 -8
  145. package/dist/cache-BVAiJV3J.js +0 -502
  146. package/dist/cache-CHs4DXui.mjs +0 -434
  147. package/dist/constants-BoB_6lFw.js +0 -73
  148. package/dist/constants-E_loJC49.mjs +0 -44
  149. package/dist/generator-DKkhJbOg.js +0 -1531
  150. package/dist/generator-UBmfduYg.mjs +0 -1432
  151. package/dist/generator-css-Bwp3nbrl.js +0 -1381
  152. package/dist/generator-css-DeLLmp2N.mjs +0 -1342
  153. package/dist/lightningcss/index.d.ts +0 -8
  154. package/dist/lightningcss/style-handler/options.d.ts +0 -3
  155. package/dist/lightningcss/style-handler/selector-transform.d.ts +0 -10
  156. package/dist/lightningcss/style-handler/selector-utils.d.ts +0 -10
  157. package/dist/lightningcss/style-handler.d.ts +0 -17
  158. package/dist/precheck-B32p-gLI.js +0 -2736
  159. package/dist/precheck-B4RH6ZNN.mjs +0 -2622
  160. package/dist/run-tasks-B50A3pxt.js +0 -128
  161. package/dist/run-tasks-DdNi-hkk.mjs +0 -91
  162. package/dist/runtime-patch-CwN5ya72.mjs +0 -71
  163. package/dist/runtime-patch-D6mBo_KB.js +0 -85
  164. package/dist/vite-By5KQi9s.js +0 -2419
  165. package/dist/vite-Cyp42bBf.mjs +0 -2406
  166. /package/dist/{logger-Bub1jggA.mjs → logger-BNzxZbZj.mjs} +0 -0
  167. /package/dist/{logger-BRy6XPQ2.js → logger-TlKT3xmR.js} +0 -0
@@ -0,0 +1,529 @@
1
+ const require_chunk = require("./chunk-C5U5_Hdc.js");
2
+ const require_precheck = require("./precheck-BzYPm-EG.js");
3
+ let node_module = require("node:module");
4
+ let node_process = require("node:process");
5
+ node_process = require_chunk.__toESM(node_process);
6
+ let node_path = require("node:path");
7
+ node_path = require_chunk.__toESM(node_path);
8
+ let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
9
+ let node_buffer = require("node:buffer");
10
+ //#region src/bundlers/shared/module-graph.ts
11
+ const QUERY_HASH_RE = /[?#].*$/u;
12
+ const PROTOCOL_RE = /^[a-z][a-z+.-]*:/iu;
13
+ const WINDOWS_ABSOLUTE_RE = /^[a-z]:[\\/]/iu;
14
+ const VIRTUAL_PREFIX = "\0";
15
+ const JS_EXTENSIONS = [
16
+ ".js",
17
+ ".mjs",
18
+ ".cjs"
19
+ ];
20
+ function normalizeOutputPathKey(value) {
21
+ return node_path.default.normalize(value).replace(/\\/g, "/");
22
+ }
23
+ function stripQueryAndHash(specifier) {
24
+ return specifier.replace(QUERY_HASH_RE, "");
25
+ }
26
+ function isResolvableSpecifier(specifier) {
27
+ if (!specifier) return false;
28
+ const normalized = stripQueryAndHash(specifier);
29
+ if (normalized.startsWith(VIRTUAL_PREFIX)) return false;
30
+ if (node_path.default.isAbsolute(normalized) || WINDOWS_ABSOLUTE_RE.test(normalized)) return true;
31
+ return !PROTOCOL_RE.test(normalized);
32
+ }
33
+ function toAbsoluteOutputPath(fileName, outDir) {
34
+ if (node_path.default.isAbsolute(fileName) || WINDOWS_ABSOLUTE_RE.test(fileName)) return node_path.default.normalize(fileName);
35
+ return node_path.default.resolve(outDir, fileName);
36
+ }
37
+ function matchWithExtensions(candidate, hasOutput) {
38
+ if (hasOutput(candidate)) return candidate;
39
+ if (!node_path.default.extname(candidate)) for (const ext of JS_EXTENSIONS) {
40
+ const extended = `${candidate}${ext}`;
41
+ if (hasOutput(extended)) return extended;
42
+ }
43
+ }
44
+ function resolveOutputSpecifier(specifier, importer, outDir, hasOutput) {
45
+ if (!isResolvableSpecifier(specifier)) return;
46
+ const normalized = stripQueryAndHash(specifier);
47
+ let candidate;
48
+ if (node_path.default.isAbsolute(normalized) || WINDOWS_ABSOLUTE_RE.test(normalized)) candidate = node_path.default.normalize(normalized);
49
+ else if (normalized.startsWith("/")) candidate = node_path.default.resolve(outDir, normalized.slice(1));
50
+ else candidate = node_path.default.resolve(node_path.default.dirname(importer), normalized);
51
+ return matchWithExtensions(candidate, hasOutput);
52
+ }
53
+ //#endregion
54
+ //#region src/bundlers/shared/style-requests.ts
55
+ const SOURCE_STYLE_EXT_RE = /\.(?:css|scss|sass|less|styl|stylus|pcss|postcss)$/i;
56
+ const STYLE_QUERY_RE = /(?:^|&)type=styles?(?:&|$)/;
57
+ const STYLE_LANG_QUERY_RE = /(?:^|&)lang(?:[.=](?:css|scss|sass|less|styl|stylus|pcss|postcss))?(?:&|$)/;
58
+ function stripHash(request) {
59
+ const hashIndex = request.indexOf("#");
60
+ return hashIndex === -1 ? request : request.slice(0, hashIndex);
61
+ }
62
+ function stripRequestQuery(request) {
63
+ const normalized = stripHash(request);
64
+ const queryIndex = normalized.indexOf("?");
65
+ return queryIndex === -1 ? normalized : normalized.slice(0, queryIndex);
66
+ }
67
+ function isSourceStyleRequest(request) {
68
+ if (typeof request !== "string" || request.length === 0) return false;
69
+ const normalized = stripHash(request);
70
+ const queryIndex = normalized.indexOf("?");
71
+ const pathname = queryIndex === -1 ? normalized : normalized.slice(0, queryIndex);
72
+ if (SOURCE_STYLE_EXT_RE.test(pathname)) return true;
73
+ if (queryIndex === -1) return false;
74
+ const query = normalized.slice(queryIndex + 1);
75
+ return STYLE_QUERY_RE.test(query) || STYLE_LANG_QUERY_RE.test(query);
76
+ }
77
+ //#endregion
78
+ //#region src/bundlers/vite/utils.ts
79
+ function slash(p) {
80
+ return (0, _weapp_tailwindcss_shared.ensurePosix)(p);
81
+ }
82
+ const isWindows = node_process.default.platform === "win32";
83
+ const cssLangRE = new RegExp(`\\.(css|less|sass|scss|styl|stylus|pcss|postcss)($|\\?)`);
84
+ function isCSSRequest(request) {
85
+ return cssLangRE.test(request) || isSourceStyleRequest(request);
86
+ }
87
+ function normalizePath(id) {
88
+ return node_path.default.posix.normalize(isWindows ? (0, _weapp_tailwindcss_shared.ensurePosix)(id) : id);
89
+ }
90
+ async function formatPostcssSourceMap(rawMap, file) {
91
+ const inputFileDir = node_path.default.dirname(file);
92
+ const sources = rawMap.sources.map((source) => {
93
+ const cleanSource = (0, _weapp_tailwindcss_shared.cleanUrl)(decodeURIComponent(source));
94
+ if (cleanSource[0] === "<" && cleanSource.endsWith(">")) return `\0${cleanSource}`;
95
+ return normalizePath(node_path.default.resolve(inputFileDir, cleanSource));
96
+ });
97
+ return {
98
+ file,
99
+ mappings: rawMap.mappings,
100
+ names: rawMap.names,
101
+ sources,
102
+ sourcesContent: rawMap.sourcesContent,
103
+ version: rawMap.version
104
+ };
105
+ }
106
+ //#endregion
107
+ //#region src/utils/disabled.ts
108
+ function resolvePluginDisabledState(disabled) {
109
+ if (disabled === true) return { plugin: true };
110
+ if (disabled === false || disabled == null) return { plugin: false };
111
+ return { plugin: disabled.plugin ?? false };
112
+ }
113
+ //#endregion
114
+ //#region src/utils/resolve-package.ts
115
+ const require$1 = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
116
+ function resolvePackageDir(name) {
117
+ const pkgPath = require$1.resolve(`${name}/package.json`);
118
+ return node_path.default.dirname(pkgPath);
119
+ }
120
+ //#endregion
121
+ //#region src/bundlers/shared/generated-css-marker.ts
122
+ const BUNDLER_GENERATED_CSS_MARKER_RE = /\/\*!\s*weapp-tailwindcss (?:vite|webpack)-generated-css(?::[^\s*]+)?\s*\*\/\s*/i;
123
+ const BUNDLER_GENERATED_CSS_MARKER_GLOBAL_RE = /\/\*!\s*weapp-tailwindcss (?:vite|webpack)-generated-css(?::[^\s*]+)?\s*\*\/\s*/gi;
124
+ function createBundlerGeneratedCssMarker(bundler, file) {
125
+ return `/*! weapp-tailwindcss ${bundler}-generated-css:${encodeURIComponent(file)} */`;
126
+ }
127
+ function hasBundlerGeneratedCssMarker(source) {
128
+ return typeof source === "string" && BUNDLER_GENERATED_CSS_MARKER_RE.test(source);
129
+ }
130
+ function stripBundlerGeneratedCssMarkers(source) {
131
+ return source.replace(BUNDLER_GENERATED_CSS_MARKER_GLOBAL_RE, "");
132
+ }
133
+ //#endregion
134
+ //#region src/bundlers/shared/run-tasks.ts
135
+ async function runWithConcurrency(factories, limit = Math.min(4, Math.max(1, factories.length))) {
136
+ if (factories.length === 0) return [];
137
+ const results = Array.from({ length: factories.length });
138
+ const executing = /* @__PURE__ */ new Set();
139
+ let cursor = 0;
140
+ const effectiveLimit = Math.max(1, limit);
141
+ const scheduleNext = () => {
142
+ if (cursor >= factories.length) return;
143
+ const currentIndex = cursor++;
144
+ const factory = factories[currentIndex];
145
+ if (!factory) return;
146
+ const wrapped = Promise.resolve(factory()).then((value) => {
147
+ results[currentIndex] = value;
148
+ }).finally(() => {
149
+ executing.delete(wrapped);
150
+ });
151
+ executing.add(wrapped);
152
+ };
153
+ while (cursor < factories.length && executing.size < effectiveLimit) scheduleNext();
154
+ while (cursor < factories.length) {
155
+ await Promise.race(executing);
156
+ scheduleNext();
157
+ }
158
+ await Promise.all(executing);
159
+ return results;
160
+ }
161
+ function pushConcurrentTaskFactories(queue, factories, limit) {
162
+ if (factories.length === 0) return;
163
+ queue.push(runWithConcurrency(factories, limit).then(() => void 0));
164
+ }
165
+ //#endregion
166
+ //#region src/bundlers/vite/bundle-entries.ts
167
+ function readOutputEntry(entry) {
168
+ if (entry.output.type === "chunk") return entry.output.code;
169
+ const source = entry.output.source;
170
+ if (typeof source === "string") return source;
171
+ if (source instanceof Uint8Array) return node_buffer.Buffer.from(source).toString();
172
+ const fallbackSource = source;
173
+ if (fallbackSource == null) return;
174
+ if (typeof fallbackSource.toString === "function") return fallbackSource.toString();
175
+ }
176
+ function isJavaScriptEntry(entry) {
177
+ if (entry.output.type === "chunk") return true;
178
+ return entry.fileName.endsWith(".js");
179
+ }
180
+ function createBundleModuleGraphOptions(outputDir, entries) {
181
+ const normalizedEntries = /* @__PURE__ */ new Map();
182
+ for (const [id, entry] of entries) normalizedEntries.set(normalizeOutputPathKey(id), entry);
183
+ const getEntry = (id) => entries.get(id) ?? normalizedEntries.get(normalizeOutputPathKey(id));
184
+ return {
185
+ resolve(specifier, importer) {
186
+ return resolveOutputSpecifier(specifier, importer, outputDir, (candidate) => Boolean(getEntry(candidate)));
187
+ },
188
+ load(id) {
189
+ const entry = getEntry(id);
190
+ if (!entry) return;
191
+ return readOutputEntry(entry);
192
+ },
193
+ filter(id) {
194
+ return Boolean(getEntry(id));
195
+ }
196
+ };
197
+ }
198
+ function applyLinkedResults(linked, entries, onLinkedUpdate, onApplied) {
199
+ if (!linked) return;
200
+ const normalizedEntries = /* @__PURE__ */ new Map();
201
+ for (const [entryId, entry] of entries) normalizedEntries.set(normalizeOutputPathKey(entryId), entry);
202
+ for (const [id, { code }] of Object.entries(linked)) {
203
+ const entry = entries.get(id) ?? normalizedEntries.get(normalizeOutputPathKey(id));
204
+ if (!entry) continue;
205
+ const previous = readOutputEntry(entry);
206
+ if (previous == null || previous === code) continue;
207
+ if (entry.output.type === "chunk") entry.output.code = code;
208
+ else entry.output.source = code;
209
+ onApplied?.(entry, code);
210
+ onLinkedUpdate(entry.fileName, previous, code);
211
+ }
212
+ }
213
+ //#endregion
214
+ //#region src/bundlers/vite/runtime-affecting-signature.ts
215
+ const CSS_BLOCK_COMMENT_RE = /\/\*[\s\S]*?\*\//g;
216
+ const CSS_AROUND_PUNCTUATION_RE = /\s*([{}:;,>+~()])\s*/g;
217
+ const CSS_TRAILING_DECLARATION_SEMICOLON_RE = /;\}/g;
218
+ const CSS_WHITESPACE_RE = /\s+/g;
219
+ function createHtmlRuntimeAffectingSignature(source) {
220
+ try {
221
+ const parts = [];
222
+ const parser = new require_precheck.Parser({
223
+ onattribute(name, value) {
224
+ parts.push(`a:${name}=${value}`);
225
+ },
226
+ oncomment(data) {
227
+ parts.push(`c:${data}`);
228
+ },
229
+ ontext(data) {
230
+ const value = data.trim();
231
+ if (value.length > 0) parts.push(`t:${value}`);
232
+ }
233
+ }, { xmlMode: true });
234
+ parser.write(source);
235
+ parser.end();
236
+ return parts.join("\n");
237
+ } catch {
238
+ return source;
239
+ }
240
+ }
241
+ function createJsRuntimeAffectingSignature(source) {
242
+ try {
243
+ const ast = require_precheck.babelParse(source, {
244
+ cache: true,
245
+ cacheKey: "vite-runtime-affecting:unambiguous",
246
+ plugins: ["jsx", "typescript"],
247
+ sourceType: "unambiguous"
248
+ });
249
+ const parts = [];
250
+ require_precheck.traverse(ast, {
251
+ noScope: true,
252
+ StringLiteral(path) {
253
+ parts.push(`s:${path.node.value}`);
254
+ },
255
+ TemplateElement(path) {
256
+ parts.push(`t:${path.node.value.raw}`);
257
+ },
258
+ JSXText(path) {
259
+ const value = path.node.value.trim();
260
+ if (value.length > 0) parts.push(`x:${value}`);
261
+ }
262
+ });
263
+ const comments = ast.comments;
264
+ if (Array.isArray(comments)) {
265
+ for (const comment of comments) if (typeof comment?.value === "string" && comment.value.length > 0) parts.push(`c:${comment.value}`);
266
+ }
267
+ return parts.join("\n");
268
+ } catch {
269
+ return source;
270
+ }
271
+ }
272
+ function createCssRuntimeAffectingSignature(source) {
273
+ return source.replace(CSS_BLOCK_COMMENT_RE, "").replace(CSS_AROUND_PUNCTUATION_RE, "$1").replace(CSS_TRAILING_DECLARATION_SEMICOLON_RE, "}").replace(CSS_WHITESPACE_RE, " ").trim();
274
+ }
275
+ function createRuntimeAffectingSourceSignature(source, type) {
276
+ if (type === "html") return createHtmlRuntimeAffectingSignature(source);
277
+ if (type === "js") return createJsRuntimeAffectingSignature(source);
278
+ if (type === "css") return createCssRuntimeAffectingSignature(source);
279
+ return source;
280
+ }
281
+ //#endregion
282
+ //#region src/bundlers/vite/bundle-state.ts
283
+ function createBundleBuildState() {
284
+ return {
285
+ iteration: 0,
286
+ sourceHashByFile: /* @__PURE__ */ new Map(),
287
+ runtimeAffectingSignatureByFile: /* @__PURE__ */ new Map(),
288
+ runtimeAffectingHashByFile: /* @__PURE__ */ new Map(),
289
+ linkedByEntry: /* @__PURE__ */ new Map(),
290
+ dependentsByLinkedFile: /* @__PURE__ */ new Map(),
291
+ generatorCandidateSignature: void 0
292
+ };
293
+ }
294
+ function createChangedByType() {
295
+ return {
296
+ html: /* @__PURE__ */ new Set(),
297
+ js: /* @__PURE__ */ new Set(),
298
+ css: /* @__PURE__ */ new Set(),
299
+ other: /* @__PURE__ */ new Set()
300
+ };
301
+ }
302
+ function createProcessFiles() {
303
+ return {
304
+ html: /* @__PURE__ */ new Set(),
305
+ js: /* @__PURE__ */ new Set(),
306
+ css: /* @__PURE__ */ new Set()
307
+ };
308
+ }
309
+ function readEntrySource(output) {
310
+ if (output.type === "chunk") return output.code;
311
+ return output.source.toString();
312
+ }
313
+ function classifyBundleEntry(file, opts) {
314
+ if (opts.cssMatcher(file) || isCSSRequest(file)) return "css";
315
+ if (opts.htmlMatcher(file)) return "html";
316
+ if (opts.jsMatcher(file) || opts.wxsMatcher(file)) return "js";
317
+ return "other";
318
+ }
319
+ function collectJsEntries(fileName, output, outDir, store) {
320
+ const entry = {
321
+ fileName,
322
+ output
323
+ };
324
+ if (!isJavaScriptEntry(entry)) return;
325
+ const absolute = toAbsoluteOutputPath(fileName, outDir);
326
+ store.set(absolute, entry);
327
+ }
328
+ function markProcessFile(type, file, processFiles) {
329
+ if (type === "html" || type === "js" || type === "css") processFiles[type].add(file);
330
+ }
331
+ function buildBundleSnapshot(bundle, opts, outDir, state, forceAll = false) {
332
+ const sourceHashByFile = /* @__PURE__ */ new Map();
333
+ const runtimeAffectingSignatureByFile = /* @__PURE__ */ new Map();
334
+ const runtimeAffectingHashByFile = /* @__PURE__ */ new Map();
335
+ const changedByType = createChangedByType();
336
+ const runtimeAffectingChangedByType = createChangedByType();
337
+ const processFiles = createProcessFiles();
338
+ const linkedImpactsByEntry = /* @__PURE__ */ new Map();
339
+ const jsEntries = /* @__PURE__ */ new Map();
340
+ const entries = [];
341
+ const firstRun = state.linkedByEntry.size === 0;
342
+ for (const [file, output] of Object.entries(bundle)) {
343
+ const type = classifyBundleEntry(file, opts);
344
+ const source = readEntrySource(output);
345
+ const hash = opts.cache.computeHash(source);
346
+ sourceHashByFile.set(file, hash);
347
+ const previousHash = state.sourceHashByFile.get(file);
348
+ const changed = previousHash == null || previousHash !== hash;
349
+ const previousRuntimeAffectingSignature = state.runtimeAffectingSignatureByFile.get(file);
350
+ const previousRuntimeAffectingHash = state.runtimeAffectingHashByFile.get(file);
351
+ const canReuseRuntimeAffectingSignature = !changed && previousRuntimeAffectingSignature != null && previousRuntimeAffectingHash != null;
352
+ const runtimeAffectingSignature = canReuseRuntimeAffectingSignature ? previousRuntimeAffectingSignature : createRuntimeAffectingSourceSignature(source, type);
353
+ const runtimeAffectingHash = canReuseRuntimeAffectingSignature ? previousRuntimeAffectingHash : opts.cache.computeHash(runtimeAffectingSignature);
354
+ runtimeAffectingSignatureByFile.set(file, runtimeAffectingSignature);
355
+ runtimeAffectingHashByFile.set(file, runtimeAffectingHash);
356
+ if (changed) changedByType[type].add(file);
357
+ if (previousRuntimeAffectingHash == null || previousRuntimeAffectingHash !== runtimeAffectingHash) runtimeAffectingChangedByType[type].add(file);
358
+ if (forceAll || firstRun) markProcessFile(type, file, processFiles);
359
+ else if (type === "html") processFiles.html.add(file);
360
+ else if (changed && (type === "js" || type === "css")) processFiles[type].add(file);
361
+ collectJsEntries(file, output, outDir, jsEntries);
362
+ entries.push({
363
+ file,
364
+ output,
365
+ source,
366
+ type
367
+ });
368
+ }
369
+ if (!forceAll && !firstRun) for (const changedFile of changedByType.js) {
370
+ const dependents = state.dependentsByLinkedFile.get(changedFile);
371
+ if (!dependents) continue;
372
+ for (const entryFile of dependents) {
373
+ processFiles.js.add(entryFile);
374
+ let impacts = linkedImpactsByEntry.get(entryFile);
375
+ if (!impacts) {
376
+ impacts = /* @__PURE__ */ new Set();
377
+ linkedImpactsByEntry.set(entryFile, impacts);
378
+ }
379
+ impacts.add(changedFile);
380
+ }
381
+ }
382
+ return {
383
+ entries,
384
+ jsEntries,
385
+ sourceHashByFile,
386
+ runtimeAffectingSignatureByFile,
387
+ runtimeAffectingHashByFile,
388
+ changedByType,
389
+ runtimeAffectingChangedByType,
390
+ processFiles,
391
+ linkedImpactsByEntry
392
+ };
393
+ }
394
+ function invertLinkedByEntry(linkedByEntry) {
395
+ const dependentsByLinkedFile = /* @__PURE__ */ new Map();
396
+ for (const [entryFile, linkedFiles] of linkedByEntry.entries()) for (const linkedFile of linkedFiles) {
397
+ let dependents = dependentsByLinkedFile.get(linkedFile);
398
+ if (!dependents) {
399
+ dependents = /* @__PURE__ */ new Set();
400
+ dependentsByLinkedFile.set(linkedFile, dependents);
401
+ }
402
+ dependents.add(entryFile);
403
+ }
404
+ return dependentsByLinkedFile;
405
+ }
406
+ function updateBundleBuildState(state, snapshot, linkedByEntry, options = {}) {
407
+ const incremental = options.incremental === true;
408
+ state.iteration += 1;
409
+ state.sourceHashByFile = incremental ? new Map([...state.sourceHashByFile, ...snapshot.sourceHashByFile]) : snapshot.sourceHashByFile;
410
+ state.runtimeAffectingSignatureByFile = incremental ? new Map([...state.runtimeAffectingSignatureByFile, ...snapshot.runtimeAffectingSignatureByFile]) : snapshot.runtimeAffectingSignatureByFile;
411
+ state.runtimeAffectingHashByFile = incremental ? new Map([...state.runtimeAffectingHashByFile, ...snapshot.runtimeAffectingHashByFile]) : snapshot.runtimeAffectingHashByFile;
412
+ state.linkedByEntry = incremental ? new Map([...state.linkedByEntry, ...linkedByEntry]) : linkedByEntry;
413
+ state.dependentsByLinkedFile = invertLinkedByEntry(state.linkedByEntry);
414
+ }
415
+ //#endregion
416
+ Object.defineProperty(exports, "applyLinkedResults", {
417
+ enumerable: true,
418
+ get: function() {
419
+ return applyLinkedResults;
420
+ }
421
+ });
422
+ Object.defineProperty(exports, "buildBundleSnapshot", {
423
+ enumerable: true,
424
+ get: function() {
425
+ return buildBundleSnapshot;
426
+ }
427
+ });
428
+ Object.defineProperty(exports, "createBundleBuildState", {
429
+ enumerable: true,
430
+ get: function() {
431
+ return createBundleBuildState;
432
+ }
433
+ });
434
+ Object.defineProperty(exports, "createBundleModuleGraphOptions", {
435
+ enumerable: true,
436
+ get: function() {
437
+ return createBundleModuleGraphOptions;
438
+ }
439
+ });
440
+ Object.defineProperty(exports, "createBundlerGeneratedCssMarker", {
441
+ enumerable: true,
442
+ get: function() {
443
+ return createBundlerGeneratedCssMarker;
444
+ }
445
+ });
446
+ Object.defineProperty(exports, "formatPostcssSourceMap", {
447
+ enumerable: true,
448
+ get: function() {
449
+ return formatPostcssSourceMap;
450
+ }
451
+ });
452
+ Object.defineProperty(exports, "hasBundlerGeneratedCssMarker", {
453
+ enumerable: true,
454
+ get: function() {
455
+ return hasBundlerGeneratedCssMarker;
456
+ }
457
+ });
458
+ Object.defineProperty(exports, "isCSSRequest", {
459
+ enumerable: true,
460
+ get: function() {
461
+ return isCSSRequest;
462
+ }
463
+ });
464
+ Object.defineProperty(exports, "isSourceStyleRequest", {
465
+ enumerable: true,
466
+ get: function() {
467
+ return isSourceStyleRequest;
468
+ }
469
+ });
470
+ Object.defineProperty(exports, "normalizeOutputPathKey", {
471
+ enumerable: true,
472
+ get: function() {
473
+ return normalizeOutputPathKey;
474
+ }
475
+ });
476
+ Object.defineProperty(exports, "pushConcurrentTaskFactories", {
477
+ enumerable: true,
478
+ get: function() {
479
+ return pushConcurrentTaskFactories;
480
+ }
481
+ });
482
+ Object.defineProperty(exports, "resolveOutputSpecifier", {
483
+ enumerable: true,
484
+ get: function() {
485
+ return resolveOutputSpecifier;
486
+ }
487
+ });
488
+ Object.defineProperty(exports, "resolvePackageDir", {
489
+ enumerable: true,
490
+ get: function() {
491
+ return resolvePackageDir;
492
+ }
493
+ });
494
+ Object.defineProperty(exports, "resolvePluginDisabledState", {
495
+ enumerable: true,
496
+ get: function() {
497
+ return resolvePluginDisabledState;
498
+ }
499
+ });
500
+ Object.defineProperty(exports, "slash", {
501
+ enumerable: true,
502
+ get: function() {
503
+ return slash;
504
+ }
505
+ });
506
+ Object.defineProperty(exports, "stripBundlerGeneratedCssMarkers", {
507
+ enumerable: true,
508
+ get: function() {
509
+ return stripBundlerGeneratedCssMarkers;
510
+ }
511
+ });
512
+ Object.defineProperty(exports, "stripRequestQuery", {
513
+ enumerable: true,
514
+ get: function() {
515
+ return stripRequestQuery;
516
+ }
517
+ });
518
+ Object.defineProperty(exports, "toAbsoluteOutputPath", {
519
+ enumerable: true,
520
+ get: function() {
521
+ return toAbsoluteOutputPath;
522
+ }
523
+ });
524
+ Object.defineProperty(exports, "updateBundleBuildState", {
525
+ enumerable: true,
526
+ get: function() {
527
+ return updateBundleBuildState;
528
+ }
529
+ });