weapp-tailwindcss 5.0.0-next.25 → 5.0.0-next.26
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/{auto-B11j1XiD.js → auto-CqyEtds4.js} +4 -6
- package/dist/{auto-AduSz49t.mjs → auto-CsWz6lsU.mjs} +4 -6
- package/dist/{bundle-state-CBouNDzi.mjs → bundle-state-CWcrb3mH.mjs} +1 -2
- package/dist/{bundle-state-BY7PWHAc.js → bundle-state-uCtqRm0p.js} +2 -3
- package/dist/bundlers/vite/serve-css-generation.d.ts +11 -0
- package/dist/cli.js +4 -5
- package/dist/cli.mjs +4 -5
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/css-macro/postcss.js +1 -1
- package/dist/css-macro/postcss.mjs +1 -1
- package/dist/css-macro.js +2 -2
- package/dist/css-macro.mjs +2 -2
- package/dist/{generator-DTPePQZ9.js → generator-BH6a0xuB.js} +1 -1
- package/dist/{generator-CtqzN9L-.mjs → generator-iI_265gt.mjs} +1 -1
- package/dist/generator.js +2 -2
- package/dist/generator.mjs +2 -2
- package/dist/gulp.js +5 -5
- package/dist/gulp.mjs +5 -5
- package/dist/{incremental-runtime-class-set-BlJ86j-A.mjs → incremental-runtime-class-set-ECHyKwUL.mjs} +3 -3
- package/dist/{incremental-runtime-class-set-CERcE0fP.js → incremental-runtime-class-set-mY0v1k-Y.js} +3 -3
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/dist/{postcss-DXkxsPNg.js → postcss-BwW8zO24.js} +4 -4
- package/dist/{postcss-DYktK8_T.mjs → postcss-BzaRjBL0.mjs} +4 -4
- package/dist/{postcss-BAO9tGi5.js → postcss-DEEAZ8J5.js} +2 -2
- package/dist/{postcss-CYPHxj7a.mjs → postcss-DJoU--Z-.mjs} +2 -2
- package/dist/postcss.js +1 -1
- package/dist/postcss.mjs +1 -1
- package/dist/{precheck-B4CpMt_w.mjs → precheck-BI8oBeUg.mjs} +1991 -4
- package/dist/{precheck-ezN3ovAq.js → precheck-DLJg0_pu.js} +1997 -4
- package/dist/presets/index.d.ts +1 -0
- package/dist/presets.js +16 -3
- package/dist/presets.mjs +15 -4
- package/dist/{source-candidates-DoyOltpZ.mjs → source-candidates-DkScNh9A.mjs} +1 -1
- package/dist/{source-candidates-0jPRIPmC.js → source-candidates-mfvC9gMc.js} +1 -1
- package/dist/{tailwindcss-nQetCaPp.js → tailwindcss-Cm93idme.js} +1 -1
- package/dist/{tailwindcss-ujlr9Iad.mjs → tailwindcss-DFa5Yes8.mjs} +1 -1
- package/dist/{v3-engine-Bbsrez2w.js → v3-engine-CGsbY81C.js} +1 -1
- package/dist/{v3-engine-COw08vWd.mjs → v3-engine-CPJ9uGyr.mjs} +1 -1
- package/dist/{vite-DE8Vfzal.js → vite-BM_ksf1q.js} +138 -19
- package/dist/{vite-hZsQAY1a.mjs → vite-CqEF-Wx5.mjs} +138 -19
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +7 -10
- package/dist/{webpack-CTJcw_sX.js → webpack-CfcuDhQ8.js} +9 -6
- package/dist/{webpack-c2WJnCJI.mjs → webpack-D--XZMBB.mjs} +10 -7
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +8 -6
package/dist/presets/index.d.ts
CHANGED
package/dist/presets.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_chunk = require("./chunk-8l464Juk.js");
|
|
3
|
-
const require_v3_engine = require("./v3-engine-
|
|
3
|
+
const require_v3_engine = require("./v3-engine-CGsbY81C.js");
|
|
4
4
|
const require_utils = require("./utils-CSA174-I.js");
|
|
5
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
5
|
+
const require_tailwindcss = require("./tailwindcss-Cm93idme.js");
|
|
6
6
|
require("./logger-Cdzl3p8j.js");
|
|
7
|
+
let node_path = require("node:path");
|
|
8
|
+
node_path = require_chunk.__toESM(node_path);
|
|
7
9
|
let node_process = require("node:process");
|
|
8
10
|
node_process = require_chunk.__toESM(node_process);
|
|
9
11
|
let local_pkg = require("local-pkg");
|
|
@@ -42,6 +44,11 @@ function createBasePreset(options = {}) {
|
|
|
42
44
|
return (0, _weapp_tailwindcss_shared.defuOverrideArray)((0, _weapp_tailwindcss_shared.defuOverrideArray)(userOptions, rawOptions ?? {}), preset);
|
|
43
45
|
}
|
|
44
46
|
//#endregion
|
|
47
|
+
//#region src/presets/hbuilderx.ts
|
|
48
|
+
function hbuilderx(options = {}) {
|
|
49
|
+
return createBasePreset({ ...options });
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
45
52
|
//#region src/presets/uni-app.ts
|
|
46
53
|
function uniApp(options = {}) {
|
|
47
54
|
const uniPlatform = node_process.default.env["UNI_PLATFORM"];
|
|
@@ -61,7 +68,11 @@ function resolveTailwindResolveOptions(base, resolve) {
|
|
|
61
68
|
const currentPaths = Array.isArray(resolve?.paths) ? resolve.paths : [];
|
|
62
69
|
return {
|
|
63
70
|
...resolve ?? {},
|
|
64
|
-
paths: [...new Set([
|
|
71
|
+
paths: [...new Set([
|
|
72
|
+
node_path.default.join(base, "node_modules"),
|
|
73
|
+
base,
|
|
74
|
+
...currentPaths
|
|
75
|
+
])]
|
|
65
76
|
};
|
|
66
77
|
}
|
|
67
78
|
function resolveInstalledTailwindDefaults(resolve) {
|
|
@@ -102,6 +113,7 @@ function uniAppX(options) {
|
|
|
102
113
|
rem2rpx: options.rem2rpx,
|
|
103
114
|
unitsToPx: options.unitsToPx,
|
|
104
115
|
unitConversion: options.unitConversion,
|
|
116
|
+
appType: "uni-app-x",
|
|
105
117
|
tailwindcssBasedir: options.base,
|
|
106
118
|
tailwindcssPatcherOptions: {
|
|
107
119
|
projectRoot: options.base,
|
|
@@ -127,6 +139,7 @@ function uniAppX(options) {
|
|
|
127
139
|
}
|
|
128
140
|
//#endregion
|
|
129
141
|
exports.createBasePreset = createBasePreset;
|
|
142
|
+
exports.hbuilderx = hbuilderx;
|
|
130
143
|
exports.normalizeCssEntries = normalizeCssEntries;
|
|
131
144
|
exports.uniApp = uniApp;
|
|
132
145
|
exports.uniAppX = uniAppX;
|
package/dist/presets.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { q as omitUndefined } from "./v3-engine-
|
|
1
|
+
import { q as omitUndefined } from "./v3-engine-CPJ9uGyr.mjs";
|
|
2
2
|
import { n as defuOverrideArray, o as resolveUniUtsPlatform } from "./utils-B2SJgA1L.mjs";
|
|
3
|
-
import { i as resolveUniAppXOptions, n as resolveTailwindcssBasedir } from "./tailwindcss-
|
|
3
|
+
import { i as resolveUniAppXOptions, n as resolveTailwindcssBasedir } from "./tailwindcss-DFa5Yes8.mjs";
|
|
4
4
|
import { t as logger } from "./logger-Dr7IvyH2.mjs";
|
|
5
|
+
import path from "node:path";
|
|
5
6
|
import process from "node:process";
|
|
6
7
|
import { getPackageInfoSync } from "local-pkg";
|
|
7
8
|
//#region src/presets/shared.ts
|
|
@@ -37,6 +38,11 @@ function createBasePreset(options = {}) {
|
|
|
37
38
|
return defuOverrideArray(defuOverrideArray(userOptions, rawOptions ?? {}), preset);
|
|
38
39
|
}
|
|
39
40
|
//#endregion
|
|
41
|
+
//#region src/presets/hbuilderx.ts
|
|
42
|
+
function hbuilderx(options = {}) {
|
|
43
|
+
return createBasePreset({ ...options });
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
40
46
|
//#region src/presets/uni-app.ts
|
|
41
47
|
function uniApp(options = {}) {
|
|
42
48
|
const uniPlatform = process.env["UNI_PLATFORM"];
|
|
@@ -56,7 +62,11 @@ function resolveTailwindResolveOptions(base, resolve) {
|
|
|
56
62
|
const currentPaths = Array.isArray(resolve?.paths) ? resolve.paths : [];
|
|
57
63
|
return {
|
|
58
64
|
...resolve ?? {},
|
|
59
|
-
paths: [...new Set([
|
|
65
|
+
paths: [...new Set([
|
|
66
|
+
path.join(base, "node_modules"),
|
|
67
|
+
base,
|
|
68
|
+
...currentPaths
|
|
69
|
+
])]
|
|
60
70
|
};
|
|
61
71
|
}
|
|
62
72
|
function resolveInstalledTailwindDefaults(resolve) {
|
|
@@ -97,6 +107,7 @@ function uniAppX(options) {
|
|
|
97
107
|
rem2rpx: options.rem2rpx,
|
|
98
108
|
unitsToPx: options.unitsToPx,
|
|
99
109
|
unitConversion: options.unitConversion,
|
|
110
|
+
appType: "uni-app-x",
|
|
100
111
|
tailwindcssBasedir: options.base,
|
|
101
112
|
tailwindcssPatcherOptions: {
|
|
102
113
|
projectRoot: options.base,
|
|
@@ -121,4 +132,4 @@ function uniAppX(options) {
|
|
|
121
132
|
});
|
|
122
133
|
}
|
|
123
134
|
//#endregion
|
|
124
|
-
export { createBasePreset, normalizeCssEntries, uniApp, uniAppX };
|
|
135
|
+
export { createBasePreset, hbuilderx, normalizeCssEntries, uniApp, uniAppX };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { L as resolveSourceScanPath, N as isFileMatchedByTailwindSourceEntries, k as FULL_SOURCE_SCAN_EXTENSION_RE, z as toPosixPath } from "./v3-engine-
|
|
1
|
+
import { L as resolveSourceScanPath, N as isFileMatchedByTailwindSourceEntries, k as FULL_SOURCE_SCAN_EXTENSION_RE, z as toPosixPath } from "./v3-engine-CPJ9uGyr.mjs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { extractSourceCandidates, resolveProjectSourceFiles } from "tailwindcss-patch";
|
|
4
4
|
import { readFile } from "node:fs/promises";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-8l464Juk.js");
|
|
2
|
-
const require_v3_engine = require("./v3-engine-
|
|
2
|
+
const require_v3_engine = require("./v3-engine-CGsbY81C.js");
|
|
3
3
|
let node_path = require("node:path");
|
|
4
4
|
node_path = require_chunk.__toESM(node_path);
|
|
5
5
|
let tailwindcss_patch = require("tailwindcss-patch");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-8l464Juk.js");
|
|
2
|
-
const require_v3_engine = require("./v3-engine-
|
|
2
|
+
const require_v3_engine = require("./v3-engine-CGsbY81C.js");
|
|
3
3
|
require("./utils-CSA174-I.js");
|
|
4
4
|
let node_fs = require("node:fs");
|
|
5
5
|
let node_module = require("node:module");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as normalizeStringListOption, H as readInstalledPackageMajorVersion, J as findNearestPackageRoot, V as createTailwindcssPatcher, X as findWorkspaceRoot, Y as findWorkspacePackageDir, f as runtimeSignaturePatchersSymbol, q as omitUndefined } from "./v3-engine-
|
|
1
|
+
import { G as normalizeStringListOption, H as readInstalledPackageMajorVersion, J as findNearestPackageRoot, V as createTailwindcssPatcher, X as findWorkspaceRoot, Y as findWorkspacePackageDir, f as runtimeSignaturePatchersSymbol, q as omitUndefined } from "./v3-engine-CPJ9uGyr.mjs";
|
|
2
2
|
import { n as defuOverrideArray } from "./utils-B2SJgA1L.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { existsSync, readFileSync } from "node:fs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-8l464Juk.js");
|
|
2
|
-
const require_auto = require("./auto-
|
|
2
|
+
const require_auto = require("./auto-CqyEtds4.js");
|
|
3
3
|
let node_fs = require("node:fs");
|
|
4
4
|
node_fs = require_chunk.__toESM(node_fs);
|
|
5
5
|
let node_module = require("node:module");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as transformCssMacroCss, n as hasCssMacroTailwindPlugin, o as withCssMacroStyleOptions, r as hasCssMacroTailwindV4Directive, t as hasCssMacroStyleOptions } from "./auto-
|
|
1
|
+
import { a as transformCssMacroCss, n as hasCssMacroTailwindPlugin, o as withCssMacroStyleOptions, r as hasCssMacroTailwindV4Directive, t as hasCssMacroStyleOptions } from "./auto-CsWz6lsU.mjs";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import fs, { existsSync, readFileSync, readdirSync, realpathSync, statSync } from "node:fs";
|
|
4
4
|
import postcss from "postcss";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-8l464Juk.js");
|
|
2
|
-
const require_v3_engine = require("./v3-engine-
|
|
3
|
-
const require_generator = require("./generator-
|
|
4
|
-
const require_incremental_runtime_class_set = require("./incremental-runtime-class-set-
|
|
5
|
-
const require_precheck = require("./precheck-
|
|
2
|
+
const require_v3_engine = require("./v3-engine-CGsbY81C.js");
|
|
3
|
+
const require_generator = require("./generator-BH6a0xuB.js");
|
|
4
|
+
const require_incremental_runtime_class_set = require("./incremental-runtime-class-set-mY0v1k-Y.js");
|
|
5
|
+
const require_precheck = require("./precheck-DLJg0_pu.js");
|
|
6
6
|
const require_utils = require("./utils-CSA174-I.js");
|
|
7
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
8
|
-
const require_source_candidates = require("./source-candidates-
|
|
9
|
-
const require_bundle_state = require("./bundle-state-
|
|
7
|
+
const require_tailwindcss = require("./tailwindcss-Cm93idme.js");
|
|
8
|
+
const require_source_candidates = require("./source-candidates-mfvC9gMc.js");
|
|
9
|
+
const require_bundle_state = require("./bundle-state-uCtqRm0p.js");
|
|
10
10
|
require("./logger-Cdzl3p8j.js");
|
|
11
11
|
let node_fs = require("node:fs");
|
|
12
12
|
node_fs = require_chunk.__toESM(node_fs);
|
|
@@ -1814,6 +1814,83 @@ function createViteRuntimeClassSet(options) {
|
|
|
1814
1814
|
};
|
|
1815
1815
|
}
|
|
1816
1816
|
//#endregion
|
|
1817
|
+
//#region src/bundlers/vite/serve-css-generation.ts
|
|
1818
|
+
const SPECIAL_QUERY_RE = /[?&](?:worker|sharedworker|raw|url)\b/;
|
|
1819
|
+
const COMMON_JS_PROXY_RE = /\?commonjs-proxy/;
|
|
1820
|
+
const VITE_CSS_HMR_MODULE_RE = /\b__vite__updateStyle\s*\(/;
|
|
1821
|
+
const VITE_CSS_CONST_RE = /\bconst\s+__vite__css\s*=\s*("(?:\\[\s\S]|[^"])*")/;
|
|
1822
|
+
function decodeJsStringLiteral(literal) {
|
|
1823
|
+
try {
|
|
1824
|
+
return JSON.parse(literal);
|
|
1825
|
+
} catch {
|
|
1826
|
+
return;
|
|
1827
|
+
}
|
|
1828
|
+
}
|
|
1829
|
+
function encodeJsStringLiteral(value) {
|
|
1830
|
+
return JSON.stringify(value);
|
|
1831
|
+
}
|
|
1832
|
+
function extractViteCssHmrModuleCss(code) {
|
|
1833
|
+
const match = VITE_CSS_CONST_RE.exec(code);
|
|
1834
|
+
if (!match?.[1]) return;
|
|
1835
|
+
const css = decodeJsStringLiteral(match[1]);
|
|
1836
|
+
if (typeof css !== "string") return;
|
|
1837
|
+
return {
|
|
1838
|
+
css,
|
|
1839
|
+
start: match.index + match[0].lastIndexOf(match[1]),
|
|
1840
|
+
end: match.index + match[0].length
|
|
1841
|
+
};
|
|
1842
|
+
}
|
|
1843
|
+
function replaceViteCssHmrModuleCss(code, css) {
|
|
1844
|
+
const extracted = extractViteCssHmrModuleCss(code);
|
|
1845
|
+
if (!extracted) return;
|
|
1846
|
+
return `${code.slice(0, extracted.start)}${encodeJsStringLiteral(css)}${code.slice(extracted.end)}`;
|
|
1847
|
+
}
|
|
1848
|
+
function isViteServeStyleRequest(id, command) {
|
|
1849
|
+
return command === "serve" && require_bundle_state.isSourceStyleRequest(id) && !SPECIAL_QUERY_RE.test(id) && !COMMON_JS_PROXY_RE.test(id);
|
|
1850
|
+
}
|
|
1851
|
+
function isViteServeCssRootRequest(id, command) {
|
|
1852
|
+
return command === "serve" && require_bundle_state.isCSSRequest(id) && !SPECIAL_QUERY_RE.test(id) && !COMMON_JS_PROXY_RE.test(id);
|
|
1853
|
+
}
|
|
1854
|
+
function isViteCssHmrModule(code, id, command) {
|
|
1855
|
+
return isViteServeStyleRequest(id, command) && VITE_CSS_HMR_MODULE_RE.test(code) && /[?&](?:direct|vue)(?:&|$)/.test(id);
|
|
1856
|
+
}
|
|
1857
|
+
function createViteServeCssGenerationPlugins(options) {
|
|
1858
|
+
return [{
|
|
1859
|
+
name: `${require_precheck.vitePluginName}:generate:serve`,
|
|
1860
|
+
apply: "serve",
|
|
1861
|
+
enforce: "pre",
|
|
1862
|
+
async transform(code, id) {
|
|
1863
|
+
if (!options.shouldGenerate() || !isViteServeCssRootRequest(id, options.getCommand())) return;
|
|
1864
|
+
if (!require_incremental_runtime_class_set.hasTailwindRootDirectives(code)) return;
|
|
1865
|
+
await options.onTailwindRootCss?.(id, code);
|
|
1866
|
+
const generatedCss = await options.generateCss(id, code, this);
|
|
1867
|
+
if (generatedCss === void 0 || generatedCss === code) return;
|
|
1868
|
+
return {
|
|
1869
|
+
code: generatedCss,
|
|
1870
|
+
map: null
|
|
1871
|
+
};
|
|
1872
|
+
}
|
|
1873
|
+
}, {
|
|
1874
|
+
name: `${require_precheck.vitePluginName}:generate:serve-hmr`,
|
|
1875
|
+
apply: "serve",
|
|
1876
|
+
enforce: "post",
|
|
1877
|
+
async transform(code, id) {
|
|
1878
|
+
if (!options.shouldGenerate() || !isViteCssHmrModule(code, id, options.getCommand())) return;
|
|
1879
|
+
const extracted = extractViteCssHmrModuleCss(code);
|
|
1880
|
+
if (!extracted) return;
|
|
1881
|
+
await options.onTailwindRootCss?.(id, extracted.css);
|
|
1882
|
+
const generatedCss = await options.generateCss(id, extracted.css, this);
|
|
1883
|
+
if (generatedCss === void 0 || generatedCss === extracted.css) return;
|
|
1884
|
+
const nextCode = replaceViteCssHmrModuleCss(code, generatedCss);
|
|
1885
|
+
if (nextCode === void 0 || nextCode === code) return;
|
|
1886
|
+
return {
|
|
1887
|
+
code: nextCode,
|
|
1888
|
+
map: null
|
|
1889
|
+
};
|
|
1890
|
+
}
|
|
1891
|
+
}];
|
|
1892
|
+
}
|
|
1893
|
+
//#endregion
|
|
1817
1894
|
//#region src/bundlers/vite/tailwind-basedir.ts
|
|
1818
1895
|
const PACKAGE_JSON_FILE = "package.json";
|
|
1819
1896
|
function resolveImplicitTailwindcssBasedirFromViteRoot(root) {
|
|
@@ -1885,7 +1962,6 @@ function WeappTailwindcss(options = {}) {
|
|
|
1885
1962
|
const shouldOwnTailwindGeneration = !disabledOptions.plugin;
|
|
1886
1963
|
const shouldRewriteCssImports = tailwindcssMajorVersion >= 4;
|
|
1887
1964
|
const generatorOptions = require_generator.normalizeWeappTailwindcssGeneratorOptions(opts.generator);
|
|
1888
|
-
const isWebGeneratorTarget = generatorOptions.target === "web";
|
|
1889
1965
|
const shouldInferAppType = !hasExplicitAppType && generatorOptions.target !== "web";
|
|
1890
1966
|
const hasInitialTailwindCssRoots = require_tailwindcss.hasConfiguredTailwindV4CssRoots({
|
|
1891
1967
|
...options,
|
|
@@ -2154,20 +2230,57 @@ function WeappTailwindcss(options = {}) {
|
|
|
2154
2230
|
const resolveHotTailwindCssModules = (ctx) => {
|
|
2155
2231
|
const modules = [];
|
|
2156
2232
|
const seenModules = /* @__PURE__ */ new Set();
|
|
2233
|
+
const collectModule = (mod) => {
|
|
2234
|
+
if (mod == null || seenModules.has(mod)) return;
|
|
2235
|
+
if (!require_bundle_state.isSourceStyleRequest(mod.id ?? mod.url)) return;
|
|
2236
|
+
seenModules.add(mod);
|
|
2237
|
+
ctx.server.moduleGraph.invalidateModule(mod);
|
|
2238
|
+
modules.push(mod);
|
|
2239
|
+
};
|
|
2157
2240
|
for (const id of tailwindRootCssModuleIds) {
|
|
2158
|
-
const candidates = [
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
ctx.server.moduleGraph.invalidateModule(mod);
|
|
2166
|
-
modules.push(mod);
|
|
2167
|
-
}
|
|
2241
|
+
const candidates = [
|
|
2242
|
+
ctx.server.moduleGraph.getModuleById(id),
|
|
2243
|
+
ctx.server.moduleGraph.getModuleById((0, _weapp_tailwindcss_shared.cleanUrl)(id)),
|
|
2244
|
+
...ctx.server.moduleGraph.getModulesByFile(id) ?? [],
|
|
2245
|
+
...ctx.server.moduleGraph.getModulesByFile((0, _weapp_tailwindcss_shared.cleanUrl)(id)) ?? []
|
|
2246
|
+
];
|
|
2247
|
+
for (const mod of candidates) collectModule(mod);
|
|
2168
2248
|
}
|
|
2169
2249
|
return modules;
|
|
2170
2250
|
};
|
|
2251
|
+
const resolveModuleHotUrl = (mod) => {
|
|
2252
|
+
if (typeof mod.url === "string" && mod.url.length > 0) return mod.url;
|
|
2253
|
+
if (typeof mod.id === "string" && mod.id.startsWith("/")) return mod.id;
|
|
2254
|
+
};
|
|
2255
|
+
const includesHotModule = (modules, target) => {
|
|
2256
|
+
const targetUrl = resolveModuleHotUrl(target);
|
|
2257
|
+
const targetId = target.id;
|
|
2258
|
+
return modules.some((mod) => {
|
|
2259
|
+
if (mod === target) return true;
|
|
2260
|
+
return targetUrl !== void 0 && resolveModuleHotUrl(mod) === targetUrl || typeof targetId === "string" && targetId.length > 0 && mod.id === targetId;
|
|
2261
|
+
});
|
|
2262
|
+
};
|
|
2263
|
+
const sendSupplementalCssHotUpdates = (ctx, cssModules) => {
|
|
2264
|
+
const updates = cssModules.filter((mod) => !includesHotModule(ctx.modules, mod)).map((mod) => {
|
|
2265
|
+
const hotUrl = resolveModuleHotUrl(mod);
|
|
2266
|
+
if (!hotUrl) return;
|
|
2267
|
+
return {
|
|
2268
|
+
type: "js-update",
|
|
2269
|
+
timestamp: ctx.timestamp,
|
|
2270
|
+
path: hotUrl,
|
|
2271
|
+
acceptedPath: hotUrl,
|
|
2272
|
+
explicitImportRequired: false,
|
|
2273
|
+
isWithinCircularImport: false
|
|
2274
|
+
};
|
|
2275
|
+
}).filter((update) => update !== void 0);
|
|
2276
|
+
if (updates.length === 0) return;
|
|
2277
|
+
queueMicrotask(() => {
|
|
2278
|
+
ctx.server.ws?.send?.({
|
|
2279
|
+
type: "update",
|
|
2280
|
+
updates
|
|
2281
|
+
});
|
|
2282
|
+
});
|
|
2283
|
+
};
|
|
2171
2284
|
const matchesViteProcessedCssSource = (candidate) => {
|
|
2172
2285
|
const normalized = normalizeViteProcessedCssFile(candidate);
|
|
2173
2286
|
return viteProcessedCssSourceFiles.has(normalized);
|
|
@@ -2268,7 +2381,6 @@ function WeappTailwindcss(options = {}) {
|
|
|
2268
2381
|
});
|
|
2269
2382
|
const isIosPlatform = require_utils.resolveUniUtsPlatform().isAppIos;
|
|
2270
2383
|
const prepareTailwindGeneration = async () => {
|
|
2271
|
-
if (isWebGeneratorTarget && runtimeState.twPatcher.majorVersion !== 3) return;
|
|
2272
2384
|
if (shouldDiscoverAutoCssSources()) await discoverAndRegisterAutoCssSources();
|
|
2273
2385
|
await syncSourceCandidateScan();
|
|
2274
2386
|
};
|
|
@@ -2323,6 +2435,7 @@ function WeappTailwindcss(options = {}) {
|
|
|
2323
2435
|
await syncChangedSourceCandidateFile(ctx.file);
|
|
2324
2436
|
invalidateRecordedGeneratorCandidates();
|
|
2325
2437
|
const cssModules = resolveHotTailwindCssModules(ctx);
|
|
2438
|
+
sendSupplementalCssHotUpdates(ctx, cssModules);
|
|
2326
2439
|
return cssModules.length > 0 ? [...ctx.modules, ...cssModules] : void 0;
|
|
2327
2440
|
}, { emit: false });
|
|
2328
2441
|
},
|
|
@@ -2332,6 +2445,12 @@ function WeappTailwindcss(options = {}) {
|
|
|
2332
2445
|
}, { emit: false });
|
|
2333
2446
|
}
|
|
2334
2447
|
},
|
|
2448
|
+
...createViteServeCssGenerationPlugins({
|
|
2449
|
+
generateCss: generateTailwindCssForVitePipeline,
|
|
2450
|
+
getCommand: () => resolvedConfig?.command,
|
|
2451
|
+
onTailwindRootCss: (id, code) => registerAutoCssSource(id, code),
|
|
2452
|
+
shouldGenerate: () => shouldOwnTailwindGeneration
|
|
2453
|
+
}),
|
|
2335
2454
|
{
|
|
2336
2455
|
name: `${require_precheck.vitePluginName}:post`,
|
|
2337
2456
|
enforce: "post",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { B as createDebug, E as filterUnsupportedMiniProgramTailwindV4Candidates, J as findNearestPackageRoot, U as findTailwindConfig, W as resolveTailwindcssOptions, _ as resolveViteSourceScanEntries, g as resolveTailwindV4EntriesFromCssCached, l as getRuntimeClassSetSignature, m as discoverTailwindV4CssEntries, p as createViteSourceScanMatcher, q as omitUndefined, v as resolveViteTailwindV4CssDependencies } from "./v3-engine-
|
|
2
|
-
import { i as normalizeWeappTailwindcssGeneratorOptions } from "./generator-
|
|
3
|
-
import { a as validateCandidatesByGenerator, c as hasTailwindSourceDirectives, i as generateCssByGenerator, l as normalizeTailwindSourceForGenerator, n as createHmrTimingRecorder, o as processCachedTask, s as hasTailwindRootDirectives, t as createBundleRuntimeClassSetManager, u as hasTailwindGeneratedCssMarkers } from "./incremental-runtime-class-set-
|
|
4
|
-
import { _ as
|
|
1
|
+
import { B as createDebug, E as filterUnsupportedMiniProgramTailwindV4Candidates, J as findNearestPackageRoot, U as findTailwindConfig, W as resolveTailwindcssOptions, _ as resolveViteSourceScanEntries, g as resolveTailwindV4EntriesFromCssCached, l as getRuntimeClassSetSignature, m as discoverTailwindV4CssEntries, p as createViteSourceScanMatcher, q as omitUndefined, v as resolveViteTailwindV4CssDependencies } from "./v3-engine-CPJ9uGyr.mjs";
|
|
2
|
+
import { i as normalizeWeappTailwindcssGeneratorOptions } from "./generator-iI_265gt.mjs";
|
|
3
|
+
import { a as validateCandidatesByGenerator, c as hasTailwindSourceDirectives, i as generateCssByGenerator, l as normalizeTailwindSourceForGenerator, n as createHmrTimingRecorder, o as processCachedTask, s as hasTailwindRootDirectives, t as createBundleRuntimeClassSetManager, u as hasTailwindGeneratedCssMarkers } from "./incremental-runtime-class-set-ECHyKwUL.mjs";
|
|
4
|
+
import { _ as collectRuntimeClassSet, a as vitePluginName, b as refreshTailwindRuntimeState, c as createAttributeMatcher, d as _defineProperty, f as isClassContextLiteralPath, g as toCustomAttributesEntities, l as analyzeSource, m as babelParse, n as getCompilerContext, p as replaceWxml, s as generateCode, t as shouldSkipJsTransform, u as JsTokenUpdater, v as createTailwindRuntimeReadyPromise } from "./precheck-BI8oBeUg.mjs";
|
|
5
5
|
import { o as resolveUniUtsPlatform } from "./utils-B2SJgA1L.mjs";
|
|
6
|
-
import { c as upsertTailwindV4CssSource, i as resolveUniAppXOptions, r as isUniAppXEnabled, s as hasConfiguredTailwindV4CssRoots } from "./tailwindcss-
|
|
7
|
-
import { n as isSourceCandidateRequest, t as createSourceCandidateCollector } from "./source-candidates-
|
|
8
|
-
import { a as createBundleModuleGraphOptions, b as toAbsoluteOutputPath, c as hasBundlerGeneratedCssMarker, d as resolvePluginDisabledState, f as cleanUrl, g as isSourceStyleRequest, h as slash, i as applyLinkedResults, l as stripBundlerGeneratedCssMarkers, m as isCSSRequest, n as createBundleBuildState, o as pushConcurrentTaskFactories, p as formatPostcssSourceMap, r as updateBundleBuildState, s as createBundlerGeneratedCssMarker, t as buildBundleSnapshot, u as resolvePackageDir, v as normalizeOutputPathKey } from "./bundle-state-
|
|
6
|
+
import { c as upsertTailwindV4CssSource, i as resolveUniAppXOptions, r as isUniAppXEnabled, s as hasConfiguredTailwindV4CssRoots } from "./tailwindcss-DFa5Yes8.mjs";
|
|
7
|
+
import { n as isSourceCandidateRequest, t as createSourceCandidateCollector } from "./source-candidates-DkScNh9A.mjs";
|
|
8
|
+
import { a as createBundleModuleGraphOptions, b as toAbsoluteOutputPath, c as hasBundlerGeneratedCssMarker, d as resolvePluginDisabledState, f as cleanUrl, g as isSourceStyleRequest, h as slash, i as applyLinkedResults, l as stripBundlerGeneratedCssMarkers, m as isCSSRequest, n as createBundleBuildState, o as pushConcurrentTaskFactories, p as formatPostcssSourceMap, r as updateBundleBuildState, s as createBundlerGeneratedCssMarker, t as buildBundleSnapshot, u as resolvePackageDir, v as normalizeOutputPathKey } from "./bundle-state-CWcrb3mH.mjs";
|
|
9
9
|
import { t as logger$1 } from "./logger-Dr7IvyH2.mjs";
|
|
10
10
|
import fs, { existsSync, readFileSync } from "node:fs";
|
|
11
11
|
import postcss from "postcss";
|
|
@@ -1805,6 +1805,83 @@ function createViteRuntimeClassSet(options) {
|
|
|
1805
1805
|
};
|
|
1806
1806
|
}
|
|
1807
1807
|
//#endregion
|
|
1808
|
+
//#region src/bundlers/vite/serve-css-generation.ts
|
|
1809
|
+
const SPECIAL_QUERY_RE = /[?&](?:worker|sharedworker|raw|url)\b/;
|
|
1810
|
+
const COMMON_JS_PROXY_RE = /\?commonjs-proxy/;
|
|
1811
|
+
const VITE_CSS_HMR_MODULE_RE = /\b__vite__updateStyle\s*\(/;
|
|
1812
|
+
const VITE_CSS_CONST_RE = /\bconst\s+__vite__css\s*=\s*("(?:\\[\s\S]|[^"])*")/;
|
|
1813
|
+
function decodeJsStringLiteral(literal) {
|
|
1814
|
+
try {
|
|
1815
|
+
return JSON.parse(literal);
|
|
1816
|
+
} catch {
|
|
1817
|
+
return;
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1820
|
+
function encodeJsStringLiteral(value) {
|
|
1821
|
+
return JSON.stringify(value);
|
|
1822
|
+
}
|
|
1823
|
+
function extractViteCssHmrModuleCss(code) {
|
|
1824
|
+
const match = VITE_CSS_CONST_RE.exec(code);
|
|
1825
|
+
if (!match?.[1]) return;
|
|
1826
|
+
const css = decodeJsStringLiteral(match[1]);
|
|
1827
|
+
if (typeof css !== "string") return;
|
|
1828
|
+
return {
|
|
1829
|
+
css,
|
|
1830
|
+
start: match.index + match[0].lastIndexOf(match[1]),
|
|
1831
|
+
end: match.index + match[0].length
|
|
1832
|
+
};
|
|
1833
|
+
}
|
|
1834
|
+
function replaceViteCssHmrModuleCss(code, css) {
|
|
1835
|
+
const extracted = extractViteCssHmrModuleCss(code);
|
|
1836
|
+
if (!extracted) return;
|
|
1837
|
+
return `${code.slice(0, extracted.start)}${encodeJsStringLiteral(css)}${code.slice(extracted.end)}`;
|
|
1838
|
+
}
|
|
1839
|
+
function isViteServeStyleRequest(id, command) {
|
|
1840
|
+
return command === "serve" && isSourceStyleRequest(id) && !SPECIAL_QUERY_RE.test(id) && !COMMON_JS_PROXY_RE.test(id);
|
|
1841
|
+
}
|
|
1842
|
+
function isViteServeCssRootRequest(id, command) {
|
|
1843
|
+
return command === "serve" && isCSSRequest(id) && !SPECIAL_QUERY_RE.test(id) && !COMMON_JS_PROXY_RE.test(id);
|
|
1844
|
+
}
|
|
1845
|
+
function isViteCssHmrModule(code, id, command) {
|
|
1846
|
+
return isViteServeStyleRequest(id, command) && VITE_CSS_HMR_MODULE_RE.test(code) && /[?&](?:direct|vue)(?:&|$)/.test(id);
|
|
1847
|
+
}
|
|
1848
|
+
function createViteServeCssGenerationPlugins(options) {
|
|
1849
|
+
return [{
|
|
1850
|
+
name: `${vitePluginName}:generate:serve`,
|
|
1851
|
+
apply: "serve",
|
|
1852
|
+
enforce: "pre",
|
|
1853
|
+
async transform(code, id) {
|
|
1854
|
+
if (!options.shouldGenerate() || !isViteServeCssRootRequest(id, options.getCommand())) return;
|
|
1855
|
+
if (!hasTailwindRootDirectives(code)) return;
|
|
1856
|
+
await options.onTailwindRootCss?.(id, code);
|
|
1857
|
+
const generatedCss = await options.generateCss(id, code, this);
|
|
1858
|
+
if (generatedCss === void 0 || generatedCss === code) return;
|
|
1859
|
+
return {
|
|
1860
|
+
code: generatedCss,
|
|
1861
|
+
map: null
|
|
1862
|
+
};
|
|
1863
|
+
}
|
|
1864
|
+
}, {
|
|
1865
|
+
name: `${vitePluginName}:generate:serve-hmr`,
|
|
1866
|
+
apply: "serve",
|
|
1867
|
+
enforce: "post",
|
|
1868
|
+
async transform(code, id) {
|
|
1869
|
+
if (!options.shouldGenerate() || !isViteCssHmrModule(code, id, options.getCommand())) return;
|
|
1870
|
+
const extracted = extractViteCssHmrModuleCss(code);
|
|
1871
|
+
if (!extracted) return;
|
|
1872
|
+
await options.onTailwindRootCss?.(id, extracted.css);
|
|
1873
|
+
const generatedCss = await options.generateCss(id, extracted.css, this);
|
|
1874
|
+
if (generatedCss === void 0 || generatedCss === extracted.css) return;
|
|
1875
|
+
const nextCode = replaceViteCssHmrModuleCss(code, generatedCss);
|
|
1876
|
+
if (nextCode === void 0 || nextCode === code) return;
|
|
1877
|
+
return {
|
|
1878
|
+
code: nextCode,
|
|
1879
|
+
map: null
|
|
1880
|
+
};
|
|
1881
|
+
}
|
|
1882
|
+
}];
|
|
1883
|
+
}
|
|
1884
|
+
//#endregion
|
|
1808
1885
|
//#region src/bundlers/vite/tailwind-basedir.ts
|
|
1809
1886
|
const PACKAGE_JSON_FILE = "package.json";
|
|
1810
1887
|
function resolveImplicitTailwindcssBasedirFromViteRoot(root) {
|
|
@@ -1876,7 +1953,6 @@ function WeappTailwindcss(options = {}) {
|
|
|
1876
1953
|
const shouldOwnTailwindGeneration = !disabledOptions.plugin;
|
|
1877
1954
|
const shouldRewriteCssImports = tailwindcssMajorVersion >= 4;
|
|
1878
1955
|
const generatorOptions = normalizeWeappTailwindcssGeneratorOptions(opts.generator);
|
|
1879
|
-
const isWebGeneratorTarget = generatorOptions.target === "web";
|
|
1880
1956
|
const shouldInferAppType = !hasExplicitAppType && generatorOptions.target !== "web";
|
|
1881
1957
|
const hasInitialTailwindCssRoots = hasConfiguredTailwindV4CssRoots({
|
|
1882
1958
|
...options,
|
|
@@ -2145,20 +2221,57 @@ function WeappTailwindcss(options = {}) {
|
|
|
2145
2221
|
const resolveHotTailwindCssModules = (ctx) => {
|
|
2146
2222
|
const modules = [];
|
|
2147
2223
|
const seenModules = /* @__PURE__ */ new Set();
|
|
2224
|
+
const collectModule = (mod) => {
|
|
2225
|
+
if (mod == null || seenModules.has(mod)) return;
|
|
2226
|
+
if (!isSourceStyleRequest(mod.id ?? mod.url)) return;
|
|
2227
|
+
seenModules.add(mod);
|
|
2228
|
+
ctx.server.moduleGraph.invalidateModule(mod);
|
|
2229
|
+
modules.push(mod);
|
|
2230
|
+
};
|
|
2148
2231
|
for (const id of tailwindRootCssModuleIds) {
|
|
2149
|
-
const candidates = [
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
ctx.server.moduleGraph.invalidateModule(mod);
|
|
2157
|
-
modules.push(mod);
|
|
2158
|
-
}
|
|
2232
|
+
const candidates = [
|
|
2233
|
+
ctx.server.moduleGraph.getModuleById(id),
|
|
2234
|
+
ctx.server.moduleGraph.getModuleById(cleanUrl(id)),
|
|
2235
|
+
...ctx.server.moduleGraph.getModulesByFile(id) ?? [],
|
|
2236
|
+
...ctx.server.moduleGraph.getModulesByFile(cleanUrl(id)) ?? []
|
|
2237
|
+
];
|
|
2238
|
+
for (const mod of candidates) collectModule(mod);
|
|
2159
2239
|
}
|
|
2160
2240
|
return modules;
|
|
2161
2241
|
};
|
|
2242
|
+
const resolveModuleHotUrl = (mod) => {
|
|
2243
|
+
if (typeof mod.url === "string" && mod.url.length > 0) return mod.url;
|
|
2244
|
+
if (typeof mod.id === "string" && mod.id.startsWith("/")) return mod.id;
|
|
2245
|
+
};
|
|
2246
|
+
const includesHotModule = (modules, target) => {
|
|
2247
|
+
const targetUrl = resolveModuleHotUrl(target);
|
|
2248
|
+
const targetId = target.id;
|
|
2249
|
+
return modules.some((mod) => {
|
|
2250
|
+
if (mod === target) return true;
|
|
2251
|
+
return targetUrl !== void 0 && resolveModuleHotUrl(mod) === targetUrl || typeof targetId === "string" && targetId.length > 0 && mod.id === targetId;
|
|
2252
|
+
});
|
|
2253
|
+
};
|
|
2254
|
+
const sendSupplementalCssHotUpdates = (ctx, cssModules) => {
|
|
2255
|
+
const updates = cssModules.filter((mod) => !includesHotModule(ctx.modules, mod)).map((mod) => {
|
|
2256
|
+
const hotUrl = resolveModuleHotUrl(mod);
|
|
2257
|
+
if (!hotUrl) return;
|
|
2258
|
+
return {
|
|
2259
|
+
type: "js-update",
|
|
2260
|
+
timestamp: ctx.timestamp,
|
|
2261
|
+
path: hotUrl,
|
|
2262
|
+
acceptedPath: hotUrl,
|
|
2263
|
+
explicitImportRequired: false,
|
|
2264
|
+
isWithinCircularImport: false
|
|
2265
|
+
};
|
|
2266
|
+
}).filter((update) => update !== void 0);
|
|
2267
|
+
if (updates.length === 0) return;
|
|
2268
|
+
queueMicrotask(() => {
|
|
2269
|
+
ctx.server.ws?.send?.({
|
|
2270
|
+
type: "update",
|
|
2271
|
+
updates
|
|
2272
|
+
});
|
|
2273
|
+
});
|
|
2274
|
+
};
|
|
2162
2275
|
const matchesViteProcessedCssSource = (candidate) => {
|
|
2163
2276
|
const normalized = normalizeViteProcessedCssFile(candidate);
|
|
2164
2277
|
return viteProcessedCssSourceFiles.has(normalized);
|
|
@@ -2259,7 +2372,6 @@ function WeappTailwindcss(options = {}) {
|
|
|
2259
2372
|
});
|
|
2260
2373
|
const isIosPlatform = resolveUniUtsPlatform().isAppIos;
|
|
2261
2374
|
const prepareTailwindGeneration = async () => {
|
|
2262
|
-
if (isWebGeneratorTarget && runtimeState.twPatcher.majorVersion !== 3) return;
|
|
2263
2375
|
if (shouldDiscoverAutoCssSources()) await discoverAndRegisterAutoCssSources();
|
|
2264
2376
|
await syncSourceCandidateScan();
|
|
2265
2377
|
};
|
|
@@ -2314,6 +2426,7 @@ function WeappTailwindcss(options = {}) {
|
|
|
2314
2426
|
await syncChangedSourceCandidateFile(ctx.file);
|
|
2315
2427
|
invalidateRecordedGeneratorCandidates();
|
|
2316
2428
|
const cssModules = resolveHotTailwindCssModules(ctx);
|
|
2429
|
+
sendSupplementalCssHotUpdates(ctx, cssModules);
|
|
2317
2430
|
return cssModules.length > 0 ? [...ctx.modules, ...cssModules] : void 0;
|
|
2318
2431
|
}, { emit: false });
|
|
2319
2432
|
},
|
|
@@ -2323,6 +2436,12 @@ function WeappTailwindcss(options = {}) {
|
|
|
2323
2436
|
}, { emit: false });
|
|
2324
2437
|
}
|
|
2325
2438
|
},
|
|
2439
|
+
...createViteServeCssGenerationPlugins({
|
|
2440
|
+
generateCss: generateTailwindCssForVitePipeline,
|
|
2441
|
+
getCommand: () => resolvedConfig?.command,
|
|
2442
|
+
onTailwindRootCss: (id, code) => registerAutoCssSource(id, code),
|
|
2443
|
+
shouldGenerate: () => shouldOwnTailwindGeneration
|
|
2444
|
+
}),
|
|
2326
2445
|
{
|
|
2327
2446
|
name: `${vitePluginName}:post`,
|
|
2328
2447
|
enforce: "post",
|
package/dist/vite.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_vite = require("./vite-
|
|
2
|
+
const require_vite = require("./vite-BM_ksf1q.js");
|
|
3
3
|
exports.WeappTailwindcss = require_vite.WeappTailwindcss;
|
|
4
4
|
exports.weappTailwindcss = require_vite.WeappTailwindcss;
|
package/dist/vite.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as WeappTailwindcss } from "./vite-
|
|
1
|
+
import { t as WeappTailwindcss } from "./vite-CqEF-Wx5.mjs";
|
|
2
2
|
export { WeappTailwindcss, WeappTailwindcss as weappTailwindcss };
|
|
@@ -31,7 +31,6 @@ require("@babel/parser");
|
|
|
31
31
|
require("@babel/types");
|
|
32
32
|
require("@ast-core/escape");
|
|
33
33
|
require("@weapp-tailwindcss/shared/extractors");
|
|
34
|
-
require("htmlparser2");
|
|
35
34
|
//#region src/bundlers/shared/css-imports.ts
|
|
36
35
|
const tailwindcssImportRE = /^(?:tailwindcss|weapp-tailwindcss)(?:\/.*)?$/;
|
|
37
36
|
const tailwindcssCssImportStatementRE = /(@import\s+(?:url\(\s*)?)(["'])((?:tailwindcss|weapp-tailwindcss)(?:\/[^"']*)?\$?)(\2\s*\)?)/gi;
|
|
@@ -197,10 +196,10 @@ const creator = () => {
|
|
|
197
196
|
];
|
|
198
197
|
atRule.replaceWith(nextNodes);
|
|
199
198
|
startComment.raws.before = hasPreviousNode ? "\n" : "";
|
|
200
|
-
startComment.raws
|
|
199
|
+
startComment.raws["after"] = "\n";
|
|
201
200
|
if (clonedNodes[0]) clonedNodes[0].raws.before = "\n";
|
|
202
201
|
endComment.raws.before = "\n";
|
|
203
|
-
endComment.raws
|
|
202
|
+
endComment.raws["after"] = "\n";
|
|
204
203
|
const nextNode = endComment?.next();
|
|
205
204
|
if (nextNode) nextNode.raws.before = "\n";
|
|
206
205
|
}
|
|
@@ -235,10 +234,10 @@ const creator = () => {
|
|
|
235
234
|
if ((parentRule.nodes?.length ?? 0) === 0) parentRule.replaceWith(nextNodes);
|
|
236
235
|
else parentRule.after(nextNodes);
|
|
237
236
|
startComment.raws.before = hasPreviousNode ? "\n" : "";
|
|
238
|
-
startComment.raws
|
|
237
|
+
startComment.raws["after"] = "\n";
|
|
239
238
|
conditionalRule.raws.before = "\n";
|
|
240
239
|
endComment.raws.before = "\n";
|
|
241
|
-
endComment.raws
|
|
240
|
+
endComment.raws["after"] = "\n";
|
|
242
241
|
const nextNode = endComment.next();
|
|
243
242
|
if (nextNode) nextNode.raws.before = "\n";
|
|
244
243
|
return true;
|
|
@@ -319,11 +318,9 @@ function withCssMacroPostcssPlugins(plugins) {
|
|
|
319
318
|
if (!plugins) return [macroPlugin];
|
|
320
319
|
if (Array.isArray(plugins)) return plugins.some(isCssMacroPostcssPlugin) ? plugins : [...plugins, macroPlugin];
|
|
321
320
|
if (typeof plugins === "object") {
|
|
322
|
-
|
|
323
|
-
return
|
|
324
|
-
|
|
325
|
-
[CSS_MACRO_POSTCSS_PLUGIN_NAME]: macroPlugin
|
|
326
|
-
};
|
|
321
|
+
const values = Object.values(plugins).filter(Boolean);
|
|
322
|
+
if (values.some(isCssMacroPostcssPlugin)) return values;
|
|
323
|
+
return [...values, macroPlugin];
|
|
327
324
|
}
|
|
328
325
|
return [macroPlugin];
|
|
329
326
|
}
|