weapp-tailwindcss 4.8.3 → 4.8.5-alpha.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/dist/{chunk-7KTLLGAG.mjs → chunk-3XGTIDA6.mjs} +72 -49
- package/dist/{chunk-26ZRX6OH.js → chunk-5KVCFUCR.js} +27 -20
- package/dist/{chunk-QGH4JZRW.mjs → chunk-67CD2S5L.mjs} +0 -8
- package/dist/{chunk-H34KPZQW.js → chunk-AB45L5FP.js} +2 -2
- package/dist/{chunk-E3GZQTOH.mjs → chunk-E4WMGIBB.mjs} +13 -6
- package/dist/{chunk-KSHK56CW.mjs → chunk-EQP3XJUM.mjs} +1 -1
- package/dist/chunk-GBKTM7HE.mjs +29 -0
- package/dist/{chunk-NLLCK6RM.mjs → chunk-NE4IF47K.mjs} +11 -4
- package/dist/{chunk-UUVGNRUM.mjs → chunk-NMUFIIAM.mjs} +36 -23
- package/dist/{chunk-N2ZUYGKA.js → chunk-OQGFV6TW.js} +14 -7
- package/dist/{chunk-UCA2DMVN.js → chunk-OR5KGJ46.js} +5 -5
- package/dist/{chunk-W5Z3I3S2.js → chunk-QZ5JL3U3.js} +52 -39
- package/dist/chunk-R6ERGDBQ.js +29 -0
- package/dist/{chunk-2ZEOKKVA.js → chunk-RJRLVYVJ.js} +77 -54
- package/dist/{chunk-WTOLVORM.mjs → chunk-T25LQFYZ.mjs} +389 -52
- package/dist/chunk-UTZLVU3M.js +7 -0
- package/dist/{chunk-PLV4QGF4.js → chunk-YKMZHWQ4.js} +427 -90
- package/dist/cli.js +270 -311
- package/dist/cli.mjs +273 -313
- package/dist/core.js +19 -11
- package/dist/core.mjs +14 -6
- 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 -5
- package/dist/gulp.mjs +5 -4
- package/dist/index.js +10 -9
- package/dist/index.mjs +8 -7
- package/dist/postcss-html-transform.js +1 -1
- package/dist/postcss-html-transform.mjs +1 -1
- package/dist/presets.js +4 -6
- package/dist/presets.mjs +3 -5
- package/dist/reset.d.mts +30 -0
- package/dist/reset.d.ts +32 -0
- package/dist/reset.js +161 -0
- package/dist/reset.mjs +161 -0
- package/dist/types.js +1 -1
- package/dist/types.mjs +1 -1
- package/dist/vite.js +7 -6
- package/dist/vite.mjs +5 -4
- package/dist/webpack.js +8 -7
- package/dist/webpack.mjs +6 -5
- package/dist/webpack4.js +29 -22
- package/dist/webpack4.mjs +14 -7
- package/package.json +12 -5
- package/dist/chunk-OXASK55Q.js +0 -6
- package/dist/chunk-PMF2CCKK.mjs +0 -6
- package/dist/chunk-UJIUFWXE.js +0 -15
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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 _chunkAB45L5FPjs = require('./chunk-AB45L5FP.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkYKMZHWQ4js = require('./chunk-YKMZHWQ4.js');
|
|
7
7
|
|
|
8
8
|
// src/bundlers/webpack/shared/css-imports.ts
|
|
9
9
|
var CSS_EXT_RE = /\.(?:css|scss|sass|less|styl|pcss)$/i;
|
|
@@ -33,7 +33,7 @@ function rewriteTailwindcssRequestForCss(data, pkgDir) {
|
|
|
33
33
|
if (!CSS_EXT_RE.test(normalizedIssuer)) {
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
|
-
const resolved =
|
|
36
|
+
const resolved = _chunkAB45L5FPjs.resolveTailwindcssImport.call(void 0, request, pkgDir);
|
|
37
37
|
if (!resolved) {
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
@@ -43,8 +43,8 @@ function applyTailwindcssCssImportRewrite(compiler, options) {
|
|
|
43
43
|
if (!options.enabled) {
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
|
-
compiler.hooks.normalModuleFactory.tap(
|
|
47
|
-
factory.hooks.beforeResolve.tap(
|
|
46
|
+
compiler.hooks.normalModuleFactory.tap(_chunkYKMZHWQ4js.pluginName, (factory) => {
|
|
47
|
+
factory.hooks.beforeResolve.tap(_chunkYKMZHWQ4js.pluginName, (data) => {
|
|
48
48
|
rewriteTailwindcssRequestForCss(data, options.pkgDir);
|
|
49
49
|
});
|
|
50
50
|
});
|
|
@@ -5,12 +5,13 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkAB45L5FPjs = require('./chunk-AB45L5FP.js');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
|
|
12
12
|
|
|
13
13
|
|
|
14
|
+
var _chunkR6ERGDBQjs = require('./chunk-R6ERGDBQ.js');
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
|
|
@@ -20,7 +21,8 @@ var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
|
|
|
20
21
|
|
|
21
22
|
|
|
22
23
|
|
|
23
|
-
|
|
24
|
+
|
|
25
|
+
var _chunkYKMZHWQ4js = require('./chunk-YKMZHWQ4.js');
|
|
24
26
|
|
|
25
27
|
|
|
26
28
|
var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
|
|
@@ -52,7 +54,7 @@ function updateStaticAttribute(ms, prop) {
|
|
|
52
54
|
const start = prop.value.loc.start.offset + 1;
|
|
53
55
|
const end = prop.value.loc.end.offset - 1;
|
|
54
56
|
if (start < end) {
|
|
55
|
-
ms.update(start, end,
|
|
57
|
+
ms.update(start, end, _chunkYKMZHWQ4js.replaceWxml.call(void 0, prop.value.content));
|
|
56
58
|
}
|
|
57
59
|
}
|
|
58
60
|
function updateDirectiveExpression(ms, prop, jsHandler, runtimeSet) {
|
|
@@ -64,7 +66,7 @@ function updateDirectiveExpression(ms, prop, jsHandler, runtimeSet) {
|
|
|
64
66
|
if (start >= end) {
|
|
65
67
|
return;
|
|
66
68
|
}
|
|
67
|
-
const generated =
|
|
69
|
+
const generated = _chunkYKMZHWQ4js.generateCode.call(void 0, prop.exp.content, {
|
|
68
70
|
jsHandler,
|
|
69
71
|
runtimeSet,
|
|
70
72
|
wrapExpression: true
|
|
@@ -93,7 +95,7 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
|
|
|
93
95
|
return;
|
|
94
96
|
}
|
|
95
97
|
const { customAttributesEntities, disabledDefaultTemplateHandler = false } = options;
|
|
96
|
-
const matchCustomAttribute =
|
|
98
|
+
const matchCustomAttribute = _chunkYKMZHWQ4js.createAttributeMatcher.call(void 0, customAttributesEntities);
|
|
97
99
|
const ms = new (0, _magicstring2.default)(code);
|
|
98
100
|
const { descriptor, errors } = _compilersfc.parse.call(void 0, code);
|
|
99
101
|
if (errors.length === 0) {
|
|
@@ -216,8 +218,8 @@ async function formatPostcssSourceMap(rawMap, file) {
|
|
|
216
218
|
}
|
|
217
219
|
|
|
218
220
|
// src/bundlers/vite/index.ts
|
|
219
|
-
var debug =
|
|
220
|
-
var weappTailwindcssPackageDir =
|
|
221
|
+
var debug = _chunkYKMZHWQ4js.createDebug.call(void 0, );
|
|
222
|
+
var weappTailwindcssPackageDir = _chunkAB45L5FPjs.resolvePackageDir.call(void 0, "weapp-tailwindcss");
|
|
221
223
|
var weappTailwindcssDirPosix = slash(weappTailwindcssPackageDir);
|
|
222
224
|
function joinPosixPath(base, subpath) {
|
|
223
225
|
if (base.endsWith("/")) {
|
|
@@ -261,7 +263,7 @@ function isJavaScriptEntry(entry) {
|
|
|
261
263
|
function createBundleModuleGraphOptions(outputDir, entries) {
|
|
262
264
|
return {
|
|
263
265
|
resolve(specifier, importer) {
|
|
264
|
-
return
|
|
266
|
+
return _chunkAB45L5FPjs.resolveOutputSpecifier.call(void 0, specifier, importer, outputDir, (candidate) => entries.has(candidate));
|
|
265
267
|
},
|
|
266
268
|
load(id) {
|
|
267
269
|
const entry = entries.get(id);
|
|
@@ -299,7 +301,7 @@ function applyLinkedResults(linked, entries, onLinkedUpdate, onApplied) {
|
|
|
299
301
|
}
|
|
300
302
|
function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
301
303
|
const rewriteCssImportsSpecified = Object.prototype.hasOwnProperty.call(options, "rewriteCssImports");
|
|
302
|
-
const opts =
|
|
304
|
+
const opts = _chunkYKMZHWQ4js.getCompilerContext.call(void 0, options);
|
|
303
305
|
const {
|
|
304
306
|
disabled,
|
|
305
307
|
customAttributes,
|
|
@@ -321,17 +323,22 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
321
323
|
if (disabled) {
|
|
322
324
|
return;
|
|
323
325
|
}
|
|
324
|
-
const customAttributesEntities =
|
|
326
|
+
const customAttributesEntities = _chunkYKMZHWQ4js.toCustomAttributesEntities.call(void 0, customAttributes);
|
|
327
|
+
const patchRecorderState = _chunkR6ERGDBQjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
|
|
328
|
+
source: "runtime",
|
|
329
|
+
cwd: _nullishCoalesce(opts.tailwindcssBasedir, () => ( _process2.default.cwd()))
|
|
330
|
+
});
|
|
325
331
|
const runtimeState = {
|
|
326
332
|
twPatcher: initialTwPatcher,
|
|
327
|
-
patchPromise:
|
|
328
|
-
refreshTailwindcssPatcher
|
|
333
|
+
patchPromise: patchRecorderState.patchPromise,
|
|
334
|
+
refreshTailwindcssPatcher,
|
|
335
|
+
onPatchCompleted: patchRecorderState.onPatchCompleted
|
|
329
336
|
};
|
|
330
337
|
let runtimeSet;
|
|
331
338
|
let runtimeSetPromise;
|
|
332
339
|
let resolvedConfig;
|
|
333
340
|
async function refreshRuntimeState(force) {
|
|
334
|
-
const refreshed = await
|
|
341
|
+
const refreshed = await _chunkYKMZHWQ4js.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
|
|
335
342
|
if (refreshed) {
|
|
336
343
|
runtimeSet = void 0;
|
|
337
344
|
runtimeSetPromise = void 0;
|
|
@@ -344,7 +351,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
344
351
|
return runtimeSet;
|
|
345
352
|
}
|
|
346
353
|
if (force || !runtimeSetPromise) {
|
|
347
|
-
const task2 =
|
|
354
|
+
const task2 = _chunkYKMZHWQ4js.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, {
|
|
348
355
|
force: force || !runtimeSet,
|
|
349
356
|
skipRefresh: force
|
|
350
357
|
});
|
|
@@ -364,37 +371,43 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
364
371
|
const shouldRewriteCssImports = opts.rewriteCssImports !== false && (rewriteCssImportsSpecified || (_nullishCoalesce(runtimeState.twPatcher.majorVersion, () => ( 0))) >= 4);
|
|
365
372
|
const rewritePlugins = !shouldRewriteCssImports ? [] : [
|
|
366
373
|
{
|
|
367
|
-
name: `${
|
|
374
|
+
name: `${_chunkYKMZHWQ4js.vitePluginName}:rewrite-css-imports`,
|
|
368
375
|
enforce: "pre",
|
|
369
|
-
resolveId
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
+
resolveId: {
|
|
377
|
+
order: "pre",
|
|
378
|
+
handler(id, importer) {
|
|
379
|
+
const replacement = _chunkAB45L5FPjs.resolveTailwindcssImport.call(void 0, id, weappTailwindcssDirPosix, { join: joinPosixPath });
|
|
380
|
+
if (!replacement) {
|
|
381
|
+
return null;
|
|
382
|
+
}
|
|
383
|
+
if (importer && !isCssLikeImporter(importer)) {
|
|
384
|
+
return null;
|
|
385
|
+
}
|
|
386
|
+
return replacement;
|
|
376
387
|
}
|
|
377
|
-
return replacement;
|
|
378
388
|
},
|
|
379
|
-
transform
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
389
|
+
transform: {
|
|
390
|
+
order: "pre",
|
|
391
|
+
handler(code, id) {
|
|
392
|
+
if (!isCSSRequest(id)) {
|
|
393
|
+
return null;
|
|
394
|
+
}
|
|
395
|
+
const rewritten = _chunkAB45L5FPjs.rewriteTailwindcssImportsInCode.call(void 0, code, weappTailwindcssDirPosix, { join: joinPosixPath });
|
|
396
|
+
if (!rewritten) {
|
|
397
|
+
return null;
|
|
398
|
+
}
|
|
399
|
+
return {
|
|
400
|
+
code: rewritten,
|
|
401
|
+
map: null
|
|
402
|
+
};
|
|
386
403
|
}
|
|
387
|
-
return {
|
|
388
|
-
code: rewritten,
|
|
389
|
-
map: null
|
|
390
|
-
};
|
|
391
404
|
}
|
|
392
405
|
}
|
|
393
406
|
];
|
|
394
407
|
const plugins = [
|
|
395
408
|
...rewritePlugins,
|
|
396
409
|
{
|
|
397
|
-
name: `${
|
|
410
|
+
name: `${_chunkYKMZHWQ4js.vitePluginName}:post`,
|
|
398
411
|
enforce: "post",
|
|
399
412
|
configResolved(config) {
|
|
400
413
|
resolvedConfig = config;
|
|
@@ -420,7 +433,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
420
433
|
for (const [fileName, output] of entries) {
|
|
421
434
|
const entry = { fileName, output };
|
|
422
435
|
if (isJavaScriptEntry(entry)) {
|
|
423
|
-
const absolute =
|
|
436
|
+
const absolute = _chunkAB45L5FPjs.toAbsoluteOutputPath.call(void 0, fileName, outDir);
|
|
424
437
|
jsEntries.set(absolute, entry);
|
|
425
438
|
}
|
|
426
439
|
}
|
|
@@ -484,7 +497,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
484
497
|
if (Array.isArray(groupedEntries.js)) {
|
|
485
498
|
for (const [file, originalSource] of groupedEntries.js) {
|
|
486
499
|
if (originalSource.type === "chunk") {
|
|
487
|
-
const absoluteFile =
|
|
500
|
+
const absoluteFile = _chunkAB45L5FPjs.toAbsoluteOutputPath.call(void 0, file, outDir);
|
|
488
501
|
const initialRawSource = originalSource.code;
|
|
489
502
|
jsTaskFactories.push(async () => {
|
|
490
503
|
await _chunkLTJQUORKjs.processCachedTask.call(void 0, {
|
|
@@ -510,7 +523,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
510
523
|
});
|
|
511
524
|
});
|
|
512
525
|
} else if (uniAppX && originalSource.type === "asset") {
|
|
513
|
-
const absoluteFile =
|
|
526
|
+
const absoluteFile = _chunkAB45L5FPjs.toAbsoluteOutputPath.call(void 0, file, outDir);
|
|
514
527
|
const rawSource = originalSource.source.toString();
|
|
515
528
|
jsTaskFactories.push(async () => {
|
|
516
529
|
await _chunkLTJQUORKjs.processCachedTask.call(void 0, {
|
|
@@ -581,7 +594,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
581
594
|
);
|
|
582
595
|
}
|
|
583
596
|
}
|
|
584
|
-
|
|
597
|
+
_chunkAB45L5FPjs.pushConcurrentTaskFactories.call(void 0, tasks, jsTaskFactories);
|
|
585
598
|
await Promise.all(tasks);
|
|
586
599
|
for (const apply of pendingLinkedUpdates) {
|
|
587
600
|
apply();
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkYKMZHWQ4js = require('./chunk-YKMZHWQ4.js');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkRJRLVYVJjs = require('./chunk-RJRLVYVJ.js');
|
|
8
|
+
|
|
9
|
+
// src/tailwindcss/recorder.ts
|
|
10
|
+
function setupPatchRecorder(patcher, baseDir, options) {
|
|
11
|
+
const recorder = _chunkYKMZHWQ4js.createPatchTargetRecorder.call(void 0, baseDir, patcher, options);
|
|
12
|
+
if (_optionalChain([recorder, 'optionalAccess', _ => _.message]) && _optionalChain([options, 'optionalAccess', _2 => _2.logMessage]) !== false) {
|
|
13
|
+
const prefix = _optionalChain([options, 'optionalAccess', _3 => _3.messagePrefix]) ? `${options.messagePrefix} ` : "";
|
|
14
|
+
_chunkRJRLVYVJjs.logger.info("%s%s", prefix, recorder.message);
|
|
15
|
+
}
|
|
16
|
+
const onPatchCompleted = _optionalChain([recorder, 'optionalAccess', _4 => _4.onPatched]) ? async () => {
|
|
17
|
+
await recorder.onPatched();
|
|
18
|
+
} : void 0;
|
|
19
|
+
const patchPromise = patcher ? _chunkYKMZHWQ4js.createTailwindPatchPromise.call(void 0, patcher, onPatchCompleted) : Promise.resolve();
|
|
20
|
+
return {
|
|
21
|
+
recorder,
|
|
22
|
+
patchPromise,
|
|
23
|
+
onPatchCompleted
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
exports.setupPatchRecorder = setupPatchRecorder;
|
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkUTZLVU3Mjs = require('./chunk-UTZLVU3M.js');
|
|
7
7
|
|
|
8
8
|
// src/context/tailwindcss.ts
|
|
9
|
-
var _fs = require('fs');
|
|
10
9
|
var _module = require('module');
|
|
11
10
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
12
11
|
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
@@ -14,7 +13,7 @@ var _url = require('url');
|
|
|
14
13
|
var _logger = require('@weapp-tailwindcss/logger');
|
|
15
14
|
|
|
16
15
|
// src/context/workspace.ts
|
|
17
|
-
|
|
16
|
+
var _fs = require('fs');
|
|
18
17
|
|
|
19
18
|
var IGNORED_WORKSPACE_DIRS = /* @__PURE__ */ new Set([
|
|
20
19
|
"node_modules",
|
|
@@ -44,6 +43,23 @@ function findWorkspaceRoot(startDir) {
|
|
|
44
43
|
current = parent;
|
|
45
44
|
}
|
|
46
45
|
}
|
|
46
|
+
function findNearestPackageRoot(startDir) {
|
|
47
|
+
if (!startDir) {
|
|
48
|
+
return void 0;
|
|
49
|
+
}
|
|
50
|
+
let current = _path2.default.resolve(startDir);
|
|
51
|
+
while (true) {
|
|
52
|
+
const pkgPath = _path2.default.join(current, "package.json");
|
|
53
|
+
if (_fs.existsSync.call(void 0, pkgPath)) {
|
|
54
|
+
return current;
|
|
55
|
+
}
|
|
56
|
+
const parent = _path2.default.dirname(current);
|
|
57
|
+
if (parent === current) {
|
|
58
|
+
return void 0;
|
|
59
|
+
}
|
|
60
|
+
current = parent;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
47
63
|
function findWorkspacePackageDir(rootDir, packageName) {
|
|
48
64
|
const visited = /* @__PURE__ */ new Set();
|
|
49
65
|
const queue = [_path2.default.resolve(rootDir)];
|
|
@@ -114,7 +130,7 @@ function resolveModuleFromPaths(specifier, paths) {
|
|
|
114
130
|
return void 0;
|
|
115
131
|
}
|
|
116
132
|
try {
|
|
117
|
-
const req = _module.createRequire.call(void 0,
|
|
133
|
+
const req = _module.createRequire.call(void 0, _chunkUTZLVU3Mjs.importMetaUrl);
|
|
118
134
|
return req.resolve(specifier, { paths });
|
|
119
135
|
} catch (e3) {
|
|
120
136
|
return void 0;
|
|
@@ -170,23 +186,6 @@ function createFallbackTailwindcssPatcher() {
|
|
|
170
186
|
};
|
|
171
187
|
}
|
|
172
188
|
var hasLoggedMissingTailwind = false;
|
|
173
|
-
function findNearestPackageRoot(startDir) {
|
|
174
|
-
if (!startDir) {
|
|
175
|
-
return void 0;
|
|
176
|
-
}
|
|
177
|
-
let current = _path2.default.resolve(startDir);
|
|
178
|
-
while (true) {
|
|
179
|
-
const pkgPath = _path2.default.join(current, "package.json");
|
|
180
|
-
if (_fs.existsSync.call(void 0, pkgPath)) {
|
|
181
|
-
return current;
|
|
182
|
-
}
|
|
183
|
-
const parent = _path2.default.dirname(current);
|
|
184
|
-
if (parent === current) {
|
|
185
|
-
return void 0;
|
|
186
|
-
}
|
|
187
|
-
current = parent;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
189
|
function appendNodeModules(paths, dir) {
|
|
191
190
|
if (!dir) {
|
|
192
191
|
return;
|
|
@@ -231,11 +230,11 @@ function createDefaultResolvePaths(basedir) {
|
|
|
231
230
|
const cwd = _process2.default.cwd();
|
|
232
231
|
appendNodeModules(paths, cwd);
|
|
233
232
|
try {
|
|
234
|
-
const modulePath = _url.fileURLToPath.call(void 0,
|
|
233
|
+
const modulePath = _url.fileURLToPath.call(void 0, _chunkUTZLVU3Mjs.importMetaUrl);
|
|
235
234
|
const candidate = _fs.existsSync.call(void 0, modulePath) && !_path2.default.extname(modulePath) ? modulePath : _path2.default.dirname(modulePath);
|
|
236
235
|
paths.add(candidate);
|
|
237
236
|
} catch (e4) {
|
|
238
|
-
paths.add(
|
|
237
|
+
paths.add(_chunkUTZLVU3Mjs.importMetaUrl);
|
|
239
238
|
}
|
|
240
239
|
if (paths.size === 0) {
|
|
241
240
|
fallbackCandidates = fallbackCandidates.filter(Boolean);
|
|
@@ -449,6 +448,11 @@ function createTailwindcssPatcher(options) {
|
|
|
449
448
|
}
|
|
450
449
|
}
|
|
451
450
|
|
|
451
|
+
// src/tailwindcss/index.ts
|
|
452
|
+
function getTailwindcssPackageInfo(options) {
|
|
453
|
+
return _localpkg.getPackageInfoSync.call(void 0, "tailwindcss", options);
|
|
454
|
+
}
|
|
455
|
+
|
|
452
456
|
// src/context/tailwindcss.ts
|
|
453
457
|
var ENV_BASEDIR_KEYS = [
|
|
454
458
|
"WEAPP_TAILWINDCSS_BASEDIR",
|
|
@@ -539,7 +543,9 @@ function resolveTailwindcssBasedir(basedir, fallback) {
|
|
|
539
543
|
const packageEnvBasedir = pickPackageEnvBasedir();
|
|
540
544
|
const shouldDetectCaller = !envBasedir || envBasedirIsGeneric;
|
|
541
545
|
const callerBasedir = shouldDetectCaller ? detectCallerBasedir() : void 0;
|
|
542
|
-
const
|
|
546
|
+
const cwd = _process2.default.cwd();
|
|
547
|
+
const anchor = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(envBasedir, () => ( packageEnvBasedir)), () => ( fallback)), () => ( callerBasedir)), () => ( cwd));
|
|
548
|
+
const resolveRelative = (value) => _path2.default.isAbsolute(value) ? _path2.default.normalize(value) : _path2.default.normalize(_path2.default.resolve(anchor, value));
|
|
543
549
|
if (_process2.default.env.WEAPP_TW_DEBUG_STACK === "1") {
|
|
544
550
|
_logger.logger.debug("resolveTailwindcssBasedir anchor %O", {
|
|
545
551
|
basedir,
|
|
@@ -550,22 +556,18 @@ function resolveTailwindcssBasedir(basedir, fallback) {
|
|
|
550
556
|
fallback,
|
|
551
557
|
callerBasedir,
|
|
552
558
|
npm_package_json: _process2.default.env.npm_package_json,
|
|
553
|
-
cwd
|
|
559
|
+
cwd,
|
|
554
560
|
anchor
|
|
555
561
|
});
|
|
556
562
|
}
|
|
557
563
|
if (basedir && basedir.trim().length > 0) {
|
|
558
|
-
|
|
559
|
-
return _path2.default.normalize(basedir);
|
|
560
|
-
}
|
|
561
|
-
return _path2.default.resolve(anchor, basedir);
|
|
564
|
+
return resolveRelative(basedir);
|
|
562
565
|
}
|
|
563
566
|
if (envBasedir && !envBasedirIsGeneric) {
|
|
564
567
|
return _path2.default.normalize(envBasedir);
|
|
565
568
|
}
|
|
566
569
|
if (fallback && fallback.trim().length > 0) {
|
|
567
|
-
|
|
568
|
-
return _path2.default.normalize(resolvedFallback);
|
|
570
|
+
return resolveRelative(fallback);
|
|
569
571
|
}
|
|
570
572
|
if (packageEnvBasedir) {
|
|
571
573
|
return _path2.default.normalize(packageEnvBasedir);
|
|
@@ -602,24 +604,7 @@ function resolveTailwindcssBasedir(basedir, fallback) {
|
|
|
602
604
|
if (envBasedir) {
|
|
603
605
|
return _path2.default.normalize(envBasedir);
|
|
604
606
|
}
|
|
605
|
-
return _path2.default.normalize(
|
|
606
|
-
}
|
|
607
|
-
function findNearestPackageRootFromDir(startDir) {
|
|
608
|
-
if (!startDir) {
|
|
609
|
-
return void 0;
|
|
610
|
-
}
|
|
611
|
-
let current = _path2.default.resolve(startDir);
|
|
612
|
-
while (true) {
|
|
613
|
-
const pkgPath = _path2.default.join(current, "package.json");
|
|
614
|
-
if (_fs.existsSync.call(void 0, pkgPath)) {
|
|
615
|
-
return current;
|
|
616
|
-
}
|
|
617
|
-
const parent = _path2.default.dirname(current);
|
|
618
|
-
if (parent === current) {
|
|
619
|
-
return void 0;
|
|
620
|
-
}
|
|
621
|
-
current = parent;
|
|
622
|
-
}
|
|
607
|
+
return _path2.default.normalize(cwd);
|
|
623
608
|
}
|
|
624
609
|
function guessBasedirFromEntries(entries) {
|
|
625
610
|
if (!entries) {
|
|
@@ -634,7 +619,7 @@ function guessBasedirFromEntries(entries) {
|
|
|
634
619
|
continue;
|
|
635
620
|
}
|
|
636
621
|
const entryDir = _path2.default.dirname(trimmed);
|
|
637
|
-
const resolved = _nullishCoalesce(
|
|
622
|
+
const resolved = _nullishCoalesce(findNearestPackageRoot(entryDir), () => ( entryDir));
|
|
638
623
|
if (resolved) {
|
|
639
624
|
return resolved;
|
|
640
625
|
}
|
|
@@ -659,10 +644,37 @@ function normalizeCssEntries(entries, anchor) {
|
|
|
659
644
|
}
|
|
660
645
|
return normalized.size > 0 ? [...normalized] : void 0;
|
|
661
646
|
}
|
|
662
|
-
function
|
|
647
|
+
function isSubPath(parent, child) {
|
|
648
|
+
if (!parent || !child) {
|
|
649
|
+
return false;
|
|
650
|
+
}
|
|
651
|
+
const relative = _path2.default.relative(parent, child);
|
|
652
|
+
return relative === "" || !relative.startsWith("..") && !_path2.default.isAbsolute(relative);
|
|
653
|
+
}
|
|
654
|
+
function resolveCssEntryBase(entryDir, options) {
|
|
655
|
+
const normalizedDir = _path2.default.normalize(entryDir);
|
|
656
|
+
const { preferredBaseDir, workspaceRoot } = options;
|
|
657
|
+
if (preferredBaseDir && isSubPath(preferredBaseDir, normalizedDir)) {
|
|
658
|
+
return preferredBaseDir;
|
|
659
|
+
}
|
|
660
|
+
if (workspaceRoot && isSubPath(workspaceRoot, normalizedDir)) {
|
|
661
|
+
return workspaceRoot;
|
|
662
|
+
}
|
|
663
|
+
const packageRoot = findNearestPackageRoot(normalizedDir);
|
|
664
|
+
if (packageRoot) {
|
|
665
|
+
return _path2.default.normalize(packageRoot);
|
|
666
|
+
}
|
|
667
|
+
return normalizedDir;
|
|
668
|
+
}
|
|
669
|
+
function groupCssEntriesByBase(entries, options = {}) {
|
|
670
|
+
const normalizedOptions = {
|
|
671
|
+
preferredBaseDir: options.preferredBaseDir ? _path2.default.normalize(options.preferredBaseDir) : void 0,
|
|
672
|
+
workspaceRoot: options.workspaceRoot ? _path2.default.normalize(options.workspaceRoot) : void 0
|
|
673
|
+
};
|
|
663
674
|
const groups = /* @__PURE__ */ new Map();
|
|
664
675
|
for (const entry of entries) {
|
|
665
|
-
const
|
|
676
|
+
const entryDir = _path2.default.dirname(entry);
|
|
677
|
+
const baseDir = resolveCssEntryBase(entryDir, normalizedOptions);
|
|
666
678
|
const bucket = groups.get(baseDir);
|
|
667
679
|
if (bucket) {
|
|
668
680
|
bucket.push(entry);
|
|
@@ -892,7 +904,11 @@ function createTailwindcssPatcherFromContext(ctx) {
|
|
|
892
904
|
supportCustomLengthUnitsPatch,
|
|
893
905
|
appType
|
|
894
906
|
};
|
|
895
|
-
const
|
|
907
|
+
const workspaceRoot = _nullishCoalesce(findWorkspaceRoot(resolvedTailwindcssBasedir), () => ( (absoluteCssEntryBasedir ? findWorkspaceRoot(absoluteCssEntryBasedir) : void 0)));
|
|
908
|
+
const groupedCssEntries = normalizedCssEntries ? groupCssEntriesByBase(normalizedCssEntries, {
|
|
909
|
+
preferredBaseDir: resolvedTailwindcssBasedir,
|
|
910
|
+
workspaceRoot
|
|
911
|
+
}) : void 0;
|
|
896
912
|
const multiPatcher = groupedCssEntries ? tryCreateMultiTailwindcssPatcher(groupedCssEntries, patcherOptions) : void 0;
|
|
897
913
|
if (multiPatcher) {
|
|
898
914
|
return multiPatcher;
|
|
@@ -912,7 +928,14 @@ function createTailwindcssPatcherFromContext(ctx) {
|
|
|
912
928
|
);
|
|
913
929
|
}
|
|
914
930
|
|
|
931
|
+
// src/logger/index.ts
|
|
932
|
+
|
|
933
|
+
|
|
934
|
+
|
|
935
|
+
|
|
936
|
+
|
|
937
|
+
|
|
915
938
|
|
|
916
939
|
|
|
917
940
|
|
|
918
|
-
exports.resolveTailwindcssBasedir = resolveTailwindcssBasedir; exports.createTailwindcssPatcherFromContext = createTailwindcssPatcherFromContext;
|
|
941
|
+
exports.findWorkspaceRoot = findWorkspaceRoot; exports.findNearestPackageRoot = findNearestPackageRoot; exports.getTailwindcssPackageInfo = getTailwindcssPackageInfo; exports.resolveTailwindcssBasedir = resolveTailwindcssBasedir; exports.createTailwindcssPatcherFromContext = createTailwindcssPatcherFromContext; exports.logger = _logger.logger;
|