weapp-tailwindcss 4.8.2 → 4.8.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-IXZDFEPL.js → chunk-26ZRX6OH.js} +27 -19
- package/dist/{chunk-467NHGLF.js → chunk-2ZEOKKVA.js} +107 -33
- package/dist/{chunk-HCXLLOIU.mjs → chunk-7KTLLGAG.mjs} +126 -52
- package/dist/{chunk-OJRQGFJR.mjs → chunk-E3GZQTOH.mjs} +16 -8
- package/dist/{chunk-GVPBDBX4.mjs → chunk-KSHK56CW.mjs} +1 -1
- package/dist/{chunk-K7AD7FLJ.js → chunk-N2ZUYGKA.js} +6 -6
- package/dist/{chunk-5BZA7BAP.mjs → chunk-NLLCK6RM.mjs} +1 -1
- package/dist/{chunk-ACSKKIYM.js → chunk-PLV4QGF4.js} +3 -3
- package/dist/{chunk-JPLWILCP.js → chunk-UCA2DMVN.js} +3 -3
- package/dist/{chunk-6OTI5FPH.mjs → chunk-UUVGNRUM.mjs} +1 -1
- package/dist/{chunk-Z6IWSDU3.js → chunk-W5Z3I3S2.js} +12 -12
- package/dist/{chunk-W4ERVC6L.mjs → chunk-WTOLVORM.mjs} +1 -1
- package/dist/cli.js +8 -8
- package/dist/cli.mjs +2 -2
- package/dist/core.js +8 -8
- package/dist/core.mjs +2 -2
- package/dist/gulp.js +4 -4
- package/dist/gulp.mjs +3 -3
- package/dist/index.js +7 -7
- package/dist/index.mjs +6 -6
- package/dist/presets.js +2 -2
- package/dist/presets.mjs +1 -1
- package/dist/vite.js +4 -4
- package/dist/vite.mjs +3 -3
- package/dist/weapp-tw-runtime-loader.js +66 -2
- package/dist/webpack.js +5 -5
- package/dist/webpack.mjs +4 -4
- package/dist/webpack4.js +27 -20
- package/dist/webpack4.mjs +16 -9
- package/package.json +3 -3
|
@@ -1,7 +1,7 @@
|
|
|
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
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkUCA2DMVNjs = require('./chunk-UCA2DMVN.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
@@ -18,7 +18,7 @@ var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var
|
|
21
|
+
var _chunkPLV4QGF4js = require('./chunk-PLV4QGF4.js');
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
|
|
@@ -27,11 +27,11 @@ var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
|
|
|
27
27
|
var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
|
|
28
28
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
29
29
|
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
30
|
-
var debug =
|
|
30
|
+
var debug = _chunkPLV4QGF4js.createDebug.call(void 0, );
|
|
31
31
|
var weappTailwindcssPackageDir = _chunkH34KPZQWjs.resolvePackageDir.call(void 0, "weapp-tailwindcss");
|
|
32
32
|
var UnifiedWebpackPluginV5 = class {
|
|
33
33
|
constructor(options = {}) {
|
|
34
|
-
this.options =
|
|
34
|
+
this.options = _chunkPLV4QGF4js.getCompilerContext.call(void 0, options);
|
|
35
35
|
this.userSpecifiedRewriteCssImports = Object.prototype.hasOwnProperty.call(options, "rewriteCssImports");
|
|
36
36
|
this.appType = this.options.appType;
|
|
37
37
|
}
|
|
@@ -56,49 +56,57 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
56
56
|
}
|
|
57
57
|
const shouldRewriteCssImports = this.options.rewriteCssImports !== false && (this.userSpecifiedRewriteCssImports || (_nullishCoalesce(initialTwPatcher.majorVersion, () => ( 0))) >= 4);
|
|
58
58
|
if (shouldRewriteCssImports) {
|
|
59
|
-
|
|
59
|
+
_chunkUCA2DMVNjs.applyTailwindcssCssImportRewrite.call(void 0, compiler, {
|
|
60
60
|
pkgDir: weappTailwindcssPackageDir,
|
|
61
61
|
enabled: true
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
64
|
const runtimeState = {
|
|
65
65
|
twPatcher: initialTwPatcher,
|
|
66
|
-
patchPromise:
|
|
66
|
+
patchPromise: _chunkPLV4QGF4js.createTailwindPatchPromise.call(void 0, initialTwPatcher),
|
|
67
67
|
refreshTailwindcssPatcher
|
|
68
68
|
};
|
|
69
69
|
const refreshRuntimeState = async (force) => {
|
|
70
|
-
await
|
|
70
|
+
await _chunkPLV4QGF4js.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
|
|
71
71
|
};
|
|
72
72
|
const { Compilation, sources, NormalModule } = compiler.webpack;
|
|
73
73
|
const { ConcatSource } = sources;
|
|
74
74
|
async function getClassSetInLoader() {
|
|
75
75
|
await refreshRuntimeState(true);
|
|
76
76
|
await runtimeState.patchPromise;
|
|
77
|
-
await
|
|
77
|
+
await _chunkPLV4QGF4js.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
|
|
78
78
|
}
|
|
79
79
|
onLoad();
|
|
80
80
|
const loader = _nullishCoalesce(runtimeLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-runtime-loader.js")));
|
|
81
81
|
const isExisted = _fs2.default.existsSync(loader);
|
|
82
|
-
const
|
|
82
|
+
const runtimeLoaderRewriteOptions = shouldRewriteCssImports ? {
|
|
83
|
+
pkgDir: weappTailwindcssPackageDir
|
|
84
|
+
} : void 0;
|
|
85
|
+
const runtimeLoaderOptions = {
|
|
86
|
+
getClassSet: getClassSetInLoader,
|
|
87
|
+
rewriteCssImports: runtimeLoaderRewriteOptions
|
|
88
|
+
};
|
|
89
|
+
const createRuntimeLoaderEntry = () => ({
|
|
83
90
|
loader,
|
|
84
|
-
options:
|
|
85
|
-
getClassSet: getClassSetInLoader
|
|
86
|
-
},
|
|
91
|
+
options: runtimeLoaderOptions,
|
|
87
92
|
ident: null,
|
|
88
93
|
type: null
|
|
89
|
-
};
|
|
90
|
-
compiler.hooks.compilation.tap(
|
|
91
|
-
NormalModule.getCompilationHooks(compilation).loader.tap(
|
|
94
|
+
});
|
|
95
|
+
compiler.hooks.compilation.tap(_chunkPLV4QGF4js.pluginName, (compilation) => {
|
|
96
|
+
NormalModule.getCompilationHooks(compilation).loader.tap(_chunkPLV4QGF4js.pluginName, (_loaderContext, module) => {
|
|
92
97
|
if (isExisted) {
|
|
93
98
|
const idx = module.loaders.findIndex((x) => x.loader.includes("postcss-loader"));
|
|
99
|
+
const runtimeLoaderEntry = createRuntimeLoaderEntry();
|
|
94
100
|
if (idx > -1) {
|
|
95
|
-
module.loaders.
|
|
101
|
+
module.loaders.splice(idx + 1, 0, runtimeLoaderEntry);
|
|
102
|
+
} else {
|
|
103
|
+
module.loaders.push(runtimeLoaderEntry);
|
|
96
104
|
}
|
|
97
105
|
}
|
|
98
106
|
});
|
|
99
107
|
compilation.hooks.processAssets.tapPromise(
|
|
100
108
|
{
|
|
101
|
-
name:
|
|
109
|
+
name: _chunkPLV4QGF4js.pluginName,
|
|
102
110
|
stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
|
|
103
111
|
},
|
|
104
112
|
async (assets) => {
|
|
@@ -167,7 +175,7 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
167
175
|
const groupedEntries = _chunkUW3WHSZ5js.getGroupedEntries.call(void 0, entries, this.options);
|
|
168
176
|
await refreshRuntimeState(true);
|
|
169
177
|
await runtimeState.patchPromise;
|
|
170
|
-
const runtimeSet = await
|
|
178
|
+
const runtimeSet = await _chunkPLV4QGF4js.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
|
|
171
179
|
debug("get runtimeSet, class count: %d", runtimeSet.size);
|
|
172
180
|
const tasks = [];
|
|
173
181
|
if (Array.isArray(groupedEntries.html)) {
|
|
@@ -204,7 +212,7 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
204
212
|
const jsTaskFactories = [];
|
|
205
213
|
if (Array.isArray(groupedEntries.js)) {
|
|
206
214
|
for (const [file] of groupedEntries.js) {
|
|
207
|
-
const cacheKey =
|
|
215
|
+
const cacheKey = _chunkUCA2DMVNjs.getCacheKey.call(void 0, file);
|
|
208
216
|
const asset = compilation.getAsset(file);
|
|
209
217
|
if (!asset) {
|
|
210
218
|
continue;
|
|
@@ -13,6 +13,73 @@ var _process = require('process'); var _process2 = _interopRequireDefault(_proce
|
|
|
13
13
|
var _url = require('url');
|
|
14
14
|
var _logger = require('@weapp-tailwindcss/logger');
|
|
15
15
|
|
|
16
|
+
// src/context/workspace.ts
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
var IGNORED_WORKSPACE_DIRS = /* @__PURE__ */ new Set([
|
|
20
|
+
"node_modules",
|
|
21
|
+
".git",
|
|
22
|
+
".hg",
|
|
23
|
+
".svn",
|
|
24
|
+
".turbo",
|
|
25
|
+
".output",
|
|
26
|
+
".next",
|
|
27
|
+
"dist",
|
|
28
|
+
"build"
|
|
29
|
+
]);
|
|
30
|
+
function findWorkspaceRoot(startDir) {
|
|
31
|
+
if (!startDir) {
|
|
32
|
+
return void 0;
|
|
33
|
+
}
|
|
34
|
+
let current = _path2.default.resolve(startDir);
|
|
35
|
+
while (true) {
|
|
36
|
+
const workspaceFile = _path2.default.join(current, "pnpm-workspace.yaml");
|
|
37
|
+
if (_fs.existsSync.call(void 0, workspaceFile)) {
|
|
38
|
+
return current;
|
|
39
|
+
}
|
|
40
|
+
const parent = _path2.default.dirname(current);
|
|
41
|
+
if (parent === current) {
|
|
42
|
+
return void 0;
|
|
43
|
+
}
|
|
44
|
+
current = parent;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function findWorkspacePackageDir(rootDir, packageName) {
|
|
48
|
+
const visited = /* @__PURE__ */ new Set();
|
|
49
|
+
const queue = [_path2.default.resolve(rootDir)];
|
|
50
|
+
while (queue.length > 0) {
|
|
51
|
+
const current = queue.shift();
|
|
52
|
+
const normalized = _path2.default.normalize(current);
|
|
53
|
+
if (visited.has(normalized)) {
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
visited.add(normalized);
|
|
57
|
+
try {
|
|
58
|
+
const pkgPath = _path2.default.join(normalized, "package.json");
|
|
59
|
+
if (_fs.existsSync.call(void 0, pkgPath)) {
|
|
60
|
+
const pkg = JSON.parse(_fs.readFileSync.call(void 0, pkgPath, "utf8"));
|
|
61
|
+
if (_optionalChain([pkg, 'optionalAccess', _ => _.name]) === packageName) {
|
|
62
|
+
return normalized;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
} catch (e) {
|
|
66
|
+
}
|
|
67
|
+
let entries;
|
|
68
|
+
try {
|
|
69
|
+
entries = _fs.readdirSync.call(void 0, normalized, { withFileTypes: true });
|
|
70
|
+
} catch (e2) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
for (const entry of entries) {
|
|
74
|
+
if (!entry.isDirectory() || IGNORED_WORKSPACE_DIRS.has(entry.name) || _optionalChain([entry, 'access', _2 => _2.isSymbolicLink, 'optionalCall', _3 => _3()])) {
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
queue.push(_path2.default.join(normalized, entry.name));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return void 0;
|
|
81
|
+
}
|
|
82
|
+
|
|
16
83
|
// src/tailwindcss/index.ts
|
|
17
84
|
var _localpkg = require('local-pkg');
|
|
18
85
|
|
|
@@ -49,7 +116,7 @@ function resolveModuleFromPaths(specifier, paths) {
|
|
|
49
116
|
try {
|
|
50
117
|
const req = _module.createRequire.call(void 0, _chunkUJIUFWXEjs.importMetaUrl);
|
|
51
118
|
return req.resolve(specifier, { paths });
|
|
52
|
-
} catch (
|
|
119
|
+
} catch (e3) {
|
|
53
120
|
return void 0;
|
|
54
121
|
}
|
|
55
122
|
}
|
|
@@ -167,7 +234,7 @@ function createDefaultResolvePaths(basedir) {
|
|
|
167
234
|
const modulePath = _url.fileURLToPath.call(void 0, _chunkUJIUFWXEjs.importMetaUrl);
|
|
168
235
|
const candidate = _fs.existsSync.call(void 0, modulePath) && !_path2.default.extname(modulePath) ? modulePath : _path2.default.dirname(modulePath);
|
|
169
236
|
paths.add(candidate);
|
|
170
|
-
} catch (
|
|
237
|
+
} catch (e4) {
|
|
171
238
|
paths.add(_chunkUJIUFWXEjs.importMetaUrl);
|
|
172
239
|
}
|
|
173
240
|
if (paths.size === 0) {
|
|
@@ -206,28 +273,28 @@ function normalizeTailwindcssPatcherOptions(options) {
|
|
|
206
273
|
if (cache !== void 0) {
|
|
207
274
|
normalized.cache = cache;
|
|
208
275
|
}
|
|
209
|
-
if (_optionalChain([patch, 'optionalAccess',
|
|
276
|
+
if (_optionalChain([patch, 'optionalAccess', _4 => _4.overwrite]) !== void 0) {
|
|
210
277
|
normalized.overwrite = patch.overwrite;
|
|
211
278
|
}
|
|
212
|
-
if (_optionalChain([patch, 'optionalAccess',
|
|
279
|
+
if (_optionalChain([patch, 'optionalAccess', _5 => _5.filter])) {
|
|
213
280
|
normalized.filter = patch.filter;
|
|
214
281
|
}
|
|
215
|
-
const extendLengthUnits = normalizeExtendLengthUnits(_optionalChain([patch, 'optionalAccess',
|
|
216
|
-
const exposeContext = _optionalChain([patch, 'optionalAccess',
|
|
282
|
+
const extendLengthUnits = normalizeExtendLengthUnits(_optionalChain([patch, 'optionalAccess', _6 => _6.applyPatches, 'optionalAccess', _7 => _7.extendLengthUnits]));
|
|
283
|
+
const exposeContext = _optionalChain([patch, 'optionalAccess', _8 => _8.applyPatches, 'optionalAccess', _9 => _9.exportContext]);
|
|
217
284
|
if (extendLengthUnits !== void 0 || exposeContext !== void 0) {
|
|
218
285
|
normalized.features = {
|
|
219
286
|
exposeContext,
|
|
220
287
|
extendLengthUnits
|
|
221
288
|
};
|
|
222
289
|
}
|
|
223
|
-
const cwd = _nullishCoalesce(_optionalChain([patch, 'optionalAccess',
|
|
290
|
+
const cwd = _nullishCoalesce(_optionalChain([patch, 'optionalAccess', _10 => _10.cwd]), () => ( _optionalChain([patch, 'optionalAccess', _11 => _11.basedir])));
|
|
224
291
|
if (cwd) {
|
|
225
292
|
normalized.cwd = cwd;
|
|
226
293
|
}
|
|
227
|
-
const tailwindOptions = _optionalChain([patch, 'optionalAccess',
|
|
228
|
-
const legacyResolve = _optionalChain([patch, 'optionalAccess',
|
|
294
|
+
const tailwindOptions = _optionalChain([patch, 'optionalAccess', _12 => _12.tailwindcss]) ? { ...patch.tailwindcss } : void 0;
|
|
295
|
+
const legacyResolve = _optionalChain([patch, 'optionalAccess', _13 => _13.resolve]);
|
|
229
296
|
let nextTailwindOptions = tailwindOptions;
|
|
230
|
-
if (_optionalChain([nextTailwindOptions, 'optionalAccess',
|
|
297
|
+
if (_optionalChain([nextTailwindOptions, 'optionalAccess', _14 => _14.version]) === 2 && !nextTailwindOptions.packageName) {
|
|
231
298
|
nextTailwindOptions = {
|
|
232
299
|
...nextTailwindOptions,
|
|
233
300
|
packageName: "@tailwindcss/postcss7-compat",
|
|
@@ -238,7 +305,7 @@ function normalizeTailwindcssPatcherOptions(options) {
|
|
|
238
305
|
}
|
|
239
306
|
}
|
|
240
307
|
if (nextTailwindOptions || legacyResolve) {
|
|
241
|
-
const resolveOptions = _optionalChain([nextTailwindOptions, 'optionalAccess',
|
|
308
|
+
const resolveOptions = _optionalChain([nextTailwindOptions, 'optionalAccess', _15 => _15.resolve]);
|
|
242
309
|
const mergedResolve = legacyResolve || resolveOptions ? {
|
|
243
310
|
..._nullishCoalesce(resolveOptions, () => ( {})),
|
|
244
311
|
..._nullishCoalesce(legacyResolve, () => ( {}))
|
|
@@ -332,7 +399,7 @@ function createTailwindcssPatcher(options) {
|
|
|
332
399
|
if (typeof resolvedOptions.tailwind.postcssPlugin === "string") {
|
|
333
400
|
const resolvedPlugin = resolveModuleFromPaths(
|
|
334
401
|
resolvedOptions.tailwind.postcssPlugin,
|
|
335
|
-
_nullishCoalesce(_optionalChain([resolvedOptions, 'access',
|
|
402
|
+
_nullishCoalesce(_optionalChain([resolvedOptions, 'access', _16 => _16.tailwind, 'access', _17 => _17.resolve, 'optionalAccess', _18 => _18.paths]), () => ( resolvePaths))
|
|
336
403
|
);
|
|
337
404
|
if (resolvedPlugin) {
|
|
338
405
|
resolvedOptions.tailwind.postcssPlugin = resolvedPlugin;
|
|
@@ -342,7 +409,7 @@ function createTailwindcssPatcher(options) {
|
|
|
342
409
|
if (resolvedOptions.tailwind.cwd) {
|
|
343
410
|
searchRoots.add(resolvedOptions.tailwind.cwd);
|
|
344
411
|
}
|
|
345
|
-
for (const resolvePath of _nullishCoalesce(_optionalChain([resolvedOptions, 'access',
|
|
412
|
+
for (const resolvePath of _nullishCoalesce(_optionalChain([resolvedOptions, 'access', _19 => _19.tailwind, 'access', _20 => _20.resolve, 'optionalAccess', _21 => _21.paths]), () => ( []))) {
|
|
346
413
|
const parentDir = _path2.default.dirname(resolvePath);
|
|
347
414
|
searchRoots.add(parentDir);
|
|
348
415
|
}
|
|
@@ -367,7 +434,7 @@ function createTailwindcssPatcher(options) {
|
|
|
367
434
|
try {
|
|
368
435
|
return new (0, _tailwindcsspatch.TailwindcssPatcher)(resolvedOptions);
|
|
369
436
|
} catch (error) {
|
|
370
|
-
const searchPaths = _optionalChain([resolvedOptions, 'access',
|
|
437
|
+
const searchPaths = _optionalChain([resolvedOptions, 'access', _22 => _22.tailwind, 'optionalAccess', _23 => _23.resolve, 'optionalAccess', _24 => _24.paths]);
|
|
371
438
|
if (error instanceof Error && /tailwindcss not found/i.test(error.message)) {
|
|
372
439
|
if (!hasLoggedMissingTailwind) {
|
|
373
440
|
_logger.logger.warn("Tailwind CSS \u672A\u5B89\u88C5\uFF0C\u5DF2\u8DF3\u8FC7 Tailwind \u76F8\u5173\u8865\u4E01\u3002\u82E5\u9700\u4F7F\u7528 Tailwind \u80FD\u529B\uFF0C\u8BF7\u5B89\u88C5 tailwindcss\u3002");
|
|
@@ -376,7 +443,7 @@ function createTailwindcssPatcher(options) {
|
|
|
376
443
|
return createFallbackTailwindcssPatcher();
|
|
377
444
|
}
|
|
378
445
|
if (error instanceof Error && /unable to locate tailwind css package/i.test(error.message)) {
|
|
379
|
-
_logger.logger.error('\u65E0\u6CD5\u5B9A\u4F4D Tailwind CSS \u5305 "%s"\uFF0C\u5DF2\u5C1D\u8BD5\u8DEF\u5F84: %O', _optionalChain([resolvedOptions, 'access',
|
|
446
|
+
_logger.logger.error('\u65E0\u6CD5\u5B9A\u4F4D Tailwind CSS \u5305 "%s"\uFF0C\u5DF2\u5C1D\u8BD5\u8DEF\u5F84: %O', _optionalChain([resolvedOptions, 'access', _25 => _25.tailwind, 'optionalAccess', _26 => _26.packageName]), searchPaths);
|
|
380
447
|
}
|
|
381
448
|
throw error;
|
|
382
449
|
}
|
|
@@ -436,7 +503,7 @@ function detectCallerBasedir() {
|
|
|
436
503
|
const lines = stack.split("\n");
|
|
437
504
|
for (const line of lines) {
|
|
438
505
|
const match = _nullishCoalesce(line.match(/\(([^)]+)\)/u), () => ( line.match(/at\s+(\S.*)$/u)));
|
|
439
|
-
const location = _optionalChain([match, 'optionalAccess',
|
|
506
|
+
const location = _optionalChain([match, 'optionalAccess', _27 => _27[1]]);
|
|
440
507
|
if (!location) {
|
|
441
508
|
continue;
|
|
442
509
|
}
|
|
@@ -444,7 +511,7 @@ function detectCallerBasedir() {
|
|
|
444
511
|
if (filePath.startsWith("file://")) {
|
|
445
512
|
try {
|
|
446
513
|
filePath = _url.fileURLToPath.call(void 0, filePath);
|
|
447
|
-
} catch (
|
|
514
|
+
} catch (e5) {
|
|
448
515
|
continue;
|
|
449
516
|
}
|
|
450
517
|
}
|
|
@@ -458,7 +525,7 @@ function detectCallerBasedir() {
|
|
|
458
525
|
}
|
|
459
526
|
try {
|
|
460
527
|
return _path2.default.dirname(resolvedPath);
|
|
461
|
-
} catch (
|
|
528
|
+
} catch (e6) {
|
|
462
529
|
continue;
|
|
463
530
|
}
|
|
464
531
|
}
|
|
@@ -466,8 +533,8 @@ function detectCallerBasedir() {
|
|
|
466
533
|
}
|
|
467
534
|
function resolveTailwindcssBasedir(basedir, fallback) {
|
|
468
535
|
const envBasedirResult = pickEnvBasedir();
|
|
469
|
-
const envBasedir = _optionalChain([envBasedirResult, 'optionalAccess',
|
|
470
|
-
const envBasedirKey = _optionalChain([envBasedirResult, 'optionalAccess',
|
|
536
|
+
const envBasedir = _optionalChain([envBasedirResult, 'optionalAccess', _28 => _28.value]);
|
|
537
|
+
const envBasedirKey = _optionalChain([envBasedirResult, 'optionalAccess', _29 => _29.key]);
|
|
471
538
|
const envBasedirIsGeneric = envBasedirKey ? GENERIC_ENV_BASEDIR_KEYS.has(envBasedirKey) : false;
|
|
472
539
|
const packageEnvBasedir = pickPackageEnvBasedir();
|
|
473
540
|
const shouldDetectCaller = !envBasedir || envBasedirIsGeneric;
|
|
@@ -510,9 +577,6 @@ function resolveTailwindcssBasedir(basedir, fallback) {
|
|
|
510
577
|
return normalizedCaller;
|
|
511
578
|
}
|
|
512
579
|
}
|
|
513
|
-
if (envBasedir) {
|
|
514
|
-
return _path2.default.normalize(envBasedir);
|
|
515
|
-
}
|
|
516
580
|
const packageName = _process2.default.env.PNPM_PACKAGE_NAME;
|
|
517
581
|
if (packageName) {
|
|
518
582
|
try {
|
|
@@ -522,12 +586,22 @@ function resolveTailwindcssBasedir(basedir, fallback) {
|
|
|
522
586
|
_logger.logger.debug("package basedir resolved from PNPM_PACKAGE_NAME: %s", packageJsonPath);
|
|
523
587
|
}
|
|
524
588
|
return _path2.default.normalize(_path2.default.dirname(packageJsonPath));
|
|
525
|
-
} catch (
|
|
589
|
+
} catch (e7) {
|
|
526
590
|
if (_process2.default.env.WEAPP_TW_DEBUG_STACK === "1") {
|
|
527
591
|
_logger.logger.debug("failed to resolve package json for %s", packageName);
|
|
528
592
|
}
|
|
593
|
+
const workspaceRoot = findWorkspaceRoot(anchor);
|
|
594
|
+
if (workspaceRoot) {
|
|
595
|
+
const packageDir = findWorkspacePackageDir(workspaceRoot, packageName);
|
|
596
|
+
if (packageDir) {
|
|
597
|
+
return packageDir;
|
|
598
|
+
}
|
|
599
|
+
}
|
|
529
600
|
}
|
|
530
601
|
}
|
|
602
|
+
if (envBasedir) {
|
|
603
|
+
return _path2.default.normalize(envBasedir);
|
|
604
|
+
}
|
|
531
605
|
return _path2.default.normalize(_process2.default.cwd());
|
|
532
606
|
}
|
|
533
607
|
function findNearestPackageRootFromDir(startDir) {
|
|
@@ -665,7 +739,7 @@ function createPatcherForBase(baseDir, cssEntries, options) {
|
|
|
665
739
|
cssEntries
|
|
666
740
|
}
|
|
667
741
|
};
|
|
668
|
-
if (_optionalChain([cssEntries, 'optionalAccess',
|
|
742
|
+
if (_optionalChain([cssEntries, 'optionalAccess', _30 => _30.length]) && (tailwindcss == null || tailwindcss.version == null)) {
|
|
669
743
|
defaultTailwindcssConfig.version = 4;
|
|
670
744
|
}
|
|
671
745
|
const mergedTailwindOptions = _chunkUW3WHSZ5js.defuOverrideArray.call(void 0,
|
|
@@ -679,7 +753,7 @@ function createPatcherForBase(baseDir, cssEntries, options) {
|
|
|
679
753
|
};
|
|
680
754
|
} else {
|
|
681
755
|
mergedTailwindOptions.v4.base = baseDir;
|
|
682
|
-
if (_optionalChain([cssEntries, 'optionalAccess',
|
|
756
|
+
if (_optionalChain([cssEntries, 'optionalAccess', _31 => _31.length])) {
|
|
683
757
|
mergedTailwindOptions.v4.cssEntries = cssEntries;
|
|
684
758
|
} else if (!mergedTailwindOptions.v4.cssEntries) {
|
|
685
759
|
mergedTailwindOptions.v4.cssEntries = [];
|
|
@@ -704,18 +778,18 @@ function createMultiTailwindcssPatcher(patchers) {
|
|
|
704
778
|
}
|
|
705
779
|
const [first] = patchers;
|
|
706
780
|
const multiPatcher = {
|
|
707
|
-
packageInfo: _optionalChain([first, 'optionalAccess',
|
|
708
|
-
majorVersion: _optionalChain([first, 'optionalAccess',
|
|
709
|
-
options: _optionalChain([first, 'optionalAccess',
|
|
781
|
+
packageInfo: _optionalChain([first, 'optionalAccess', _32 => _32.packageInfo]),
|
|
782
|
+
majorVersion: _optionalChain([first, 'optionalAccess', _33 => _33.majorVersion]),
|
|
783
|
+
options: _optionalChain([first, 'optionalAccess', _34 => _34.options]),
|
|
710
784
|
async patch() {
|
|
711
785
|
let exposeContext;
|
|
712
786
|
let extendLengthUnits;
|
|
713
787
|
for (const patcher of patchers) {
|
|
714
788
|
const result = await patcher.patch();
|
|
715
|
-
if (_optionalChain([result, 'optionalAccess',
|
|
789
|
+
if (_optionalChain([result, 'optionalAccess', _35 => _35.exposeContext]) && exposeContext == null) {
|
|
716
790
|
exposeContext = result.exposeContext;
|
|
717
791
|
}
|
|
718
|
-
if (_optionalChain([result, 'optionalAccess',
|
|
792
|
+
if (_optionalChain([result, 'optionalAccess', _36 => _36.extendLengthUnits]) && extendLengthUnits == null) {
|
|
719
793
|
extendLengthUnits = result.extendLengthUnits;
|
|
720
794
|
}
|
|
721
795
|
}
|
|
@@ -771,7 +845,7 @@ function createMultiTailwindcssPatcher(patchers) {
|
|
|
771
845
|
multiPatcher.getClassSetSync = () => {
|
|
772
846
|
const aggregated = /* @__PURE__ */ new Set();
|
|
773
847
|
for (const patcher of patchers) {
|
|
774
|
-
const current = _optionalChain([patcher, 'access',
|
|
848
|
+
const current = _optionalChain([patcher, 'access', _37 => _37.getClassSetSync, 'optionalCall', _38 => _38()]);
|
|
775
849
|
if (!current) {
|
|
776
850
|
continue;
|
|
777
851
|
}
|
|
@@ -823,7 +897,7 @@ function createTailwindcssPatcherFromContext(ctx) {
|
|
|
823
897
|
if (multiPatcher) {
|
|
824
898
|
return multiPatcher;
|
|
825
899
|
}
|
|
826
|
-
if (_optionalChain([groupedCssEntries, 'optionalAccess',
|
|
900
|
+
if (_optionalChain([groupedCssEntries, 'optionalAccess', _39 => _39.size]) === 1) {
|
|
827
901
|
const firstGroup = groupedCssEntries.entries().next().value;
|
|
828
902
|
if (firstGroup) {
|
|
829
903
|
const [baseDir, entries] = firstGroup;
|