weapp-tailwindcss 4.9.2 → 4.9.4

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.
Files changed (54) hide show
  1. package/dist/{chunk-WGBJY2H3.mjs → chunk-3IXWQT3G.mjs} +646 -565
  2. package/dist/{chunk-5O6237HX.js → chunk-4RUFPPI6.js} +400 -377
  3. package/dist/{chunk-2L6NDZIQ.mjs → chunk-6HOLMRXS.mjs} +2 -2
  4. package/dist/{chunk-ZE7JKKFT.mjs → chunk-7D27E7TU.mjs} +438 -415
  5. package/dist/chunk-AJDZJQNR.mjs +444 -0
  6. package/dist/{chunk-U7BH6QHE.js → chunk-DKX737YI.js} +277 -236
  7. package/dist/{chunk-VU2GIXVH.js → chunk-EZWWOZAH.js} +7 -7
  8. package/dist/{chunk-3SKEY32E.mjs → chunk-F2CKKG6Q.mjs} +67 -67
  9. package/dist/{chunk-DNRNFN4I.js → chunk-KHBSYJ76.js} +44 -44
  10. package/dist/{chunk-XXJNXESJ.js → chunk-MVOIVNKL.js} +635 -554
  11. package/dist/{chunk-G5OV7IOU.mjs → chunk-QAEALIIZ.mjs} +2 -2
  12. package/dist/{chunk-FFGR5V3H.mjs → chunk-SPH6SCTM.mjs} +1 -1
  13. package/dist/{chunk-2WPTDMN3.js → chunk-VPHA77FH.js} +61 -61
  14. package/dist/{chunk-DSD5JRCQ.mjs → chunk-WCM6ODS4.mjs} +265 -224
  15. package/dist/{chunk-CBOVUIXD.mjs → chunk-XI2H73CF.mjs} +41 -41
  16. package/dist/{chunk-UAEME5HT.js → chunk-Y6F6NBA7.js} +1 -1
  17. package/dist/chunk-Z3A2XYUL.js +441 -0
  18. package/dist/{chunk-W3MTTQ5M.js → chunk-ZQ7ET56G.js} +5 -5
  19. package/dist/cli.js +182 -136
  20. package/dist/cli.mjs +194 -148
  21. package/dist/core.js +10 -10
  22. package/dist/core.mjs +4 -4
  23. package/dist/css-macro/postcss.js +1 -1
  24. package/dist/css-macro/postcss.mjs +1 -1
  25. package/dist/css-macro.js +1 -1
  26. package/dist/css-macro.mjs +1 -1
  27. package/dist/defaults.js +1 -1
  28. package/dist/defaults.mjs +1 -1
  29. package/dist/gulp.js +6 -6
  30. package/dist/gulp.mjs +5 -5
  31. package/dist/index.js +10 -10
  32. package/dist/index.mjs +9 -9
  33. package/dist/postcss-html-transform.js +1 -1
  34. package/dist/postcss-html-transform.mjs +1 -1
  35. package/dist/presets.js +5 -5
  36. package/dist/presets.mjs +2 -2
  37. package/dist/reset.d.mts +2 -1
  38. package/dist/reset.d.ts +2 -1
  39. package/dist/reset.js +25 -21
  40. package/dist/reset.mjs +25 -21
  41. package/dist/types.d.mts +503 -474
  42. package/dist/types.d.ts +503 -474
  43. package/dist/types.js +1 -1
  44. package/dist/types.mjs +1 -1
  45. package/dist/vite.js +7 -7
  46. package/dist/vite.mjs +6 -6
  47. package/dist/weapp-tw-css-import-rewrite-loader.js +2 -4
  48. package/dist/webpack.js +8 -8
  49. package/dist/webpack.mjs +7 -7
  50. package/dist/webpack4.js +351 -307
  51. package/dist/webpack4.mjs +341 -297
  52. package/package.json +10 -10
  53. package/dist/chunk-5AKI6FQP.mjs +0 -397
  54. package/dist/chunk-SNEMGP42.js +0 -394
@@ -3,13 +3,13 @@
3
3
  var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
4
4
 
5
5
 
6
- var _chunkW3MTTQ5Mjs = require('./chunk-W3MTTQ5M.js');
6
+ var _chunkZQ7ET56Gjs = require('./chunk-ZQ7ET56G.js');
7
7
 
8
8
 
9
9
 
10
10
 
11
11
 
12
- var _chunkXXJNXESJjs = require('./chunk-XXJNXESJ.js');
12
+ var _chunkMVOIVNKLjs = require('./chunk-MVOIVNKL.js');
13
13
 
