weapp-tailwindcss 4.9.0 → 4.9.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.
Files changed (40) hide show
  1. package/dist/{chunk-NNYRZ4FL.js → chunk-65CKEW6P.js} +24 -24
  2. package/dist/{chunk-YJ4NK2AE.mjs → chunk-7JV2EGN7.mjs} +4 -4
  3. package/dist/{chunk-PT4IJT3Q.js → chunk-APJY6PQW.js} +2 -2
  4. package/dist/{chunk-GIUNRP65.mjs → chunk-BC6TZREM.mjs} +2 -2
  5. package/dist/{chunk-4FB4YO6F.js → chunk-BIFOYWIB.js} +80 -57
  6. package/dist/{chunk-A2OSQ5CV.js → chunk-CYKRAS6K.js} +14 -14
  7. package/dist/chunk-DYLQ6UOI.js +71 -0
  8. package/dist/{chunk-RMTGZQHJ.js → chunk-F4HOQ6DE.js} +7 -7
  9. package/dist/{chunk-6R4BK6D6.js → chunk-FYYBY3VK.js} +5 -5
  10. package/dist/{chunk-SZOXLSNK.mjs → chunk-HEBIKTBC.mjs} +1 -1
  11. package/dist/{chunk-TFOTUR4L.mjs → chunk-HWF5U4CI.mjs} +1 -1
  12. package/dist/{chunk-6OOJ46QK.mjs → chunk-J4FEPPRP.mjs} +60 -37
  13. package/dist/{chunk-QJTJC5UT.mjs → chunk-O35YNDUX.mjs} +1 -1
  14. package/dist/{chunk-RR5HCKVQ.mjs → chunk-OOHJLO5M.mjs} +26 -0
  15. package/dist/{chunk-3M464H7S.mjs → chunk-VNGPHRAS.mjs} +2 -2
  16. package/dist/{chunk-4Z6MHSEO.mjs → chunk-W33YZK2C.mjs} +4 -4
  17. package/dist/{chunk-IGTIMGCP.js → chunk-WOJCMQDF.js} +5 -5
  18. package/dist/{chunk-QZJTOS3U.js → chunk-YDM2M3NT.js} +3 -3
  19. package/dist/cli.js +40 -40
  20. package/dist/cli.mjs +4 -4
  21. package/dist/core.js +11 -11
  22. package/dist/core.mjs +5 -5
  23. package/dist/css-macro.js +2 -2
  24. package/dist/css-macro.mjs +1 -1
  25. package/dist/defaults.js +3 -3
  26. package/dist/defaults.mjs +2 -2
  27. package/dist/gulp.js +7 -7
  28. package/dist/gulp.mjs +6 -6
  29. package/dist/index.js +10 -10
  30. package/dist/index.mjs +9 -9
  31. package/dist/presets.js +12 -8
  32. package/dist/presets.mjs +8 -4
  33. package/dist/vite.js +7 -7
  34. package/dist/vite.mjs +6 -6
  35. package/dist/webpack.js +8 -8
  36. package/dist/webpack.mjs +7 -7
  37. package/dist/webpack4.js +27 -27
  38. package/dist/webpack4.mjs +6 -6
  39. package/package.json +3 -3
  40. package/dist/chunk-FMBPNII7.js +0 -45
@@ -9,7 +9,7 @@
9
9
 
10
10
 
11
11
 
12
- var _chunkQZJTOS3Ujs = require('./chunk-QZJTOS3U.js');
12
+ var _chunkYDM2M3NTjs = require('./chunk-YDM2M3NT.js');
13
13
 
14
14
 
15
15
 
@@ -22,27 +22,27 @@ var _chunkORSWL3MIjs = require('./chunk-ORSWL3MI.js');
22
22
  var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
23
23
 
24
24
 
25
- var _chunkIGTIMGCPjs = require('./chunk-IGTIMGCP.js');
25
+ var _chunkWOJCMQDFjs = require('./chunk-WOJCMQDF.js');
26
26
 
27
27
 
28
28
 
29
29
 
30
30
 
31
31
 
32
- var _chunkA2OSQ5CVjs = require('./chunk-A2OSQ5CV.js');
32
+ var _chunkCYKRAS6Kjs = require('./chunk-CYKRAS6K.js');
33
33
 
34
34
 
35
- var _chunkFMBPNII7js = require('./chunk-FMBPNII7.js');
35
+ var _chunkDYLQ6UOIjs = require('./chunk-DYLQ6UOI.js');
36
36
 
37
37
  // src/bundlers/webpack/BaseUnifiedPlugin/v5.ts
38
38
  var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
39
39
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
40
40
  var _process = require('process'); var _process2 = _interopRequireDefault(_process);
41
- var debug = _chunkA2OSQ5CVjs.createDebug.call(void 0, );
41
+ var debug = _chunkCYKRAS6Kjs.createDebug.call(void 0, );
42
42
  var weappTailwindcssPackageDir = _chunkORSWL3MIjs.resolvePackageDir.call(void 0, "weapp-tailwindcss");
