weapp-tailwindcss 5.0.0-next.2 → 5.0.0-next.20
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-BlXvU4jl.js +530 -0
- package/dist/bundle-state-PO6MysTJ.mjs +414 -0
- package/dist/bundlers/shared/cache.d.ts +6 -6
- package/dist/bundlers/shared/css-cleanup/at-rules.d.ts +2 -0
- package/dist/bundlers/shared/css-cleanup/color-gamut.d.ts +3 -0
- package/dist/bundlers/shared/css-cleanup/root-cleanups.d.ts +5 -0
- package/dist/bundlers/shared/css-cleanup/selectors.d.ts +8 -0
- package/dist/bundlers/shared/css-cleanup.d.ts +7 -3
- 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-DIuglJub.mjs +32 -0
- package/dist/generator-N4jy1HCk.js +55 -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-CJ0Pnsw2.js +2348 -0
- package/dist/incremental-runtime-class-set-hF-uiw6W.mjs +2285 -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/lightningcss/style-handler/selector-transform.d.ts +1 -1
- package/dist/lightningcss/style-handler.d.ts +3 -3
- 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-D4UdbBQ6.mjs +228 -0
- package/dist/postcss-DlY-YRvA.js +237 -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-BjEbVEpX.js} +218 -314
- package/dist/{recorder-zsgatmkB.mjs → precheck-tbk626YL.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-D5qnaSpo.js +5516 -0
- package/dist/shared/mpx.d.ts +1 -0
- package/dist/source-candidates-BrvneDDd.mjs +209 -0
- package/dist/source-candidates-gxijpPI3.js +222 -0
- package/dist/tailwindcss/miniprogram.d.ts +5 -1
- package/dist/tailwindcss/patcher-options.d.ts +3 -51
- package/dist/tailwindcss/patcher.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-BhG7BtB-.js +651 -0
- package/dist/tailwindcss-c6ROlNNW.mjs +600 -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-5LoZUH-4.js +3695 -0
- package/dist/v3-engine-DIXDEDmL.mjs +3406 -0
- package/dist/{vite-CrlzCNqz.mjs → vite-B5faZcbE.mjs} +1256 -1088
- package/dist/vite-MyXBNux0.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 +5157 -16
- package/dist/weapp-tw-runtime-classset-loader.js +32 -7
- package/dist/webpack-BnVyDmsD.mjs +836 -0
- package/dist/webpack-Mz1V0A9p.js +846 -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/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
package/dist/cli.js
CHANGED
|
@@ -36,8 +36,13 @@ require("@weapp-tailwindcss/shared");
|
|
|
36
36
|
let debug = require("debug");
|
|
37
37
|
debug = __toESM(debug);
|
|
38
38
|
let node_fs = require("node:fs");
|
|
39
|
+
node_fs = __toESM(node_fs);
|
|
40
|
+
require("postcss");
|
|
41
|
+
require("micromatch");
|
|
42
|
+
let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
|
|
39
43
|
let node_module = require("node:module");
|
|
40
|
-
require("
|
|
44
|
+
require("fast-glob");
|
|
45
|
+
require("tailwindcss-config");
|
|
41
46
|
let _babel_traverse = require("@babel/traverse");
|
|
42
47
|
_babel_traverse = __toESM(_babel_traverse);
|
|
43
48
|
let _babel_parser = require("@babel/parser");
|
|
@@ -48,260 +53,489 @@ let _ast_core_escape = require("@ast-core/escape");
|
|
|
48
53
|
let _weapp_tailwindcss_shared_extractors = require("@weapp-tailwindcss/shared/extractors");
|
|
49
54
|
require("@babel/types");
|
|
50
55
|
require("htmlparser2");
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
56
|
+
//#region src/js/babel/cache-options.ts
|
|
57
|
+
const DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH = 5e4;
|
|
58
|
+
const HARD_PARSE_CACHE_MAX_ENTRIES = 1024;
|
|
59
|
+
//#endregion
|
|
55
60
|
//#region src/debug/index.ts
|
|
56
61
|
const _debug = (0, debug.default)("weapp-tw");
|
|
57
62
|
function createDebug(prefix) {
|
|
58
|
-
const debug$
|
|
63
|
+
const debug$4 = ((formatter, ...args) => {
|
|
59
64
|
return _debug((prefix ?? "") + formatter, ...args);
|
|
60
65
|
});
|
|
61
|
-
Object.defineProperty(debug$
|
|
66
|
+
Object.defineProperty(debug$4, "enabled", {
|
|
62
67
|
enumerable: false,
|
|
63
68
|
configurable: false,
|
|
64
69
|
get() {
|
|
65
70
|
return _debug.enabled;
|
|
66
71
|
}
|
|
67
72
|
});
|
|
68
|
-
return debug$
|
|
69
|
-
}
|
|
70
|
-
createDebug("[tailwindcss:runtime] ");
|
|
71
|
-
//#endregion
|
|
72
|
-
//#region src/tailwindcss/runtime-logs.ts
|
|
73
|
-
const runtimeLogDedupeHolder = globalThis;
|
|
74
|
-
const runtimeLogDedupe = runtimeLogDedupeHolder.__WEAPP_TW_RUNTIME_LOG_DEDUPE__ ?? (runtimeLogDedupeHolder.__WEAPP_TW_RUNTIME_LOG_DEDUPE__ = /* @__PURE__ */ new Set());
|
|
75
|
-
function createRuntimeLogKey(category, baseDir, rootPath, version) {
|
|
76
|
-
return JSON.stringify([
|
|
77
|
-
category,
|
|
78
|
-
baseDir ?? node_process.default.cwd(),
|
|
79
|
-
rootPath ?? "",
|
|
80
|
-
version ?? ""
|
|
81
|
-
]);
|
|
82
|
-
}
|
|
83
|
-
function markRuntimeLog(category, baseDir, rootPath, version) {
|
|
84
|
-
const key = createRuntimeLogKey(category, baseDir, rootPath, version);
|
|
85
|
-
if (runtimeLogDedupe.has(key)) return false;
|
|
86
|
-
runtimeLogDedupe.add(key);
|
|
87
|
-
return true;
|
|
88
|
-
}
|
|
89
|
-
function logRuntimeTailwindcssTarget(baseDir, rootPath, version) {
|
|
90
|
-
if (!markRuntimeLog("target", baseDir, rootPath, version)) return;
|
|
91
|
-
const versionText = version ? ` (v${version})` : "";
|
|
92
|
-
_weapp_tailwindcss_logger.logger.info("%s 使用 Tailwind CSS%s", "Weapp-tailwindcss", versionText);
|
|
93
|
-
}
|
|
94
|
-
//#endregion
|
|
95
|
-
//#region src/context/workspace.ts
|
|
96
|
-
function findWorkspaceRoot(startDir) {
|
|
97
|
-
if (!startDir) return;
|
|
98
|
-
let current = node_path.default.resolve(startDir);
|
|
99
|
-
while (true) {
|
|
100
|
-
if ((0, node_fs.existsSync)(node_path.default.join(current, "pnpm-workspace.yaml"))) return current;
|
|
101
|
-
const parent = node_path.default.dirname(current);
|
|
102
|
-
if (parent === current) return;
|
|
103
|
-
current = parent;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
function findNearestPackageRoot(startDir) {
|
|
107
|
-
if (!startDir) return;
|
|
108
|
-
let current = node_path.default.resolve(startDir);
|
|
109
|
-
while (true) {
|
|
110
|
-
if ((0, node_fs.existsSync)(node_path.default.join(current, "package.json"))) return current;
|
|
111
|
-
const parent = node_path.default.dirname(current);
|
|
112
|
-
if (parent === current) return;
|
|
113
|
-
current = parent;
|
|
114
|
-
}
|
|
73
|
+
return debug$4;
|
|
115
74
|
}
|
|
116
75
|
//#endregion
|
|
117
|
-
//#region src/tailwindcss/
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
76
|
+
//#region src/tailwindcss/source-scan.ts
|
|
77
|
+
const DEFAULT_SOURCE_SCAN_EXTENSIONS = [
|
|
78
|
+
"html",
|
|
79
|
+
"wxml",
|
|
80
|
+
"axml",
|
|
81
|
+
"jxml",
|
|
82
|
+
"ksml",
|
|
83
|
+
"ttml",
|
|
84
|
+
"qml",
|
|
85
|
+
"tyml",
|
|
86
|
+
"xhsml",
|
|
87
|
+
"swan",
|
|
88
|
+
"vue",
|
|
89
|
+
"mpx",
|
|
90
|
+
"js",
|
|
91
|
+
"jsx",
|
|
92
|
+
"ts",
|
|
93
|
+
"tsx"
|
|
94
|
+
];
|
|
95
|
+
const FULL_SOURCE_SCAN_EXTENSIONS = [
|
|
96
|
+
"js",
|
|
97
|
+
"jsx",
|
|
98
|
+
"mjs",
|
|
99
|
+
"cjs",
|
|
100
|
+
"ts",
|
|
101
|
+
"tsx",
|
|
102
|
+
"mts",
|
|
103
|
+
"cts",
|
|
104
|
+
"vue",
|
|
105
|
+
"uvue",
|
|
106
|
+
"nvue",
|
|
107
|
+
"svelte",
|
|
108
|
+
"mpx",
|
|
109
|
+
"html",
|
|
110
|
+
"wxml",
|
|
111
|
+
"axml",
|
|
112
|
+
"jxml",
|
|
113
|
+
"ksml",
|
|
114
|
+
"ttml",
|
|
115
|
+
"qml",
|
|
116
|
+
"tyml",
|
|
117
|
+
"xhsml",
|
|
118
|
+
"swan",
|
|
119
|
+
"css",
|
|
120
|
+
"wxss",
|
|
121
|
+
"acss",
|
|
122
|
+
"jxss",
|
|
123
|
+
"ttss",
|
|
124
|
+
"qss",
|
|
125
|
+
"tyss",
|
|
126
|
+
"scss",
|
|
127
|
+
"sass",
|
|
128
|
+
"less",
|
|
129
|
+
"styl",
|
|
130
|
+
"stylus"
|
|
131
|
+
];
|
|
132
|
+
function createSourceScanPattern(extensions = DEFAULT_SOURCE_SCAN_EXTENSIONS) {
|
|
133
|
+
return `**/*.{${extensions.join(",")}}`;
|
|
156
134
|
}
|
|
135
|
+
createSourceScanPattern(FULL_SOURCE_SCAN_EXTENSIONS);
|
|
136
|
+
new RegExp(`\\.(?:${FULL_SOURCE_SCAN_EXTENSIONS.map((extension) => extension.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})$`);
|
|
157
137
|
//#endregion
|
|
158
|
-
//#region
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
const fileDisplay = formatRelativeToBase(normalizedPath, baseDir);
|
|
172
|
-
const baseDisplay = formatRelativeToBase(node_path.default.normalize(baseDir), node_process.default.cwd());
|
|
173
|
-
const reasonMessage = reason ? `:${reason}` : "";
|
|
174
|
-
_weapp_tailwindcss_logger.logger.warn(`检测到损坏的 Tailwind CSS 目标记录 ${fileDisplay}${reasonMessage}。请在 ${baseDisplay} 重新执行 "weapp-tw patch --record-target" 或删除该文件后再运行。`);
|
|
175
|
-
}
|
|
176
|
-
function readPatchTargetRecord(baseDir) {
|
|
177
|
-
if (!baseDir) return;
|
|
178
|
-
const normalizedBase = node_path.default.normalize(baseDir);
|
|
179
|
-
for (const recordPath of getRecordFileCandidates(normalizedBase)) {
|
|
180
|
-
if (!(0, node_fs.existsSync)(recordPath)) continue;
|
|
181
|
-
try {
|
|
182
|
-
const content = (0, node_fs.readFileSync)(recordPath, "utf8");
|
|
183
|
-
const parsed = JSON.parse(content);
|
|
184
|
-
if (!parsed || typeof parsed.tailwindPackagePath !== "string") {
|
|
185
|
-
warnInvalidPatchTargetRecord(normalizedBase, recordPath, "缺少 tailwindPackagePath 字段");
|
|
186
|
-
continue;
|
|
187
|
-
}
|
|
188
|
-
return {
|
|
189
|
-
baseDir: normalizedBase,
|
|
190
|
-
path: recordPath,
|
|
191
|
-
record: parsed
|
|
192
|
-
};
|
|
193
|
-
} catch (error) {
|
|
194
|
-
warnInvalidPatchTargetRecord(normalizedBase, recordPath, error instanceof Error ? error.message : String(error));
|
|
195
|
-
continue;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
async function saveCliPatchTargetRecord(baseDir, patcher, options) {
|
|
200
|
-
if (!baseDir || !patcher?.packageInfo?.rootPath) return;
|
|
201
|
-
const normalizedBase = node_path.default.normalize(baseDir);
|
|
202
|
-
const location = resolveRecordLocation(normalizedBase);
|
|
203
|
-
const recordPath = options?.recordPath ? node_path.default.normalize(options.recordPath) : location.recordPath;
|
|
204
|
-
const record = {
|
|
205
|
-
tailwindPackagePath: node_path.default.normalize(patcher.packageInfo.rootPath),
|
|
206
|
-
packageVersion: patcher.packageInfo.version,
|
|
207
|
-
recordedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
208
|
-
source: options?.source ?? "cli",
|
|
209
|
-
tailwindcssBasedir: normalizedBase,
|
|
210
|
-
cwd: options?.cwd ? node_path.default.normalize(options.cwd) : normalizedBase,
|
|
211
|
-
patchVersion: WEAPP_TW_VERSION,
|
|
212
|
-
packageJsonPath: options?.packageJsonPath ?? location.packageJsonPath,
|
|
213
|
-
recordKey: options?.recordKey ?? location.recordKey
|
|
214
|
-
};
|
|
215
|
-
try {
|
|
216
|
-
await (0, node_fs_promises.mkdir)(node_path.default.dirname(recordPath), { recursive: true });
|
|
217
|
-
await (0, node_fs_promises.writeFile)(recordPath, `${JSON.stringify(record, null, 2)}\n`, "utf8");
|
|
218
|
-
return recordPath;
|
|
219
|
-
} catch (error) {
|
|
220
|
-
const baseDisplay = formatRelativeToBase(normalizedBase, node_process.default.cwd());
|
|
221
|
-
_weapp_tailwindcss_logger.logger.warn("自动更新 Tailwind CSS 补丁记录失败,请在 %s 运行 \"weapp-tw patch --cwd %s\"。", baseDisplay, normalizedBase);
|
|
222
|
-
_weapp_tailwindcss_logger.logger.debug("failed to persist patch target record %s: %O", recordPath, error);
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
138
|
+
//#region src/utils/object.ts
|
|
139
|
+
function definedEntries(value) {
|
|
140
|
+
return Object.entries(value).filter(([, item]) => item !== void 0);
|
|
141
|
+
}
|
|
142
|
+
function omitUndefined(value) {
|
|
143
|
+
return Object.fromEntries(definedEntries(value));
|
|
144
|
+
}
|
|
145
|
+
(0, _weapp_tailwindcss_postcss.createStyleHandler)({
|
|
146
|
+
cssChildCombinatorReplaceValue: ["view", "text"],
|
|
147
|
+
cssRemoveHoverPseudoClass: true,
|
|
148
|
+
isMainChunk: true,
|
|
149
|
+
majorVersion: 4
|
|
150
|
+
});
|
|
226
151
|
//#endregion
|
|
227
|
-
//#region src/tailwindcss/
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
152
|
+
//#region src/tailwindcss/v4-engine/tailwind-v3-default-colors.ts
|
|
153
|
+
const TAILWIND_V3_COLOR_STEPS = [
|
|
154
|
+
"50",
|
|
155
|
+
"100",
|
|
156
|
+
"200",
|
|
157
|
+
"300",
|
|
158
|
+
"400",
|
|
159
|
+
"500",
|
|
160
|
+
"600",
|
|
161
|
+
"700",
|
|
162
|
+
"800",
|
|
163
|
+
"900",
|
|
164
|
+
"950"
|
|
165
|
+
];
|
|
166
|
+
const TAILWIND_V3_COLOR_PALETTE = {
|
|
167
|
+
slate: [
|
|
168
|
+
"#f8fafc",
|
|
169
|
+
"#f1f5f9",
|
|
170
|
+
"#e2e8f0",
|
|
171
|
+
"#cbd5e1",
|
|
172
|
+
"#94a3b8",
|
|
173
|
+
"#64748b",
|
|
174
|
+
"#475569",
|
|
175
|
+
"#334155",
|
|
176
|
+
"#1e293b",
|
|
177
|
+
"#0f172a",
|
|
178
|
+
"#020617"
|
|
179
|
+
],
|
|
180
|
+
gray: [
|
|
181
|
+
"#f9fafb",
|
|
182
|
+
"#f3f4f6",
|
|
183
|
+
"#e5e7eb",
|
|
184
|
+
"#d1d5db",
|
|
185
|
+
"#9ca3af",
|
|
186
|
+
"#6b7280",
|
|
187
|
+
"#4b5563",
|
|
188
|
+
"#374151",
|
|
189
|
+
"#1f2937",
|
|
190
|
+
"#111827",
|
|
191
|
+
"#030712"
|
|
192
|
+
],
|
|
193
|
+
zinc: [
|
|
194
|
+
"#fafafa",
|
|
195
|
+
"#f4f4f5",
|
|
196
|
+
"#e4e4e7",
|
|
197
|
+
"#d4d4d8",
|
|
198
|
+
"#a1a1aa",
|
|
199
|
+
"#71717a",
|
|
200
|
+
"#52525b",
|
|
201
|
+
"#3f3f46",
|
|
202
|
+
"#27272a",
|
|
203
|
+
"#18181b",
|
|
204
|
+
"#09090b"
|
|
205
|
+
],
|
|
206
|
+
neutral: [
|
|
207
|
+
"#fafafa",
|
|
208
|
+
"#f5f5f5",
|
|
209
|
+
"#e5e5e5",
|
|
210
|
+
"#d4d4d4",
|
|
211
|
+
"#a3a3a3",
|
|
212
|
+
"#737373",
|
|
213
|
+
"#525252",
|
|
214
|
+
"#404040",
|
|
215
|
+
"#262626",
|
|
216
|
+
"#171717",
|
|
217
|
+
"#0a0a0a"
|
|
218
|
+
],
|
|
219
|
+
stone: [
|
|
220
|
+
"#fafaf9",
|
|
221
|
+
"#f5f5f4",
|
|
222
|
+
"#e7e5e4",
|
|
223
|
+
"#d6d3d1",
|
|
224
|
+
"#a8a29e",
|
|
225
|
+
"#78716c",
|
|
226
|
+
"#57534e",
|
|
227
|
+
"#44403c",
|
|
228
|
+
"#292524",
|
|
229
|
+
"#1c1917",
|
|
230
|
+
"#0c0a09"
|
|
231
|
+
],
|
|
232
|
+
red: [
|
|
233
|
+
"#fef2f2",
|
|
234
|
+
"#fee2e2",
|
|
235
|
+
"#fecaca",
|
|
236
|
+
"#fca5a5",
|
|
237
|
+
"#f87171",
|
|
238
|
+
"#ef4444",
|
|
239
|
+
"#dc2626",
|
|
240
|
+
"#b91c1c",
|
|
241
|
+
"#991b1b",
|
|
242
|
+
"#7f1d1d",
|
|
243
|
+
"#450a0a"
|
|
244
|
+
],
|
|
245
|
+
orange: [
|
|
246
|
+
"#fff7ed",
|
|
247
|
+
"#ffedd5",
|
|
248
|
+
"#fed7aa",
|
|
249
|
+
"#fdba74",
|
|
250
|
+
"#fb923c",
|
|
251
|
+
"#f97316",
|
|
252
|
+
"#ea580c",
|
|
253
|
+
"#c2410c",
|
|
254
|
+
"#9a3412",
|
|
255
|
+
"#7c2d12",
|
|
256
|
+
"#431407"
|
|
257
|
+
],
|
|
258
|
+
amber: [
|
|
259
|
+
"#fffbeb",
|
|
260
|
+
"#fef3c7",
|
|
261
|
+
"#fde68a",
|
|
262
|
+
"#fcd34d",
|
|
263
|
+
"#fbbf24",
|
|
264
|
+
"#f59e0b",
|
|
265
|
+
"#d97706",
|
|
266
|
+
"#b45309",
|
|
267
|
+
"#92400e",
|
|
268
|
+
"#78350f",
|
|
269
|
+
"#451a03"
|
|
270
|
+
],
|
|
271
|
+
yellow: [
|
|
272
|
+
"#fefce8",
|
|
273
|
+
"#fef9c3",
|
|
274
|
+
"#fef08a",
|
|
275
|
+
"#fde047",
|
|
276
|
+
"#facc15",
|
|
277
|
+
"#eab308",
|
|
278
|
+
"#ca8a04",
|
|
279
|
+
"#a16207",
|
|
280
|
+
"#854d0e",
|
|
281
|
+
"#713f12",
|
|
282
|
+
"#422006"
|
|
283
|
+
],
|
|
284
|
+
lime: [
|
|
285
|
+
"#f7fee7",
|
|
286
|
+
"#ecfccb",
|
|
287
|
+
"#d9f99d",
|
|
288
|
+
"#bef264",
|
|
289
|
+
"#a3e635",
|
|
290
|
+
"#84cc16",
|
|
291
|
+
"#65a30d",
|
|
292
|
+
"#4d7c0f",
|
|
293
|
+
"#3f6212",
|
|
294
|
+
"#365314",
|
|
295
|
+
"#1a2e05"
|
|
296
|
+
],
|
|
297
|
+
green: [
|
|
298
|
+
"#f0fdf4",
|
|
299
|
+
"#dcfce7",
|
|
300
|
+
"#bbf7d0",
|
|
301
|
+
"#86efac",
|
|
302
|
+
"#4ade80",
|
|
303
|
+
"#22c55e",
|
|
304
|
+
"#16a34a",
|
|
305
|
+
"#15803d",
|
|
306
|
+
"#166534",
|
|
307
|
+
"#14532d",
|
|
308
|
+
"#052e16"
|
|
309
|
+
],
|
|
310
|
+
emerald: [
|
|
311
|
+
"#ecfdf5",
|
|
312
|
+
"#d1fae5",
|
|
313
|
+
"#a7f3d0",
|
|
314
|
+
"#6ee7b7",
|
|
315
|
+
"#34d399",
|
|
316
|
+
"#10b981",
|
|
317
|
+
"#059669",
|
|
318
|
+
"#047857",
|
|
319
|
+
"#065f46",
|
|
320
|
+
"#064e3b",
|
|
321
|
+
"#022c22"
|
|
322
|
+
],
|
|
323
|
+
teal: [
|
|
324
|
+
"#f0fdfa",
|
|
325
|
+
"#ccfbf1",
|
|
326
|
+
"#99f6e4",
|
|
327
|
+
"#5eead4",
|
|
328
|
+
"#2dd4bf",
|
|
329
|
+
"#14b8a6",
|
|
330
|
+
"#0d9488",
|
|
331
|
+
"#0f766e",
|
|
332
|
+
"#115e59",
|
|
333
|
+
"#134e4a",
|
|
334
|
+
"#042f2e"
|
|
335
|
+
],
|
|
336
|
+
cyan: [
|
|
337
|
+
"#ecfeff",
|
|
338
|
+
"#cffafe",
|
|
339
|
+
"#a5f3fc",
|
|
340
|
+
"#67e8f9",
|
|
341
|
+
"#22d3ee",
|
|
342
|
+
"#06b6d4",
|
|
343
|
+
"#0891b2",
|
|
344
|
+
"#0e7490",
|
|
345
|
+
"#155e75",
|
|
346
|
+
"#164e63",
|
|
347
|
+
"#083344"
|
|
348
|
+
],
|
|
349
|
+
sky: [
|
|
350
|
+
"#f0f9ff",
|
|
351
|
+
"#e0f2fe",
|
|
352
|
+
"#bae6fd",
|
|
353
|
+
"#7dd3fc",
|
|
354
|
+
"#38bdf8",
|
|
355
|
+
"#0ea5e9",
|
|
356
|
+
"#0284c7",
|
|
357
|
+
"#0369a1",
|
|
358
|
+
"#075985",
|
|
359
|
+
"#0c4a6e",
|
|
360
|
+
"#082f49"
|
|
361
|
+
],
|
|
362
|
+
blue: [
|
|
363
|
+
"#eff6ff",
|
|
364
|
+
"#dbeafe",
|
|
365
|
+
"#bfdbfe",
|
|
366
|
+
"#93c5fd",
|
|
367
|
+
"#60a5fa",
|
|
368
|
+
"#3b82f6",
|
|
369
|
+
"#2563eb",
|
|
370
|
+
"#1d4ed8",
|
|
371
|
+
"#1e40af",
|
|
372
|
+
"#1e3a8a",
|
|
373
|
+
"#172554"
|
|
374
|
+
],
|
|
375
|
+
indigo: [
|
|
376
|
+
"#eef2ff",
|
|
377
|
+
"#e0e7ff",
|
|
378
|
+
"#c7d2fe",
|
|
379
|
+
"#a5b4fc",
|
|
380
|
+
"#818cf8",
|
|
381
|
+
"#6366f1",
|
|
382
|
+
"#4f46e5",
|
|
383
|
+
"#4338ca",
|
|
384
|
+
"#3730a3",
|
|
385
|
+
"#312e81",
|
|
386
|
+
"#1e1b4b"
|
|
387
|
+
],
|
|
388
|
+
violet: [
|
|
389
|
+
"#f5f3ff",
|
|
390
|
+
"#ede9fe",
|
|
391
|
+
"#ddd6fe",
|
|
392
|
+
"#c4b5fd",
|
|
393
|
+
"#a78bfa",
|
|
394
|
+
"#8b5cf6",
|
|
395
|
+
"#7c3aed",
|
|
396
|
+
"#6d28d9",
|
|
397
|
+
"#5b21b6",
|
|
398
|
+
"#4c1d95",
|
|
399
|
+
"#2e1065"
|
|
400
|
+
],
|
|
401
|
+
purple: [
|
|
402
|
+
"#faf5ff",
|
|
403
|
+
"#f3e8ff",
|
|
404
|
+
"#e9d5ff",
|
|
405
|
+
"#d8b4fe",
|
|
406
|
+
"#c084fc",
|
|
407
|
+
"#a855f7",
|
|
408
|
+
"#9333ea",
|
|
409
|
+
"#7e22ce",
|
|
410
|
+
"#6b21a8",
|
|
411
|
+
"#581c87",
|
|
412
|
+
"#3b0764"
|
|
413
|
+
],
|
|
414
|
+
fuchsia: [
|
|
415
|
+
"#fdf4ff",
|
|
416
|
+
"#fae8ff",
|
|
417
|
+
"#f5d0fe",
|
|
418
|
+
"#f0abfc",
|
|
419
|
+
"#e879f9",
|
|
420
|
+
"#d946ef",
|
|
421
|
+
"#c026d3",
|
|
422
|
+
"#a21caf",
|
|
423
|
+
"#86198f",
|
|
424
|
+
"#701a75",
|
|
425
|
+
"#4a044e"
|
|
426
|
+
],
|
|
427
|
+
pink: [
|
|
428
|
+
"#fdf2f8",
|
|
429
|
+
"#fce7f3",
|
|
430
|
+
"#fbcfe8",
|
|
431
|
+
"#f9a8d4",
|
|
432
|
+
"#f472b6",
|
|
433
|
+
"#ec4899",
|
|
434
|
+
"#db2777",
|
|
435
|
+
"#be185d",
|
|
436
|
+
"#9d174d",
|
|
437
|
+
"#831843",
|
|
438
|
+
"#500724"
|
|
439
|
+
],
|
|
440
|
+
rose: [
|
|
441
|
+
"#fff1f2",
|
|
442
|
+
"#ffe4e6",
|
|
443
|
+
"#fecdd3",
|
|
444
|
+
"#fda4af",
|
|
445
|
+
"#fb7185",
|
|
446
|
+
"#f43f5e",
|
|
447
|
+
"#e11d48",
|
|
448
|
+
"#be123c",
|
|
449
|
+
"#9f1239",
|
|
450
|
+
"#881337",
|
|
451
|
+
"#4c0519"
|
|
452
|
+
]
|
|
453
|
+
};
|
|
454
|
+
function createTailwindV3DefaultColorThemeCss() {
|
|
455
|
+
const declarations = [" --color-black: #000;", " --color-white: #fff;"];
|
|
456
|
+
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]};`);
|
|
457
|
+
return [
|
|
458
|
+
"@theme {",
|
|
459
|
+
...declarations,
|
|
460
|
+
"}"
|
|
461
|
+
].join("\n");
|
|
462
|
+
}
|
|
463
|
+
[
|
|
464
|
+
"@theme {",
|
|
465
|
+
" --default-ring-width: 3px;",
|
|
466
|
+
" --default-ring-color: var(--color-blue-500, #3b82f6);",
|
|
467
|
+
" --default-outline-width: 3px;",
|
|
468
|
+
"",
|
|
469
|
+
" --shadow-xs: 0 1px rgb(0 0 0 / 0.05);",
|
|
470
|
+
" --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);",
|
|
471
|
+
" --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);",
|
|
472
|
+
" --drop-shadow-xs: 0 1px 1px rgb(0 0 0 / 0.05);",
|
|
473
|
+
" --drop-shadow-sm: 0 1px 2px rgb(0 0 0 / 0.15);",
|
|
474
|
+
" --drop-shadow: 0 1px 2px rgb(0 0 0 / 0.1), 0 1px 1px rgb(0 0 0 / 0.06);",
|
|
475
|
+
"",
|
|
476
|
+
" --blur-xs: 4px;",
|
|
477
|
+
" --blur-sm: 4px;",
|
|
478
|
+
" --blur: 8px;",
|
|
479
|
+
" --backdrop-blur-xs: 4px;",
|
|
480
|
+
" --backdrop-blur-sm: 4px;",
|
|
481
|
+
" --backdrop-blur: 8px;",
|
|
482
|
+
"",
|
|
483
|
+
" --radius-xs: 0.125rem;",
|
|
484
|
+
" --radius-sm: 0.125rem;",
|
|
485
|
+
" --radius: 0.25rem;",
|
|
486
|
+
"}",
|
|
487
|
+
createTailwindV3DefaultColorThemeCss()
|
|
488
|
+
].join("\n");
|
|
489
|
+
[
|
|
490
|
+
"*,",
|
|
491
|
+
"::after,",
|
|
492
|
+
"::before,",
|
|
493
|
+
"::backdrop,",
|
|
494
|
+
"::file-selector-button {",
|
|
495
|
+
" border-color: var(--color-gray-200, currentcolor);",
|
|
496
|
+
"}",
|
|
497
|
+
"",
|
|
498
|
+
"input::placeholder,",
|
|
499
|
+
"textarea::placeholder {",
|
|
500
|
+
" opacity: 1;",
|
|
501
|
+
" color: var(--color-gray-400, currentcolor);",
|
|
502
|
+
"}",
|
|
503
|
+
"",
|
|
504
|
+
"button:not(:disabled),",
|
|
505
|
+
"[role=\"button\"]:not(:disabled) {",
|
|
506
|
+
" cursor: pointer;",
|
|
507
|
+
"}",
|
|
508
|
+
"",
|
|
509
|
+
"dialog {",
|
|
510
|
+
" margin: auto;",
|
|
511
|
+
"}"
|
|
512
|
+
].join("\n");
|
|
513
|
+
(0, _weapp_tailwindcss_postcss.createStyleHandler)({
|
|
514
|
+
cssChildCombinatorReplaceValue: ["view", "text"],
|
|
515
|
+
cssRemoveHoverPseudoClass: true,
|
|
516
|
+
isMainChunk: true,
|
|
517
|
+
majorVersion: 3
|
|
518
|
+
});
|
|
519
|
+
[
|
|
520
|
+
"@tailwind base;",
|
|
521
|
+
"@tailwind components;",
|
|
522
|
+
"@tailwind utilities;"
|
|
523
|
+
].join("\n");
|
|
524
|
+
createDebug("[tailwindcss:runtime-patch] ");
|
|
525
|
+
(0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
|
|
526
|
+
createDebug("[tailwindcss:runtime] ");
|
|
283
527
|
//#endregion
|
|
284
|
-
//#region src/tailwindcss/
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
const label = kind === "cli" ? "weapp-tw patch" : "Weapp-tailwindcss";
|
|
288
|
-
if (!packageInfo?.rootPath) {
|
|
289
|
-
_weapp_tailwindcss_logger.logger.warn("%s 未找到 Tailwind CSS 依赖,请检查在 %s 是否已安装 tailwindcss", label, baseDir ?? node_process.default.cwd());
|
|
290
|
-
return;
|
|
291
|
-
}
|
|
292
|
-
const displayPath = formatRelativeToBase(packageInfo.rootPath, baseDir);
|
|
293
|
-
const version = packageInfo.version ? ` (v${packageInfo.version})` : "";
|
|
294
|
-
if (kind === "runtime") {
|
|
295
|
-
logRuntimeTailwindcssTarget(baseDir, packageInfo.rootPath, packageInfo.version);
|
|
296
|
-
return;
|
|
297
|
-
}
|
|
298
|
-
_weapp_tailwindcss_logger.logger.info("%s 绑定 Tailwind CSS -> %s%s", label, displayPath, version);
|
|
299
|
-
}
|
|
528
|
+
//#region src/tailwindcss/runtime-logs.ts
|
|
529
|
+
const runtimeLogDedupeHolder = globalThis;
|
|
530
|
+
runtimeLogDedupeHolder.__WEAPP_TW_RUNTIME_LOG_DEDUPE__ ?? (runtimeLogDedupeHolder.__WEAPP_TW_RUNTIME_LOG_DEDUPE__ = /* @__PURE__ */ new Set());
|
|
300
531
|
//#endregion
|
|
301
532
|
//#region src/context/compiler-context-cache.ts
|
|
302
533
|
const globalCacheHolder = globalThis;
|
|
303
534
|
globalCacheHolder.__WEAPP_TW_COMPILER_CONTEXT_CACHE__ ?? (globalCacheHolder.__WEAPP_TW_COMPILER_CONTEXT_CACHE__ = /* @__PURE__ */ new Map());
|
|
304
535
|
//#endregion
|
|
536
|
+
//#region src/constants.ts
|
|
537
|
+
const WEAPP_TW_REQUIRED_NODE_VERSION_RANGE = "^20.19.0 || >=22.12.0";
|
|
538
|
+
//#endregion
|
|
305
539
|
//#region src/babel/index.ts
|
|
306
540
|
function _interopDefaultCompat(e) {
|
|
307
541
|
return e && typeof e === "object" && "default" in e ? e.default : e;
|
|
@@ -315,6 +549,7 @@ function buildFuzzyMatcher(fuzzyStrings) {
|
|
|
315
549
|
if (fuzzyStrings.length === 0) return;
|
|
316
550
|
if (fuzzyStrings.length === 1) {
|
|
317
551
|
const [needle] = fuzzyStrings;
|
|
552
|
+
if (needle === void 0) return;
|
|
318
553
|
return (value) => value.includes(needle);
|
|
319
554
|
}
|
|
320
555
|
const unique = [...new Set(fuzzyStrings)];
|
|
@@ -338,11 +573,13 @@ function createNameMatcher(list, { exact = false } = {}) {
|
|
|
338
573
|
const exactStringCount = exactStrings?.size ?? 0;
|
|
339
574
|
if (exactStringCount === 1 && regexList.length === 0) {
|
|
340
575
|
const [needle] = exactStrings;
|
|
576
|
+
if (needle === void 0) return NEVER_MATCH_NAME$1;
|
|
341
577
|
return (value) => value === needle;
|
|
342
578
|
}
|
|
343
579
|
if (regexList.length === 0) return (value) => exactStrings.has(value);
|
|
344
580
|
if (exactStringCount === 0 && regexList.length === 1) {
|
|
345
581
|
const [regex] = regexList;
|
|
582
|
+
if (!regex) return NEVER_MATCH_NAME$1;
|
|
346
583
|
return (value) => regex.test(value);
|
|
347
584
|
}
|
|
348
585
|
return (value) => {
|
|
@@ -355,6 +592,7 @@ function createNameMatcher(list, { exact = false } = {}) {
|
|
|
355
592
|
if (fuzzyMatcher && !hasRegex) return fuzzyMatcher;
|
|
356
593
|
if (!fuzzyMatcher && regexList.length === 1) {
|
|
357
594
|
const [regex] = regexList;
|
|
595
|
+
if (!regex) return NEVER_MATCH_NAME$1;
|
|
358
596
|
return (value) => regex.test(value);
|
|
359
597
|
}
|
|
360
598
|
return (value) => {
|
|
@@ -365,20 +603,40 @@ function createNameMatcher(list, { exact = false } = {}) {
|
|
|
365
603
|
}
|
|
366
604
|
//#endregion
|
|
367
605
|
//#region src/js/babel/parse.ts
|
|
368
|
-
const parseCache = new lru_cache.LRUCache({ max:
|
|
606
|
+
const parseCache = new lru_cache.LRUCache({ max: HARD_PARSE_CACHE_MAX_ENTRIES });
|
|
369
607
|
function genCacheKey(source, options) {
|
|
370
|
-
if (typeof options === "string") return source
|
|
371
|
-
return source
|
|
608
|
+
if (typeof options === "string") return `${(0, _weapp_tailwindcss_shared_node.md5)(source)}:${options}`;
|
|
609
|
+
return `${(0, _weapp_tailwindcss_shared_node.md5)(source)}:${JSON.stringify(options, (_, val) => typeof val === "function" ? val.toString() : val)}`;
|
|
610
|
+
}
|
|
611
|
+
function normalizeCacheMaxEntries(value) {
|
|
612
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return 128;
|
|
613
|
+
return Math.min(Math.max(Math.floor(value), 0), HARD_PARSE_CACHE_MAX_ENTRIES);
|
|
614
|
+
}
|
|
615
|
+
function normalizeCacheMaxSourceLength(value) {
|
|
616
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH;
|
|
617
|
+
return Math.max(Math.floor(value), 0);
|
|
618
|
+
}
|
|
619
|
+
function trimParseCache(maxEntries) {
|
|
620
|
+
while (parseCache.size > maxEntries) parseCache.pop();
|
|
372
621
|
}
|
|
373
622
|
function babelParse(code, opts = {}) {
|
|
374
|
-
const { cache, cacheKey, ...rest } = opts;
|
|
375
|
-
const
|
|
623
|
+
const { cache, cacheKey, cacheMaxEntries, cacheMaxSourceLength, ...rest } = opts;
|
|
624
|
+
const maxEntries = normalizeCacheMaxEntries(cacheMaxEntries);
|
|
625
|
+
const maxSourceLength = normalizeCacheMaxSourceLength(cacheMaxSourceLength);
|
|
626
|
+
const shouldCache = cache === true && maxEntries > 0 && code.length <= maxSourceLength;
|
|
627
|
+
const cacheKeyString = shouldCache ? genCacheKey(code, cacheKey ?? rest) : void 0;
|
|
376
628
|
let result;
|
|
377
|
-
if (
|
|
629
|
+
if (shouldCache) {
|
|
630
|
+
trimParseCache(maxEntries);
|
|
631
|
+
result = parseCache.get(cacheKeyString);
|
|
632
|
+
}
|
|
378
633
|
if (!result) {
|
|
379
|
-
const { cache: _cache, cacheKey: _cacheKey, ...parseOptions } = opts;
|
|
634
|
+
const { cache: _cache, cacheKey: _cacheKey, cacheMaxEntries: _cacheMaxEntries, cacheMaxSourceLength: _cacheMaxSourceLength, ...parseOptions } = opts;
|
|
380
635
|
result = (0, _babel_parser.parse)(code, parseOptions);
|
|
381
|
-
if (
|
|
636
|
+
if (shouldCache) {
|
|
637
|
+
parseCache.set(cacheKeyString, result);
|
|
638
|
+
trimParseCache(maxEntries);
|
|
639
|
+
}
|
|
382
640
|
}
|
|
383
641
|
return result;
|
|
384
642
|
}
|
|
@@ -392,10 +650,10 @@ function replaceWxml(original, options = {
|
|
|
392
650
|
const { keepEOL, escapeMap, ignoreHead } = options;
|
|
393
651
|
let res = original;
|
|
394
652
|
if (!keepEOL) res = res.replaceAll(NEWLINE_RE, "");
|
|
395
|
-
res = (0, _weapp_core_escape.escape)(res, {
|
|
653
|
+
res = (0, _weapp_core_escape.escape)(res, omitUndefined({
|
|
396
654
|
map: escapeMap,
|
|
397
655
|
ignoreHead
|
|
398
|
-
});
|
|
656
|
+
}));
|
|
399
657
|
return res;
|
|
400
658
|
}
|
|
401
659
|
//#endregion
|
|
@@ -933,6 +1191,44 @@ function walkEvalExpression(path, options, updater, handler) {
|
|
|
933
1191
|
}
|
|
934
1192
|
}
|
|
935
1193
|
//#endregion
|
|
1194
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
|
|
1195
|
+
function _typeof(o) {
|
|
1196
|
+
"@babel/helpers - typeof";
|
|
1197
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
1198
|
+
return typeof o;
|
|
1199
|
+
} : function(o) {
|
|
1200
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
1201
|
+
}, _typeof(o);
|
|
1202
|
+
}
|
|
1203
|
+
//#endregion
|
|
1204
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
|
|
1205
|
+
function toPrimitive(t, r) {
|
|
1206
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
1207
|
+
var e = t[Symbol.toPrimitive];
|
|
1208
|
+
if (void 0 !== e) {
|
|
1209
|
+
var i = e.call(t, r || "default");
|
|
1210
|
+
if ("object" != _typeof(i)) return i;
|
|
1211
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1212
|
+
}
|
|
1213
|
+
return ("string" === r ? String : Number)(t);
|
|
1214
|
+
}
|
|
1215
|
+
//#endregion
|
|
1216
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
|
|
1217
|
+
function toPropertyKey(t) {
|
|
1218
|
+
var i = toPrimitive(t, "string");
|
|
1219
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
1220
|
+
}
|
|
1221
|
+
//#endregion
|
|
1222
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
|
|
1223
|
+
function _defineProperty(e, r, t) {
|
|
1224
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
1225
|
+
value: t,
|
|
1226
|
+
enumerable: !0,
|
|
1227
|
+
configurable: !0,
|
|
1228
|
+
writable: !0
|
|
1229
|
+
}) : e[r] = t, e;
|
|
1230
|
+
}
|
|
1231
|
+
//#endregion
|
|
936
1232
|
//#region src/js/JsTokenUpdater.ts
|
|
937
1233
|
/**
|
|
938
1234
|
* Lightweight helper that batches updates to {@link MagicString}.
|
|
@@ -941,6 +1237,7 @@ function walkEvalExpression(path, options, updater, handler) {
|
|
|
941
1237
|
*/
|
|
942
1238
|
var JsTokenUpdater = class {
|
|
943
1239
|
constructor({ value } = {}) {
|
|
1240
|
+
_defineProperty(this, "tokens", void 0);
|
|
944
1241
|
this.tokens = value ? [...value] : [];
|
|
945
1242
|
}
|
|
946
1243
|
addToken(token) {
|
|
@@ -974,7 +1271,7 @@ var JsTokenUpdater = class {
|
|
|
974
1271
|
var IgnoredExportsTracker = class {
|
|
975
1272
|
constructor(options) {
|
|
976
1273
|
this.options = options;
|
|
977
|
-
this
|
|
1274
|
+
_defineProperty(this, "ignoredExportNames", /* @__PURE__ */ new Map());
|
|
978
1275
|
}
|
|
979
1276
|
addIgnoredExport(filename, exportName) {
|
|
980
1277
|
if (!exportName) return;
|
|
@@ -1093,8 +1390,16 @@ var IgnoredExportsTracker = class {
|
|
|
1093
1390
|
//#region src/js/ModuleGraph.ts
|
|
1094
1391
|
var JsModuleGraph = class {
|
|
1095
1392
|
constructor(entry, graphOptions) {
|
|
1096
|
-
this
|
|
1097
|
-
this
|
|
1393
|
+
_defineProperty(this, "modules", /* @__PURE__ */ new Map());
|
|
1394
|
+
_defineProperty(this, "queue", []);
|
|
1395
|
+
_defineProperty(this, "resolve", void 0);
|
|
1396
|
+
_defineProperty(this, "load", void 0);
|
|
1397
|
+
_defineProperty(this, "filter", void 0);
|
|
1398
|
+
_defineProperty(this, "maxDepth", void 0);
|
|
1399
|
+
_defineProperty(this, "baseOptions", void 0);
|
|
1400
|
+
_defineProperty(this, "parserOptions", void 0);
|
|
1401
|
+
_defineProperty(this, "rootFilename", void 0);
|
|
1402
|
+
_defineProperty(this, "ignoredExports", void 0);
|
|
1098
1403
|
this.resolve = graphOptions.resolve;
|
|
1099
1404
|
this.load = graphOptions.load;
|
|
1100
1405
|
this.filter = graphOptions.filter;
|
|
@@ -1266,6 +1571,12 @@ const NEVER_MATCH_NAME = () => false;
|
|
|
1266
1571
|
*/
|
|
1267
1572
|
var NodePathWalker = class {
|
|
1268
1573
|
constructor({ ignoreCallExpressionIdentifiers, callback } = {}) {
|
|
1574
|
+
_defineProperty(this, "ignoreCallExpressionIdentifiers", void 0);
|
|
1575
|
+
_defineProperty(this, "callback", void 0);
|
|
1576
|
+
_defineProperty(this, "isIgnoredCallIdentifier", void 0);
|
|
1577
|
+
_defineProperty(this, "hasIgnoredCallIdentifiers", void 0);
|
|
1578
|
+
_defineProperty(this, "importsStore", void 0);
|
|
1579
|
+
_defineProperty(this, "visitedStore", void 0);
|
|
1269
1580
|
this.hasIgnoredCallIdentifiers = Boolean(ignoreCallExpressionIdentifiers && ignoreCallExpressionIdentifiers.length > 0);
|
|
1270
1581
|
this.ignoreCallExpressionIdentifiers = ignoreCallExpressionIdentifiers ?? EMPTY_IGNORE_CALL_EXPRESSION_IDENTIFIERS;
|
|
1271
1582
|
this.callback = callback ?? NOOP_STRING_PATH_CALLBACK;
|
|
@@ -1528,7 +1839,7 @@ function analyzeSource(ast, options, handler, collectModuleMetadata = true) {
|
|
|
1528
1839
|
const needScope = Boolean(options.ignoreCallExpressionIdentifiers && options.ignoreCallExpressionIdentifiers.length > 0);
|
|
1529
1840
|
const ignoredPaths = needScope ? /* @__PURE__ */ new WeakSet() : EMPTY_IGNORED_PATHS;
|
|
1530
1841
|
const walker = needScope ? new NodePathWalker({
|
|
1531
|
-
ignoreCallExpressionIdentifiers: options.ignoreCallExpressionIdentifiers,
|
|
1842
|
+
...options.ignoreCallExpressionIdentifiers === void 0 ? {} : { ignoreCallExpressionIdentifiers: options.ignoreCallExpressionIdentifiers },
|
|
1532
1843
|
callback(path) {
|
|
1533
1844
|
ignoredPaths.add(path);
|
|
1534
1845
|
}
|
|
@@ -1538,7 +1849,7 @@ function analyzeSource(ast, options, handler, collectModuleMetadata = true) {
|
|
|
1538
1849
|
function getTaggedTemplateIgnore() {
|
|
1539
1850
|
if (!taggedTemplateIgnore) taggedTemplateIgnore = createTaggedTemplateIgnore({
|
|
1540
1851
|
matcher: getIgnoredTaggedTemplateMatcher(options),
|
|
1541
|
-
names: options.ignoreTaggedTemplateExpressionIdentifiers
|
|
1852
|
+
...options.ignoreTaggedTemplateExpressionIdentifiers === void 0 ? {} : { names: options.ignoreTaggedTemplateExpressionIdentifiers }
|
|
1542
1853
|
});
|
|
1543
1854
|
return taggedTemplateIgnore;
|
|
1544
1855
|
}
|
|
@@ -1673,6 +1984,13 @@ function isWhitespace(char) {
|
|
|
1673
1984
|
//#region src/wxml/Tokenizer.ts
|
|
1674
1985
|
var Tokenizer = class {
|
|
1675
1986
|
constructor() {
|
|
1987
|
+
_defineProperty(this, "state", void 0);
|
|
1988
|
+
_defineProperty(this, "buffer", void 0);
|
|
1989
|
+
_defineProperty(this, "tokens", void 0);
|
|
1990
|
+
_defineProperty(this, "bufferStartIndex", void 0);
|
|
1991
|
+
_defineProperty(this, "expressionStartIndex", void 0);
|
|
1992
|
+
_defineProperty(this, "expressionBuffer", void 0);
|
|
1993
|
+
_defineProperty(this, "expressions", void 0);
|
|
1676
1994
|
this.reset();
|
|
1677
1995
|
}
|
|
1678
1996
|
processChar(char, index) {
|
|
@@ -1763,6 +2081,7 @@ var Tokenizer = class {
|
|
|
1763
2081
|
this.reset();
|
|
1764
2082
|
for (let i = 0; i < input.length; i++) {
|
|
1765
2083
|
const char = input[i];
|
|
2084
|
+
if (char === void 0) continue;
|
|
1766
2085
|
this.processChar(char, i);
|
|
1767
2086
|
}
|
|
1768
2087
|
if (this.buffer.length > 0) this.tokens.push({
|
|
@@ -1787,36 +2106,6 @@ var Tokenizer = class {
|
|
|
1787
2106
|
};
|
|
1788
2107
|
new Tokenizer();
|
|
1789
2108
|
//#endregion
|
|
1790
|
-
//#region src/context/index.ts
|
|
1791
|
-
async function clearTailwindcssPatcherCache(patcher, options) {
|
|
1792
|
-
if (!patcher) return;
|
|
1793
|
-
const cacheOptions = patcher.options?.cache;
|
|
1794
|
-
if (cacheOptions == null || typeof cacheOptions === "object" && cacheOptions.enabled === false) return;
|
|
1795
|
-
if (typeof patcher.clearCache === "function") try {
|
|
1796
|
-
await patcher.clearCache({ scope: "all" });
|
|
1797
|
-
} catch (error) {
|
|
1798
|
-
_weapp_tailwindcss_logger.logger.debug("failed to clear tailwindcss patcher cache via clearCache(): %O", error);
|
|
1799
|
-
}
|
|
1800
|
-
if (!options?.removeDirectory) return;
|
|
1801
|
-
const cachePaths = /* @__PURE__ */ new Map();
|
|
1802
|
-
const normalizedCacheOptions = typeof cacheOptions === "object" ? cacheOptions : void 0;
|
|
1803
|
-
if (normalizedCacheOptions?.path) cachePaths.set(normalizedCacheOptions.path, false);
|
|
1804
|
-
const privateCachePath = patcher?.cacheStore?.options?.path;
|
|
1805
|
-
if (privateCachePath) cachePaths.set(privateCachePath, false);
|
|
1806
|
-
if (options?.removeDirectory && normalizedCacheOptions?.dir) cachePaths.set(normalizedCacheOptions.dir, true);
|
|
1807
|
-
if (!cachePaths.size) return;
|
|
1808
|
-
for (const [cachePath, recursive] of cachePaths.entries()) try {
|
|
1809
|
-
await (0, node_fs_promises.rm)(cachePath, {
|
|
1810
|
-
force: true,
|
|
1811
|
-
recursive
|
|
1812
|
-
});
|
|
1813
|
-
} catch (error) {
|
|
1814
|
-
const err = error;
|
|
1815
|
-
if (err?.code === "ENOENT") continue;
|
|
1816
|
-
_weapp_tailwindcss_logger.logger.debug("failed to clear tailwindcss patcher cache: %s %O", cachePath, err);
|
|
1817
|
-
}
|
|
1818
|
-
}
|
|
1819
|
-
//#endregion
|
|
1820
2109
|
//#region src/cli/context.ts
|
|
1821
2110
|
function formatOutputPath(target, baseDir) {
|
|
1822
2111
|
const root = baseDir ?? node_process.default.cwd();
|
|
@@ -1860,7 +2149,7 @@ const FRAMEWORK_DEPS = [
|
|
|
1860
2149
|
];
|
|
1861
2150
|
//#endregion
|
|
1862
2151
|
//#region src/cli/doctor.ts
|
|
1863
|
-
function tryReadJson
|
|
2152
|
+
function tryReadJson(file) {
|
|
1864
2153
|
try {
|
|
1865
2154
|
return JSON.parse((0, node_fs.readFileSync)(file, "utf8"));
|
|
1866
2155
|
} catch {
|
|
@@ -1871,11 +2160,11 @@ function findFirstExisting(cwd, files) {
|
|
|
1871
2160
|
return files.find((file) => (0, node_fs.existsSync)(node_path.default.join(cwd, file)));
|
|
1872
2161
|
}
|
|
1873
2162
|
function readProjectPackageJson(cwd) {
|
|
1874
|
-
return tryReadJson
|
|
2163
|
+
return tryReadJson(node_path.default.join(cwd, "package.json"));
|
|
1875
2164
|
}
|
|
1876
2165
|
function readDependencyVersion(cwd, packageName) {
|
|
1877
2166
|
try {
|
|
1878
|
-
return tryReadJson
|
|
2167
|
+
return tryReadJson((0, node_module.createRequire)(node_path.default.join(cwd, "package.json")).resolve(`${packageName}/package.json`))?.version;
|
|
1879
2168
|
} catch {
|
|
1880
2169
|
return;
|
|
1881
2170
|
}
|
|
@@ -2118,43 +2407,6 @@ function resolveCliCwd(value) {
|
|
|
2118
2407
|
return node_path.default.isAbsolute(raw) ? node_path.default.normalize(raw) : node_path.default.resolve(node_process.default.cwd(), raw);
|
|
2119
2408
|
}
|
|
2120
2409
|
//#endregion
|
|
2121
|
-
//#region src/tailwindcss/index.ts
|
|
2122
|
-
function getTailwindcssPackageInfo(options) {
|
|
2123
|
-
return (0, local_pkg.getPackageInfoSync)("tailwindcss", options);
|
|
2124
|
-
}
|
|
2125
|
-
//#endregion
|
|
2126
|
-
//#region src/cli/helpers/patch-cwd.ts
|
|
2127
|
-
/**
|
|
2128
|
-
* Resolve default working directory for `weapp-tw patch`.
|
|
2129
|
-
* Prefer explicit env overrides to avoid cross-package INIT_CWD pollution.
|
|
2130
|
-
*/
|
|
2131
|
-
function normalizeCandidatePath(baseDir, candidate) {
|
|
2132
|
-
if (!candidate) return;
|
|
2133
|
-
return node_path.default.isAbsolute(candidate) ? node_path.default.normalize(candidate) : node_path.default.resolve(baseDir, candidate);
|
|
2134
|
-
}
|
|
2135
|
-
function detectTailwindWorkspace(paths) {
|
|
2136
|
-
for (const candidate of paths) try {
|
|
2137
|
-
if (getTailwindcssPackageInfo({ paths: [candidate] })?.rootPath) return candidate;
|
|
2138
|
-
} catch {}
|
|
2139
|
-
}
|
|
2140
|
-
function resolvePatchDefaultCwd(currentCwd = node_process.default.cwd()) {
|
|
2141
|
-
const baseDir = node_path.default.normalize(currentCwd);
|
|
2142
|
-
const explicitCwd = normalizeCandidatePath(baseDir, node_process.default.env.WEAPP_TW_PATCH_CWD);
|
|
2143
|
-
if (explicitCwd) return explicitCwd;
|
|
2144
|
-
const workspaceRoot = findWorkspaceRoot(baseDir);
|
|
2145
|
-
const initCwd = normalizeCandidatePath(baseDir, node_process.default.env.INIT_CWD);
|
|
2146
|
-
const localPrefix = normalizeCandidatePath(baseDir, node_process.default.env.npm_config_local_prefix);
|
|
2147
|
-
const candidates = [
|
|
2148
|
-
baseDir,
|
|
2149
|
-
workspaceRoot,
|
|
2150
|
-
initCwd,
|
|
2151
|
-
localPrefix
|
|
2152
|
-
].filter(Boolean);
|
|
2153
|
-
const detected = detectTailwindWorkspace([...new Set(candidates)]);
|
|
2154
|
-
if (detected) return detected;
|
|
2155
|
-
return initCwd ?? localPrefix ?? workspaceRoot ?? baseDir;
|
|
2156
|
-
}
|
|
2157
|
-
//#endregion
|
|
2158
2410
|
//#region src/cli/helpers.ts
|
|
2159
2411
|
async function ensureDir(dir) {
|
|
2160
2412
|
await (0, node_fs_promises.mkdir)(dir, { recursive: true });
|
|
@@ -2162,7 +2414,7 @@ async function ensureDir(dir) {
|
|
|
2162
2414
|
function handleCliError$1(error) {
|
|
2163
2415
|
if (error instanceof Error) {
|
|
2164
2416
|
_weapp_tailwindcss_logger.logger.error(error.message);
|
|
2165
|
-
if (error.stack && node_process.default.env
|
|
2417
|
+
if (error.stack && node_process.default.env["WEAPP_TW_DEBUG"] === "1") _weapp_tailwindcss_logger.logger.error(error.stack);
|
|
2166
2418
|
} else _weapp_tailwindcss_logger.logger.error(String(error));
|
|
2167
2419
|
}
|
|
2168
2420
|
function commandAction(handler) {
|
|
@@ -2176,216 +2428,15 @@ function commandAction(handler) {
|
|
|
2176
2428
|
};
|
|
2177
2429
|
}
|
|
2178
2430
|
//#endregion
|
|
2179
|
-
//#region src/cli/mount-options/patch-status.ts
|
|
2180
|
-
function formatStatusFilesHint(files) {
|
|
2181
|
-
if (!files?.length) return "";
|
|
2182
|
-
return ` (${files.join(", ")})`;
|
|
2183
|
-
}
|
|
2184
|
-
function logPatchStatusReport(report) {
|
|
2185
|
-
const applied = report.entries.filter((entry) => entry.status === "applied");
|
|
2186
|
-
const pending = report.entries.filter((entry) => entry.status === "not-applied");
|
|
2187
|
-
const skipped = report.entries.filter((entry) => entry.status === "skipped" || entry.status === "unsupported");
|
|
2188
|
-
const packageLabel = `${report.package.name ?? "tailwindcss"}@${report.package.version ?? "unknown"}`;
|
|
2189
|
-
_weapp_tailwindcss_logger.logger.info(`Patch status for ${packageLabel} (v${report.majorVersion})`);
|
|
2190
|
-
if (applied.length) {
|
|
2191
|
-
_weapp_tailwindcss_logger.logger.success("Applied:");
|
|
2192
|
-
applied.forEach((entry) => {
|
|
2193
|
-
_weapp_tailwindcss_logger.logger.success(` - ${entry.name}${formatStatusFilesHint(entry.files)}`);
|
|
2194
|
-
});
|
|
2195
|
-
}
|
|
2196
|
-
if (pending.length) {
|
|
2197
|
-
_weapp_tailwindcss_logger.logger.warn("Needs attention:");
|
|
2198
|
-
pending.forEach((entry) => {
|
|
2199
|
-
const details = entry.reason ? ` - ${entry.reason}` : "";
|
|
2200
|
-
_weapp_tailwindcss_logger.logger.warn(` - ${entry.name}${formatStatusFilesHint(entry.files)}${details}`);
|
|
2201
|
-
});
|
|
2202
|
-
} else _weapp_tailwindcss_logger.logger.success("All applicable patches are applied.");
|
|
2203
|
-
if (skipped.length) {
|
|
2204
|
-
_weapp_tailwindcss_logger.logger.info("Skipped:");
|
|
2205
|
-
skipped.forEach((entry) => {
|
|
2206
|
-
const details = entry.reason ? ` - ${entry.reason}` : "";
|
|
2207
|
-
_weapp_tailwindcss_logger.logger.info(` - ${entry.name}${details}`);
|
|
2208
|
-
});
|
|
2209
|
-
}
|
|
2210
|
-
}
|
|
2211
|
-
//#endregion
|
|
2212
|
-
//#region src/cli/patch-options.ts
|
|
2213
|
-
const DEFAULT_EXTEND_LENGTH_UNITS_FEATURE = {
|
|
2214
|
-
enabled: true,
|
|
2215
|
-
units: ["rpx"],
|
|
2216
|
-
overwrite: true
|
|
2217
|
-
};
|
|
2218
|
-
function withDefaultExtendLengthUnits(options) {
|
|
2219
|
-
const normalized = options ?? {};
|
|
2220
|
-
if (normalized.apply?.extendLengthUnits == null) return {
|
|
2221
|
-
...normalized,
|
|
2222
|
-
apply: {
|
|
2223
|
-
...normalized.apply ?? {},
|
|
2224
|
-
extendLengthUnits: DEFAULT_EXTEND_LENGTH_UNITS_FEATURE
|
|
2225
|
-
}
|
|
2226
|
-
};
|
|
2227
|
-
return normalized;
|
|
2228
|
-
}
|
|
2229
|
-
function buildExtendLengthUnitsOverride(options) {
|
|
2230
|
-
if (options?.apply?.extendLengthUnits == null) return { apply: {
|
|
2231
|
-
...options?.apply ?? {},
|
|
2232
|
-
extendLengthUnits: DEFAULT_EXTEND_LENGTH_UNITS_FEATURE
|
|
2233
|
-
} };
|
|
2234
|
-
}
|
|
2235
|
-
//#endregion
|
|
2236
|
-
//#region src/cli/workspace/workspace-io.ts
|
|
2237
|
-
function tryReadJson(file) {
|
|
2238
|
-
try {
|
|
2239
|
-
const content = (0, node_fs.readFileSync)(file, "utf8");
|
|
2240
|
-
return JSON.parse(content);
|
|
2241
|
-
} catch {
|
|
2242
|
-
return;
|
|
2243
|
-
}
|
|
2244
|
-
}
|
|
2245
|
-
//#endregion
|
|
2246
|
-
//#region src/cli/workspace/workspace-globs.ts
|
|
2247
|
-
function parseWorkspaceGlobsFromPackageJson(workspaceRoot) {
|
|
2248
|
-
const pkg = tryReadJson(node_path.default.join(workspaceRoot, "package.json"));
|
|
2249
|
-
if (!pkg?.workspaces) return [];
|
|
2250
|
-
if (Array.isArray(pkg.workspaces)) return pkg.workspaces.filter(Boolean);
|
|
2251
|
-
if (Array.isArray(pkg.workspaces.packages)) return pkg.workspaces.packages.filter(Boolean);
|
|
2252
|
-
return [];
|
|
2253
|
-
}
|
|
2254
|
-
function parseWorkspaceGlobsFromWorkspaceFile(workspaceRoot) {
|
|
2255
|
-
const workspaceFile = node_path.default.join(workspaceRoot, "pnpm-workspace.yaml");
|
|
2256
|
-
if (!(0, node_fs.existsSync)(workspaceFile)) return [];
|
|
2257
|
-
try {
|
|
2258
|
-
const parsed = (0, yaml.parse)((0, node_fs.readFileSync)(workspaceFile, "utf8"));
|
|
2259
|
-
return Array.isArray(parsed?.packages) ? parsed.packages.filter(Boolean) : [];
|
|
2260
|
-
} catch {
|
|
2261
|
-
return [];
|
|
2262
|
-
}
|
|
2263
|
-
}
|
|
2264
|
-
//#endregion
|
|
2265
|
-
//#region src/cli/workspace/workspace-lock.ts
|
|
2266
|
-
function parseImportersFromLock(workspaceRoot) {
|
|
2267
|
-
const lockPath = node_path.default.join(workspaceRoot, "pnpm-lock.yaml");
|
|
2268
|
-
if (!(0, node_fs.existsSync)(lockPath)) return [];
|
|
2269
|
-
try {
|
|
2270
|
-
const importers = (0, yaml.parse)((0, node_fs.readFileSync)(lockPath, "utf8"))?.importers;
|
|
2271
|
-
if (!importers) return [];
|
|
2272
|
-
return Object.keys(importers).map((key) => {
|
|
2273
|
-
if (!key || key === ".") return workspaceRoot;
|
|
2274
|
-
return node_path.default.join(workspaceRoot, key);
|
|
2275
|
-
});
|
|
2276
|
-
} catch {
|
|
2277
|
-
return [];
|
|
2278
|
-
}
|
|
2279
|
-
}
|
|
2280
|
-
//#endregion
|
|
2281
|
-
//#region src/cli/workspace/package-dirs.ts
|
|
2282
|
-
const BACKSLASH_RE$1 = /\\/g;
|
|
2283
|
-
const TRAILING_SLASH_RE = /\/+$/;
|
|
2284
|
-
async function resolveWorkspacePackageDirs(workspaceRoot) {
|
|
2285
|
-
const dirs = /* @__PURE__ */ new Set();
|
|
2286
|
-
for (const importerDir of parseImportersFromLock(workspaceRoot)) dirs.add(node_path.default.normalize(importerDir));
|
|
2287
|
-
if (!dirs.size) {
|
|
2288
|
-
let globs = parseWorkspaceGlobsFromWorkspaceFile(workspaceRoot);
|
|
2289
|
-
if (!globs.length) globs = parseWorkspaceGlobsFromPackageJson(workspaceRoot);
|
|
2290
|
-
if (globs.length > 0) {
|
|
2291
|
-
const packageJsonFiles = await (0, fast_glob.default)(globs.map((pattern) => {
|
|
2292
|
-
const normalized = pattern.replace(BACKSLASH_RE$1, "/").replace(TRAILING_SLASH_RE, "");
|
|
2293
|
-
return normalized.endsWith("package.json") ? normalized : `${normalized}/package.json`;
|
|
2294
|
-
}), {
|
|
2295
|
-
cwd: workspaceRoot,
|
|
2296
|
-
absolute: true,
|
|
2297
|
-
onlyFiles: true,
|
|
2298
|
-
unique: true,
|
|
2299
|
-
ignore: ["**/node_modules/**", "**/.git/**"]
|
|
2300
|
-
});
|
|
2301
|
-
for (const file of packageJsonFiles) dirs.add(node_path.default.normalize(node_path.default.dirname(file)));
|
|
2302
|
-
}
|
|
2303
|
-
}
|
|
2304
|
-
if ((0, node_fs.existsSync)(node_path.default.join(workspaceRoot, "package.json"))) dirs.add(node_path.default.normalize(workspaceRoot));
|
|
2305
|
-
return [...dirs];
|
|
2306
|
-
}
|
|
2307
|
-
//#endregion
|
|
2308
|
-
//#region src/cli/workspace/patch-utils.ts
|
|
2309
|
-
function formatDisplayName(workspaceRoot, dir, name) {
|
|
2310
|
-
const relative = node_path.default.relative(workspaceRoot, dir) || ".";
|
|
2311
|
-
return name ? `${name} (${relative})` : relative;
|
|
2312
|
-
}
|
|
2313
|
-
function summarizeWorkspaceResults(results) {
|
|
2314
|
-
const patched = results.filter((result) => result.status === "patched").length;
|
|
2315
|
-
const skipped = results.filter((result) => result.status === "skipped").length;
|
|
2316
|
-
const failed = results.filter((result) => result.status === "failed").length;
|
|
2317
|
-
_weapp_tailwindcss_logger.logger.info("[workspace] 汇总:已补丁 %d,跳过 %d,失败 %d", patched, skipped, failed);
|
|
2318
|
-
}
|
|
2319
|
-
//#endregion
|
|
2320
|
-
//#region src/cli/workspace/patch-package.ts
|
|
2321
|
-
function createWorkspacePatcher(cwd) {
|
|
2322
|
-
return new tailwindcss_patch.TailwindcssPatcher((0, tailwindcss_patch.normalizeOptions)(withDefaultExtendLengthUnits({ projectRoot: cwd })));
|
|
2323
|
-
}
|
|
2324
|
-
async function patchWorkspacePackage(workspaceRoot, dir, pkgName, options) {
|
|
2325
|
-
const displayName = formatDisplayName(workspaceRoot, dir, pkgName);
|
|
2326
|
-
if (!getTailwindcssPackageInfo({ paths: [dir] })?.rootPath) {
|
|
2327
|
-
_weapp_tailwindcss_logger.logger.info("[workspace] 跳过 %s(tailwindcss 未安装)。", displayName);
|
|
2328
|
-
return {
|
|
2329
|
-
dir,
|
|
2330
|
-
name: pkgName,
|
|
2331
|
-
status: "skipped",
|
|
2332
|
-
message: "tailwindcss 未安装,已跳过。"
|
|
2333
|
-
};
|
|
2334
|
-
}
|
|
2335
|
-
try {
|
|
2336
|
-
const patcher = createWorkspacePatcher(dir);
|
|
2337
|
-
if (options.clearCache) await clearTailwindcssPatcherCache(patcher, { removeDirectory: true });
|
|
2338
|
-
const recorder = createPatchTargetRecorder(dir, patcher, {
|
|
2339
|
-
source: "cli",
|
|
2340
|
-
cwd: dir,
|
|
2341
|
-
recordTarget: options.recordTarget !== false,
|
|
2342
|
-
alwaysRecord: true
|
|
2343
|
-
});
|
|
2344
|
-
if (recorder?.message) _weapp_tailwindcss_logger.logger.info("[workspace] %s %s", displayName, recorder.message);
|
|
2345
|
-
logTailwindcssTarget("cli", patcher, dir);
|
|
2346
|
-
await patcher.patch();
|
|
2347
|
-
if (recorder?.onPatched) await recorder.onPatched();
|
|
2348
|
-
_weapp_tailwindcss_logger.logger.success("[workspace] 已补丁 %s", displayName);
|
|
2349
|
-
return {
|
|
2350
|
-
dir,
|
|
2351
|
-
name: pkgName,
|
|
2352
|
-
status: "patched",
|
|
2353
|
-
message: "已完成 patch。"
|
|
2354
|
-
};
|
|
2355
|
-
} catch (error) {
|
|
2356
|
-
const message = `${error instanceof Error ? error.message : String(error)},${`请在 ${dir} 运行 "weapp-tw patch --cwd ${dir}".`}`;
|
|
2357
|
-
_weapp_tailwindcss_logger.logger.error("[workspace] 补丁失败 %s:%s", displayName, message);
|
|
2358
|
-
return {
|
|
2359
|
-
dir,
|
|
2360
|
-
name: pkgName,
|
|
2361
|
-
status: "failed",
|
|
2362
|
-
message
|
|
2363
|
-
};
|
|
2364
|
-
}
|
|
2365
|
-
}
|
|
2366
|
-
//#endregion
|
|
2367
|
-
//#region src/cli/workspace.ts
|
|
2368
|
-
async function patchWorkspace(options) {
|
|
2369
|
-
const cwd = options.cwd ?? node_process.default.cwd();
|
|
2370
|
-
const workspaceRoot = findWorkspaceRoot(cwd) ?? cwd;
|
|
2371
|
-
const packageDirs = await resolveWorkspacePackageDirs(workspaceRoot);
|
|
2372
|
-
if (packageDirs.length === 0) {
|
|
2373
|
-
_weapp_tailwindcss_logger.logger.warn("未在 %s 检测到 workspace 包,已跳过批量 patch。", workspaceRoot);
|
|
2374
|
-
return;
|
|
2375
|
-
}
|
|
2376
|
-
const results = [];
|
|
2377
|
-
for (const dir of packageDirs) {
|
|
2378
|
-
const pkgJson = tryReadJson(node_path.default.join(dir, "package.json"));
|
|
2379
|
-
results.push(await patchWorkspacePackage(workspaceRoot, dir, pkgJson?.name, options));
|
|
2380
|
-
}
|
|
2381
|
-
summarizeWorkspaceResults(results);
|
|
2382
|
-
}
|
|
2383
|
-
//#endregion
|
|
2384
2431
|
//#region src/cli/mount-options.ts
|
|
2432
|
+
const PATCH_COMMAND_OBSOLETE_NOTICE = "提示:weapp-tailwindcss@5 已由构建运行时接管 Tailwind CSS 处理,weapp-tw patch 已无需执行;请移除 package.json 中的 postinstall 钩子。";
|
|
2433
|
+
function logPatchCommandObsoleteNotice() {
|
|
2434
|
+
_weapp_tailwindcss_logger.logger.warn(PATCH_COMMAND_OBSOLETE_NOTICE);
|
|
2435
|
+
}
|
|
2385
2436
|
function handleCliError(error) {
|
|
2386
2437
|
if (error instanceof Error) {
|
|
2387
2438
|
_weapp_tailwindcss_logger.logger.error(error.message);
|
|
2388
|
-
if (error.stack && node_process.default.env
|
|
2439
|
+
if (error.stack && node_process.default.env["WEAPP_TW_DEBUG"] === "1") _weapp_tailwindcss_logger.logger.error(error.stack);
|
|
2389
2440
|
} else _weapp_tailwindcss_logger.logger.error(String(error));
|
|
2390
2441
|
}
|
|
2391
2442
|
function withCommandErrorHandling(handler) {
|
|
@@ -2399,92 +2450,18 @@ function withCommandErrorHandling(handler) {
|
|
|
2399
2450
|
}
|
|
2400
2451
|
});
|
|
2401
2452
|
}
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2453
|
+
const forwardedCommands = [
|
|
2454
|
+
"extract",
|
|
2455
|
+
"tokens",
|
|
2456
|
+
"init",
|
|
2457
|
+
"migrate",
|
|
2458
|
+
"restore",
|
|
2459
|
+
"validate"
|
|
2460
|
+
];
|
|
2461
|
+
const commandHandlers = Object.fromEntries(forwardedCommands.map((command) => [command, withCommandErrorHandling(async (_ctx, next) => next())]));
|
|
2407
2462
|
const mountOptions = {
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
name: "patch",
|
|
2411
|
-
aliases: ["install"],
|
|
2412
|
-
appendDefaultOptions: false,
|
|
2413
|
-
optionDefs: [
|
|
2414
|
-
{
|
|
2415
|
-
flags: "--cwd <dir>",
|
|
2416
|
-
description: "Working directory",
|
|
2417
|
-
config: { default: resolvePatchDefaultCwd() }
|
|
2418
|
-
},
|
|
2419
|
-
{
|
|
2420
|
-
flags: "--record-target",
|
|
2421
|
-
description: "Write tailwindcss target metadata (node_modules/.cache/weapp-tailwindcss/tailwindcss-target.json). Pass \"--record-target false\" to skip.",
|
|
2422
|
-
config: { default: true }
|
|
2423
|
-
},
|
|
2424
|
-
{
|
|
2425
|
-
flags: "--clear-cache",
|
|
2426
|
-
description: "Clear tailwindcss-patch cache before patch (opt-in)"
|
|
2427
|
-
},
|
|
2428
|
-
{
|
|
2429
|
-
flags: "--workspace",
|
|
2430
|
-
description: "Scan pnpm workspace packages and patch each Tailwind CSS dependency"
|
|
2431
|
-
}
|
|
2432
|
-
]
|
|
2433
|
-
},
|
|
2434
|
-
status: {
|
|
2435
|
-
appendDefaultOptions: false,
|
|
2436
|
-
optionDefs: [{
|
|
2437
|
-
flags: "--cwd <dir>",
|
|
2438
|
-
description: "Working directory",
|
|
2439
|
-
config: { default: resolvePatchDefaultCwd() }
|
|
2440
|
-
}, {
|
|
2441
|
-
flags: "--json",
|
|
2442
|
-
description: "Print a JSON report of patch status"
|
|
2443
|
-
}]
|
|
2444
|
-
}
|
|
2445
|
-
},
|
|
2446
|
-
commandHandlers: {
|
|
2447
|
-
install: withCommandErrorHandling(async (ctx) => {
|
|
2448
|
-
const shouldClearCache = toBoolean(ctx.args.clearCache, false);
|
|
2449
|
-
const shouldRecordTarget = toBoolean(ctx.args.recordTarget, true);
|
|
2450
|
-
if (toBoolean(ctx.args.workspace, false)) {
|
|
2451
|
-
await patchWorkspace({
|
|
2452
|
-
cwd: ctx.cwd,
|
|
2453
|
-
clearCache: shouldClearCache,
|
|
2454
|
-
recordTarget: shouldRecordTarget
|
|
2455
|
-
});
|
|
2456
|
-
return;
|
|
2457
|
-
}
|
|
2458
|
-
const patcher = await createPatcherWithDefaultExtendLengthUnits(ctx);
|
|
2459
|
-
if (shouldClearCache) await clearTailwindcssPatcherCache(patcher, { removeDirectory: true });
|
|
2460
|
-
const recorder = createPatchTargetRecorder(ctx.cwd, patcher, {
|
|
2461
|
-
source: "cli",
|
|
2462
|
-
cwd: ctx.cwd,
|
|
2463
|
-
recordTarget: shouldRecordTarget,
|
|
2464
|
-
alwaysRecord: true
|
|
2465
|
-
});
|
|
2466
|
-
if (recorder?.message) _weapp_tailwindcss_logger.logger.info(recorder.message);
|
|
2467
|
-
logTailwindcssTarget("cli", patcher, ctx.cwd);
|
|
2468
|
-
await patcher.patch();
|
|
2469
|
-
if (recorder?.onPatched) {
|
|
2470
|
-
const recordPath = await recorder.onPatched();
|
|
2471
|
-
if (recordPath) _weapp_tailwindcss_logger.logger.info(`记录 weapp-tw patch 目标 -> ${formatOutputPath(recordPath, ctx.cwd)}`);
|
|
2472
|
-
}
|
|
2473
|
-
_weapp_tailwindcss_logger.logger.success("Tailwind CSS 运行时补丁已完成。");
|
|
2474
|
-
}),
|
|
2475
|
-
extract: withCommandErrorHandling(async (_ctx, next) => next()),
|
|
2476
|
-
tokens: withCommandErrorHandling(async (_ctx, next) => next()),
|
|
2477
|
-
init: withCommandErrorHandling(async (_ctx, next) => next()),
|
|
2478
|
-
status: withCommandErrorHandling(async (ctx) => {
|
|
2479
|
-
const report = await (await createPatcherWithDefaultExtendLengthUnits(ctx)).getPatchStatus();
|
|
2480
|
-
if (ctx.args.json) {
|
|
2481
|
-
_weapp_tailwindcss_logger.logger.log(JSON.stringify(report, null, 2));
|
|
2482
|
-
return report;
|
|
2483
|
-
}
|
|
2484
|
-
logPatchStatusReport(report);
|
|
2485
|
-
return report;
|
|
2486
|
-
})
|
|
2487
|
-
}
|
|
2463
|
+
commands: [...forwardedCommands],
|
|
2464
|
+
commandHandlers
|
|
2488
2465
|
};
|
|
2489
2466
|
//#endregion
|
|
2490
2467
|
//#region src/cli/vscode-entry.ts
|
|
@@ -2592,6 +2569,23 @@ const cli = (0, tailwindcss_patch.createTailwindcssPatchCli)({
|
|
|
2592
2569
|
name: "weapp-tailwindcss",
|
|
2593
2570
|
mountOptions
|
|
2594
2571
|
});
|
|
2572
|
+
cli.command("patch", "Deprecated no-op: v5 runtime handles Tailwind CSS automatically").alias("install").option("--cwd <dir>", "Ignored working directory").option("--clear-cache", "Ignored compatibility option").option("--record-target [enabled]", "Ignored compatibility option").option("--workspace", "Ignored compatibility option").action(commandAction(async (_options) => {
|
|
2573
|
+
logPatchCommandObsoleteNotice();
|
|
2574
|
+
_weapp_tailwindcss_logger.logger.success("已跳过:当前版本不需要手动执行 Tailwind CSS patch。");
|
|
2575
|
+
}));
|
|
2576
|
+
cli.command("status", "Deprecated no-op: patch status is no longer required").option("--cwd <dir>", "Ignored working directory").option("--json", "Print a JSON no-op report").action(commandAction(async (options) => {
|
|
2577
|
+
const payload = {
|
|
2578
|
+
required: false,
|
|
2579
|
+
status: "unnecessary",
|
|
2580
|
+
message: PATCH_COMMAND_OBSOLETE_NOTICE
|
|
2581
|
+
};
|
|
2582
|
+
if (toBoolean(options.json, false)) {
|
|
2583
|
+
_weapp_tailwindcss_logger.logger.log(JSON.stringify(payload, null, 2));
|
|
2584
|
+
return;
|
|
2585
|
+
}
|
|
2586
|
+
logPatchCommandObsoleteNotice();
|
|
2587
|
+
_weapp_tailwindcss_logger.logger.success("无需检查 Tailwind CSS patch 状态。");
|
|
2588
|
+
}));
|
|
2595
2589
|
cli.command("vscode-entry", "Generate a VS Code helper CSS for Tailwind IntelliSense").option("--cwd <dir>", "Working directory").option("--css <file>", "Path to the CSS file that imports weapp-tailwindcss (required)").option("--output <file>", `Helper output path. Defaults to ${DEFAULT_VSCODE_ENTRY_OUTPUT}`).option("--source <pattern>", "Additional @source glob (can be repeated)").option("--force", "Overwrite the helper file when it already exists").action(commandAction(async (options) => {
|
|
2596
2590
|
const resolvedCwd = resolveCliCwd(options.cwd);
|
|
2597
2591
|
const baseDir = resolvedCwd ?? node_process.default.cwd();
|
|
@@ -2613,6 +2607,6 @@ cli.command("doctor", "Check project setup for weapp-tailwindcss").option("--cwd
|
|
|
2613
2607
|
if (hasDoctorFailure(report, toBoolean(options.strict, false))) node_process.default.exitCode = 1;
|
|
2614
2608
|
}));
|
|
2615
2609
|
cli.help();
|
|
2616
|
-
cli.version(node_process.default.env
|
|
2610
|
+
cli.version(node_process.default.env["npm_package_version"] ?? "0.0.0");
|
|
2617
2611
|
cli.parse();
|
|
2618
2612
|
//#endregion
|