14
14
  // src/bundlers/gulp/index.ts
15
15
  var _buffer = require('buffer');
@@ -17,12 +17,12 @@ var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
17
17
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
18
18
  var _process = require('process'); var _process2 = _interopRequireDefault(_process);
19
19
  var _stream = require('stream'); var _stream2 = _interopRequireDefault(_stream);
20
- var debug = _chunkXXJNXESJjs.createDebug.call(void 0, );
20
+ var debug = _chunkMVOIVNKLjs.createDebug.call(void 0, );
21
21
  var Transform = _stream2.default.Transform;
22
22
  function createPlugins(options = {}) {
23
- const opts = _chunkXXJNXESJjs.getCompilerContext.call(void 0, options);
23
+ const opts = _chunkMVOIVNKLjs.getCompilerContext.call(void 0, options);
24
24
  const { templateHandler, styleHandler, jsHandler, cache, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
25
- const patchRecorderState = _chunkW3MTTQ5Mjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
25
+ const patchRecorderState = _chunkZQ7ET56Gjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
26
26
  source: "runtime",
27
27
  cwd: _nullishCoalesce(opts.tailwindcssBasedir, () => ( _process2.default.cwd()))
28
28
  });
@@ -36,7 +36,7 @@ function createPlugins(options = {}) {
36
36
  const MODULE_EXTENSIONS = [".js", ".mjs", ".cjs", ".ts", ".tsx", ".jsx"];
37
37
  let runtimeSetInitialized = false;
38
38
  async function refreshRuntimeState(force) {
39
- await _chunkXXJNXESJjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
39
+ await _chunkMVOIVNKLjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
40
40
  }
41
41
  async function refreshRuntimeSet(force = false) {
42
42
  await refreshRuntimeState(force);
@@ -44,7 +44,7 @@ function createPlugins(options = {}) {
44
44
  if (!force && runtimeSetInitialized && runtimeSet.size > 0) {
45
45
  return runtimeSet;
46
46
  }
47
- runtimeSet = await _chunkXXJNXESJjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force, skipRefresh: force });
47
+ runtimeSet = await _chunkMVOIVNKLjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force, skipRefresh: force });
48
48
  runtimeSetInitialized = true;
49
49
  return runtimeSet;
50
50
  }
@@ -1,5 +1,28 @@
1
- // src/bundlers/shared/module-graph.ts
1
+ // src/utils/disabled.ts
2
+ function resolveDisabledOptions(disabled) {
3
+ if (disabled === true) {
4
+ return { plugin: true, rewriteCssImports: false };
5
+ }
6
+ if (disabled === false || disabled == null) {
7
+ return { plugin: false, rewriteCssImports: false };
8
+ }
9
+ return {
10
+ plugin: disabled.plugin ?? false,
11
+ rewriteCssImports: disabled.rewriteCssImports ?? false
12
+ };
13
+ }
14
+
15
+ // src/utils/resolve-package.ts
16
+ import { createRequire } from "module";
2
17
  import path from "path";
