weapp-tailwindcss 5.0.0-next.2 → 5.0.0-next.21
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/README.md +6 -7
- package/bin/weapp-tailwindcss.js +1 -21
- package/dist/bundle-state-BnV8o2Yn.js +530 -0
- package/dist/bundle-state-CLnuf2CW.mjs +414 -0
- package/dist/bundlers/shared/cache.d.ts +6 -6
- package/dist/bundlers/shared/css-cleanup/at-rules.d.ts +1 -0
- package/dist/bundlers/shared/css-cleanup.d.ts +1 -4
- package/dist/bundlers/shared/css-imports.d.ts +3 -3
- package/dist/bundlers/shared/generated-css-marker.d.ts +3 -0
- package/dist/bundlers/shared/generator-css/config-directive.d.ts +2 -0
- package/dist/bundlers/shared/generator-css/directives.d.ts +20 -0
- package/dist/bundlers/shared/generator-css/legacy-compat.d.ts +7 -0
- package/dist/bundlers/shared/generator-css/legacy-selectors.d.ts +5 -0
- package/dist/bundlers/shared/generator-css/legacy-units.d.ts +1 -0
- package/dist/bundlers/shared/generator-css/markers.d.ts +28 -0
- package/dist/bundlers/shared/generator-css/source-files.d.ts +14 -0
- package/dist/bundlers/shared/generator-css/source-resolver.d.ts +24 -0
- package/dist/bundlers/shared/generator-css.d.ts +16 -22
- package/dist/bundlers/shared/hmr-timing.d.ts +22 -0
- package/dist/bundlers/shared/style-requests.d.ts +2 -0
- package/dist/bundlers/vite/bundle-state.d.ts +1 -0
- package/dist/bundlers/vite/css-finalizer.d.ts +7 -1
- package/dist/bundlers/vite/generate-bundle/candidates.d.ts +2 -0
- package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +24 -0
- package/dist/bundlers/vite/generate-bundle/css-share-scope.d.ts +4 -0
- package/dist/bundlers/vite/generate-bundle/dirty-state.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/js-entries.d.ts +2 -0
- package/dist/bundlers/vite/generate-bundle/js-handler-options.d.ts +8 -0
- package/dist/bundlers/vite/generate-bundle/js-linking.d.ts +13 -0
- package/dist/bundlers/vite/generate-bundle/metrics.d.ts +17 -0
- package/dist/bundlers/vite/generate-bundle/process-plan.d.ts +9 -0
- package/dist/bundlers/vite/generate-bundle/rollup-assets.d.ts +7 -0
- package/dist/bundlers/vite/generate-bundle/signatures.d.ts +8 -0
- package/dist/bundlers/vite/generate-bundle.d.ts +14 -2
- package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +5 -1
- package/dist/bundlers/vite/index.d.ts +1 -1
- package/dist/bundlers/vite/official-tailwind-plugins.d.ts +5 -0
- package/dist/bundlers/vite/postcss-config.d.ts +6 -0
- package/dist/bundlers/vite/processed-css-assets.d.ts +32 -0
- package/dist/bundlers/vite/rewrite-css-imports.d.ts +8 -3
- package/dist/bundlers/vite/runtime-class-set.d.ts +25 -0
- package/dist/bundlers/vite/source-candidates.d.ts +16 -1
- package/dist/bundlers/vite/source-scan.d.ts +26 -0
- package/dist/bundlers/vite/static-config-content.d.ts +5 -0
- package/dist/bundlers/vite/tailwind-basedir.d.ts +1 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +6 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +6 -2
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +9 -3
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +1 -0
- package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +31 -0
- package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +2 -6
- package/dist/bundlers/webpack/loaders/weapp-tw-runtime-classset-loader.d.ts +3 -7
- package/dist/cache/index.d.ts +6 -6
- package/dist/cli/context.d.ts +1 -14
- package/dist/cli/doctor/types.d.ts +11 -11
- package/dist/cli/helpers.d.ts +1 -2
- package/dist/cli/mount-options.d.ts +2 -0
- package/dist/cli/types.d.ts +0 -2
- package/dist/cli/vscode-entry.d.ts +3 -3
- package/dist/cli.js +605 -611
- package/dist/cli.mjs +614 -620
- package/dist/constants.d.ts +1 -2
- package/dist/core.js +13 -20
- package/dist/core.mjs +8 -14
- package/dist/css-macro/postcss.js +3 -2
- package/dist/css-macro/postcss.mjs +3 -2
- package/dist/css-macro.d.ts +1 -0
- package/dist/css-macro.js +2 -2
- package/dist/css-macro.mjs +2 -2
- package/dist/defaults-B1igPF_e.mjs +150 -0
- package/dist/defaults-IHhYxNeU.js +193 -0
- package/dist/defaults.d.ts +15 -1
- package/dist/defaults.js +6 -131
- package/dist/defaults.mjs +2 -129
- package/dist/escape.js +10 -2
- package/dist/escape.mjs +10 -2
- package/dist/generator/index.d.ts +1 -1
- package/dist/generator/options.d.ts +9 -8
- package/dist/generator/types.d.ts +3 -3
- package/dist/generator-B4RNgMLx.js +55 -0
- package/dist/generator-DvyhmC76.mjs +32 -0
- package/dist/generator.js +12 -11
- package/dist/generator.mjs +2 -1
- package/dist/gulp.js +185 -47
- package/dist/gulp.mjs +179 -41
- package/dist/incremental-runtime-class-set-C7Q7fC5u.mjs +1863 -0
- package/dist/incremental-runtime-class-set-DZsbM0-a.js +1926 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -6
- package/dist/index.mjs +5 -5
- package/dist/js/babel/cache-options.d.ts +3 -0
- package/dist/js/babel/parse.d.ts +7 -4
- package/dist/js/index.d.ts +1 -0
- package/dist/js/literal-transform.d.ts +2 -0
- package/dist/js/precheck.d.ts +2 -2
- package/dist/logger-CZUxvJJD.mjs +2 -0
- package/dist/logger-EVNB9z7i.js +1 -0
- package/dist/postcss/config-directive.d.ts +1 -0
- package/dist/postcss/context.d.ts +9 -0
- package/dist/postcss/source-files.d.ts +8 -0
- package/dist/postcss/tailwind-version.d.ts +3 -0
- package/dist/postcss-CFa6-qO9.js +237 -0
- package/dist/postcss-Drpy7j-g.mjs +228 -0
- package/dist/postcss.d.ts +2 -2
- package/dist/postcss.js +3 -276
- package/dist/postcss.mjs +1 -269
- package/dist/{recorder-gYSNLfOP.js → precheck-8pQbjqpq.js} +218 -314
- package/dist/{recorder-zsgatmkB.mjs → precheck-D1O5AWzy.mjs} +186 -281
- package/dist/presets.js +13 -11
- package/dist/presets.mjs +11 -9
- package/dist/reset.d.ts +1 -0
- package/dist/runtime-registry-CdCV3Opt.js +5496 -0
- package/dist/shared/mpx.d.ts +1 -0
- package/dist/source-candidates-CUTNdsiz.js +222 -0
- package/dist/source-candidates-CnD4vyic.mjs +209 -0
- package/dist/tailwindcss/miniprogram.d.ts +1 -1
- package/dist/tailwindcss/patcher-options.d.ts +3 -51
- package/dist/tailwindcss/patcher.d.ts +1 -2
- package/dist/tailwindcss/remove-unsupported-css.d.ts +1 -2
- package/dist/tailwindcss/runtime/cache.d.ts +4 -3
- package/dist/tailwindcss/runtime-patch.d.ts +5 -0
- package/dist/tailwindcss/runtime.d.ts +11 -12
- package/dist/tailwindcss/source-scan.d.ts +35 -0
- package/dist/tailwindcss/targets.d.ts +1 -5
- package/dist/tailwindcss/v3-engine/types.d.ts +17 -14
- package/dist/tailwindcss/v4/css-entries.d.ts +2 -2
- package/dist/tailwindcss/v4/css-sources.d.ts +5 -0
- package/dist/tailwindcss/v4/patcher-options.d.ts +1 -23
- package/dist/tailwindcss/v4/patcher.d.ts +1 -0
- package/dist/tailwindcss/v4-engine/source.d.ts +2 -2
- package/dist/tailwindcss/v4-engine/types.d.ts +17 -5
- package/dist/tailwindcss/version.d.ts +4 -0
- package/dist/tailwindcss-B_JAdOQf.mjs +600 -0
- package/dist/tailwindcss-whZE3HpL.js +651 -0
- package/dist/typedoc.export.d.ts +0 -2
- package/dist/types/index.d.ts +51 -48
- package/dist/types/shared.d.ts +3 -0
- package/dist/types/user-defined-options/general.d.ts +23 -23
- package/dist/types/user-defined-options/important.d.ts +31 -28
- package/dist/types/user-defined-options/lifecycle.d.ts +4 -4
- package/dist/types/user-defined-options/matcher.d.ts +6 -6
- package/dist/uni-app-x/vite.d.ts +1 -1
- package/dist/utils/disabled.d.ts +2 -3
- package/dist/utils/object.d.ts +9 -0
- package/dist/{utils-DmC9_In3.js → utils-4ODFyoqD.js} +1 -1
- package/dist/{utils-7DUGTFED.mjs → utils-CGBVVNm6.mjs} +1 -1
- package/dist/v3-engine-CCwvhRrQ.js +3473 -0
- package/dist/v3-engine-DyIcbpZm.mjs +3190 -0
- package/dist/{vite-CrlzCNqz.mjs → vite-B8IiXgVD.mjs} +1256 -1088
- package/dist/vite-BcnwgJMt.js +2368 -0
- package/dist/vite.d.ts +1 -2
- package/dist/vite.js +3 -4
- package/dist/vite.mjs +2 -2
- package/dist/weapp-tw-css-import-rewrite-loader.js +4533 -16
- package/dist/weapp-tw-runtime-classset-loader.js +33 -7
- package/dist/webpack-C4zI624R.js +846 -0
- package/dist/webpack-DTkshAtp.mjs +836 -0
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +27 -37
- package/dist/bundlers/shared/generator-candidates.d.ts +0 -5
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-assets.d.ts +0 -14
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-loaders.d.ts +0 -15
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v4.d.ts +0 -9
- package/dist/bundlers/webpack/shared/css-imports.d.ts +0 -6
- package/dist/cli/config.d.ts +0 -5
- package/dist/cli/helpers/patch-cwd.d.ts +0 -1
- package/dist/cli/mount-options/patch-status.d.ts +0 -2
- package/dist/cli/patch-options.d.ts +0 -6
- package/dist/cli/tokens.d.ts +0 -4
- package/dist/cli/workspace/package-dirs.d.ts +0 -3
- package/dist/cli/workspace/patch-package.d.ts +0 -3
- package/dist/cli/workspace/patch-utils.d.ts +0 -3
- package/dist/cli/workspace/types.d.ts +0 -11
- package/dist/cli/workspace/workspace-globs.d.ts +0 -2
- package/dist/cli/workspace/workspace-io.d.ts +0 -1
- package/dist/cli/workspace/workspace-lock.d.ts +0 -1
- package/dist/cli/workspace.d.ts +0 -2
- package/dist/css-imports-BbrbluP9.js +0 -177
- package/dist/css-imports-CSdPq_Sc.mjs +0 -128
- package/dist/experimental/index.d.ts +0 -2
- package/dist/experimental/oxc/ast-utils.d.ts +0 -30
- package/dist/experimental/oxc/index.d.ts +0 -2
- package/dist/experimental/oxc/module-specifiers.d.ts +0 -2
- package/dist/experimental/shared/cache.d.ts +0 -3
- package/dist/experimental/shared/transform.d.ts +0 -3
- package/dist/experimental/shared.d.ts +0 -8
- package/dist/experimental/swc/ast-utils.d.ts +0 -30
- package/dist/experimental/swc/index.d.ts +0 -2
- package/dist/experimental/swc/module-specifiers.d.ts +0 -2
- package/dist/generator-Y-Ikv4Fu.mjs +0 -1177
- package/dist/generator-css-B5ejWUMv.mjs +0 -1098
- package/dist/generator-css-D3OdPRiS.js +0 -1125
- package/dist/generator-mmhXzZnv.js +0 -1276
- package/dist/js/syntax.d.ts +0 -10
- package/dist/lightningcss/index.d.ts +0 -8
- package/dist/lightningcss/style-handler/options.d.ts +0 -3
- package/dist/lightningcss/style-handler/selector-transform.d.ts +0 -10
- package/dist/lightningcss/style-handler/selector-utils.d.ts +0 -10
- package/dist/lightningcss/style-handler.d.ts +0 -17
- package/dist/loader-anchors-CNkWT8hx.js +0 -273
- package/dist/loader-anchors-TrU7EUr7.mjs +0 -205
- package/dist/logger-BZ45DZJT.js +0 -1003
- package/dist/logger-BoVx1Dbt.mjs +0 -935
- package/dist/patcher-options-6gJN2EXy.js +0 -115
- package/dist/patcher-options-DQfR5xxT.mjs +0 -92
- package/dist/tailwindcss/recorder.d.ts +0 -13
- package/dist/tailwindcss/targets/paths.d.ts +0 -13
- package/dist/tailwindcss/targets/record-io.d.ts +0 -5
- package/dist/tailwindcss/targets/recorder.d.ts +0 -3
- package/dist/tailwindcss/targets/types.d.ts +0 -35
- package/dist/types/disabled-options.d.ts +0 -4
- package/dist/vite-BC9U7ahn.js +0 -2199
- package/dist/webpack-Bu6M-Hbw.mjs +0 -441
- package/dist/webpack-DD7A6V0u.js +0 -456
- package/dist/webpack4.d.ts +0 -4
- package/dist/webpack4.js +0 -387
- package/dist/webpack4.mjs +0 -379
- package/scripts/postinstall.mjs +0 -59
- /package/dist/{constants-B-_T5UnW.mjs → constants-BG12WAKw.mjs} +0 -0
- /package/dist/{constants-p1dyh1x1.js → constants-BeeyfJ9k.js} +0 -0
|
@@ -0,0 +1,3473 @@
|
|
|
1
|
+
const require_chunk = require("./chunk-8l464Juk.js");
|
|
2
|
+
let node_fs = require("node:fs");
|
|
3
|
+
node_fs = require_chunk.__toESM(node_fs);
|
|
4
|
+
let node_module = require("node:module");
|
|
5
|
+
let postcss = require("postcss");
|
|
6
|
+
postcss = require_chunk.__toESM(postcss);
|
|
7
|
+
let node_path = require("node:path");
|
|
8
|
+
node_path = require_chunk.__toESM(node_path);
|
|
9
|
+
let node_process = require("node:process");
|
|
10
|
+
node_process = require_chunk.__toESM(node_process);
|
|
11
|
+
let _weapp_tailwindcss_logger = require("@weapp-tailwindcss/logger");
|
|
12
|
+
let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
|
|
13
|
+
let tailwindcss_patch = require("tailwindcss-patch");
|
|
14
|
+
let node_url = require("node:url");
|
|
15
|
+
let debug = require("debug");
|
|
16
|
+
debug = require_chunk.__toESM(debug);
|
|
17
|
+
let node_fs_promises = require("node:fs/promises");
|
|
18
|
+
let fast_glob = require("fast-glob");
|
|
19
|
+
fast_glob = require_chunk.__toESM(fast_glob);
|
|
20
|
+
let tailwindcss_config = require("tailwindcss-config");
|
|
21
|
+
let micromatch = require("micromatch");
|
|
22
|
+
micromatch = require_chunk.__toESM(micromatch);
|
|
23
|
+
let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
|
|
24
|
+
//#region src/context/workspace.ts
|
|
25
|
+
const IGNORED_WORKSPACE_DIRS = new Set([
|
|
26
|
+
"node_modules",
|
|
27
|
+
".git",
|
|
28
|
+
".hg",
|
|
29
|
+
".svn",
|
|
30
|
+
".turbo",
|
|
31
|
+
".output",
|
|
32
|
+
".next",
|
|
33
|
+
"dist",
|
|
34
|
+
"build"
|
|
35
|
+
]);
|
|
36
|
+
function findWorkspaceRoot(startDir) {
|
|
37
|
+
if (!startDir) return;
|
|
38
|
+
let current = node_path.default.resolve(startDir);
|
|
39
|
+
while (true) {
|
|
40
|
+
if ((0, node_fs.existsSync)(node_path.default.join(current, "pnpm-workspace.yaml"))) return current;
|
|
41
|
+
const parent = node_path.default.dirname(current);
|
|
42
|
+
if (parent === current) return;
|
|
43
|
+
current = parent;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function findNearestPackageRoot(startDir) {
|
|
47
|
+
if (!startDir) return;
|
|
48
|
+
let current = node_path.default.resolve(startDir);
|
|
49
|
+
while (true) {
|
|
50
|
+
if ((0, node_fs.existsSync)(node_path.default.join(current, "package.json"))) return current;
|
|
51
|
+
const parent = node_path.default.dirname(current);
|
|
52
|
+
if (parent === current) return;
|
|
53
|
+
current = parent;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function findWorkspacePackageDir(rootDir, packageName) {
|
|
57
|
+
const visited = /* @__PURE__ */ new Set();
|
|
58
|
+
const queue = [node_path.default.resolve(rootDir)];
|
|
59
|
+
while (queue.length > 0) {
|
|
60
|
+
const current = queue.shift();
|
|
61
|
+
const normalized = node_path.default.normalize(current);
|
|
62
|
+
if (visited.has(normalized)) continue;
|
|
63
|
+
visited.add(normalized);
|
|
64
|
+
try {
|
|
65
|
+
const pkgPath = node_path.default.join(normalized, "package.json");
|
|
66
|
+
if ((0, node_fs.existsSync)(pkgPath)) {
|
|
67
|
+
if (JSON.parse((0, node_fs.readFileSync)(pkgPath, "utf8"))?.name === packageName) return normalized;
|
|
68
|
+
}
|
|
69
|
+
} catch {}
|
|
70
|
+
let entries;
|
|
71
|
+
try {
|
|
72
|
+
entries = (0, node_fs.readdirSync)(normalized, { withFileTypes: true });
|
|
73
|
+
} catch {
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
for (const entry of entries) {
|
|
77
|
+
if (!entry.isDirectory() || IGNORED_WORKSPACE_DIRS.has(entry.name) || entry.isSymbolicLink?.()) continue;
|
|
78
|
+
queue.push(node_path.default.join(normalized, entry.name));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region src/utils/object.ts
|
|
84
|
+
function definedEntries(value) {
|
|
85
|
+
return Object.entries(value).filter(([, item]) => item !== void 0);
|
|
86
|
+
}
|
|
87
|
+
function omitUndefined(value) {
|
|
88
|
+
return Object.fromEntries(definedEntries(value));
|
|
89
|
+
}
|
|
90
|
+
//#endregion
|
|
91
|
+
//#region src/tailwindcss/patcher-options.ts
|
|
92
|
+
function resolveTailwindcssOptions(options) {
|
|
93
|
+
return options?.tailwindcss ?? options?.tailwind;
|
|
94
|
+
}
|
|
95
|
+
function normalizeExtendLengthUnits(value) {
|
|
96
|
+
if (value === false) return false;
|
|
97
|
+
if (value === true) return { enabled: true };
|
|
98
|
+
if (value && typeof value === "object") return {
|
|
99
|
+
enabled: true,
|
|
100
|
+
...value
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function normalizeTailwindcssPatcherOptions(options) {
|
|
104
|
+
return options;
|
|
105
|
+
}
|
|
106
|
+
//#endregion
|
|
107
|
+
//#region src/tailwindcss/patcher-resolve.ts
|
|
108
|
+
const GENERIC_RELATIVE_SPECIFIERS = [".", ".."];
|
|
109
|
+
const DEFAULT_TAILWIND_CONFIG_SPECIFIERS = ["stubs/config.full.js", "defaultConfig.js"];
|
|
110
|
+
const TAILWIND_CONFIG_FILES = [
|
|
111
|
+
"tailwind.config.js",
|
|
112
|
+
"tailwind.config.cjs",
|
|
113
|
+
"tailwind.config.mjs",
|
|
114
|
+
"tailwind.config.ts",
|
|
115
|
+
"tailwind.config.cts",
|
|
116
|
+
"tailwind.config.mts"
|
|
117
|
+
];
|
|
118
|
+
function isPathSpecifier(specifier) {
|
|
119
|
+
if (!specifier) return false;
|
|
120
|
+
if (specifier.startsWith("file://")) return true;
|
|
121
|
+
if (node_path.default.isAbsolute(specifier)) return true;
|
|
122
|
+
return GENERIC_RELATIVE_SPECIFIERS.some((prefix) => specifier.startsWith(`${prefix}/`) || specifier.startsWith(`${prefix}\\`));
|
|
123
|
+
}
|
|
124
|
+
function resolveModuleFromPaths(specifier, paths) {
|
|
125
|
+
if (!specifier || isPathSpecifier(specifier) || paths.length === 0) return;
|
|
126
|
+
try {
|
|
127
|
+
return (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href).resolve(specifier, { paths });
|
|
128
|
+
} catch {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
function resolveTailwindConfigFallback(packageName, paths) {
|
|
133
|
+
if (!packageName) return;
|
|
134
|
+
for (const suffix of DEFAULT_TAILWIND_CONFIG_SPECIFIERS) {
|
|
135
|
+
const resolved = resolveModuleFromPaths(`${packageName}/${suffix}`, paths);
|
|
136
|
+
if (resolved) return resolved;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function appendNodeModules(paths, dir) {
|
|
140
|
+
if (!dir) return;
|
|
141
|
+
const nodeModulesDir = node_path.default.join(dir, "node_modules");
|
|
142
|
+
if ((0, node_fs.existsSync)(nodeModulesDir)) paths.add(nodeModulesDir);
|
|
143
|
+
}
|
|
144
|
+
function findTailwindConfig(searchRoots) {
|
|
145
|
+
for (const root of searchRoots) for (const file of TAILWIND_CONFIG_FILES) {
|
|
146
|
+
const candidate = node_path.default.resolve(root, file);
|
|
147
|
+
if ((0, node_fs.existsSync)(candidate)) return candidate;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
function createDefaultResolvePaths(basedir) {
|
|
151
|
+
const paths = /* @__PURE__ */ new Set();
|
|
152
|
+
let fallbackCandidates = [];
|
|
153
|
+
if (basedir) {
|
|
154
|
+
const resolvedBase = node_path.default.resolve(basedir);
|
|
155
|
+
appendNodeModules(paths, resolvedBase);
|
|
156
|
+
fallbackCandidates.push(resolvedBase);
|
|
157
|
+
const packageRoot = findNearestPackageRoot(resolvedBase);
|
|
158
|
+
if (packageRoot) {
|
|
159
|
+
appendNodeModules(paths, packageRoot);
|
|
160
|
+
fallbackCandidates.push(packageRoot);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
const cwd = node_process.default.cwd();
|
|
164
|
+
appendNodeModules(paths, cwd);
|
|
165
|
+
try {
|
|
166
|
+
const modulePath = (0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href);
|
|
167
|
+
const candidate = (0, node_fs.existsSync)(modulePath) && !node_path.default.extname(modulePath) ? modulePath : node_path.default.dirname(modulePath);
|
|
168
|
+
paths.add(candidate);
|
|
169
|
+
} catch {
|
|
170
|
+
paths.add(require("url").pathToFileURL(__filename).href);
|
|
171
|
+
}
|
|
172
|
+
if (paths.size === 0) {
|
|
173
|
+
fallbackCandidates = fallbackCandidates.filter(Boolean);
|
|
174
|
+
if (fallbackCandidates.length === 0) fallbackCandidates.push(cwd);
|
|
175
|
+
for (const candidate of fallbackCandidates) paths.add(candidate);
|
|
176
|
+
}
|
|
177
|
+
return [...paths];
|
|
178
|
+
}
|
|
179
|
+
//#endregion
|
|
180
|
+
//#region src/tailwindcss/version.ts
|
|
181
|
+
function normalizeSupportedTailwindcssMajorVersion(version) {
|
|
182
|
+
return version === 3 || version === 4 ? version : void 0;
|
|
183
|
+
}
|
|
184
|
+
function readPackageJson(packageJsonPath) {
|
|
185
|
+
try {
|
|
186
|
+
return JSON.parse((0, node_fs.readFileSync)(packageJsonPath, "utf8"));
|
|
187
|
+
} catch {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
function findPackageJsonDeclaringPackage(packageName, base) {
|
|
192
|
+
let current = node_path.default.resolve(base);
|
|
193
|
+
while (true) {
|
|
194
|
+
const pkgPath = node_path.default.join(current, "package.json");
|
|
195
|
+
if ((0, node_fs.existsSync)(pkgPath)) {
|
|
196
|
+
const pkg = readPackageJson(pkgPath);
|
|
197
|
+
if (readDeclaredPackageVersion(packageName, pkg)) return pkgPath;
|
|
198
|
+
if (pkg?.name !== "weapp-tailwindcss") return;
|
|
199
|
+
}
|
|
200
|
+
const parent = node_path.default.dirname(current);
|
|
201
|
+
if (parent === current) return;
|
|
202
|
+
current = parent;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
function readDeclaredPackageVersion(packageName, pkg) {
|
|
206
|
+
return pkg?.dependencies?.[packageName] ?? pkg?.devDependencies?.[packageName] ?? pkg?.peerDependencies?.[packageName] ?? pkg?.optionalDependencies?.[packageName];
|
|
207
|
+
}
|
|
208
|
+
function readDeclaredPackageMajorVersion(version) {
|
|
209
|
+
const match = version?.match(/(?:^|\D)([34])(?:\.|\b)/);
|
|
210
|
+
return normalizeSupportedTailwindcssMajorVersion(match ? Number(match[1]) : void 0);
|
|
211
|
+
}
|
|
212
|
+
function readInstalledPackageMajorVersion(packageName, base) {
|
|
213
|
+
const packageJsonPath = findPackageJsonDeclaringPackage(packageName, base);
|
|
214
|
+
if (!packageJsonPath) return;
|
|
215
|
+
const declaredVersion = readDeclaredPackageVersion(packageName, readPackageJson(packageJsonPath));
|
|
216
|
+
if (!declaredVersion) return;
|
|
217
|
+
try {
|
|
218
|
+
const pkg = (0, node_module.createRequire)(packageJsonPath)(`${packageName}/package.json`);
|
|
219
|
+
return normalizeSupportedTailwindcssMajorVersion(Number(pkg.version?.split(".")[0]));
|
|
220
|
+
} catch {
|
|
221
|
+
return readDeclaredPackageMajorVersion(declaredVersion);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
//#endregion
|
|
225
|
+
//#region src/tailwindcss/patcher.ts
|
|
226
|
+
function createFallbackTailwindcssPatcher() {
|
|
227
|
+
return {
|
|
228
|
+
packageInfo: {
|
|
229
|
+
name: "tailwindcss",
|
|
230
|
+
version: void 0,
|
|
231
|
+
rootPath: "",
|
|
232
|
+
packageJsonPath: "",
|
|
233
|
+
packageJson: {}
|
|
234
|
+
},
|
|
235
|
+
majorVersion: 4,
|
|
236
|
+
async getClassSet() {
|
|
237
|
+
return /* @__PURE__ */ new Set();
|
|
238
|
+
},
|
|
239
|
+
async extract(_options) {
|
|
240
|
+
return {
|
|
241
|
+
classList: [],
|
|
242
|
+
classSet: /* @__PURE__ */ new Set()
|
|
243
|
+
};
|
|
244
|
+
},
|
|
245
|
+
async collectContentTokens() {
|
|
246
|
+
return {
|
|
247
|
+
entries: [],
|
|
248
|
+
filesScanned: 0,
|
|
249
|
+
sources: [],
|
|
250
|
+
skippedFiles: []
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
let hasLoggedMissingTailwind = false;
|
|
256
|
+
const TAILWINDCSS_NOT_FOUND_RE = /tailwindcss not found/i;
|
|
257
|
+
const UNABLE_TO_LOCATE_TAILWINDCSS_RE = /unable to locate tailwind css package/i;
|
|
258
|
+
function isTailwindcssV4PackageName(packageName) {
|
|
259
|
+
return packageName === "@tailwindcss/postcss" || packageName === "tailwindcss4" || Boolean(packageName && packageName.includes("tailwindcss4"));
|
|
260
|
+
}
|
|
261
|
+
function createTailwindcssPatcher(options) {
|
|
262
|
+
const { basedir, cacheDir, supportCustomLengthUnitsPatch, tailwindcss, tailwindcssPatcherOptions } = options || {};
|
|
263
|
+
const cache = { driver: "memory" };
|
|
264
|
+
const normalizedBasedir = basedir ? node_path.default.resolve(basedir) : void 0;
|
|
265
|
+
const cacheRoot = findNearestPackageRoot(normalizedBasedir) ?? normalizedBasedir ?? node_process.default.cwd();
|
|
266
|
+
if (cacheDir) if (node_path.default.isAbsolute(cacheDir)) cache.dir = cacheDir;
|
|
267
|
+
else if (normalizedBasedir) cache.dir = node_path.default.resolve(normalizedBasedir, cacheDir);
|
|
268
|
+
else cache.dir = node_path.default.resolve(node_process.default.cwd(), cacheDir);
|
|
269
|
+
else cache.dir = node_path.default.join(cacheRoot, "node_modules", ".cache", "tailwindcss-patch");
|
|
270
|
+
if (normalizedBasedir) cache.cwd = normalizedBasedir;
|
|
271
|
+
const resolvePaths = createDefaultResolvePaths(cache.cwd ?? normalizedBasedir ?? node_process.default.cwd());
|
|
272
|
+
const normalizedUserOptions = normalizeTailwindcssPatcherOptions(tailwindcssPatcherOptions);
|
|
273
|
+
const extendLengthUnits = normalizeExtendLengthUnits(supportCustomLengthUnitsPatch ?? true);
|
|
274
|
+
const baseTailwindOptions = (0, _weapp_tailwindcss_shared.defuOverrideArray)(tailwindcss ?? {}, omitUndefined({
|
|
275
|
+
cwd: normalizedBasedir,
|
|
276
|
+
resolve: { paths: resolvePaths }
|
|
277
|
+
}));
|
|
278
|
+
if (!baseTailwindOptions.packageName) baseTailwindOptions.packageName = "tailwindcss";
|
|
279
|
+
if (!baseTailwindOptions.postcssPlugin) baseTailwindOptions.postcssPlugin = baseTailwindOptions.version === 4 || isTailwindcssV4PackageName(baseTailwindOptions.packageName) ? "@tailwindcss/postcss" : "tailwindcss";
|
|
280
|
+
if (typeof baseTailwindOptions.postcssPlugin === "string") {
|
|
281
|
+
const resolvedPlugin = resolveModuleFromPaths(baseTailwindOptions.postcssPlugin, resolvePaths);
|
|
282
|
+
if (resolvedPlugin) baseTailwindOptions.postcssPlugin = resolvedPlugin;
|
|
283
|
+
}
|
|
284
|
+
const baseOptions = omitUndefined({
|
|
285
|
+
projectRoot: normalizedBasedir,
|
|
286
|
+
cache,
|
|
287
|
+
tailwindcss: baseTailwindOptions,
|
|
288
|
+
apply: omitUndefined({
|
|
289
|
+
exposeContext: true,
|
|
290
|
+
extendLengthUnits
|
|
291
|
+
})
|
|
292
|
+
});
|
|
293
|
+
const resolvedOptions = (0, _weapp_tailwindcss_shared.defuOverrideArray)(normalizedUserOptions ?? {}, baseOptions);
|
|
294
|
+
const resolvedTailwindOptions = resolvedOptions.tailwindcss;
|
|
295
|
+
if (resolvedTailwindOptions) {
|
|
296
|
+
const existingResolve = resolvedTailwindOptions.resolve ?? {};
|
|
297
|
+
const sourcePaths = Array.isArray(existingResolve.paths) && existingResolve.paths.length > 0 ? existingResolve.paths : resolvePaths;
|
|
298
|
+
resolvedTailwindOptions.resolve = {
|
|
299
|
+
...existingResolve,
|
|
300
|
+
paths: [...new Set(sourcePaths)]
|
|
301
|
+
};
|
|
302
|
+
_weapp_tailwindcss_logger.logger.debug("Tailwind resolve config %O", {
|
|
303
|
+
packageName: resolvedTailwindOptions.packageName,
|
|
304
|
+
version: resolvedTailwindOptions.version,
|
|
305
|
+
resolve: resolvedTailwindOptions.resolve,
|
|
306
|
+
cwd: resolvedTailwindOptions.cwd
|
|
307
|
+
});
|
|
308
|
+
if (typeof resolvedTailwindOptions.postcssPlugin === "string") {
|
|
309
|
+
const resolvedPlugin = resolveModuleFromPaths(resolvedTailwindOptions.postcssPlugin, resolvedTailwindOptions.resolve?.paths ?? resolvePaths);
|
|
310
|
+
if (resolvedPlugin) resolvedTailwindOptions.postcssPlugin = resolvedPlugin;
|
|
311
|
+
}
|
|
312
|
+
const searchRoots = /* @__PURE__ */ new Set();
|
|
313
|
+
if (resolvedTailwindOptions.cwd) searchRoots.add(resolvedTailwindOptions.cwd);
|
|
314
|
+
for (const resolvePath of resolvedTailwindOptions.resolve?.paths ?? []) {
|
|
315
|
+
const parentDir = node_path.default.dirname(resolvePath);
|
|
316
|
+
searchRoots.add(parentDir);
|
|
317
|
+
}
|
|
318
|
+
const configPath = findTailwindConfig(searchRoots);
|
|
319
|
+
if (!resolvedTailwindOptions.config) if (configPath) resolvedTailwindOptions.config = configPath;
|
|
320
|
+
else {
|
|
321
|
+
const fallbackConfig = resolveTailwindConfigFallback(resolvedTailwindOptions.packageName, resolvedTailwindOptions.resolve.paths ?? resolvePaths);
|
|
322
|
+
if (fallbackConfig) resolvedTailwindOptions.config = fallbackConfig;
|
|
323
|
+
}
|
|
324
|
+
if (!resolvedTailwindOptions.cwd && configPath) resolvedTailwindOptions.cwd = node_path.default.dirname(configPath);
|
|
325
|
+
resolvedOptions.tailwindcss = resolvedTailwindOptions;
|
|
326
|
+
}
|
|
327
|
+
try {
|
|
328
|
+
return new tailwindcss_patch.TailwindcssPatcher(resolvedOptions);
|
|
329
|
+
} catch (error) {
|
|
330
|
+
const searchPaths = resolvedOptions.tailwindcss?.resolve?.paths;
|
|
331
|
+
if (error instanceof Error && TAILWINDCSS_NOT_FOUND_RE.test(error.message)) {
|
|
332
|
+
if (!hasLoggedMissingTailwind) {
|
|
333
|
+
_weapp_tailwindcss_logger.logger.warn("Tailwind CSS 未安装,已跳过 Tailwind 运行时能力。若需使用 Tailwind 能力,请安装 tailwindcss。");
|
|
334
|
+
hasLoggedMissingTailwind = true;
|
|
335
|
+
}
|
|
336
|
+
return createFallbackTailwindcssPatcher();
|
|
337
|
+
}
|
|
338
|
+
if (error instanceof Error && UNABLE_TO_LOCATE_TAILWINDCSS_RE.test(error.message)) _weapp_tailwindcss_logger.logger.error("无法定位 Tailwind CSS 包 \"%s\",已尝试路径: %O", resolvedOptions.tailwindcss?.packageName, searchPaths);
|
|
339
|
+
throw error;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
//#endregion
|
|
343
|
+
//#region src/debug/index.ts
|
|
344
|
+
const _debug = (0, debug.default)("weapp-tw");
|
|
345
|
+
function createDebug(prefix) {
|
|
346
|
+
const debug$2 = ((formatter, ...args) => {
|
|
347
|
+
return _debug((prefix ?? "") + formatter, ...args);
|
|
348
|
+
});
|
|
349
|
+
Object.defineProperty(debug$2, "enabled", {
|
|
350
|
+
enumerable: false,
|
|
351
|
+
configurable: false,
|
|
352
|
+
get() {
|
|
353
|
+
return _debug.enabled;
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
return debug$2;
|
|
357
|
+
}
|
|
358
|
+
//#endregion
|
|
359
|
+
//#region src/tailwindcss/source-scan.ts
|
|
360
|
+
const DEFAULT_SOURCE_SCAN_EXTENSIONS = [
|
|
361
|
+
"html",
|
|
362
|
+
"wxml",
|
|
363
|
+
"axml",
|
|
364
|
+
"jxml",
|
|
365
|
+
"ksml",
|
|
366
|
+
"ttml",
|
|
367
|
+
"qml",
|
|
368
|
+
"tyml",
|
|
369
|
+
"xhsml",
|
|
370
|
+
"swan",
|
|
371
|
+
"vue",
|
|
372
|
+
"mpx",
|
|
373
|
+
"js",
|
|
374
|
+
"jsx",
|
|
375
|
+
"ts",
|
|
376
|
+
"tsx"
|
|
377
|
+
];
|
|
378
|
+
const FULL_SOURCE_SCAN_EXTENSIONS = [
|
|
379
|
+
"js",
|
|
380
|
+
"jsx",
|
|
381
|
+
"mjs",
|
|
382
|
+
"cjs",
|
|
383
|
+
"ts",
|
|
384
|
+
"tsx",
|
|
385
|
+
"mts",
|
|
386
|
+
"cts",
|
|
387
|
+
"vue",
|
|
388
|
+
"uvue",
|
|
389
|
+
"nvue",
|
|
390
|
+
"svelte",
|
|
391
|
+
"mpx",
|
|
392
|
+
"html",
|
|
393
|
+
"wxml",
|
|
394
|
+
"axml",
|
|
395
|
+
"jxml",
|
|
396
|
+
"ksml",
|
|
397
|
+
"ttml",
|
|
398
|
+
"qml",
|
|
399
|
+
"tyml",
|
|
400
|
+
"xhsml",
|
|
401
|
+
"swan",
|
|
402
|
+
"css",
|
|
403
|
+
"wxss",
|
|
404
|
+
"acss",
|
|
405
|
+
"jxss",
|
|
406
|
+
"ttss",
|
|
407
|
+
"qss",
|
|
408
|
+
"tyss",
|
|
409
|
+
"scss",
|
|
410
|
+
"sass",
|
|
411
|
+
"less",
|
|
412
|
+
"styl",
|
|
413
|
+
"stylus"
|
|
414
|
+
];
|
|
415
|
+
function createSourceScanPattern(extensions = DEFAULT_SOURCE_SCAN_EXTENSIONS) {
|
|
416
|
+
return `**/*.{${extensions.join(",")}}`;
|
|
417
|
+
}
|
|
418
|
+
const FULL_SOURCE_SCAN_PATTERN = createSourceScanPattern(FULL_SOURCE_SCAN_EXTENSIONS);
|
|
419
|
+
const FULL_SOURCE_SCAN_EXTENSION_RE = new RegExp(`\\.(?:${FULL_SOURCE_SCAN_EXTENSIONS.map((extension) => extension.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})$`);
|
|
420
|
+
function toPosixPath(value) {
|
|
421
|
+
return value.split(node_path.default.sep).join("/");
|
|
422
|
+
}
|
|
423
|
+
function resolveSourceScanPath(value) {
|
|
424
|
+
const resolved = node_path.default.resolve(value);
|
|
425
|
+
try {
|
|
426
|
+
return node_fs.realpathSync.native(resolved);
|
|
427
|
+
} catch {
|
|
428
|
+
return resolved;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
function normalizeEntryPattern(entry) {
|
|
432
|
+
return node_path.default.isAbsolute(entry.pattern) ? toPosixPath(node_path.default.relative(resolveSourceScanPath(entry.base), entry.pattern)) : entry.pattern;
|
|
433
|
+
}
|
|
434
|
+
function isFileMatchedByTailwindSourceEntry(file, entry) {
|
|
435
|
+
const relative = toPosixPath(node_path.default.relative(resolveSourceScanPath(entry.base), file));
|
|
436
|
+
return relative && !relative.startsWith("../") && !node_path.default.isAbsolute(relative) && micromatch.default.isMatch(relative, normalizeEntryPattern(entry));
|
|
437
|
+
}
|
|
438
|
+
function isFileExcludedByTailwindSourceEntries(file, entries) {
|
|
439
|
+
if (!entries?.length) return false;
|
|
440
|
+
const resolvedFile = resolveSourceScanPath(file);
|
|
441
|
+
return entries.some((entry) => entry.negated && isFileMatchedByTailwindSourceEntry(resolvedFile, entry));
|
|
442
|
+
}
|
|
443
|
+
function isFileMatchedByTailwindSourceEntries(file, entries) {
|
|
444
|
+
if (!entries?.length) return true;
|
|
445
|
+
const positiveEntries = entries.filter((entry) => !entry.negated);
|
|
446
|
+
const negativeEntries = entries.filter((entry) => entry.negated);
|
|
447
|
+
if (positiveEntries.length === 0) return false;
|
|
448
|
+
const resolvedFile = resolveSourceScanPath(file);
|
|
449
|
+
if (!positiveEntries.some((entry) => isFileMatchedByTailwindSourceEntry(resolvedFile, entry))) return false;
|
|
450
|
+
return !negativeEntries.some((entry) => isFileMatchedByTailwindSourceEntry(resolvedFile, entry));
|
|
451
|
+
}
|
|
452
|
+
function createTailwindSourceEntryMatcher(entries) {
|
|
453
|
+
if (!entries?.length) return;
|
|
454
|
+
return (file) => isFileMatchedByTailwindSourceEntries(file, entries);
|
|
455
|
+
}
|
|
456
|
+
function resolveTailwindV4CssSourceBase(source, fallbackBase) {
|
|
457
|
+
if (typeof source.base === "string" && source.base.length > 0) return source.base;
|
|
458
|
+
if (typeof source.file === "string" && source.file.length > 0) return node_path.default.dirname(source.file);
|
|
459
|
+
return fallbackBase;
|
|
460
|
+
}
|
|
461
|
+
const NUMERICAL_RANGE_RE = /^(-?\d+)\.\.(-?\d+)(?:\.\.(-?\d+))?$/;
|
|
462
|
+
function parseConfigParam$1(params) {
|
|
463
|
+
const value = params.trim();
|
|
464
|
+
return /^(['"])(.+)\1$/.exec(value)?.[2];
|
|
465
|
+
}
|
|
466
|
+
function isLegacyContentObject$1(value) {
|
|
467
|
+
return typeof value === "object" && value !== null && "files" in value;
|
|
468
|
+
}
|
|
469
|
+
function normalizeGlobPattern(pattern) {
|
|
470
|
+
return pattern.startsWith("./") ? pattern.slice(2) : pattern;
|
|
471
|
+
}
|
|
472
|
+
function hasGlobMagic(value) {
|
|
473
|
+
return /[*?[\]{}()!+@]/.test(value);
|
|
474
|
+
}
|
|
475
|
+
function splitStaticGlobPrefix(pattern) {
|
|
476
|
+
const segments = normalizeGlobPattern(pattern).split(/[\\/]+/);
|
|
477
|
+
const prefix = [];
|
|
478
|
+
const rest = [];
|
|
479
|
+
let reachedGlob = false;
|
|
480
|
+
for (const segment of segments) {
|
|
481
|
+
if (!reachedGlob && segment && !hasGlobMagic(segment)) {
|
|
482
|
+
prefix.push(segment);
|
|
483
|
+
continue;
|
|
484
|
+
}
|
|
485
|
+
reachedGlob = true;
|
|
486
|
+
rest.push(segment);
|
|
487
|
+
}
|
|
488
|
+
return {
|
|
489
|
+
prefix,
|
|
490
|
+
rest
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
function segmentTopLevel(input, separator, options = {}) {
|
|
494
|
+
const parts = [];
|
|
495
|
+
const stack = [];
|
|
496
|
+
let lastPos = 0;
|
|
497
|
+
let quote;
|
|
498
|
+
for (let index = 0; index < input.length; index++) {
|
|
499
|
+
const char = input[index];
|
|
500
|
+
if (char === "\\") {
|
|
501
|
+
index += 1;
|
|
502
|
+
continue;
|
|
503
|
+
}
|
|
504
|
+
if (quote) {
|
|
505
|
+
if (char === quote) quote = void 0;
|
|
506
|
+
continue;
|
|
507
|
+
}
|
|
508
|
+
if (char === "\"" || char === "'") {
|
|
509
|
+
quote = char;
|
|
510
|
+
continue;
|
|
511
|
+
}
|
|
512
|
+
if (char === "(") {
|
|
513
|
+
stack.push(")");
|
|
514
|
+
continue;
|
|
515
|
+
}
|
|
516
|
+
if (char === "[") {
|
|
517
|
+
stack.push("]");
|
|
518
|
+
continue;
|
|
519
|
+
}
|
|
520
|
+
if (char === "{") {
|
|
521
|
+
stack.push("}");
|
|
522
|
+
continue;
|
|
523
|
+
}
|
|
524
|
+
if (stack.length > 0 && char === stack[stack.length - 1]) {
|
|
525
|
+
stack.pop();
|
|
526
|
+
continue;
|
|
527
|
+
}
|
|
528
|
+
if (stack.length === 0 && char === separator) {
|
|
529
|
+
const part = input.slice(lastPos, index);
|
|
530
|
+
if (part || options.keepEmpty) parts.push(part);
|
|
531
|
+
lastPos = index + 1;
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
const part = input.slice(lastPos);
|
|
535
|
+
if (part || options.keepEmpty) parts.push(part);
|
|
536
|
+
return parts;
|
|
537
|
+
}
|
|
538
|
+
function isSequence(value) {
|
|
539
|
+
return NUMERICAL_RANGE_RE.test(value);
|
|
540
|
+
}
|
|
541
|
+
function expandSequence(value) {
|
|
542
|
+
const match = value.match(NUMERICAL_RANGE_RE);
|
|
543
|
+
if (!match) return [value];
|
|
544
|
+
const [, start, end, stepValue] = match;
|
|
545
|
+
if (start === void 0 || end === void 0) return [value];
|
|
546
|
+
let step = stepValue ? Number.parseInt(stepValue, 10) : void 0;
|
|
547
|
+
const startNumber = Number.parseInt(start, 10);
|
|
548
|
+
const endNumber = Number.parseInt(end, 10);
|
|
549
|
+
const increasing = startNumber < endNumber;
|
|
550
|
+
if (step === void 0) step = increasing ? 1 : -1;
|
|
551
|
+
if (step === 0) return [];
|
|
552
|
+
if (increasing && step < 0) step = -step;
|
|
553
|
+
if (!increasing && step > 0) step = -step;
|
|
554
|
+
const result = [];
|
|
555
|
+
for (let value = startNumber; increasing ? value <= endNumber : value >= endNumber; value += step) result.push(String(value));
|
|
556
|
+
return result;
|
|
557
|
+
}
|
|
558
|
+
function expandInlineSourceCandidatePattern(pattern) {
|
|
559
|
+
const index = pattern.indexOf("{");
|
|
560
|
+
if (index === -1) return [pattern];
|
|
561
|
+
const prefix = pattern.slice(0, index);
|
|
562
|
+
const rest = pattern.slice(index);
|
|
563
|
+
let depth = 0;
|
|
564
|
+
let endIndex = -1;
|
|
565
|
+
for (let index = 0; index < rest.length; index++) {
|
|
566
|
+
const char = rest[index];
|
|
567
|
+
if (char === "{") depth += 1;
|
|
568
|
+
else if (char === "}") {
|
|
569
|
+
depth -= 1;
|
|
570
|
+
if (depth === 0) {
|
|
571
|
+
endIndex = index;
|
|
572
|
+
break;
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
if (endIndex === -1) return [pattern];
|
|
577
|
+
const inner = rest.slice(1, endIndex);
|
|
578
|
+
const suffix = rest.slice(endIndex + 1);
|
|
579
|
+
const parts = (isSequence(inner) ? expandSequence(inner) : segmentTopLevel(inner, ",", { keepEmpty: true })).flatMap((part) => expandInlineSourceCandidatePattern(part));
|
|
580
|
+
return expandInlineSourceCandidatePattern(suffix).flatMap((suffix) => parts.map((part) => `${prefix}${part}${suffix}`));
|
|
581
|
+
}
|
|
582
|
+
function parseSourceInlineParam(params) {
|
|
583
|
+
let value = params.trim();
|
|
584
|
+
const negated = value.startsWith("not ");
|
|
585
|
+
if (negated) value = value.slice(4).trim();
|
|
586
|
+
if (!value.startsWith("inline(") || !value.endsWith(")")) return;
|
|
587
|
+
const inlineValue = value.slice(7, -1).trim();
|
|
588
|
+
const match = /^(['"])([\s\S]*)\1$/.exec(inlineValue);
|
|
589
|
+
if (!match) return;
|
|
590
|
+
const source = match[2];
|
|
591
|
+
if (source === void 0) return;
|
|
592
|
+
return {
|
|
593
|
+
negated,
|
|
594
|
+
source
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
function collectCssInlineSourceCandidates(root) {
|
|
598
|
+
const included = /* @__PURE__ */ new Set();
|
|
599
|
+
const excluded = /* @__PURE__ */ new Set();
|
|
600
|
+
root.walkAtRules("source", (rule) => {
|
|
601
|
+
const parsed = parseSourceInlineParam(rule.params);
|
|
602
|
+
if (!parsed) return;
|
|
603
|
+
const target = parsed.negated ? excluded : included;
|
|
604
|
+
for (const source of segmentTopLevel(parsed.source, " ")) {
|
|
605
|
+
const trimmed = source.trim();
|
|
606
|
+
if (!trimmed) continue;
|
|
607
|
+
for (const candidate of expandInlineSourceCandidatePattern(trimmed)) {
|
|
608
|
+
const normalized = candidate.trim();
|
|
609
|
+
if (normalized) target.add(normalized);
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
});
|
|
613
|
+
for (const candidate of excluded) included.delete(candidate);
|
|
614
|
+
return {
|
|
615
|
+
included,
|
|
616
|
+
excluded
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
function normalizeLegacyContentEntries(content, base) {
|
|
620
|
+
if (typeof content === "string") {
|
|
621
|
+
const negated = content.startsWith("!");
|
|
622
|
+
return [{
|
|
623
|
+
base,
|
|
624
|
+
negated,
|
|
625
|
+
pattern: normalizeGlobPattern(negated ? content.slice(1) : content)
|
|
626
|
+
}];
|
|
627
|
+
}
|
|
628
|
+
if (Array.isArray(content)) return content.flatMap((item) => normalizeLegacyContentEntries(item, base));
|
|
629
|
+
if (isLegacyContentObject$1(content)) return normalizeLegacyContentEntries(content.files, base);
|
|
630
|
+
return [];
|
|
631
|
+
}
|
|
632
|
+
async function pathExistsAsDirectory(file) {
|
|
633
|
+
try {
|
|
634
|
+
return (await (0, node_fs_promises.stat)(file)).isDirectory();
|
|
635
|
+
} catch {
|
|
636
|
+
return false;
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
async function resolveTailwindSourceEntry(sourcePath, base, negated, defaultPattern = createSourceScanPattern()) {
|
|
640
|
+
const absoluteSource = node_path.default.isAbsolute(sourcePath) ? node_path.default.resolve(sourcePath) : node_path.default.resolve(base, sourcePath);
|
|
641
|
+
if (await pathExistsAsDirectory(absoluteSource)) return {
|
|
642
|
+
base: absoluteSource,
|
|
643
|
+
negated,
|
|
644
|
+
pattern: normalizeGlobPattern(defaultPattern)
|
|
645
|
+
};
|
|
646
|
+
if (node_path.default.isAbsolute(sourcePath)) return {
|
|
647
|
+
base: node_path.default.dirname(absoluteSource),
|
|
648
|
+
negated,
|
|
649
|
+
pattern: normalizeGlobPattern(node_path.default.basename(absoluteSource))
|
|
650
|
+
};
|
|
651
|
+
const { prefix, rest } = splitStaticGlobPrefix(sourcePath);
|
|
652
|
+
if (prefix.length > 0 && rest.length > 0) return {
|
|
653
|
+
base: node_path.default.resolve(base, ...prefix),
|
|
654
|
+
negated,
|
|
655
|
+
pattern: normalizeGlobPattern(rest.join("/"))
|
|
656
|
+
};
|
|
657
|
+
return {
|
|
658
|
+
base,
|
|
659
|
+
negated,
|
|
660
|
+
pattern: normalizeGlobPattern(sourcePath)
|
|
661
|
+
};
|
|
662
|
+
}
|
|
663
|
+
function parseSourceFileParam(params) {
|
|
664
|
+
const value = params.trim();
|
|
665
|
+
if (!value || value === "none" || value.startsWith("inline(")) return;
|
|
666
|
+
const negated = value.startsWith("not ");
|
|
667
|
+
const sourceValue = negated ? value.slice(4).trim() : value;
|
|
668
|
+
if (sourceValue.startsWith("inline(")) return;
|
|
669
|
+
const match = /^(['"])(.+)\1$/.exec(sourceValue);
|
|
670
|
+
return match?.[2] ? {
|
|
671
|
+
negated,
|
|
672
|
+
sourcePath: match[2]
|
|
673
|
+
} : void 0;
|
|
674
|
+
}
|
|
675
|
+
async function resolveCssSourceEntries(root, base, defaultPattern = createSourceScanPattern()) {
|
|
676
|
+
const entries = [];
|
|
677
|
+
const tasks = [];
|
|
678
|
+
root.walkAtRules("source", (rule) => {
|
|
679
|
+
const parsed = parseSourceFileParam(rule.params);
|
|
680
|
+
if (!parsed) return;
|
|
681
|
+
tasks.push(resolveTailwindSourceEntry(parsed.sourcePath, base, parsed.negated, defaultPattern));
|
|
682
|
+
});
|
|
683
|
+
entries.push(...await Promise.all(tasks));
|
|
684
|
+
return entries;
|
|
685
|
+
}
|
|
686
|
+
async function expandTailwindSourceEntries(entries, options = {}) {
|
|
687
|
+
if (entries.length === 0) return [];
|
|
688
|
+
const files = /* @__PURE__ */ new Set();
|
|
689
|
+
const entriesByBase = /* @__PURE__ */ new Map();
|
|
690
|
+
for (const entry of entries) {
|
|
691
|
+
const base = node_path.default.resolve(entry.base);
|
|
692
|
+
const group = entriesByBase.get(base) ?? [];
|
|
693
|
+
group.push({
|
|
694
|
+
...entry,
|
|
695
|
+
base
|
|
696
|
+
});
|
|
697
|
+
entriesByBase.set(base, group);
|
|
698
|
+
}
|
|
699
|
+
await Promise.all([...entriesByBase.entries()].map(async ([base, group]) => {
|
|
700
|
+
const ignoredSources = options.ignore?.map((pattern) => ({
|
|
701
|
+
base,
|
|
702
|
+
pattern: normalizeGlobPattern(pattern),
|
|
703
|
+
negated: true
|
|
704
|
+
}));
|
|
705
|
+
const matched = await (0, tailwindcss_patch.resolveProjectSourceFiles)({
|
|
706
|
+
cwd: base,
|
|
707
|
+
sources: group,
|
|
708
|
+
...ignoredSources === void 0 ? {} : { ignoredSources }
|
|
709
|
+
});
|
|
710
|
+
for (const file of matched) files.add(node_path.default.resolve(file));
|
|
711
|
+
}));
|
|
712
|
+
return [...files].filter((file) => !isFileExcludedByTailwindSourceEntries(file, entries));
|
|
713
|
+
}
|
|
714
|
+
//#endregion
|
|
715
|
+
//#region src/tailwindcss/v4-engine/candidates.ts
|
|
716
|
+
const UNSUPPORTED_MINI_PROGRAM_TAILWIND_V4_CANDIDATE_RE = /(?:^|:)(?:group|peer|in|not-in)-[^\s:]*\/|(?:^|:)(?:in|not-in)-\[/;
|
|
717
|
+
function isUnsupportedMiniProgramTailwindV4Candidate(candidate) {
|
|
718
|
+
return UNSUPPORTED_MINI_PROGRAM_TAILWIND_V4_CANDIDATE_RE.test(candidate);
|
|
719
|
+
}
|
|
720
|
+
function filterUnsupportedMiniProgramTailwindV4Candidates(candidates) {
|
|
721
|
+
if (!candidates) return;
|
|
722
|
+
return new Set([...candidates].filter((candidate) => !isUnsupportedMiniProgramTailwindV4Candidate(candidate)));
|
|
723
|
+
}
|
|
724
|
+
//#endregion
|
|
725
|
+
//#region src/tailwindcss/v4-engine/miniprogram.ts
|
|
726
|
+
const defaultStyleHandler$1 = (0, _weapp_tailwindcss_postcss.createStyleHandler)({
|
|
727
|
+
cssChildCombinatorReplaceValue: ["view", "text"],
|
|
728
|
+
cssRemoveHoverPseudoClass: true,
|
|
729
|
+
isMainChunk: true,
|
|
730
|
+
majorVersion: 4
|
|
731
|
+
});
|
|
732
|
+
const CSS_DECLARATION_URL_RE = /(:\s*)url\(([^\n\r"';[\]{}]*[[\]{}][^\n\r;]*)\)(?=\s*;)/g;
|
|
733
|
+
function normalizeTailwindV4GeneratedUrlValues(css) {
|
|
734
|
+
return css.replace(CSS_DECLARATION_URL_RE, (match, prefix, urlValue) => {
|
|
735
|
+
try {
|
|
736
|
+
return `${prefix}url("${urlValue.replaceAll("\\", "\\\\").replaceAll("\"", "\\\"")}")`;
|
|
737
|
+
} catch {
|
|
738
|
+
return match;
|
|
739
|
+
}
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
async function transformTailwindV4CssToWeapp(css, options) {
|
|
743
|
+
const protectedCss = (0, _weapp_tailwindcss_postcss.protectDynamicColorMixAlpha)(normalizeTailwindV4GeneratedUrlValues(css), { customPropertyValues: options && "customPropertyValues" in options ? options.customPropertyValues : void 0 });
|
|
744
|
+
const result = await defaultStyleHandler$1(protectedCss.css, {
|
|
745
|
+
cssChildCombinatorReplaceValue: ["view", "text"],
|
|
746
|
+
cssRemoveHoverPseudoClass: true,
|
|
747
|
+
isMainChunk: true,
|
|
748
|
+
majorVersion: 4,
|
|
749
|
+
...options
|
|
750
|
+
});
|
|
751
|
+
return (0, _weapp_tailwindcss_postcss.pruneMiniProgramGeneratedCss)(protectedCss.restore(result.css));
|
|
752
|
+
}
|
|
753
|
+
async function transformTailwindV4CssByTarget(css, target, options) {
|
|
754
|
+
return target === "weapp" ? transformTailwindV4CssToWeapp(css, options) : css;
|
|
755
|
+
}
|
|
756
|
+
//#endregion
|
|
757
|
+
//#region src/tailwindcss/v4-engine/tailwind-v3-default-colors.ts
|
|
758
|
+
const TAILWIND_V3_COLOR_STEPS = [
|
|
759
|
+
"50",
|
|
760
|
+
"100",
|
|
761
|
+
"200",
|
|
762
|
+
"300",
|
|
763
|
+
"400",
|
|
764
|
+
"500",
|
|
765
|
+
"600",
|
|
766
|
+
"700",
|
|
767
|
+
"800",
|
|
768
|
+
"900",
|
|
769
|
+
"950"
|
|
770
|
+
];
|
|
771
|
+
const TAILWIND_V3_COLOR_PALETTE = {
|
|
772
|
+
slate: [
|
|
773
|
+
"#f8fafc",
|
|
774
|
+
"#f1f5f9",
|
|
775
|
+
"#e2e8f0",
|
|
776
|
+
"#cbd5e1",
|
|
777
|
+
"#94a3b8",
|
|
778
|
+
"#64748b",
|
|
779
|
+
"#475569",
|
|
780
|
+
"#334155",
|
|
781
|
+
"#1e293b",
|
|
782
|
+
"#0f172a",
|
|
783
|
+
"#020617"
|
|
784
|
+
],
|
|
785
|
+
gray: [
|
|
786
|
+
"#f9fafb",
|
|
787
|
+
"#f3f4f6",
|
|
788
|
+
"#e5e7eb",
|
|
789
|
+
"#d1d5db",
|
|
790
|
+
"#9ca3af",
|
|
791
|
+
"#6b7280",
|
|
792
|
+
"#4b5563",
|
|
793
|
+
"#374151",
|
|
794
|
+
"#1f2937",
|
|
795
|
+
"#111827",
|
|
796
|
+
"#030712"
|
|
797
|
+
],
|
|
798
|
+
zinc: [
|
|
799
|
+
"#fafafa",
|
|
800
|
+
"#f4f4f5",
|
|
801
|
+
"#e4e4e7",
|
|
802
|
+
"#d4d4d8",
|
|
803
|
+
"#a1a1aa",
|
|
804
|
+
"#71717a",
|
|
805
|
+
"#52525b",
|
|
806
|
+
"#3f3f46",
|
|
807
|
+
"#27272a",
|
|
808
|
+
"#18181b",
|
|
809
|
+
"#09090b"
|
|
810
|
+
],
|
|
811
|
+
neutral: [
|
|
812
|
+
"#fafafa",
|
|
813
|
+
"#f5f5f5",
|
|
814
|
+
"#e5e5e5",
|
|
815
|
+
"#d4d4d4",
|
|
816
|
+
"#a3a3a3",
|
|
817
|
+
"#737373",
|
|
818
|
+
"#525252",
|
|
819
|
+
"#404040",
|
|
820
|
+
"#262626",
|
|
821
|
+
"#171717",
|
|
822
|
+
"#0a0a0a"
|
|
823
|
+
],
|
|
824
|
+
stone: [
|
|
825
|
+
"#fafaf9",
|
|
826
|
+
"#f5f5f4",
|
|
827
|
+
"#e7e5e4",
|
|
828
|
+
"#d6d3d1",
|
|
829
|
+
"#a8a29e",
|
|
830
|
+
"#78716c",
|
|
831
|
+
"#57534e",
|
|
832
|
+
"#44403c",
|
|
833
|
+
"#292524",
|
|
834
|
+
"#1c1917",
|
|
835
|
+
"#0c0a09"
|
|
836
|
+
],
|
|
837
|
+
red: [
|
|
838
|
+
"#fef2f2",
|
|
839
|
+
"#fee2e2",
|
|
840
|
+
"#fecaca",
|
|
841
|
+
"#fca5a5",
|
|
842
|
+
"#f87171",
|
|
843
|
+
"#ef4444",
|
|
844
|
+
"#dc2626",
|
|
845
|
+
"#b91c1c",
|
|
846
|
+
"#991b1b",
|
|
847
|
+
"#7f1d1d",
|
|
848
|
+
"#450a0a"
|
|
849
|
+
],
|
|
850
|
+
orange: [
|
|
851
|
+
"#fff7ed",
|
|
852
|
+
"#ffedd5",
|
|
853
|
+
"#fed7aa",
|
|
854
|
+
"#fdba74",
|
|
855
|
+
"#fb923c",
|
|
856
|
+
"#f97316",
|
|
857
|
+
"#ea580c",
|
|
858
|
+
"#c2410c",
|
|
859
|
+
"#9a3412",
|
|
860
|
+
"#7c2d12",
|
|
861
|
+
"#431407"
|
|
862
|
+
],
|
|
863
|
+
amber: [
|
|
864
|
+
"#fffbeb",
|
|
865
|
+
"#fef3c7",
|
|
866
|
+
"#fde68a",
|
|
867
|
+
"#fcd34d",
|
|
868
|
+
"#fbbf24",
|
|
869
|
+
"#f59e0b",
|
|
870
|
+
"#d97706",
|
|
871
|
+
"#b45309",
|
|
872
|
+
"#92400e",
|
|
873
|
+
"#78350f",
|
|
874
|
+
"#451a03"
|
|
875
|
+
],
|
|
876
|
+
yellow: [
|
|
877
|
+
"#fefce8",
|
|
878
|
+
"#fef9c3",
|
|
879
|
+
"#fef08a",
|
|
880
|
+
"#fde047",
|
|
881
|
+
"#facc15",
|
|
882
|
+
"#eab308",
|
|
883
|
+
"#ca8a04",
|
|
884
|
+
"#a16207",
|
|
885
|
+
"#854d0e",
|
|
886
|
+
"#713f12",
|
|
887
|
+
"#422006"
|
|
888
|
+
],
|
|
889
|
+
lime: [
|
|
890
|
+
"#f7fee7",
|
|
891
|
+
"#ecfccb",
|
|
892
|
+
"#d9f99d",
|
|
893
|
+
"#bef264",
|
|
894
|
+
"#a3e635",
|
|
895
|
+
"#84cc16",
|
|
896
|
+
"#65a30d",
|
|
897
|
+
"#4d7c0f",
|
|
898
|
+
"#3f6212",
|
|
899
|
+
"#365314",
|
|
900
|
+
"#1a2e05"
|
|
901
|
+
],
|
|
902
|
+
green: [
|
|
903
|
+
"#f0fdf4",
|
|
904
|
+
"#dcfce7",
|
|
905
|
+
"#bbf7d0",
|
|
906
|
+
"#86efac",
|
|
907
|
+
"#4ade80",
|
|
908
|
+
"#22c55e",
|
|
909
|
+
"#16a34a",
|
|
910
|
+
"#15803d",
|
|
911
|
+
"#166534",
|
|
912
|
+
"#14532d",
|
|
913
|
+
"#052e16"
|
|
914
|
+
],
|
|
915
|
+
emerald: [
|
|
916
|
+
"#ecfdf5",
|
|
917
|
+
"#d1fae5",
|
|
918
|
+
"#a7f3d0",
|
|
919
|
+
"#6ee7b7",
|
|
920
|
+
"#34d399",
|
|
921
|
+
"#10b981",
|
|
922
|
+
"#059669",
|
|
923
|
+
"#047857",
|
|
924
|
+
"#065f46",
|
|
925
|
+
"#064e3b",
|
|
926
|
+
"#022c22"
|
|
927
|
+
],
|
|
928
|
+
teal: [
|
|
929
|
+
"#f0fdfa",
|
|
930
|
+
"#ccfbf1",
|
|
931
|
+
"#99f6e4",
|
|
932
|
+
"#5eead4",
|
|
933
|
+
"#2dd4bf",
|
|
934
|
+
"#14b8a6",
|
|
935
|
+
"#0d9488",
|
|
936
|
+
"#0f766e",
|
|
937
|
+
"#115e59",
|
|
938
|
+
"#134e4a",
|
|
939
|
+
"#042f2e"
|
|
940
|
+
],
|
|
941
|
+
cyan: [
|
|
942
|
+
"#ecfeff",
|
|
943
|
+
"#cffafe",
|
|
944
|
+
"#a5f3fc",
|
|
945
|
+
"#67e8f9",
|
|
946
|
+
"#22d3ee",
|
|
947
|
+
"#06b6d4",
|
|
948
|
+
"#0891b2",
|
|
949
|
+
"#0e7490",
|
|
950
|
+
"#155e75",
|
|
951
|
+
"#164e63",
|
|
952
|
+
"#083344"
|
|
953
|
+
],
|
|
954
|
+
sky: [
|
|
955
|
+
"#f0f9ff",
|
|
956
|
+
"#e0f2fe",
|
|
957
|
+
"#bae6fd",
|
|
958
|
+
"#7dd3fc",
|
|
959
|
+
"#38bdf8",
|
|
960
|
+
"#0ea5e9",
|
|
961
|
+
"#0284c7",
|
|
962
|
+
"#0369a1",
|
|
963
|
+
"#075985",
|
|
964
|
+
"#0c4a6e",
|
|
965
|
+
"#082f49"
|
|
966
|
+
],
|
|
967
|
+
blue: [
|
|
968
|
+
"#eff6ff",
|
|
969
|
+
"#dbeafe",
|
|
970
|
+
"#bfdbfe",
|
|
971
|
+
"#93c5fd",
|
|
972
|
+
"#60a5fa",
|
|
973
|
+
"#3b82f6",
|
|
974
|
+
"#2563eb",
|
|
975
|
+
"#1d4ed8",
|
|
976
|
+
"#1e40af",
|
|
977
|
+
"#1e3a8a",
|
|
978
|
+
"#172554"
|
|
979
|
+
],
|
|
980
|
+
indigo: [
|
|
981
|
+
"#eef2ff",
|
|
982
|
+
"#e0e7ff",
|
|
983
|
+
"#c7d2fe",
|
|
984
|
+
"#a5b4fc",
|
|
985
|
+
"#818cf8",
|
|
986
|
+
"#6366f1",
|
|
987
|
+
"#4f46e5",
|
|
988
|
+
"#4338ca",
|
|
989
|
+
"#3730a3",
|
|
990
|
+
"#312e81",
|
|
991
|
+
"#1e1b4b"
|
|
992
|
+
],
|
|
993
|
+
violet: [
|
|
994
|
+
"#f5f3ff",
|
|
995
|
+
"#ede9fe",
|
|
996
|
+
"#ddd6fe",
|
|
997
|
+
"#c4b5fd",
|
|
998
|
+
"#a78bfa",
|
|
999
|
+
"#8b5cf6",
|
|
1000
|
+
"#7c3aed",
|
|
1001
|
+
"#6d28d9",
|
|
1002
|
+
"#5b21b6",
|
|
1003
|
+
"#4c1d95",
|
|
1004
|
+
"#2e1065"
|
|
1005
|
+
],
|
|
1006
|
+
purple: [
|
|
1007
|
+
"#faf5ff",
|
|
1008
|
+
"#f3e8ff",
|
|
1009
|
+
"#e9d5ff",
|
|
1010
|
+
"#d8b4fe",
|
|
1011
|
+
"#c084fc",
|
|
1012
|
+
"#a855f7",
|
|
1013
|
+
"#9333ea",
|
|
1014
|
+
"#7e22ce",
|
|
1015
|
+
"#6b21a8",
|
|
1016
|
+
"#581c87",
|
|
1017
|
+
"#3b0764"
|
|
1018
|
+
],
|
|
1019
|
+
fuchsia: [
|
|
1020
|
+
"#fdf4ff",
|
|
1021
|
+
"#fae8ff",
|
|
1022
|
+
"#f5d0fe",
|
|
1023
|
+
"#f0abfc",
|
|
1024
|
+
"#e879f9",
|
|
1025
|
+
"#d946ef",
|
|
1026
|
+
"#c026d3",
|
|
1027
|
+
"#a21caf",
|
|
1028
|
+
"#86198f",
|
|
1029
|
+
"#701a75",
|
|
1030
|
+
"#4a044e"
|
|
1031
|
+
],
|
|
1032
|
+
pink: [
|
|
1033
|
+
"#fdf2f8",
|
|
1034
|
+
"#fce7f3",
|
|
1035
|
+
"#fbcfe8",
|
|
1036
|
+
"#f9a8d4",
|
|
1037
|
+
"#f472b6",
|
|
1038
|
+
"#ec4899",
|
|
1039
|
+
"#db2777",
|
|
1040
|
+
"#be185d",
|
|
1041
|
+
"#9d174d",
|
|
1042
|
+
"#831843",
|
|
1043
|
+
"#500724"
|
|
1044
|
+
],
|
|
1045
|
+
rose: [
|
|
1046
|
+
"#fff1f2",
|
|
1047
|
+
"#ffe4e6",
|
|
1048
|
+
"#fecdd3",
|
|
1049
|
+
"#fda4af",
|
|
1050
|
+
"#fb7185",
|
|
1051
|
+
"#f43f5e",
|
|
1052
|
+
"#e11d48",
|
|
1053
|
+
"#be123c",
|
|
1054
|
+
"#9f1239",
|
|
1055
|
+
"#881337",
|
|
1056
|
+
"#4c0519"
|
|
1057
|
+
]
|
|
1058
|
+
};
|
|
1059
|
+
function createTailwindV3DefaultColorThemeCss() {
|
|
1060
|
+
const declarations = [" --color-black: #000;", " --color-white: #fff;"];
|
|
1061
|
+
for (const [color, values] of Object.entries(TAILWIND_V3_COLOR_PALETTE)) for (let index = 0; index < TAILWIND_V3_COLOR_STEPS.length; index++) declarations.push(` --color-${color}-${TAILWIND_V3_COLOR_STEPS[index]}: ${values[index]};`);
|
|
1062
|
+
return [
|
|
1063
|
+
"@theme {",
|
|
1064
|
+
...declarations,
|
|
1065
|
+
"}"
|
|
1066
|
+
].join("\n");
|
|
1067
|
+
}
|
|
1068
|
+
//#endregion
|
|
1069
|
+
//#region src/tailwindcss/v4-engine/tailwind-v3-compatibility.ts
|
|
1070
|
+
const TAILWIND_V3_COMPATIBILITY_THEME_CSS = [
|
|
1071
|
+
"@theme {",
|
|
1072
|
+
" --default-ring-width: 3px;",
|
|
1073
|
+
" --default-ring-color: var(--color-blue-500, #3b82f6);",
|
|
1074
|
+
" --default-outline-width: 3px;",
|
|
1075
|
+
"",
|
|
1076
|
+
" --shadow-xs: 0 1px rgb(0 0 0 / 0.05);",
|
|
1077
|
+
" --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);",
|
|
1078
|
+
" --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);",
|
|
1079
|
+
" --drop-shadow-xs: 0 1px 1px rgb(0 0 0 / 0.05);",
|
|
1080
|
+
" --drop-shadow-sm: 0 1px 2px rgb(0 0 0 / 0.15);",
|
|
1081
|
+
" --drop-shadow: 0 1px 2px rgb(0 0 0 / 0.1), 0 1px 1px rgb(0 0 0 / 0.06);",
|
|
1082
|
+
"",
|
|
1083
|
+
" --blur-xs: 4px;",
|
|
1084
|
+
" --blur-sm: 4px;",
|
|
1085
|
+
" --blur: 8px;",
|
|
1086
|
+
" --backdrop-blur-xs: 4px;",
|
|
1087
|
+
" --backdrop-blur-sm: 4px;",
|
|
1088
|
+
" --backdrop-blur: 8px;",
|
|
1089
|
+
"",
|
|
1090
|
+
" --radius-xs: 0.125rem;",
|
|
1091
|
+
" --radius-sm: 0.125rem;",
|
|
1092
|
+
" --radius: 0.25rem;",
|
|
1093
|
+
"}",
|
|
1094
|
+
createTailwindV3DefaultColorThemeCss()
|
|
1095
|
+
].join("\n");
|
|
1096
|
+
const TAILWIND_V3_COMPATIBILITY_BASE_CSS = [
|
|
1097
|
+
"*,",
|
|
1098
|
+
"::after,",
|
|
1099
|
+
"::before,",
|
|
1100
|
+
"::backdrop,",
|
|
1101
|
+
"::file-selector-button {",
|
|
1102
|
+
" border-color: var(--color-gray-200, currentcolor);",
|
|
1103
|
+
"}",
|
|
1104
|
+
"",
|
|
1105
|
+
"input::placeholder,",
|
|
1106
|
+
"textarea::placeholder {",
|
|
1107
|
+
" opacity: 1;",
|
|
1108
|
+
" color: var(--color-gray-400, currentcolor);",
|
|
1109
|
+
"}",
|
|
1110
|
+
"",
|
|
1111
|
+
"button:not(:disabled),",
|
|
1112
|
+
"[role=\"button\"]:not(:disabled) {",
|
|
1113
|
+
" cursor: pointer;",
|
|
1114
|
+
"}",
|
|
1115
|
+
"",
|
|
1116
|
+
"dialog {",
|
|
1117
|
+
" margin: auto;",
|
|
1118
|
+
"}"
|
|
1119
|
+
].join("\n");
|
|
1120
|
+
function applyTailwindV3CompatibilityCss(css) {
|
|
1121
|
+
return `${TAILWIND_V3_COMPATIBILITY_THEME_CSS}\n${css}\n${TAILWIND_V3_COMPATIBILITY_BASE_CSS}`;
|
|
1122
|
+
}
|
|
1123
|
+
//#endregion
|
|
1124
|
+
//#region src/tailwindcss/v4-engine/tailwind-v4-default-colors.ts
|
|
1125
|
+
const TAILWIND_V4_COLOR_STEPS = [
|
|
1126
|
+
"50",
|
|
1127
|
+
"100",
|
|
1128
|
+
"200",
|
|
1129
|
+
"300",
|
|
1130
|
+
"400",
|
|
1131
|
+
"500",
|
|
1132
|
+
"600",
|
|
1133
|
+
"700",
|
|
1134
|
+
"800",
|
|
1135
|
+
"900",
|
|
1136
|
+
"950"
|
|
1137
|
+
];
|
|
1138
|
+
const TAILWIND_V4_COLOR_PALETTE = {
|
|
1139
|
+
slate: [
|
|
1140
|
+
"#f8fafc",
|
|
1141
|
+
"#f1f5f9",
|
|
1142
|
+
"#e2e8f0",
|
|
1143
|
+
"#cad5e2",
|
|
1144
|
+
"#90a1b9",
|
|
1145
|
+
"#62748e",
|
|
1146
|
+
"#45556c",
|
|
1147
|
+
"#314158",
|
|
1148
|
+
"#1d293d",
|
|
1149
|
+
"#0f172b",
|
|
1150
|
+
"#020618"
|
|
1151
|
+
],
|
|
1152
|
+
gray: [
|
|
1153
|
+
"#f9fafb",
|
|
1154
|
+
"#f3f4f6",
|
|
1155
|
+
"#e5e7eb",
|
|
1156
|
+
"#d1d5dc",
|
|
1157
|
+
"#99a1af",
|
|
1158
|
+
"#6a7282",
|
|
1159
|
+
"#4a5565",
|
|
1160
|
+
"#364153",
|
|
1161
|
+
"#1e2939",
|
|
1162
|
+
"#101828",
|
|
1163
|
+
"#030712"
|
|
1164
|
+
],
|
|
1165
|
+
zinc: [
|
|
1166
|
+
"#fafafa",
|
|
1167
|
+
"#f4f4f5",
|
|
1168
|
+
"#e4e4e7",
|
|
1169
|
+
"#d4d4d8",
|
|
1170
|
+
"#9f9fa9",
|
|
1171
|
+
"#71717b",
|
|
1172
|
+
"#52525c",
|
|
1173
|
+
"#3f3f46",
|
|
1174
|
+
"#27272a",
|
|
1175
|
+
"#18181b",
|
|
1176
|
+
"#09090b"
|
|
1177
|
+
],
|
|
1178
|
+
neutral: [
|
|
1179
|
+
"#fafafa",
|
|
1180
|
+
"#f5f5f5",
|
|
1181
|
+
"#e5e5e5",
|
|
1182
|
+
"#d4d4d4",
|
|
1183
|
+
"#a1a1a1",
|
|
1184
|
+
"#737373",
|
|
1185
|
+
"#525252",
|
|
1186
|
+
"#404040",
|
|
1187
|
+
"#262626",
|
|
1188
|
+
"#171717",
|
|
1189
|
+
"#0a0a0a"
|
|
1190
|
+
],
|
|
1191
|
+
stone: [
|
|
1192
|
+
"#fafaf9",
|
|
1193
|
+
"#f5f5f4",
|
|
1194
|
+
"#e7e5e4",
|
|
1195
|
+
"#d6d3d1",
|
|
1196
|
+
"#a6a09b",
|
|
1197
|
+
"#79716b",
|
|
1198
|
+
"#57534d",
|
|
1199
|
+
"#44403b",
|
|
1200
|
+
"#292524",
|
|
1201
|
+
"#1c1917",
|
|
1202
|
+
"#0c0a09"
|
|
1203
|
+
],
|
|
1204
|
+
mauve: [
|
|
1205
|
+
"#fafafa",
|
|
1206
|
+
"#f3f1f3",
|
|
1207
|
+
"#e7e4e7",
|
|
1208
|
+
"#d7d0d7",
|
|
1209
|
+
"#a89ea9",
|
|
1210
|
+
"#79697b",
|
|
1211
|
+
"#594c5b",
|
|
1212
|
+
"#463947",
|
|
1213
|
+
"#2a212c",
|
|
1214
|
+
"#1d161e",
|
|
1215
|
+
"#0c090c"
|
|
1216
|
+
],
|
|
1217
|
+
olive: [
|
|
1218
|
+
"#fbfbf9",
|
|
1219
|
+
"#f4f4f0",
|
|
1220
|
+
"#e8e8e3",
|
|
1221
|
+
"#d8d8d0",
|
|
1222
|
+
"#abab9c",
|
|
1223
|
+
"#7c7c67",
|
|
1224
|
+
"#5b5b4b",
|
|
1225
|
+
"#474739",
|
|
1226
|
+
"#2b2b22",
|
|
1227
|
+
"#1d1d16",
|
|
1228
|
+
"#0c0c09"
|
|
1229
|
+
],
|
|
1230
|
+
mist: [
|
|
1231
|
+
"#f9fbfb",
|
|
1232
|
+
"#f1f3f3",
|
|
1233
|
+
"#e3e7e8",
|
|
1234
|
+
"#d0d6d8",
|
|
1235
|
+
"#9ca8ab",
|
|
1236
|
+
"#67787c",
|
|
1237
|
+
"#4b585b",
|
|
1238
|
+
"#394447",
|
|
1239
|
+
"#22292b",
|
|
1240
|
+
"#161b1d",
|
|
1241
|
+
"#090b0c"
|
|
1242
|
+
],
|
|
1243
|
+
taupe: [
|
|
1244
|
+
"#fbfaf9",
|
|
1245
|
+
"#f3f1f1",
|
|
1246
|
+
"#e8e4e3",
|
|
1247
|
+
"#d8d2d0",
|
|
1248
|
+
"#aba09c",
|
|
1249
|
+
"#7c6d67",
|
|
1250
|
+
"#5b4f4b",
|
|
1251
|
+
"#473c39",
|
|
1252
|
+
"#2b2422",
|
|
1253
|
+
"#1d1816",
|
|
1254
|
+
"#0c0a09"
|
|
1255
|
+
],
|
|
1256
|
+
red: [
|
|
1257
|
+
"#fef2f2",
|
|
1258
|
+
"#ffe2e2",
|
|
1259
|
+
"#ffc9c9",
|
|
1260
|
+
"#ffa2a2",
|
|
1261
|
+
"#ff6467",
|
|
1262
|
+
"#fb2c36",
|
|
1263
|
+
"#e7000b",
|
|
1264
|
+
"#c10007",
|
|
1265
|
+
"#9f0712",
|
|
1266
|
+
"#82181a",
|
|
1267
|
+
"#460809"
|
|
1268
|
+
],
|
|
1269
|
+
orange: [
|
|
1270
|
+
"#fff7ed",
|
|
1271
|
+
"#ffedd4",
|
|
1272
|
+
"#ffd6a7",
|
|
1273
|
+
"#ffb86a",
|
|
1274
|
+
"#ff8904",
|
|
1275
|
+
"#ff6900",
|
|
1276
|
+
"#f54900",
|
|
1277
|
+
"#ca3500",
|
|
1278
|
+
"#9f2d00",
|
|
1279
|
+
"#7e2a0c",
|
|
1280
|
+
"#441306"
|
|
1281
|
+
],
|
|
1282
|
+
amber: [
|
|
1283
|
+
"#fffbeb",
|
|
1284
|
+
"#fef3c6",
|
|
1285
|
+
"#fee685",
|
|
1286
|
+
"#ffd230",
|
|
1287
|
+
"#ffb900",
|
|
1288
|
+
"#fe9a00",
|
|
1289
|
+
"#e17100",
|
|
1290
|
+
"#bb4d00",
|
|
1291
|
+
"#973c00",
|
|
1292
|
+
"#7b3306",
|
|
1293
|
+
"#461901"
|
|
1294
|
+
],
|
|
1295
|
+
yellow: [
|
|
1296
|
+
"#fefce8",
|
|
1297
|
+
"#fef9c2",
|
|
1298
|
+
"#fff085",
|
|
1299
|
+
"#ffdf20",
|
|
1300
|
+
"#fdc700",
|
|
1301
|
+
"#f0b100",
|
|
1302
|
+
"#d08700",
|
|
1303
|
+
"#a65f00",
|
|
1304
|
+
"#894b00",
|
|
1305
|
+
"#733e0a",
|
|
1306
|
+
"#432004"
|
|
1307
|
+
],
|
|
1308
|
+
lime: [
|
|
1309
|
+
"#f7fee7",
|
|
1310
|
+
"#ecfcca",
|
|
1311
|
+
"#d8f999",
|
|
1312
|
+
"#bbf451",
|
|
1313
|
+
"#9ae600",
|
|
1314
|
+
"#7ccf00",
|
|
1315
|
+
"#5ea500",
|
|
1316
|
+
"#497d00",
|
|
1317
|
+
"#3c6300",
|
|
1318
|
+
"#35530e",
|
|
1319
|
+
"#192e03"
|
|
1320
|
+
],
|
|
1321
|
+
green: [
|
|
1322
|
+
"#f0fdf4",
|
|
1323
|
+
"#dcfce7",
|
|
1324
|
+
"#b9f8cf",
|
|
1325
|
+
"#7bf1a8",
|
|
1326
|
+
"#05df72",
|
|
1327
|
+
"#00c950",
|
|
1328
|
+
"#00a63e",
|
|
1329
|
+
"#008236",
|
|
1330
|
+
"#016630",
|
|
1331
|
+
"#0d542b",
|
|
1332
|
+
"#032e15"
|
|
1333
|
+
],
|
|
1334
|
+
emerald: [
|
|
1335
|
+
"#ecfdf5",
|
|
1336
|
+
"#d0fae5",
|
|
1337
|
+
"#a4f4cf",
|
|
1338
|
+
"#5ee9b5",
|
|
1339
|
+
"#00d492",
|
|
1340
|
+
"#00bc7d",
|
|
1341
|
+
"#009966",
|
|
1342
|
+
"#007a55",
|
|
1343
|
+
"#006045",
|
|
1344
|
+
"#004f3b",
|
|
1345
|
+
"#002c22"
|
|
1346
|
+
],
|
|
1347
|
+
teal: [
|
|
1348
|
+
"#f0fdfa",
|
|
1349
|
+
"#cbfbf1",
|
|
1350
|
+
"#96f7e4",
|
|
1351
|
+
"#46ecd5",
|
|
1352
|
+
"#00d5be",
|
|
1353
|
+
"#00bba7",
|
|
1354
|
+
"#009689",
|
|
1355
|
+
"#00786f",
|
|
1356
|
+
"#005f5a",
|
|
1357
|
+
"#0b4f4a",
|
|
1358
|
+
"#022f2e"
|
|
1359
|
+
],
|
|
1360
|
+
cyan: [
|
|
1361
|
+
"#ecfeff",
|
|
1362
|
+
"#cefafe",
|
|
1363
|
+
"#a2f4fd",
|
|
1364
|
+
"#53eafd",
|
|
1365
|
+
"#00d3f2",
|
|
1366
|
+
"#00b8db",
|
|
1367
|
+
"#0092b8",
|
|
1368
|
+
"#007595",
|
|
1369
|
+
"#005f78",
|
|
1370
|
+
"#104e64",
|
|
1371
|
+
"#053345"
|
|
1372
|
+
],
|
|
1373
|
+
sky: [
|
|
1374
|
+
"#f0f9ff",
|
|
1375
|
+
"#dff2fe",
|
|
1376
|
+
"#b8e6fe",
|
|
1377
|
+
"#74d4ff",
|
|
1378
|
+
"#00bcff",
|
|
1379
|
+
"#00a6f4",
|
|
1380
|
+
"#0084d1",
|
|
1381
|
+
"#0069a8",
|
|
1382
|
+
"#00598a",
|
|
1383
|
+
"#024a70",
|
|
1384
|
+
"#052f4a"
|
|
1385
|
+
],
|
|
1386
|
+
blue: [
|
|
1387
|
+
"#eff6ff",
|
|
1388
|
+
"#dbeafe",
|
|
1389
|
+
"#bedbff",
|
|
1390
|
+
"#8ec5ff",
|
|
1391
|
+
"#51a2ff",
|
|
1392
|
+
"#2b7fff",
|
|
1393
|
+
"#155dfc",
|
|
1394
|
+
"#1447e6",
|
|
1395
|
+
"#193cb8",
|
|
1396
|
+
"#1c398e",
|
|
1397
|
+
"#162456"
|
|
1398
|
+
],
|
|
1399
|
+
indigo: [
|
|
1400
|
+
"#eef2ff",
|
|
1401
|
+
"#e0e7ff",
|
|
1402
|
+
"#c6d2ff",
|
|
1403
|
+
"#a3b3ff",
|
|
1404
|
+
"#7c86ff",
|
|
1405
|
+
"#615fff",
|
|
1406
|
+
"#4f39f6",
|
|
1407
|
+
"#432dd7",
|
|
1408
|
+
"#372aac",
|
|
1409
|
+
"#312c85",
|
|
1410
|
+
"#1e1a4d"
|
|
1411
|
+
],
|
|
1412
|
+
violet: [
|
|
1413
|
+
"#f5f3ff",
|
|
1414
|
+
"#ede9fe",
|
|
1415
|
+
"#ddd6ff",
|
|
1416
|
+
"#c4b4ff",
|
|
1417
|
+
"#a684ff",
|
|
1418
|
+
"#8e51ff",
|
|
1419
|
+
"#7f22fe",
|
|
1420
|
+
"#7008e7",
|
|
1421
|
+
"#5d0ec0",
|
|
1422
|
+
"#4d179a",
|
|
1423
|
+
"#2f0d68"
|
|
1424
|
+
],
|
|
1425
|
+
purple: [
|
|
1426
|
+
"#faf5ff",
|
|
1427
|
+
"#f3e8ff",
|
|
1428
|
+
"#e9d4ff",
|
|
1429
|
+
"#dab2ff",
|
|
1430
|
+
"#c27aff",
|
|
1431
|
+
"#ad46ff",
|
|
1432
|
+
"#9810fa",
|
|
1433
|
+
"#8200db",
|
|
1434
|
+
"#6e11b0",
|
|
1435
|
+
"#59168b",
|
|
1436
|
+
"#3c0366"
|
|
1437
|
+
],
|
|
1438
|
+
fuchsia: [
|
|
1439
|
+
"#fdf4ff",
|
|
1440
|
+
"#fae8ff",
|
|
1441
|
+
"#f6cfff",
|
|
1442
|
+
"#f4a8ff",
|
|
1443
|
+
"#ed6aff",
|
|
1444
|
+
"#e12afb",
|
|
1445
|
+
"#c800de",
|
|
1446
|
+
"#a800b7",
|
|
1447
|
+
"#8a0194",
|
|
1448
|
+
"#721378",
|
|
1449
|
+
"#4b004f"
|
|
1450
|
+
],
|
|
1451
|
+
pink: [
|
|
1452
|
+
"#fdf2f8",
|
|
1453
|
+
"#fce7f3",
|
|
1454
|
+
"#fccee8",
|
|
1455
|
+
"#fda5d5",
|
|
1456
|
+
"#fb64b6",
|
|
1457
|
+
"#f6339a",
|
|
1458
|
+
"#e60076",
|
|
1459
|
+
"#c6005c",
|
|
1460
|
+
"#a3004c",
|
|
1461
|
+
"#861043",
|
|
1462
|
+
"#510424"
|
|
1463
|
+
],
|
|
1464
|
+
rose: [
|
|
1465
|
+
"#fff1f2",
|
|
1466
|
+
"#ffe4e6",
|
|
1467
|
+
"#ffccd3",
|
|
1468
|
+
"#ffa1ad",
|
|
1469
|
+
"#ff637e",
|
|
1470
|
+
"#ff2056",
|
|
1471
|
+
"#ec003f",
|
|
1472
|
+
"#c70036",
|
|
1473
|
+
"#a50036",
|
|
1474
|
+
"#8b0836",
|
|
1475
|
+
"#4d0218"
|
|
1476
|
+
]
|
|
1477
|
+
};
|
|
1478
|
+
function createTailwindV4DefaultColorThemeCss() {
|
|
1479
|
+
const declarations = [" --color-black: #000;", " --color-white: #fff;"];
|
|
1480
|
+
for (const [color, values] of Object.entries(TAILWIND_V4_COLOR_PALETTE)) for (let index = 0; index < TAILWIND_V4_COLOR_STEPS.length; index++) declarations.push(` --color-${color}-${TAILWIND_V4_COLOR_STEPS[index]}: ${values[index]};`);
|
|
1481
|
+
return [
|
|
1482
|
+
"@theme {",
|
|
1483
|
+
...declarations,
|
|
1484
|
+
"}"
|
|
1485
|
+
].join("\n");
|
|
1486
|
+
}
|
|
1487
|
+
//#endregion
|
|
1488
|
+
//#region src/tailwindcss/v4-engine/generator.ts
|
|
1489
|
+
const incrementalGenerateCache$1 = /* @__PURE__ */ new Map();
|
|
1490
|
+
const incrementalGenerateTaskCache = /* @__PURE__ */ new Map();
|
|
1491
|
+
function findLeadingImportInsertionIndex(css) {
|
|
1492
|
+
const importPattern = /(?:^|\n)\s*@import\b[^;]*;/g;
|
|
1493
|
+
let insertionIndex = 0;
|
|
1494
|
+
let match = importPattern.exec(css);
|
|
1495
|
+
while (match !== null) {
|
|
1496
|
+
insertionIndex = match.index + match[0].length;
|
|
1497
|
+
match = importPattern.exec(css);
|
|
1498
|
+
}
|
|
1499
|
+
return insertionIndex;
|
|
1500
|
+
}
|
|
1501
|
+
function applyMiniProgramTailwindV4DefaultColorCss(css) {
|
|
1502
|
+
const themeCss = createTailwindV4DefaultColorThemeCss();
|
|
1503
|
+
const insertionIndex = findLeadingImportInsertionIndex(css);
|
|
1504
|
+
if (insertionIndex === 0) return `${themeCss}\n${css}`;
|
|
1505
|
+
return `${css.slice(0, insertionIndex)}\n${themeCss}\n${css.slice(insertionIndex)}`;
|
|
1506
|
+
}
|
|
1507
|
+
function collectCandidates$1(candidates) {
|
|
1508
|
+
return new Set(candidates ?? []);
|
|
1509
|
+
}
|
|
1510
|
+
function createStableJson$1(value) {
|
|
1511
|
+
if (value === void 0) return "undefined";
|
|
1512
|
+
if (value === null || typeof value !== "object") return JSON.stringify(value);
|
|
1513
|
+
if (Array.isArray(value)) return `[${value.map((item) => createStableJson$1(item)).join(",")}]`;
|
|
1514
|
+
return `{${Object.keys(value).sort().map((key) => {
|
|
1515
|
+
const record = value;
|
|
1516
|
+
return `${JSON.stringify(key)}:${createStableJson$1(record[key])}`;
|
|
1517
|
+
}).join(",")}}`;
|
|
1518
|
+
}
|
|
1519
|
+
function createDependencyFingerprint$1(files) {
|
|
1520
|
+
return files.map((file) => {
|
|
1521
|
+
try {
|
|
1522
|
+
const stat = node_fs.default.statSync(file);
|
|
1523
|
+
return `${file}:${stat.size}:${stat.mtimeMs}`;
|
|
1524
|
+
} catch {
|
|
1525
|
+
return `${file}:missing`;
|
|
1526
|
+
}
|
|
1527
|
+
}).join("|");
|
|
1528
|
+
}
|
|
1529
|
+
function createIncrementalGenerateCacheKey$1(source, target, styleOptions, tailwindcssV3Compatibility) {
|
|
1530
|
+
return [
|
|
1531
|
+
source.projectRoot,
|
|
1532
|
+
source.base,
|
|
1533
|
+
createStableJson$1(source.baseFallbacks),
|
|
1534
|
+
source.css,
|
|
1535
|
+
createDependencyFingerprint$1(source.dependencies),
|
|
1536
|
+
target,
|
|
1537
|
+
createStableJson$1(styleOptions),
|
|
1538
|
+
createStableJson$1(tailwindcssV3Compatibility)
|
|
1539
|
+
].join("\0");
|
|
1540
|
+
}
|
|
1541
|
+
function createIncrementalGenerateTaskCacheKey(cacheKey, requestedCandidates, scanSources) {
|
|
1542
|
+
return [
|
|
1543
|
+
cacheKey,
|
|
1544
|
+
scanSources === true ? "scan:1" : "scan:0",
|
|
1545
|
+
[...requestedCandidates].sort().join("\n")
|
|
1546
|
+
].join("\0");
|
|
1547
|
+
}
|
|
1548
|
+
function runIncrementalGenerateTask(cacheKey, requestedCandidates, scanSources, task) {
|
|
1549
|
+
const taskKey = createIncrementalGenerateTaskCacheKey(cacheKey, requestedCandidates, scanSources);
|
|
1550
|
+
const cachedTask = incrementalGenerateTaskCache.get(taskKey);
|
|
1551
|
+
if (cachedTask) return cachedTask;
|
|
1552
|
+
const promise = task();
|
|
1553
|
+
incrementalGenerateTaskCache.set(taskKey, promise);
|
|
1554
|
+
promise.finally(() => {
|
|
1555
|
+
if (incrementalGenerateTaskCache.get(taskKey) === promise) incrementalGenerateTaskCache.delete(taskKey);
|
|
1556
|
+
});
|
|
1557
|
+
return promise;
|
|
1558
|
+
}
|
|
1559
|
+
function createIncrementalDesignSystemPromise(source, cacheKey) {
|
|
1560
|
+
const promise = (0, tailwindcss_patch.loadTailwindV4DesignSystem)(source);
|
|
1561
|
+
promise.catch(() => {
|
|
1562
|
+
if (incrementalGenerateCache$1.get(cacheKey)?.designSystemPromise === promise) incrementalGenerateCache$1.delete(cacheKey);
|
|
1563
|
+
});
|
|
1564
|
+
return promise;
|
|
1565
|
+
}
|
|
1566
|
+
function createCompatibleSource(source, target, tailwindcssV3Compatibility) {
|
|
1567
|
+
const shouldApplyTailwindV3Compatibility = tailwindcssV3Compatibility ?? target === "weapp";
|
|
1568
|
+
const filteredSourceCss = target === "weapp" ? removeUnlayeredTailwindV4PreflightImports(source.css) : source.css;
|
|
1569
|
+
const compatibleSourceCss = removeUnsupportedThemeVendorKeyframes(shouldApplyTailwindV3Compatibility ? applyTailwindV3CompatibilityCss(filteredSourceCss) : target === "weapp" ? applyMiniProgramTailwindV4DefaultColorCss(filteredSourceCss) : filteredSourceCss);
|
|
1570
|
+
return compatibleSourceCss === source.css ? source : {
|
|
1571
|
+
...source,
|
|
1572
|
+
css: compatibleSourceCss
|
|
1573
|
+
};
|
|
1574
|
+
}
|
|
1575
|
+
function resolveTargetCandidates(candidates, target) {
|
|
1576
|
+
const collected = collectCandidates$1(candidates);
|
|
1577
|
+
return target === "weapp" ? filterUnsupportedMiniProgramTailwindV4Candidates(collected) : collected;
|
|
1578
|
+
}
|
|
1579
|
+
function collectSeenCandidates(generated, requestedCandidates) {
|
|
1580
|
+
return new Set([
|
|
1581
|
+
...requestedCandidates,
|
|
1582
|
+
...generated.rawCandidates,
|
|
1583
|
+
...generated.classSet
|
|
1584
|
+
]);
|
|
1585
|
+
}
|
|
1586
|
+
function createIncrementalStyleOptions(styleOptions) {
|
|
1587
|
+
return {
|
|
1588
|
+
...styleOptions,
|
|
1589
|
+
isMainChunk: false
|
|
1590
|
+
};
|
|
1591
|
+
}
|
|
1592
|
+
function collectCustomPropertyValues(css) {
|
|
1593
|
+
const values = /* @__PURE__ */ new Map();
|
|
1594
|
+
try {
|
|
1595
|
+
postcss.default.parse(css).walkDecls((decl) => {
|
|
1596
|
+
if (decl.prop.startsWith("--")) values.set(decl.prop, decl.value.trim());
|
|
1597
|
+
});
|
|
1598
|
+
} catch {}
|
|
1599
|
+
return values;
|
|
1600
|
+
}
|
|
1601
|
+
function mergeCustomPropertyValues(target, css) {
|
|
1602
|
+
for (const [prop, value] of collectCustomPropertyValues(css)) target.set(prop, value);
|
|
1603
|
+
}
|
|
1604
|
+
function seedIncrementalGenerateCache(options) {
|
|
1605
|
+
const cacheKey = createIncrementalGenerateCacheKey$1(options.compatibleSource, options.target, options.styleOptions, options.tailwindcssV3Compatibility);
|
|
1606
|
+
const customPropertyValues = collectCustomPropertyValues(options.compatibleSource.css);
|
|
1607
|
+
mergeCustomPropertyValues(customPropertyValues, options.generated.css);
|
|
1608
|
+
incrementalGenerateCache$1.set(cacheKey, {
|
|
1609
|
+
seenCandidates: collectSeenCandidates(options.generated, options.requestedCandidates),
|
|
1610
|
+
classSet: new Set(options.generated.classSet),
|
|
1611
|
+
css: options.generated.css,
|
|
1612
|
+
rawCss: options.generated.rawCss,
|
|
1613
|
+
customPropertyValues,
|
|
1614
|
+
designSystemPromise: createIncrementalDesignSystemPromise(options.compatibleSource, cacheKey),
|
|
1615
|
+
dependencies: options.generated.dependencies,
|
|
1616
|
+
sources: options.generated.sources,
|
|
1617
|
+
root: options.generated.root,
|
|
1618
|
+
target: options.generated.target
|
|
1619
|
+
});
|
|
1620
|
+
}
|
|
1621
|
+
function parseImportSourceParam$1(params) {
|
|
1622
|
+
const match = /\bsource\(\s*(none|(['"])(.*?)\2)\s*\)/.exec(params);
|
|
1623
|
+
if (!match) return;
|
|
1624
|
+
return {
|
|
1625
|
+
none: match[1] === "none",
|
|
1626
|
+
sourcePath: match[3]
|
|
1627
|
+
};
|
|
1628
|
+
}
|
|
1629
|
+
function isTailwindCssImport$1(params) {
|
|
1630
|
+
return /^\s*(['"])tailwindcss(?:\/[^'"]*)?\1/.test(params);
|
|
1631
|
+
}
|
|
1632
|
+
function parseCssImportSpecifier$1(params) {
|
|
1633
|
+
const value = params.trim();
|
|
1634
|
+
const quoted = /^(['"])(.*?)\1/.exec(value);
|
|
1635
|
+
if (quoted) return quoted[2];
|
|
1636
|
+
const url = /^url\(\s*(?:(['"])(.*?)\1|([^'")\s]+))\s*\)/.exec(value);
|
|
1637
|
+
return url?.[2] ?? url?.[3];
|
|
1638
|
+
}
|
|
1639
|
+
function isTailwindCssPreflightImport(params) {
|
|
1640
|
+
const specifier = parseCssImportSpecifier$1(params);
|
|
1641
|
+
return specifier === "tailwindcss/preflight.css" || specifier === "tailwindcss/preflight";
|
|
1642
|
+
}
|
|
1643
|
+
function hasImportLayerOption(params) {
|
|
1644
|
+
return /\blayer(?:\s*\(|\s*$)/.test(params);
|
|
1645
|
+
}
|
|
1646
|
+
function removeUnlayeredTailwindV4PreflightImports(css) {
|
|
1647
|
+
if (!css.includes("preflight")) return css;
|
|
1648
|
+
let root;
|
|
1649
|
+
try {
|
|
1650
|
+
root = postcss.default.parse(css);
|
|
1651
|
+
} catch {
|
|
1652
|
+
return css;
|
|
1653
|
+
}
|
|
1654
|
+
let changed = false;
|
|
1655
|
+
root.walkAtRules("import", (rule) => {
|
|
1656
|
+
if (isTailwindCssPreflightImport(rule.params) && !hasImportLayerOption(rule.params)) {
|
|
1657
|
+
rule.remove();
|
|
1658
|
+
changed = true;
|
|
1659
|
+
}
|
|
1660
|
+
});
|
|
1661
|
+
return changed ? root.toString() : css;
|
|
1662
|
+
}
|
|
1663
|
+
function resolveSourceBase$1(base, sourcePath) {
|
|
1664
|
+
return node_path.default.isAbsolute(sourcePath) ? sourcePath : node_path.default.resolve(base, sourcePath);
|
|
1665
|
+
}
|
|
1666
|
+
async function resolveCssDefinedScanSources(source) {
|
|
1667
|
+
let importSourceBase;
|
|
1668
|
+
let hasSourceNone = false;
|
|
1669
|
+
const from = source.dependencies[0];
|
|
1670
|
+
let root;
|
|
1671
|
+
try {
|
|
1672
|
+
root = postcss.default.parse(source.css, { from });
|
|
1673
|
+
} catch {
|
|
1674
|
+
return;
|
|
1675
|
+
}
|
|
1676
|
+
root.walkAtRules((rule) => {
|
|
1677
|
+
if (rule.name === "import") {
|
|
1678
|
+
if (!isTailwindCssImport$1(rule.params)) return;
|
|
1679
|
+
const sourceParam = parseImportSourceParam$1(rule.params);
|
|
1680
|
+
if (sourceParam?.none) hasSourceNone = true;
|
|
1681
|
+
if (sourceParam?.sourcePath) importSourceBase = resolveSourceBase$1(source.base, sourceParam.sourcePath);
|
|
1682
|
+
}
|
|
1683
|
+
});
|
|
1684
|
+
const sourcePatterns = await resolveCssSourceEntries(root, source.base, "**/*");
|
|
1685
|
+
if (!importSourceBase) {
|
|
1686
|
+
if (sourcePatterns.length > 0) return sourcePatterns;
|
|
1687
|
+
if (hasSourceNone) return false;
|
|
1688
|
+
return;
|
|
1689
|
+
}
|
|
1690
|
+
return [await resolveTailwindSourceEntry(".", importSourceBase, false, "**/*"), ...sourcePatterns];
|
|
1691
|
+
}
|
|
1692
|
+
async function resolveScanSources(source, scanSources) {
|
|
1693
|
+
if (scanSources !== true) return scanSources;
|
|
1694
|
+
return await resolveCssDefinedScanSources(source) ?? false;
|
|
1695
|
+
}
|
|
1696
|
+
function hasThemeParent(rule) {
|
|
1697
|
+
let parent = rule.parent;
|
|
1698
|
+
while (parent) {
|
|
1699
|
+
if (parent.type === "atrule" && parent.name === "theme") return true;
|
|
1700
|
+
parent = parent.parent;
|
|
1701
|
+
}
|
|
1702
|
+
return false;
|
|
1703
|
+
}
|
|
1704
|
+
function isVendorPrefixedKeyframes(rule) {
|
|
1705
|
+
return rule.name.startsWith("-") && rule.name.endsWith("keyframes");
|
|
1706
|
+
}
|
|
1707
|
+
function removeUnsupportedThemeVendorKeyframes(css) {
|
|
1708
|
+
if (!css.includes("@theme") || !css.includes("@-")) return css;
|
|
1709
|
+
let root;
|
|
1710
|
+
try {
|
|
1711
|
+
root = postcss.default.parse(css);
|
|
1712
|
+
} catch {
|
|
1713
|
+
return css;
|
|
1714
|
+
}
|
|
1715
|
+
let changed = false;
|
|
1716
|
+
root.walkAtRules((rule) => {
|
|
1717
|
+
if (isVendorPrefixedKeyframes(rule) && hasThemeParent(rule)) {
|
|
1718
|
+
rule.remove();
|
|
1719
|
+
changed = true;
|
|
1720
|
+
}
|
|
1721
|
+
});
|
|
1722
|
+
return changed ? root.toString() : css;
|
|
1723
|
+
}
|
|
1724
|
+
function createTailwindV4Engine(source) {
|
|
1725
|
+
async function generateOnce(generateSource, options = {}) {
|
|
1726
|
+
const { scanSources = true, styleOptions, tailwindcssV3Compatibility, target = "weapp", ...patchOptions } = options;
|
|
1727
|
+
const engine = (0, tailwindcss_patch.createTailwindV4Engine)(createCompatibleSource(generateSource, target, tailwindcssV3Compatibility));
|
|
1728
|
+
const resolvedScanSources = await resolveScanSources(generateSource, scanSources);
|
|
1729
|
+
const filesystemCandidates = Array.isArray(resolvedScanSources) ? new Set(await (0, tailwindcss_patch.extractRawCandidates)(resolvedScanSources)) : void 0;
|
|
1730
|
+
const resolvedCandidates = resolveTargetCandidates(new Set([...collectCandidates$1(patchOptions.candidates), ...filesystemCandidates ?? []]), target);
|
|
1731
|
+
const result = await engine.generate(omitUndefined({
|
|
1732
|
+
scanSources: false,
|
|
1733
|
+
...patchOptions,
|
|
1734
|
+
candidates: resolvedCandidates
|
|
1735
|
+
}));
|
|
1736
|
+
const rawCss = result.css;
|
|
1737
|
+
const css = await transformTailwindV4CssByTarget(rawCss, target, styleOptions);
|
|
1738
|
+
return {
|
|
1739
|
+
...result,
|
|
1740
|
+
css,
|
|
1741
|
+
rawCss,
|
|
1742
|
+
target
|
|
1743
|
+
};
|
|
1744
|
+
}
|
|
1745
|
+
async function generateWithIncrementalCache(options = {}) {
|
|
1746
|
+
const target = options.target ?? "weapp";
|
|
1747
|
+
const compatibleSource = createCompatibleSource(source, target, options.tailwindcssV3Compatibility);
|
|
1748
|
+
const requestedCandidates = resolveTargetCandidates(options.candidates, target);
|
|
1749
|
+
if ((options.sources?.length ?? 0) > 0 || options.bareArbitraryValues !== void 0 || Array.isArray(options.scanSources)) return generateOnce(source, options);
|
|
1750
|
+
const cacheKey = createIncrementalGenerateCacheKey$1(compatibleSource, target, options.styleOptions, options.tailwindcssV3Compatibility);
|
|
1751
|
+
if (options.scanSources === true) return runIncrementalGenerateTask(cacheKey, requestedCandidates, options.scanSources, async () => {
|
|
1752
|
+
const generated = await generateOnce(source, options);
|
|
1753
|
+
seedIncrementalGenerateCache({
|
|
1754
|
+
compatibleSource,
|
|
1755
|
+
generated,
|
|
1756
|
+
requestedCandidates,
|
|
1757
|
+
styleOptions: options.styleOptions,
|
|
1758
|
+
tailwindcssV3Compatibility: options.tailwindcssV3Compatibility,
|
|
1759
|
+
target
|
|
1760
|
+
});
|
|
1761
|
+
return generated;
|
|
1762
|
+
});
|
|
1763
|
+
const cached = incrementalGenerateCache$1.get(cacheKey);
|
|
1764
|
+
if (cached) {
|
|
1765
|
+
const missingCandidates = [...requestedCandidates].filter((candidate) => !cached.seenCandidates.has(candidate));
|
|
1766
|
+
if (missingCandidates.length === 0) return {
|
|
1767
|
+
css: cached.css,
|
|
1768
|
+
rawCss: cached.rawCss,
|
|
1769
|
+
incrementalCss: "",
|
|
1770
|
+
incrementalRawCss: "",
|
|
1771
|
+
classSet: new Set(cached.classSet),
|
|
1772
|
+
rawCandidates: new Set(cached.seenCandidates),
|
|
1773
|
+
dependencies: cached.dependencies,
|
|
1774
|
+
sources: cached.sources,
|
|
1775
|
+
root: cached.root,
|
|
1776
|
+
target: cached.target
|
|
1777
|
+
};
|
|
1778
|
+
return runIncrementalGenerateTask(cacheKey, requestedCandidates, options.scanSources, async () => {
|
|
1779
|
+
const cssByCandidate = (await cached.designSystemPromise).candidatesToCss(missingCandidates);
|
|
1780
|
+
const rawCssParts = [];
|
|
1781
|
+
const classSet = /* @__PURE__ */ new Set();
|
|
1782
|
+
for (let index = 0; index < missingCandidates.length; index += 1) {
|
|
1783
|
+
const candidate = missingCandidates[index];
|
|
1784
|
+
const css = cssByCandidate[index];
|
|
1785
|
+
if (candidate && typeof css === "string" && css.trim().length > 0) {
|
|
1786
|
+
rawCssParts.push(css);
|
|
1787
|
+
classSet.add(candidate);
|
|
1788
|
+
}
|
|
1789
|
+
}
|
|
1790
|
+
const rawCss = rawCssParts.join("\n");
|
|
1791
|
+
const incrementalCss = rawCss.length > 0 ? await transformTailwindV4CssByTarget(rawCss, target, {
|
|
1792
|
+
...createIncrementalStyleOptions(options.styleOptions),
|
|
1793
|
+
customPropertyValues: cached.customPropertyValues
|
|
1794
|
+
}) : "";
|
|
1795
|
+
for (const candidate of missingCandidates) cached.seenCandidates.add(candidate);
|
|
1796
|
+
for (const className of classSet) cached.classSet.add(className);
|
|
1797
|
+
cached.css = [cached.css, incrementalCss].filter(Boolean).join("\n");
|
|
1798
|
+
cached.rawCss = [cached.rawCss, rawCss].filter(Boolean).join("\n");
|
|
1799
|
+
mergeCustomPropertyValues(cached.customPropertyValues, incrementalCss);
|
|
1800
|
+
return {
|
|
1801
|
+
css: cached.css,
|
|
1802
|
+
rawCss: cached.rawCss,
|
|
1803
|
+
incrementalCss,
|
|
1804
|
+
incrementalRawCss: rawCss,
|
|
1805
|
+
classSet: new Set(cached.classSet),
|
|
1806
|
+
rawCandidates: new Set(cached.seenCandidates),
|
|
1807
|
+
dependencies: cached.dependencies,
|
|
1808
|
+
sources: cached.sources,
|
|
1809
|
+
root: cached.root,
|
|
1810
|
+
target: cached.target
|
|
1811
|
+
};
|
|
1812
|
+
});
|
|
1813
|
+
}
|
|
1814
|
+
return runIncrementalGenerateTask(cacheKey, requestedCandidates, options.scanSources, async () => {
|
|
1815
|
+
const generated = await generateOnce(source, options);
|
|
1816
|
+
seedIncrementalGenerateCache({
|
|
1817
|
+
compatibleSource,
|
|
1818
|
+
generated,
|
|
1819
|
+
requestedCandidates,
|
|
1820
|
+
styleOptions: options.styleOptions,
|
|
1821
|
+
tailwindcssV3Compatibility: options.tailwindcssV3Compatibility,
|
|
1822
|
+
target
|
|
1823
|
+
});
|
|
1824
|
+
return generated;
|
|
1825
|
+
});
|
|
1826
|
+
}
|
|
1827
|
+
async function generate(options = {}) {
|
|
1828
|
+
return options.incrementalCache ? generateWithIncrementalCache(options) : generateOnce(source, options);
|
|
1829
|
+
}
|
|
1830
|
+
return {
|
|
1831
|
+
source,
|
|
1832
|
+
loadDesignSystem: (0, tailwindcss_patch.createTailwindV4Engine)(source).loadDesignSystem,
|
|
1833
|
+
validateCandidates: (0, tailwindcss_patch.createTailwindV4Engine)(source).validateCandidates,
|
|
1834
|
+
generate
|
|
1835
|
+
};
|
|
1836
|
+
}
|
|
1837
|
+
//#endregion
|
|
1838
|
+
//#region src/tailwindcss/v4-engine/source.ts
|
|
1839
|
+
function isPostcssPluginImportTarget(value) {
|
|
1840
|
+
if (!value) return false;
|
|
1841
|
+
return value === "@tailwindcss/postcss" || value.includes("/postcss");
|
|
1842
|
+
}
|
|
1843
|
+
function uniqueDefined(values) {
|
|
1844
|
+
return [...new Set(values.filter((value) => typeof value === "string" && value.length > 0))];
|
|
1845
|
+
}
|
|
1846
|
+
function getProjectRoot$1(patcher) {
|
|
1847
|
+
return patcher.options?.projectRoot ?? node_process.default.cwd();
|
|
1848
|
+
}
|
|
1849
|
+
function resolveBase(value, fallback) {
|
|
1850
|
+
return value === void 0 ? fallback : node_path.default.isAbsolute(value) ? node_path.default.resolve(value) : node_path.default.resolve(fallback, value);
|
|
1851
|
+
}
|
|
1852
|
+
function resolveConfigDir(config, projectRoot) {
|
|
1853
|
+
if (!config) return;
|
|
1854
|
+
const configPath = node_path.default.isAbsolute(config) ? config : node_path.default.resolve(projectRoot, config);
|
|
1855
|
+
return node_path.default.dirname(configPath);
|
|
1856
|
+
}
|
|
1857
|
+
function isBarePackageSpecifier(specifier) {
|
|
1858
|
+
return !specifier.startsWith(".") && !specifier.startsWith("/") && !specifier.includes("\\") && !/^[a-z][a-z\d+.-]*:/i.test(specifier);
|
|
1859
|
+
}
|
|
1860
|
+
function parseCssImportSpecifier(params) {
|
|
1861
|
+
const value = params.trim();
|
|
1862
|
+
const quoted = /^(['"])(.*?)\1/.exec(value);
|
|
1863
|
+
if (quoted) {
|
|
1864
|
+
const specifier = quoted[2];
|
|
1865
|
+
if (specifier === void 0) return;
|
|
1866
|
+
return {
|
|
1867
|
+
quote: quoted[1],
|
|
1868
|
+
raw: quoted[0],
|
|
1869
|
+
specifier
|
|
1870
|
+
};
|
|
1871
|
+
}
|
|
1872
|
+
const url = /^url\(\s*(?:(['"])(.*?)\1|([^'")\s]+))\s*\)/.exec(value);
|
|
1873
|
+
if (!url) return;
|
|
1874
|
+
const specifier = url[2] ?? url[3];
|
|
1875
|
+
if (specifier === void 0) return;
|
|
1876
|
+
return {
|
|
1877
|
+
quote: url[1],
|
|
1878
|
+
raw: url[0],
|
|
1879
|
+
specifier
|
|
1880
|
+
};
|
|
1881
|
+
}
|
|
1882
|
+
function quoteCssImportSpecifier(specifier, quote = "\"") {
|
|
1883
|
+
return `${quote}${specifier.replaceAll("\\", "\\\\").replaceAll(quote, `\\${quote}`)}${quote}`;
|
|
1884
|
+
}
|
|
1885
|
+
function createTailwindV4CssImportSpecifierSet(packageName) {
|
|
1886
|
+
const specifiers = new Set(["tailwindcss"]);
|
|
1887
|
+
if (packageName && isBarePackageSpecifier(packageName)) specifiers.add(packageName);
|
|
1888
|
+
return specifiers;
|
|
1889
|
+
}
|
|
1890
|
+
function normalizeTailwindV4CssPackageImports(css, packageName) {
|
|
1891
|
+
if (!css.includes("tailwindcss")) return css;
|
|
1892
|
+
let root;
|
|
1893
|
+
try {
|
|
1894
|
+
root = postcss.default.parse(css);
|
|
1895
|
+
} catch {
|
|
1896
|
+
return css;
|
|
1897
|
+
}
|
|
1898
|
+
const importSpecifiers = createTailwindV4CssImportSpecifierSet(packageName);
|
|
1899
|
+
let changed = false;
|
|
1900
|
+
root.walkAtRules("import", (rule) => {
|
|
1901
|
+
const parsed = parseCssImportSpecifier(rule.params);
|
|
1902
|
+
if (!parsed || !importSpecifiers.has(parsed.specifier)) return;
|
|
1903
|
+
rule.params = rule.params.replace(parsed.raw, quoteCssImportSpecifier(`${parsed.specifier}/index.css`, parsed.quote));
|
|
1904
|
+
changed = true;
|
|
1905
|
+
});
|
|
1906
|
+
return changed ? root.toString() : css;
|
|
1907
|
+
}
|
|
1908
|
+
function resolveTailwindCssImportTarget(patcher) {
|
|
1909
|
+
const configuredPackageName = resolveTailwindcssOptions(patcher.options)?.packageName;
|
|
1910
|
+
if (typeof configuredPackageName === "string" && configuredPackageName.length > 0 && !isPostcssPluginImportTarget(configuredPackageName)) return configuredPackageName;
|
|
1911
|
+
const packageName = patcher.packageInfo?.name;
|
|
1912
|
+
if (typeof packageName === "string" && packageName.length > 0 && !isPostcssPluginImportTarget(packageName)) return packageName;
|
|
1913
|
+
return "tailwindcss";
|
|
1914
|
+
}
|
|
1915
|
+
function readTailwindV4Options(patcher) {
|
|
1916
|
+
return resolveTailwindcssOptions(patcher.options)?.v4 ?? patcher.options?.tailwind?.v4;
|
|
1917
|
+
}
|
|
1918
|
+
function isRawTailwindcssPatchOptions(options) {
|
|
1919
|
+
return Boolean(options && "tailwindcss" in options);
|
|
1920
|
+
}
|
|
1921
|
+
function resolvePatchTailwindV4SourceOptions(patcher) {
|
|
1922
|
+
if (patcher.options) {
|
|
1923
|
+
const projectRoot = getProjectRoot$1(patcher);
|
|
1924
|
+
const tailwindOptions = resolveTailwindcssOptions(patcher.options);
|
|
1925
|
+
const tailwindV4Options = readTailwindV4Options(patcher);
|
|
1926
|
+
const cwd = resolveBase(tailwindOptions?.cwd, projectRoot);
|
|
1927
|
+
const configuredBase = tailwindV4Options?.configuredBase ?? (isRawTailwindcssPatchOptions(patcher.options) ? tailwindV4Options?.base : void 0);
|
|
1928
|
+
const baseFallbacks = uniqueDefined([
|
|
1929
|
+
configuredBase,
|
|
1930
|
+
cwd,
|
|
1931
|
+
projectRoot,
|
|
1932
|
+
resolveConfigDir(tailwindOptions?.config, projectRoot)
|
|
1933
|
+
]);
|
|
1934
|
+
return {
|
|
1935
|
+
projectRoot,
|
|
1936
|
+
cwd,
|
|
1937
|
+
...configuredBase === void 0 ? {} : { base: configuredBase },
|
|
1938
|
+
baseFallbacks,
|
|
1939
|
+
...tailwindV4Options?.css === void 0 ? {} : { css: tailwindV4Options.css },
|
|
1940
|
+
...tailwindV4Options?.cssSources === void 0 ? {} : { cssSources: tailwindV4Options.cssSources },
|
|
1941
|
+
...tailwindV4Options?.cssEntries === void 0 ? {} : { cssEntries: tailwindV4Options.cssEntries },
|
|
1942
|
+
packageName: resolveTailwindCssImportTarget(patcher)
|
|
1943
|
+
};
|
|
1944
|
+
}
|
|
1945
|
+
return {
|
|
1946
|
+
projectRoot: getProjectRoot$1(patcher),
|
|
1947
|
+
packageName: resolveTailwindCssImportTarget(patcher)
|
|
1948
|
+
};
|
|
1949
|
+
}
|
|
1950
|
+
function resolveTailwindV4SourceOptionsFromPatcher(patcher) {
|
|
1951
|
+
const tailwindV4Options = readTailwindV4Options(patcher);
|
|
1952
|
+
return omitUndefined({
|
|
1953
|
+
...resolvePatchTailwindV4SourceOptions(patcher),
|
|
1954
|
+
sources: tailwindV4Options?.sources
|
|
1955
|
+
});
|
|
1956
|
+
}
|
|
1957
|
+
function resolveTailwindV4Source(options) {
|
|
1958
|
+
return (0, tailwindcss_patch.resolveTailwindV4Source)(options?.css === void 0 ? options : {
|
|
1959
|
+
...options,
|
|
1960
|
+
css: normalizeTailwindV4CssPackageImports(options.css, options.packageName)
|
|
1961
|
+
});
|
|
1962
|
+
}
|
|
1963
|
+
async function resolveTailwindV4SourceFromPatcher(patcher) {
|
|
1964
|
+
return resolveTailwindV4Source(resolveTailwindV4SourceOptionsFromPatcher(patcher));
|
|
1965
|
+
}
|
|
1966
|
+
//#endregion
|
|
1967
|
+
//#region src/bundlers/vite/static-config-content.ts
|
|
1968
|
+
function skipWhitespaceAndComments(source, start) {
|
|
1969
|
+
let index = start;
|
|
1970
|
+
while (index < source.length) {
|
|
1971
|
+
const char = source[index];
|
|
1972
|
+
if (/\s/.test(char ?? "")) {
|
|
1973
|
+
index += 1;
|
|
1974
|
+
continue;
|
|
1975
|
+
}
|
|
1976
|
+
if (char === "/" && source[index + 1] === "/") {
|
|
1977
|
+
index += 2;
|
|
1978
|
+
while (index < source.length && source[index] !== "\n") index += 1;
|
|
1979
|
+
continue;
|
|
1980
|
+
}
|
|
1981
|
+
if (char === "/" && source[index + 1] === "*") {
|
|
1982
|
+
index += 2;
|
|
1983
|
+
while (index < source.length && !(source[index] === "*" && source[index + 1] === "/")) index += 1;
|
|
1984
|
+
index = Math.min(index + 2, source.length);
|
|
1985
|
+
continue;
|
|
1986
|
+
}
|
|
1987
|
+
break;
|
|
1988
|
+
}
|
|
1989
|
+
return index;
|
|
1990
|
+
}
|
|
1991
|
+
function readQuotedString(source, start) {
|
|
1992
|
+
const quote = source[start];
|
|
1993
|
+
if (quote !== "\"" && quote !== "'") return;
|
|
1994
|
+
let value = "";
|
|
1995
|
+
for (let index = start + 1; index < source.length; index++) {
|
|
1996
|
+
const char = source[index];
|
|
1997
|
+
if (char === "\\") {
|
|
1998
|
+
const next = source[index + 1];
|
|
1999
|
+
if (next === void 0) return;
|
|
2000
|
+
value += next;
|
|
2001
|
+
index += 1;
|
|
2002
|
+
continue;
|
|
2003
|
+
}
|
|
2004
|
+
if (char === quote) return {
|
|
2005
|
+
end: index + 1,
|
|
2006
|
+
value
|
|
2007
|
+
};
|
|
2008
|
+
value += char;
|
|
2009
|
+
}
|
|
2010
|
+
}
|
|
2011
|
+
function readIdentifier(source, start) {
|
|
2012
|
+
return /^[A-Z_$][\w$]*/i.exec(source.slice(start))?.[0];
|
|
2013
|
+
}
|
|
2014
|
+
function findMatchingBracket(source, start, open, close) {
|
|
2015
|
+
let depth = 0;
|
|
2016
|
+
let quote;
|
|
2017
|
+
for (let index = start; index < source.length; index++) {
|
|
2018
|
+
const char = source[index];
|
|
2019
|
+
if (char === "\\") {
|
|
2020
|
+
index += 1;
|
|
2021
|
+
continue;
|
|
2022
|
+
}
|
|
2023
|
+
if (quote) {
|
|
2024
|
+
if (char === quote) quote = void 0;
|
|
2025
|
+
continue;
|
|
2026
|
+
}
|
|
2027
|
+
if (char === "\"" || char === "'") {
|
|
2028
|
+
quote = char;
|
|
2029
|
+
continue;
|
|
2030
|
+
}
|
|
2031
|
+
if (char === "`") return;
|
|
2032
|
+
if (char === open) {
|
|
2033
|
+
depth += 1;
|
|
2034
|
+
continue;
|
|
2035
|
+
}
|
|
2036
|
+
if (char === close) {
|
|
2037
|
+
depth -= 1;
|
|
2038
|
+
if (depth === 0) return index;
|
|
2039
|
+
}
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
2042
|
+
function findContentPropertyValue(source) {
|
|
2043
|
+
let index = 0;
|
|
2044
|
+
while (index < source.length) {
|
|
2045
|
+
const nextIndex = source.indexOf("content", index);
|
|
2046
|
+
if (nextIndex === -1) return;
|
|
2047
|
+
const previous = source[nextIndex - 1];
|
|
2048
|
+
const next = source[nextIndex + 7];
|
|
2049
|
+
if (previous && /[\w$]/.test(previous) || next && /[\w$]/.test(next)) {
|
|
2050
|
+
index = nextIndex + 7;
|
|
2051
|
+
continue;
|
|
2052
|
+
}
|
|
2053
|
+
let colonIndex = skipWhitespaceAndComments(source, nextIndex + 7);
|
|
2054
|
+
if (source[colonIndex] !== ":") {
|
|
2055
|
+
index = nextIndex + 7;
|
|
2056
|
+
continue;
|
|
2057
|
+
}
|
|
2058
|
+
colonIndex = skipWhitespaceAndComments(source, colonIndex + 1);
|
|
2059
|
+
return { start: colonIndex };
|
|
2060
|
+
}
|
|
2061
|
+
}
|
|
2062
|
+
function parseStaticContentArray(source, start) {
|
|
2063
|
+
if (source[start] !== "[") return;
|
|
2064
|
+
const value = [];
|
|
2065
|
+
let index = skipWhitespaceAndComments(source, start + 1);
|
|
2066
|
+
while (index < source.length) {
|
|
2067
|
+
if (source[index] === "]") return {
|
|
2068
|
+
end: index + 1,
|
|
2069
|
+
value
|
|
2070
|
+
};
|
|
2071
|
+
const parsed = parseStaticContentValue(source, index);
|
|
2072
|
+
if (!parsed) return;
|
|
2073
|
+
value.push(parsed.value);
|
|
2074
|
+
index = skipWhitespaceAndComments(source, parsed.end);
|
|
2075
|
+
if (source[index] === ",") {
|
|
2076
|
+
index = skipWhitespaceAndComments(source, index + 1);
|
|
2077
|
+
continue;
|
|
2078
|
+
}
|
|
2079
|
+
if (source[index] === "]") continue;
|
|
2080
|
+
return;
|
|
2081
|
+
}
|
|
2082
|
+
}
|
|
2083
|
+
function parseStaticContentObject(source, start) {
|
|
2084
|
+
if (source[start] !== "{") return;
|
|
2085
|
+
const end = findMatchingBracket(source, start, "{", "}");
|
|
2086
|
+
if (end === void 0) return;
|
|
2087
|
+
let index = skipWhitespaceAndComments(source, start + 1);
|
|
2088
|
+
let files;
|
|
2089
|
+
while (index < end) {
|
|
2090
|
+
let key;
|
|
2091
|
+
const quotedKey = readQuotedString(source, index);
|
|
2092
|
+
if (quotedKey) {
|
|
2093
|
+
key = quotedKey.value;
|
|
2094
|
+
index = quotedKey.end;
|
|
2095
|
+
} else {
|
|
2096
|
+
key = readIdentifier(source, index);
|
|
2097
|
+
if (!key) return;
|
|
2098
|
+
index += key.length;
|
|
2099
|
+
}
|
|
2100
|
+
index = skipWhitespaceAndComments(source, index);
|
|
2101
|
+
if (source[index] !== ":") return;
|
|
2102
|
+
index = skipWhitespaceAndComments(source, index + 1);
|
|
2103
|
+
const parsedValue = parseStaticContentValue(source, index);
|
|
2104
|
+
if (!parsedValue) return;
|
|
2105
|
+
if (key === "files") files = parsedValue.value;
|
|
2106
|
+
index = skipWhitespaceAndComments(source, parsedValue.end);
|
|
2107
|
+
if (source[index] === ",") {
|
|
2108
|
+
index = skipWhitespaceAndComments(source, index + 1);
|
|
2109
|
+
continue;
|
|
2110
|
+
}
|
|
2111
|
+
if (index < end) return;
|
|
2112
|
+
}
|
|
2113
|
+
return files === void 0 ? void 0 : {
|
|
2114
|
+
end: end + 1,
|
|
2115
|
+
value: { files }
|
|
2116
|
+
};
|
|
2117
|
+
}
|
|
2118
|
+
function parseStaticContentValue(source, start) {
|
|
2119
|
+
const index = skipWhitespaceAndComments(source, start);
|
|
2120
|
+
const quoted = readQuotedString(source, index);
|
|
2121
|
+
if (quoted) return quoted;
|
|
2122
|
+
if (source[index] === "[") return parseStaticContentArray(source, index);
|
|
2123
|
+
if (source[index] === "{") return parseStaticContentObject(source, index);
|
|
2124
|
+
}
|
|
2125
|
+
function readStaticConfigContent(configPath) {
|
|
2126
|
+
let source;
|
|
2127
|
+
try {
|
|
2128
|
+
source = (0, node_fs.readFileSync)(configPath, "utf8");
|
|
2129
|
+
} catch {
|
|
2130
|
+
return;
|
|
2131
|
+
}
|
|
2132
|
+
const contentProperty = findContentPropertyValue(source);
|
|
2133
|
+
if (!contentProperty) return;
|
|
2134
|
+
return parseStaticContentValue(source, contentProperty.start)?.value;
|
|
2135
|
+
}
|
|
2136
|
+
//#endregion
|
|
2137
|
+
//#region src/bundlers/vite/source-scan.ts
|
|
2138
|
+
const VITE_SOURCE_CANDIDATE_PATTERN = FULL_SOURCE_SCAN_PATTERN;
|
|
2139
|
+
const VITE_TAILWIND_CSS_ENTRY_PATTERN = "**/*.{css,less,sass,scss,styl,stylus,pcss,postcss}";
|
|
2140
|
+
const tailwindV4CssEntriesCache = /* @__PURE__ */ new Map();
|
|
2141
|
+
function parseImportSourceParam(params) {
|
|
2142
|
+
const match = /\bsource\(\s*(none|(['"])(.*?)\2)\s*\)/.exec(params);
|
|
2143
|
+
if (!match) return;
|
|
2144
|
+
return {
|
|
2145
|
+
none: match[1] === "none",
|
|
2146
|
+
sourcePath: match[3]
|
|
2147
|
+
};
|
|
2148
|
+
}
|
|
2149
|
+
function isTailwindCssImport(params) {
|
|
2150
|
+
return /^\s*(['"])tailwindcss(?:\/[^'"]*)?\1/.test(params);
|
|
2151
|
+
}
|
|
2152
|
+
function resolveSourceBase(base, sourcePath) {
|
|
2153
|
+
return node_path.default.isAbsolute(sourcePath) ? sourcePath : node_path.default.resolve(base, sourcePath);
|
|
2154
|
+
}
|
|
2155
|
+
function resolveConfigPath(base, configPath) {
|
|
2156
|
+
if (node_path.default.isAbsolute(configPath)) return node_path.default.resolve(configPath);
|
|
2157
|
+
let current = node_path.default.resolve(base);
|
|
2158
|
+
while (true) {
|
|
2159
|
+
const candidate = node_path.default.resolve(current, configPath);
|
|
2160
|
+
if ((0, node_fs.existsSync)(candidate)) return candidate;
|
|
2161
|
+
const parent = node_path.default.dirname(current);
|
|
2162
|
+
if (parent === current) break;
|
|
2163
|
+
current = parent;
|
|
2164
|
+
}
|
|
2165
|
+
return node_path.default.resolve(base, configPath);
|
|
2166
|
+
}
|
|
2167
|
+
function createCssEntriesCacheKey(css, base, dependencies) {
|
|
2168
|
+
return JSON.stringify({
|
|
2169
|
+
base: node_path.default.resolve(base),
|
|
2170
|
+
css,
|
|
2171
|
+
dependencies
|
|
2172
|
+
});
|
|
2173
|
+
}
|
|
2174
|
+
function addSourceScanDependency(dependencies, file) {
|
|
2175
|
+
if (typeof file === "string" && file.length > 0) dependencies.add(node_path.default.resolve(file));
|
|
2176
|
+
}
|
|
2177
|
+
function addSourceScanDependencies(dependencies, files) {
|
|
2178
|
+
for (const file of files ?? []) addSourceScanDependency(dependencies, file);
|
|
2179
|
+
}
|
|
2180
|
+
function createResolvedViteSourceScan(input, dependencies) {
|
|
2181
|
+
return {
|
|
2182
|
+
...input,
|
|
2183
|
+
...dependencies.size > 0 ? { dependencies: [...dependencies].sort() } : {}
|
|
2184
|
+
};
|
|
2185
|
+
}
|
|
2186
|
+
async function statConfigDependency(file) {
|
|
2187
|
+
try {
|
|
2188
|
+
const stats = await (0, node_fs_promises.stat)(file);
|
|
2189
|
+
return {
|
|
2190
|
+
file,
|
|
2191
|
+
mtimeMs: stats.mtimeMs,
|
|
2192
|
+
size: stats.size
|
|
2193
|
+
};
|
|
2194
|
+
} catch {
|
|
2195
|
+
return {
|
|
2196
|
+
file,
|
|
2197
|
+
mtimeMs: -1,
|
|
2198
|
+
size: -1
|
|
2199
|
+
};
|
|
2200
|
+
}
|
|
2201
|
+
}
|
|
2202
|
+
async function collectConfigDependencySignatures(root, base) {
|
|
2203
|
+
const configPaths = /* @__PURE__ */ new Set();
|
|
2204
|
+
root.walkAtRules("config", (rule) => {
|
|
2205
|
+
const configPath = parseConfigParam$1(rule.params);
|
|
2206
|
+
if (configPath) configPaths.add(resolveConfigPath(base, configPath));
|
|
2207
|
+
});
|
|
2208
|
+
return Promise.all([...configPaths].sort().map(statConfigDependency));
|
|
2209
|
+
}
|
|
2210
|
+
function mergeTailwindInlineSourceCandidates(allInlineCandidates) {
|
|
2211
|
+
const merged = {
|
|
2212
|
+
included: /* @__PURE__ */ new Set(),
|
|
2213
|
+
excluded: /* @__PURE__ */ new Set()
|
|
2214
|
+
};
|
|
2215
|
+
for (const inlineCandidates of allInlineCandidates) {
|
|
2216
|
+
if (!inlineCandidates) continue;
|
|
2217
|
+
for (const candidate of inlineCandidates.included) if (!merged.excluded.has(candidate)) merged.included.add(candidate);
|
|
2218
|
+
for (const candidate of inlineCandidates.excluded) {
|
|
2219
|
+
merged.excluded.add(candidate);
|
|
2220
|
+
merged.included.delete(candidate);
|
|
2221
|
+
}
|
|
2222
|
+
}
|
|
2223
|
+
return merged.included.size > 0 || merged.excluded.size > 0 ? merged : void 0;
|
|
2224
|
+
}
|
|
2225
|
+
async function resolveConfigContentEntries(root, base) {
|
|
2226
|
+
const configPaths = /* @__PURE__ */ new Set();
|
|
2227
|
+
root.walkAtRules("config", (rule) => {
|
|
2228
|
+
const configPath = parseConfigParam$1(rule.params);
|
|
2229
|
+
if (configPath) configPaths.add(resolveConfigPath(base, configPath));
|
|
2230
|
+
});
|
|
2231
|
+
const entries = [];
|
|
2232
|
+
for (const configPath of configPaths) {
|
|
2233
|
+
const staticContent = readStaticConfigContent(configPath);
|
|
2234
|
+
if (staticContent !== void 0) {
|
|
2235
|
+
entries.push(...normalizeLegacyContentEntries(staticContent, node_path.default.dirname(configPath)));
|
|
2236
|
+
continue;
|
|
2237
|
+
}
|
|
2238
|
+
try {
|
|
2239
|
+
const loaded = await (0, tailwindcss_config.loadConfig)({
|
|
2240
|
+
config: configPath,
|
|
2241
|
+
cwd: node_path.default.dirname(configPath)
|
|
2242
|
+
});
|
|
2243
|
+
entries.push(...normalizeLegacyContentEntries(loaded?.config.content, node_path.default.dirname(configPath)));
|
|
2244
|
+
} catch {}
|
|
2245
|
+
}
|
|
2246
|
+
return {
|
|
2247
|
+
dependencies: [...configPaths],
|
|
2248
|
+
entries
|
|
2249
|
+
};
|
|
2250
|
+
}
|
|
2251
|
+
async function resolveTailwindV4EntriesFromCss(css, base) {
|
|
2252
|
+
let root;
|
|
2253
|
+
try {
|
|
2254
|
+
root = postcss.default.parse(css);
|
|
2255
|
+
} catch {
|
|
2256
|
+
return;
|
|
2257
|
+
}
|
|
2258
|
+
let importSourceBase;
|
|
2259
|
+
let hasSourceNone = false;
|
|
2260
|
+
let hasTailwindCssImport = false;
|
|
2261
|
+
const [sourceEntries, configEntries] = await Promise.all([resolveCssSourceEntries(root, base, VITE_SOURCE_CANDIDATE_PATTERN), resolveConfigContentEntries(root, base)]);
|
|
2262
|
+
const entries = [...configEntries.entries, ...sourceEntries];
|
|
2263
|
+
const inlineCandidates = collectCssInlineSourceCandidates(root);
|
|
2264
|
+
root.walkAtRules("import", (rule) => {
|
|
2265
|
+
if (!isTailwindCssImport(rule.params)) return;
|
|
2266
|
+
hasTailwindCssImport = true;
|
|
2267
|
+
const sourceParam = parseImportSourceParam(rule.params);
|
|
2268
|
+
if (sourceParam?.none) hasSourceNone = true;
|
|
2269
|
+
if (sourceParam?.sourcePath) importSourceBase = resolveSourceBase(base, sourceParam.sourcePath);
|
|
2270
|
+
});
|
|
2271
|
+
if (importSourceBase) return {
|
|
2272
|
+
entries: [{
|
|
2273
|
+
base: importSourceBase,
|
|
2274
|
+
negated: false,
|
|
2275
|
+
pattern: VITE_SOURCE_CANDIDATE_PATTERN
|
|
2276
|
+
}, ...entries],
|
|
2277
|
+
explicit: true,
|
|
2278
|
+
inlineCandidates,
|
|
2279
|
+
dependencies: configEntries.dependencies
|
|
2280
|
+
};
|
|
2281
|
+
if (hasSourceNone) return {
|
|
2282
|
+
entries,
|
|
2283
|
+
explicit: true,
|
|
2284
|
+
inlineCandidates,
|
|
2285
|
+
dependencies: configEntries.dependencies
|
|
2286
|
+
};
|
|
2287
|
+
if (entries.length > 0) return {
|
|
2288
|
+
entries,
|
|
2289
|
+
explicit: true,
|
|
2290
|
+
inlineCandidates,
|
|
2291
|
+
dependencies: configEntries.dependencies
|
|
2292
|
+
};
|
|
2293
|
+
if (inlineCandidates.included.size > 0 || inlineCandidates.excluded.size > 0) return {
|
|
2294
|
+
entries: [],
|
|
2295
|
+
explicit: true,
|
|
2296
|
+
inlineCandidates,
|
|
2297
|
+
dependencies: configEntries.dependencies
|
|
2298
|
+
};
|
|
2299
|
+
return hasTailwindCssImport ? {
|
|
2300
|
+
entries: [],
|
|
2301
|
+
explicit: false,
|
|
2302
|
+
inlineCandidates,
|
|
2303
|
+
dependencies: configEntries.dependencies
|
|
2304
|
+
} : void 0;
|
|
2305
|
+
}
|
|
2306
|
+
async function resolveViteTailwindV4CssDependencies(css, base) {
|
|
2307
|
+
return (await resolveTailwindV4EntriesFromCss(css, base))?.dependencies ?? [];
|
|
2308
|
+
}
|
|
2309
|
+
function collectExistingCssEntries(options) {
|
|
2310
|
+
return [
|
|
2311
|
+
...options.cssEntries ?? [],
|
|
2312
|
+
...options.tailwindcss?.v4?.cssEntries ?? [],
|
|
2313
|
+
...options.tailwindcssPatcherOptions?.tailwindcss?.v4?.cssEntries ?? []
|
|
2314
|
+
].filter((item) => typeof item === "string" && item.length > 0).map((item) => node_path.default.resolve(item)).filter((item) => (0, node_fs.existsSync)(item));
|
|
2315
|
+
}
|
|
2316
|
+
async function pathExistsAsFile(file) {
|
|
2317
|
+
try {
|
|
2318
|
+
return (await (0, node_fs_promises.stat)(file)).isFile();
|
|
2319
|
+
} catch {
|
|
2320
|
+
return false;
|
|
2321
|
+
}
|
|
2322
|
+
}
|
|
2323
|
+
async function resolveTailwindV4EntriesFromCssCached(css, base) {
|
|
2324
|
+
let root;
|
|
2325
|
+
try {
|
|
2326
|
+
root = postcss.default.parse(css);
|
|
2327
|
+
} catch {
|
|
2328
|
+
return;
|
|
2329
|
+
}
|
|
2330
|
+
const cacheKey = createCssEntriesCacheKey(css, base, await collectConfigDependencySignatures(root, base));
|
|
2331
|
+
const cached = tailwindV4CssEntriesCache.get(cacheKey);
|
|
2332
|
+
if (cached) return cached;
|
|
2333
|
+
const task = resolveTailwindV4EntriesFromCss(css, base);
|
|
2334
|
+
tailwindV4CssEntriesCache.set(cacheKey, task);
|
|
2335
|
+
return task;
|
|
2336
|
+
}
|
|
2337
|
+
async function discoverTailwindV4CssEntries(root, outDir) {
|
|
2338
|
+
const resolvedRoot = node_path.default.resolve(root);
|
|
2339
|
+
const ignore = ["**/node_modules/**", "**/.git/**"];
|
|
2340
|
+
const resolvedOutDir = outDir ? node_path.default.resolve(resolvedRoot, outDir) : void 0;
|
|
2341
|
+
if (resolvedOutDir) {
|
|
2342
|
+
const relativeOutDir = node_path.default.relative(resolvedRoot, resolvedOutDir);
|
|
2343
|
+
if (relativeOutDir && !relativeOutDir.startsWith("..") && !node_path.default.isAbsolute(relativeOutDir)) ignore.push(`${relativeOutDir.split(node_path.default.sep).join("/")}/**`);
|
|
2344
|
+
}
|
|
2345
|
+
const candidates = await (0, fast_glob.default)(VITE_TAILWIND_CSS_ENTRY_PATTERN, {
|
|
2346
|
+
absolute: true,
|
|
2347
|
+
cwd: resolvedRoot,
|
|
2348
|
+
ignore,
|
|
2349
|
+
onlyFiles: true,
|
|
2350
|
+
unique: true
|
|
2351
|
+
});
|
|
2352
|
+
const entries = [];
|
|
2353
|
+
for (const file of candidates) {
|
|
2354
|
+
if (!await pathExistsAsFile(file)) continue;
|
|
2355
|
+
try {
|
|
2356
|
+
const css = (0, node_fs.readFileSync)(file, "utf8");
|
|
2357
|
+
if (css.includes("tailwindcss") || css.includes("@source") || css.includes("@config")) {
|
|
2358
|
+
if (await resolveTailwindV4EntriesFromCssCached(css, node_path.default.dirname(file))) entries.push(file);
|
|
2359
|
+
}
|
|
2360
|
+
} catch {}
|
|
2361
|
+
}
|
|
2362
|
+
return entries;
|
|
2363
|
+
}
|
|
2364
|
+
function collectConfiguredCssSources(options) {
|
|
2365
|
+
return [...options.tailwindcss?.v4?.cssSources ?? [], ...options.tailwindcssPatcherOptions?.tailwindcss?.v4?.cssSources ?? []];
|
|
2366
|
+
}
|
|
2367
|
+
async function resolveViteSourceScanEntries(options, patcher, scanOptions = {}) {
|
|
2368
|
+
if (patcher.majorVersion === 3) {
|
|
2369
|
+
const source = await resolveTailwindV3SourceFromPatcher(patcher);
|
|
2370
|
+
const contentEntries = normalizeLegacyContentEntries(source.configObject?.content, source.config ? node_path.default.dirname(source.config) : source.cwd);
|
|
2371
|
+
const dependencies = /* @__PURE__ */ new Set();
|
|
2372
|
+
addSourceScanDependency(dependencies, source.config);
|
|
2373
|
+
return contentEntries.length > 0 ? createResolvedViteSourceScan({ entries: contentEntries }, dependencies) : void 0;
|
|
2374
|
+
}
|
|
2375
|
+
if (patcher.majorVersion === 4) {
|
|
2376
|
+
const sourceOptions = resolveTailwindV4SourceOptionsFromPatcher(patcher);
|
|
2377
|
+
const cssEntries = collectExistingCssEntries(options);
|
|
2378
|
+
if (cssEntries.length === 0 && !sourceOptions.css && !sourceOptions.cssSources?.length) {
|
|
2379
|
+
const scanRoot = scanOptions.root;
|
|
2380
|
+
const sourceProjectRoot = sourceOptions.projectRoot;
|
|
2381
|
+
if (scanRoot && sourceProjectRoot && node_path.default.resolve(scanRoot) === node_path.default.resolve(sourceProjectRoot)) {
|
|
2382
|
+
const discoveredCssEntries = await discoverTailwindV4CssEntries(scanRoot, scanOptions.outDir);
|
|
2383
|
+
cssEntries.push(...discoveredCssEntries);
|
|
2384
|
+
}
|
|
2385
|
+
}
|
|
2386
|
+
const entries = [];
|
|
2387
|
+
const cssInlineCandidates = [];
|
|
2388
|
+
const dependencies = /* @__PURE__ */ new Set();
|
|
2389
|
+
let explicit = false;
|
|
2390
|
+
for (const cssEntry of cssEntries) {
|
|
2391
|
+
addSourceScanDependency(dependencies, cssEntry);
|
|
2392
|
+
const resolved = await resolveTailwindV4EntriesFromCssCached((0, node_fs.readFileSync)(cssEntry, "utf8"), node_path.default.dirname(cssEntry));
|
|
2393
|
+
if (resolved) {
|
|
2394
|
+
entries.push(...resolved.entries);
|
|
2395
|
+
cssInlineCandidates.push(resolved.inlineCandidates);
|
|
2396
|
+
addSourceScanDependencies(dependencies, resolved.dependencies);
|
|
2397
|
+
explicit || (explicit = resolved.explicit);
|
|
2398
|
+
}
|
|
2399
|
+
}
|
|
2400
|
+
const inlineCandidates = mergeTailwindInlineSourceCandidates(cssInlineCandidates);
|
|
2401
|
+
if (entries.length > 0 || inlineCandidates || explicit || cssEntries.length > 0) return createResolvedViteSourceScan({
|
|
2402
|
+
entries: explicit ? entries : entries.length > 0 ? entries : void 0,
|
|
2403
|
+
explicit,
|
|
2404
|
+
inlineCandidates
|
|
2405
|
+
}, dependencies);
|
|
2406
|
+
if (typeof sourceOptions.css === "string" && sourceOptions.css.length > 0) {
|
|
2407
|
+
const resolved = await resolveTailwindV4EntriesFromCssCached(sourceOptions.css, sourceOptions.base ?? sourceOptions.projectRoot ?? node_process.default.cwd());
|
|
2408
|
+
return resolved ? createResolvedViteSourceScan({
|
|
2409
|
+
entries: resolved.explicit ? resolved.entries : resolved.entries.length > 0 ? resolved.entries : void 0,
|
|
2410
|
+
explicit: resolved.explicit,
|
|
2411
|
+
inlineCandidates: resolved.inlineCandidates
|
|
2412
|
+
}, new Set(resolved.dependencies)) : void 0;
|
|
2413
|
+
}
|
|
2414
|
+
const sourceOptionBase = sourceOptions.base ?? sourceOptions.projectRoot ?? node_process.default.cwd();
|
|
2415
|
+
const configuredCssSources = collectConfiguredCssSources(options);
|
|
2416
|
+
for (const cssSource of [...configuredCssSources, ...sourceOptions.cssSources ?? []]) {
|
|
2417
|
+
if (typeof cssSource.css !== "string" || cssSource.css.length === 0) continue;
|
|
2418
|
+
addSourceScanDependency(dependencies, cssSource.file);
|
|
2419
|
+
addSourceScanDependencies(dependencies, cssSource.dependencies);
|
|
2420
|
+
const resolved = await resolveTailwindV4EntriesFromCssCached(cssSource.css, resolveTailwindV4CssSourceBase(cssSource, sourceOptionBase));
|
|
2421
|
+
if (resolved) {
|
|
2422
|
+
entries.push(...resolved.entries);
|
|
2423
|
+
cssInlineCandidates.push(resolved.inlineCandidates);
|
|
2424
|
+
addSourceScanDependencies(dependencies, resolved.dependencies);
|
|
2425
|
+
explicit || (explicit = resolved.explicit);
|
|
2426
|
+
}
|
|
2427
|
+
}
|
|
2428
|
+
const cssSourceInlineCandidates = mergeTailwindInlineSourceCandidates(cssInlineCandidates);
|
|
2429
|
+
if (entries.length > 0 || cssSourceInlineCandidates || explicit || sourceOptions.cssSources?.length || configuredCssSources.length > 0) return createResolvedViteSourceScan({
|
|
2430
|
+
entries: explicit ? entries : entries.length > 0 ? entries : void 0,
|
|
2431
|
+
explicit,
|
|
2432
|
+
inlineCandidates: cssSourceInlineCandidates
|
|
2433
|
+
}, dependencies);
|
|
2434
|
+
const source = await resolveTailwindV4SourceFromPatcher(patcher);
|
|
2435
|
+
addSourceScanDependency(dependencies, source.file);
|
|
2436
|
+
addSourceScanDependencies(dependencies, source.dependencies);
|
|
2437
|
+
const resolved = await resolveTailwindV4EntriesFromCssCached(source.css, source.base);
|
|
2438
|
+
return resolved ? createResolvedViteSourceScan({
|
|
2439
|
+
entries: resolved.explicit ? resolved.entries : resolved.entries.length > 0 ? resolved.entries : void 0,
|
|
2440
|
+
explicit: resolved.explicit,
|
|
2441
|
+
inlineCandidates: resolved.inlineCandidates
|
|
2442
|
+
}, new Set([...dependencies, ...resolved.dependencies])) : void 0;
|
|
2443
|
+
}
|
|
2444
|
+
}
|
|
2445
|
+
function createViteSourceScanMatcher(entries) {
|
|
2446
|
+
return createTailwindSourceEntryMatcher(entries);
|
|
2447
|
+
}
|
|
2448
|
+
//#endregion
|
|
2449
|
+
//#region src/tailwindcss/runtime/cache.ts
|
|
2450
|
+
const runtimeClassSetCache = /* @__PURE__ */ new WeakMap();
|
|
2451
|
+
const runtimeFileSignatureCache = /* @__PURE__ */ new Map();
|
|
2452
|
+
const runtimeTrackedSourceFilesCache = /* @__PURE__ */ new Map();
|
|
2453
|
+
let runtimeFileSignatureCacheClearTimer;
|
|
2454
|
+
const runtimeSignaturePatchersSymbol = Symbol.for("weapp-tailwindcss.runtimeSignaturePatchers");
|
|
2455
|
+
function getCacheEntry(twPatcher) {
|
|
2456
|
+
let entry = runtimeClassSetCache.get(twPatcher);
|
|
2457
|
+
if (!entry) {
|
|
2458
|
+
entry = {};
|
|
2459
|
+
runtimeClassSetCache.set(twPatcher, entry);
|
|
2460
|
+
}
|
|
2461
|
+
return entry;
|
|
2462
|
+
}
|
|
2463
|
+
function scheduleRuntimeConfigSignatureCacheClear() {
|
|
2464
|
+
if (runtimeFileSignatureCacheClearTimer) return;
|
|
2465
|
+
runtimeFileSignatureCacheClearTimer = setTimeout(() => {
|
|
2466
|
+
runtimeFileSignatureCache.clear();
|
|
2467
|
+
runtimeTrackedSourceFilesCache.clear();
|
|
2468
|
+
runtimeFileSignatureCacheClearTimer = void 0;
|
|
2469
|
+
}, 0);
|
|
2470
|
+
runtimeFileSignatureCacheClearTimer.unref?.();
|
|
2471
|
+
}
|
|
2472
|
+
function getFileSignature(filePath) {
|
|
2473
|
+
const cached = runtimeFileSignatureCache.get(filePath);
|
|
2474
|
+
if (cached !== void 0) return cached;
|
|
2475
|
+
let signature;
|
|
2476
|
+
try {
|
|
2477
|
+
const stats = (0, node_fs.statSync)(filePath);
|
|
2478
|
+
signature = `${filePath}:${stats.size}:${stats.mtimeMs}`;
|
|
2479
|
+
} catch {
|
|
2480
|
+
signature = `${filePath}:missing`;
|
|
2481
|
+
}
|
|
2482
|
+
runtimeFileSignatureCache.set(filePath, signature);
|
|
2483
|
+
scheduleRuntimeConfigSignatureCacheClear();
|
|
2484
|
+
return signature;
|
|
2485
|
+
}
|
|
2486
|
+
function getTailwindTrackedFiles(twPatcher) {
|
|
2487
|
+
const tailwindOptions = resolveTailwindcssOptions(twPatcher.options);
|
|
2488
|
+
const tracked = /* @__PURE__ */ new Set();
|
|
2489
|
+
const configPath = tailwindOptions?.config;
|
|
2490
|
+
if (typeof configPath === "string" && configPath.length > 0) tracked.add(configPath);
|
|
2491
|
+
for (const entry of tailwindOptions?.v4?.cssEntries ?? []) if (typeof entry === "string" && entry.length > 0) tracked.add(entry);
|
|
2492
|
+
for (const source of tailwindOptions?.v4?.cssSources ?? []) {
|
|
2493
|
+
if (typeof source.file === "string" && source.file.length > 0) tracked.add(source.file);
|
|
2494
|
+
for (const dependency of source.dependencies ?? []) if (typeof dependency === "string" && dependency.length > 0) tracked.add(dependency);
|
|
2495
|
+
}
|
|
2496
|
+
return tracked;
|
|
2497
|
+
}
|
|
2498
|
+
function normalizeTrackedSourceSignature(cssEntries, cssSources) {
|
|
2499
|
+
return normalizeSignatureValue({
|
|
2500
|
+
cssEntries: cssEntries?.map((entry) => {
|
|
2501
|
+
if (!(0, node_fs.existsSync)(entry)) return `${entry}:missing`;
|
|
2502
|
+
return getFileSignature(entry);
|
|
2503
|
+
}),
|
|
2504
|
+
cssSources
|
|
2505
|
+
});
|
|
2506
|
+
}
|
|
2507
|
+
async function collectTailwindV4TrackedSourceFiles(twPatcher) {
|
|
2508
|
+
const tailwindOptions = resolveTailwindcssOptions(twPatcher.options);
|
|
2509
|
+
const signature = normalizeTrackedSourceSignature(tailwindOptions?.v4?.cssEntries, tailwindOptions?.v4?.cssSources);
|
|
2510
|
+
const cached = runtimeTrackedSourceFilesCache.get(signature);
|
|
2511
|
+
if (cached) return cached;
|
|
2512
|
+
const files = /* @__PURE__ */ new Set();
|
|
2513
|
+
for (const cssEntry of tailwindOptions?.v4?.cssEntries ?? []) {
|
|
2514
|
+
if (!(0, node_fs.existsSync)(cssEntry)) continue;
|
|
2515
|
+
const resolved = await resolveTailwindV4EntriesFromCssCached((0, node_fs.readFileSync)(cssEntry, "utf8"), node_path.default.dirname(cssEntry));
|
|
2516
|
+
const expanded = resolved?.entries?.length ? await expandTailwindSourceEntries(resolved.entries) : [];
|
|
2517
|
+
for (const file of expanded) files.add(file);
|
|
2518
|
+
}
|
|
2519
|
+
for (const cssSource of tailwindOptions?.v4?.cssSources ?? []) {
|
|
2520
|
+
if (typeof cssSource.css !== "string" || cssSource.css.length === 0) continue;
|
|
2521
|
+
const base = typeof cssSource.file === "string" && cssSource.file.length > 0 ? node_path.default.dirname(cssSource.file) : tailwindOptions?.v4?.base ?? tailwindOptions?.cwd ?? twPatcher.options?.projectRoot ?? node_process.default.cwd();
|
|
2522
|
+
const resolved = await resolveTailwindV4EntriesFromCssCached(cssSource.css, base);
|
|
2523
|
+
const expanded = resolved?.entries?.length ? await expandTailwindSourceEntries(resolved.entries) : [];
|
|
2524
|
+
for (const file of expanded) files.add(file);
|
|
2525
|
+
}
|
|
2526
|
+
const result = [...files].sort((a, b) => a.localeCompare(b));
|
|
2527
|
+
runtimeTrackedSourceFilesCache.set(signature, result);
|
|
2528
|
+
return result;
|
|
2529
|
+
}
|
|
2530
|
+
function normalizeSignatureValue(value) {
|
|
2531
|
+
if (value == null) return "null";
|
|
2532
|
+
if (typeof value === "string") return value;
|
|
2533
|
+
if (typeof value === "number" || typeof value === "boolean") return String(value);
|
|
2534
|
+
if (Array.isArray(value)) return `[${value.map((item) => normalizeSignatureValue(item)).join(",")}]`;
|
|
2535
|
+
if (typeof value === "object") return `{${Object.entries(value).filter(([, item]) => item !== void 0).sort(([a], [b]) => a.localeCompare(b)).map(([key, item]) => `${key}:${normalizeSignatureValue(item)}`).join(",")}}`;
|
|
2536
|
+
return String(value);
|
|
2537
|
+
}
|
|
2538
|
+
function readOptionalProperty(value, key) {
|
|
2539
|
+
if (typeof value !== "object" || value === null || !(key in value)) return;
|
|
2540
|
+
return value[key];
|
|
2541
|
+
}
|
|
2542
|
+
function getTailwindOptionsSignature(twPatcher) {
|
|
2543
|
+
const options = twPatcher.options;
|
|
2544
|
+
const tailwindOptions = resolveTailwindcssOptions(options);
|
|
2545
|
+
return normalizeSignatureValue({
|
|
2546
|
+
projectRoot: options?.projectRoot,
|
|
2547
|
+
packageName: tailwindOptions?.packageName,
|
|
2548
|
+
versionHint: readOptionalProperty(tailwindOptions, "versionHint"),
|
|
2549
|
+
cwd: tailwindOptions?.cwd,
|
|
2550
|
+
config: tailwindOptions?.config,
|
|
2551
|
+
v2: tailwindOptions?.v2,
|
|
2552
|
+
v3: tailwindOptions?.v3,
|
|
2553
|
+
v4: {
|
|
2554
|
+
base: tailwindOptions?.v4?.base,
|
|
2555
|
+
configuredBase: readOptionalProperty(tailwindOptions?.v4, "configuredBase"),
|
|
2556
|
+
css: tailwindOptions?.v4?.css,
|
|
2557
|
+
cssEntries: tailwindOptions?.v4?.cssEntries,
|
|
2558
|
+
cssSources: tailwindOptions?.v4?.cssSources,
|
|
2559
|
+
hasUserDefinedSources: readOptionalProperty(tailwindOptions?.v4, "hasUserDefinedSources"),
|
|
2560
|
+
sources: tailwindOptions?.v4?.sources
|
|
2561
|
+
}
|
|
2562
|
+
});
|
|
2563
|
+
}
|
|
2564
|
+
function getRuntimeTargetSignature(twPatcher) {
|
|
2565
|
+
const packageInfo = twPatcher.packageInfo;
|
|
2566
|
+
return [
|
|
2567
|
+
packageInfo?.name ?? "missing",
|
|
2568
|
+
packageInfo?.rootPath ?? "missing",
|
|
2569
|
+
packageInfo?.version ?? "unknown",
|
|
2570
|
+
twPatcher.majorVersion ?? "unknown",
|
|
2571
|
+
getTailwindOptionsSignature(twPatcher)
|
|
2572
|
+
].join(":");
|
|
2573
|
+
}
|
|
2574
|
+
function getNestedPatchers$1(twPatcher) {
|
|
2575
|
+
const nested = twPatcher[runtimeSignaturePatchersSymbol];
|
|
2576
|
+
return Array.isArray(nested) && nested.length > 0 ? nested : void 0;
|
|
2577
|
+
}
|
|
2578
|
+
function getOwnRuntimeClassSetSignature(twPatcher) {
|
|
2579
|
+
const trackedFiles = [...getTailwindTrackedFiles(twPatcher)].sort((a, b) => a.localeCompare(b)).map(getFileSignature);
|
|
2580
|
+
return `${trackedFiles.length > 0 ? trackedFiles.join("|") : "files:missing"}|runtime:${getRuntimeTargetSignature(twPatcher)}`;
|
|
2581
|
+
}
|
|
2582
|
+
function invalidateRuntimeClassSet(twPatcher) {
|
|
2583
|
+
if (!twPatcher) return;
|
|
2584
|
+
const nestedPatchers = getNestedPatchers$1(twPatcher);
|
|
2585
|
+
if (nestedPatchers) for (const patcher of nestedPatchers) invalidateRuntimeClassSet(patcher);
|
|
2586
|
+
for (const trackedFile of getTailwindTrackedFiles(twPatcher)) runtimeFileSignatureCache.delete(trackedFile);
|
|
2587
|
+
runtimeTrackedSourceFilesCache.clear();
|
|
2588
|
+
runtimeClassSetCache.delete(twPatcher);
|
|
2589
|
+
}
|
|
2590
|
+
function getRuntimeClassSetCacheEntry(twPatcher) {
|
|
2591
|
+
return getCacheEntry(twPatcher);
|
|
2592
|
+
}
|
|
2593
|
+
function getRuntimeClassSetSignature(twPatcher) {
|
|
2594
|
+
const nestedPatchers = getNestedPatchers$1(twPatcher);
|
|
2595
|
+
if (nestedPatchers) return nestedPatchers.map(getOwnRuntimeClassSetSignature).sort((a, b) => a.localeCompare(b)).join("||");
|
|
2596
|
+
return getOwnRuntimeClassSetSignature(twPatcher);
|
|
2597
|
+
}
|
|
2598
|
+
async function getRuntimeClassSetSignatureWithSources(twPatcher) {
|
|
2599
|
+
const baseSignature = getRuntimeClassSetSignature(twPatcher);
|
|
2600
|
+
if (twPatcher.majorVersion !== 4) return baseSignature;
|
|
2601
|
+
const trackedSourceFiles = await collectTailwindV4TrackedSourceFiles(twPatcher);
|
|
2602
|
+
if (trackedSourceFiles.length === 0) return baseSignature;
|
|
2603
|
+
return [baseSignature, trackedSourceFiles.map(getFileSignature).join("|")].join("|sources:");
|
|
2604
|
+
}
|
|
2605
|
+
//#endregion
|
|
2606
|
+
//#region src/tailwindcss/runtime-patch.ts
|
|
2607
|
+
const debug$1 = createDebug("[tailwindcss:runtime-patch] ");
|
|
2608
|
+
const require$1 = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
|
|
2609
|
+
const runtimePatchPromiseCache = /* @__PURE__ */ new WeakMap();
|
|
2610
|
+
function getNestedPatchers(twPatcher) {
|
|
2611
|
+
const nested = twPatcher[runtimeSignaturePatchersSymbol];
|
|
2612
|
+
return Array.isArray(nested) && nested.length > 0 ? nested : void 0;
|
|
2613
|
+
}
|
|
2614
|
+
function shouldApplyRuntimePatch(twPatcher) {
|
|
2615
|
+
return twPatcher.majorVersion === 3 && typeof twPatcher.patch === "function";
|
|
2616
|
+
}
|
|
2617
|
+
function clearTailwindcssRequireCache(twPatcher) {
|
|
2618
|
+
const rootPath = twPatcher.packageInfo?.rootPath;
|
|
2619
|
+
if (!rootPath) return;
|
|
2620
|
+
const normalizedRoot = node_path.default.resolve(rootPath);
|
|
2621
|
+
let count = 0;
|
|
2622
|
+
for (const id of Object.keys(require$1.cache)) {
|
|
2623
|
+
const normalizedId = node_path.default.resolve(id);
|
|
2624
|
+
if (normalizedId === normalizedRoot || normalizedId.startsWith(`${normalizedRoot}${node_path.default.sep}`)) {
|
|
2625
|
+
delete require$1.cache[id];
|
|
2626
|
+
count += 1;
|
|
2627
|
+
}
|
|
2628
|
+
}
|
|
2629
|
+
if (count > 0) debug$1("clear tailwindcss require cache after runtime patch, count=%d root=%s", count, normalizedRoot);
|
|
2630
|
+
}
|
|
2631
|
+
async function ensureTailwindcssRuntimePatch(twPatcher, options = {}) {
|
|
2632
|
+
const nestedPatchers = getNestedPatchers(twPatcher);
|
|
2633
|
+
if (nestedPatchers) {
|
|
2634
|
+
await Promise.all(nestedPatchers.map((patcher) => ensureTailwindcssRuntimePatch(patcher)));
|
|
2635
|
+
return;
|
|
2636
|
+
}
|
|
2637
|
+
if (!shouldApplyRuntimePatch(twPatcher)) return;
|
|
2638
|
+
const cached = runtimePatchPromiseCache.get(twPatcher);
|
|
2639
|
+
if (cached) {
|
|
2640
|
+
await cached;
|
|
2641
|
+
if (options.clearRequireCache) clearTailwindcssRequireCache(twPatcher);
|
|
2642
|
+
return;
|
|
2643
|
+
}
|
|
2644
|
+
const task = Promise.resolve().then(async () => {
|
|
2645
|
+
debug$1("apply tailwindcss runtime patch, package=%s version=%s root=%s", twPatcher.packageInfo?.name ?? "tailwindcss", twPatcher.packageInfo?.version ?? "unknown", twPatcher.packageInfo?.rootPath ?? "unknown");
|
|
2646
|
+
await twPatcher.patch?.();
|
|
2647
|
+
if (options.clearRequireCache) clearTailwindcssRequireCache(twPatcher);
|
|
2648
|
+
}).catch((error) => {
|
|
2649
|
+
runtimePatchPromiseCache.delete(twPatcher);
|
|
2650
|
+
throw error;
|
|
2651
|
+
});
|
|
2652
|
+
runtimePatchPromiseCache.set(twPatcher, task);
|
|
2653
|
+
return task;
|
|
2654
|
+
}
|
|
2655
|
+
//#endregion
|
|
2656
|
+
//#region src/tailwindcss/v3-engine/miniprogram.ts
|
|
2657
|
+
const defaultStyleHandler = (0, _weapp_tailwindcss_postcss.createStyleHandler)({
|
|
2658
|
+
cssChildCombinatorReplaceValue: ["view", "text"],
|
|
2659
|
+
cssRemoveHoverPseudoClass: true,
|
|
2660
|
+
isMainChunk: true,
|
|
2661
|
+
majorVersion: 3
|
|
2662
|
+
});
|
|
2663
|
+
const MINI_PROGRAM_V3_PREFLIGHT_SELECTORS = new Set([
|
|
2664
|
+
"view,text,:before,:after",
|
|
2665
|
+
"view,text,:after,:before",
|
|
2666
|
+
"view,text,::before,::after",
|
|
2667
|
+
"view,text,::after,::before"
|
|
2668
|
+
]);
|
|
2669
|
+
const V3_PREFLIGHT_RESET_PROPS = new Set([
|
|
2670
|
+
"box-sizing",
|
|
2671
|
+
"border",
|
|
2672
|
+
"border-width",
|
|
2673
|
+
"border-style",
|
|
2674
|
+
"border-color",
|
|
2675
|
+
"margin",
|
|
2676
|
+
"padding"
|
|
2677
|
+
]);
|
|
2678
|
+
function normalizeSelector(selector) {
|
|
2679
|
+
return selector.trim().replace(/\s+/g, "");
|
|
2680
|
+
}
|
|
2681
|
+
function isMiniProgramV3PreflightRule(rule) {
|
|
2682
|
+
return MINI_PROGRAM_V3_PREFLIGHT_SELECTORS.has(normalizeSelector(rule.selector));
|
|
2683
|
+
}
|
|
2684
|
+
function hasResetDeclaration(rule) {
|
|
2685
|
+
let found = false;
|
|
2686
|
+
rule.walkDecls((decl) => {
|
|
2687
|
+
if (V3_PREFLIGHT_RESET_PROPS.has(decl.prop)) found = true;
|
|
2688
|
+
});
|
|
2689
|
+
return found;
|
|
2690
|
+
}
|
|
2691
|
+
function createPreflightDeclarations(cssPreflight) {
|
|
2692
|
+
if (!cssPreflight || typeof cssPreflight !== "object") return [];
|
|
2693
|
+
return Object.entries(cssPreflight).filter((entry) => entry[1] !== false).map(([prop, value]) => postcss.default.decl({
|
|
2694
|
+
prop,
|
|
2695
|
+
value: value.toString()
|
|
2696
|
+
}));
|
|
2697
|
+
}
|
|
2698
|
+
function ensureMiniProgramV3PreflightReset(css, cssPreflight) {
|
|
2699
|
+
const declarations = createPreflightDeclarations(cssPreflight);
|
|
2700
|
+
if (declarations.length === 0) return css;
|
|
2701
|
+
try {
|
|
2702
|
+
const root = postcss.default.parse(css);
|
|
2703
|
+
let targetRule;
|
|
2704
|
+
let hasReset = false;
|
|
2705
|
+
root.walkRules((rule) => {
|
|
2706
|
+
if (!isMiniProgramV3PreflightRule(rule)) return;
|
|
2707
|
+
targetRule ?? (targetRule = rule);
|
|
2708
|
+
if (hasResetDeclaration(rule)) hasReset = true;
|
|
2709
|
+
});
|
|
2710
|
+
if (!targetRule || hasReset) return css;
|
|
2711
|
+
targetRule.append(...declarations.map((decl) => decl.clone()));
|
|
2712
|
+
return root.toString();
|
|
2713
|
+
} catch {
|
|
2714
|
+
return css;
|
|
2715
|
+
}
|
|
2716
|
+
}
|
|
2717
|
+
async function transformTailwindV3CssToWeapp(css, options) {
|
|
2718
|
+
return ensureMiniProgramV3PreflightReset((0, _weapp_tailwindcss_postcss.pruneMiniProgramGeneratedCss)((await defaultStyleHandler(css, {
|
|
2719
|
+
cssChildCombinatorReplaceValue: ["view", "text"],
|
|
2720
|
+
cssRemoveHoverPseudoClass: true,
|
|
2721
|
+
isMainChunk: true,
|
|
2722
|
+
majorVersion: 3,
|
|
2723
|
+
...options
|
|
2724
|
+
})).css, { preservePreflight: true }), options?.cssPreflight);
|
|
2725
|
+
}
|
|
2726
|
+
async function transformTailwindV3CssByTarget(css, target, options) {
|
|
2727
|
+
return target === "weapp" ? transformTailwindV3CssToWeapp(css, options) : css;
|
|
2728
|
+
}
|
|
2729
|
+
//#endregion
|
|
2730
|
+
//#region src/tailwindcss/v3-engine/generator.ts
|
|
2731
|
+
const runtimeReadyPromiseCache = /* @__PURE__ */ new Map();
|
|
2732
|
+
const incrementalGenerateCache = /* @__PURE__ */ new Map();
|
|
2733
|
+
function isLegacyContentObject(value) {
|
|
2734
|
+
return typeof value === "object" && value !== null && "files" in value;
|
|
2735
|
+
}
|
|
2736
|
+
function createRawContentEntries(candidates, sources) {
|
|
2737
|
+
const entries = [];
|
|
2738
|
+
const candidateContent = [...candidates].join(" ");
|
|
2739
|
+
if (candidateContent.length > 0) entries.push({
|
|
2740
|
+
raw: candidateContent,
|
|
2741
|
+
extension: "html"
|
|
2742
|
+
});
|
|
2743
|
+
for (const source of sources) entries.push({
|
|
2744
|
+
raw: source.content,
|
|
2745
|
+
extension: source.extension ?? "html"
|
|
2746
|
+
});
|
|
2747
|
+
return entries;
|
|
2748
|
+
}
|
|
2749
|
+
function createChangedContentEntries(candidates, sources) {
|
|
2750
|
+
return createRawContentEntries(candidates, sources).map((entry) => ({
|
|
2751
|
+
content: entry.raw,
|
|
2752
|
+
extension: entry.extension
|
|
2753
|
+
}));
|
|
2754
|
+
}
|
|
2755
|
+
function collectCandidates(candidates) {
|
|
2756
|
+
return new Set(candidates ?? []);
|
|
2757
|
+
}
|
|
2758
|
+
function collectApplyCandidatesFromCss(css) {
|
|
2759
|
+
if (!css.includes("@apply")) return [];
|
|
2760
|
+
const candidates = /* @__PURE__ */ new Set();
|
|
2761
|
+
try {
|
|
2762
|
+
postcss.default.parse(css).walkAtRules("apply", (rule) => {
|
|
2763
|
+
for (const candidate of rule.params.split(/\s+/)) {
|
|
2764
|
+
const normalized = candidate.replace(/!important$/, "").trim();
|
|
2765
|
+
if (normalized) candidates.add(normalized);
|
|
2766
|
+
}
|
|
2767
|
+
});
|
|
2768
|
+
} catch {}
|
|
2769
|
+
return [...candidates];
|
|
2770
|
+
}
|
|
2771
|
+
function isTailwindCandidateLayer(params) {
|
|
2772
|
+
return params.split(/[,\s]+/).some((layer) => layer === "components" || layer === "utilities");
|
|
2773
|
+
}
|
|
2774
|
+
function extractClassCandidatesFromSelector(selector, candidates) {
|
|
2775
|
+
for (let index = 0; index < selector.length; index++) {
|
|
2776
|
+
if (selector[index] !== ".") continue;
|
|
2777
|
+
let candidate = "";
|
|
2778
|
+
let escaped = false;
|
|
2779
|
+
for (let tokenIndex = index + 1; tokenIndex < selector.length; tokenIndex++) {
|
|
2780
|
+
const char = selector[tokenIndex];
|
|
2781
|
+
if (escaped) {
|
|
2782
|
+
candidate += char;
|
|
2783
|
+
escaped = false;
|
|
2784
|
+
continue;
|
|
2785
|
+
}
|
|
2786
|
+
if (char === "\\") {
|
|
2787
|
+
escaped = true;
|
|
2788
|
+
continue;
|
|
2789
|
+
}
|
|
2790
|
+
if (/[\w-]/.test(char)) {
|
|
2791
|
+
candidate += char;
|
|
2792
|
+
continue;
|
|
2793
|
+
}
|
|
2794
|
+
break;
|
|
2795
|
+
}
|
|
2796
|
+
if (candidate) candidates.add(candidate);
|
|
2797
|
+
}
|
|
2798
|
+
}
|
|
2799
|
+
function collectLayerCandidatesFromCss(css) {
|
|
2800
|
+
if (!css.includes("@layer")) return [];
|
|
2801
|
+
const candidates = /* @__PURE__ */ new Set();
|
|
2802
|
+
try {
|
|
2803
|
+
postcss.default.parse(css).walkAtRules("layer", (layer) => {
|
|
2804
|
+
if (!isTailwindCandidateLayer(layer.params)) return;
|
|
2805
|
+
layer.walkRules((rule) => {
|
|
2806
|
+
extractClassCandidatesFromSelector(rule.selector, candidates);
|
|
2807
|
+
});
|
|
2808
|
+
});
|
|
2809
|
+
} catch {}
|
|
2810
|
+
return [...candidates];
|
|
2811
|
+
}
|
|
2812
|
+
function mergeGenerateCandidates(source, options) {
|
|
2813
|
+
return collectCandidates([
|
|
2814
|
+
...collectLayerCandidatesFromCss(source.css),
|
|
2815
|
+
...collectApplyCandidatesFromCss(source.css),
|
|
2816
|
+
...collectCandidates(options.candidates)
|
|
2817
|
+
]);
|
|
2818
|
+
}
|
|
2819
|
+
function mergeContent(content, rawEntries) {
|
|
2820
|
+
if (isLegacyContentObject(content)) return {
|
|
2821
|
+
...content,
|
|
2822
|
+
relative: content.relative ?? true,
|
|
2823
|
+
files: [...[].concat(content.files ?? []), ...rawEntries]
|
|
2824
|
+
};
|
|
2825
|
+
return {
|
|
2826
|
+
relative: true,
|
|
2827
|
+
files: [...[].concat(content ?? []), ...rawEntries]
|
|
2828
|
+
};
|
|
2829
|
+
}
|
|
2830
|
+
function normalizeConfigObject(config) {
|
|
2831
|
+
if (!config || typeof config !== "object") return config;
|
|
2832
|
+
const maybeDefault = config.default;
|
|
2833
|
+
if (maybeDefault && typeof maybeDefault === "object") return maybeDefault;
|
|
2834
|
+
return config;
|
|
2835
|
+
}
|
|
2836
|
+
function hasExplicitContentInput(options) {
|
|
2837
|
+
return options.candidates !== void 0 || options.sources !== void 0;
|
|
2838
|
+
}
|
|
2839
|
+
function createExplicitContentConfig(rawEntries) {
|
|
2840
|
+
return {
|
|
2841
|
+
relative: true,
|
|
2842
|
+
files: rawEntries
|
|
2843
|
+
};
|
|
2844
|
+
}
|
|
2845
|
+
function createTailwindConfig(source, options) {
|
|
2846
|
+
const config = { ...normalizeConfigObject(source.configObject) ?? {} };
|
|
2847
|
+
const rawEntries = createRawContentEntries(mergeGenerateCandidates(source, options), options.sources ?? []);
|
|
2848
|
+
config.content = hasExplicitContentInput(options) ? createExplicitContentConfig(rawEntries) : mergeContent(config.content, rawEntries);
|
|
2849
|
+
return config;
|
|
2850
|
+
}
|
|
2851
|
+
function loadTailwindV3Internals(source) {
|
|
2852
|
+
const requireFromProject = (0, node_module.createRequire)(`${source.cwd}/package.json`);
|
|
2853
|
+
const requireFromRuntime = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
|
|
2854
|
+
const requireTailwind = (id) => {
|
|
2855
|
+
try {
|
|
2856
|
+
return requireFromProject(id);
|
|
2857
|
+
} catch {
|
|
2858
|
+
return requireFromRuntime(id);
|
|
2859
|
+
}
|
|
2860
|
+
};
|
|
2861
|
+
const collapseAdjacentRulesModule = requireTailwind(`${source.packageName}/lib/lib/collapseAdjacentRules`);
|
|
2862
|
+
const collapseDuplicateDeclarationsModule = requireTailwind(`${source.packageName}/lib/lib/collapseDuplicateDeclarations`);
|
|
2863
|
+
const generateRulesModule = requireTailwind(`${source.packageName}/lib/lib/generateRules`);
|
|
2864
|
+
const sharedStateModule = requireTailwind(`${source.packageName}/lib/lib/sharedState`);
|
|
2865
|
+
const setupContextUtils = requireTailwind(`${source.packageName}/lib/lib/setupContextUtils`);
|
|
2866
|
+
const processTailwindFeaturesModule = requireTailwind(`${source.packageName}/lib/processTailwindFeatures`);
|
|
2867
|
+
const resolveDefaultsAtRulesModule = requireTailwind(`${source.packageName}/lib/lib/resolveDefaultsAtRules`);
|
|
2868
|
+
const resolveConfigModule = requireTailwind(`${source.packageName}/lib/public/resolve-config`);
|
|
2869
|
+
const validateConfigModule = requireTailwind(`${source.packageName}/lib/util/validateConfig.js`);
|
|
2870
|
+
return {
|
|
2871
|
+
collapseAdjacentRules: collapseAdjacentRulesModule["default"] ?? collapseAdjacentRulesModule,
|
|
2872
|
+
collapseDuplicateDeclarations: collapseDuplicateDeclarationsModule["default"] ?? collapseDuplicateDeclarationsModule,
|
|
2873
|
+
createContext: setupContextUtils["createContext"],
|
|
2874
|
+
generateRules: generateRulesModule["generateRules"],
|
|
2875
|
+
notOnDemandCandidate: String(sharedStateModule["NOT_ON_DEMAND"] ?? "*"),
|
|
2876
|
+
processTailwindFeatures: processTailwindFeaturesModule["default"] ?? processTailwindFeaturesModule,
|
|
2877
|
+
resolveDefaultsAtRules: resolveDefaultsAtRulesModule["default"] ?? resolveDefaultsAtRulesModule,
|
|
2878
|
+
resolveConfig: resolveConfigModule["default"] ?? resolveConfigModule,
|
|
2879
|
+
validateConfig: validateConfigModule["validateConfig"]
|
|
2880
|
+
};
|
|
2881
|
+
}
|
|
2882
|
+
function createStableJson(value) {
|
|
2883
|
+
if (value === void 0) return "undefined";
|
|
2884
|
+
if (value === null || typeof value !== "object") return JSON.stringify(value);
|
|
2885
|
+
if (Array.isArray(value)) return `[${value.map((item) => createStableJson(item)).join(",")}]`;
|
|
2886
|
+
return `{${Object.keys(value).sort().map((key) => {
|
|
2887
|
+
const record = value;
|
|
2888
|
+
return `${JSON.stringify(key)}:${createStableJson(record[key])}`;
|
|
2889
|
+
}).join(",")}}`;
|
|
2890
|
+
}
|
|
2891
|
+
function createDependencyFingerprint(files) {
|
|
2892
|
+
return files.map((file) => {
|
|
2893
|
+
try {
|
|
2894
|
+
const stat = node_fs.default.statSync(file);
|
|
2895
|
+
return `${file}:${stat.size}:${stat.mtimeMs}`;
|
|
2896
|
+
} catch {
|
|
2897
|
+
return `${file}:missing`;
|
|
2898
|
+
}
|
|
2899
|
+
}).join("|");
|
|
2900
|
+
}
|
|
2901
|
+
function createIncrementalGenerateCacheKey(source, target, styleOptions) {
|
|
2902
|
+
return [
|
|
2903
|
+
source.packageName,
|
|
2904
|
+
source.postcssPlugin,
|
|
2905
|
+
source.cwd,
|
|
2906
|
+
source.config ?? "config:missing",
|
|
2907
|
+
createDependencyFingerprint(source.dependencies),
|
|
2908
|
+
source.css,
|
|
2909
|
+
createStableJson(normalizeConfigObject(source.configObject)?.content),
|
|
2910
|
+
target,
|
|
2911
|
+
createStableJson(styleOptions)
|
|
2912
|
+
].join("\0");
|
|
2913
|
+
}
|
|
2914
|
+
function createRuntimeReadyCacheKey(source, rootPath) {
|
|
2915
|
+
return [
|
|
2916
|
+
source.packageName,
|
|
2917
|
+
source.postcssPlugin,
|
|
2918
|
+
rootPath ?? "missing",
|
|
2919
|
+
source.config ?? "config:missing",
|
|
2920
|
+
source.cwd
|
|
2921
|
+
].join("\0");
|
|
2922
|
+
}
|
|
2923
|
+
function isDirectUtilitiesOnlyCss(css) {
|
|
2924
|
+
return css.replace(/\s+/g, "") === "@tailwindutilities;";
|
|
2925
|
+
}
|
|
2926
|
+
function collectClassSet(context) {
|
|
2927
|
+
const classSet = /* @__PURE__ */ new Set();
|
|
2928
|
+
for (const candidate of context.classCache.keys()) if (String(candidate) !== "*") classSet.add(candidate);
|
|
2929
|
+
return classSet;
|
|
2930
|
+
}
|
|
2931
|
+
function collectDependencyMessages(result) {
|
|
2932
|
+
const dependencies = /* @__PURE__ */ new Set();
|
|
2933
|
+
for (const message of result.messages) {
|
|
2934
|
+
const file = message["file"];
|
|
2935
|
+
if (message["type"] === "dependency" && typeof file === "string") dependencies.add(file);
|
|
2936
|
+
}
|
|
2937
|
+
return dependencies;
|
|
2938
|
+
}
|
|
2939
|
+
function sortCandidates(candidates) {
|
|
2940
|
+
return [...candidates].sort((a, z) => {
|
|
2941
|
+
if (a === z) return 0;
|
|
2942
|
+
return a < z ? -1 : 1;
|
|
2943
|
+
});
|
|
2944
|
+
}
|
|
2945
|
+
function appendUtilityRules(root, context, rules) {
|
|
2946
|
+
const sortedRules = context.offsets.sort(rules);
|
|
2947
|
+
for (const [sort, rule] of sortedRules) {
|
|
2948
|
+
const tailwindRaw = rule.raws.tailwind;
|
|
2949
|
+
if (sort.layer === "utilities" || sort.layer === "variants" && tailwindRaw?.parentLayer === "utilities") root.append(rule.clone());
|
|
2950
|
+
}
|
|
2951
|
+
}
|
|
2952
|
+
function appendDirectUtilityRules(root, context) {
|
|
2953
|
+
appendUtilityRules(root, context, [...context.ruleCache]);
|
|
2954
|
+
}
|
|
2955
|
+
function createRuntimeReadyPromise(source) {
|
|
2956
|
+
const patcher = createTailwindcssPatcher({
|
|
2957
|
+
basedir: source.cwd,
|
|
2958
|
+
supportCustomLengthUnitsPatch: true,
|
|
2959
|
+
tailwindcss: {
|
|
2960
|
+
...source.config === void 0 ? {} : { config: source.config },
|
|
2961
|
+
cwd: source.cwd,
|
|
2962
|
+
packageName: source.packageName,
|
|
2963
|
+
postcssPlugin: source.postcssPlugin,
|
|
2964
|
+
version: 3
|
|
2965
|
+
}
|
|
2966
|
+
});
|
|
2967
|
+
const cacheKey = createRuntimeReadyCacheKey(source, patcher.packageInfo?.rootPath);
|
|
2968
|
+
const cached = runtimeReadyPromiseCache.get(cacheKey);
|
|
2969
|
+
if (cached) return cached;
|
|
2970
|
+
const task = ensureTailwindcssRuntimePatch(patcher, { clearRequireCache: true }).catch((error) => {
|
|
2971
|
+
runtimeReadyPromiseCache.delete(cacheKey);
|
|
2972
|
+
throw error;
|
|
2973
|
+
});
|
|
2974
|
+
runtimeReadyPromiseCache.set(cacheKey, task);
|
|
2975
|
+
return task;
|
|
2976
|
+
}
|
|
2977
|
+
function createTailwindV3Engine(source) {
|
|
2978
|
+
const runtimeReadyPromise = createRuntimeReadyPromise(source);
|
|
2979
|
+
let tailwindInternals;
|
|
2980
|
+
async function generateOnce(generateSource, options = {}) {
|
|
2981
|
+
await runtimeReadyPromise;
|
|
2982
|
+
tailwindInternals ?? (tailwindInternals = loadTailwindV3Internals(source));
|
|
2983
|
+
const internals = tailwindInternals;
|
|
2984
|
+
const { styleOptions, target = "weapp" } = options;
|
|
2985
|
+
const tailwindConfig = internals.validateConfig(internals.resolveConfig(createTailwindConfig(generateSource, options)));
|
|
2986
|
+
const candidates = mergeGenerateCandidates(generateSource, options);
|
|
2987
|
+
const changedContent = createChangedContentEntries(candidates, options.sources ?? []);
|
|
2988
|
+
const root = postcss.default.parse(generateSource.css, { from: void 0 });
|
|
2989
|
+
const result = {
|
|
2990
|
+
css: "",
|
|
2991
|
+
messages: []
|
|
2992
|
+
};
|
|
2993
|
+
let context;
|
|
2994
|
+
if (isDirectUtilitiesOnlyCss(generateSource.css)) {
|
|
2995
|
+
context = internals.createContext(tailwindConfig, changedContent, root);
|
|
2996
|
+
internals.generateRules(new Set(sortCandidates([internals.notOnDemandCandidate, ...candidates])), context);
|
|
2997
|
+
root.removeAll();
|
|
2998
|
+
appendDirectUtilityRules(root, context);
|
|
2999
|
+
internals.resolveDefaultsAtRules(context)(root, result);
|
|
3000
|
+
internals.collapseAdjacentRules(context)(root, result);
|
|
3001
|
+
internals.collapseDuplicateDeclarations(context)(root, result);
|
|
3002
|
+
} else {
|
|
3003
|
+
const setupContext = () => {
|
|
3004
|
+
return (currentRoot) => internals.createContext(tailwindConfig, changedContent, currentRoot);
|
|
3005
|
+
};
|
|
3006
|
+
context = await internals.processTailwindFeatures(setupContext)(root, result);
|
|
3007
|
+
}
|
|
3008
|
+
const rawCss = root.toString();
|
|
3009
|
+
const css = await transformTailwindV3CssByTarget(rawCss, target, styleOptions);
|
|
3010
|
+
const dependencies = collectDependencyMessages(result);
|
|
3011
|
+
for (const dependency of generateSource.dependencies) dependencies.add(dependency);
|
|
3012
|
+
const classSet = collectClassSet(context);
|
|
3013
|
+
return {
|
|
3014
|
+
css,
|
|
3015
|
+
rawCss,
|
|
3016
|
+
context,
|
|
3017
|
+
classSet,
|
|
3018
|
+
rawCandidates: candidates,
|
|
3019
|
+
dependencies: [...dependencies],
|
|
3020
|
+
sources: [],
|
|
3021
|
+
root: null,
|
|
3022
|
+
target,
|
|
3023
|
+
version: 3
|
|
3024
|
+
};
|
|
3025
|
+
}
|
|
3026
|
+
async function generateIncrementalMissingUtilities(context, candidates, target, styleOptions) {
|
|
3027
|
+
tailwindInternals ?? (tailwindInternals = loadTailwindV3Internals(source));
|
|
3028
|
+
const internals = tailwindInternals;
|
|
3029
|
+
const root = postcss.default.root();
|
|
3030
|
+
const result = {
|
|
3031
|
+
css: "",
|
|
3032
|
+
messages: []
|
|
3033
|
+
};
|
|
3034
|
+
appendUtilityRules(root, context, internals.generateRules(new Set(sortCandidates(candidates)), context));
|
|
3035
|
+
internals.resolveDefaultsAtRules(context)(root, result);
|
|
3036
|
+
internals.collapseAdjacentRules(context)(root, result);
|
|
3037
|
+
internals.collapseDuplicateDeclarations(context)(root, result);
|
|
3038
|
+
const rawCss = root.toString();
|
|
3039
|
+
return {
|
|
3040
|
+
css: await transformTailwindV3CssByTarget(rawCss, target, styleOptions),
|
|
3041
|
+
rawCss,
|
|
3042
|
+
classSet: collectClassSet(context),
|
|
3043
|
+
dependencies: collectDependencyMessages(result)
|
|
3044
|
+
};
|
|
3045
|
+
}
|
|
3046
|
+
async function generateWithIncrementalCache(options = {}) {
|
|
3047
|
+
if ((options.sources?.length ?? 0) > 0) return generateOnce(source, options);
|
|
3048
|
+
const target = options.target ?? "weapp";
|
|
3049
|
+
const requestedCandidates = mergeGenerateCandidates(source, options);
|
|
3050
|
+
if (requestedCandidates.size === 0) return generateOnce(source, options);
|
|
3051
|
+
const cacheKey = createIncrementalGenerateCacheKey(source, target, options.styleOptions);
|
|
3052
|
+
const cached = incrementalGenerateCache.get(cacheKey);
|
|
3053
|
+
if (cached) {
|
|
3054
|
+
const missingCandidates = [...requestedCandidates].filter((candidate) => !cached.seenCandidates.has(candidate));
|
|
3055
|
+
if (missingCandidates.length === 0) return {
|
|
3056
|
+
css: cached.css,
|
|
3057
|
+
rawCss: cached.rawCss,
|
|
3058
|
+
incrementalCss: "",
|
|
3059
|
+
incrementalRawCss: "",
|
|
3060
|
+
classSet: new Set(cached.classSet),
|
|
3061
|
+
rawCandidates: new Set(cached.seenCandidates),
|
|
3062
|
+
dependencies: cached.dependencies,
|
|
3063
|
+
sources: [],
|
|
3064
|
+
root: null,
|
|
3065
|
+
target: cached.target,
|
|
3066
|
+
version: 3
|
|
3067
|
+
};
|
|
3068
|
+
const generated = await generateIncrementalMissingUtilities(cached.context, missingCandidates, target, options.styleOptions);
|
|
3069
|
+
for (const candidate of missingCandidates) cached.seenCandidates.add(candidate);
|
|
3070
|
+
for (const className of generated.classSet) cached.classSet.add(className);
|
|
3071
|
+
cached.css = [cached.css, generated.css].filter(Boolean).join("\n");
|
|
3072
|
+
cached.rawCss = [cached.rawCss, generated.rawCss].filter(Boolean).join("\n");
|
|
3073
|
+
cached.dependencies = [...new Set([...cached.dependencies, ...generated.dependencies])];
|
|
3074
|
+
return {
|
|
3075
|
+
css: cached.css,
|
|
3076
|
+
rawCss: cached.rawCss,
|
|
3077
|
+
incrementalCss: generated.css,
|
|
3078
|
+
incrementalRawCss: generated.rawCss,
|
|
3079
|
+
classSet: new Set(cached.classSet),
|
|
3080
|
+
rawCandidates: new Set(cached.seenCandidates),
|
|
3081
|
+
dependencies: cached.dependencies,
|
|
3082
|
+
sources: [],
|
|
3083
|
+
root: null,
|
|
3084
|
+
target: cached.target,
|
|
3085
|
+
version: 3
|
|
3086
|
+
};
|
|
3087
|
+
}
|
|
3088
|
+
const generated = await generateOnce(source, options);
|
|
3089
|
+
incrementalGenerateCache.set(cacheKey, {
|
|
3090
|
+
context: generated.context,
|
|
3091
|
+
seenCandidates: new Set(requestedCandidates),
|
|
3092
|
+
classSet: new Set(generated.classSet),
|
|
3093
|
+
css: generated.css,
|
|
3094
|
+
rawCss: generated.rawCss,
|
|
3095
|
+
dependencies: generated.dependencies,
|
|
3096
|
+
target: generated.target
|
|
3097
|
+
});
|
|
3098
|
+
return generated;
|
|
3099
|
+
}
|
|
3100
|
+
async function generate(options = {}) {
|
|
3101
|
+
return options.incrementalCache ? generateWithIncrementalCache(options) : generateOnce(source, options);
|
|
3102
|
+
}
|
|
3103
|
+
return {
|
|
3104
|
+
source,
|
|
3105
|
+
async validateCandidates(candidates) {
|
|
3106
|
+
return (await generate({
|
|
3107
|
+
candidates,
|
|
3108
|
+
incrementalCache: true,
|
|
3109
|
+
target: "tailwind"
|
|
3110
|
+
})).classSet;
|
|
3111
|
+
},
|
|
3112
|
+
generate
|
|
3113
|
+
};
|
|
3114
|
+
}
|
|
3115
|
+
//#endregion
|
|
3116
|
+
//#region src/tailwindcss/v3-engine/source.ts
|
|
3117
|
+
const DEFAULT_TAILWIND_V3_CSS = [
|
|
3118
|
+
"@tailwind base;",
|
|
3119
|
+
"@tailwind components;",
|
|
3120
|
+
"@tailwind utilities;"
|
|
3121
|
+
].join("\n");
|
|
3122
|
+
function parseConfigParam(params) {
|
|
3123
|
+
const value = params.trim();
|
|
3124
|
+
return /^(['"])(.+)\1$/.exec(value)?.[2];
|
|
3125
|
+
}
|
|
3126
|
+
function resolveOptionalPath(value, base) {
|
|
3127
|
+
if (!value) return;
|
|
3128
|
+
return node_path.default.isAbsolute(value) ? value : node_path.default.resolve(base, value);
|
|
3129
|
+
}
|
|
3130
|
+
function resolveCssConfig(css, base) {
|
|
3131
|
+
if (!css) return {
|
|
3132
|
+
css,
|
|
3133
|
+
config: void 0
|
|
3134
|
+
};
|
|
3135
|
+
const root = postcss.default.parse(css);
|
|
3136
|
+
let config;
|
|
3137
|
+
root.walkAtRules("config", (rule) => {
|
|
3138
|
+
const configPath = parseConfigParam(rule.params);
|
|
3139
|
+
if (!configPath) return;
|
|
3140
|
+
if (!config) config = resolveOptionalPath(configPath, base);
|
|
3141
|
+
rule.remove();
|
|
3142
|
+
});
|
|
3143
|
+
return {
|
|
3144
|
+
config,
|
|
3145
|
+
css: root.toString()
|
|
3146
|
+
};
|
|
3147
|
+
}
|
|
3148
|
+
function getProjectRoot(patcher) {
|
|
3149
|
+
return patcher.options?.projectRoot ?? node_process.default.cwd();
|
|
3150
|
+
}
|
|
3151
|
+
function normalizeLoadedConfig(config) {
|
|
3152
|
+
if (!config || typeof config !== "object") return config;
|
|
3153
|
+
const maybeDefault = config.default;
|
|
3154
|
+
if (maybeDefault && typeof maybeDefault === "object") return maybeDefault;
|
|
3155
|
+
return config;
|
|
3156
|
+
}
|
|
3157
|
+
function resolveTailwindCssPackageName(patcher) {
|
|
3158
|
+
return resolveTailwindcssOptions(patcher.options)?.packageName ?? patcher.packageInfo?.name ?? "tailwindcss";
|
|
3159
|
+
}
|
|
3160
|
+
async function resolveTailwindV3Source(options = {}) {
|
|
3161
|
+
const projectRoot = options.projectRoot ?? node_process.default.cwd();
|
|
3162
|
+
const base = options.base ?? options.cwd ?? projectRoot;
|
|
3163
|
+
const cssConfig = resolveCssConfig(options.css, base);
|
|
3164
|
+
const config = resolveOptionalPath(options.config, base) ?? cssConfig.config;
|
|
3165
|
+
const cwd = options.cwd ?? (config ? node_path.default.dirname(config) : projectRoot);
|
|
3166
|
+
const loaded = await (0, tailwindcss_config.loadConfig)(omitUndefined({
|
|
3167
|
+
config,
|
|
3168
|
+
cwd
|
|
3169
|
+
}));
|
|
3170
|
+
return {
|
|
3171
|
+
version: 3,
|
|
3172
|
+
projectRoot,
|
|
3173
|
+
cwd,
|
|
3174
|
+
base,
|
|
3175
|
+
css: cssConfig.css ?? options.css ?? DEFAULT_TAILWIND_V3_CSS,
|
|
3176
|
+
config: loaded?.filepath ?? config,
|
|
3177
|
+
configObject: normalizeLoadedConfig(loaded?.config),
|
|
3178
|
+
dependencies: loaded?.filepath ? [loaded.filepath] : [],
|
|
3179
|
+
packageName: options.packageName ?? "tailwindcss",
|
|
3180
|
+
postcssPlugin: options.postcssPlugin ?? options.packageName ?? "tailwindcss"
|
|
3181
|
+
};
|
|
3182
|
+
}
|
|
3183
|
+
function resolveTailwindV3SourceOptionsFromPatcher(patcher) {
|
|
3184
|
+
const projectRoot = getProjectRoot(patcher);
|
|
3185
|
+
const tailwindOptions = resolveTailwindcssOptions(patcher.options);
|
|
3186
|
+
return {
|
|
3187
|
+
projectRoot,
|
|
3188
|
+
cwd: tailwindOptions?.v3?.cwd ?? tailwindOptions?.cwd ?? projectRoot,
|
|
3189
|
+
config: tailwindOptions?.v3?.config ?? tailwindOptions?.config,
|
|
3190
|
+
packageName: resolveTailwindCssPackageName(patcher),
|
|
3191
|
+
postcssPlugin: tailwindOptions?.v3?.postcssPlugin ?? tailwindOptions?.postcssPlugin
|
|
3192
|
+
};
|
|
3193
|
+
}
|
|
3194
|
+
function resolveTailwindV3SourceFromPatcher(patcher) {
|
|
3195
|
+
return resolveTailwindV3Source(resolveTailwindV3SourceOptionsFromPatcher(patcher));
|
|
3196
|
+
}
|
|
3197
|
+
//#endregion
|
|
3198
|
+
Object.defineProperty(exports, "DEFAULT_SOURCE_SCAN_EXTENSIONS", {
|
|
3199
|
+
enumerable: true,
|
|
3200
|
+
get: function() {
|
|
3201
|
+
return DEFAULT_SOURCE_SCAN_EXTENSIONS;
|
|
3202
|
+
}
|
|
3203
|
+
});
|
|
3204
|
+
Object.defineProperty(exports, "FULL_SOURCE_SCAN_EXTENSION_RE", {
|
|
3205
|
+
enumerable: true,
|
|
3206
|
+
get: function() {
|
|
3207
|
+
return FULL_SOURCE_SCAN_EXTENSION_RE;
|
|
3208
|
+
}
|
|
3209
|
+
});
|
|
3210
|
+
Object.defineProperty(exports, "collectCssInlineSourceCandidates", {
|
|
3211
|
+
enumerable: true,
|
|
3212
|
+
get: function() {
|
|
3213
|
+
return collectCssInlineSourceCandidates;
|
|
3214
|
+
}
|
|
3215
|
+
});
|
|
3216
|
+
Object.defineProperty(exports, "createDebug", {
|
|
3217
|
+
enumerable: true,
|
|
3218
|
+
get: function() {
|
|
3219
|
+
return createDebug;
|
|
3220
|
+
}
|
|
3221
|
+
});
|
|
3222
|
+
Object.defineProperty(exports, "createSourceScanPattern", {
|
|
3223
|
+
enumerable: true,
|
|
3224
|
+
get: function() {
|
|
3225
|
+
return createSourceScanPattern;
|
|
3226
|
+
}
|
|
3227
|
+
});
|
|
3228
|
+
Object.defineProperty(exports, "createTailwindV3Engine", {
|
|
3229
|
+
enumerable: true,
|
|
3230
|
+
get: function() {
|
|
3231
|
+
return createTailwindV3Engine;
|
|
3232
|
+
}
|
|
3233
|
+
});
|
|
3234
|
+
Object.defineProperty(exports, "createTailwindV4Engine", {
|
|
3235
|
+
enumerable: true,
|
|
3236
|
+
get: function() {
|
|
3237
|
+
return createTailwindV4Engine;
|
|
3238
|
+
}
|
|
3239
|
+
});
|
|
3240
|
+
Object.defineProperty(exports, "createTailwindcssPatcher", {
|
|
3241
|
+
enumerable: true,
|
|
3242
|
+
get: function() {
|
|
3243
|
+
return createTailwindcssPatcher;
|
|
3244
|
+
}
|
|
3245
|
+
});
|
|
3246
|
+
Object.defineProperty(exports, "createViteSourceScanMatcher", {
|
|
3247
|
+
enumerable: true,
|
|
3248
|
+
get: function() {
|
|
3249
|
+
return createViteSourceScanMatcher;
|
|
3250
|
+
}
|
|
3251
|
+
});
|
|
3252
|
+
Object.defineProperty(exports, "discoverTailwindV4CssEntries", {
|
|
3253
|
+
enumerable: true,
|
|
3254
|
+
get: function() {
|
|
3255
|
+
return discoverTailwindV4CssEntries;
|
|
3256
|
+
}
|
|
3257
|
+
});
|
|
3258
|
+
Object.defineProperty(exports, "ensureTailwindcssRuntimePatch", {
|
|
3259
|
+
enumerable: true,
|
|
3260
|
+
get: function() {
|
|
3261
|
+
return ensureTailwindcssRuntimePatch;
|
|
3262
|
+
}
|
|
3263
|
+
});
|
|
3264
|
+
Object.defineProperty(exports, "expandTailwindSourceEntries", {
|
|
3265
|
+
enumerable: true,
|
|
3266
|
+
get: function() {
|
|
3267
|
+
return expandTailwindSourceEntries;
|
|
3268
|
+
}
|
|
3269
|
+
});
|
|
3270
|
+
Object.defineProperty(exports, "filterUnsupportedMiniProgramTailwindV4Candidates", {
|
|
3271
|
+
enumerable: true,
|
|
3272
|
+
get: function() {
|
|
3273
|
+
return filterUnsupportedMiniProgramTailwindV4Candidates;
|
|
3274
|
+
}
|
|
3275
|
+
});
|
|
3276
|
+
Object.defineProperty(exports, "findNearestPackageRoot", {
|
|
3277
|
+
enumerable: true,
|
|
3278
|
+
get: function() {
|
|
3279
|
+
return findNearestPackageRoot;
|
|
3280
|
+
}
|
|
3281
|
+
});
|
|
3282
|
+
Object.defineProperty(exports, "findTailwindConfig", {
|
|
3283
|
+
enumerable: true,
|
|
3284
|
+
get: function() {
|
|
3285
|
+
return findTailwindConfig;
|
|
3286
|
+
}
|
|
3287
|
+
});
|
|
3288
|
+
Object.defineProperty(exports, "findWorkspacePackageDir", {
|
|
3289
|
+
enumerable: true,
|
|
3290
|
+
get: function() {
|
|
3291
|
+
return findWorkspacePackageDir;
|
|
3292
|
+
}
|
|
3293
|
+
});
|
|
3294
|
+
Object.defineProperty(exports, "findWorkspaceRoot", {
|
|
3295
|
+
enumerable: true,
|
|
3296
|
+
get: function() {
|
|
3297
|
+
return findWorkspaceRoot;
|
|
3298
|
+
}
|
|
3299
|
+
});
|
|
3300
|
+
Object.defineProperty(exports, "getRuntimeClassSetCacheEntry", {
|
|
3301
|
+
enumerable: true,
|
|
3302
|
+
get: function() {
|
|
3303
|
+
return getRuntimeClassSetCacheEntry;
|
|
3304
|
+
}
|
|
3305
|
+
});
|
|
3306
|
+
Object.defineProperty(exports, "getRuntimeClassSetSignature", {
|
|
3307
|
+
enumerable: true,
|
|
3308
|
+
get: function() {
|
|
3309
|
+
return getRuntimeClassSetSignature;
|
|
3310
|
+
}
|
|
3311
|
+
});
|
|
3312
|
+
Object.defineProperty(exports, "getRuntimeClassSetSignatureWithSources", {
|
|
3313
|
+
enumerable: true,
|
|
3314
|
+
get: function() {
|
|
3315
|
+
return getRuntimeClassSetSignatureWithSources;
|
|
3316
|
+
}
|
|
3317
|
+
});
|
|
3318
|
+
Object.defineProperty(exports, "invalidateRuntimeClassSet", {
|
|
3319
|
+
enumerable: true,
|
|
3320
|
+
get: function() {
|
|
3321
|
+
return invalidateRuntimeClassSet;
|
|
3322
|
+
}
|
|
3323
|
+
});
|
|
3324
|
+
Object.defineProperty(exports, "isFileMatchedByTailwindSourceEntries", {
|
|
3325
|
+
enumerable: true,
|
|
3326
|
+
get: function() {
|
|
3327
|
+
return isFileMatchedByTailwindSourceEntries;
|
|
3328
|
+
}
|
|
3329
|
+
});
|
|
3330
|
+
Object.defineProperty(exports, "normalizeLegacyContentEntries", {
|
|
3331
|
+
enumerable: true,
|
|
3332
|
+
get: function() {
|
|
3333
|
+
return normalizeLegacyContentEntries;
|
|
3334
|
+
}
|
|
3335
|
+
});
|
|
3336
|
+
Object.defineProperty(exports, "omitUndefined", {
|
|
3337
|
+
enumerable: true,
|
|
3338
|
+
get: function() {
|
|
3339
|
+
return omitUndefined;
|
|
3340
|
+
}
|
|
3341
|
+
});
|
|
3342
|
+
Object.defineProperty(exports, "parseConfigParam", {
|
|
3343
|
+
enumerable: true,
|
|
3344
|
+
get: function() {
|
|
3345
|
+
return parseConfigParam$1;
|
|
3346
|
+
}
|
|
3347
|
+
});
|
|
3348
|
+
Object.defineProperty(exports, "readInstalledPackageMajorVersion", {
|
|
3349
|
+
enumerable: true,
|
|
3350
|
+
get: function() {
|
|
3351
|
+
return readInstalledPackageMajorVersion;
|
|
3352
|
+
}
|
|
3353
|
+
});
|
|
3354
|
+
Object.defineProperty(exports, "resolveCssSourceEntries", {
|
|
3355
|
+
enumerable: true,
|
|
3356
|
+
get: function() {
|
|
3357
|
+
return resolveCssSourceEntries;
|
|
3358
|
+
}
|
|
3359
|
+
});
|
|
3360
|
+
Object.defineProperty(exports, "resolveSourceScanPath", {
|
|
3361
|
+
enumerable: true,
|
|
3362
|
+
get: function() {
|
|
3363
|
+
return resolveSourceScanPath;
|
|
3364
|
+
}
|
|
3365
|
+
});
|
|
3366
|
+
Object.defineProperty(exports, "resolveTailwindV3Source", {
|
|
3367
|
+
enumerable: true,
|
|
3368
|
+
get: function() {
|
|
3369
|
+
return resolveTailwindV3Source;
|
|
3370
|
+
}
|
|
3371
|
+
});
|
|
3372
|
+
Object.defineProperty(exports, "resolveTailwindV3SourceFromPatcher", {
|
|
3373
|
+
enumerable: true,
|
|
3374
|
+
get: function() {
|
|
3375
|
+
return resolveTailwindV3SourceFromPatcher;
|
|
3376
|
+
}
|
|
3377
|
+
});
|
|
3378
|
+
Object.defineProperty(exports, "resolveTailwindV3SourceOptionsFromPatcher", {
|
|
3379
|
+
enumerable: true,
|
|
3380
|
+
get: function() {
|
|
3381
|
+
return resolveTailwindV3SourceOptionsFromPatcher;
|
|
3382
|
+
}
|
|
3383
|
+
});
|
|
3384
|
+
Object.defineProperty(exports, "resolveTailwindV4CssSourceBase", {
|
|
3385
|
+
enumerable: true,
|
|
3386
|
+
get: function() {
|
|
3387
|
+
return resolveTailwindV4CssSourceBase;
|
|
3388
|
+
}
|
|
3389
|
+
});
|
|
3390
|
+
Object.defineProperty(exports, "resolveTailwindV4EntriesFromCss", {
|
|
3391
|
+
enumerable: true,
|
|
3392
|
+
get: function() {
|
|
3393
|
+
return resolveTailwindV4EntriesFromCss;
|
|
3394
|
+
}
|
|
3395
|
+
});
|
|
3396
|
+
Object.defineProperty(exports, "resolveTailwindV4EntriesFromCssCached", {
|
|
3397
|
+
enumerable: true,
|
|
3398
|
+
get: function() {
|
|
3399
|
+
return resolveTailwindV4EntriesFromCssCached;
|
|
3400
|
+
}
|
|
3401
|
+
});
|
|
3402
|
+
Object.defineProperty(exports, "resolveTailwindV4Source", {
|
|
3403
|
+
enumerable: true,
|
|
3404
|
+
get: function() {
|
|
3405
|
+
return resolveTailwindV4Source;
|
|
3406
|
+
}
|
|
3407
|
+
});
|
|
3408
|
+
Object.defineProperty(exports, "resolveTailwindV4SourceFromPatcher", {
|
|
3409
|
+
enumerable: true,
|
|
3410
|
+
get: function() {
|
|
3411
|
+
return resolveTailwindV4SourceFromPatcher;
|
|
3412
|
+
}
|
|
3413
|
+
});
|
|
3414
|
+
Object.defineProperty(exports, "resolveTailwindV4SourceOptionsFromPatcher", {
|
|
3415
|
+
enumerable: true,
|
|
3416
|
+
get: function() {
|
|
3417
|
+
return resolveTailwindV4SourceOptionsFromPatcher;
|
|
3418
|
+
}
|
|
3419
|
+
});
|
|
3420
|
+
Object.defineProperty(exports, "resolveTailwindcssOptions", {
|
|
3421
|
+
enumerable: true,
|
|
3422
|
+
get: function() {
|
|
3423
|
+
return resolveTailwindcssOptions;
|
|
3424
|
+
}
|
|
3425
|
+
});
|
|
3426
|
+
Object.defineProperty(exports, "resolveViteSourceScanEntries", {
|
|
3427
|
+
enumerable: true,
|
|
3428
|
+
get: function() {
|
|
3429
|
+
return resolveViteSourceScanEntries;
|
|
3430
|
+
}
|
|
3431
|
+
});
|
|
3432
|
+
Object.defineProperty(exports, "resolveViteTailwindV4CssDependencies", {
|
|
3433
|
+
enumerable: true,
|
|
3434
|
+
get: function() {
|
|
3435
|
+
return resolveViteTailwindV4CssDependencies;
|
|
3436
|
+
}
|
|
3437
|
+
});
|
|
3438
|
+
Object.defineProperty(exports, "runtimeSignaturePatchersSymbol", {
|
|
3439
|
+
enumerable: true,
|
|
3440
|
+
get: function() {
|
|
3441
|
+
return runtimeSignaturePatchersSymbol;
|
|
3442
|
+
}
|
|
3443
|
+
});
|
|
3444
|
+
Object.defineProperty(exports, "toPosixPath", {
|
|
3445
|
+
enumerable: true,
|
|
3446
|
+
get: function() {
|
|
3447
|
+
return toPosixPath;
|
|
3448
|
+
}
|
|
3449
|
+
});
|
|
3450
|
+
Object.defineProperty(exports, "transformTailwindV3CssByTarget", {
|
|
3451
|
+
enumerable: true,
|
|
3452
|
+
get: function() {
|
|
3453
|
+
return transformTailwindV3CssByTarget;
|
|
3454
|
+
}
|
|
3455
|
+
});
|
|
3456
|
+
Object.defineProperty(exports, "transformTailwindV3CssToWeapp", {
|
|
3457
|
+
enumerable: true,
|
|
3458
|
+
get: function() {
|
|
3459
|
+
return transformTailwindV3CssToWeapp;
|
|
3460
|
+
}
|
|
3461
|
+
});
|
|
3462
|
+
Object.defineProperty(exports, "transformTailwindV4CssByTarget", {
|
|
3463
|
+
enumerable: true,
|
|
3464
|
+
get: function() {
|
|
3465
|
+
return transformTailwindV4CssByTarget;
|
|
3466
|
+
}
|
|
3467
|
+
});
|
|
3468
|
+
Object.defineProperty(exports, "transformTailwindV4CssToWeapp", {
|
|
3469
|
+
enumerable: true,
|
|
3470
|
+
get: function() {
|
|
3471
|
+
return transformTailwindV4CssToWeapp;
|
|
3472
|
+
}
|
|
3473
|
+
});
|