weapp-tailwindcss 4.11.1 → 4.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-6YV5WADN.js → chunk-3QHYEMEW.js} +28 -28
- package/dist/{chunk-4O2J5ZM6.mjs → chunk-AB2RGZQO.mjs} +90 -44
- package/dist/{chunk-Q2HTQFI4.js → chunk-AV3XB6EQ.js} +3 -3
- package/dist/{chunk-ZUV5AZRB.mjs → chunk-JIERVBTX.mjs} +1 -1
- package/dist/{chunk-Y6JUVWRU.js → chunk-SUKOZ6OG.js} +6 -6
- package/dist/{chunk-SSASUP5F.js → chunk-TT5WHNGS.js} +58 -12
- package/dist/{chunk-SV55AOBL.mjs → chunk-VGPAKLMZ.mjs} +2 -2
- package/dist/{chunk-KX2JVTVM.mjs → chunk-W3DXDWYC.mjs} +1 -1
- package/dist/{chunk-VOCOKTZW.js → chunk-WJIRXC26.js} +25 -25
- package/dist/{chunk-WSMWD4MC.mjs → chunk-ZZ36BKM5.mjs} +1 -1
- package/dist/cli.js +114 -81
- package/dist/cli.mjs +114 -81
- package/dist/core.js +6 -6
- package/dist/core.mjs +1 -1
- package/dist/gulp.js +3 -3
- package/dist/gulp.mjs +2 -2
- package/dist/index.js +6 -6
- package/dist/index.mjs +5 -5
- package/dist/vite.js +3 -3
- package/dist/vite.mjs +2 -2
- package/dist/webpack.js +4 -4
- package/dist/webpack.mjs +3 -3
- package/dist/webpack4.js +24 -24
- package/dist/webpack4.mjs +2 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -23,17 +23,17 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
23
23
|
));
|
|
24
24
|
|
|
25
25
|
// src/cli.ts
|
|
26
|
-
var
|
|
26
|
+
var import_node_process18 = __toESM(require("process"));
|
|
27
27
|
var import_semver = __toESM(require("semver"));
|
|
28
28
|
var import_tailwindcss_patch3 = require("tailwindcss-patch");
|
|
29
29
|
|
|
30
30
|
// src/cli/context.ts
|
|
31
31
|
var import_node_path12 = __toESM(require("path"));
|
|
32
|
-
var
|
|
32
|
+
var import_node_process12 = __toESM(require("process"));
|
|
33
33
|
|
|
34
34
|
// src/context/index.ts
|
|
35
35
|
var import_promises2 = require("fs/promises");
|
|
36
|
-
var
|
|
36
|
+
var import_logger11 = require("@weapp-tailwindcss/logger");
|
|
37
37
|
|
|
38
38
|
// src/cache/index.ts
|
|
39
39
|
var import_lru_cache = require("lru-cache");
|
|
@@ -77,9 +77,38 @@ var import_node_fs = require("fs");
|
|
|
77
77
|
// src/tailwindcss/runtime.ts
|
|
78
78
|
var debug = createDebug("[tailwindcss:runtime] ");
|
|
79
79
|
|
|
80
|
+
// src/tailwindcss/runtime-logs.ts
|
|
81
|
+
var import_node_process3 = __toESM(require("process"));
|
|
82
|
+
var import_logger = require("@weapp-tailwindcss/logger");
|
|
83
|
+
var runtimeLogDedupeHolder = globalThis;
|
|
84
|
+
var runtimeLogDedupe = runtimeLogDedupeHolder.__WEAPP_TW_RUNTIME_LOG_DEDUPE__ ?? (runtimeLogDedupeHolder.__WEAPP_TW_RUNTIME_LOG_DEDUPE__ = /* @__PURE__ */ new Set());
|
|
85
|
+
function createRuntimeLogKey(category, baseDir, rootPath, version) {
|
|
86
|
+
return JSON.stringify([
|
|
87
|
+
category,
|
|
88
|
+
baseDir ?? import_node_process3.default.cwd(),
|
|
89
|
+
rootPath ?? "",
|
|
90
|
+
version ?? ""
|
|
91
|
+
]);
|
|
92
|
+
}
|
|
93
|
+
function markRuntimeLog(category, baseDir, rootPath, version) {
|
|
94
|
+
const key = createRuntimeLogKey(category, baseDir, rootPath, version);
|
|
95
|
+
if (runtimeLogDedupe.has(key)) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
runtimeLogDedupe.add(key);
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
function logRuntimeTailwindcssTarget(baseDir, rootPath, version) {
|
|
102
|
+
if (!markRuntimeLog("target", baseDir, rootPath, version)) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const versionText = version ? ` (v${version})` : "";
|
|
106
|
+
import_logger.logger.info("%s \u4F7F\u7528 Tailwind CSS%s", "Weapp-tailwindcss", versionText);
|
|
107
|
+
}
|
|
108
|
+
|
|
80
109
|
// src/tailwindcss/targets.ts
|
|
81
|
-
var
|
|
82
|
-
var
|
|
110
|
+
var import_node_process6 = __toESM(require("process"));
|
|
111
|
+
var import_logger3 = require("@weapp-tailwindcss/logger");
|
|
83
112
|
|
|
84
113
|
// src/tailwindcss/targets/paths.ts
|
|
85
114
|
var import_node_fs3 = require("fs");
|
|
@@ -173,13 +202,13 @@ function getRecordFileCandidates(baseDir) {
|
|
|
173
202
|
var import_node_fs4 = require("fs");
|
|
174
203
|
var import_promises = require("fs/promises");
|
|
175
204
|
var import_node_path4 = __toESM(require("path"));
|
|
176
|
-
var
|
|
177
|
-
var
|
|
205
|
+
var import_node_process4 = __toESM(require("process"));
|
|
206
|
+
var import_logger2 = require("@weapp-tailwindcss/logger");
|
|
178
207
|
|
|
179
208
|
// package.json
|
|
180
209
|
var package_default = {
|
|
181
210
|
name: "weapp-tailwindcss",
|
|
182
|
-
version: "4.11.
|
|
211
|
+
version: "4.11.2",
|
|
183
212
|
description: "\u628A tailwindcss \u539F\u5B50\u5316\u6837\u5F0F\u601D\u60F3\uFF0C\u5E26\u7ED9\u5C0F\u7A0B\u5E8F\u5F00\u53D1\u8005\u4EEC! bring tailwindcss to miniprogram developers!",
|
|
184
213
|
author: "ice breaker <1324318532@qq.com>",
|
|
185
214
|
license: "MIT",
|
|
@@ -411,9 +440,9 @@ function warnInvalidPatchTargetRecord(baseDir, recordPath, reason) {
|
|
|
411
440
|
}
|
|
412
441
|
loggedInvalidPatchRecords.add(normalizedPath);
|
|
413
442
|
const fileDisplay = formatRelativeToBase(normalizedPath, baseDir);
|
|
414
|
-
const baseDisplay = formatRelativeToBase(import_node_path4.default.normalize(baseDir),
|
|
443
|
+
const baseDisplay = formatRelativeToBase(import_node_path4.default.normalize(baseDir), import_node_process4.default.cwd());
|
|
415
444
|
const reasonMessage = reason ? `\uFF1A${reason}` : "";
|
|
416
|
-
|
|
445
|
+
import_logger2.logger.warn(
|
|
417
446
|
`\u68C0\u6D4B\u5230\u635F\u574F\u7684 Tailwind CSS \u76EE\u6807\u8BB0\u5F55 ${fileDisplay}${reasonMessage}\u3002\u8BF7\u5728 ${baseDisplay} \u91CD\u65B0\u6267\u884C "weapp-tw patch --record-target" \u6216\u5220\u9664\u8BE5\u6587\u4EF6\u540E\u518D\u8FD0\u884C\u3002`
|
|
418
447
|
);
|
|
419
448
|
}
|
|
@@ -470,23 +499,23 @@ async function saveCliPatchTargetRecord(baseDir, patcher, options) {
|
|
|
470
499
|
`, "utf8");
|
|
471
500
|
return recordPath;
|
|
472
501
|
} catch (error) {
|
|
473
|
-
const baseDisplay = formatRelativeToBase(normalizedBase,
|
|
474
|
-
|
|
502
|
+
const baseDisplay = formatRelativeToBase(normalizedBase, import_node_process4.default.cwd());
|
|
503
|
+
import_logger2.logger.warn(
|
|
475
504
|
'\u81EA\u52A8\u66F4\u65B0 Tailwind CSS \u8865\u4E01\u8BB0\u5F55\u5931\u8D25\uFF0C\u8BF7\u5728 %s \u8FD0\u884C "weapp-tw patch --cwd %s"\u3002',
|
|
476
505
|
baseDisplay,
|
|
477
506
|
normalizedBase
|
|
478
507
|
);
|
|
479
|
-
|
|
508
|
+
import_logger2.logger.debug("failed to persist patch target record %s: %O", recordPath, error);
|
|
480
509
|
return void 0;
|
|
481
510
|
}
|
|
482
511
|
}
|
|
483
512
|
|
|
484
513
|
// src/tailwindcss/targets/recorder.ts
|
|
485
514
|
var import_node_path5 = __toESM(require("path"));
|
|
486
|
-
var
|
|
515
|
+
var import_node_process5 = __toESM(require("process"));
|
|
487
516
|
function findPatchTargetRecord(baseDir) {
|
|
488
517
|
const visited = /* @__PURE__ */ new Set();
|
|
489
|
-
const fallback = baseDir ??
|
|
518
|
+
const fallback = baseDir ?? import_node_process5.default.cwd();
|
|
490
519
|
let current = import_node_path5.default.resolve(fallback);
|
|
491
520
|
while (!visited.has(current)) {
|
|
492
521
|
const record = readPatchTargetRecord(current);
|
|
@@ -564,30 +593,34 @@ function createPatchTargetRecorder(baseDir, patcher, options) {
|
|
|
564
593
|
// src/tailwindcss/targets.ts
|
|
565
594
|
function logTailwindcssTarget(kind, patcher, baseDir) {
|
|
566
595
|
const packageInfo = patcher?.packageInfo;
|
|
567
|
-
const label = kind === "cli" ? "weapp-tw patch" : "tailwindcss
|
|
596
|
+
const label = kind === "cli" ? "weapp-tw patch" : "Weapp-tailwindcss";
|
|
568
597
|
if (!packageInfo?.rootPath) {
|
|
569
|
-
|
|
598
|
+
import_logger3.logger.warn(
|
|
570
599
|
"%s \u672A\u627E\u5230 Tailwind CSS \u4F9D\u8D56\uFF0C\u8BF7\u68C0\u67E5\u5728 %s \u662F\u5426\u5DF2\u5B89\u88C5 tailwindcss",
|
|
571
600
|
label,
|
|
572
|
-
baseDir ??
|
|
601
|
+
baseDir ?? import_node_process6.default.cwd()
|
|
573
602
|
);
|
|
574
603
|
return;
|
|
575
604
|
}
|
|
576
605
|
const displayPath = formatRelativeToBase(packageInfo.rootPath, baseDir);
|
|
577
606
|
const version = packageInfo.version ? ` (v${packageInfo.version})` : "";
|
|
578
|
-
|
|
607
|
+
if (kind === "runtime") {
|
|
608
|
+
logRuntimeTailwindcssTarget(baseDir, packageInfo.rootPath, packageInfo.version);
|
|
609
|
+
return;
|
|
610
|
+
}
|
|
611
|
+
import_logger3.logger.info("%s \u7ED1\u5B9A Tailwind CSS -> %s%s", label, displayPath, version);
|
|
579
612
|
}
|
|
580
613
|
|
|
581
614
|
// src/tailwindcss/v4/config.ts
|
|
582
|
-
var
|
|
615
|
+
var import_logger4 = require("@weapp-tailwindcss/logger");
|
|
583
616
|
|
|
584
617
|
// src/tailwindcss/v4/patcher.ts
|
|
585
|
-
var
|
|
618
|
+
var import_logger6 = require("@weapp-tailwindcss/logger");
|
|
586
619
|
|
|
587
620
|
// src/tailwindcss/patcher.ts
|
|
588
621
|
var import_node_path7 = __toESM(require("path"));
|
|
589
|
-
var
|
|
590
|
-
var
|
|
622
|
+
var import_node_process8 = __toESM(require("process"));
|
|
623
|
+
var import_logger5 = require("@weapp-tailwindcss/logger");
|
|
591
624
|
var import_shared2 = require("@weapp-tailwindcss/shared");
|
|
592
625
|
var import_tailwindcss_patch = require("tailwindcss-patch");
|
|
593
626
|
|
|
@@ -595,7 +628,7 @@ var import_tailwindcss_patch = require("tailwindcss-patch");
|
|
|
595
628
|
var import_node_fs5 = require("fs");
|
|
596
629
|
var import_node_module = require("module");
|
|
597
630
|
var import_node_path6 = __toESM(require("path"));
|
|
598
|
-
var
|
|
631
|
+
var import_node_process7 = __toESM(require("process"));
|
|
599
632
|
var import_node_url = require("url");
|
|
600
633
|
|
|
601
634
|
// src/tailwindcss/v4/css-entries.ts
|
|
@@ -604,8 +637,8 @@ var import_node_path8 = __toESM(require("path"));
|
|
|
604
637
|
// src/context/compiler-context-cache.ts
|
|
605
638
|
var import_node_buffer = require("buffer");
|
|
606
639
|
var import_node_path9 = __toESM(require("path"));
|
|
607
|
-
var
|
|
608
|
-
var
|
|
640
|
+
var import_node_process9 = __toESM(require("process"));
|
|
641
|
+
var import_logger7 = require("@weapp-tailwindcss/logger");
|
|
609
642
|
var globalCacheHolder = globalThis;
|
|
610
643
|
var compilerContextCache = globalCacheHolder.__WEAPP_TW_COMPILER_CONTEXT_CACHE__ ?? (globalCacheHolder.__WEAPP_TW_COMPILER_CONTEXT_CACHE__ = /* @__PURE__ */ new Map());
|
|
611
644
|
|
|
@@ -812,22 +845,22 @@ var Tokenizer = class {
|
|
|
812
845
|
var sharedTokenizer = new Tokenizer();
|
|
813
846
|
|
|
814
847
|
// src/context/logger.ts
|
|
815
|
-
var
|
|
848
|
+
var import_logger8 = require("@weapp-tailwindcss/logger");
|
|
816
849
|
|
|
817
850
|
// src/context/tailwindcss.ts
|
|
818
|
-
var
|
|
851
|
+
var import_logger10 = require("@weapp-tailwindcss/logger");
|
|
819
852
|
|
|
820
853
|
// src/context/tailwindcss/basedir.ts
|
|
821
854
|
var import_node_module2 = require("module");
|
|
822
855
|
var import_node_path10 = __toESM(require("path"));
|
|
823
|
-
var
|
|
856
|
+
var import_node_process10 = __toESM(require("process"));
|
|
824
857
|
var import_node_url2 = require("url");
|
|
825
|
-
var
|
|
858
|
+
var import_logger9 = require("@weapp-tailwindcss/logger");
|
|
826
859
|
|
|
827
860
|
// src/context/tailwindcss/rax.ts
|
|
828
861
|
var import_node_fs6 = require("fs");
|
|
829
862
|
var import_node_path11 = __toESM(require("path"));
|
|
830
|
-
var
|
|
863
|
+
var import_node_process11 = __toESM(require("process"));
|
|
831
864
|
|
|
832
865
|
// src/context/index.ts
|
|
833
866
|
async function clearTailwindcssPatcherCache(patcher, options) {
|
|
@@ -842,7 +875,7 @@ async function clearTailwindcssPatcherCache(patcher, options) {
|
|
|
842
875
|
try {
|
|
843
876
|
await patcher.clearCache({ scope: "all" });
|
|
844
877
|
} catch (error) {
|
|
845
|
-
|
|
878
|
+
import_logger11.logger.debug("failed to clear tailwindcss patcher cache via clearCache(): %O", error);
|
|
846
879
|
}
|
|
847
880
|
}
|
|
848
881
|
if (!options?.removeDirectory) {
|
|
@@ -871,14 +904,14 @@ async function clearTailwindcssPatcherCache(patcher, options) {
|
|
|
871
904
|
if (err?.code === "ENOENT") {
|
|
872
905
|
continue;
|
|
873
906
|
}
|
|
874
|
-
|
|
907
|
+
import_logger11.logger.debug("failed to clear tailwindcss patcher cache: %s %O", cachePath, err);
|
|
875
908
|
}
|
|
876
909
|
}
|
|
877
910
|
}
|
|
878
911
|
|
|
879
912
|
// src/cli/context.ts
|
|
880
913
|
function formatOutputPath(target, baseDir) {
|
|
881
|
-
const root = baseDir ??
|
|
914
|
+
const root = baseDir ?? import_node_process12.default.cwd();
|
|
882
915
|
const relative = import_node_path12.default.relative(root, target);
|
|
883
916
|
if (!relative) {
|
|
884
917
|
return ".";
|
|
@@ -891,10 +924,10 @@ function formatOutputPath(target, baseDir) {
|
|
|
891
924
|
|
|
892
925
|
// src/cli/helpers.ts
|
|
893
926
|
var import_promises3 = require("fs/promises");
|
|
894
|
-
var
|
|
927
|
+
var import_node_process15 = __toESM(require("process"));
|
|
895
928
|
|
|
896
929
|
// src/logger/index.ts
|
|
897
|
-
var
|
|
930
|
+
var import_logger13 = require("@weapp-tailwindcss/logger");
|
|
898
931
|
|
|
899
932
|
// src/cli/helpers/options/parse.ts
|
|
900
933
|
function readStringOption(flag, value) {
|
|
@@ -950,18 +983,18 @@ function toBoolean(value, fallback) {
|
|
|
950
983
|
|
|
951
984
|
// src/cli/helpers/options/resolve.ts
|
|
952
985
|
var import_node_path13 = __toESM(require("path"));
|
|
953
|
-
var
|
|
986
|
+
var import_node_process13 = __toESM(require("process"));
|
|
954
987
|
function resolveCliCwd(value) {
|
|
955
988
|
const raw = readStringOption("cwd", value);
|
|
956
989
|
if (!raw) {
|
|
957
990
|
return void 0;
|
|
958
991
|
}
|
|
959
|
-
return import_node_path13.default.isAbsolute(raw) ? import_node_path13.default.normalize(raw) : import_node_path13.default.resolve(
|
|
992
|
+
return import_node_path13.default.isAbsolute(raw) ? import_node_path13.default.normalize(raw) : import_node_path13.default.resolve(import_node_process13.default.cwd(), raw);
|
|
960
993
|
}
|
|
961
994
|
|
|
962
995
|
// src/cli/helpers/patch-cwd.ts
|
|
963
996
|
var import_node_path14 = __toESM(require("path"));
|
|
964
|
-
var
|
|
997
|
+
var import_node_process14 = __toESM(require("process"));
|
|
965
998
|
|
|
966
999
|
// src/tailwindcss/index.ts
|
|
967
1000
|
var import_local_pkg = require("local-pkg");
|
|
@@ -988,15 +1021,15 @@ function detectTailwindWorkspace(paths) {
|
|
|
988
1021
|
}
|
|
989
1022
|
return void 0;
|
|
990
1023
|
}
|
|
991
|
-
function resolvePatchDefaultCwd(currentCwd =
|
|
1024
|
+
function resolvePatchDefaultCwd(currentCwd = import_node_process14.default.cwd()) {
|
|
992
1025
|
const baseDir = import_node_path14.default.normalize(currentCwd);
|
|
993
|
-
const explicitCwd = normalizeCandidatePath(baseDir,
|
|
1026
|
+
const explicitCwd = normalizeCandidatePath(baseDir, import_node_process14.default.env.WEAPP_TW_PATCH_CWD);
|
|
994
1027
|
if (explicitCwd) {
|
|
995
1028
|
return explicitCwd;
|
|
996
1029
|
}
|
|
997
1030
|
const workspaceRoot = findWorkspaceRoot(baseDir);
|
|
998
|
-
const initCwd = normalizeCandidatePath(baseDir,
|
|
999
|
-
const localPrefix = normalizeCandidatePath(baseDir,
|
|
1031
|
+
const initCwd = normalizeCandidatePath(baseDir, import_node_process14.default.env.INIT_CWD);
|
|
1032
|
+
const localPrefix = normalizeCandidatePath(baseDir, import_node_process14.default.env.npm_config_local_prefix);
|
|
1000
1033
|
const candidates = [
|
|
1001
1034
|
baseDir,
|
|
1002
1035
|
workspaceRoot,
|
|
@@ -1016,12 +1049,12 @@ async function ensureDir(dir) {
|
|
|
1016
1049
|
}
|
|
1017
1050
|
function handleCliError(error) {
|
|
1018
1051
|
if (error instanceof Error) {
|
|
1019
|
-
|
|
1020
|
-
if (error.stack &&
|
|
1021
|
-
|
|
1052
|
+
import_logger13.logger.error(error.message);
|
|
1053
|
+
if (error.stack && import_node_process15.default.env.WEAPP_TW_DEBUG === "1") {
|
|
1054
|
+
import_logger13.logger.error(error.stack);
|
|
1022
1055
|
}
|
|
1023
1056
|
} else {
|
|
1024
|
-
|
|
1057
|
+
import_logger13.logger.error(String(error));
|
|
1025
1058
|
}
|
|
1026
1059
|
}
|
|
1027
1060
|
function commandAction(handler) {
|
|
@@ -1030,13 +1063,13 @@ function commandAction(handler) {
|
|
|
1030
1063
|
await handler(...args);
|
|
1031
1064
|
} catch (error) {
|
|
1032
1065
|
handleCliError(error);
|
|
1033
|
-
|
|
1066
|
+
import_node_process15.default.exitCode = 1;
|
|
1034
1067
|
}
|
|
1035
1068
|
};
|
|
1036
1069
|
}
|
|
1037
1070
|
|
|
1038
1071
|
// src/cli/mount-options.ts
|
|
1039
|
-
var
|
|
1072
|
+
var import_node_process17 = __toESM(require("process"));
|
|
1040
1073
|
|
|
1041
1074
|
// src/cli/mount-options/patch-status.ts
|
|
1042
1075
|
function formatStatusFilesHint(files) {
|
|
@@ -1052,27 +1085,27 @@ function logPatchStatusReport(report) {
|
|
|
1052
1085
|
(entry) => entry.status === "skipped" || entry.status === "unsupported"
|
|
1053
1086
|
);
|
|
1054
1087
|
const packageLabel = `${report.package.name ?? "tailwindcss"}@${report.package.version ?? "unknown"}`;
|
|
1055
|
-
|
|
1088
|
+
import_logger13.logger.info(`Patch status for ${packageLabel} (v${report.majorVersion})`);
|
|
1056
1089
|
if (applied.length) {
|
|
1057
|
-
|
|
1090
|
+
import_logger13.logger.success("Applied:");
|
|
1058
1091
|
applied.forEach((entry) => {
|
|
1059
|
-
|
|
1092
|
+
import_logger13.logger.success(` - ${entry.name}${formatStatusFilesHint(entry.files)}`);
|
|
1060
1093
|
});
|
|
1061
1094
|
}
|
|
1062
1095
|
if (pending.length) {
|
|
1063
|
-
|
|
1096
|
+
import_logger13.logger.warn("Needs attention:");
|
|
1064
1097
|
pending.forEach((entry) => {
|
|
1065
1098
|
const details = entry.reason ? ` - ${entry.reason}` : "";
|
|
1066
|
-
|
|
1099
|
+
import_logger13.logger.warn(` - ${entry.name}${formatStatusFilesHint(entry.files)}${details}`);
|
|
1067
1100
|
});
|
|
1068
1101
|
} else {
|
|
1069
|
-
|
|
1102
|
+
import_logger13.logger.success("All applicable patches are applied.");
|
|
1070
1103
|
}
|
|
1071
1104
|
if (skipped.length) {
|
|
1072
|
-
|
|
1105
|
+
import_logger13.logger.info("Skipped:");
|
|
1073
1106
|
skipped.forEach((entry) => {
|
|
1074
1107
|
const details = entry.reason ? ` - ${entry.reason}` : "";
|
|
1075
|
-
|
|
1108
|
+
import_logger13.logger.info(` - ${entry.name}${details}`);
|
|
1076
1109
|
});
|
|
1077
1110
|
}
|
|
1078
1111
|
}
|
|
@@ -1112,7 +1145,7 @@ function buildExtendLengthUnitsOverride(options) {
|
|
|
1112
1145
|
|
|
1113
1146
|
// src/cli/workspace.ts
|
|
1114
1147
|
var import_node_path19 = __toESM(require("path"));
|
|
1115
|
-
var
|
|
1148
|
+
var import_node_process16 = __toESM(require("process"));
|
|
1116
1149
|
|
|
1117
1150
|
// src/cli/workspace/package-dirs.ts
|
|
1118
1151
|
var import_node_fs10 = require("fs");
|
|
@@ -1239,7 +1272,7 @@ function summarizeWorkspaceResults(results) {
|
|
|
1239
1272
|
const patched = results.filter((result) => result.status === "patched").length;
|
|
1240
1273
|
const skipped = results.filter((result) => result.status === "skipped").length;
|
|
1241
1274
|
const failed = results.filter((result) => result.status === "failed").length;
|
|
1242
|
-
|
|
1275
|
+
import_logger13.logger.info("[workspace] \u6C47\u603B\uFF1A\u5DF2\u8865\u4E01 %d\uFF0C\u8DF3\u8FC7 %d\uFF0C\u5931\u8D25 %d", patched, skipped, failed);
|
|
1243
1276
|
}
|
|
1244
1277
|
|
|
1245
1278
|
// src/cli/workspace/patch-package.ts
|
|
@@ -1255,7 +1288,7 @@ async function patchWorkspacePackage(workspaceRoot, dir, pkgName, options) {
|
|
|
1255
1288
|
const displayName = formatDisplayName(workspaceRoot, dir, pkgName);
|
|
1256
1289
|
const tailwindInfo = getTailwindcssPackageInfo({ paths: [dir] });
|
|
1257
1290
|
if (!tailwindInfo?.rootPath) {
|
|
1258
|
-
|
|
1291
|
+
import_logger13.logger.info("[workspace] \u8DF3\u8FC7 %s\uFF08tailwindcss \u672A\u5B89\u88C5\uFF09\u3002", displayName);
|
|
1259
1292
|
return {
|
|
1260
1293
|
dir,
|
|
1261
1294
|
name: pkgName,
|
|
@@ -1275,14 +1308,14 @@ async function patchWorkspacePackage(workspaceRoot, dir, pkgName, options) {
|
|
|
1275
1308
|
alwaysRecord: true
|
|
1276
1309
|
});
|
|
1277
1310
|
if (recorder?.message) {
|
|
1278
|
-
|
|
1311
|
+
import_logger13.logger.info("[workspace] %s %s", displayName, recorder.message);
|
|
1279
1312
|
}
|
|
1280
1313
|
logTailwindcssTarget("cli", patcher, dir);
|
|
1281
1314
|
await patcher.patch();
|
|
1282
1315
|
if (recorder?.onPatched) {
|
|
1283
1316
|
await recorder.onPatched();
|
|
1284
1317
|
}
|
|
1285
|
-
|
|
1318
|
+
import_logger13.logger.success("[workspace] \u5DF2\u8865\u4E01 %s", displayName);
|
|
1286
1319
|
return {
|
|
1287
1320
|
dir,
|
|
1288
1321
|
name: pkgName,
|
|
@@ -1293,7 +1326,7 @@ async function patchWorkspacePackage(workspaceRoot, dir, pkgName, options) {
|
|
|
1293
1326
|
const reason = error instanceof Error ? error.message : String(error);
|
|
1294
1327
|
const suggestion = `\u8BF7\u5728 ${dir} \u8FD0\u884C "weapp-tw patch --cwd ${dir}".`;
|
|
1295
1328
|
const message = `${reason}\uFF0C${suggestion}`;
|
|
1296
|
-
|
|
1329
|
+
import_logger13.logger.error("[workspace] \u8865\u4E01\u5931\u8D25 %s\uFF1A%s", displayName, message);
|
|
1297
1330
|
return {
|
|
1298
1331
|
dir,
|
|
1299
1332
|
name: pkgName,
|
|
@@ -1305,11 +1338,11 @@ async function patchWorkspacePackage(workspaceRoot, dir, pkgName, options) {
|
|
|
1305
1338
|
|
|
1306
1339
|
// src/cli/workspace.ts
|
|
1307
1340
|
async function patchWorkspace(options) {
|
|
1308
|
-
const cwd = options.cwd ??
|
|
1341
|
+
const cwd = options.cwd ?? import_node_process16.default.cwd();
|
|
1309
1342
|
const workspaceRoot = findWorkspaceRoot(cwd) ?? cwd;
|
|
1310
1343
|
const packageDirs = await resolveWorkspacePackageDirs(workspaceRoot);
|
|
1311
1344
|
if (packageDirs.length === 0) {
|
|
1312
|
-
|
|
1345
|
+
import_logger13.logger.warn("\u672A\u5728 %s \u68C0\u6D4B\u5230 workspace \u5305\uFF0C\u5DF2\u8DF3\u8FC7\u6279\u91CF patch\u3002", workspaceRoot);
|
|
1313
1346
|
return;
|
|
1314
1347
|
}
|
|
1315
1348
|
const results = [];
|
|
@@ -1324,12 +1357,12 @@ async function patchWorkspace(options) {
|
|
|
1324
1357
|
// src/cli/mount-options.ts
|
|
1325
1358
|
function handleCliError2(error) {
|
|
1326
1359
|
if (error instanceof Error) {
|
|
1327
|
-
|
|
1328
|
-
if (error.stack &&
|
|
1329
|
-
|
|
1360
|
+
import_logger13.logger.error(error.message);
|
|
1361
|
+
if (error.stack && import_node_process17.default.env.WEAPP_TW_DEBUG === "1") {
|
|
1362
|
+
import_logger13.logger.error(error.stack);
|
|
1330
1363
|
}
|
|
1331
1364
|
} else {
|
|
1332
|
-
|
|
1365
|
+
import_logger13.logger.error(String(error));
|
|
1333
1366
|
}
|
|
1334
1367
|
}
|
|
1335
1368
|
function withCommandErrorHandling(handler) {
|
|
@@ -1338,7 +1371,7 @@ function withCommandErrorHandling(handler) {
|
|
|
1338
1371
|
return await handler(ctx, next);
|
|
1339
1372
|
} catch (error) {
|
|
1340
1373
|
handleCliError2(error);
|
|
1341
|
-
|
|
1374
|
+
import_node_process17.default.exitCode = 1;
|
|
1342
1375
|
return void 0;
|
|
1343
1376
|
}
|
|
1344
1377
|
});
|
|
@@ -1417,17 +1450,17 @@ var mountOptions = {
|
|
|
1417
1450
|
alwaysRecord: true
|
|
1418
1451
|
});
|
|
1419
1452
|
if (recorder?.message) {
|
|
1420
|
-
|
|
1453
|
+
import_logger13.logger.info(recorder.message);
|
|
1421
1454
|
}
|
|
1422
1455
|
logTailwindcssTarget("cli", patcher, ctx.cwd);
|
|
1423
1456
|
await patcher.patch();
|
|
1424
1457
|
if (recorder?.onPatched) {
|
|
1425
1458
|
const recordPath = await recorder.onPatched();
|
|
1426
1459
|
if (recordPath) {
|
|
1427
|
-
|
|
1460
|
+
import_logger13.logger.info(`\u8BB0\u5F55 weapp-tw patch \u76EE\u6807 -> ${formatOutputPath(recordPath, ctx.cwd)}`);
|
|
1428
1461
|
}
|
|
1429
1462
|
}
|
|
1430
|
-
|
|
1463
|
+
import_logger13.logger.success("Tailwind CSS \u8FD0\u884C\u65F6\u8865\u4E01\u5DF2\u5B8C\u6210\u3002");
|
|
1431
1464
|
}),
|
|
1432
1465
|
extract: withCommandErrorHandling(async (_ctx, next) => next()),
|
|
1433
1466
|
tokens: withCommandErrorHandling(async (_ctx, next) => next()),
|
|
@@ -1436,7 +1469,7 @@ var mountOptions = {
|
|
|
1436
1469
|
const patcher = await createPatcherWithDefaultExtendLengthUnits(ctx);
|
|
1437
1470
|
const report = await patcher.getPatchStatus();
|
|
1438
1471
|
if (ctx.args.json) {
|
|
1439
|
-
|
|
1472
|
+
import_logger13.logger.log(JSON.stringify(report, null, 2));
|
|
1440
1473
|
return report;
|
|
1441
1474
|
}
|
|
1442
1475
|
logPatchStatusReport(report);
|
|
@@ -1567,10 +1600,10 @@ async function generateVscodeIntellisenseEntry(options) {
|
|
|
1567
1600
|
}
|
|
1568
1601
|
|
|
1569
1602
|
// src/cli.ts
|
|
1570
|
-
|
|
1571
|
-
if (import_semver.default.lt(
|
|
1572
|
-
|
|
1573
|
-
`You are using Node.js ${
|
|
1603
|
+
import_node_process18.default.title = "node (weapp-tailwindcss)";
|
|
1604
|
+
if (import_semver.default.lt(import_node_process18.default.versions.node, WEAPP_TW_REQUIRED_NODE_VERSION)) {
|
|
1605
|
+
import_logger13.logger.warn(
|
|
1606
|
+
`You are using Node.js ${import_node_process18.default.versions.node}. For weapp-tailwindcss, Node.js version >= v${WEAPP_TW_REQUIRED_NODE_VERSION} is required.`
|
|
1574
1607
|
);
|
|
1575
1608
|
}
|
|
1576
1609
|
var cli = (0, import_tailwindcss_patch3.createTailwindcssPatchCli)({
|
|
@@ -1580,7 +1613,7 @@ var cli = (0, import_tailwindcss_patch3.createTailwindcssPatchCli)({
|
|
|
1580
1613
|
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(
|
|
1581
1614
|
commandAction(async (options) => {
|
|
1582
1615
|
const resolvedCwd = resolveCliCwd(options.cwd);
|
|
1583
|
-
const baseDir = resolvedCwd ??
|
|
1616
|
+
const baseDir = resolvedCwd ?? import_node_process18.default.cwd();
|
|
1584
1617
|
const cssEntry = readStringOption("css", options.css);
|
|
1585
1618
|
if (!cssEntry) {
|
|
1586
1619
|
throw new Error('Option "--css" is required.');
|
|
@@ -1595,11 +1628,11 @@ cli.command("vscode-entry", "Generate a VS Code helper CSS for Tailwind IntelliS
|
|
|
1595
1628
|
sources,
|
|
1596
1629
|
force
|
|
1597
1630
|
});
|
|
1598
|
-
|
|
1631
|
+
import_logger13.logger.success(
|
|
1599
1632
|
`VS Code helper generated -> ${formatOutputPath(result.outputPath, resolvedCwd)}`
|
|
1600
1633
|
);
|
|
1601
1634
|
})
|
|
1602
1635
|
);
|
|
1603
1636
|
cli.help();
|
|
1604
|
-
cli.version(
|
|
1637
|
+
cli.version(import_node_process18.default.env.npm_package_version ?? "0.0.0");
|
|
1605
1638
|
cli.parse();
|