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.mjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
// src/cli.ts
|
|
2
|
-
import
|
|
2
|
+
import process18 from "process";
|
|
3
3
|
import semver from "semver";
|
|
4
4
|
import { createTailwindcssPatchCli } from "tailwindcss-patch";
|
|
5
5
|
|
|
6
6
|
// src/cli/context.ts
|
|
7
7
|
import path12 from "path";
|
|
8
|
-
import
|
|
8
|
+
import process12 from "process";
|
|
9
9
|
|
|
10
10
|
// src/context/index.ts
|
|
11
11
|
import { rm } from "fs/promises";
|
|
12
|
-
import { logger as
|
|
12
|
+
import { logger as logger11 } from "@weapp-tailwindcss/logger";
|
|
13
13
|
|
|
14
14
|
// src/cache/index.ts
|
|
15
15
|
import { LRUCache } from "lru-cache";
|
|
@@ -53,9 +53,38 @@ import { statSync } from "fs";
|
|
|
53
53
|
// src/tailwindcss/runtime.ts
|
|
54
54
|
var debug = createDebug("[tailwindcss:runtime] ");
|
|
55
55
|
|
|
56
|
+
// src/tailwindcss/runtime-logs.ts
|
|
57
|
+
import process3 from "process";
|
|
58
|
+
import { logger, pc } from "@weapp-tailwindcss/logger";
|
|
59
|
+
var runtimeLogDedupeHolder = globalThis;
|
|
60
|
+
var runtimeLogDedupe = runtimeLogDedupeHolder.__WEAPP_TW_RUNTIME_LOG_DEDUPE__ ?? (runtimeLogDedupeHolder.__WEAPP_TW_RUNTIME_LOG_DEDUPE__ = /* @__PURE__ */ new Set());
|
|
61
|
+
function createRuntimeLogKey(category, baseDir, rootPath, version) {
|
|
62
|
+
return JSON.stringify([
|
|
63
|
+
category,
|
|
64
|
+
baseDir ?? process3.cwd(),
|
|
65
|
+
rootPath ?? "",
|
|
66
|
+
version ?? ""
|
|
67
|
+
]);
|
|
68
|
+
}
|
|
69
|
+
function markRuntimeLog(category, baseDir, rootPath, version) {
|
|
70
|
+
const key = createRuntimeLogKey(category, baseDir, rootPath, version);
|
|
71
|
+
if (runtimeLogDedupe.has(key)) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
runtimeLogDedupe.add(key);
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
function logRuntimeTailwindcssTarget(baseDir, rootPath, version) {
|
|
78
|
+
if (!markRuntimeLog("target", baseDir, rootPath, version)) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const versionText = version ? ` (v${version})` : "";
|
|
82
|
+
logger.info("%s \u4F7F\u7528 Tailwind CSS%s", "Weapp-tailwindcss", versionText);
|
|
83
|
+
}
|
|
84
|
+
|
|
56
85
|
// src/tailwindcss/targets.ts
|
|
57
|
-
import
|
|
58
|
-
import { logger as
|
|
86
|
+
import process6 from "process";
|
|
87
|
+
import { logger as logger3 } from "@weapp-tailwindcss/logger";
|
|
59
88
|
|
|
60
89
|
// src/tailwindcss/targets/paths.ts
|
|
61
90
|
import { existsSync as existsSync2 } from "fs";
|
|
@@ -149,13 +178,13 @@ function getRecordFileCandidates(baseDir) {
|
|
|
149
178
|
import { existsSync as existsSync3, readFileSync as readFileSync2 } from "fs";
|
|
150
179
|
import { mkdir, writeFile } from "fs/promises";
|
|
151
180
|
import path4 from "path";
|
|
152
|
-
import
|
|
153
|
-
import { logger } from "@weapp-tailwindcss/logger";
|
|
181
|
+
import process4 from "process";
|
|
182
|
+
import { logger as logger2 } from "@weapp-tailwindcss/logger";
|
|
154
183
|
|
|
155
184
|
// package.json
|
|
156
185
|
var package_default = {
|
|
157
186
|
name: "weapp-tailwindcss",
|
|
158
|
-
version: "4.11.
|
|
187
|
+
version: "4.11.2",
|
|
159
188
|
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!",
|
|
160
189
|
author: "ice breaker <1324318532@qq.com>",
|
|
161
190
|
license: "MIT",
|
|
@@ -387,9 +416,9 @@ function warnInvalidPatchTargetRecord(baseDir, recordPath, reason) {
|
|
|
387
416
|
}
|
|
388
417
|
loggedInvalidPatchRecords.add(normalizedPath);
|
|
389
418
|
const fileDisplay = formatRelativeToBase(normalizedPath, baseDir);
|
|
390
|
-
const baseDisplay = formatRelativeToBase(path4.normalize(baseDir),
|
|
419
|
+
const baseDisplay = formatRelativeToBase(path4.normalize(baseDir), process4.cwd());
|
|
391
420
|
const reasonMessage = reason ? `\uFF1A${reason}` : "";
|
|
392
|
-
|
|
421
|
+
logger2.warn(
|
|
393
422
|
`\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`
|
|
394
423
|
);
|
|
395
424
|
}
|
|
@@ -446,23 +475,23 @@ async function saveCliPatchTargetRecord(baseDir, patcher, options) {
|
|
|
446
475
|
`, "utf8");
|
|
447
476
|
return recordPath;
|
|
448
477
|
} catch (error) {
|
|
449
|
-
const baseDisplay = formatRelativeToBase(normalizedBase,
|
|
450
|
-
|
|
478
|
+
const baseDisplay = formatRelativeToBase(normalizedBase, process4.cwd());
|
|
479
|
+
logger2.warn(
|
|
451
480
|
'\u81EA\u52A8\u66F4\u65B0 Tailwind CSS \u8865\u4E01\u8BB0\u5F55\u5931\u8D25\uFF0C\u8BF7\u5728 %s \u8FD0\u884C "weapp-tw patch --cwd %s"\u3002',
|
|
452
481
|
baseDisplay,
|
|
453
482
|
normalizedBase
|
|
454
483
|
);
|
|
455
|
-
|
|
484
|
+
logger2.debug("failed to persist patch target record %s: %O", recordPath, error);
|
|
456
485
|
return void 0;
|
|
457
486
|
}
|
|
458
487
|
}
|
|
459
488
|
|
|
460
489
|
// src/tailwindcss/targets/recorder.ts
|
|
461
490
|
import path5 from "path";
|
|
462
|
-
import
|
|
491
|
+
import process5 from "process";
|
|
463
492
|
function findPatchTargetRecord(baseDir) {
|
|
464
493
|
const visited = /* @__PURE__ */ new Set();
|
|
465
|
-
const fallback = baseDir ??
|
|
494
|
+
const fallback = baseDir ?? process5.cwd();
|
|
466
495
|
let current = path5.resolve(fallback);
|
|
467
496
|
while (!visited.has(current)) {
|
|
468
497
|
const record = readPatchTargetRecord(current);
|
|
@@ -540,30 +569,34 @@ function createPatchTargetRecorder(baseDir, patcher, options) {
|
|
|
540
569
|
// src/tailwindcss/targets.ts
|
|
541
570
|
function logTailwindcssTarget(kind, patcher, baseDir) {
|
|
542
571
|
const packageInfo = patcher?.packageInfo;
|
|
543
|
-
const label = kind === "cli" ? "weapp-tw patch" : "tailwindcss
|
|
572
|
+
const label = kind === "cli" ? "weapp-tw patch" : "Weapp-tailwindcss";
|
|
544
573
|
if (!packageInfo?.rootPath) {
|
|
545
|
-
|
|
574
|
+
logger3.warn(
|
|
546
575
|
"%s \u672A\u627E\u5230 Tailwind CSS \u4F9D\u8D56\uFF0C\u8BF7\u68C0\u67E5\u5728 %s \u662F\u5426\u5DF2\u5B89\u88C5 tailwindcss",
|
|
547
576
|
label,
|
|
548
|
-
baseDir ??
|
|
577
|
+
baseDir ?? process6.cwd()
|
|
549
578
|
);
|
|
550
579
|
return;
|
|
551
580
|
}
|
|
552
581
|
const displayPath = formatRelativeToBase(packageInfo.rootPath, baseDir);
|
|
553
582
|
const version = packageInfo.version ? ` (v${packageInfo.version})` : "";
|
|
554
|
-
|
|
583
|
+
if (kind === "runtime") {
|
|
584
|
+
logRuntimeTailwindcssTarget(baseDir, packageInfo.rootPath, packageInfo.version);
|
|
585
|
+
return;
|
|
586
|
+
}
|
|
587
|
+
logger3.info("%s \u7ED1\u5B9A Tailwind CSS -> %s%s", label, displayPath, version);
|
|
555
588
|
}
|
|
556
589
|
|
|
557
590
|
// src/tailwindcss/v4/config.ts
|
|
558
|
-
import { logger as
|
|
591
|
+
import { logger as logger4 } from "@weapp-tailwindcss/logger";
|
|
559
592
|
|
|
560
593
|
// src/tailwindcss/v4/patcher.ts
|
|
561
|
-
import { logger as
|
|
594
|
+
import { logger as logger6 } from "@weapp-tailwindcss/logger";
|
|
562
595
|
|
|
563
596
|
// src/tailwindcss/patcher.ts
|
|
564
597
|
import path7 from "path";
|
|
565
|
-
import
|
|
566
|
-
import { logger as
|
|
598
|
+
import process8 from "process";
|
|
599
|
+
import { logger as logger5 } from "@weapp-tailwindcss/logger";
|
|
567
600
|
import { defuOverrideArray as defuOverrideArray2 } from "@weapp-tailwindcss/shared";
|
|
568
601
|
import { TailwindcssPatcher } from "tailwindcss-patch";
|
|
569
602
|
|
|
@@ -571,7 +604,7 @@ import { TailwindcssPatcher } from "tailwindcss-patch";
|
|
|
571
604
|
import { existsSync as existsSync4 } from "fs";
|
|
572
605
|
import { createRequire } from "module";
|
|
573
606
|
import path6 from "path";
|
|
574
|
-
import
|
|
607
|
+
import process7 from "process";
|
|
575
608
|
import { fileURLToPath } from "url";
|
|
576
609
|
|
|
577
610
|
// src/tailwindcss/v4/css-entries.ts
|
|
@@ -580,8 +613,8 @@ import path8 from "path";
|
|
|
580
613
|
// src/context/compiler-context-cache.ts
|
|
581
614
|
import { Buffer } from "buffer";
|
|
582
615
|
import path9 from "path";
|
|
583
|
-
import
|
|
584
|
-
import { logger as
|
|
616
|
+
import process9 from "process";
|
|
617
|
+
import { logger as logger7 } from "@weapp-tailwindcss/logger";
|
|
585
618
|
var globalCacheHolder = globalThis;
|
|
586
619
|
var compilerContextCache = globalCacheHolder.__WEAPP_TW_COMPILER_CONTEXT_CACHE__ ?? (globalCacheHolder.__WEAPP_TW_COMPILER_CONTEXT_CACHE__ = /* @__PURE__ */ new Map());
|
|
587
620
|
|
|
@@ -788,22 +821,22 @@ var Tokenizer = class {
|
|
|
788
821
|
var sharedTokenizer = new Tokenizer();
|
|
789
822
|
|
|
790
823
|
// src/context/logger.ts
|
|
791
|
-
import { logger as
|
|
824
|
+
import { logger as logger8 } from "@weapp-tailwindcss/logger";
|
|
792
825
|
|
|
793
826
|
// src/context/tailwindcss.ts
|
|
794
|
-
import { logger as
|
|
827
|
+
import { logger as logger10 } from "@weapp-tailwindcss/logger";
|
|
795
828
|
|
|
796
829
|
// src/context/tailwindcss/basedir.ts
|
|
797
830
|
import { createRequire as createRequire2 } from "module";
|
|
798
831
|
import path10 from "path";
|
|
799
|
-
import
|
|
832
|
+
import process10 from "process";
|
|
800
833
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
801
|
-
import { logger as
|
|
834
|
+
import { logger as logger9 } from "@weapp-tailwindcss/logger";
|
|
802
835
|
|
|
803
836
|
// src/context/tailwindcss/rax.ts
|
|
804
837
|
import { existsSync as existsSync5, readFileSync as readFileSync3 } from "fs";
|
|
805
838
|
import path11 from "path";
|
|
806
|
-
import
|
|
839
|
+
import process11 from "process";
|
|
807
840
|
|
|
808
841
|
// src/context/index.ts
|
|
809
842
|
async function clearTailwindcssPatcherCache(patcher, options) {
|
|
@@ -818,7 +851,7 @@ async function clearTailwindcssPatcherCache(patcher, options) {
|
|
|
818
851
|
try {
|
|
819
852
|
await patcher.clearCache({ scope: "all" });
|
|
820
853
|
} catch (error) {
|
|
821
|
-
|
|
854
|
+
logger11.debug("failed to clear tailwindcss patcher cache via clearCache(): %O", error);
|
|
822
855
|
}
|
|
823
856
|
}
|
|
824
857
|
if (!options?.removeDirectory) {
|
|
@@ -847,14 +880,14 @@ async function clearTailwindcssPatcherCache(patcher, options) {
|
|
|
847
880
|
if (err?.code === "ENOENT") {
|
|
848
881
|
continue;
|
|
849
882
|
}
|
|
850
|
-
|
|
883
|
+
logger11.debug("failed to clear tailwindcss patcher cache: %s %O", cachePath, err);
|
|
851
884
|
}
|
|
852
885
|
}
|
|
853
886
|
}
|
|
854
887
|
|
|
855
888
|
// src/cli/context.ts
|
|
856
889
|
function formatOutputPath(target, baseDir) {
|
|
857
|
-
const root = baseDir ??
|
|
890
|
+
const root = baseDir ?? process12.cwd();
|
|
858
891
|
const relative = path12.relative(root, target);
|
|
859
892
|
if (!relative) {
|
|
860
893
|
return ".";
|
|
@@ -867,10 +900,10 @@ function formatOutputPath(target, baseDir) {
|
|
|
867
900
|
|
|
868
901
|
// src/cli/helpers.ts
|
|
869
902
|
import { mkdir as mkdir2 } from "fs/promises";
|
|
870
|
-
import
|
|
903
|
+
import process15 from "process";
|
|
871
904
|
|
|
872
905
|
// src/logger/index.ts
|
|
873
|
-
import { logger as
|
|
906
|
+
import { logger as logger12 } from "@weapp-tailwindcss/logger";
|
|
874
907
|
|
|
875
908
|
// src/cli/helpers/options/parse.ts
|
|
876
909
|
function readStringOption(flag, value) {
|
|
@@ -926,18 +959,18 @@ function toBoolean(value, fallback) {
|
|
|
926
959
|
|
|
927
960
|
// src/cli/helpers/options/resolve.ts
|
|
928
961
|
import path13 from "path";
|
|
929
|
-
import
|
|
962
|
+
import process13 from "process";
|
|
930
963
|
function resolveCliCwd(value) {
|
|
931
964
|
const raw = readStringOption("cwd", value);
|
|
932
965
|
if (!raw) {
|
|
933
966
|
return void 0;
|
|
934
967
|
}
|
|
935
|
-
return path13.isAbsolute(raw) ? path13.normalize(raw) : path13.resolve(
|
|
968
|
+
return path13.isAbsolute(raw) ? path13.normalize(raw) : path13.resolve(process13.cwd(), raw);
|
|
936
969
|
}
|
|
937
970
|
|
|
938
971
|
// src/cli/helpers/patch-cwd.ts
|
|
939
972
|
import path14 from "path";
|
|
940
|
-
import
|
|
973
|
+
import process14 from "process";
|
|
941
974
|
|
|
942
975
|
// src/tailwindcss/index.ts
|
|
943
976
|
import { getPackageInfoSync } from "local-pkg";
|
|
@@ -964,15 +997,15 @@ function detectTailwindWorkspace(paths) {
|
|
|
964
997
|
}
|
|
965
998
|
return void 0;
|
|
966
999
|
}
|
|
967
|
-
function resolvePatchDefaultCwd(currentCwd =
|
|
1000
|
+
function resolvePatchDefaultCwd(currentCwd = process14.cwd()) {
|
|
968
1001
|
const baseDir = path14.normalize(currentCwd);
|
|
969
|
-
const explicitCwd = normalizeCandidatePath(baseDir,
|
|
1002
|
+
const explicitCwd = normalizeCandidatePath(baseDir, process14.env.WEAPP_TW_PATCH_CWD);
|
|
970
1003
|
if (explicitCwd) {
|
|
971
1004
|
return explicitCwd;
|
|
972
1005
|
}
|
|
973
1006
|
const workspaceRoot = findWorkspaceRoot(baseDir);
|
|
974
|
-
const initCwd = normalizeCandidatePath(baseDir,
|
|
975
|
-
const localPrefix = normalizeCandidatePath(baseDir,
|
|
1007
|
+
const initCwd = normalizeCandidatePath(baseDir, process14.env.INIT_CWD);
|
|
1008
|
+
const localPrefix = normalizeCandidatePath(baseDir, process14.env.npm_config_local_prefix);
|
|
976
1009
|
const candidates = [
|
|
977
1010
|
baseDir,
|
|
978
1011
|
workspaceRoot,
|
|
@@ -992,12 +1025,12 @@ async function ensureDir(dir) {
|
|
|
992
1025
|
}
|
|
993
1026
|
function handleCliError(error) {
|
|
994
1027
|
if (error instanceof Error) {
|
|
995
|
-
|
|
996
|
-
if (error.stack &&
|
|
997
|
-
|
|
1028
|
+
logger12.error(error.message);
|
|
1029
|
+
if (error.stack && process15.env.WEAPP_TW_DEBUG === "1") {
|
|
1030
|
+
logger12.error(error.stack);
|
|
998
1031
|
}
|
|
999
1032
|
} else {
|
|
1000
|
-
|
|
1033
|
+
logger12.error(String(error));
|
|
1001
1034
|
}
|
|
1002
1035
|
}
|
|
1003
1036
|
function commandAction(handler) {
|
|
@@ -1006,13 +1039,13 @@ function commandAction(handler) {
|
|
|
1006
1039
|
await handler(...args);
|
|
1007
1040
|
} catch (error) {
|
|
1008
1041
|
handleCliError(error);
|
|
1009
|
-
|
|
1042
|
+
process15.exitCode = 1;
|
|
1010
1043
|
}
|
|
1011
1044
|
};
|
|
1012
1045
|
}
|
|
1013
1046
|
|
|
1014
1047
|
// src/cli/mount-options.ts
|
|
1015
|
-
import
|
|
1048
|
+
import process17 from "process";
|
|
1016
1049
|
|
|
1017
1050
|
// src/cli/mount-options/patch-status.ts
|
|
1018
1051
|
function formatStatusFilesHint(files) {
|
|
@@ -1028,27 +1061,27 @@ function logPatchStatusReport(report) {
|
|
|
1028
1061
|
(entry) => entry.status === "skipped" || entry.status === "unsupported"
|
|
1029
1062
|
);
|
|
1030
1063
|
const packageLabel = `${report.package.name ?? "tailwindcss"}@${report.package.version ?? "unknown"}`;
|
|
1031
|
-
|
|
1064
|
+
logger12.info(`Patch status for ${packageLabel} (v${report.majorVersion})`);
|
|
1032
1065
|
if (applied.length) {
|
|
1033
|
-
|
|
1066
|
+
logger12.success("Applied:");
|
|
1034
1067
|
applied.forEach((entry) => {
|
|
1035
|
-
|
|
1068
|
+
logger12.success(` - ${entry.name}${formatStatusFilesHint(entry.files)}`);
|
|
1036
1069
|
});
|
|
1037
1070
|
}
|
|
1038
1071
|
if (pending.length) {
|
|
1039
|
-
|
|
1072
|
+
logger12.warn("Needs attention:");
|
|
1040
1073
|
pending.forEach((entry) => {
|
|
1041
1074
|
const details = entry.reason ? ` - ${entry.reason}` : "";
|
|
1042
|
-
|
|
1075
|
+
logger12.warn(` - ${entry.name}${formatStatusFilesHint(entry.files)}${details}`);
|
|
1043
1076
|
});
|
|
1044
1077
|
} else {
|
|
1045
|
-
|
|
1078
|
+
logger12.success("All applicable patches are applied.");
|
|
1046
1079
|
}
|
|
1047
1080
|
if (skipped.length) {
|
|
1048
|
-
|
|
1081
|
+
logger12.info("Skipped:");
|
|
1049
1082
|
skipped.forEach((entry) => {
|
|
1050
1083
|
const details = entry.reason ? ` - ${entry.reason}` : "";
|
|
1051
|
-
|
|
1084
|
+
logger12.info(` - ${entry.name}${details}`);
|
|
1052
1085
|
});
|
|
1053
1086
|
}
|
|
1054
1087
|
}
|
|
@@ -1088,7 +1121,7 @@ function buildExtendLengthUnitsOverride(options) {
|
|
|
1088
1121
|
|
|
1089
1122
|
// src/cli/workspace.ts
|
|
1090
1123
|
import path19 from "path";
|
|
1091
|
-
import
|
|
1124
|
+
import process16 from "process";
|
|
1092
1125
|
|
|
1093
1126
|
// src/cli/workspace/package-dirs.ts
|
|
1094
1127
|
import { existsSync as existsSync8 } from "fs";
|
|
@@ -1215,7 +1248,7 @@ function summarizeWorkspaceResults(results) {
|
|
|
1215
1248
|
const patched = results.filter((result) => result.status === "patched").length;
|
|
1216
1249
|
const skipped = results.filter((result) => result.status === "skipped").length;
|
|
1217
1250
|
const failed = results.filter((result) => result.status === "failed").length;
|
|
1218
|
-
|
|
1251
|
+
logger12.info("[workspace] \u6C47\u603B\uFF1A\u5DF2\u8865\u4E01 %d\uFF0C\u8DF3\u8FC7 %d\uFF0C\u5931\u8D25 %d", patched, skipped, failed);
|
|
1219
1252
|
}
|
|
1220
1253
|
|
|
1221
1254
|
// src/cli/workspace/patch-package.ts
|
|
@@ -1231,7 +1264,7 @@ async function patchWorkspacePackage(workspaceRoot, dir, pkgName, options) {
|
|
|
1231
1264
|
const displayName = formatDisplayName(workspaceRoot, dir, pkgName);
|
|
1232
1265
|
const tailwindInfo = getTailwindcssPackageInfo({ paths: [dir] });
|
|
1233
1266
|
if (!tailwindInfo?.rootPath) {
|
|
1234
|
-
|
|
1267
|
+
logger12.info("[workspace] \u8DF3\u8FC7 %s\uFF08tailwindcss \u672A\u5B89\u88C5\uFF09\u3002", displayName);
|
|
1235
1268
|
return {
|
|
1236
1269
|
dir,
|
|
1237
1270
|
name: pkgName,
|
|
@@ -1251,14 +1284,14 @@ async function patchWorkspacePackage(workspaceRoot, dir, pkgName, options) {
|
|
|
1251
1284
|
alwaysRecord: true
|
|
1252
1285
|
});
|
|
1253
1286
|
if (recorder?.message) {
|
|
1254
|
-
|
|
1287
|
+
logger12.info("[workspace] %s %s", displayName, recorder.message);
|
|
1255
1288
|
}
|
|
1256
1289
|
logTailwindcssTarget("cli", patcher, dir);
|
|
1257
1290
|
await patcher.patch();
|
|
1258
1291
|
if (recorder?.onPatched) {
|
|
1259
1292
|
await recorder.onPatched();
|
|
1260
1293
|
}
|
|
1261
|
-
|
|
1294
|
+
logger12.success("[workspace] \u5DF2\u8865\u4E01 %s", displayName);
|
|
1262
1295
|
return {
|
|
1263
1296
|
dir,
|
|
1264
1297
|
name: pkgName,
|
|
@@ -1269,7 +1302,7 @@ async function patchWorkspacePackage(workspaceRoot, dir, pkgName, options) {
|
|
|
1269
1302
|
const reason = error instanceof Error ? error.message : String(error);
|
|
1270
1303
|
const suggestion = `\u8BF7\u5728 ${dir} \u8FD0\u884C "weapp-tw patch --cwd ${dir}".`;
|
|
1271
1304
|
const message = `${reason}\uFF0C${suggestion}`;
|
|
1272
|
-
|
|
1305
|
+
logger12.error("[workspace] \u8865\u4E01\u5931\u8D25 %s\uFF1A%s", displayName, message);
|
|
1273
1306
|
return {
|
|
1274
1307
|
dir,
|
|
1275
1308
|
name: pkgName,
|
|
@@ -1281,11 +1314,11 @@ async function patchWorkspacePackage(workspaceRoot, dir, pkgName, options) {
|
|
|
1281
1314
|
|
|
1282
1315
|
// src/cli/workspace.ts
|
|
1283
1316
|
async function patchWorkspace(options) {
|
|
1284
|
-
const cwd = options.cwd ??
|
|
1317
|
+
const cwd = options.cwd ?? process16.cwd();
|
|
1285
1318
|
const workspaceRoot = findWorkspaceRoot(cwd) ?? cwd;
|
|
1286
1319
|
const packageDirs = await resolveWorkspacePackageDirs(workspaceRoot);
|
|
1287
1320
|
if (packageDirs.length === 0) {
|
|
1288
|
-
|
|
1321
|
+
logger12.warn("\u672A\u5728 %s \u68C0\u6D4B\u5230 workspace \u5305\uFF0C\u5DF2\u8DF3\u8FC7\u6279\u91CF patch\u3002", workspaceRoot);
|
|
1289
1322
|
return;
|
|
1290
1323
|
}
|
|
1291
1324
|
const results = [];
|
|
@@ -1300,12 +1333,12 @@ async function patchWorkspace(options) {
|
|
|
1300
1333
|
// src/cli/mount-options.ts
|
|
1301
1334
|
function handleCliError2(error) {
|
|
1302
1335
|
if (error instanceof Error) {
|
|
1303
|
-
|
|
1304
|
-
if (error.stack &&
|
|
1305
|
-
|
|
1336
|
+
logger12.error(error.message);
|
|
1337
|
+
if (error.stack && process17.env.WEAPP_TW_DEBUG === "1") {
|
|
1338
|
+
logger12.error(error.stack);
|
|
1306
1339
|
}
|
|
1307
1340
|
} else {
|
|
1308
|
-
|
|
1341
|
+
logger12.error(String(error));
|
|
1309
1342
|
}
|
|
1310
1343
|
}
|
|
1311
1344
|
function withCommandErrorHandling(handler) {
|
|
@@ -1314,7 +1347,7 @@ function withCommandErrorHandling(handler) {
|
|
|
1314
1347
|
return await handler(ctx, next);
|
|
1315
1348
|
} catch (error) {
|
|
1316
1349
|
handleCliError2(error);
|
|
1317
|
-
|
|
1350
|
+
process17.exitCode = 1;
|
|
1318
1351
|
return void 0;
|
|
1319
1352
|
}
|
|
1320
1353
|
});
|
|
@@ -1393,17 +1426,17 @@ var mountOptions = {
|
|
|
1393
1426
|
alwaysRecord: true
|
|
1394
1427
|
});
|
|
1395
1428
|
if (recorder?.message) {
|
|
1396
|
-
|
|
1429
|
+
logger12.info(recorder.message);
|
|
1397
1430
|
}
|
|
1398
1431
|
logTailwindcssTarget("cli", patcher, ctx.cwd);
|
|
1399
1432
|
await patcher.patch();
|
|
1400
1433
|
if (recorder?.onPatched) {
|
|
1401
1434
|
const recordPath = await recorder.onPatched();
|
|
1402
1435
|
if (recordPath) {
|
|
1403
|
-
|
|
1436
|
+
logger12.info(`\u8BB0\u5F55 weapp-tw patch \u76EE\u6807 -> ${formatOutputPath(recordPath, ctx.cwd)}`);
|
|
1404
1437
|
}
|
|
1405
1438
|
}
|
|
1406
|
-
|
|
1439
|
+
logger12.success("Tailwind CSS \u8FD0\u884C\u65F6\u8865\u4E01\u5DF2\u5B8C\u6210\u3002");
|
|
1407
1440
|
}),
|
|
1408
1441
|
extract: withCommandErrorHandling(async (_ctx, next) => next()),
|
|
1409
1442
|
tokens: withCommandErrorHandling(async (_ctx, next) => next()),
|
|
@@ -1412,7 +1445,7 @@ var mountOptions = {
|
|
|
1412
1445
|
const patcher = await createPatcherWithDefaultExtendLengthUnits(ctx);
|
|
1413
1446
|
const report = await patcher.getPatchStatus();
|
|
1414
1447
|
if (ctx.args.json) {
|
|
1415
|
-
|
|
1448
|
+
logger12.log(JSON.stringify(report, null, 2));
|
|
1416
1449
|
return report;
|
|
1417
1450
|
}
|
|
1418
1451
|
logPatchStatusReport(report);
|
|
@@ -1543,10 +1576,10 @@ async function generateVscodeIntellisenseEntry(options) {
|
|
|
1543
1576
|
}
|
|
1544
1577
|
|
|
1545
1578
|
// src/cli.ts
|
|
1546
|
-
|
|
1547
|
-
if (semver.lt(
|
|
1548
|
-
|
|
1549
|
-
`You are using Node.js ${
|
|
1579
|
+
process18.title = "node (weapp-tailwindcss)";
|
|
1580
|
+
if (semver.lt(process18.versions.node, WEAPP_TW_REQUIRED_NODE_VERSION)) {
|
|
1581
|
+
logger12.warn(
|
|
1582
|
+
`You are using Node.js ${process18.versions.node}. For weapp-tailwindcss, Node.js version >= v${WEAPP_TW_REQUIRED_NODE_VERSION} is required.`
|
|
1550
1583
|
);
|
|
1551
1584
|
}
|
|
1552
1585
|
var cli = createTailwindcssPatchCli({
|
|
@@ -1556,7 +1589,7 @@ var cli = createTailwindcssPatchCli({
|
|
|
1556
1589
|
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(
|
|
1557
1590
|
commandAction(async (options) => {
|
|
1558
1591
|
const resolvedCwd = resolveCliCwd(options.cwd);
|
|
1559
|
-
const baseDir = resolvedCwd ??
|
|
1592
|
+
const baseDir = resolvedCwd ?? process18.cwd();
|
|
1560
1593
|
const cssEntry = readStringOption("css", options.css);
|
|
1561
1594
|
if (!cssEntry) {
|
|
1562
1595
|
throw new Error('Option "--css" is required.');
|
|
@@ -1571,11 +1604,11 @@ cli.command("vscode-entry", "Generate a VS Code helper CSS for Tailwind IntelliS
|
|
|
1571
1604
|
sources,
|
|
1572
1605
|
force
|
|
1573
1606
|
});
|
|
1574
|
-
|
|
1607
|
+
logger12.success(
|
|
1575
1608
|
`VS Code helper generated -> ${formatOutputPath(result.outputPath, resolvedCwd)}`
|
|
1576
1609
|
);
|
|
1577
1610
|
})
|
|
1578
1611
|
);
|
|
1579
1612
|
cli.help();
|
|
1580
|
-
cli.version(
|
|
1613
|
+
cli.version(process18.env.npm_package_version ?? "0.0.0");
|
|
1581
1614
|
cli.parse();
|
package/dist/core.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkTT5WHNGSjs = require('./chunk-TT5WHNGS.js');
|
|
6
6
|
require('./chunk-QK6VNNNL.js');
|
|
7
7
|
require('./chunk-A5PB4KZT.js');
|
|
8
8
|
require('./chunk-DYLQ6UOI.js');
|
|
@@ -24,9 +24,9 @@ function resolveTransformWxssOptions(options) {
|
|
|
24
24
|
return _shared.defuOverrideArray.call(void 0, options, DEFAULT_MAIN_CHUNK_STYLE_OPTIONS);
|
|
25
25
|
}
|
|
26
26
|
function createContext(options = {}) {
|
|
27
|
-
const opts =
|
|
27
|
+
const opts = _chunkTT5WHNGSjs.getCompilerContext.call(void 0, options);
|
|
28
28
|
const { templateHandler, styleHandler, jsHandler, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
|
|
29
|
-
const patchRecorderState =
|
|
29
|
+
const patchRecorderState = _chunkTT5WHNGSjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
|
|
30
30
|
source: "runtime",
|
|
31
31
|
cwd: _nullishCoalesce(opts.tailwindcssBasedir, () => ( _process2.default.cwd()))
|
|
32
32
|
});
|
|
@@ -143,7 +143,7 @@ function createContext(options = {}) {
|
|
|
143
143
|
async function transformWxss(rawCss, options2) {
|
|
144
144
|
await runtimeState.patchPromise;
|
|
145
145
|
const result = await styleHandler(rawCss, resolveTransformWxssOptions(options2));
|
|
146
|
-
runtimeSet = await
|
|
146
|
+
runtimeSet = await _chunkTT5WHNGSjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
|
|
147
147
|
forceRefresh: true,
|
|
148
148
|
forceCollect: true
|
|
149
149
|
});
|
|
@@ -154,7 +154,7 @@ function createContext(options = {}) {
|
|
|
154
154
|
if (_optionalChain([options2, 'optionalAccess', _ => _.runtimeSet])) {
|
|
155
155
|
runtimeSet = options2.runtimeSet;
|
|
156
156
|
} else if (runtimeSet.size === 0) {
|
|
157
|
-
runtimeSet = await
|
|
157
|
+
runtimeSet = await _chunkTT5WHNGSjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
|
|
158
158
|
forceCollect: true
|
|
159
159
|
});
|
|
160
160
|
}
|
|
@@ -163,7 +163,7 @@ function createContext(options = {}) {
|
|
|
163
163
|
async function transformWxml(rawWxml, options2) {
|
|
164
164
|
await runtimeState.patchPromise;
|
|
165
165
|
if (!_optionalChain([options2, 'optionalAccess', _2 => _2.runtimeSet]) && runtimeSet.size === 0) {
|
|
166
|
-
runtimeSet = await
|
|
166
|
+
runtimeSet = await _chunkTT5WHNGSjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
|
|
167
167
|
forceCollect: true
|
|
168
168
|
});
|
|
169
169
|
}
|
package/dist/core.mjs
CHANGED
package/dist/gulp.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkSUKOZ6OGjs = require('./chunk-SUKOZ6OG.js');
|
|
4
4
|
require('./chunk-OF6MFURR.js');
|
|
5
|
-
require('./chunk-
|
|
5
|
+
require('./chunk-TT5WHNGS.js');
|
|
6
6
|
require('./chunk-QK6VNNNL.js');
|
|
7
7
|
require('./chunk-A5PB4KZT.js');
|
|
8
8
|
require('./chunk-DYLQ6UOI.js');
|
|
@@ -10,4 +10,4 @@ require('./chunk-CRDOWYG4.js');
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
exports.createPlugins =
|
|
13
|
+
exports.createPlugins = _chunkSUKOZ6OGjs.createPlugins; exports.weappTailwindcss = _chunkSUKOZ6OGjs.createPlugins;
|
package/dist/gulp.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createPlugins
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ZZ36BKM5.mjs";
|
|
4
4
|
import "./chunk-76S2EME4.mjs";
|
|
5
|
-
import "./chunk-
|
|
5
|
+
import "./chunk-AB2RGZQO.mjs";
|
|
6
6
|
import "./chunk-OMARW5NC.mjs";
|
|
7
7
|
import "./chunk-XAKAD2CR.mjs";
|
|
8
8
|
import "./chunk-OOHJLO5M.mjs";
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('./chunk-
|
|
4
|
+
var _chunk3QHYEMEWjs = require('./chunk-3QHYEMEW.js');
|
|
5
|
+
require('./chunk-AV3XB6EQ.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkSUKOZ6OGjs = require('./chunk-SUKOZ6OG.js');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkWJIRXC26js = require('./chunk-WJIRXC26.js');
|
|
12
12
|
require('./chunk-7LKMJZD2.js');
|
|
13
13
|
require('./chunk-OF6MFURR.js');
|
|
14
|
-
require('./chunk-
|
|
14
|
+
require('./chunk-TT5WHNGS.js');
|
|
15
15
|
require('./chunk-QK6VNNNL.js');
|
|
16
16
|
require('./chunk-A5PB4KZT.js');
|
|
17
17
|
require('./chunk-DYLQ6UOI.js');
|
|
@@ -21,4 +21,4 @@ require('./chunk-CRDOWYG4.js');
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
exports.UnifiedViteWeappTailwindcssPlugin =
|
|
24
|
+
exports.UnifiedViteWeappTailwindcssPlugin = _chunkWJIRXC26js.UnifiedViteWeappTailwindcssPlugin; exports.UnifiedWebpackPluginV5 = _chunk3QHYEMEWjs.UnifiedWebpackPluginV5; exports.createPlugins = _chunkSUKOZ6OGjs.createPlugins; exports.weappTailwindcssPackageDir = _chunk3QHYEMEWjs.weappTailwindcssPackageDir;
|
package/dist/index.mjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
UnifiedWebpackPluginV5,
|
|
3
3
|
weappTailwindcssPackageDir
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-VGPAKLMZ.mjs";
|
|
5
|
+
import "./chunk-JIERVBTX.mjs";
|
|
6
6
|
import {
|
|
7
7
|
createPlugins
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-ZZ36BKM5.mjs";
|
|
9
9
|
import {
|
|
10
10
|
UnifiedViteWeappTailwindcssPlugin
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-W3DXDWYC.mjs";
|
|
12
12
|
import "./chunk-F2CKKG6Q.mjs";
|
|
13
13
|
import "./chunk-76S2EME4.mjs";
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-AB2RGZQO.mjs";
|
|
15
15
|
import "./chunk-OMARW5NC.mjs";
|
|
16
16
|
import "./chunk-XAKAD2CR.mjs";
|
|
17
17
|
import "./chunk-OOHJLO5M.mjs";
|