weapp-tailwindcss 4.9.2 → 4.9.3
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-DNRNFN4I.js → chunk-3UOPODB3.js} +44 -44
- package/dist/{chunk-2L6NDZIQ.mjs → chunk-4HESZS5A.mjs} +2 -2
- package/dist/{chunk-5O6237HX.js → chunk-4RUFPPI6.js} +400 -377
- package/dist/{chunk-ZE7JKKFT.mjs → chunk-7D27E7TU.mjs} +438 -415
- package/dist/{chunk-W3MTTQ5M.js → chunk-A2BRI46M.js} +5 -5
- package/dist/{chunk-3SKEY32E.mjs → chunk-F2CKKG6Q.mjs} +67 -67
- package/dist/{chunk-VU2GIXVH.js → chunk-I3IRT5VH.js} +7 -7
- package/dist/chunk-IMOEZLDR.js +441 -0
- package/dist/{chunk-WGBJY2H3.mjs → chunk-IW3B6ZJD.mjs} +646 -565
- package/dist/{chunk-U7BH6QHE.js → chunk-KXZ4MP4L.js} +277 -236
- package/dist/chunk-PU5CC4ZI.mjs +444 -0
- package/dist/{chunk-FFGR5V3H.mjs → chunk-SPH6SCTM.mjs} +1 -1
- package/dist/{chunk-XXJNXESJ.js → chunk-VOD2WUH6.js} +635 -554
- package/dist/{chunk-2WPTDMN3.js → chunk-VPHA77FH.js} +61 -61
- package/dist/{chunk-CBOVUIXD.mjs → chunk-WH65CIYG.mjs} +41 -41
- package/dist/{chunk-UAEME5HT.js → chunk-Y6F6NBA7.js} +1 -1
- package/dist/{chunk-DSD5JRCQ.mjs → chunk-Z2D5NSG5.mjs} +265 -224
- package/dist/{chunk-G5OV7IOU.mjs → chunk-ZL22KEHH.mjs} +2 -2
- package/dist/cli.js +182 -136
- package/dist/cli.mjs +194 -148
- package/dist/core.js +10 -10
- package/dist/core.mjs +4 -4
- 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.js +1 -1
- package/dist/defaults.mjs +1 -1
- package/dist/gulp.js +6 -6
- package/dist/gulp.mjs +5 -5
- package/dist/index.js +10 -10
- package/dist/index.mjs +9 -9
- package/dist/postcss-html-transform.js +1 -1
- package/dist/postcss-html-transform.mjs +1 -1
- package/dist/presets.js +5 -5
- package/dist/presets.mjs +2 -2
- package/dist/reset.d.mts +2 -1
- package/dist/reset.d.ts +2 -1
- package/dist/reset.js +25 -21
- package/dist/reset.mjs +25 -21
- package/dist/types.d.mts +503 -474
- package/dist/types.d.ts +503 -474
- package/dist/types.js +1 -1
- package/dist/types.mjs +1 -1
- package/dist/vite.js +7 -7
- package/dist/vite.mjs +6 -6
- package/dist/weapp-tw-css-import-rewrite-loader.js +2 -4
- package/dist/webpack.js +8 -8
- package/dist/webpack.mjs +7 -7
- package/dist/webpack4.js +351 -307
- package/dist/webpack4.mjs +341 -297
- package/package.json +10 -10
- package/dist/chunk-5AKI6FQP.mjs +0 -397
- package/dist/chunk-SNEMGP42.js +0 -394
package/dist/cli.js
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkVOD2WUH6js = require('./chunk-VOD2WUH6.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunk4RUFPPI6js = require('./chunk-4RUFPPI6.js');
|
|
11
11
|
require('./chunk-FYYBY3VK.js');
|
|
12
12
|
require('./chunk-DYLQ6UOI.js');
|
|
13
|
-
require('./chunk-
|
|
13
|
+
require('./chunk-Y6F6NBA7.js');
|
|
14
14
|
|
|
15
15
|
// src/cli.ts
|
|
16
16
|
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
@@ -36,14 +36,7 @@ function formatOutputPath(target, baseDir) {
|
|
|
36
36
|
var _promises = require('fs/promises');
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
// src/tailwindcss/index.ts
|
|
41
|
-
var _localpkg = require('local-pkg');
|
|
42
|
-
function getTailwindcssPackageInfo(options) {
|
|
43
|
-
return _localpkg.getPackageInfoSync.call(void 0, "tailwindcss", options);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// src/cli/helpers.ts
|
|
39
|
+
// src/cli/helpers/options/parse.ts
|
|
47
40
|
function readStringOption(flag, value) {
|
|
48
41
|
if (value == null) {
|
|
49
42
|
return void 0;
|
|
@@ -94,6 +87,10 @@ function toBoolean(value, fallback) {
|
|
|
94
87
|
}
|
|
95
88
|
return Boolean(value);
|
|
96
89
|
}
|
|
90
|
+
|
|
91
|
+
// src/cli/helpers/options/resolve.ts
|
|
92
|
+
|
|
93
|
+
|
|
97
94
|
function resolveCliCwd(value) {
|
|
98
95
|
const raw = readStringOption("cwd", value);
|
|
99
96
|
if (!raw) {
|
|
@@ -101,6 +98,18 @@ function resolveCliCwd(value) {
|
|
|
101
98
|
}
|
|
102
99
|
return _path2.default.isAbsolute(raw) ? _path2.default.normalize(raw) : _path2.default.resolve(_process2.default.cwd(), raw);
|
|
103
100
|
}
|
|
101
|
+
|
|
102
|
+
// src/cli/helpers/patch-cwd.ts
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
// src/tailwindcss/index.ts
|
|
107
|
+
var _localpkg = require('local-pkg');
|
|
108
|
+
function getTailwindcssPackageInfo(options) {
|
|
109
|
+
return _localpkg.getPackageInfoSync.call(void 0, "tailwindcss", options);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// src/cli/helpers/patch-cwd.ts
|
|
104
113
|
function normalizeCandidatePath(baseDir, candidate) {
|
|
105
114
|
if (!candidate) {
|
|
106
115
|
return void 0;
|
|
@@ -125,7 +134,7 @@ function resolvePatchDefaultCwd(currentCwd = _process2.default.cwd()) {
|
|
|
125
134
|
if (explicitCwd) {
|
|
126
135
|
return explicitCwd;
|
|
127
136
|
}
|
|
128
|
-
const workspaceRoot =
|
|
137
|
+
const workspaceRoot = _chunk4RUFPPI6js.findWorkspaceRoot.call(void 0, baseDir);
|
|
129
138
|
const initCwd = normalizeCandidatePath(baseDir, _process2.default.env.INIT_CWD);
|
|
130
139
|
const localPrefix = normalizeCandidatePath(baseDir, _process2.default.env.npm_config_local_prefix);
|
|
131
140
|
const candidates = [
|
|
@@ -140,17 +149,19 @@ function resolvePatchDefaultCwd(currentCwd = _process2.default.cwd()) {
|
|
|
140
149
|
}
|
|
141
150
|
return _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(initCwd, () => ( localPrefix)), () => ( workspaceRoot)), () => ( baseDir));
|
|
142
151
|
}
|
|
152
|
+
|
|
153
|
+
// src/cli/helpers.ts
|
|
143
154
|
async function ensureDir(dir) {
|
|
144
155
|
await _promises.mkdir.call(void 0, dir, { recursive: true });
|
|
145
156
|
}
|
|
146
157
|
function handleCliError(error) {
|
|
147
158
|
if (error instanceof Error) {
|
|
148
|
-
|
|
159
|
+
_chunk4RUFPPI6js.logger.error(error.message);
|
|
149
160
|
if (error.stack && _process2.default.env.WEAPP_TW_DEBUG === "1") {
|
|
150
|
-
|
|
161
|
+
_chunk4RUFPPI6js.logger.error(error.stack);
|
|
151
162
|
}
|
|
152
163
|
} else {
|
|
153
|
-
|
|
164
|
+
_chunk4RUFPPI6js.logger.error(String(error));
|
|
154
165
|
}
|
|
155
166
|
}
|
|
156
167
|
function commandAction(handler) {
|
|
@@ -167,6 +178,45 @@ function commandAction(handler) {
|
|
|
167
178
|
// src/cli/mount-options.ts
|
|
168
179
|
|
|
169
180
|
|
|
181
|
+
// src/cli/mount-options/patch-status.ts
|
|
182
|
+
function formatStatusFilesHint(files) {
|
|
183
|
+
if (!_optionalChain([files, 'optionalAccess', _2 => _2.length])) {
|
|
184
|
+
return "";
|
|
185
|
+
}
|
|
186
|
+
return ` (${files.join(", ")})`;
|
|
187
|
+
}
|
|
188
|
+
function logPatchStatusReport(report) {
|
|
189
|
+
const applied = report.entries.filter((entry) => entry.status === "applied");
|
|
190
|
+
const pending = report.entries.filter((entry) => entry.status === "not-applied");
|
|
191
|
+
const skipped = report.entries.filter(
|
|
192
|
+
(entry) => entry.status === "skipped" || entry.status === "unsupported"
|
|
193
|
+
);
|
|
194
|
+
const packageLabel = `${_nullishCoalesce(report.package.name, () => ( "tailwindcss"))}@${_nullishCoalesce(report.package.version, () => ( "unknown"))}`;
|
|
195
|
+
_chunk4RUFPPI6js.logger.info(`Patch status for ${packageLabel} (v${report.majorVersion})`);
|
|
196
|
+
if (applied.length) {
|
|
197
|
+
_chunk4RUFPPI6js.logger.success("Applied:");
|
|
198
|
+
applied.forEach((entry) => {
|
|
199
|
+
_chunk4RUFPPI6js.logger.success(` - ${entry.name}${formatStatusFilesHint(entry.files)}`);
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
if (pending.length) {
|
|
203
|
+
_chunk4RUFPPI6js.logger.warn("Needs attention:");
|
|
204
|
+
pending.forEach((entry) => {
|
|
205
|
+
const details = entry.reason ? ` - ${entry.reason}` : "";
|
|
206
|
+
_chunk4RUFPPI6js.logger.warn(` - ${entry.name}${formatStatusFilesHint(entry.files)}${details}`);
|
|
207
|
+
});
|
|
208
|
+
} else {
|
|
209
|
+
_chunk4RUFPPI6js.logger.success("All applicable patches are applied.");
|
|
210
|
+
}
|
|
211
|
+
if (skipped.length) {
|
|
212
|
+
_chunk4RUFPPI6js.logger.info("Skipped:");
|
|
213
|
+
skipped.forEach((entry) => {
|
|
214
|
+
const details = entry.reason ? ` - ${entry.reason}` : "";
|
|
215
|
+
_chunk4RUFPPI6js.logger.info(` - ${entry.name}${details}`);
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
170
220
|
// src/cli/patch-options.ts
|
|
171
221
|
var DEFAULT_EXTEND_LENGTH_UNITS_FEATURE = {
|
|
172
222
|
enabled: true,
|
|
@@ -175,7 +225,7 @@ var DEFAULT_EXTEND_LENGTH_UNITS_FEATURE = {
|
|
|
175
225
|
};
|
|
176
226
|
function withDefaultExtendLengthUnits(options) {
|
|
177
227
|
const normalized = _nullishCoalesce(options, () => ( {}));
|
|
178
|
-
const extendLengthUnits = _optionalChain([normalized, 'access',
|
|
228
|
+
const extendLengthUnits = _optionalChain([normalized, 'access', _3 => _3.features, 'optionalAccess', _4 => _4.extendLengthUnits]);
|
|
179
229
|
if (extendLengthUnits == null) {
|
|
180
230
|
return {
|
|
181
231
|
...normalized,
|
|
@@ -188,11 +238,11 @@ function withDefaultExtendLengthUnits(options) {
|
|
|
188
238
|
return normalized;
|
|
189
239
|
}
|
|
190
240
|
function buildExtendLengthUnitsOverride(options) {
|
|
191
|
-
const extendLengthUnits = _optionalChain([options, 'optionalAccess',
|
|
241
|
+
const extendLengthUnits = _optionalChain([options, 'optionalAccess', _5 => _5.features, 'optionalAccess', _6 => _6.extendLengthUnits]);
|
|
192
242
|
if (extendLengthUnits == null) {
|
|
193
243
|
return {
|
|
194
244
|
features: {
|
|
195
|
-
..._nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
245
|
+
..._nullishCoalesce(_optionalChain([options, 'optionalAccess', _7 => _7.features]), () => ( {})),
|
|
196
246
|
extendLengthUnits: DEFAULT_EXTEND_LENGTH_UNITS_FEATURE
|
|
197
247
|
}
|
|
198
248
|
};
|
|
@@ -201,12 +251,21 @@ function buildExtendLengthUnitsOverride(options) {
|
|
|
201
251
|
}
|
|
202
252
|
|
|
203
253
|
// src/cli/workspace.ts
|
|
204
|
-
var _fs = require('fs');
|
|
205
254
|
|
|
206
255
|
|
|
256
|
+
|
|
257
|
+
// src/cli/workspace/package-dirs.ts
|
|
258
|
+
var _fs = require('fs');
|
|
259
|
+
|
|
207
260
|
var _fastglob = require('fast-glob'); var _fastglob2 = _interopRequireDefault(_fastglob);
|
|
208
261
|
|
|
262
|
+
// src/cli/workspace/workspace-globs.ts
|
|
263
|
+
|
|
264
|
+
|
|
209
265
|
var _yaml = require('yaml');
|
|
266
|
+
|
|
267
|
+
// src/cli/workspace/workspace-io.ts
|
|
268
|
+
|
|
210
269
|
function tryReadJson(file) {
|
|
211
270
|
try {
|
|
212
271
|
const content = _fs.readFileSync.call(void 0, file, "utf8");
|
|
@@ -215,10 +274,12 @@ function tryReadJson(file) {
|
|
|
215
274
|
return void 0;
|
|
216
275
|
}
|
|
217
276
|
}
|
|
277
|
+
|
|
278
|
+
// src/cli/workspace/workspace-globs.ts
|
|
218
279
|
function parseWorkspaceGlobsFromPackageJson(workspaceRoot) {
|
|
219
280
|
const pkgJsonPath = _path2.default.join(workspaceRoot, "package.json");
|
|
220
281
|
const pkg = tryReadJson(pkgJsonPath);
|
|
221
|
-
if (!_optionalChain([pkg, 'optionalAccess',
|
|
282
|
+
if (!_optionalChain([pkg, 'optionalAccess', _8 => _8.workspaces])) {
|
|
222
283
|
return [];
|
|
223
284
|
}
|
|
224
285
|
if (Array.isArray(pkg.workspaces)) {
|
|
@@ -236,11 +297,16 @@ function parseWorkspaceGlobsFromWorkspaceFile(workspaceRoot) {
|
|
|
236
297
|
}
|
|
237
298
|
try {
|
|
238
299
|
const parsed = _yaml.parse.call(void 0, _fs.readFileSync.call(void 0, workspaceFile, "utf8"));
|
|
239
|
-
return Array.isArray(_optionalChain([parsed, 'optionalAccess',
|
|
300
|
+
return Array.isArray(_optionalChain([parsed, 'optionalAccess', _9 => _9.packages])) ? parsed.packages.filter(Boolean) : [];
|
|
240
301
|
} catch (e3) {
|
|
241
302
|
return [];
|
|
242
303
|
}
|
|
243
304
|
}
|
|
305
|
+
|
|
306
|
+
// src/cli/workspace/workspace-lock.ts
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
|
|
244
310
|
function parseImportersFromLock(workspaceRoot) {
|
|
245
311
|
const lockPath = _path2.default.join(workspaceRoot, "pnpm-lock.yaml");
|
|
246
312
|
if (!_fs.existsSync.call(void 0, lockPath)) {
|
|
@@ -248,7 +314,7 @@ function parseImportersFromLock(workspaceRoot) {
|
|
|
248
314
|
}
|
|
249
315
|
try {
|
|
250
316
|
const parsed = _yaml.parse.call(void 0, _fs.readFileSync.call(void 0, lockPath, "utf8"));
|
|
251
|
-
const importers = _optionalChain([parsed, 'optionalAccess',
|
|
317
|
+
const importers = _optionalChain([parsed, 'optionalAccess', _10 => _10.importers]);
|
|
252
318
|
if (!importers) {
|
|
253
319
|
return [];
|
|
254
320
|
}
|
|
@@ -262,6 +328,8 @@ function parseImportersFromLock(workspaceRoot) {
|
|
|
262
328
|
return [];
|
|
263
329
|
}
|
|
264
330
|
}
|
|
331
|
+
|
|
332
|
+
// src/cli/workspace/package-dirs.ts
|
|
265
333
|
async function resolveWorkspacePackageDirs(workspaceRoot) {
|
|
266
334
|
const dirs = /* @__PURE__ */ new Set();
|
|
267
335
|
for (const importerDir of parseImportersFromLock(workspaceRoot)) {
|
|
@@ -295,6 +363,24 @@ async function resolveWorkspacePackageDirs(workspaceRoot) {
|
|
|
295
363
|
}
|
|
296
364
|
return [...dirs];
|
|
297
365
|
}
|
|
366
|
+
|
|
367
|
+
// src/cli/workspace/patch-package.ts
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
// src/cli/workspace/patch-utils.ts
|
|
371
|
+
|
|
372
|
+
function formatDisplayName(workspaceRoot, dir, name) {
|
|
373
|
+
const relative = _path2.default.relative(workspaceRoot, dir) || ".";
|
|
374
|
+
return name ? `${name} (${relative})` : relative;
|
|
375
|
+
}
|
|
376
|
+
function summarizeWorkspaceResults(results) {
|
|
377
|
+
const patched = results.filter((result) => result.status === "patched").length;
|
|
378
|
+
const skipped = results.filter((result) => result.status === "skipped").length;
|
|
379
|
+
const failed = results.filter((result) => result.status === "failed").length;
|
|
380
|
+
_chunk4RUFPPI6js.logger.info("[workspace] \u6C47\u603B\uFF1A\u5DF2\u8865\u4E01 %d\uFF0C\u8DF3\u8FC7 %d\uFF0C\u5931\u8D25 %d", patched, skipped, failed);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
// src/cli/workspace/patch-package.ts
|
|
298
384
|
function createWorkspacePatcher(cwd) {
|
|
299
385
|
const normalized = _tailwindcsspatch.normalizeOptions.call(void 0,
|
|
300
386
|
withDefaultExtendLengthUnits({
|
|
@@ -303,88 +389,85 @@ function createWorkspacePatcher(cwd) {
|
|
|
303
389
|
);
|
|
304
390
|
return new (0, _tailwindcsspatch.TailwindcssPatcher)(normalized);
|
|
305
391
|
}
|
|
306
|
-
function
|
|
307
|
-
const
|
|
308
|
-
|
|
392
|
+
async function patchWorkspacePackage(workspaceRoot, dir, pkgName, options) {
|
|
393
|
+
const displayName = formatDisplayName(workspaceRoot, dir, pkgName);
|
|
394
|
+
const tailwindInfo = getTailwindcssPackageInfo({ paths: [dir] });
|
|
395
|
+
if (!_optionalChain([tailwindInfo, 'optionalAccess', _11 => _11.rootPath])) {
|
|
396
|
+
_chunk4RUFPPI6js.logger.info("[workspace] \u8DF3\u8FC7 %s\uFF08tailwindcss \u672A\u5B89\u88C5\uFF09\u3002", displayName);
|
|
397
|
+
return {
|
|
398
|
+
dir,
|
|
399
|
+
name: pkgName,
|
|
400
|
+
status: "skipped",
|
|
401
|
+
message: "tailwindcss \u672A\u5B89\u88C5\uFF0C\u5DF2\u8DF3\u8FC7\u3002"
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
try {
|
|
405
|
+
const patcher = createWorkspacePatcher(dir);
|
|
406
|
+
if (options.clearCache) {
|
|
407
|
+
await _chunkVOD2WUH6js.clearTailwindcssPatcherCache.call(void 0, patcher, { removeDirectory: true });
|
|
408
|
+
}
|
|
409
|
+
const recorder = _chunkVOD2WUH6js.createPatchTargetRecorder.call(void 0, dir, patcher, {
|
|
410
|
+
source: "cli",
|
|
411
|
+
cwd: dir,
|
|
412
|
+
recordTarget: options.recordTarget !== false,
|
|
413
|
+
alwaysRecord: true
|
|
414
|
+
});
|
|
415
|
+
if (_optionalChain([recorder, 'optionalAccess', _12 => _12.message])) {
|
|
416
|
+
_chunk4RUFPPI6js.logger.info("[workspace] %s %s", displayName, recorder.message);
|
|
417
|
+
}
|
|
418
|
+
_chunkVOD2WUH6js.logTailwindcssTarget.call(void 0, "cli", patcher, dir);
|
|
419
|
+
await patcher.patch();
|
|
420
|
+
if (_optionalChain([recorder, 'optionalAccess', _13 => _13.onPatched])) {
|
|
421
|
+
await recorder.onPatched();
|
|
422
|
+
}
|
|
423
|
+
_chunk4RUFPPI6js.logger.success("[workspace] \u5DF2\u8865\u4E01 %s", displayName);
|
|
424
|
+
return {
|
|
425
|
+
dir,
|
|
426
|
+
name: pkgName,
|
|
427
|
+
status: "patched",
|
|
428
|
+
message: "\u5DF2\u5B8C\u6210 patch\u3002"
|
|
429
|
+
};
|
|
430
|
+
} catch (error) {
|
|
431
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
432
|
+
const suggestion = `\u8BF7\u5728 ${dir} \u8FD0\u884C "weapp-tw patch --cwd ${dir}".`;
|
|
433
|
+
const message = `${reason}\uFF0C${suggestion}`;
|
|
434
|
+
_chunk4RUFPPI6js.logger.error("[workspace] \u8865\u4E01\u5931\u8D25 %s\uFF1A%s", displayName, message);
|
|
435
|
+
return {
|
|
436
|
+
dir,
|
|
437
|
+
name: pkgName,
|
|
438
|
+
status: "failed",
|
|
439
|
+
message
|
|
440
|
+
};
|
|
441
|
+
}
|
|
309
442
|
}
|
|
443
|
+
|
|
444
|
+
// src/cli/workspace.ts
|
|
310
445
|
async function patchWorkspace(options) {
|
|
311
446
|
const cwd = _nullishCoalesce(options.cwd, () => ( _process2.default.cwd()));
|
|
312
|
-
const workspaceRoot = _nullishCoalesce(
|
|
447
|
+
const workspaceRoot = _nullishCoalesce(_chunk4RUFPPI6js.findWorkspaceRoot.call(void 0, cwd), () => ( cwd));
|
|
313
448
|
const packageDirs = await resolveWorkspacePackageDirs(workspaceRoot);
|
|
314
449
|
if (packageDirs.length === 0) {
|
|
315
|
-
|
|
450
|
+
_chunk4RUFPPI6js.logger.warn("\u672A\u5728 %s \u68C0\u6D4B\u5230 workspace \u5305\uFF0C\u5DF2\u8DF3\u8FC7\u6279\u91CF patch\u3002", workspaceRoot);
|
|
316
451
|
return;
|
|
317
452
|
}
|
|
318
453
|
const results = [];
|
|
319
454
|
for (const dir of packageDirs) {
|
|
320
455
|
const pkgJsonPath = _path2.default.join(dir, "package.json");
|
|
321
456
|
const pkgJson = tryReadJson(pkgJsonPath);
|
|
322
|
-
|
|
323
|
-
const tailwindInfo = getTailwindcssPackageInfo({ paths: [dir] });
|
|
324
|
-
if (!_optionalChain([tailwindInfo, 'optionalAccess', _11 => _11.rootPath])) {
|
|
325
|
-
results.push({
|
|
326
|
-
dir,
|
|
327
|
-
name: _optionalChain([pkgJson, 'optionalAccess', _12 => _12.name]),
|
|
328
|
-
status: "skipped",
|
|
329
|
-
message: "tailwindcss \u672A\u5B89\u88C5\uFF0C\u5DF2\u8DF3\u8FC7\u3002"
|
|
330
|
-
});
|
|
331
|
-
_chunk5O6237HXjs.logger.info("[workspace] \u8DF3\u8FC7 %s\uFF08tailwindcss \u672A\u5B89\u88C5\uFF09\u3002", displayName);
|
|
332
|
-
continue;
|
|
333
|
-
}
|
|
334
|
-
try {
|
|
335
|
-
const patcher = createWorkspacePatcher(dir);
|
|
336
|
-
if (options.clearCache) {
|
|
337
|
-
await _chunkXXJNXESJjs.clearTailwindcssPatcherCache.call(void 0, patcher, { removeDirectory: true });
|
|
338
|
-
}
|
|
339
|
-
const recorder = _chunkXXJNXESJjs.createPatchTargetRecorder.call(void 0, dir, patcher, {
|
|
340
|
-
source: "cli",
|
|
341
|
-
cwd: dir,
|
|
342
|
-
recordTarget: options.recordTarget !== false,
|
|
343
|
-
alwaysRecord: true
|
|
344
|
-
});
|
|
345
|
-
if (_optionalChain([recorder, 'optionalAccess', _13 => _13.message])) {
|
|
346
|
-
_chunk5O6237HXjs.logger.info("[workspace] %s %s", displayName, recorder.message);
|
|
347
|
-
}
|
|
348
|
-
_chunkXXJNXESJjs.logTailwindcssTarget.call(void 0, "cli", patcher, dir);
|
|
349
|
-
await patcher.patch();
|
|
350
|
-
if (_optionalChain([recorder, 'optionalAccess', _14 => _14.onPatched])) {
|
|
351
|
-
await recorder.onPatched();
|
|
352
|
-
}
|
|
353
|
-
results.push({
|
|
354
|
-
dir,
|
|
355
|
-
name: _optionalChain([pkgJson, 'optionalAccess', _15 => _15.name]),
|
|
356
|
-
status: "patched",
|
|
357
|
-
message: "\u5DF2\u5B8C\u6210 patch\u3002"
|
|
358
|
-
});
|
|
359
|
-
_chunk5O6237HXjs.logger.success("[workspace] \u5DF2\u8865\u4E01 %s", displayName);
|
|
360
|
-
} catch (error) {
|
|
361
|
-
const reason = error instanceof Error ? error.message : String(error);
|
|
362
|
-
const suggestion = `\u8BF7\u5728 ${dir} \u8FD0\u884C "weapp-tw patch --cwd ${dir}".`;
|
|
363
|
-
const message = `${reason}\uFF0C${suggestion}`;
|
|
364
|
-
results.push({
|
|
365
|
-
dir,
|
|
366
|
-
name: _optionalChain([pkgJson, 'optionalAccess', _16 => _16.name]),
|
|
367
|
-
status: "failed",
|
|
368
|
-
message
|
|
369
|
-
});
|
|
370
|
-
_chunk5O6237HXjs.logger.error("[workspace] \u8865\u4E01\u5931\u8D25 %s\uFF1A%s", displayName, message);
|
|
371
|
-
}
|
|
457
|
+
results.push(await patchWorkspacePackage(workspaceRoot, dir, _optionalChain([pkgJson, 'optionalAccess', _14 => _14.name]), options));
|
|
372
458
|
}
|
|
373
|
-
|
|
374
|
-
const skipped = results.filter((result) => result.status === "skipped").length;
|
|
375
|
-
const failed = results.filter((result) => result.status === "failed").length;
|
|
376
|
-
_chunk5O6237HXjs.logger.info("[workspace] \u6C47\u603B\uFF1A\u5DF2\u8865\u4E01 %d\uFF0C\u8DF3\u8FC7 %d\uFF0C\u5931\u8D25 %d", patched, skipped, failed);
|
|
459
|
+
summarizeWorkspaceResults(results);
|
|
377
460
|
}
|
|
378
461
|
|
|
379
462
|
// src/cli/mount-options.ts
|
|
380
463
|
function handleCliError2(error) {
|
|
381
464
|
if (error instanceof Error) {
|
|
382
|
-
|
|
465
|
+
_chunk4RUFPPI6js.logger.error(error.message);
|
|
383
466
|
if (error.stack && _process2.default.env.WEAPP_TW_DEBUG === "1") {
|
|
384
|
-
|
|
467
|
+
_chunk4RUFPPI6js.logger.error(error.stack);
|
|
385
468
|
}
|
|
386
469
|
} else {
|
|
387
|
-
|
|
470
|
+
_chunk4RUFPPI6js.logger.error(String(error));
|
|
388
471
|
}
|
|
389
472
|
}
|
|
390
473
|
function withCommandErrorHandling(handler) {
|
|
@@ -406,43 +489,6 @@ async function createPatcherWithDefaultExtendLengthUnits(ctx) {
|
|
|
406
489
|
}
|
|
407
490
|
return ctx.createPatcher();
|
|
408
491
|
}
|
|
409
|
-
function formatStatusFilesHint(files) {
|
|
410
|
-
if (!_optionalChain([files, 'optionalAccess', _17 => _17.length])) {
|
|
411
|
-
return "";
|
|
412
|
-
}
|
|
413
|
-
return ` (${files.join(", ")})`;
|
|
414
|
-
}
|
|
415
|
-
function logPatchStatusReport(report) {
|
|
416
|
-
const applied = report.entries.filter((entry) => entry.status === "applied");
|
|
417
|
-
const pending = report.entries.filter((entry) => entry.status === "not-applied");
|
|
418
|
-
const skipped = report.entries.filter(
|
|
419
|
-
(entry) => entry.status === "skipped" || entry.status === "unsupported"
|
|
420
|
-
);
|
|
421
|
-
const packageLabel = `${_nullishCoalesce(report.package.name, () => ( "tailwindcss"))}@${_nullishCoalesce(report.package.version, () => ( "unknown"))}`;
|
|
422
|
-
_chunk5O6237HXjs.logger.info(`Patch status for ${packageLabel} (v${report.majorVersion})`);
|
|
423
|
-
if (applied.length) {
|
|
424
|
-
_chunk5O6237HXjs.logger.success("Applied:");
|
|
425
|
-
applied.forEach((entry) => {
|
|
426
|
-
_chunk5O6237HXjs.logger.success(` - ${entry.name}${formatStatusFilesHint(entry.files)}`);
|
|
427
|
-
});
|
|
428
|
-
}
|
|
429
|
-
if (pending.length) {
|
|
430
|
-
_chunk5O6237HXjs.logger.warn("Needs attention:");
|
|
431
|
-
pending.forEach((entry) => {
|
|
432
|
-
const details = entry.reason ? ` - ${entry.reason}` : "";
|
|
433
|
-
_chunk5O6237HXjs.logger.warn(` - ${entry.name}${formatStatusFilesHint(entry.files)}${details}`);
|
|
434
|
-
});
|
|
435
|
-
} else {
|
|
436
|
-
_chunk5O6237HXjs.logger.success("All applicable patches are applied.");
|
|
437
|
-
}
|
|
438
|
-
if (skipped.length) {
|
|
439
|
-
_chunk5O6237HXjs.logger.info("Skipped:");
|
|
440
|
-
skipped.forEach((entry) => {
|
|
441
|
-
const details = entry.reason ? ` - ${entry.reason}` : "";
|
|
442
|
-
_chunk5O6237HXjs.logger.info(` - ${entry.name}${details}`);
|
|
443
|
-
});
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
492
|
var mountOptions = {
|
|
447
493
|
commandOptions: {
|
|
448
494
|
install: {
|
|
@@ -500,26 +546,26 @@ var mountOptions = {
|
|
|
500
546
|
}
|
|
501
547
|
const patcher = await createPatcherWithDefaultExtendLengthUnits(ctx);
|
|
502
548
|
if (shouldClearCache) {
|
|
503
|
-
await
|
|
549
|
+
await _chunkVOD2WUH6js.clearTailwindcssPatcherCache.call(void 0, patcher, { removeDirectory: true });
|
|
504
550
|
}
|
|
505
|
-
const recorder =
|
|
551
|
+
const recorder = _chunkVOD2WUH6js.createPatchTargetRecorder.call(void 0, ctx.cwd, patcher, {
|
|
506
552
|
source: "cli",
|
|
507
553
|
cwd: ctx.cwd,
|
|
508
554
|
recordTarget: shouldRecordTarget,
|
|
509
555
|
alwaysRecord: true
|
|
510
556
|
});
|
|
511
|
-
if (_optionalChain([recorder, 'optionalAccess',
|
|
512
|
-
|
|
557
|
+
if (_optionalChain([recorder, 'optionalAccess', _15 => _15.message])) {
|
|
558
|
+
_chunk4RUFPPI6js.logger.info(recorder.message);
|
|
513
559
|
}
|
|
514
|
-
|
|
560
|
+
_chunkVOD2WUH6js.logTailwindcssTarget.call(void 0, "cli", patcher, ctx.cwd);
|
|
515
561
|
await patcher.patch();
|
|
516
|
-
if (_optionalChain([recorder, 'optionalAccess',
|
|
562
|
+
if (_optionalChain([recorder, 'optionalAccess', _16 => _16.onPatched])) {
|
|
517
563
|
const recordPath = await recorder.onPatched();
|
|
518
564
|
if (recordPath) {
|
|
519
|
-
|
|
565
|
+
_chunk4RUFPPI6js.logger.info(`\u8BB0\u5F55 weapp-tw patch \u76EE\u6807 -> ${formatOutputPath(recordPath, ctx.cwd)}`);
|
|
520
566
|
}
|
|
521
567
|
}
|
|
522
|
-
|
|
568
|
+
_chunk4RUFPPI6js.logger.success("Tailwind CSS \u8FD0\u884C\u65F6\u8865\u4E01\u5DF2\u5B8C\u6210\u3002");
|
|
523
569
|
}),
|
|
524
570
|
extract: withCommandErrorHandling(async (_ctx, next) => next()),
|
|
525
571
|
tokens: withCommandErrorHandling(async (_ctx, next) => next()),
|
|
@@ -528,7 +574,7 @@ var mountOptions = {
|
|
|
528
574
|
const patcher = await createPatcherWithDefaultExtendLengthUnits(ctx);
|
|
529
575
|
const report = await patcher.getPatchStatus();
|
|
530
576
|
if (ctx.args.json) {
|
|
531
|
-
|
|
577
|
+
_chunk4RUFPPI6js.logger.log(JSON.stringify(report, null, 2));
|
|
532
578
|
return report;
|
|
533
579
|
}
|
|
534
580
|
logPatchStatusReport(report);
|
|
@@ -559,7 +605,7 @@ async function assertFileExists(filepath) {
|
|
|
559
605
|
await _promises.access.call(void 0, filepath, _fs.constants.F_OK);
|
|
560
606
|
} catch (error) {
|
|
561
607
|
const err = error;
|
|
562
|
-
if (_optionalChain([err, 'optionalAccess',
|
|
608
|
+
if (_optionalChain([err, 'optionalAccess', _17 => _17.code]) === "ENOENT") {
|
|
563
609
|
throw new Error(`CSS entry file not found: ${filepath}`);
|
|
564
610
|
}
|
|
565
611
|
throw err;
|
|
@@ -575,7 +621,7 @@ async function assertCanWrite(filepath, force) {
|
|
|
575
621
|
}
|
|
576
622
|
} catch (error) {
|
|
577
623
|
const err = error;
|
|
578
|
-
if (_optionalChain([err, 'optionalAccess',
|
|
624
|
+
if (_optionalChain([err, 'optionalAccess', _18 => _18.code]) === "ENOENT") {
|
|
579
625
|
return;
|
|
580
626
|
}
|
|
581
627
|
throw err;
|
|
@@ -659,9 +705,9 @@ async function generateVscodeIntellisenseEntry(options) {
|
|
|
659
705
|
|
|
660
706
|
// src/cli.ts
|
|
661
707
|
_process2.default.title = "node (weapp-tailwindcss)";
|
|
662
|
-
if (_semver2.default.lt(_process2.default.versions.node,
|
|
663
|
-
|
|
664
|
-
`You are using Node.js ${_process2.default.versions.node}. For weapp-tailwindcss, Node.js version >= v${
|
|
708
|
+
if (_semver2.default.lt(_process2.default.versions.node, _chunkVOD2WUH6js.WEAPP_TW_REQUIRED_NODE_VERSION)) {
|
|
709
|
+
_chunk4RUFPPI6js.logger.warn(
|
|
710
|
+
`You are using Node.js ${_process2.default.versions.node}. For weapp-tailwindcss, Node.js version >= v${_chunkVOD2WUH6js.WEAPP_TW_REQUIRED_NODE_VERSION} is required.`
|
|
665
711
|
);
|
|
666
712
|
}
|
|
667
713
|
var cli = _tailwindcsspatch.createTailwindcssPatchCli.call(void 0, {
|
|
@@ -686,7 +732,7 @@ cli.command("vscode-entry", "Generate a VS Code helper CSS for Tailwind IntelliS
|
|
|
686
732
|
sources,
|
|
687
733
|
force
|
|
688
734
|
});
|
|
689
|
-
|
|
735
|
+
_chunk4RUFPPI6js.logger.success(
|
|
690
736
|
`VS Code helper generated -> ${formatOutputPath(result.outputPath, resolvedCwd)}`
|
|
691
737
|
);
|
|
692
738
|
})
|