weapp-tailwindcss 4.11.1 → 4.12.0-next.0
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 +38 -0
- package/dist/{chunk-VOCOKTZW.js → chunk-5ONE75V7.js} +117 -119
- package/dist/{chunk-OMARW5NC.mjs → chunk-AYJ4HLWZ.mjs} +4 -2
- package/dist/{chunk-SV55AOBL.mjs → chunk-F5XJWJYO.mjs} +12 -7
- package/dist/{chunk-Y6JUVWRU.js → chunk-FMK6SFQQ.js} +10 -6
- package/dist/{chunk-SSASUP5F.js → chunk-GC7WXUOW.js} +187 -82
- package/dist/{chunk-KX2JVTVM.mjs → chunk-GD4SQMVF.mjs} +49 -51
- package/dist/{chunk-7LKMJZD2.js → chunk-GMKSBLNY.js} +2 -2
- package/dist/{chunk-EFBQ4SQR.mjs → chunk-HL3US2OT.mjs} +1 -1
- package/dist/{chunk-6YV5WADN.js → chunk-LVSUBDJC.js} +45 -40
- package/dist/{chunk-QK6VNNNL.js → chunk-NIS74SI6.js} +8 -6
- package/dist/{chunk-CRDOWYG4.js → chunk-ONLKZIRQ.js} +1 -1
- package/dist/{chunk-4O2J5ZM6.mjs → chunk-QNRJCEZN.mjs} +195 -90
- package/dist/{chunk-WSMWD4MC.mjs → chunk-UUJWDME4.mjs} +6 -2
- package/dist/{chunk-Q2HTQFI4.js → chunk-WSS26HZS.js} +5 -5
- package/dist/{chunk-ZUV5AZRB.mjs → chunk-ZR3KN3FG.mjs} +1 -1
- package/dist/cli.js +121 -81
- package/dist/cli.mjs +121 -81
- package/dist/core.d.mts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +14 -9
- package/dist/core.mjs +10 -5
- package/dist/css-macro/postcss.js +1 -1
- package/dist/css-macro/postcss.mjs +1 -1
- package/dist/css-macro.js +1 -1
- package/dist/css-macro.mjs +1 -1
- package/dist/defaults.d.mts +1 -1
- package/dist/defaults.d.ts +1 -1
- package/dist/defaults.js +1 -1
- package/dist/defaults.mjs +1 -1
- package/dist/gulp.d.mts +1 -1
- package/dist/gulp.d.ts +1 -1
- package/dist/gulp.js +5 -5
- package/dist/gulp.mjs +4 -4
- package/dist/{index-CoXntW_P.d.mts → index-BXrmQelt.d.mts} +29 -1
- package/dist/{index-CoXntW_P.d.ts → index-BXrmQelt.d.ts} +29 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +9 -9
- package/dist/index.mjs +7 -7
- package/dist/postcss-html-transform.js +1 -1
- package/dist/postcss-html-transform.mjs +1 -1
- package/dist/presets.d.mts +8 -1
- package/dist/presets.d.ts +8 -1
- package/dist/presets.js +7 -6
- package/dist/presets.mjs +3 -2
- package/dist/reset.d.mts +1 -31
- package/dist/reset.d.ts +3 -32
- package/dist/reset.js +3 -160
- package/dist/reset.mjs +3 -160
- package/dist/types.d.mts +2 -2
- package/dist/types.d.ts +2 -2
- package/dist/types.js +1 -1
- package/dist/types.mjs +1 -1
- package/dist/vite.d.mts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +6 -6
- package/dist/vite.mjs +4 -4
- package/dist/webpack.d.mts +1 -1
- package/dist/webpack.d.ts +1 -1
- package/dist/webpack.js +7 -7
- package/dist/webpack.mjs +5 -5
- package/dist/webpack4.d.mts +1 -1
- package/dist/webpack4.d.ts +1 -1
- package/dist/webpack4.js +41 -36
- package/dist/webpack4.mjs +12 -7
- package/package.json +8 -4
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.
|
|
211
|
+
version: "4.12.0-next.0",
|
|
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",
|
|
@@ -381,6 +410,7 @@ var package_default = {
|
|
|
381
410
|
"@weapp-core/regex": "~1.0.1",
|
|
382
411
|
"@weapp-tailwindcss/logger": "workspace:*",
|
|
383
412
|
"@weapp-tailwindcss/postcss": "workspace:*",
|
|
413
|
+
"@weapp-tailwindcss/reset": "workspace:*",
|
|
384
414
|
"@weapp-tailwindcss/shared": "workspace:*",
|
|
385
415
|
cac: "6.7.14",
|
|
386
416
|
"comment-json": "^4.6.2",
|
|
@@ -395,6 +425,9 @@ var package_default = {
|
|
|
395
425
|
"tailwindcss-patch": "catalog:tailwindcssPatch",
|
|
396
426
|
"webpack-sources": "3.3.4",
|
|
397
427
|
yaml: "^2.8.3"
|
|
428
|
+
},
|
|
429
|
+
devDependencies: {
|
|
430
|
+
"fast-check": "^4.7.0"
|
|
398
431
|
}
|
|
399
432
|
};
|
|
400
433
|
|
|
@@ -411,9 +444,9 @@ function warnInvalidPatchTargetRecord(baseDir, recordPath, reason) {
|
|
|
411
444
|
}
|
|
412
445
|
loggedInvalidPatchRecords.add(normalizedPath);
|
|
413
446
|
const fileDisplay = formatRelativeToBase(normalizedPath, baseDir);
|
|
414
|
-
const baseDisplay = formatRelativeToBase(import_node_path4.default.normalize(baseDir),
|
|
447
|
+
const baseDisplay = formatRelativeToBase(import_node_path4.default.normalize(baseDir), import_node_process4.default.cwd());
|
|
415
448
|
const reasonMessage = reason ? `\uFF1A${reason}` : "";
|
|
416
|
-
|
|
449
|
+
import_logger2.logger.warn(
|
|
417
450
|
`\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
451
|
);
|
|
419
452
|
}
|
|
@@ -470,23 +503,23 @@ async function saveCliPatchTargetRecord(baseDir, patcher, options) {
|
|
|
470
503
|
`, "utf8");
|
|
471
504
|
return recordPath;
|
|
472
505
|
} catch (error) {
|
|
473
|
-
const baseDisplay = formatRelativeToBase(normalizedBase,
|
|
474
|
-
|
|
506
|
+
const baseDisplay = formatRelativeToBase(normalizedBase, import_node_process4.default.cwd());
|
|
507
|
+
import_logger2.logger.warn(
|
|
475
508
|
'\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
509
|
baseDisplay,
|
|
477
510
|
normalizedBase
|
|
478
511
|
);
|
|
479
|
-
|
|
512
|
+
import_logger2.logger.debug("failed to persist patch target record %s: %O", recordPath, error);
|
|
480
513
|
return void 0;
|
|
481
514
|
}
|
|
482
515
|
}
|
|
483
516
|
|
|
484
517
|
// src/tailwindcss/targets/recorder.ts
|
|
485
518
|
var import_node_path5 = __toESM(require("path"));
|
|
486
|
-
var
|
|
519
|
+
var import_node_process5 = __toESM(require("process"));
|
|
487
520
|
function findPatchTargetRecord(baseDir) {
|
|
488
521
|
const visited = /* @__PURE__ */ new Set();
|
|
489
|
-
const fallback = baseDir ??
|
|
522
|
+
const fallback = baseDir ?? import_node_process5.default.cwd();
|
|
490
523
|
let current = import_node_path5.default.resolve(fallback);
|
|
491
524
|
while (!visited.has(current)) {
|
|
492
525
|
const record = readPatchTargetRecord(current);
|
|
@@ -564,30 +597,34 @@ function createPatchTargetRecorder(baseDir, patcher, options) {
|
|
|
564
597
|
// src/tailwindcss/targets.ts
|
|
565
598
|
function logTailwindcssTarget(kind, patcher, baseDir) {
|
|
566
599
|
const packageInfo = patcher?.packageInfo;
|
|
567
|
-
const label = kind === "cli" ? "weapp-tw patch" : "tailwindcss
|
|
600
|
+
const label = kind === "cli" ? "weapp-tw patch" : "Weapp-tailwindcss";
|
|
568
601
|
if (!packageInfo?.rootPath) {
|
|
569
|
-
|
|
602
|
+
import_logger3.logger.warn(
|
|
570
603
|
"%s \u672A\u627E\u5230 Tailwind CSS \u4F9D\u8D56\uFF0C\u8BF7\u68C0\u67E5\u5728 %s \u662F\u5426\u5DF2\u5B89\u88C5 tailwindcss",
|
|
571
604
|
label,
|
|
572
|
-
baseDir ??
|
|
605
|
+
baseDir ?? import_node_process6.default.cwd()
|
|
573
606
|
);
|
|
574
607
|
return;
|
|
575
608
|
}
|
|
576
609
|
const displayPath = formatRelativeToBase(packageInfo.rootPath, baseDir);
|
|
577
610
|
const version = packageInfo.version ? ` (v${packageInfo.version})` : "";
|
|
578
|
-
|
|
611
|
+
if (kind === "runtime") {
|
|
612
|
+
logRuntimeTailwindcssTarget(baseDir, packageInfo.rootPath, packageInfo.version);
|
|
613
|
+
return;
|
|
614
|
+
}
|
|
615
|
+
import_logger3.logger.info("%s \u7ED1\u5B9A Tailwind CSS -> %s%s", label, displayPath, version);
|
|
579
616
|
}
|
|
580
617
|
|
|
581
618
|
// src/tailwindcss/v4/config.ts
|
|
582
|
-
var
|
|
619
|
+
var import_logger4 = require("@weapp-tailwindcss/logger");
|
|
583
620
|
|
|
584
621
|
// src/tailwindcss/v4/patcher.ts
|
|
585
|
-
var
|
|
622
|
+
var import_logger6 = require("@weapp-tailwindcss/logger");
|
|
586
623
|
|
|
587
624
|
// src/tailwindcss/patcher.ts
|
|
588
625
|
var import_node_path7 = __toESM(require("path"));
|
|
589
|
-
var
|
|
590
|
-
var
|
|
626
|
+
var import_node_process8 = __toESM(require("process"));
|
|
627
|
+
var import_logger5 = require("@weapp-tailwindcss/logger");
|
|
591
628
|
var import_shared2 = require("@weapp-tailwindcss/shared");
|
|
592
629
|
var import_tailwindcss_patch = require("tailwindcss-patch");
|
|
593
630
|
|
|
@@ -595,7 +632,7 @@ var import_tailwindcss_patch = require("tailwindcss-patch");
|
|
|
595
632
|
var import_node_fs5 = require("fs");
|
|
596
633
|
var import_node_module = require("module");
|
|
597
634
|
var import_node_path6 = __toESM(require("path"));
|
|
598
|
-
var
|
|
635
|
+
var import_node_process7 = __toESM(require("process"));
|
|
599
636
|
var import_node_url = require("url");
|
|
600
637
|
|
|
601
638
|
// src/tailwindcss/v4/css-entries.ts
|
|
@@ -604,14 +641,17 @@ var import_node_path8 = __toESM(require("path"));
|
|
|
604
641
|
// src/context/compiler-context-cache.ts
|
|
605
642
|
var import_node_buffer = require("buffer");
|
|
606
643
|
var import_node_path9 = __toESM(require("path"));
|
|
607
|
-
var
|
|
608
|
-
var
|
|
644
|
+
var import_node_process9 = __toESM(require("process"));
|
|
645
|
+
var import_logger7 = require("@weapp-tailwindcss/logger");
|
|
609
646
|
var globalCacheHolder = globalThis;
|
|
610
647
|
var compilerContextCache = globalCacheHolder.__WEAPP_TW_COMPILER_CONTEXT_CACHE__ ?? (globalCacheHolder.__WEAPP_TW_COMPILER_CONTEXT_CACHE__ = /* @__PURE__ */ new Map());
|
|
611
648
|
|
|
612
649
|
// src/context/handlers.ts
|
|
613
650
|
var import_postcss = require("@weapp-tailwindcss/postcss");
|
|
614
651
|
|
|
652
|
+
// src/js/index.ts
|
|
653
|
+
var import_lru_cache3 = require("lru-cache");
|
|
654
|
+
|
|
615
655
|
// src/babel/index.ts
|
|
616
656
|
var import_traverse = __toESM(require("@babel/traverse"));
|
|
617
657
|
var import_parser = require("@babel/parser");
|
|
@@ -812,22 +852,22 @@ var Tokenizer = class {
|
|
|
812
852
|
var sharedTokenizer = new Tokenizer();
|
|
813
853
|
|
|
814
854
|
// src/context/logger.ts
|
|
815
|
-
var
|
|
855
|
+
var import_logger8 = require("@weapp-tailwindcss/logger");
|
|
816
856
|
|
|
817
857
|
// src/context/tailwindcss.ts
|
|
818
|
-
var
|
|
858
|
+
var import_logger10 = require("@weapp-tailwindcss/logger");
|
|
819
859
|
|
|
820
860
|
// src/context/tailwindcss/basedir.ts
|
|
821
861
|
var import_node_module2 = require("module");
|
|
822
862
|
var import_node_path10 = __toESM(require("path"));
|
|
823
|
-
var
|
|
863
|
+
var import_node_process10 = __toESM(require("process"));
|
|
824
864
|
var import_node_url2 = require("url");
|
|
825
|
-
var
|
|
865
|
+
var import_logger9 = require("@weapp-tailwindcss/logger");
|
|
826
866
|
|
|
827
867
|
// src/context/tailwindcss/rax.ts
|
|
828
868
|
var import_node_fs6 = require("fs");
|
|
829
869
|
var import_node_path11 = __toESM(require("path"));
|
|
830
|
-
var
|
|
870
|
+
var import_node_process11 = __toESM(require("process"));
|
|
831
871
|
|
|
832
872
|
// src/context/index.ts
|
|
833
873
|
async function clearTailwindcssPatcherCache(patcher, options) {
|
|
@@ -842,7 +882,7 @@ async function clearTailwindcssPatcherCache(patcher, options) {
|
|
|
842
882
|
try {
|
|
843
883
|
await patcher.clearCache({ scope: "all" });
|
|
844
884
|
} catch (error) {
|
|
845
|
-
|
|
885
|
+
import_logger11.logger.debug("failed to clear tailwindcss patcher cache via clearCache(): %O", error);
|
|
846
886
|
}
|
|
847
887
|
}
|
|
848
888
|
if (!options?.removeDirectory) {
|
|
@@ -871,14 +911,14 @@ async function clearTailwindcssPatcherCache(patcher, options) {
|
|
|
871
911
|
if (err?.code === "ENOENT") {
|
|
872
912
|
continue;
|
|
873
913
|
}
|
|
874
|
-
|
|
914
|
+
import_logger11.logger.debug("failed to clear tailwindcss patcher cache: %s %O", cachePath, err);
|
|
875
915
|
}
|
|
876
916
|
}
|
|
877
917
|
}
|
|
878
918
|
|
|
879
919
|
// src/cli/context.ts
|
|
880
920
|
function formatOutputPath(target, baseDir) {
|
|
881
|
-
const root = baseDir ??
|
|
921
|
+
const root = baseDir ?? import_node_process12.default.cwd();
|
|
882
922
|
const relative = import_node_path12.default.relative(root, target);
|
|
883
923
|
if (!relative) {
|
|
884
924
|
return ".";
|
|
@@ -891,10 +931,10 @@ function formatOutputPath(target, baseDir) {
|
|
|
891
931
|
|
|
892
932
|
// src/cli/helpers.ts
|
|
893
933
|
var import_promises3 = require("fs/promises");
|
|
894
|
-
var
|
|
934
|
+
var import_node_process15 = __toESM(require("process"));
|
|
895
935
|
|
|
896
936
|
// src/logger/index.ts
|
|
897
|
-
var
|
|
937
|
+
var import_logger13 = require("@weapp-tailwindcss/logger");
|
|
898
938
|
|
|
899
939
|
// src/cli/helpers/options/parse.ts
|
|
900
940
|
function readStringOption(flag, value) {
|
|
@@ -950,18 +990,18 @@ function toBoolean(value, fallback) {
|
|
|
950
990
|
|
|
951
991
|
// src/cli/helpers/options/resolve.ts
|
|
952
992
|
var import_node_path13 = __toESM(require("path"));
|
|
953
|
-
var
|
|
993
|
+
var import_node_process13 = __toESM(require("process"));
|
|
954
994
|
function resolveCliCwd(value) {
|
|
955
995
|
const raw = readStringOption("cwd", value);
|
|
956
996
|
if (!raw) {
|
|
957
997
|
return void 0;
|
|
958
998
|
}
|
|
959
|
-
return import_node_path13.default.isAbsolute(raw) ? import_node_path13.default.normalize(raw) : import_node_path13.default.resolve(
|
|
999
|
+
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
1000
|
}
|
|
961
1001
|
|
|
962
1002
|
// src/cli/helpers/patch-cwd.ts
|
|
963
1003
|
var import_node_path14 = __toESM(require("path"));
|
|
964
|
-
var
|
|
1004
|
+
var import_node_process14 = __toESM(require("process"));
|
|
965
1005
|
|
|
966
1006
|
// src/tailwindcss/index.ts
|
|
967
1007
|
var import_local_pkg = require("local-pkg");
|
|
@@ -988,15 +1028,15 @@ function detectTailwindWorkspace(paths) {
|
|
|
988
1028
|
}
|
|
989
1029
|
return void 0;
|
|
990
1030
|
}
|
|
991
|
-
function resolvePatchDefaultCwd(currentCwd =
|
|
1031
|
+
function resolvePatchDefaultCwd(currentCwd = import_node_process14.default.cwd()) {
|
|
992
1032
|
const baseDir = import_node_path14.default.normalize(currentCwd);
|
|
993
|
-
const explicitCwd = normalizeCandidatePath(baseDir,
|
|
1033
|
+
const explicitCwd = normalizeCandidatePath(baseDir, import_node_process14.default.env.WEAPP_TW_PATCH_CWD);
|
|
994
1034
|
if (explicitCwd) {
|
|
995
1035
|
return explicitCwd;
|
|
996
1036
|
}
|
|
997
1037
|
const workspaceRoot = findWorkspaceRoot(baseDir);
|
|
998
|
-
const initCwd = normalizeCandidatePath(baseDir,
|
|
999
|
-
const localPrefix = normalizeCandidatePath(baseDir,
|
|
1038
|
+
const initCwd = normalizeCandidatePath(baseDir, import_node_process14.default.env.INIT_CWD);
|
|
1039
|
+
const localPrefix = normalizeCandidatePath(baseDir, import_node_process14.default.env.npm_config_local_prefix);
|
|
1000
1040
|
const candidates = [
|
|
1001
1041
|
baseDir,
|
|
1002
1042
|
workspaceRoot,
|
|
@@ -1016,12 +1056,12 @@ async function ensureDir(dir) {
|
|
|
1016
1056
|
}
|
|
1017
1057
|
function handleCliError(error) {
|
|
1018
1058
|
if (error instanceof Error) {
|
|
1019
|
-
|
|
1020
|
-
if (error.stack &&
|
|
1021
|
-
|
|
1059
|
+
import_logger13.logger.error(error.message);
|
|
1060
|
+
if (error.stack && import_node_process15.default.env.WEAPP_TW_DEBUG === "1") {
|
|
1061
|
+
import_logger13.logger.error(error.stack);
|
|
1022
1062
|
}
|
|
1023
1063
|
} else {
|
|
1024
|
-
|
|
1064
|
+
import_logger13.logger.error(String(error));
|
|
1025
1065
|
}
|
|
1026
1066
|
}
|
|
1027
1067
|
function commandAction(handler) {
|
|
@@ -1030,13 +1070,13 @@ function commandAction(handler) {
|
|
|
1030
1070
|
await handler(...args);
|
|
1031
1071
|
} catch (error) {
|
|
1032
1072
|
handleCliError(error);
|
|
1033
|
-
|
|
1073
|
+
import_node_process15.default.exitCode = 1;
|
|
1034
1074
|
}
|
|
1035
1075
|
};
|
|
1036
1076
|
}
|
|
1037
1077
|
|
|
1038
1078
|
// src/cli/mount-options.ts
|
|
1039
|
-
var
|
|
1079
|
+
var import_node_process17 = __toESM(require("process"));
|
|
1040
1080
|
|
|
1041
1081
|
// src/cli/mount-options/patch-status.ts
|
|
1042
1082
|
function formatStatusFilesHint(files) {
|
|
@@ -1052,27 +1092,27 @@ function logPatchStatusReport(report) {
|
|
|
1052
1092
|
(entry) => entry.status === "skipped" || entry.status === "unsupported"
|
|
1053
1093
|
);
|
|
1054
1094
|
const packageLabel = `${report.package.name ?? "tailwindcss"}@${report.package.version ?? "unknown"}`;
|
|
1055
|
-
|
|
1095
|
+
import_logger13.logger.info(`Patch status for ${packageLabel} (v${report.majorVersion})`);
|
|
1056
1096
|
if (applied.length) {
|
|
1057
|
-
|
|
1097
|
+
import_logger13.logger.success("Applied:");
|
|
1058
1098
|
applied.forEach((entry) => {
|
|
1059
|
-
|
|
1099
|
+
import_logger13.logger.success(` - ${entry.name}${formatStatusFilesHint(entry.files)}`);
|
|
1060
1100
|
});
|
|
1061
1101
|
}
|
|
1062
1102
|
if (pending.length) {
|
|
1063
|
-
|
|
1103
|
+
import_logger13.logger.warn("Needs attention:");
|
|
1064
1104
|
pending.forEach((entry) => {
|
|
1065
1105
|
const details = entry.reason ? ` - ${entry.reason}` : "";
|
|
1066
|
-
|
|
1106
|
+
import_logger13.logger.warn(` - ${entry.name}${formatStatusFilesHint(entry.files)}${details}`);
|
|
1067
1107
|
});
|
|
1068
1108
|
} else {
|
|
1069
|
-
|
|
1109
|
+
import_logger13.logger.success("All applicable patches are applied.");
|
|
1070
1110
|
}
|
|
1071
1111
|
if (skipped.length) {
|
|
1072
|
-
|
|
1112
|
+
import_logger13.logger.info("Skipped:");
|
|
1073
1113
|
skipped.forEach((entry) => {
|
|
1074
1114
|
const details = entry.reason ? ` - ${entry.reason}` : "";
|
|
1075
|
-
|
|
1115
|
+
import_logger13.logger.info(` - ${entry.name}${details}`);
|
|
1076
1116
|
});
|
|
1077
1117
|
}
|
|
1078
1118
|
}
|
|
@@ -1112,7 +1152,7 @@ function buildExtendLengthUnitsOverride(options) {
|
|
|
1112
1152
|
|
|
1113
1153
|
// src/cli/workspace.ts
|
|
1114
1154
|
var import_node_path19 = __toESM(require("path"));
|
|
1115
|
-
var
|
|
1155
|
+
var import_node_process16 = __toESM(require("process"));
|
|
1116
1156
|
|
|
1117
1157
|
// src/cli/workspace/package-dirs.ts
|
|
1118
1158
|
var import_node_fs10 = require("fs");
|
|
@@ -1239,7 +1279,7 @@ function summarizeWorkspaceResults(results) {
|
|
|
1239
1279
|
const patched = results.filter((result) => result.status === "patched").length;
|
|
1240
1280
|
const skipped = results.filter((result) => result.status === "skipped").length;
|
|
1241
1281
|
const failed = results.filter((result) => result.status === "failed").length;
|
|
1242
|
-
|
|
1282
|
+
import_logger13.logger.info("[workspace] \u6C47\u603B\uFF1A\u5DF2\u8865\u4E01 %d\uFF0C\u8DF3\u8FC7 %d\uFF0C\u5931\u8D25 %d", patched, skipped, failed);
|
|
1243
1283
|
}
|
|
1244
1284
|
|
|
1245
1285
|
// src/cli/workspace/patch-package.ts
|
|
@@ -1255,7 +1295,7 @@ async function patchWorkspacePackage(workspaceRoot, dir, pkgName, options) {
|
|
|
1255
1295
|
const displayName = formatDisplayName(workspaceRoot, dir, pkgName);
|
|
1256
1296
|
const tailwindInfo = getTailwindcssPackageInfo({ paths: [dir] });
|
|
1257
1297
|
if (!tailwindInfo?.rootPath) {
|
|
1258
|
-
|
|
1298
|
+
import_logger13.logger.info("[workspace] \u8DF3\u8FC7 %s\uFF08tailwindcss \u672A\u5B89\u88C5\uFF09\u3002", displayName);
|
|
1259
1299
|
return {
|
|
1260
1300
|
dir,
|
|
1261
1301
|
name: pkgName,
|
|
@@ -1275,14 +1315,14 @@ async function patchWorkspacePackage(workspaceRoot, dir, pkgName, options) {
|
|
|
1275
1315
|
alwaysRecord: true
|
|
1276
1316
|
});
|
|
1277
1317
|
if (recorder?.message) {
|
|
1278
|
-
|
|
1318
|
+
import_logger13.logger.info("[workspace] %s %s", displayName, recorder.message);
|
|
1279
1319
|
}
|
|
1280
1320
|
logTailwindcssTarget("cli", patcher, dir);
|
|
1281
1321
|
await patcher.patch();
|
|
1282
1322
|
if (recorder?.onPatched) {
|
|
1283
1323
|
await recorder.onPatched();
|
|
1284
1324
|
}
|
|
1285
|
-
|
|
1325
|
+
import_logger13.logger.success("[workspace] \u5DF2\u8865\u4E01 %s", displayName);
|
|
1286
1326
|
return {
|
|
1287
1327
|
dir,
|
|
1288
1328
|
name: pkgName,
|
|
@@ -1293,7 +1333,7 @@ async function patchWorkspacePackage(workspaceRoot, dir, pkgName, options) {
|
|
|
1293
1333
|
const reason = error instanceof Error ? error.message : String(error);
|
|
1294
1334
|
const suggestion = `\u8BF7\u5728 ${dir} \u8FD0\u884C "weapp-tw patch --cwd ${dir}".`;
|
|
1295
1335
|
const message = `${reason}\uFF0C${suggestion}`;
|
|
1296
|
-
|
|
1336
|
+
import_logger13.logger.error("[workspace] \u8865\u4E01\u5931\u8D25 %s\uFF1A%s", displayName, message);
|
|
1297
1337
|
return {
|
|
1298
1338
|
dir,
|
|
1299
1339
|
name: pkgName,
|
|
@@ -1305,11 +1345,11 @@ async function patchWorkspacePackage(workspaceRoot, dir, pkgName, options) {
|
|
|
1305
1345
|
|
|
1306
1346
|
// src/cli/workspace.ts
|
|
1307
1347
|
async function patchWorkspace(options) {
|
|
1308
|
-
const cwd = options.cwd ??
|
|
1348
|
+
const cwd = options.cwd ?? import_node_process16.default.cwd();
|
|
1309
1349
|
const workspaceRoot = findWorkspaceRoot(cwd) ?? cwd;
|
|
1310
1350
|
const packageDirs = await resolveWorkspacePackageDirs(workspaceRoot);
|
|
1311
1351
|
if (packageDirs.length === 0) {
|
|
1312
|
-
|
|
1352
|
+
import_logger13.logger.warn("\u672A\u5728 %s \u68C0\u6D4B\u5230 workspace \u5305\uFF0C\u5DF2\u8DF3\u8FC7\u6279\u91CF patch\u3002", workspaceRoot);
|
|
1313
1353
|
return;
|
|
1314
1354
|
}
|
|
1315
1355
|
const results = [];
|
|
@@ -1324,12 +1364,12 @@ async function patchWorkspace(options) {
|
|
|
1324
1364
|
// src/cli/mount-options.ts
|
|
1325
1365
|
function handleCliError2(error) {
|
|
1326
1366
|
if (error instanceof Error) {
|
|
1327
|
-
|
|
1328
|
-
if (error.stack &&
|
|
1329
|
-
|
|
1367
|
+
import_logger13.logger.error(error.message);
|
|
1368
|
+
if (error.stack && import_node_process17.default.env.WEAPP_TW_DEBUG === "1") {
|
|
1369
|
+
import_logger13.logger.error(error.stack);
|
|
1330
1370
|
}
|
|
1331
1371
|
} else {
|
|
1332
|
-
|
|
1372
|
+
import_logger13.logger.error(String(error));
|
|
1333
1373
|
}
|
|
1334
1374
|
}
|
|
1335
1375
|
function withCommandErrorHandling(handler) {
|
|
@@ -1338,7 +1378,7 @@ function withCommandErrorHandling(handler) {
|
|
|
1338
1378
|
return await handler(ctx, next);
|
|
1339
1379
|
} catch (error) {
|
|
1340
1380
|
handleCliError2(error);
|
|
1341
|
-
|
|
1381
|
+
import_node_process17.default.exitCode = 1;
|
|
1342
1382
|
return void 0;
|
|
1343
1383
|
}
|
|
1344
1384
|
});
|
|
@@ -1417,17 +1457,17 @@ var mountOptions = {
|
|
|
1417
1457
|
alwaysRecord: true
|
|
1418
1458
|
});
|
|
1419
1459
|
if (recorder?.message) {
|
|
1420
|
-
|
|
1460
|
+
import_logger13.logger.info(recorder.message);
|
|
1421
1461
|
}
|
|
1422
1462
|
logTailwindcssTarget("cli", patcher, ctx.cwd);
|
|
1423
1463
|
await patcher.patch();
|
|
1424
1464
|
if (recorder?.onPatched) {
|
|
1425
1465
|
const recordPath = await recorder.onPatched();
|
|
1426
1466
|
if (recordPath) {
|
|
1427
|
-
|
|
1467
|
+
import_logger13.logger.info(`\u8BB0\u5F55 weapp-tw patch \u76EE\u6807 -> ${formatOutputPath(recordPath, ctx.cwd)}`);
|
|
1428
1468
|
}
|
|
1429
1469
|
}
|
|
1430
|
-
|
|
1470
|
+
import_logger13.logger.success("Tailwind CSS \u8FD0\u884C\u65F6\u8865\u4E01\u5DF2\u5B8C\u6210\u3002");
|
|
1431
1471
|
}),
|
|
1432
1472
|
extract: withCommandErrorHandling(async (_ctx, next) => next()),
|
|
1433
1473
|
tokens: withCommandErrorHandling(async (_ctx, next) => next()),
|
|
@@ -1436,7 +1476,7 @@ var mountOptions = {
|
|
|
1436
1476
|
const patcher = await createPatcherWithDefaultExtendLengthUnits(ctx);
|
|
1437
1477
|
const report = await patcher.getPatchStatus();
|
|
1438
1478
|
if (ctx.args.json) {
|
|
1439
|
-
|
|
1479
|
+
import_logger13.logger.log(JSON.stringify(report, null, 2));
|
|
1440
1480
|
return report;
|
|
1441
1481
|
}
|
|
1442
1482
|
logPatchStatusReport(report);
|
|
@@ -1567,10 +1607,10 @@ async function generateVscodeIntellisenseEntry(options) {
|
|
|
1567
1607
|
}
|
|
1568
1608
|
|
|
1569
1609
|
// src/cli.ts
|
|
1570
|
-
|
|
1571
|
-
if (import_semver.default.lt(
|
|
1572
|
-
|
|
1573
|
-
`You are using Node.js ${
|
|
1610
|
+
import_node_process18.default.title = "node (weapp-tailwindcss)";
|
|
1611
|
+
if (import_semver.default.lt(import_node_process18.default.versions.node, WEAPP_TW_REQUIRED_NODE_VERSION)) {
|
|
1612
|
+
import_logger13.logger.warn(
|
|
1613
|
+
`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
1614
|
);
|
|
1575
1615
|
}
|
|
1576
1616
|
var cli = (0, import_tailwindcss_patch3.createTailwindcssPatchCli)({
|
|
@@ -1580,7 +1620,7 @@ var cli = (0, import_tailwindcss_patch3.createTailwindcssPatchCli)({
|
|
|
1580
1620
|
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
1621
|
commandAction(async (options) => {
|
|
1582
1622
|
const resolvedCwd = resolveCliCwd(options.cwd);
|
|
1583
|
-
const baseDir = resolvedCwd ??
|
|
1623
|
+
const baseDir = resolvedCwd ?? import_node_process18.default.cwd();
|
|
1584
1624
|
const cssEntry = readStringOption("css", options.css);
|
|
1585
1625
|
if (!cssEntry) {
|
|
1586
1626
|
throw new Error('Option "--css" is required.');
|
|
@@ -1595,11 +1635,11 @@ cli.command("vscode-entry", "Generate a VS Code helper CSS for Tailwind IntelliS
|
|
|
1595
1635
|
sources,
|
|
1596
1636
|
force
|
|
1597
1637
|
});
|
|
1598
|
-
|
|
1638
|
+
import_logger13.logger.success(
|
|
1599
1639
|
`VS Code helper generated -> ${formatOutputPath(result.outputPath, resolvedCwd)}`
|
|
1600
1640
|
);
|
|
1601
1641
|
})
|
|
1602
1642
|
);
|
|
1603
1643
|
cli.help();
|
|
1604
|
-
cli.version(
|
|
1644
|
+
cli.version(import_node_process18.default.env.npm_package_version ?? "0.0.0");
|
|
1605
1645
|
cli.parse();
|