18
+ var require2 = createRequire(import.meta.url);
19
+ function resolvePackageDir(name) {
20
+ const pkgPath = require2.resolve(`${name}/package.json`);
21
+ return path.dirname(pkgPath);
22
+ }
23
+
24
+ // src/bundlers/shared/module-graph.ts
25
+ import path2 from "path";
3
26
  var QUERY_HASH_RE = /[?#].*$/u;
4
27
  var PROTOCOL_RE = /^[a-z][a-z+.-]*:/iu;
5
28
  var VIRTUAL_PREFIX = "\0";
@@ -18,16 +41,16 @@ function isResolvableSpecifier(specifier) {
18
41
  return !PROTOCOL_RE.test(normalized);
19
42
  }
20
43
  function toAbsoluteOutputPath(fileName, outDir) {
21
- if (path.isAbsolute(fileName)) {
44
+ if (path2.isAbsolute(fileName)) {
22
45
  return fileName;
23
46
  }
24
- return path.resolve(outDir, fileName);
47
+ return path2.resolve(outDir, fileName);
25
48
  }
26
49
  function matchWithExtensions(candidate, hasOutput) {
27
50
  if (hasOutput(candidate)) {
28
51
  return candidate;
29
52
  }
30
- if (!path.extname(candidate)) {
53
+ if (!path2.extname(candidate)) {
31
54
  for (const ext of JS_EXTENSIONS) {
32
55
  const extended = `${candidate}${ext}`;
33
56
  if (hasOutput(extended)) {
@@ -43,37 +66,54 @@ function resolveOutputSpecifier(specifier, importer, outDir, hasOutput) {
43
66
  }
44
67
  const normalized = stripQueryAndHash(specifier);
45
68
  let candidate;
46
- if (path.isAbsolute(normalized)) {
69
+ if (path2.isAbsolute(normalized)) {
47
70
  candidate = normalized;
48
71
  } else if (normalized.startsWith("/")) {
49
- candidate = path.resolve(outDir, normalized.slice(1));
72
+ candidate = path2.resolve(outDir, normalized.slice(1));
50
73
  } else {
51
- candidate = path.resolve(path.dirname(importer), normalized);
74
+ candidate = path2.resolve(path2.dirname(importer), normalized);
52
75
  }
53
76
  return matchWithExtensions(candidate, hasOutput);
54
77
  }
55
78
 
56
- // src/utils/disabled.ts
57
- function resolveDisabledOptions(disabled) {
58
- if (disabled === true) {
59
- return { plugin: true, rewriteCssImports: false };
60
- }
61
- if (disabled === false || disabled == null) {
62
- return { plugin: false, rewriteCssImports: false };
79
+ // src/bundlers/shared/run-tasks.ts
80
+ async function runWithConcurrency(factories, limit = Math.min(4, Math.max(1, factories.length))) {
81
+ if (factories.length === 0) {
82
+ return [];
63
83
  }
64
- return {
65
- plugin: disabled.plugin ?? false,
66
- rewriteCssImports: disabled.rewriteCssImports ?? false
84
+ const results = Array.from({ length: factories.length });
85
+ const executing = /* @__PURE__ */ new Set();
86
+ let cursor = 0;
87
+ const effectiveLimit = Math.max(1, limit);
88
+ const scheduleNext = () => {
89
+ if (cursor >= factories.length) {
90
+ return;
91
+ }
92
+ const currentIndex = cursor++;
93
+ const wrapped = Promise.resolve(factories[currentIndex]()).then((value) => {
94
+ results[currentIndex] = value;
95
+ }).finally(() => {
96
+ executing.delete(wrapped);
97
+ });
98
+ executing.add(wrapped);
67
99
  };
100
+ while (cursor < factories.length && executing.size < effectiveLimit) {
101
+ scheduleNext();
102
+ }
103
+ while (cursor < factories.length) {
104
+ await Promise.race(executing);
105
+ scheduleNext();
106
+ }
107
+ await Promise.all(executing);
108
+ return results;
68
109
  }
69
-
70
- // src/utils/resolve-package.ts
71
- import { createRequire } from "module";
72
- import path2 from "path";
73
- var require2 = createRequire(import.meta.url);
74
- function resolvePackageDir(name) {
75
- const pkgPath = require2.resolve(`${name}/package.json`);
76
- return path2.dirname(pkgPath);
110
+ function pushConcurrentTaskFactories(queue, factories, limit) {
111
+ if (factories.length === 0) {
112
+ return;
113
+ }
114
+ queue.push(
115
+ runWithConcurrency(factories, limit).then(() => void 0)
116
+ );
77
117
  }
78
118
 
79
119
  // src/bundlers/shared/css-imports.ts
@@ -120,52 +160,12 @@ function rewriteTailwindcssImportsInCode(code, pkgDir, options) {
120
160
  return hasReplacements ? rewritten : void 0;
121
161
  }
122
162
 
123
- // src/bundlers/shared/run-tasks.ts
124
- async function runWithConcurrency(factories, limit = Math.min(4, Math.max(1, factories.length))) {
125
- if (factories.length === 0) {
126
- return [];
127
- }
128
- const results = Array.from({ length: factories.length });
129
- const executing = /* @__PURE__ */ new Set();
130
- let cursor = 0;
131
- const effectiveLimit = Math.max(1, limit);
132
- const scheduleNext = () => {
133
- if (cursor >= factories.length) {
134
- return;
135
- }
136
- const currentIndex = cursor++;
137
- const wrapped = Promise.resolve(factories[currentIndex]()).then((value) => {
138
- results[currentIndex] = value;
139
- }).finally(() => {
140
- executing.delete(wrapped);
141
- });
142
- executing.add(wrapped);
143
- };
144
- while (cursor < factories.length && executing.size < effectiveLimit) {
145
- scheduleNext();
146
- }
147
- while (cursor < factories.length) {
148
- await Promise.race(executing);
149
- scheduleNext();
150
- }
151
- await Promise.all(executing);
152
- return results;
153
- }
154
- function pushConcurrentTaskFactories(queue, factories, limit) {
155
- if (factories.length === 0) {
156
- return;
157
- }
158
- queue.push(
159
- runWithConcurrency(factories, limit).then(() => void 0)
160
- );
161
- }
162
-
163
163
  export {
164
164
  toAbsoluteOutputPath,
165
165
  resolveOutputSpecifier,
166
166
  resolveDisabledOptions,
167
167
  resolvePackageDir,
168
+ pushConcurrentTaskFactories,
168
169
  resolveTailwindcssImport,
169
- rewriteTailwindcssImportsInCode,
170
- pushConcurrentTaskFactories
170
+ rewriteTailwindcssImportsInCode
171
171
  };
@@ -1,9 +1,9 @@
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 _chunk2WPTDMN3js = require('./chunk-2WPTDMN3.js');
3
+ var _chunkVPHA77FHjs = require('./chunk-VPHA77FH.js');
4
4
 
5
5
 
6
- var _chunkXXJNXESJjs = require('./chunk-XXJNXESJ.js');
6
+ var _chunkMVOIVNKLjs = require('./chunk-MVOIVNKL.js');
7
7
 
8
8
  // src/shared/mpx.ts
9
9
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
@@ -144,7 +144,7 @@ function rewriteTailwindcssRequestForCss(data, pkgDir, appType) {
144
144
  if (!CSS_EXT_RE.test(normalizedIssuer)) {
145
145
  return;
146
146
  }
147
- const resolved = _chunk2WPTDMN3js.resolveTailwindcssImport.call(void 0, request, pkgDir, { appType });
147
+ const resolved = _chunkVPHA77FHjs.resolveTailwindcssImport.call(void 0, request, pkgDir, { appType });
148
148
  if (!resolved) {
149
149
  return;
150
150
  }
@@ -154,50 +154,13 @@ function applyTailwindcssCssImportRewrite(compiler, options) {
154
154
  if (!options.enabled) {
155
155
  return;
156
156
  }
157
- compiler.hooks.normalModuleFactory.tap(_chunkXXJNXESJjs.pluginName, (factory) => {
158
- factory.hooks.beforeResolve.tap(_chunkXXJNXESJjs.pluginName, (data) => {
157
+ compiler.hooks.normalModuleFactory.tap(_chunkMVOIVNKLjs.pluginName, (factory) => {
158
+ factory.hooks.beforeResolve.tap(_chunkMVOIVNKLjs.pluginName, (data) => {
159
159
  rewriteTailwindcssRequestForCss(data, options.pkgDir, options.appType);
160
160
  });
161
161
  });
162
162
  }
163
163
 
164
- // src/bundlers/webpack/shared/loader-anchors.ts
165
- var MPX_STRIP_CONDITIONAL_LOADER = "@mpxjs/webpack-plugin/lib/style-compiler/strip-conditional-loader";
166
- var MPX_STYLE_COMPILER_LOADER = "@mpxjs/webpack-plugin/lib/style-compiler/index";
167
- var MPX_REWRITE_PRECEDENCE_LOADERS = [
168
- MPX_STYLE_COMPILER_LOADER,
169
- MPX_STRIP_CONDITIONAL_LOADER
170
- ];
171
- function createFinder(targets) {
172
- return (entries) => entries.findIndex(
173
- (entry) => targets.some((target) => _optionalChain([entry, 'optionalAccess', _5 => _5.loader, 'optionalAccess', _6 => _6.includes, 'optionalCall', _7 => _7(target)]))
174
- );
175
- }
176
- function createPrioritizedFinder(targets) {
177
- return (entries) => {
178
- for (const target of targets) {
179
- const idx = entries.findIndex((entry) => _optionalChain([entry, 'optionalAccess', _8 => _8.loader, 'optionalAccess', _9 => _9.includes, 'optionalCall', _10 => _10(target)]));
180
- if (idx !== -1) {
181
- return idx;
182
- }
183
- }
184
- return -1;
185
- };
186
- }
187
- function createLoaderAnchorFinders(appType) {
188
- if (isMpx(appType)) {
189
- return {
190
- findRewriteAnchor: createPrioritizedFinder(MPX_REWRITE_PRECEDENCE_LOADERS),
191
- findClassSetAnchor: createFinder([MPX_STYLE_COMPILER_LOADER])
192
- };
193
- }
194
- const fallbackFinder = createFinder(["postcss-loader"]);
195
- return {
196
- findRewriteAnchor: fallbackFinder,
197
- findClassSetAnchor: fallbackFinder
198
- };
199
- }
200
-
201
164
  // src/bundlers/webpack/BaseUnifiedPlugin/shared.ts
202
165
  var MPX_STYLE_RESOURCE_QUERY_RE2 = /(?:\?|&)type=styles\b/;
203
166
  function getCacheKey(filename) {
@@ -234,7 +197,44 @@ function hasLoaderEntry(entries, target) {
234
197
  if (!target) {
235
198
  return false;
236
199
  }
237
- return entries.some((entry) => _optionalChain([entry, 'access', _11 => _11.loader, 'optionalAccess', _12 => _12.includes, 'optionalCall', _13 => _13(target)]));
200
+ return entries.some((entry) => _optionalChain([entry, 'access', _5 => _5.loader, 'optionalAccess', _6 => _6.includes, 'optionalCall', _7 => _7(target)]));
201
+ }
202
+
203
+ // src/bundlers/webpack/shared/loader-anchors.ts
204
+ var MPX_STRIP_CONDITIONAL_LOADER = "@mpxjs/webpack-plugin/lib/style-compiler/strip-conditional-loader";
205
+ var MPX_STYLE_COMPILER_LOADER = "@mpxjs/webpack-plugin/lib/style-compiler/index";
206
+ var MPX_REWRITE_PRECEDENCE_LOADERS = [
207
+ MPX_STYLE_COMPILER_LOADER,
208
+ MPX_STRIP_CONDITIONAL_LOADER
209
+ ];
210
+ function createFinder(targets) {
211
+ return (entries) => entries.findIndex(
212
+ (entry) => targets.some((target) => _optionalChain([entry, 'optionalAccess', _8 => _8.loader, 'optionalAccess', _9 => _9.includes, 'optionalCall', _10 => _10(target)]))
213
+ );
214
+ }
215
+ function createPrioritizedFinder(targets) {
216
+ return (entries) => {
217
+ for (const target of targets) {
218
+ const idx = entries.findIndex((entry) => _optionalChain([entry, 'optionalAccess', _11 => _11.loader, 'optionalAccess', _12 => _12.includes, 'optionalCall', _13 => _13(target)]));
219
+ if (idx !== -1) {
220
+ return idx;
221
+ }
222
+ }
223
+ return -1;
224
+ };
225
+ }
226
+ function createLoaderAnchorFinders(appType) {
227
+ if (isMpx(appType)) {
228
+ return {
229
+ findRewriteAnchor: createPrioritizedFinder(MPX_REWRITE_PRECEDENCE_LOADERS),
230
+ findClassSetAnchor: createFinder([MPX_STYLE_COMPILER_LOADER])
231
+ };
232
+ }
233
+ const fallbackFinder = createFinder(["postcss-loader"]);
234
+ return {
235
+ findRewriteAnchor: fallbackFinder,
236
+ findClassSetAnchor: fallbackFinder
237
+ };
238
238
  }
239
239
 
240
240
 
@@ -248,4 +248,4 @@ function hasLoaderEntry(entries, target) {
248
248
 
249
249
 
250
250
 
251
- exports.isMpx = isMpx; exports.ensureMpxTailwindcssAliases = ensureMpxTailwindcssAliases; exports.patchMpxLoaderResolve = patchMpxLoaderResolve; exports.setupMpxTailwindcssRedirect = setupMpxTailwindcssRedirect; exports.injectMpxCssRewritePreRules = injectMpxCssRewritePreRules; exports.applyTailwindcssCssImportRewrite = applyTailwindcssCssImportRewrite; exports.createLoaderAnchorFinders = createLoaderAnchorFinders; exports.getCacheKey = getCacheKey; exports.isCssLikeModuleResource = isCssLikeModuleResource; exports.hasLoaderEntry = hasLoaderEntry;
251
+ exports.isMpx = isMpx; exports.ensureMpxTailwindcssAliases = ensureMpxTailwindcssAliases; exports.patchMpxLoaderResolve = patchMpxLoaderResolve; exports.setupMpxTailwindcssRedirect = setupMpxTailwindcssRedirect; exports.injectMpxCssRewritePreRules = injectMpxCssRewritePreRules; exports.applyTailwindcssCssImportRewrite = applyTailwindcssCssImportRewrite; exports.getCacheKey = getCacheKey; exports.isCssLikeModuleResource = isCssLikeModuleResource; exports.hasLoaderEntry = hasLoaderEntry; exports.createLoaderAnchorFinders = createLoaderAnchorFinders;