43
43
  var UnifiedWebpackPluginV5 = class {
44
44
  constructor(options = {}) {
45
- this.options = _chunkA2OSQ5CVjs.getCompilerContext.call(void 0, options);
45
+ this.options = _chunkCYKRAS6Kjs.getCompilerContext.call(void 0, options);
46
46
  this.appType = this.options.appType;
47
47
  }
48
48
  apply(compiler) {
@@ -66,19 +66,19 @@ var UnifiedWebpackPluginV5 = class {
66
66
  const disabledOptions = _chunkORSWL3MIjs.resolveDisabledOptions.call(void 0, disabled);
67
67
  const isTailwindcssV4 = (_nullishCoalesce(initialTwPatcher.majorVersion, () => ( 0))) >= 4;
68
68
  const shouldRewriteCssImports = isTailwindcssV4 && this.options.rewriteCssImports !== false && !disabledOptions.rewriteCssImports;
69
- const isMpxApp = _chunkQZJTOS3Ujs.isMpx.call(void 0, this.appType);
69
+ const isMpxApp = _chunkYDM2M3NTjs.isMpx.call(void 0, this.appType);
70
70
  if (shouldRewriteCssImports) {
71
- _chunkQZJTOS3Ujs.applyTailwindcssCssImportRewrite.call(void 0, compiler, {
71
+ _chunkYDM2M3NTjs.applyTailwindcssCssImportRewrite.call(void 0, compiler, {
72
72
  pkgDir: weappTailwindcssPackageDir,
73
73
  enabled: true,
74
74
  appType: this.appType
75
75
  });
76
- _chunkQZJTOS3Ujs.setupMpxTailwindcssRedirect.call(void 0, weappTailwindcssPackageDir, isMpxApp);
76
+ _chunkYDM2M3NTjs.setupMpxTailwindcssRedirect.call(void 0, weappTailwindcssPackageDir, isMpxApp);
77
77
  }
78
78
  if (disabledOptions.plugin) {
79
79
  return;
80
80
  }
81
- const patchRecorderState = _chunkIGTIMGCPjs.setupPatchRecorder.call(void 0, initialTwPatcher, this.options.tailwindcssBasedir, {
81
+ const patchRecorderState = _chunkWOJCMQDFjs.setupPatchRecorder.call(void 0, initialTwPatcher, this.options.tailwindcssBasedir, {
82
82
  source: "runtime",
83
83
  cwd: _nullishCoalesce(this.options.tailwindcssBasedir, () => ( _process2.default.cwd()))
84
84
  });
@@ -89,14 +89,14 @@ var UnifiedWebpackPluginV5 = class {
89
89
  onPatchCompleted: patchRecorderState.onPatchCompleted
90
90
  };
91
91
  const refreshRuntimeState = async (force) => {
92
- await _chunkA2OSQ5CVjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
92
+ await _chunkCYKRAS6Kjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
93
93
  };
94
94
  const { Compilation, sources, NormalModule } = compiler.webpack;
95
95
  const { ConcatSource } = sources;
96
96
  async function getClassSetInLoader() {
97
97
  await refreshRuntimeState(true);
98
98
  await runtimeState.patchPromise;
99
- await _chunkA2OSQ5CVjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
99
+ await _chunkCYKRAS6Kjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
100
100
  }
101
101
  const runtimeClassSetLoader = _nullishCoalesce(runtimeLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-runtime-classset-loader.js")));
102
102
  const runtimeCssImportRewriteLoader = shouldRewriteCssImports ? _nullishCoalesce(runtimeCssImportRewriteLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-css-import-rewrite-loader.js"))) : void 0;
@@ -109,16 +109,16 @@ var UnifiedWebpackPluginV5 = class {
109
109
  const classSetLoaderOptions = {
110
110
  getClassSet: getClassSetInLoader
111
111
  };
112
- const { findRewriteAnchor, findClassSetAnchor } = _chunkQZJTOS3Ujs.createLoaderAnchorFinders.call(void 0, this.appType);
112
+ const { findRewriteAnchor, findClassSetAnchor } = _chunkYDM2M3NTjs.createLoaderAnchorFinders.call(void 0, this.appType);
113
113
  const cssImportRewriteLoaderOptions = runtimeLoaderRewriteOptions ? {
114
114
  rewriteCssImports: runtimeLoaderRewriteOptions
115
115
  } : void 0;
116
116
  onLoad();
117
117
  if (shouldRewriteCssImports && isMpxApp) {
118
- _chunkQZJTOS3Ujs.ensureMpxTailwindcssAliases.call(void 0, compiler, weappTailwindcssPackageDir);
118
+ _chunkYDM2M3NTjs.ensureMpxTailwindcssAliases.call(void 0, compiler, weappTailwindcssPackageDir);
119
119
  }
120
120
  if (runtimeCssImportRewriteLoader && shouldRewriteCssImports && cssImportRewriteLoaderOptions && isMpxApp) {
121
- _chunkQZJTOS3Ujs.injectMpxCssRewritePreRules.call(void 0, compiler, runtimeCssImportRewriteLoader, cssImportRewriteLoaderOptions);
121
+ _chunkYDM2M3NTjs.injectMpxCssRewritePreRules.call(void 0, compiler, runtimeCssImportRewriteLoader, cssImportRewriteLoaderOptions);
122
122
  }
123
123
  const createRuntimeClassSetLoaderEntry = () => ({
124
124
  loader: runtimeClassSetLoader,
@@ -137,17 +137,17 @@ var UnifiedWebpackPluginV5 = class {
137
137
  type: null
138
138
  };
139
139
  };
140
- compiler.hooks.compilation.tap(_chunkA2OSQ5CVjs.pluginName, (compilation) => {
141
- NormalModule.getCompilationHooks(compilation).loader.tap(_chunkA2OSQ5CVjs.pluginName, (_loaderContext, module) => {
140
+ compiler.hooks.compilation.tap(_chunkCYKRAS6Kjs.pluginName, (compilation) => {
141
+ NormalModule.getCompilationHooks(compilation).loader.tap(_chunkCYKRAS6Kjs.pluginName, (_loaderContext, module) => {
142
142
  const hasRuntimeLoader = runtimeClassSetLoaderExists || runtimeCssImportRewriteLoaderExists;
143
143
  if (!hasRuntimeLoader) {
144
144
  return;
145
145
  }
146
- _chunkQZJTOS3Ujs.patchMpxLoaderResolve.call(void 0, _loaderContext, weappTailwindcssPackageDir, shouldRewriteCssImports && isMpxApp);
146
+ _chunkYDM2M3NTjs.patchMpxLoaderResolve.call(void 0, _loaderContext, weappTailwindcssPackageDir, shouldRewriteCssImports && isMpxApp);
147
147
  const loaderEntries = module.loaders || [];
148
148
  let rewriteAnchorIdx = findRewriteAnchor(loaderEntries);
149
149
  const classSetAnchorIdx = findClassSetAnchor(loaderEntries);
150
- const isCssModule = _chunkQZJTOS3Ujs.isCssLikeModuleResource.call(void 0, module.resource, this.options.cssMatcher, this.appType);
150
+ const isCssModule = _chunkYDM2M3NTjs.isCssLikeModuleResource.call(void 0, module.resource, this.options.cssMatcher, this.appType);
151
151
  if (_process2.default.env.WEAPP_TW_LOADER_DEBUG && isCssModule) {
152
152
  debug("loader hook css module: %s loaders=%o anchors=%o", module.resource, loaderEntries.map((x) => x.loader), { rewriteAnchorIdx, classSetAnchorIdx });
153
153
  }
@@ -179,7 +179,7 @@ var UnifiedWebpackPluginV5 = class {
179
179
  rewriteAnchorIdx = findRewriteAnchor(loaderEntries);
180
180
  }
181
181
  }
182
- if (runtimeClassSetLoaderExists && !_chunkQZJTOS3Ujs.hasLoaderEntry.call(void 0, loaderEntries, runtimeClassSetLoader)) {
182
+ if (runtimeClassSetLoaderExists && !_chunkYDM2M3NTjs.hasLoaderEntry.call(void 0, loaderEntries, runtimeClassSetLoader)) {
183
183
  const classSetLoaderEntry = createRuntimeClassSetLoaderEntry();
184
184
  const anchorIndex = findClassSetAnchor(loaderEntries);
185
185
  if (anchorIndex === -1) {
@@ -192,7 +192,7 @@ var UnifiedWebpackPluginV5 = class {
192
192
  });
193
193
  compilation.hooks.processAssets.tapPromise(
194
194
  {
195
- name: _chunkA2OSQ5CVjs.pluginName,
195
+ name: _chunkCYKRAS6Kjs.pluginName,
196
196
  stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
197
197
  },
198
198
  async (assets) => {
@@ -258,10 +258,10 @@ var UnifiedWebpackPluginV5 = class {
258
258
  debug("js linked handle: %s", assetName);
259
259
  }
260
260
  };
261
- const groupedEntries = _chunkFMBPNII7js.getGroupedEntries.call(void 0, entries, this.options);
261
+ const groupedEntries = _chunkDYLQ6UOIjs.getGroupedEntries.call(void 0, entries, this.options);
262
262
  await refreshRuntimeState(true);
263
263
  await runtimeState.patchPromise;
264
- const runtimeSet = await _chunkA2OSQ5CVjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
264
+ const runtimeSet = await _chunkCYKRAS6Kjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
265
265
  debug("get runtimeSet, class count: %d", runtimeSet.size);
266
266
  const tasks = [];
267
267
  if (Array.isArray(groupedEntries.html)) {
@@ -298,7 +298,7 @@ var UnifiedWebpackPluginV5 = class {
298
298
  const jsTaskFactories = [];
299
299
  if (Array.isArray(groupedEntries.js)) {
300
300
  for (const [file] of groupedEntries.js) {
301
- const cacheKey = _chunkQZJTOS3Ujs.getCacheKey.call(void 0, file);
301
+ const cacheKey = _chunkYDM2M3NTjs.getCacheKey.call(void 0, file);
302
302
  const asset = compilation.getAsset(file);
303
303
  if (!asset) {
304
304
  continue;
@@ -9,7 +9,7 @@ import {
9
9
  isMpx,
10
10
  patchMpxLoaderResolve,
11
11
  setupMpxTailwindcssRedirect
12
- } from "./chunk-QJTJC5UT.mjs";
12
+ } from "./chunk-O35YNDUX.mjs";
13
13
  import {
14
14
  pushConcurrentTaskFactories,
15
15
  resolveDisabledOptions,
@@ -22,17 +22,17 @@ import {
22
22
  } from "./chunk-RRHPTTCP.mjs";
23
23
  import {
24
24
  setupPatchRecorder
25
- } from "./chunk-GIUNRP65.mjs";
25
+ } from "./chunk-BC6TZREM.mjs";
26
26
  import {
27
27
  collectRuntimeClassSet,
28
28
  createDebug,
29
29
  getCompilerContext,
30
30
  pluginName,
31
31
  refreshTailwindRuntimeState
32
- } from "./chunk-4Z6MHSEO.mjs";
32
+ } from "./chunk-W33YZK2C.mjs";
33
33
  import {
34
34
  getGroupedEntries
35
- } from "./chunk-RR5HCKVQ.mjs";
35
+ } from "./chunk-OOHJLO5M.mjs";
36
36
  import {
37
37
  __dirname
38
38
  } from "./chunk-SM5V25IN.mjs";
@@ -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 _chunkFMBPNII7js = require('./chunk-FMBPNII7.js');
3
+ var _chunkDYLQ6UOIjs = require('./chunk-DYLQ6UOI.js');
4
4
 
5
5
 
6
6
  var _chunkMB4BR57Ejs = require('./chunk-MB4BR57E.js');
@@ -708,7 +708,7 @@ function createPatcherForBase(baseDir, cssEntries, options) {
708
708
  if (_optionalChain([cssEntries, 'optionalAccess', _40 => _40.length]) && (tailwindcss == null || tailwindcss.version == null)) {
709
709
  defaultTailwindcssConfig.version = 4;
710
710
  }
711
- const mergedTailwindOptions = _chunkFMBPNII7js.defuOverrideArray.call(void 0,
711
+ const mergedTailwindOptions = _chunkDYLQ6UOIjs.defuOverrideArray.call(void 0,
712
712
  _nullishCoalesce(tailwindcss, () => ( {})),
713
713
  defaultTailwindcssConfig
714
714
  );
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  createPatchTargetRecorder,
3
3
  createTailwindPatchPromise
4
- } from "./chunk-4Z6MHSEO.mjs";
4
+ } from "./chunk-W33YZK2C.mjs";
5
5
  import {
6
6
  logger
7
- } from "./chunk-SZOXLSNK.mjs";
7
+ } from "./chunk-HEBIKTBC.mjs";
8
8
 
9
9
  // src/tailwindcss/recorder.ts
10
10
  function setupPatchRecorder(patcher, baseDir, options) {
@@ -12,7 +12,7 @@ var _chunkORSWL3MIjs = require('./chunk-ORSWL3MI.js');
12
12
  var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
13
13
 
14
14
 
15
- var _chunkIGTIMGCPjs = require('./chunk-IGTIMGCP.js');
15
+ var _chunkWOJCMQDFjs = require('./chunk-WOJCMQDF.js');
16
16
 
17
17
 
18
18
 
@@ -23,10 +23,11 @@ var _chunkIGTIMGCPjs = require('./chunk-IGTIMGCP.js');
23
23
 
24
24
 
25
25
 
26
- var _chunkA2OSQ5CVjs = require('./chunk-A2OSQ5CV.js');
26
+ var _chunkCYKRAS6Kjs = require('./chunk-CYKRAS6K.js');
27
27
 
28
28
 
29
- var _chunkFMBPNII7js = require('./chunk-FMBPNII7.js');
29
+
30
+ var _chunkDYLQ6UOIjs = require('./chunk-DYLQ6UOI.js');
30
31
 
31
32
  // src/bundlers/vite/index.ts
32
33
  var _buffer = require('buffer');
@@ -55,7 +56,7 @@ function updateStaticAttribute(ms, prop) {
55
56
  const start = prop.value.loc.start.offset + 1;
56
57
  const end = prop.value.loc.end.offset - 1;
57
58
  if (start < end) {
58
- ms.update(start, end, _chunkA2OSQ5CVjs.replaceWxml.call(void 0, prop.value.content));
59
+ ms.update(start, end, _chunkCYKRAS6Kjs.replaceWxml.call(void 0, prop.value.content));
59
60
  }
60
61
  }
61
62
  function updateDirectiveExpression(ms, prop, jsHandler, runtimeSet) {
@@ -67,7 +68,7 @@ function updateDirectiveExpression(ms, prop, jsHandler, runtimeSet) {
67
68
  if (start >= end) {
68
69
  return;
69
70
  }
70
- const generated = _chunkA2OSQ5CVjs.generateCode.call(void 0, prop.exp.content, {
71
+ const generated = _chunkCYKRAS6Kjs.generateCode.call(void 0, prop.exp.content, {
71
72
  jsHandler,
72
73
  runtimeSet,
73
74
  wrapExpression: true
@@ -96,7 +97,7 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
96
97
  return;
97
98
  }
98
99
  const { customAttributesEntities, disabledDefaultTemplateHandler = false } = options;
99
- const matchCustomAttribute = _chunkA2OSQ5CVjs.createAttributeMatcher.call(void 0, customAttributesEntities);
100
+ const matchCustomAttribute = _chunkCYKRAS6Kjs.createAttributeMatcher.call(void 0, customAttributesEntities);
100
101
  const ms = new (0, _magicstring2.default)(code);
101
102
  const { descriptor, errors } = _compilersfc.parse.call(void 0, code);
102
103
  if (errors.length === 0) {
@@ -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
- if (lang && preprocessorLangs.has(lang)) {
231
+ const normalizedLang = _optionalChain([lang, 'optionalAccess', _8 => _8.toLowerCase, 'call', _9 => _9()]);
232
+ if (normalizedLang && preprocessorLangs.has(normalizedLang)) {
233
+ return true;
234
+ }
235
+ const inlineLangMatch = id.match(/lang\.([a-z]+)/i);
236
+ if (inlineLangMatch && preprocessorLangs.has(inlineLangMatch[1].toLowerCase())) {
231
237
  return true;
232
238
  }
233
- return /\.(?:scss|sass|less|styl|stylus)(?:\?|$)/.test(id);
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 cssPlugins = [void 0, "pre"].map((enforce) => ({
248
- name: `weapp-tailwindcss:uni-app-x:css${enforce ? `:${enforce}` : ""}`,
249
- enforce,
254
+ const isIosPlatform = _nullishCoalesce(providedIosPlatform, () => ( _chunkDYLQ6UOIjs.resolveUniUtsPlatform.call(void 0, ).isAppIos));
255
+ async function transformStyle(code, id, query) {
256
+ const parsed = _nullishCoalesce(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 (enforce === "pre" && isPreprocessorRequest(id, lang)) {
291
+ if (isIosPlatform && isPreprocessorRequest(id, lang)) {
255
292
  return;
256
293
  }
257
- if (isCSSRequest(id) || query.vue && query.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
- }
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",
@@ -293,9 +313,9 @@ function createUniAppXPlugins(options) {
293
313
  return;
294
314
  }
295
315
  const resolvedConfig = getResolvedConfig();
296
- const isServeCommand = _optionalChain([resolvedConfig, 'optionalAccess', _8 => _8.command]) === "serve";
297
- const isWatchBuild = _optionalChain([resolvedConfig, 'optionalAccess', _9 => _9.command]) === "build" && !!_optionalChain([resolvedConfig, 'access', _10 => _10.build, 'optionalAccess', _11 => _11.watch]);
298
- const isNonWatchBuild = _optionalChain([resolvedConfig, 'optionalAccess', _12 => _12.command]) === "build" && !_optionalChain([resolvedConfig, 'access', _13 => _13.build, 'optionalAccess', _14 => _14.watch]);
316
+ const isServeCommand = _optionalChain([resolvedConfig, 'optionalAccess', _10 => _10.command]) === "serve";
317
+ const isWatchBuild = _optionalChain([resolvedConfig, 'optionalAccess', _11 => _11.command]) === "build" && !!_optionalChain([resolvedConfig, 'access', _12 => _12.build, 'optionalAccess', _13 => _13.watch]);
318
+ const isNonWatchBuild = _optionalChain([resolvedConfig, 'optionalAccess', _14 => _14.command]) === "build" && !_optionalChain([resolvedConfig, 'access', _15 => _15.build, 'optionalAccess', _16 => _16.watch]);
299
319
  const shouldForceRefresh = isServeCommand || isWatchBuild || isNonWatchBuild;
300
320
  const currentRuntimeSet = shouldForceRefresh ? await ensureRuntimeClassSet(true) : await ensureRuntimeClassSet();
301
321
  const extraOptions = customAttributesEntities.length > 0 || disabledDefaultTemplateHandler ? {
@@ -309,7 +329,7 @@ function createUniAppXPlugins(options) {
309
329
  },
310
330
  async handleHotUpdate(ctx) {
311
331
  const resolvedConfig = getResolvedConfig();
312
- if (_optionalChain([resolvedConfig, 'optionalAccess', _15 => _15.command]) !== "serve") {
332
+ if (_optionalChain([resolvedConfig, 'optionalAccess', _17 => _17.command]) !== "serve") {
313
333
  return;
314
334
  }
315
335
  if (!/\.(?:uvue|nvue)$/.test(ctx.file)) {
@@ -319,7 +339,7 @@ function createUniAppXPlugins(options) {
319
339
  },
320
340
  async watchChange(id) {
321
341
  const resolvedConfig = getResolvedConfig();
322
- if (_optionalChain([resolvedConfig, 'optionalAccess', _16 => _16.command]) !== "build" || !_optionalChain([resolvedConfig, 'access', _17 => _17.build, 'optionalAccess', _18 => _18.watch])) {
342
+ if (_optionalChain([resolvedConfig, 'optionalAccess', _18 => _18.command]) !== "build" || !_optionalChain([resolvedConfig, 'access', _19 => _19.build, 'optionalAccess', _20 => _20.watch])) {
323
343
  return;
324
344
  }
325
345
  if (!/\.(?:uvue|nvue)(?:\?.*)?$/.test(id)) {
@@ -379,7 +399,7 @@ function createUniAppXAssetTask(file, originalSource, outDir, options) {
379
399
  }
380
400
 
381
401
  // src/bundlers/vite/index.ts
382
- var debug = _chunkA2OSQ5CVjs.createDebug.call(void 0, );
402
+ var debug = _chunkCYKRAS6Kjs.createDebug.call(void 0, );
383
403
  var weappTailwindcssPackageDir = _chunkORSWL3MIjs.resolvePackageDir.call(void 0, "weapp-tailwindcss");
384
404
  var weappTailwindcssDirPosix = slash(weappTailwindcssPackageDir);
385
405
  function joinPosixPath(base, subpath) {
@@ -456,13 +476,13 @@ function applyLinkedResults(linked, entries, onLinkedUpdate, onApplied) {
456
476
  } else {
457
477
  entry.output.source = code;
458
478
  }
459
- _optionalChain([onApplied, 'optionalCall', _19 => _19(entry, code)]);
479
+ _optionalChain([onApplied, 'optionalCall', _21 => _21(entry, code)]);
460
480
  onLinkedUpdate(entry.fileName, previous, code);
461
481
  }
462
482
  }
463
483
  function UnifiedViteWeappTailwindcssPlugin(options = {}) {
464
484
  const rewriteCssImportsSpecified = Object.prototype.hasOwnProperty.call(options, "rewriteCssImports");
465
- const opts = _chunkA2OSQ5CVjs.getCompilerContext.call(void 0, options);
485
+ const opts = _chunkCYKRAS6Kjs.getCompilerContext.call(void 0, options);
466
486
  const {
467
487
  disabled,
468
488
  customAttributes,
@@ -486,7 +506,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
486
506
  const shouldRewriteCssImports = opts.rewriteCssImports !== false && !disabledOptions.rewriteCssImports && (rewriteCssImportsSpecified || tailwindcssMajorVersion >= 4);
487
507
  const rewritePlugins = !shouldRewriteCssImports ? [] : [
488
508
  {
489
- name: `${_chunkA2OSQ5CVjs.vitePluginName}:rewrite-css-imports`,
509
+ name: `${_chunkCYKRAS6Kjs.vitePluginName}:rewrite-css-imports`,
490
510
  enforce: "pre",
491
511
  resolveId: {
492
512
  order: "pre",
@@ -528,8 +548,8 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
528
548
  if (disabledOptions.plugin) {
529
549
  return rewritePlugins.length ? rewritePlugins : void 0;
530
550
  }
531
- const customAttributesEntities = _chunkA2OSQ5CVjs.toCustomAttributesEntities.call(void 0, customAttributes);
532
- const patchRecorderState = _chunkIGTIMGCPjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
551
+ const customAttributesEntities = _chunkCYKRAS6Kjs.toCustomAttributesEntities.call(void 0, customAttributes);
552
+ const patchRecorderState = _chunkWOJCMQDFjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
533
553
  source: "runtime",
534
554
  cwd: _nullishCoalesce(opts.tailwindcssBasedir, () => ( _process2.default.cwd()))
535
555
  });
@@ -543,7 +563,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
543
563
  let runtimeSetPromise;
544
564
  let resolvedConfig;
545
565
  async function refreshRuntimeState(force) {
546
- const refreshed = await _chunkA2OSQ5CVjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
566
+ const refreshed = await _chunkCYKRAS6Kjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
547
567
  if (refreshed) {
548
568
  runtimeSet = void 0;
549
569
  runtimeSetPromise = void 0;
@@ -556,7 +576,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
556
576
  return runtimeSet;
557
577
  }
558
578
  if (force || !runtimeSetPromise) {
559
- const task2 = _chunkA2OSQ5CVjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, {
579
+ const task2 = _chunkCYKRAS6Kjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, {
560
580
  force: force || !runtimeSet,
561
581
  skipRefresh: force
562
582
  });
@@ -574,10 +594,13 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
574
594
  }
575
595
  onLoad();
576
596
  const getResolvedConfig = () => resolvedConfig;
597
+ const utsPlatform = _chunkDYLQ6UOIjs.resolveUniUtsPlatform.call(void 0, );
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,
@@ -588,7 +611,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
588
611
  const plugins = [
589
612
  ...rewritePlugins,
590
613
  {
591
- name: `${_chunkA2OSQ5CVjs.vitePluginName}:post`,
614
+ name: `${_chunkCYKRAS6Kjs.vitePluginName}:post`,
592
615
  enforce: "post",
593
616
  configResolved(config) {
594
617
  resolvedConfig = config;
@@ -608,8 +631,8 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
608
631
  debug("start");
609
632
  onStart();
610
633
  const entries = Object.entries(bundle);
611
- const rootDir = _optionalChain([resolvedConfig, 'optionalAccess', _20 => _20.root]) ? _path2.default.resolve(resolvedConfig.root) : _process2.default.cwd();
612
- const outDir = _optionalChain([resolvedConfig, 'optionalAccess', _21 => _21.build, 'optionalAccess', _22 => _22.outDir]) ? _path2.default.resolve(rootDir, resolvedConfig.build.outDir) : rootDir;
634
+ const rootDir = _optionalChain([resolvedConfig, 'optionalAccess', _22 => _22.root]) ? _path2.default.resolve(resolvedConfig.root) : _process2.default.cwd();
635
+ const outDir = _optionalChain([resolvedConfig, 'optionalAccess', _23 => _23.build, 'optionalAccess', _24 => _24.outDir]) ? _path2.default.resolve(rootDir, resolvedConfig.build.outDir) : rootDir;
613
636
  const jsEntries = /* @__PURE__ */ new Map();
614
637
  for (const [fileName, output] of entries) {
615
638
  const entry = { fileName, output };
@@ -619,7 +642,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
619
642
  }
620
643
  }
621
644
  const moduleGraphOptions = createBundleModuleGraphOptions(outDir, jsEntries);
622
- const groupedEntries = _chunkFMBPNII7js.getGroupedEntries.call(void 0, entries, opts);
645
+ const groupedEntries = _chunkDYLQ6UOIjs.getGroupedEntries.call(void 0, entries, opts);
623
646
  const runtime = await ensureRuntimeClassSet(true);
624
647
  debug("get runtimeSet, class count: %d", runtime.size);
625
648
  const handleLinkedUpdate = (fileName, previous, next) => {
@@ -644,7 +667,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
644
667
  filename: absoluteFilename,
645
668
  moduleGraph: moduleGraphOptions,
646
669
  babelParserOptions: {
647
- ..._nullishCoalesce(_optionalChain([extra, 'optionalAccess', _23 => _23.babelParserOptions]), () => ( {})),
670
+ ..._nullishCoalesce(_optionalChain([extra, 'optionalAccess', _25 => _25.babelParserOptions]), () => ( {})),
648
671
  sourceFilename: absoluteFilename
649
672
  }
650
673
  });
@@ -3,14 +3,14 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkPT4IJT3Qjs = require('./chunk-PT4IJT3Q.js');
6
+ var _chunkAPJY6PQWjs = require('./chunk-APJY6PQW.js');
7
7
 
8
8
 
9
- var _chunk6R4BK6D6js = require('./chunk-6R4BK6D6.js');
9
+ var _chunkFYYBY3VKjs = require('./chunk-FYYBY3VK.js');
10
10
 
11
11
 
12
12
 
13
- var _chunkFMBPNII7js = require('./chunk-FMBPNII7.js');
13
+ var _chunkDYLQ6UOIjs = require('./chunk-DYLQ6UOI.js');
14
14
 
15
15
  // src/tailwindcss/runtime.ts
16
16
  var _fs = require('fs');
@@ -187,7 +187,7 @@ async function collectRuntimeClassSet(twPatcher, options = {}) {
187
187
  // package.json
188
188
  var package_default = {
189
189
  name: "weapp-tailwindcss",
190
- version: "4.9.0",
190
+ version: "4.9.1",
191
191
  description: "\u628A tailwindcss \u539F\u5B50\u5316\u6837\u5F0F\u601D\u60F3\uFF0C\u5E26\u7ED9\u5C0F\u7A0B\u5E8F\u5F00\u53D1\u8005\u4EEC! bring tailwindcss to miniprogram developers!",
192
192
  author: "ice breaker <1324318532@qq.com>",
193
193
  license: "MIT",
@@ -543,7 +543,7 @@ function formatRelativeToBase(targetPath, baseDir) {
543
543
  }
544
544
  function resolveRecordLocation(baseDir) {
545
545
  const normalizedBase = _path2.default.normalize(baseDir);
546
- const packageRoot = _nullishCoalesce(_chunkPT4IJT3Qjs.findNearestPackageRoot.call(void 0, normalizedBase), () => ( normalizedBase));
546
+ const packageRoot = _nullishCoalesce(_chunkAPJY6PQWjs.findNearestPackageRoot.call(void 0, normalizedBase), () => ( normalizedBase));
547
547
  const packageJsonPath = _path2.default.join(packageRoot, "package.json");
548
548
  const hasPackageJson = _fs.existsSync.call(void 0, packageJsonPath);
549
549
  const recordKeySource = hasPackageJson ? packageJsonPath : normalizedBase;
@@ -913,7 +913,7 @@ function toCustomAttributesEntities(customAttributes) {
913
913
  if (!customAttributes) {
914
914
  return [];
915
915
  }
916
- if (_chunkFMBPNII7js.isMap.call(void 0, customAttributes)) {
916
+ if (_chunkDYLQ6UOIjs.isMap.call(void 0, customAttributes)) {
917
917
  return [
918
918
  ...customAttributes.entries()
919
919
  ];
@@ -2201,7 +2201,7 @@ function createJsHandler(options) {
2201
2201
  } = options;
2202
2202
  function handler(rawSource, classNameSet, options2) {
2203
2203
  const overrideOptions = _nullishCoalesce(options2, () => ( {}));
2204
- const resolvedOptions = _chunkFMBPNII7js.defuOverrideArray.call(void 0,
2204
+ const resolvedOptions = _chunkDYLQ6UOIjs.defuOverrideArray.call(void 0,
2205
2205
  {
2206
2206
  ...overrideOptions,
2207
2207
  classNameSet
@@ -2630,7 +2630,7 @@ async function customTemplateHandler(rawSource, options) {
2630
2630
  }
2631
2631
  function createTemplateHandler(options = {}) {
2632
2632
  return (rawSource, opt = {}) => {
2633
- return customTemplateHandler(rawSource, _chunkFMBPNII7js.defuOverrideArray.call(void 0, opt, options));
2633
+ return customTemplateHandler(rawSource, _chunkDYLQ6UOIjs.defuOverrideArray.call(void 0, opt, options));
2634
2634
  };
2635
2635
  }
2636
2636
 
@@ -2764,22 +2764,22 @@ async function clearTailwindcssPatcherCache(patcher, options) {
2764
2764
  }
2765
2765
  }
2766
2766
  function createInternalCompilerContext(opts) {
2767
- const ctx = _chunkFMBPNII7js.defuOverrideArray.call(void 0,
2767
+ const ctx = _chunkDYLQ6UOIjs.defuOverrideArray.call(void 0,
2768
2768
  opts,
2769
- _chunk6R4BK6D6js.getDefaultOptions.call(void 0, ),
2769
+ _chunkFYYBY3VKjs.getDefaultOptions.call(void 0, ),
2770
2770
  {}
2771
2771
  );
2772
2772
  ctx.escapeMap = ctx.customReplaceDictionary;
2773
2773
  applyLoggerLevel(ctx.logLevel);
2774
- const twPatcher = _chunkPT4IJT3Qjs.createTailwindcssPatcherFromContext.call(void 0, ctx);
2774
+ const twPatcher = _chunkAPJY6PQWjs.createTailwindcssPatcherFromContext.call(void 0, ctx);
2775
2775
  logTailwindcssTarget("runtime", twPatcher, ctx.tailwindcssBasedir);
2776
2776
  if (_optionalChain([twPatcher, 'access', _95 => _95.packageInfo, 'optionalAccess', _96 => _96.version])) {
2777
2777
  _logger.logger.success(`\u5F53\u524D\u4F7F\u7528 ${_logger.pc.cyanBright("Tailwind CSS")} \u7248\u672C\u4E3A: ${_logger.pc.underline(_logger.pc.bold(_logger.pc.green(twPatcher.packageInfo.version)))}`);
2778
2778
  } else {
2779
2779
  _logger.logger.warn(`${_logger.pc.cyanBright("Tailwind CSS")} \u672A\u5B89\u88C5\uFF0C\u5DF2\u8DF3\u8FC7\u7248\u672C\u68C0\u6D4B\u4E0E\u8865\u4E01\u5E94\u7528\u3002`);
2780
2780
  }
2781
- _chunkPT4IJT3Qjs.warnMissingCssEntries.call(void 0, ctx, twPatcher);
2782
- const cssCalcOptions = _chunkPT4IJT3Qjs.applyV4CssCalcDefaults.call(void 0, ctx.cssCalc, twPatcher);
2781
+ _chunkAPJY6PQWjs.warnMissingCssEntries.call(void 0, ctx, twPatcher);
2782
+ const cssCalcOptions = _chunkAPJY6PQWjs.applyV4CssCalcDefaults.call(void 0, ctx.cssCalc, twPatcher);
2783
2783
  ctx.cssCalc = cssCalcOptions;
2784
2784
  const customAttributesEntities = toCustomAttributesEntities(ctx.customAttributes);
2785
2785
  const { styleHandler, jsHandler: jsHandler2, templateHandler } = createHandlersFromContext(
@@ -2798,7 +2798,7 @@ function createInternalCompilerContext(opts) {
2798
2798
  await clearTailwindcssPatcherCache(previousPatcher);
2799
2799
  }
2800
2800
  invalidateRuntimeClassSet(previousPatcher);
2801
- const nextPatcher = _chunkPT4IJT3Qjs.createTailwindcssPatcherFromContext.call(void 0, ctx);
2801
+ const nextPatcher = _chunkAPJY6PQWjs.createTailwindcssPatcherFromContext.call(void 0, ctx);
2802
2802
  Object.assign(previousPatcher, nextPatcher);
2803
2803
  ctx.twPatcher = previousPatcher;
2804
2804
  return previousPatcher;