weapp-tailwindcss 5.5.8 → 5.5.10
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.
- package/dist/bundlers/vite/css-calc-stage.d.ts +8 -0
- package/dist/bundlers/vite/css-finalizer/css-calc.d.ts +1 -0
- package/dist/bundlers/vite/css-finalizer/css-scope-graph.d.ts +5 -0
- package/dist/bundlers/vite/css-finalizer/final-assets.d.ts +1 -1
- package/dist/bundlers/vite/css-finalizer/options.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/css-cache-task.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/css-output-helpers.d.ts +2 -0
- package/dist/bundlers/vite/generate-bundle/css-transform-result.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/remembered-css-replay.d.ts +3 -3
- package/dist/bundlers/vite/generate-bundle/scoped-generator-runtime-cache.d.ts +5 -0
- package/dist/bundlers/vite/generate-bundle/scoped-generator-sources.d.ts +36 -0
- package/dist/bundlers/vite/generate-bundle/scoped-generator.d.ts +6 -1
- package/dist/bundlers/vite/generate-bundle/source-candidate-scope.d.ts +2 -2
- package/dist/bundlers/vite/generate-bundle/source-trace.d.ts +2 -0
- package/dist/bundlers/vite/runtime-class-set/cache.d.ts +14 -0
- package/dist/bundlers/vite/runtime-class-set/invalidation-plugin.d.ts +6 -0
- package/dist/bundlers/vite/runtime-class-set/lifecycle.d.ts +12 -0
- package/dist/bundlers/vite/runtime-class-set.d.ts +1 -0
- package/dist/bundlers/vite/shared/create-framework-plugins-runtime.d.ts +1 -2
- package/dist/bundlers/vite/shared/framework-source-scan-session.d.ts +1 -0
- package/dist/{compiler-DbwS3329.cjs → compiler-TvqqdOMD.cjs} +50 -38
- package/dist/{compiler-CThodfGH.js → compiler-v9sYta8W.js} +35 -30
- package/dist/core/compiler/generation-cache.d.ts +4 -2
- package/dist/core/compiler/root-store.d.ts +1 -1
- package/dist/core/compiler/source.d.ts +7 -0
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{scoped-generator-DlQrVbuC.js → css-cleanup-B3xP5Qph.js} +26 -23
- package/dist/{generated-css-marker-B0RyziOH.cjs → generated-css-marker-nqjR6ntO.cjs} +102 -26
- package/dist/generation/pipeline/style-context.d.ts +3 -0
- package/dist/{generator-CxauQbx3.cjs → generator-B1sYQpWu.cjs} +165 -90
- package/dist/{generator-oKZ5mCJ5.js → generator-LqofzXgr.js} +155 -92
- package/dist/generator.cjs +1 -1
- package/dist/generator.js +1 -1
- package/dist/{gulp-DhddVxGA.js → gulp-BCV0gOMb.js} +4 -4
- package/dist/{gulp-CngHA9cU.cjs → gulp-DrX6QS3N.cjs} +5 -5
- package/dist/gulp.cjs +1 -1
- package/dist/gulp.js +1 -1
- package/dist/{hmr-timing-Dc4c1VRg.cjs → hmr-timing-B56wp7y-.cjs} +4 -4
- package/dist/{hmr-timing-xPpat-km.js → hmr-timing-Bb54exB0.js} +102 -26
- package/dist/index.cjs +4 -4
- package/dist/index.js +4 -4
- package/dist/{pipeline-helpers-EUud9R2K.cjs → pipeline-helpers-DJ3VZ01J.cjs} +3 -3
- package/dist/postcss.cjs +1 -1
- package/dist/postcss.js +1 -1
- package/dist/presets.cjs +2 -2
- package/dist/presets.js +2 -2
- package/dist/project-sources/candidates/view-memo.d.ts +7 -0
- package/dist/rspack.cjs +2 -2
- package/dist/rspack.js +2 -2
- package/dist/{scoped-generator-lbTwL6mD.cjs → scoped-generator-DqNb8nJG.cjs} +31 -24
- package/dist/{source-candidate-scan-signature-BjVQYL-C.js → source-candidate-scan-signature-BWLf4tuO.js} +2 -2
- package/dist/{source-candidate-scan-signature-nG-rg809.cjs → source-candidate-scan-signature-_ohG0ePd.cjs} +2 -2
- package/dist/tailwindcss/v4/rpx-theme-warning.d.ts +1 -1
- package/dist/tailwindcss/v4-engine/generator/raw-generation.d.ts +30 -0
- package/dist/tailwindcss/v4-engine/generator/style-context.d.ts +3 -0
- package/dist/tailwindcss/v4-engine/types.d.ts +2 -0
- package/dist/{tailwindcss-kSd0ykiX.js → tailwindcss-XNfJSlhp.js} +2 -2
- package/dist/{tailwindcss-U3KIUegn.cjs → tailwindcss-uf04Iolj.cjs} +2 -2
- package/dist/{transform-DVg4q8hh.cjs → transform-CxVM0PfA.cjs} +3 -3
- package/dist/{transform-BAon9ykq.js → transform-D0NXKPmD.js} +3 -3
- package/dist/utils/stable-serialize.d.ts +1 -0
- package/dist/vite/web.cjs +1 -1
- package/dist/vite/web.js +1 -1
- package/dist/{vite-IX83wh_L.cjs → vite-C3Zh6iYK.cjs} +434 -209
- package/dist/{vite-D-RGkmOE.js → vite-D6_FxvdM.js} +434 -209
- package/dist/vite.cjs +1 -1
- package/dist/vite.js +1 -1
- package/dist/weapp-tw-css-generation-loader.cjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.cjs +5 -5
- package/dist/{web-DHfZ_KC9.cjs → web-BzeWG_XO.cjs} +442 -155
- package/dist/{web--kA4HUTm.js → web-K3qAX4sN.js} +431 -156
- package/dist/{webpack-Bhkd27Rs.js → webpack-BZBqKB4Y.js} +6 -6
- package/dist/{webpack-BetjemzT.cjs → webpack-Dbj2uykF.cjs} +8 -8
- package/dist/webpack.cjs +1 -1
- package/dist/webpack.js +1 -1
- package/package.json +5 -4
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-fg3euq-1.cjs");
|
|
2
2
|
const require_framework = require("./framework.cjs");
|
|
3
|
-
const require_generator = require("./generator-
|
|
4
|
-
|
|
3
|
+
const require_generator = require("./generator-B1sYQpWu.cjs");
|
|
4
|
+
require("./utils-CuKLf1Zv.cjs");
|
|
5
|
+
const require_compiler = require("./compiler-TvqqdOMD.cjs");
|
|
5
6
|
const require_runtime_state = require("./runtime-state-BOzuVoKl.cjs");
|
|
6
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
7
|
-
const require_generated_css_marker = require("./generated-css-marker-
|
|
8
|
-
const require_hmr_timing = require("./hmr-timing-
|
|
9
|
-
const require_source_candidate_scan_signature = require("./source-candidate-scan-signature-
|
|
7
|
+
const require_tailwindcss = require("./tailwindcss-uf04Iolj.cjs");
|
|
8
|
+
const require_generated_css_marker = require("./generated-css-marker-nqjR6ntO.cjs");
|
|
9
|
+
const require_hmr_timing = require("./hmr-timing-B56wp7y-.cjs");
|
|
10
|
+
const require_source_candidate_scan_signature = require("./source-candidate-scan-signature-_ohG0ePd.cjs");
|
|
10
11
|
const require_css_imports = require("./css-imports-R_RDMjPz.cjs");
|
|
11
12
|
let node_fs = require("node:fs");
|
|
12
13
|
let node_path = require("node:path");
|
|
@@ -16,6 +17,7 @@ node_process = require_rolldown_runtime.__toESM(node_process, 1);
|
|
|
16
17
|
let _weapp_tailwindcss_postcss_transform = require("@weapp-tailwindcss/postcss/transform");
|
|
17
18
|
let lru_cache = require("lru-cache");
|
|
18
19
|
let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
|
|
20
|
+
let node_buffer = require("node:buffer");
|
|
19
21
|
let node_fs_promises = require("node:fs/promises");
|
|
20
22
|
let _weapp_tailwindcss_logger = require("@weapp-tailwindcss/logger");
|
|
21
23
|
let node_url = require("node:url");
|
|
@@ -208,6 +210,59 @@ function createViteCssAssetIdentityResolver(options) {
|
|
|
208
210
|
};
|
|
209
211
|
}
|
|
210
212
|
//#endregion
|
|
213
|
+
//#region src/bundlers/vite/css-calc-stage.ts
|
|
214
|
+
const deferredKeys = [
|
|
215
|
+
"cssCalc",
|
|
216
|
+
"rem2rpx",
|
|
217
|
+
"px2rpx",
|
|
218
|
+
"unitsToPx",
|
|
219
|
+
"unitConversion"
|
|
220
|
+
];
|
|
221
|
+
const deferredKeySet = new Set(deferredKeys);
|
|
222
|
+
const deferredOptions = Object.fromEntries(deferredKeys.map((key) => [key, false]));
|
|
223
|
+
/** 构建中保留原始单位和表达式;最终输出阶段仍读取用户的真实配置。 */
|
|
224
|
+
function createViteCssCalcStage(original, isBuild, getPlatform = () => void 0) {
|
|
225
|
+
const resolveFinalOptions = () => require_compiler.resolveStyleOptionsFromContext({
|
|
226
|
+
...original,
|
|
227
|
+
platform: original.cssOptions?.platform ?? original.platform ?? getPlatform()
|
|
228
|
+
}, original.tailwindRuntime.majorVersion);
|
|
229
|
+
const shouldDefer = () => {
|
|
230
|
+
if (!isBuild() || !(original.cssOptions?.cssCalc ?? original.cssCalc)) return false;
|
|
231
|
+
const finalOptions = resolveFinalOptions();
|
|
232
|
+
return finalOptions.uniAppX !== true && !require_generator.resolveUniUtsPlatform(finalOptions.platform).isApp;
|
|
233
|
+
};
|
|
234
|
+
const defer = (options) => shouldDefer() ? {
|
|
235
|
+
...options,
|
|
236
|
+
...deferredOptions,
|
|
237
|
+
cssOptions: {
|
|
238
|
+
...options?.cssOptions,
|
|
239
|
+
...deferredOptions
|
|
240
|
+
}
|
|
241
|
+
} : options;
|
|
242
|
+
const styleHandler = Object.assign((css, options) => original.styleHandler(css, defer(options)), {
|
|
243
|
+
transformRoot: ((root, options) => original.styleHandler.transformRoot(root, defer(options))),
|
|
244
|
+
getPipeline: ((options) => original.styleHandler.getPipeline(defer(options)))
|
|
245
|
+
});
|
|
246
|
+
return {
|
|
247
|
+
options: new Proxy(original, { get(target, key, receiver) {
|
|
248
|
+
if (key === "styleHandler") return styleHandler;
|
|
249
|
+
if (shouldDefer()) {
|
|
250
|
+
if (deferredKeySet.has(key)) return false;
|
|
251
|
+
if (key === "cssOptions") return {
|
|
252
|
+
...target.cssOptions,
|
|
253
|
+
...deferredOptions
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
return Reflect.get(target, key, receiver);
|
|
257
|
+
} }),
|
|
258
|
+
getFinalOptions: () => shouldDefer() ? {
|
|
259
|
+
...resolveFinalOptions(),
|
|
260
|
+
customPropertyValues: original.customPropertyValues
|
|
261
|
+
} : void 0,
|
|
262
|
+
shouldDefer
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
//#endregion
|
|
211
266
|
//#region src/bundlers/vite/processed-css-assets/style-files.ts
|
|
212
267
|
const CSS_OUTPUT_FILE_RE = /\.(?:css|wxss|acss|ttss|qss|jxss|tyss)(?:$|[?#])/i;
|
|
213
268
|
function isCssOutputFile(file) {
|
|
@@ -1719,92 +1774,183 @@ function sendFullReloadForUnresolvedHotUpdate(ctx) {
|
|
|
1719
1774
|
});
|
|
1720
1775
|
}
|
|
1721
1776
|
//#endregion
|
|
1722
|
-
//#region src/bundlers/vite/css-finalizer/
|
|
1723
|
-
function
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1777
|
+
//#region src/bundlers/vite/css-finalizer/css-scope-graph.ts
|
|
1778
|
+
function outputKey(file) {
|
|
1779
|
+
return node_path.default.posix.normalize(require_source_candidate_scan_signature.normalizeOutputPathKey(file));
|
|
1780
|
+
}
|
|
1781
|
+
function collectReachable(graph, roots) {
|
|
1782
|
+
const visited = /* @__PURE__ */ new Set();
|
|
1783
|
+
const pending = [...roots];
|
|
1784
|
+
while (pending.length > 0) {
|
|
1785
|
+
const file = pending.pop();
|
|
1786
|
+
if (visited.has(file) || !graph.has(file)) continue;
|
|
1787
|
+
visited.add(file);
|
|
1788
|
+
pending.push(...graph.get(file));
|
|
1789
|
+
}
|
|
1790
|
+
return visited;
|
|
1791
|
+
}
|
|
1792
|
+
function collectSourceComponents(graph) {
|
|
1793
|
+
let nextIndex = 0;
|
|
1794
|
+
const indexes = /* @__PURE__ */ new Map();
|
|
1795
|
+
const lowLinks = /* @__PURE__ */ new Map();
|
|
1796
|
+
const stack = [];
|
|
1797
|
+
const onStack = /* @__PURE__ */ new Set();
|
|
1798
|
+
const components = [];
|
|
1799
|
+
const owners = /* @__PURE__ */ new Map();
|
|
1800
|
+
const visit = (file) => {
|
|
1801
|
+
const index = nextIndex++;
|
|
1802
|
+
indexes.set(file, index);
|
|
1803
|
+
lowLinks.set(file, index);
|
|
1804
|
+
stack.push(file);
|
|
1805
|
+
onStack.add(file);
|
|
1806
|
+
for (const target of graph.get(file)) if (!indexes.has(target)) {
|
|
1807
|
+
visit(target);
|
|
1808
|
+
lowLinks.set(file, Math.min(lowLinks.get(file), lowLinks.get(target)));
|
|
1809
|
+
} else if (onStack.has(target)) lowLinks.set(file, Math.min(lowLinks.get(file), indexes.get(target)));
|
|
1810
|
+
if (lowLinks.get(file) !== index) return;
|
|
1811
|
+
const component = [];
|
|
1812
|
+
let member;
|
|
1813
|
+
do {
|
|
1814
|
+
member = stack.pop();
|
|
1815
|
+
onStack.delete(member);
|
|
1816
|
+
owners.set(member, components.length);
|
|
1817
|
+
component.push(member);
|
|
1818
|
+
} while (member !== file);
|
|
1819
|
+
components.push(component);
|
|
1820
|
+
};
|
|
1821
|
+
for (const file of graph.keys()) if (!indexes.has(file)) visit(file);
|
|
1822
|
+
const importedComponents = /* @__PURE__ */ new Set();
|
|
1823
|
+
for (const [file, targets] of graph) for (const target of targets) if (owners.get(file) !== owners.get(target)) importedComponents.add(owners.get(target));
|
|
1824
|
+
return components.filter((_, index) => !importedComponents.has(index));
|
|
1825
|
+
}
|
|
1826
|
+
/** 按最终入口及 CSS 导入关系收集每个样式产物可见的变量上下文。 */
|
|
1827
|
+
function collectCssCalcScopes(bundle, options) {
|
|
1828
|
+
const assets = new Map(Object.entries(bundle).flatMap(([key, output]) => {
|
|
1829
|
+
const file = outputKey(output.fileName || key);
|
|
1830
|
+
return output.type === "asset" && options.matchesCss(file) ? [[file, output]] : [];
|
|
1831
|
+
}));
|
|
1832
|
+
const graph = /* @__PURE__ */ new Map();
|
|
1833
|
+
const conditionalRoots = /* @__PURE__ */ new Set();
|
|
1834
|
+
for (const [file, asset] of assets) {
|
|
1835
|
+
const targets = /* @__PURE__ */ new Set();
|
|
1836
|
+
const source = typeof asset.source === "string" ? asset.source : node_buffer.Buffer.from(asset.source).toString();
|
|
1837
|
+
_weapp_tailwindcss_postcss_transform.postcss.parse(source).walkAtRules("import", (rule) => {
|
|
1838
|
+
const params = rule.raws.params?.raw ?? rule.params;
|
|
1839
|
+
const parsed = (0, _weapp_tailwindcss_postcss_transform.parseCssImportSpecifier)(params);
|
|
1840
|
+
const request = parsed?.specifier;
|
|
1841
|
+
if (!parsed || !request || /^(?:[a-z][a-z\d+.-]*:|\/|\\\\|#)/i.test(request)) return;
|
|
1842
|
+
const target = outputKey(node_path.default.posix.join(node_path.default.posix.dirname(file), outputKey(request.replace(/[?#].*$/, ""))));
|
|
1843
|
+
if (assets.has(target)) {
|
|
1844
|
+
targets.add(target);
|
|
1845
|
+
let conditional = params.slice(params.indexOf(parsed.raw) + parsed.raw.length).trim().length > 0 || Boolean(rule.raws.between?.trim());
|
|
1846
|
+
let ancestor = rule.parent;
|
|
1847
|
+
while (ancestor && ancestor.type !== "root" && !conditional) {
|
|
1848
|
+
conditional = ancestor.type === "atrule";
|
|
1849
|
+
ancestor = ancestor.parent;
|
|
1850
|
+
}
|
|
1851
|
+
if (conditional) conditionalRoots.add(target);
|
|
1852
|
+
}
|
|
1853
|
+
});
|
|
1854
|
+
graph.set(file, targets);
|
|
1855
|
+
}
|
|
1856
|
+
for (const file of collectReachable(graph, conditionalRoots)) options.onConditionalSource?.(file);
|
|
1857
|
+
const scopes = /* @__PURE__ */ new Map();
|
|
1858
|
+
const addScope = (roots) => {
|
|
1859
|
+
const visible = collectReachable(graph, roots);
|
|
1860
|
+
for (const file of visible) {
|
|
1861
|
+
const scope = scopes.get(file) ?? /* @__PURE__ */ new Set();
|
|
1862
|
+
for (const target of visible) scope.add(target);
|
|
1863
|
+
scopes.set(file, scope);
|
|
1741
1864
|
}
|
|
1742
|
-
throw error;
|
|
1743
|
-
}
|
|
1744
|
-
}
|
|
1745
|
-
function createCssHandlerOptions(opts, majorVersion, file, outputRoot, extraOptions = {}) {
|
|
1746
|
-
const from = node_path.default.isAbsolute(file) ? file : outputRoot ? node_path.default.resolve(outputRoot, file) : file;
|
|
1747
|
-
return {
|
|
1748
|
-
...extraOptions,
|
|
1749
|
-
cssPreflight: opts.cssPreflight,
|
|
1750
|
-
isMainChunk: opts.mainCssChunkMatcher(file, opts.appType),
|
|
1751
|
-
postcssOptions: { options: { from } },
|
|
1752
|
-
...require_compiler.normalizeStyleHandlerMajorVersion(majorVersion) === void 0 ? {} : { majorVersion: 4 }
|
|
1753
1865
|
};
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1866
|
+
const chunks = new Map(Object.entries(bundle).flatMap(([key, output]) => output.type === "chunk" ? [[outputKey(output.fileName || key), output]] : []));
|
|
1867
|
+
for (const [file, entry] of chunks) {
|
|
1868
|
+
if (!entry.isEntry && !entry.isDynamicEntry) continue;
|
|
1869
|
+
const roots = /* @__PURE__ */ new Set();
|
|
1870
|
+
const entryName = node_path.default.posix.parse(file);
|
|
1871
|
+
const matchingAssets = [...assets.keys()].filter((assetFile) => {
|
|
1872
|
+
const assetName = node_path.default.posix.parse(assetFile);
|
|
1873
|
+
return assetName.dir === entryName.dir && assetName.name === entryName.name;
|
|
1874
|
+
});
|
|
1875
|
+
if (matchingAssets.length === 1) roots.add(matchingAssets[0]);
|
|
1876
|
+
const visited = /* @__PURE__ */ new Set();
|
|
1877
|
+
const pending = [file];
|
|
1878
|
+
while (pending.length > 0) {
|
|
1879
|
+
const chunkFile = pending.pop();
|
|
1880
|
+
const chunk = chunks.get(chunkFile);
|
|
1881
|
+
if (!chunk || visited.has(chunkFile)) continue;
|
|
1882
|
+
visited.add(chunkFile);
|
|
1883
|
+
for (const css of chunk.viteMetadata?.importedCss ?? []) {
|
|
1884
|
+
const key = outputKey(css);
|
|
1885
|
+
if (assets.has(key)) roots.add(key);
|
|
1886
|
+
}
|
|
1887
|
+
for (const imported of chunk.imports) {
|
|
1888
|
+
const key = outputKey(imported);
|
|
1889
|
+
pending.push(chunks.has(key) ? key : outputKey(node_path.default.posix.join(node_path.default.posix.dirname(chunkFile), key)));
|
|
1890
|
+
}
|
|
1891
|
+
}
|
|
1892
|
+
addScope(roots);
|
|
1893
|
+
}
|
|
1894
|
+
for (const component of collectSourceComponents(graph)) if (component.some((file) => !scopes.has(file))) addScope(component);
|
|
1895
|
+
return scopes;
|
|
1783
1896
|
}
|
|
1784
1897
|
//#endregion
|
|
1785
1898
|
//#region src/bundlers/vite/css-finalizer/css-calc.ts
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
if (
|
|
1795
|
-
const
|
|
1796
|
-
const
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1899
|
+
const previousAssets = /* @__PURE__ */ new WeakMap();
|
|
1900
|
+
function readSource(asset) {
|
|
1901
|
+
return typeof asset.source === "string" ? asset.source : new TextDecoder().decode(asset.source);
|
|
1902
|
+
}
|
|
1903
|
+
/** 按最终消费作用域求值;保留原始表达式供后续 watch 构建重新判断。 */
|
|
1904
|
+
async function finalizeCssCalc(bundle, context, convertUnits = false) {
|
|
1905
|
+
const deferredOptions = context.getFinalCssCalcOptions?.();
|
|
1906
|
+
const options = deferredOptions ?? context.opts;
|
|
1907
|
+
if (!(options.cssOptions?.cssCalc ?? options.cssCalc)) return;
|
|
1908
|
+
const previous = previousAssets.get(context) ?? /* @__PURE__ */ new Map();
|
|
1909
|
+
const assets = new Map(Object.entries(bundle).flatMap(([key, output]) => {
|
|
1910
|
+
const file = require_source_candidate_scan_signature.normalizeOutputPathKey(output.fileName || key);
|
|
1911
|
+
return output.type === "asset" && context.opts.cssMatcher(file) && !context.opts.htmlMatcher(file) ? [[file, output]] : [];
|
|
1912
|
+
}));
|
|
1913
|
+
for (const [file, asset] of assets) {
|
|
1914
|
+
const prior = previous.get(file);
|
|
1915
|
+
if (prior?.asset === asset && readSource(asset) === prior.final) asset.source = prior.original;
|
|
1916
|
+
}
|
|
1917
|
+
const conditionalSources = /* @__PURE__ */ new Set();
|
|
1918
|
+
const scopes = collectCssCalcScopes(bundle, {
|
|
1919
|
+
matchesCss: (file) => assets.has(require_source_candidate_scan_signature.normalizeOutputPathKey(file)),
|
|
1920
|
+
onConditionalSource: (file) => conditionalSources.add(file)
|
|
1921
|
+
});
|
|
1922
|
+
const sources = new Map([...assets].map(([file, asset]) => [file, readSource(asset)]));
|
|
1923
|
+
const next = /* @__PURE__ */ new Map();
|
|
1924
|
+
for (const [file, asset] of assets) {
|
|
1925
|
+
const original = sources.get(file);
|
|
1926
|
+
const contextCss = [...scopes.get(file) ?? [file]].map((sourceFile) => {
|
|
1927
|
+
const source = sources.get(sourceFile) ?? "";
|
|
1928
|
+
return conditionalSources.has(sourceFile) ? `@media all{${source}}` : source;
|
|
1929
|
+
}).join("\n");
|
|
1930
|
+
const calculated = await (0, _weapp_tailwindcss_postcss_transform.applyConfiguredCssCalc)(original, {
|
|
1931
|
+
...options,
|
|
1800
1932
|
contextCss
|
|
1801
1933
|
});
|
|
1934
|
+
const outDir = context.getResolvedConfig?.()?.build?.outDir;
|
|
1935
|
+
const root = context.getResolvedConfig?.()?.root;
|
|
1936
|
+
const css = convertUnits && deferredOptions ? await (0, _weapp_tailwindcss_postcss_transform.applyConfiguredCssUnits)(calculated, {
|
|
1937
|
+
...options,
|
|
1938
|
+
postcssOptions: { options: { from: node_path.default.resolve(root ?? ".", outDir ?? ".", file) } }
|
|
1939
|
+
}) : calculated;
|
|
1940
|
+
next.set(file, {
|
|
1941
|
+
asset,
|
|
1942
|
+
original,
|
|
1943
|
+
final: css
|
|
1944
|
+
});
|
|
1802
1945
|
if (css !== original) {
|
|
1803
1946
|
asset.source = css;
|
|
1804
|
-
context.
|
|
1805
|
-
context.opts.onUpdate(asset.fileName, original, css);
|
|
1947
|
+
context.opts.onUpdate(asset.fileName || file, original, css);
|
|
1806
1948
|
}
|
|
1807
1949
|
}
|
|
1950
|
+
previousAssets.set(context, next);
|
|
1951
|
+
}
|
|
1952
|
+
function finalizeWebCssCalc(bundle, context) {
|
|
1953
|
+
return finalizeCssCalc(bundle, context, true);
|
|
1808
1954
|
}
|
|
1809
1955
|
//#endregion
|
|
1810
1956
|
//#region src/bundlers/vite/shared/generic-web-production-fast-path.ts
|
|
@@ -1860,6 +2006,69 @@ function createGenericWebProductionBundleHooks(options) {
|
|
|
1860
2006
|
};
|
|
1861
2007
|
}
|
|
1862
2008
|
//#endregion
|
|
2009
|
+
//#region src/bundlers/vite/css-finalizer/options.ts
|
|
2010
|
+
function inferPlatformFromViteOutDir(outDir) {
|
|
2011
|
+
const segment = outDir ? node_path.default.basename(node_path.default.normalize(outDir)) : void 0;
|
|
2012
|
+
if (!segment) return;
|
|
2013
|
+
const normalized = segment.trim().toLowerCase();
|
|
2014
|
+
if (normalized === "h5" || normalized === "web" || normalized === "app" || normalized === "app-plus" || normalized.startsWith("app-") || normalized.startsWith("mp-") || normalized.startsWith("quickapp-webview")) return normalized;
|
|
2015
|
+
}
|
|
2016
|
+
function isAddWatchFileInvalidRollupPhaseError(error) {
|
|
2017
|
+
const candidate = error;
|
|
2018
|
+
return candidate?.code === "INVALID_ROLLUP_PHASE" || candidate?.pluginCode === "INVALID_ROLLUP_PHASE" || candidate?.message?.includes("Cannot call \"addWatchFile\" after the build has finished.") === true;
|
|
2019
|
+
}
|
|
2020
|
+
function registerGeneratorDependencies(ctx, dependencies) {
|
|
2021
|
+
if (typeof ctx.addWatchFile !== "function") return;
|
|
2022
|
+
for (const dependency of dependencies ?? []) try {
|
|
2023
|
+
ctx.addWatchFile(dependency);
|
|
2024
|
+
} catch (error) {
|
|
2025
|
+
if (isAddWatchFileInvalidRollupPhaseError(error)) {
|
|
2026
|
+
_weapp_tailwindcss_logger.logger.debug("跳过生成模式依赖监听注册,当前 Rollup 阶段不允许 addWatchFile: %s", dependency);
|
|
2027
|
+
continue;
|
|
2028
|
+
}
|
|
2029
|
+
throw error;
|
|
2030
|
+
}
|
|
2031
|
+
}
|
|
2032
|
+
function createCssHandlerOptions(opts, majorVersion, file, outputRoot, extraOptions = {}) {
|
|
2033
|
+
const from = node_path.default.isAbsolute(file) ? file : outputRoot ? node_path.default.resolve(outputRoot, file) : file;
|
|
2034
|
+
return {
|
|
2035
|
+
...extraOptions,
|
|
2036
|
+
cssPreflight: opts.cssPreflight,
|
|
2037
|
+
isMainChunk: opts.mainCssChunkMatcher(file, opts.appType),
|
|
2038
|
+
postcssOptions: { options: { from } },
|
|
2039
|
+
...require_compiler.normalizeStyleHandlerMajorVersion(majorVersion) === void 0 ? {} : { majorVersion: 4 }
|
|
2040
|
+
};
|
|
2041
|
+
}
|
|
2042
|
+
function shouldGenerateCssByGenerator(opts, majorVersion, file, rawSource, processed) {
|
|
2043
|
+
const generatorOptions = require_generator.normalizeWeappTailwindcssGeneratorOptions(opts.generator, {
|
|
2044
|
+
appType: opts.appType,
|
|
2045
|
+
platform: opts.cssOptions?.platform ?? opts.platform,
|
|
2046
|
+
tailwindcssMajorVersion: majorVersion,
|
|
2047
|
+
uniAppX: opts.uniAppX
|
|
2048
|
+
});
|
|
2049
|
+
if (!generatorOptions.enabled) return false;
|
|
2050
|
+
if ((0, _weapp_tailwindcss_postcss_transform.hasLocalCssImport)(rawSource)) return false;
|
|
2051
|
+
if ((0, _weapp_tailwindcss_postcss_transform.hasTailwindGeneratedCssMarkers)(rawSource)) return true;
|
|
2052
|
+
if ((0, _weapp_tailwindcss_postcss_transform.hasTailwindRootDirectives)(rawSource, { importFallback: generatorOptions.importFallback })) return true;
|
|
2053
|
+
return processed && (0, _weapp_tailwindcss_postcss_transform.hasTailwindApplyDirective)(rawSource) && shouldFinalizeProcessedCssAsset(opts, file);
|
|
2054
|
+
}
|
|
2055
|
+
function shouldFinalizeProcessedCssAsset(opts, file) {
|
|
2056
|
+
return opts.mainCssChunkMatcher(file, opts.appType);
|
|
2057
|
+
}
|
|
2058
|
+
function collectViteProcessedCssSources(getViteProcessedCssAssetResults) {
|
|
2059
|
+
return [...getViteProcessedCssAssetResults?.() ?? []].map(([, record]) => typeof record === "string" ? record : record.css);
|
|
2060
|
+
}
|
|
2061
|
+
function finalizeWebCss(css, context, cssPipelineStrategy) {
|
|
2062
|
+
const shouldApplyWebCssCompat = shouldApplyViteWebCssCompat(context, cssPipelineStrategy);
|
|
2063
|
+
const defaultWebCssCompat = (value) => (0, _weapp_tailwindcss_postcss_transform.transformWebCssCompat)(value, resolveViteWebCssCompatOptions(context));
|
|
2064
|
+
return cssPipelineStrategy?.transformGeneratedCss?.(css, {
|
|
2065
|
+
...context,
|
|
2066
|
+
defaultWebCssCompat,
|
|
2067
|
+
removeScopedPreflight: (value) => value,
|
|
2068
|
+
shouldApplyWebCssCompat
|
|
2069
|
+
}) ?? (shouldApplyWebCssCompat ? defaultWebCssCompat(css) : css);
|
|
2070
|
+
}
|
|
2071
|
+
//#endregion
|
|
1863
2072
|
//#region src/bundlers/vite/css-finalizer/generic-web-fast-path.ts
|
|
1864
2073
|
function readAssetSource(asset) {
|
|
1865
2074
|
return typeof asset.source === "string" ? asset.source : asset.source.toString();
|
|
@@ -2332,8 +2541,9 @@ function createRewriteCssImportsPlugins(options) {
|
|
|
2332
2541
|
};
|
|
2333
2542
|
}
|
|
2334
2543
|
if (!options.shouldRewrite) {
|
|
2335
|
-
|
|
2336
|
-
|
|
2544
|
+
const deferredCode = shouldOwnTailwindGeneration && hasTailwindRoot && !shouldGenerateInPreTransform ? `${normalizedCode}\n${(0, _weapp_tailwindcss_postcss_transform.createDeferredCssSourceMarker)(id)}` : normalizedCode;
|
|
2545
|
+
if (deferredCode !== code) return {
|
|
2546
|
+
code: deferredCode,
|
|
2337
2547
|
map: null
|
|
2338
2548
|
};
|
|
2339
2549
|
return null;
|
|
@@ -2343,7 +2553,8 @@ function createRewriteCssImportsPlugins(options) {
|
|
|
2343
2553
|
appType: resolveAppType(),
|
|
2344
2554
|
rootImport
|
|
2345
2555
|
});
|
|
2346
|
-
const
|
|
2556
|
+
const transformed = shouldOwnTailwindGeneration ? (0, _weapp_tailwindcss_postcss_transform.stripTailwindConfigDirectives)(rewritten ?? normalizedCode) : rewritten;
|
|
2557
|
+
const nextCode = shouldOwnTailwindGeneration && hasTailwindRoot && !shouldGenerateInPreTransform ? `${transformed ?? normalizedCode}\n${(0, _weapp_tailwindcss_postcss_transform.createDeferredCssSourceMarker)(id)}` : transformed;
|
|
2347
2558
|
if (!nextCode || nextCode === code) return null;
|
|
2348
2559
|
return {
|
|
2349
2560
|
code: nextCode,
|
|
@@ -2356,6 +2567,79 @@ function hasVitePipelineTailwindGenerationDirective(code) {
|
|
|
2356
2567
|
return (0, _weapp_tailwindcss_postcss_transform.hasTailwindRootDirectives)(code) || (0, _weapp_tailwindcss_postcss_transform.hasTailwindApplyDirective)(code);
|
|
2357
2568
|
}
|
|
2358
2569
|
//#endregion
|
|
2570
|
+
//#region src/bundlers/vite/runtime-class-set/cache.ts
|
|
2571
|
+
/** 按失效版本串行刷新运行时,同版本请求共享任务,过期结果不进入缓存。 */
|
|
2572
|
+
function createRuntimeClassSetCache(options) {
|
|
2573
|
+
let revision = 0;
|
|
2574
|
+
let preparedRevision = -1;
|
|
2575
|
+
let value;
|
|
2576
|
+
let pending;
|
|
2577
|
+
let queue = Promise.resolve();
|
|
2578
|
+
let disposed = false;
|
|
2579
|
+
function invalidate() {
|
|
2580
|
+
revision++;
|
|
2581
|
+
value = void 0;
|
|
2582
|
+
pending = void 0;
|
|
2583
|
+
}
|
|
2584
|
+
function assertActive() {
|
|
2585
|
+
if (disposed) throw new Error("Vite runtime class set cache has been disposed");
|
|
2586
|
+
}
|
|
2587
|
+
function enqueue(operation) {
|
|
2588
|
+
const task = queue.then(operation);
|
|
2589
|
+
queue = task.catch(() => {});
|
|
2590
|
+
return task;
|
|
2591
|
+
}
|
|
2592
|
+
async function prepare(expectedRevision) {
|
|
2593
|
+
assertActive();
|
|
2594
|
+
if (expectedRevision !== revision || preparedRevision === expectedRevision) return;
|
|
2595
|
+
await options.refresh();
|
|
2596
|
+
if (expectedRevision === revision) preparedRevision = expectedRevision;
|
|
2597
|
+
}
|
|
2598
|
+
async function refresh() {
|
|
2599
|
+
do {
|
|
2600
|
+
const expectedRevision = revision;
|
|
2601
|
+
await enqueue(() => prepare(expectedRevision));
|
|
2602
|
+
} while (preparedRevision !== revision);
|
|
2603
|
+
}
|
|
2604
|
+
async function get() {
|
|
2605
|
+
while (true) {
|
|
2606
|
+
assertActive();
|
|
2607
|
+
if (value) return value;
|
|
2608
|
+
const expectedRevision = revision;
|
|
2609
|
+
pending ?? (pending = enqueue(async () => {
|
|
2610
|
+
await prepare(expectedRevision);
|
|
2611
|
+
if (expectedRevision !== revision) return;
|
|
2612
|
+
const next = await options.collect();
|
|
2613
|
+
if (expectedRevision === revision && !disposed) {
|
|
2614
|
+
value = next;
|
|
2615
|
+
return next;
|
|
2616
|
+
}
|
|
2617
|
+
}));
|
|
2618
|
+
const task = pending;
|
|
2619
|
+
try {
|
|
2620
|
+
const next = await task;
|
|
2621
|
+
if (next && expectedRevision === revision) return next;
|
|
2622
|
+
} finally {
|
|
2623
|
+
if (pending === task) pending = void 0;
|
|
2624
|
+
}
|
|
2625
|
+
}
|
|
2626
|
+
}
|
|
2627
|
+
return {
|
|
2628
|
+
get,
|
|
2629
|
+
refresh,
|
|
2630
|
+
invalidate,
|
|
2631
|
+
peek: () => value,
|
|
2632
|
+
revision: () => revision,
|
|
2633
|
+
remember(next, expectedRevision) {
|
|
2634
|
+
if (!disposed && expectedRevision === revision) value = next;
|
|
2635
|
+
},
|
|
2636
|
+
dispose() {
|
|
2637
|
+
disposed = true;
|
|
2638
|
+
invalidate();
|
|
2639
|
+
}
|
|
2640
|
+
};
|
|
2641
|
+
}
|
|
2642
|
+
//#endregion
|
|
2359
2643
|
//#region src/bundlers/vite/runtime-class-set.ts
|
|
2360
2644
|
function createViteRuntimeClassSet(options) {
|
|
2361
2645
|
const { opts, initialTailwindRuntime, refreshTailwindcssRuntime, uniAppXEnabled, customAttributesEntities, disabledDefaultTemplateHandler, debug } = options;
|
|
@@ -2373,8 +2657,25 @@ function createViteRuntimeClassSet(options) {
|
|
|
2373
2657
|
bareArbitraryValues: opts.arbitraryValues?.bareArbitraryValues,
|
|
2374
2658
|
escapeMap: opts.escapeMap
|
|
2375
2659
|
});
|
|
2376
|
-
|
|
2377
|
-
|
|
2660
|
+
const runtimeCache = createRuntimeClassSetCache({
|
|
2661
|
+
async refresh() {
|
|
2662
|
+
await require_compiler.refreshTailwindRuntimeState(runtimeState, {
|
|
2663
|
+
force: true,
|
|
2664
|
+
clearCache: true
|
|
2665
|
+
});
|
|
2666
|
+
await runtimeState.readyPromise;
|
|
2667
|
+
},
|
|
2668
|
+
collect: () => require_compiler.collectRuntimeClassSet(runtimeState.tailwindRuntime, {
|
|
2669
|
+
force: true,
|
|
2670
|
+
skipRefresh: true,
|
|
2671
|
+
clearCache: true
|
|
2672
|
+
})
|
|
2673
|
+
});
|
|
2674
|
+
const disposeRuntimeState = runtimeState.dispose;
|
|
2675
|
+
runtimeState.dispose = () => {
|
|
2676
|
+
runtimeCache.dispose();
|
|
2677
|
+
disposeRuntimeState();
|
|
2678
|
+
};
|
|
2378
2679
|
let runtimeRefreshSignature;
|
|
2379
2680
|
let runtimeRefreshOptionsKey;
|
|
2380
2681
|
function resolveRuntimeRefreshOptions() {
|
|
@@ -2396,50 +2697,34 @@ function createViteRuntimeClassSet(options) {
|
|
|
2396
2697
|
optionsKey
|
|
2397
2698
|
};
|
|
2398
2699
|
}
|
|
2700
|
+
function invalidateRuntimeClassSet() {
|
|
2701
|
+
runtimeCache.invalidate();
|
|
2702
|
+
}
|
|
2399
2703
|
async function refreshRuntimeState(force) {
|
|
2400
2704
|
const invalidation = resolveRuntimeRefreshOptions();
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
force: shouldRefresh,
|
|
2404
|
-
clearCache: force || invalidation.changed
|
|
2405
|
-
});
|
|
2406
|
-
if (invalidation.changed) debug("runtime signature changed, refresh triggered. signature: %s", invalidation.signature);
|
|
2407
|
-
if (refreshed) {
|
|
2408
|
-
runtimeSet = void 0;
|
|
2409
|
-
runtimeSetPromise = void 0;
|
|
2410
|
-
}
|
|
2705
|
+
if (force || invalidation.changed) invalidateRuntimeClassSet();
|
|
2706
|
+
await runtimeCache.refresh();
|
|
2411
2707
|
}
|
|
2412
2708
|
async function ensureRuntimeClassSet(force = false) {
|
|
2413
2709
|
const startedAt = performance.now();
|
|
2414
2710
|
const operationId = `vite-runtime-${Date.now()}-${runtimeState.revision}`;
|
|
2415
2711
|
const forceRuntimeRefresh = force || node_process.default.env["WEAPP_TW_VITE_FORCE_RUNTIME_REFRESH"] === "1";
|
|
2416
|
-
await refreshRuntimeState(force);
|
|
2417
|
-
await runtimeState.readyPromise;
|
|
2418
|
-
if (!forceRuntimeRefresh && runtimeSet) return runtimeSet;
|
|
2419
2712
|
const invalidation = resolveRuntimeRefreshOptions();
|
|
2420
|
-
if (forceRuntimeRefresh ||
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2713
|
+
if (forceRuntimeRefresh || invalidation.changed) invalidateRuntimeClassSet();
|
|
2714
|
+
const cacheHit = runtimeCache.peek() !== void 0;
|
|
2715
|
+
const result = await runtimeCache.get();
|
|
2716
|
+
await runtimeState.events.emit({
|
|
2717
|
+
schemaVersion: 1,
|
|
2718
|
+
type: "diagnostic",
|
|
2719
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2720
|
+
adapter: "vite",
|
|
2721
|
+
phase: "candidate",
|
|
2722
|
+
revision: runtimeState.revision,
|
|
2723
|
+
operationId,
|
|
2724
|
+
durationMs: performance.now() - startedAt,
|
|
2725
|
+
cache: { hit: cacheHit }
|
|
2424
2726
|
});
|
|
2425
|
-
|
|
2426
|
-
try {
|
|
2427
|
-
runtimeSet = await task;
|
|
2428
|
-
await runtimeState.events.emit({
|
|
2429
|
-
schemaVersion: 1,
|
|
2430
|
-
type: "diagnostic",
|
|
2431
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2432
|
-
adapter: "vite",
|
|
2433
|
-
phase: "candidate",
|
|
2434
|
-
revision: runtimeState.revision,
|
|
2435
|
-
operationId,
|
|
2436
|
-
durationMs: performance.now() - startedAt,
|
|
2437
|
-
cache: { hit: !forceRuntimeRefresh && !invalidation.changed }
|
|
2438
|
-
});
|
|
2439
|
-
return runtimeSet;
|
|
2440
|
-
} finally {
|
|
2441
|
-
if (runtimeSetPromise === task) runtimeSetPromise = void 0;
|
|
2442
|
-
}
|
|
2727
|
+
return result;
|
|
2443
2728
|
}
|
|
2444
2729
|
async function ensureBundleRuntimeClassSet(snapshot, forceRefresh = false, options = {}) {
|
|
2445
2730
|
const startedAt = performance.now();
|
|
@@ -2451,21 +2736,17 @@ function createViteRuntimeClassSet(options) {
|
|
|
2451
2736
|
await refreshRuntimeState(shouldRefreshRuntime);
|
|
2452
2737
|
await runtimeState.readyPromise;
|
|
2453
2738
|
if (shouldRefreshRuntime) {
|
|
2454
|
-
runtimeSet = void 0;
|
|
2455
|
-
runtimeSetPromise = void 0;
|
|
2456
2739
|
await bundleRuntimeClassSetManager.reset();
|
|
2457
2740
|
await transformRuntimeClassSetManager.reset();
|
|
2458
2741
|
}
|
|
2742
|
+
const expectedRevision = runtimeCache.revision();
|
|
2459
2743
|
if (!forceRuntimeRefresh) try {
|
|
2460
|
-
const baseClassSet = options.baseClassSet ??
|
|
2461
|
-
force: invalidation.changed,
|
|
2462
|
-
clearCache: invalidation.changed
|
|
2463
|
-
});
|
|
2744
|
+
const baseClassSet = options.baseClassSet ?? await runtimeCache.get();
|
|
2464
2745
|
const nextRuntimeSet = await bundleRuntimeClassSetManager.sync(runtimeState.tailwindRuntime, snapshot, {
|
|
2465
2746
|
baseClassSet,
|
|
2466
2747
|
skipInitialFullScanWithBase: options.allowBaselineOnlyInitialSync
|
|
2467
2748
|
});
|
|
2468
|
-
|
|
2749
|
+
runtimeCache.remember(nextRuntimeSet, expectedRevision);
|
|
2469
2750
|
await runtimeState.events.emit({
|
|
2470
2751
|
schemaVersion: 1,
|
|
2471
2752
|
type: "diagnostic",
|
|
@@ -2483,35 +2764,26 @@ function createViteRuntimeClassSet(options) {
|
|
|
2483
2764
|
debug("incremental runtime set sync failed, fallback to full collect: %O", error);
|
|
2484
2765
|
await bundleRuntimeClassSetManager.reset();
|
|
2485
2766
|
}
|
|
2486
|
-
if (!forceRuntimeRefresh && !invalidation.changed &&
|
|
2487
|
-
const
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2767
|
+
if (!forceRuntimeRefresh && !invalidation.changed && forceCollectBySource) invalidateRuntimeClassSet();
|
|
2768
|
+
const result = await runtimeCache.get();
|
|
2769
|
+
await runtimeState.events.emit({
|
|
2770
|
+
schemaVersion: 1,
|
|
2771
|
+
type: "diagnostic",
|
|
2772
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2773
|
+
adapter: "vite",
|
|
2774
|
+
phase: "candidate",
|
|
2775
|
+
revision: runtimeState.revision,
|
|
2776
|
+
operationId,
|
|
2777
|
+
durationMs: performance.now() - startedAt,
|
|
2778
|
+
cache: { hit: false },
|
|
2779
|
+
evidence: ["runtime-class-scan"]
|
|
2491
2780
|
});
|
|
2492
|
-
|
|
2493
|
-
try {
|
|
2494
|
-
runtimeSet = await task;
|
|
2495
|
-
await runtimeState.events.emit({
|
|
2496
|
-
schemaVersion: 1,
|
|
2497
|
-
type: "diagnostic",
|
|
2498
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2499
|
-
adapter: "vite",
|
|
2500
|
-
phase: "candidate",
|
|
2501
|
-
revision: runtimeState.revision,
|
|
2502
|
-
operationId,
|
|
2503
|
-
durationMs: performance.now() - startedAt,
|
|
2504
|
-
cache: { hit: false },
|
|
2505
|
-
evidence: ["runtime-class-scan"]
|
|
2506
|
-
});
|
|
2507
|
-
return runtimeSet;
|
|
2508
|
-
} finally {
|
|
2509
|
-
if (runtimeSetPromise === task) runtimeSetPromise = void 0;
|
|
2510
|
-
}
|
|
2781
|
+
return result;
|
|
2511
2782
|
}
|
|
2512
2783
|
return {
|
|
2513
2784
|
runtimeState,
|
|
2514
2785
|
refreshRuntimeState,
|
|
2786
|
+
invalidateRuntimeClassSet,
|
|
2515
2787
|
ensureRuntimeClassSet,
|
|
2516
2788
|
ensureBundleRuntimeClassSet
|
|
2517
2789
|
};
|
|
@@ -3366,6 +3638,7 @@ function createFrameworkSourceScanSession(options) {
|
|
|
3366
3638
|
pendingHotUpdateChangeByFile: pendingHotUpdateChangeByFile.size,
|
|
3367
3639
|
sourceCandidateScanCache: sourceCandidateScanCache.size
|
|
3368
3640
|
}),
|
|
3641
|
+
getWatchFiles: () => /* @__PURE__ */ new Set([...sourceScanEligibleFiles, ...sourceScanDependencies]),
|
|
3369
3642
|
invalidate,
|
|
3370
3643
|
isDependency,
|
|
3371
3644
|
matches: (file) => sourceScanMatcher?.(file) ?? true,
|
|
@@ -3458,7 +3731,8 @@ function resolveWebGeneratorOptions(opts) {
|
|
|
3458
3731
|
/** 创建不含 JS/template、分包和小程序 bundle 处理的 Generic Web Vite 插件。 */
|
|
3459
3732
|
function createCssOnlyVitePlugins(options = {}) {
|
|
3460
3733
|
const rawOptions = options;
|
|
3461
|
-
|
|
3734
|
+
let resolvedConfig;
|
|
3735
|
+
const cssCalcStage = createViteCssCalcStage("tailwindRuntime" in options ? options : require_compiler.getCompilerContext({
|
|
3462
3736
|
...rawOptions,
|
|
3463
3737
|
appType: void 0,
|
|
3464
3738
|
platform: "web",
|
|
@@ -3468,7 +3742,8 @@ function createCssOnlyVitePlugins(options = {}) {
|
|
|
3468
3742
|
} : { target: "web" },
|
|
3469
3743
|
__internalDeferMissingCssEntriesWarning: true,
|
|
3470
3744
|
__internalViteDeferRuntimeLogs: true
|
|
3471
|
-
});
|
|
3745
|
+
}), () => resolvedConfig?.command === "build");
|
|
3746
|
+
const opts = cssCalcStage.options;
|
|
3472
3747
|
const disabled = opts.disabled === true || typeof opts.disabled === "object" && opts.disabled.plugin === true;
|
|
3473
3748
|
const shouldGenerate = !disabled && resolveWebGeneratorOptions(opts).enabled;
|
|
3474
3749
|
const sourceCandidateCollector = require_generated_css_marker.createSourceCandidateCollector({
|
|
@@ -3498,7 +3773,6 @@ function createCssOnlyVitePlugins(options = {}) {
|
|
|
3498
3773
|
getGeneratorOptions: () => resolveWebGeneratorOptions(opts),
|
|
3499
3774
|
isRuntimeAffectingSource: () => false
|
|
3500
3775
|
});
|
|
3501
|
-
let resolvedConfig;
|
|
3502
3776
|
let recordedCandidates;
|
|
3503
3777
|
const processedCssRegistry = createFrameworkProcessedCssRegistry();
|
|
3504
3778
|
const processedCssAssets = /* @__PURE__ */ new WeakSet();
|
|
@@ -3637,6 +3911,7 @@ function createCssOnlyVitePlugins(options = {}) {
|
|
|
3637
3911
|
});
|
|
3638
3912
|
const finalizer = createViteWebCssFinalizerOutputPlugin({
|
|
3639
3913
|
opts,
|
|
3914
|
+
getFinalCssCalcOptions: cssCalcStage.getFinalOptions,
|
|
3640
3915
|
runtimeState,
|
|
3641
3916
|
ensureRuntimeClassSet: collectCssSourceCandidates,
|
|
3642
3917
|
debug,
|
|
@@ -3899,6 +4174,12 @@ Object.defineProperty(exports, "createViteCssAssetIdentityResolver", {
|
|
|
3899
4174
|
return createViteCssAssetIdentityResolver;
|
|
3900
4175
|
}
|
|
3901
4176
|
});
|
|
4177
|
+
Object.defineProperty(exports, "createViteCssCalcStage", {
|
|
4178
|
+
enumerable: true,
|
|
4179
|
+
get: function() {
|
|
4180
|
+
return createViteCssCalcStage;
|
|
4181
|
+
}
|
|
4182
|
+
});
|
|
3902
4183
|
Object.defineProperty(exports, "createViteCssGenerationPlugins", {
|
|
3903
4184
|
enumerable: true,
|
|
3904
4185
|
get: function() {
|
|
@@ -3959,6 +4240,12 @@ Object.defineProperty(exports, "extractSfcStyleBlocks", {
|
|
|
3959
4240
|
return extractSfcStyleBlocks;
|
|
3960
4241
|
}
|
|
3961
4242
|
});
|
|
4243
|
+
Object.defineProperty(exports, "finalizeCssCalc", {
|
|
4244
|
+
enumerable: true,
|
|
4245
|
+
get: function() {
|
|
4246
|
+
return finalizeCssCalc;
|
|
4247
|
+
}
|
|
4248
|
+
});
|
|
3962
4249
|
Object.defineProperty(exports, "finalizeWebCss", {
|
|
3963
4250
|
enumerable: true,
|
|
3964
4251
|
get: function() {
|