weapp-tailwindcss 4.9.0 → 4.9.2-alpha.1
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-IGTIMGCP.js → chunk-2QR4UOHA.js} +5 -5
- package/dist/{chunk-SZOXLSNK.mjs → chunk-3LRQLHOG.mjs} +25 -9
- package/dist/{chunk-A2OSQ5CV.js → chunk-D2ZOXBOU.js} +14 -14
- package/dist/chunk-DYLQ6UOI.js +71 -0
- package/dist/{chunk-QZJTOS3U.js → chunk-EOCBETCN.js} +3 -3
- package/dist/{chunk-YJ4NK2AE.mjs → chunk-FAUL26KB.mjs} +4 -4
- package/dist/{chunk-6R4BK6D6.js → chunk-FYYBY3VK.js} +5 -5
- package/dist/{chunk-GIUNRP65.mjs → chunk-GKFJPK5V.mjs} +2 -2
- package/dist/{chunk-RMTGZQHJ.js → chunk-HNNJH4ZX.js} +7 -7
- package/dist/{chunk-TFOTUR4L.mjs → chunk-HWF5U4CI.mjs} +1 -1
- package/dist/{chunk-4FB4YO6F.js → chunk-IC2XBOKV.js} +80 -57
- package/dist/{chunk-4Z6MHSEO.mjs → chunk-IK5SFZ6A.mjs} +4 -4
- package/dist/{chunk-NNYRZ4FL.js → chunk-O2XZFBRS.js} +24 -24
- package/dist/{chunk-RR5HCKVQ.mjs → chunk-OOHJLO5M.mjs} +26 -0
- package/dist/{chunk-6OOJ46QK.mjs → chunk-OU6P3233.mjs} +60 -37
- package/dist/{chunk-QJTJC5UT.mjs → chunk-VZLUWOGQ.mjs} +1 -1
- package/dist/{chunk-3M464H7S.mjs → chunk-W3Z55EVM.mjs} +2 -2
- package/dist/{chunk-PT4IJT3Q.js → chunk-Y4A76SWP.js} +27 -11
- package/dist/cli.js +40 -40
- package/dist/cli.mjs +4 -4
- package/dist/core.js +11 -11
- package/dist/core.mjs +5 -5
- package/dist/css-macro.js +2 -2
- package/dist/css-macro.mjs +1 -1
- package/dist/defaults.js +3 -3
- package/dist/defaults.mjs +2 -2
- package/dist/gulp.js +7 -7
- package/dist/gulp.mjs +6 -6
- package/dist/index.js +10 -10
- package/dist/index.mjs +9 -9
- package/dist/presets.js +12 -8
- package/dist/presets.mjs +8 -4
- package/dist/vite.js +7 -7
- package/dist/vite.mjs +6 -6
- package/dist/webpack.js +8 -8
- package/dist/webpack.mjs +7 -7
- package/dist/webpack4.js +27 -27
- package/dist/webpack4.mjs +6 -6
- package/package.json +1 -1
- package/dist/chunk-FMBPNII7.js +0 -45
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from "./chunk-RRHPTTCP.mjs";
|
|
13
13
|
import {
|
|
14
14
|
setupPatchRecorder
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-GKFJPK5V.mjs";
|
|
16
16
|
import {
|
|
17
17
|
collectRuntimeClassSet,
|
|
18
18
|
createAttributeMatcher,
|
|
@@ -23,10 +23,11 @@ import {
|
|
|
23
23
|
replaceWxml,
|
|
24
24
|
toCustomAttributesEntities,
|
|
25
25
|
vitePluginName
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-IK5SFZ6A.mjs";
|
|
27
27
|
import {
|
|
28
|
-
getGroupedEntries
|
|
29
|
-
|
|
28
|
+
getGroupedEntries,
|
|
29
|
+
resolveUniUtsPlatform
|
|
30
|
+
} from "./chunk-OOHJLO5M.mjs";
|
|
30
31
|
|
|
31
32
|
// src/bundlers/vite/index.ts
|
|
32
33
|
import { Buffer } from "buffer";
|
|
@@ -227,16 +228,22 @@ async function formatPostcssSourceMap(rawMap, file) {
|
|
|
227
228
|
// src/uni-app-x/vite.ts
|
|
228
229
|
var preprocessorLangs = /* @__PURE__ */ new Set(["scss", "sass", "less", "styl", "stylus"]);
|
|
229
230
|
function isPreprocessorRequest(id, lang) {
|
|
230
|
-
|
|
231
|
+
const normalizedLang = lang?.toLowerCase();
|
|
232
|
+
if (normalizedLang && preprocessorLangs.has(normalizedLang)) {
|
|
231
233
|
return true;
|
|
232
234
|
}
|
|
233
|
-
|
|
235
|
+
const inlineLangMatch = id.match(/lang\.([a-z]+)/i);
|
|
236
|
+
if (inlineLangMatch && preprocessorLangs.has(inlineLangMatch[1].toLowerCase())) {
|
|
237
|
+
return true;
|
|
238
|
+
}
|
|
239
|
+
return /\.(?:scss|sass|less|styl|stylus)(?:\?|$)/i.test(id);
|
|
234
240
|
}
|
|
235
241
|
function createUniAppXPlugins(options) {
|
|
236
242
|
const {
|
|
237
243
|
appType,
|
|
238
244
|
customAttributesEntities,
|
|
239
245
|
disabledDefaultTemplateHandler,
|
|
246
|
+
isIosPlatform: providedIosPlatform,
|
|
240
247
|
mainCssChunkMatcher,
|
|
241
248
|
runtimeState,
|
|
242
249
|
styleHandler,
|
|
@@ -244,44 +251,57 @@ function createUniAppXPlugins(options) {
|
|
|
244
251
|
ensureRuntimeClassSet,
|
|
245
252
|
getResolvedConfig
|
|
246
253
|
} = options;
|
|
247
|
-
const
|
|
248
|
-
|
|
249
|
-
|
|
254
|
+
const isIosPlatform = providedIosPlatform ?? resolveUniUtsPlatform().isAppIos;
|
|
255
|
+
async function transformStyle(code, id, query) {
|
|
256
|
+
const parsed = query ?? parseVueRequest(id).query;
|
|
257
|
+
if (isCSSRequest(id) || parsed.vue && parsed.type === "style") {
|
|
258
|
+
const postcssResult = await styleHandler(code, {
|
|
259
|
+
isMainChunk: mainCssChunkMatcher(id, appType),
|
|
260
|
+
postcssOptions: {
|
|
261
|
+
options: {
|
|
262
|
+
from: id,
|
|
263
|
+
map: {
|
|
264
|
+
inline: false,
|
|
265
|
+
annotation: false,
|
|
266
|
+
// PostCSS 可能返回虚拟文件,因此需要启用这一项以获取源内容
|
|
267
|
+
sourcesContent: true
|
|
268
|
+
// 若上游预处理器已经生成 source map,sources 中可能出现重复条目
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
const rawPostcssMap = postcssResult.map.toJSON();
|
|
274
|
+
const postcssMap = await formatPostcssSourceMap(
|
|
275
|
+
rawPostcssMap,
|
|
276
|
+
cleanUrl(id)
|
|
277
|
+
);
|
|
278
|
+
return {
|
|
279
|
+
code: postcssResult.css,
|
|
280
|
+
map: postcssMap
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
const cssPrePlugin = {
|
|
285
|
+
name: "weapp-tailwindcss:uni-app-x:css:pre",
|
|
286
|
+
enforce: "pre",
|
|
250
287
|
async transform(code, id) {
|
|
251
288
|
await runtimeState.patchPromise;
|
|
252
289
|
const { query } = parseVueRequest(id);
|
|
253
290
|
const lang = query.lang;
|
|
254
|
-
if (
|
|
291
|
+
if (isIosPlatform && isPreprocessorRequest(id, lang)) {
|
|
255
292
|
return;
|
|
256
293
|
}
|
|
257
|
-
|
|
258
|
-
const postcssResult = await styleHandler(code, {
|
|
259
|
-
isMainChunk: mainCssChunkMatcher(id, appType),
|
|
260
|
-
postcssOptions: {
|
|
261
|
-
options: {
|
|
262
|
-
from: id,
|
|
263
|
-
map: {
|
|
264
|
-
inline: false,
|
|
265
|
-
annotation: false,
|
|
266
|
-
// PostCSS 可能返回虚拟文件,因此需要启用这一项以获取源内容
|
|
267
|
-
sourcesContent: true
|
|
268
|
-
// 若上游预处理器已经生成 source map,sources 中可能出现重复条目
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
});
|
|
273
|
-
const rawPostcssMap = postcssResult.map.toJSON();
|
|
274
|
-
const postcssMap = await formatPostcssSourceMap(
|
|
275
|
-
rawPostcssMap,
|
|
276
|
-
cleanUrl(id)
|
|
277
|
-
);
|
|
278
|
-
return {
|
|
279
|
-
code: postcssResult.css,
|
|
280
|
-
map: postcssMap
|
|
281
|
-
};
|
|
282
|
-
}
|
|
294
|
+
return transformStyle(code, id, query);
|
|
283
295
|
}
|
|
284
|
-
}
|
|
296
|
+
};
|
|
297
|
+
const cssPlugin = {
|
|
298
|
+
name: "weapp-tailwindcss:uni-app-x:css",
|
|
299
|
+
async transform(code, id) {
|
|
300
|
+
await runtimeState.patchPromise;
|
|
301
|
+
return transformStyle(code, id);
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
const cssPlugins = [cssPlugin, cssPrePlugin];
|
|
285
305
|
const nvuePlugin = {
|
|
286
306
|
name: "weapp-tailwindcss:uni-app-x:nvue",
|
|
287
307
|
enforce: "pre",
|
|
@@ -574,10 +594,13 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
574
594
|
}
|
|
575
595
|
onLoad();
|
|
576
596
|
const getResolvedConfig = () => resolvedConfig;
|
|
597
|
+
const utsPlatform = resolveUniUtsPlatform();
|
|
598
|
+
const isIosPlatform = utsPlatform.isAppIos;
|
|
577
599
|
const uniAppXPlugins = uniAppX ? createUniAppXPlugins({
|
|
578
600
|
appType,
|
|
579
601
|
customAttributesEntities,
|
|
580
602
|
disabledDefaultTemplateHandler,
|
|
603
|
+
isIosPlatform,
|
|
581
604
|
mainCssChunkMatcher,
|
|
582
605
|
runtimeState,
|
|
583
606
|
styleHandler,
|
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
} from "./chunk-RRHPTTCP.mjs";
|
|
4
4
|
import {
|
|
5
5
|
setupPatchRecorder
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-GKFJPK5V.mjs";
|
|
7
7
|
import {
|
|
8
8
|
collectRuntimeClassSet,
|
|
9
9
|
createDebug,
|
|
10
10
|
getCompilerContext,
|
|
11
11
|
refreshTailwindRuntimeState
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-IK5SFZ6A.mjs";
|
|
13
13
|
|
|
14
14
|
// src/bundlers/gulp/index.ts
|
|
15
15
|
import { Buffer } from "buffer";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkDYLQ6UOIjs = require('./chunk-DYLQ6UOI.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkMB4BR57Ejs = require('./chunk-MB4BR57E.js');
|
|
@@ -692,6 +692,7 @@ function createPatcherForBase(baseDir, cssEntries, options) {
|
|
|
692
692
|
tailwindcssPatcherOptions,
|
|
693
693
|
supportCustomLengthUnitsPatch
|
|
694
694
|
} = options;
|
|
695
|
+
const hasCssEntries = Boolean(_optionalChain([cssEntries, 'optionalAccess', _40 => _40.length]));
|
|
695
696
|
const defaultTailwindcssConfig = {
|
|
696
697
|
cwd: baseDir,
|
|
697
698
|
v2: {
|
|
@@ -700,29 +701,35 @@ function createPatcherForBase(baseDir, cssEntries, options) {
|
|
|
700
701
|
v3: {
|
|
701
702
|
cwd: baseDir
|
|
702
703
|
},
|
|
703
|
-
v4: {
|
|
704
|
+
v4: hasCssEntries ? { cssEntries } : {
|
|
704
705
|
base: baseDir,
|
|
705
706
|
cssEntries
|
|
706
707
|
}
|
|
707
708
|
};
|
|
708
|
-
if (
|
|
709
|
+
if (hasCssEntries && (tailwindcss == null || tailwindcss.version == null)) {
|
|
709
710
|
defaultTailwindcssConfig.version = 4;
|
|
710
711
|
}
|
|
711
|
-
const mergedTailwindOptions =
|
|
712
|
+
const mergedTailwindOptions = _chunkDYLQ6UOIjs.defuOverrideArray.call(void 0,
|
|
712
713
|
_nullishCoalesce(tailwindcss, () => ( {})),
|
|
713
714
|
defaultTailwindcssConfig
|
|
714
715
|
);
|
|
715
716
|
if (!mergedTailwindOptions.v4) {
|
|
716
|
-
mergedTailwindOptions.v4 = {
|
|
717
|
+
mergedTailwindOptions.v4 = hasCssEntries ? { cssEntries: _nullishCoalesce(cssEntries, () => ( [])) } : {
|
|
717
718
|
base: baseDir,
|
|
718
719
|
cssEntries: _nullishCoalesce(cssEntries, () => ( []))
|
|
719
720
|
};
|
|
720
721
|
} else {
|
|
721
|
-
mergedTailwindOptions.v4.base
|
|
722
|
-
|
|
723
|
-
|
|
722
|
+
if (!hasCssEntries && !mergedTailwindOptions.v4.base) {
|
|
723
|
+
mergedTailwindOptions.v4.base = baseDir;
|
|
724
|
+
}
|
|
725
|
+
if (hasCssEntries) {
|
|
726
|
+
if (_optionalChain([cssEntries, 'optionalAccess', _41 => _41.length])) {
|
|
727
|
+
mergedTailwindOptions.v4.cssEntries = cssEntries;
|
|
728
|
+
} else if (!mergedTailwindOptions.v4.cssEntries) {
|
|
729
|
+
mergedTailwindOptions.v4.cssEntries = [];
|
|
730
|
+
}
|
|
724
731
|
} else if (!mergedTailwindOptions.v4.cssEntries) {
|
|
725
|
-
mergedTailwindOptions.v4.cssEntries = [];
|
|
732
|
+
mergedTailwindOptions.v4.cssEntries = _nullishCoalesce(cssEntries, () => ( []));
|
|
726
733
|
}
|
|
727
734
|
}
|
|
728
735
|
const patchedOptions = overrideTailwindcssPatcherOptionsForBase(
|
|
@@ -765,6 +772,7 @@ function createMultiTailwindcssPatcher(patchers) {
|
|
|
765
772
|
}
|
|
766
773
|
const [first] = patchers;
|
|
767
774
|
const multiPatcher = {
|
|
775
|
+
...first,
|
|
768
776
|
packageInfo: _optionalChain([first, 'optionalAccess', _54 => _54.packageInfo]),
|
|
769
777
|
majorVersion: _optionalChain([first, 'optionalAccess', _55 => _55.majorVersion]),
|
|
770
778
|
options: _optionalChain([first, 'optionalAccess', _56 => _56.options]),
|
|
@@ -1090,8 +1098,16 @@ function createTailwindcssPatcherFromContext(ctx) {
|
|
|
1090
1098
|
if (normalizedCssEntries) {
|
|
1091
1099
|
ctx.cssEntries = normalizedCssEntries;
|
|
1092
1100
|
}
|
|
1101
|
+
const shouldAttachBase = Boolean(ctx.tailwindcssBasedir && _optionalChain([normalizedCssEntries, 'optionalAccess', _64 => _64.length]));
|
|
1102
|
+
const tailwindcssWithBase = shouldAttachBase && _optionalChain([tailwindcss, 'optionalAccess', _65 => _65.v4]) !== null ? {
|
|
1103
|
+
..._nullishCoalesce(tailwindcss, () => ( {})),
|
|
1104
|
+
v4: {
|
|
1105
|
+
..._nullishCoalesce(_optionalChain([tailwindcss, 'optionalAccess', _66 => _66.v4]), () => ( {})),
|
|
1106
|
+
base: _nullishCoalesce(_optionalChain([tailwindcss, 'optionalAccess', _67 => _67.v4, 'optionalAccess', _68 => _68.base]), () => ( resolvedTailwindcssBasedir))
|
|
1107
|
+
}
|
|
1108
|
+
} : tailwindcss;
|
|
1093
1109
|
const patcherOptions = {
|
|
1094
|
-
tailwindcss,
|
|
1110
|
+
tailwindcss: tailwindcssWithBase,
|
|
1095
1111
|
tailwindcssPatcherOptions,
|
|
1096
1112
|
supportCustomLengthUnitsPatch,
|
|
1097
1113
|
appType
|
|
@@ -1105,7 +1121,7 @@ function createTailwindcssPatcherFromContext(ctx) {
|
|
|
1105
1121
|
if (multiPatcher) {
|
|
1106
1122
|
return multiPatcher;
|
|
1107
1123
|
}
|
|
1108
|
-
if (_optionalChain([groupedCssEntries, 'optionalAccess',
|
|
1124
|
+
if (_optionalChain([groupedCssEntries, 'optionalAccess', _69 => _69.size]) === 1) {
|
|
1109
1125
|
const firstGroup = groupedCssEntries.entries().next().value;
|
|
1110
1126
|
if (firstGroup) {
|
|
1111
1127
|
const [baseDir, entries] = firstGroup;
|
package/dist/cli.js
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkD2ZOXBOUjs = require('./chunk-D2ZOXBOU.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
11
|
-
require('./chunk-
|
|
12
|
-
require('./chunk-
|
|
10
|
+
var _chunkY4A76SWPjs = require('./chunk-Y4A76SWP.js');
|
|
11
|
+
require('./chunk-FYYBY3VK.js');
|
|
12
|
+
require('./chunk-DYLQ6UOI.js');
|
|
13
13
|
require('./chunk-MB4BR57E.js');
|
|
14
14
|
|
|
15
15
|
// src/cli.ts
|
|
@@ -125,7 +125,7 @@ function resolvePatchDefaultCwd(currentCwd = _process2.default.cwd()) {
|
|
|
125
125
|
if (explicitCwd) {
|
|
126
126
|
return explicitCwd;
|
|
127
127
|
}
|
|
128
|
-
const workspaceRoot =
|
|
128
|
+
const workspaceRoot = _chunkY4A76SWPjs.findWorkspaceRoot.call(void 0, baseDir);
|
|
129
129
|
const initCwd = normalizeCandidatePath(baseDir, _process2.default.env.INIT_CWD);
|
|
130
130
|
const localPrefix = normalizeCandidatePath(baseDir, _process2.default.env.npm_config_local_prefix);
|
|
131
131
|
const candidates = [
|
|
@@ -145,12 +145,12 @@ async function ensureDir(dir) {
|
|
|
145
145
|
}
|
|
146
146
|
function handleCliError(error) {
|
|
147
147
|
if (error instanceof Error) {
|
|
148
|
-
|
|
148
|
+
_chunkY4A76SWPjs.logger.error(error.message);
|
|
149
149
|
if (error.stack && _process2.default.env.WEAPP_TW_DEBUG === "1") {
|
|
150
|
-
|
|
150
|
+
_chunkY4A76SWPjs.logger.error(error.stack);
|
|
151
151
|
}
|
|
152
152
|
} else {
|
|
153
|
-
|
|
153
|
+
_chunkY4A76SWPjs.logger.error(String(error));
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
function commandAction(handler) {
|
|
@@ -309,10 +309,10 @@ function formatDisplayName(workspaceRoot, dir, name) {
|
|
|
309
309
|
}
|
|
310
310
|
async function patchWorkspace(options) {
|
|
311
311
|
const cwd = _nullishCoalesce(options.cwd, () => ( _process2.default.cwd()));
|
|
312
|
-
const workspaceRoot = _nullishCoalesce(
|
|
312
|
+
const workspaceRoot = _nullishCoalesce(_chunkY4A76SWPjs.findWorkspaceRoot.call(void 0, cwd), () => ( cwd));
|
|
313
313
|
const packageDirs = await resolveWorkspacePackageDirs(workspaceRoot);
|
|
314
314
|
if (packageDirs.length === 0) {
|
|
315
|
-
|
|
315
|
+
_chunkY4A76SWPjs.logger.warn("\u672A\u5728 %s \u68C0\u6D4B\u5230 workspace \u5305\uFF0C\u5DF2\u8DF3\u8FC7\u6279\u91CF patch\u3002", workspaceRoot);
|
|
316
316
|
return;
|
|
317
317
|
}
|
|
318
318
|
const results = [];
|
|
@@ -328,24 +328,24 @@ async function patchWorkspace(options) {
|
|
|
328
328
|
status: "skipped",
|
|
329
329
|
message: "tailwindcss \u672A\u5B89\u88C5\uFF0C\u5DF2\u8DF3\u8FC7\u3002"
|
|
330
330
|
});
|
|
331
|
-
|
|
331
|
+
_chunkY4A76SWPjs.logger.info("[workspace] \u8DF3\u8FC7 %s\uFF08tailwindcss \u672A\u5B89\u88C5\uFF09\u3002", displayName);
|
|
332
332
|
continue;
|
|
333
333
|
}
|
|
334
334
|
try {
|
|
335
335
|
const patcher = createWorkspacePatcher(dir);
|
|
336
336
|
if (options.clearCache) {
|
|
337
|
-
await
|
|
337
|
+
await _chunkD2ZOXBOUjs.clearTailwindcssPatcherCache.call(void 0, patcher, { removeDirectory: true });
|
|
338
338
|
}
|
|
339
|
-
const recorder =
|
|
339
|
+
const recorder = _chunkD2ZOXBOUjs.createPatchTargetRecorder.call(void 0, dir, patcher, {
|
|
340
340
|
source: "cli",
|
|
341
341
|
cwd: dir,
|
|
342
342
|
recordTarget: options.recordTarget !== false,
|
|
343
343
|
alwaysRecord: true
|
|
344
344
|
});
|
|
345
345
|
if (_optionalChain([recorder, 'optionalAccess', _13 => _13.message])) {
|
|
346
|
-
|
|
346
|
+
_chunkY4A76SWPjs.logger.info("[workspace] %s %s", displayName, recorder.message);
|
|
347
347
|
}
|
|
348
|
-
|
|
348
|
+
_chunkD2ZOXBOUjs.logTailwindcssTarget.call(void 0, "cli", patcher, dir);
|
|
349
349
|
await patcher.patch();
|
|
350
350
|
if (_optionalChain([recorder, 'optionalAccess', _14 => _14.onPatched])) {
|
|
351
351
|
await recorder.onPatched();
|
|
@@ -356,7 +356,7 @@ async function patchWorkspace(options) {
|
|
|
356
356
|
status: "patched",
|
|
357
357
|
message: "\u5DF2\u5B8C\u6210 patch\u3002"
|
|
358
358
|
});
|
|
359
|
-
|
|
359
|
+
_chunkY4A76SWPjs.logger.success("[workspace] \u5DF2\u8865\u4E01 %s", displayName);
|
|
360
360
|
} catch (error) {
|
|
361
361
|
const reason = error instanceof Error ? error.message : String(error);
|
|
362
362
|
const suggestion = `\u8BF7\u5728 ${dir} \u8FD0\u884C "weapp-tw patch --cwd ${dir}".`;
|
|
@@ -367,24 +367,24 @@ async function patchWorkspace(options) {
|
|
|
367
367
|
status: "failed",
|
|
368
368
|
message
|
|
369
369
|
});
|
|
370
|
-
|
|
370
|
+
_chunkY4A76SWPjs.logger.error("[workspace] \u8865\u4E01\u5931\u8D25 %s\uFF1A%s", displayName, message);
|
|
371
371
|
}
|
|
372
372
|
}
|
|
373
373
|
const patched = results.filter((result) => result.status === "patched").length;
|
|
374
374
|
const skipped = results.filter((result) => result.status === "skipped").length;
|
|
375
375
|
const failed = results.filter((result) => result.status === "failed").length;
|
|
376
|
-
|
|
376
|
+
_chunkY4A76SWPjs.logger.info("[workspace] \u6C47\u603B\uFF1A\u5DF2\u8865\u4E01 %d\uFF0C\u8DF3\u8FC7 %d\uFF0C\u5931\u8D25 %d", patched, skipped, failed);
|
|
377
377
|
}
|
|
378
378
|
|
|
379
379
|
// src/cli/mount-options.ts
|
|
380
380
|
function handleCliError2(error) {
|
|
381
381
|
if (error instanceof Error) {
|
|
382
|
-
|
|
382
|
+
_chunkY4A76SWPjs.logger.error(error.message);
|
|
383
383
|
if (error.stack && _process2.default.env.WEAPP_TW_DEBUG === "1") {
|
|
384
|
-
|
|
384
|
+
_chunkY4A76SWPjs.logger.error(error.stack);
|
|
385
385
|
}
|
|
386
386
|
} else {
|
|
387
|
-
|
|
387
|
+
_chunkY4A76SWPjs.logger.error(String(error));
|
|
388
388
|
}
|
|
389
389
|
}
|
|
390
390
|
function withCommandErrorHandling(handler) {
|
|
@@ -419,27 +419,27 @@ function logPatchStatusReport(report) {
|
|
|
419
419
|
(entry) => entry.status === "skipped" || entry.status === "unsupported"
|
|
420
420
|
);
|
|
421
421
|
const packageLabel = `${_nullishCoalesce(report.package.name, () => ( "tailwindcss"))}@${_nullishCoalesce(report.package.version, () => ( "unknown"))}`;
|
|
422
|
-
|
|
422
|
+
_chunkY4A76SWPjs.logger.info(`Patch status for ${packageLabel} (v${report.majorVersion})`);
|
|
423
423
|
if (applied.length) {
|
|
424
|
-
|
|
424
|
+
_chunkY4A76SWPjs.logger.success("Applied:");
|
|
425
425
|
applied.forEach((entry) => {
|
|
426
|
-
|
|
426
|
+
_chunkY4A76SWPjs.logger.success(` - ${entry.name}${formatStatusFilesHint(entry.files)}`);
|
|
427
427
|
});
|
|
428
428
|
}
|
|
429
429
|
if (pending.length) {
|
|
430
|
-
|
|
430
|
+
_chunkY4A76SWPjs.logger.warn("Needs attention:");
|
|
431
431
|
pending.forEach((entry) => {
|
|
432
432
|
const details = entry.reason ? ` - ${entry.reason}` : "";
|
|
433
|
-
|
|
433
|
+
_chunkY4A76SWPjs.logger.warn(` - ${entry.name}${formatStatusFilesHint(entry.files)}${details}`);
|
|
434
434
|
});
|
|
435
435
|
} else {
|
|
436
|
-
|
|
436
|
+
_chunkY4A76SWPjs.logger.success("All applicable patches are applied.");
|
|
437
437
|
}
|
|
438
438
|
if (skipped.length) {
|
|
439
|
-
|
|
439
|
+
_chunkY4A76SWPjs.logger.info("Skipped:");
|
|
440
440
|
skipped.forEach((entry) => {
|
|
441
441
|
const details = entry.reason ? ` - ${entry.reason}` : "";
|
|
442
|
-
|
|
442
|
+
_chunkY4A76SWPjs.logger.info(` - ${entry.name}${details}`);
|
|
443
443
|
});
|
|
444
444
|
}
|
|
445
445
|
}
|
|
@@ -500,26 +500,26 @@ var mountOptions = {
|
|
|
500
500
|
}
|
|
501
501
|
const patcher = await createPatcherWithDefaultExtendLengthUnits(ctx);
|
|
502
502
|
if (shouldClearCache) {
|
|
503
|
-
await
|
|
503
|
+
await _chunkD2ZOXBOUjs.clearTailwindcssPatcherCache.call(void 0, patcher, { removeDirectory: true });
|
|
504
504
|
}
|
|
505
|
-
const recorder =
|
|
505
|
+
const recorder = _chunkD2ZOXBOUjs.createPatchTargetRecorder.call(void 0, ctx.cwd, patcher, {
|
|
506
506
|
source: "cli",
|
|
507
507
|
cwd: ctx.cwd,
|
|
508
508
|
recordTarget: shouldRecordTarget,
|
|
509
509
|
alwaysRecord: true
|
|
510
510
|
});
|
|
511
511
|
if (_optionalChain([recorder, 'optionalAccess', _18 => _18.message])) {
|
|
512
|
-
|
|
512
|
+
_chunkY4A76SWPjs.logger.info(recorder.message);
|
|
513
513
|
}
|
|
514
|
-
|
|
514
|
+
_chunkD2ZOXBOUjs.logTailwindcssTarget.call(void 0, "cli", patcher, ctx.cwd);
|
|
515
515
|
await patcher.patch();
|
|
516
516
|
if (_optionalChain([recorder, 'optionalAccess', _19 => _19.onPatched])) {
|
|
517
517
|
const recordPath = await recorder.onPatched();
|
|
518
518
|
if (recordPath) {
|
|
519
|
-
|
|
519
|
+
_chunkY4A76SWPjs.logger.info(`\u8BB0\u5F55 weapp-tw patch \u76EE\u6807 -> ${formatOutputPath(recordPath, ctx.cwd)}`);
|
|
520
520
|
}
|
|
521
521
|
}
|
|
522
|
-
|
|
522
|
+
_chunkY4A76SWPjs.logger.success("Tailwind CSS \u8FD0\u884C\u65F6\u8865\u4E01\u5DF2\u5B8C\u6210\u3002");
|
|
523
523
|
}),
|
|
524
524
|
extract: withCommandErrorHandling(async (_ctx, next) => next()),
|
|
525
525
|
tokens: withCommandErrorHandling(async (_ctx, next) => next()),
|
|
@@ -528,7 +528,7 @@ var mountOptions = {
|
|
|
528
528
|
const patcher = await createPatcherWithDefaultExtendLengthUnits(ctx);
|
|
529
529
|
const report = await patcher.getPatchStatus();
|
|
530
530
|
if (ctx.args.json) {
|
|
531
|
-
|
|
531
|
+
_chunkY4A76SWPjs.logger.log(JSON.stringify(report, null, 2));
|
|
532
532
|
return report;
|
|
533
533
|
}
|
|
534
534
|
logPatchStatusReport(report);
|
|
@@ -659,9 +659,9 @@ async function generateVscodeIntellisenseEntry(options) {
|
|
|
659
659
|
|
|
660
660
|
// src/cli.ts
|
|
661
661
|
_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${
|
|
662
|
+
if (_semver2.default.lt(_process2.default.versions.node, _chunkD2ZOXBOUjs.WEAPP_TW_REQUIRED_NODE_VERSION)) {
|
|
663
|
+
_chunkY4A76SWPjs.logger.warn(
|
|
664
|
+
`You are using Node.js ${_process2.default.versions.node}. For weapp-tailwindcss, Node.js version >= v${_chunkD2ZOXBOUjs.WEAPP_TW_REQUIRED_NODE_VERSION} is required.`
|
|
665
665
|
);
|
|
666
666
|
}
|
|
667
667
|
var cli = _tailwindcsspatch.createTailwindcssPatchCli.call(void 0, {
|
|
@@ -686,7 +686,7 @@ cli.command("vscode-entry", "Generate a VS Code helper CSS for Tailwind IntelliS
|
|
|
686
686
|
sources,
|
|
687
687
|
force
|
|
688
688
|
});
|
|
689
|
-
|
|
689
|
+
_chunkY4A76SWPjs.logger.success(
|
|
690
690
|
`VS Code helper generated -> ${formatOutputPath(result.outputPath, resolvedCwd)}`
|
|
691
691
|
);
|
|
692
692
|
})
|
package/dist/cli.mjs
CHANGED
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
clearTailwindcssPatcherCache,
|
|
4
4
|
createPatchTargetRecorder,
|
|
5
5
|
logTailwindcssTarget
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-IK5SFZ6A.mjs";
|
|
7
7
|
import {
|
|
8
8
|
findWorkspaceRoot,
|
|
9
9
|
logger
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-3LRQLHOG.mjs";
|
|
11
|
+
import "./chunk-HWF5U4CI.mjs";
|
|
12
|
+
import "./chunk-OOHJLO5M.mjs";
|
|
13
13
|
import "./chunk-SM5V25IN.mjs";
|
|
14
14
|
|
|
15
15
|
// src/cli.ts
|
package/dist/core.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk2QR4UOHAjs = require('./chunk-2QR4UOHA.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
9
|
-
require('./chunk-
|
|
10
|
-
require('./chunk-
|
|
11
|
-
require('./chunk-
|
|
8
|
+
var _chunkD2ZOXBOUjs = require('./chunk-D2ZOXBOU.js');
|
|
9
|
+
require('./chunk-Y4A76SWP.js');
|
|
10
|
+
require('./chunk-FYYBY3VK.js');
|
|
11
|
+
require('./chunk-DYLQ6UOI.js');
|
|
12
12
|
require('./chunk-MB4BR57E.js');
|
|
13
13
|
|
|
14
14
|
// src/core.ts
|
|
15
15
|
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
16
16
|
var _shared = require('@weapp-tailwindcss/shared');
|
|
17
17
|
function createContext(options = {}) {
|
|
18
|
-
const opts =
|
|
18
|
+
const opts = _chunkD2ZOXBOUjs.getCompilerContext.call(void 0, options);
|
|
19
19
|
const { templateHandler, styleHandler, jsHandler, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
|
|
20
|
-
const patchRecorderState =
|
|
20
|
+
const patchRecorderState = _chunk2QR4UOHAjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
|
|
21
21
|
source: "runtime",
|
|
22
22
|
cwd: _nullishCoalesce(opts.tailwindcssBasedir, () => ( _process2.default.cwd()))
|
|
23
23
|
});
|
|
@@ -29,7 +29,7 @@ function createContext(options = {}) {
|
|
|
29
29
|
onPatchCompleted: patchRecorderState.onPatchCompleted
|
|
30
30
|
};
|
|
31
31
|
async function refreshRuntimeState(force) {
|
|
32
|
-
await
|
|
32
|
+
await _chunkD2ZOXBOUjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
|
|
33
33
|
}
|
|
34
34
|
async function transformWxss(rawCss, options2) {
|
|
35
35
|
await runtimeState.patchPromise;
|
|
@@ -38,7 +38,7 @@ function createContext(options = {}) {
|
|
|
38
38
|
}));
|
|
39
39
|
await refreshRuntimeState(true);
|
|
40
40
|
await runtimeState.patchPromise;
|
|
41
|
-
runtimeSet = await
|
|
41
|
+
runtimeSet = await _chunkD2ZOXBOUjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
|
|
42
42
|
return result;
|
|
43
43
|
}
|
|
44
44
|
async function transformJs(rawJs, options2 = {}) {
|
|
@@ -48,7 +48,7 @@ function createContext(options = {}) {
|
|
|
48
48
|
} else {
|
|
49
49
|
await refreshRuntimeState(true);
|
|
50
50
|
await runtimeState.patchPromise;
|
|
51
|
-
runtimeSet = await
|
|
51
|
+
runtimeSet = await _chunkD2ZOXBOUjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
|
|
52
52
|
}
|
|
53
53
|
return await jsHandler(rawJs, runtimeSet, options2);
|
|
54
54
|
}
|
|
@@ -57,7 +57,7 @@ function createContext(options = {}) {
|
|
|
57
57
|
if (!_optionalChain([options2, 'optionalAccess', _2 => _2.runtimeSet]) && runtimeSet.size === 0) {
|
|
58
58
|
await refreshRuntimeState(true);
|
|
59
59
|
await runtimeState.patchPromise;
|
|
60
|
-
runtimeSet = await
|
|
60
|
+
runtimeSet = await _chunkD2ZOXBOUjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
|
|
61
61
|
}
|
|
62
62
|
return templateHandler(rawWxml, _shared.defuOverrideArray.call(void 0, options2, {
|
|
63
63
|
runtimeSet
|
package/dist/core.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
setupPatchRecorder
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-GKFJPK5V.mjs";
|
|
4
4
|
import {
|
|
5
5
|
collectRuntimeClassSet,
|
|
6
6
|
getCompilerContext,
|
|
7
7
|
refreshTailwindRuntimeState
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-IK5SFZ6A.mjs";
|
|
9
|
+
import "./chunk-3LRQLHOG.mjs";
|
|
10
|
+
import "./chunk-HWF5U4CI.mjs";
|
|
11
|
+
import "./chunk-OOHJLO5M.mjs";
|
|
12
12
|
import "./chunk-SM5V25IN.mjs";
|
|
13
13
|
|
|
14
14
|
// src/core.ts
|
package/dist/css-macro.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
var _chunkNS3NEDWDjs = require('./chunk-NS3NEDWD.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkDYLQ6UOIjs = require('./chunk-DYLQ6UOI.js');
|
|
8
8
|
require('./chunk-MB4BR57E.js');
|
|
9
9
|
|
|
10
10
|
// src/css-macro/index.ts
|
|
@@ -14,7 +14,7 @@ var defaultOptions = {
|
|
|
14
14
|
variantsMap: {}
|
|
15
15
|
};
|
|
16
16
|
var cssMacro = _plugin2.default.withOptions((options) => {
|
|
17
|
-
const { dynamic, variantsMap } =
|
|
17
|
+
const { dynamic, variantsMap } = _chunkDYLQ6UOIjs.defu.call(void 0, _nullishCoalesce(options, () => ( {})), defaultOptions);
|
|
18
18
|
const staticVariants = Object.entries(variantsMap).map(([name, config]) => {
|
|
19
19
|
if (typeof config === "string") {
|
|
20
20
|
return {
|
package/dist/css-macro.mjs
CHANGED
package/dist/defaults.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var _chunkFYYBY3VKjs = require('./chunk-FYYBY3VK.js');
|
|
4
|
+
require('./chunk-DYLQ6UOI.js');
|
|
5
5
|
require('./chunk-MB4BR57E.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
exports.getDefaultOptions =
|
|
8
|
+
exports.getDefaultOptions = _chunkFYYBY3VKjs.getDefaultOptions;
|