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/cli.js CHANGED
@@ -7,8 +7,8 @@ var _chunkOXASK55Qjs = require('./chunk-OXASK55Q.js');
7
7
 
8
8
 
9
9
 
10
- var _chunkACSKKIYMjs = require('./chunk-ACSKKIYM.js');
11
- require('./chunk-467NHGLF.js');
10
+ var _chunkPLV4QGF4js = require('./chunk-PLV4QGF4.js');
11
+ require('./chunk-2ZEOKKVA.js');
12
12
  require('./chunk-ZSTF2AEN.js');
13
13
 
14
14
 
@@ -124,7 +124,7 @@ function createCliContext(overrides, resolvedCwd) {
124
124
  current
125
125
  );
126
126
  }
127
- return _chunkACSKKIYMjs.getCompilerContext.call(void 0, userOptions);
127
+ return _chunkPLV4QGF4js.getCompilerContext.call(void 0, userOptions);
128
128
  }
129
129
  function formatOutputPath(target, baseDir) {
130
130
  const root = _nullishCoalesce(baseDir, () => ( _process2.default.cwd()));
@@ -429,9 +429,9 @@ async function generateVscodeIntellisenseEntry(options) {
429
429
 
430
430
  // src/cli.ts
431
431
  _process2.default.title = "node (weapp-tailwindcss)";
432
- if (_semver2.default.lt(_process2.default.versions.node, _chunkACSKKIYMjs.WEAPP_TW_REQUIRED_NODE_VERSION)) {
432
+ if (_semver2.default.lt(_process2.default.versions.node, _chunkPLV4QGF4js.WEAPP_TW_REQUIRED_NODE_VERSION)) {
433
433
  _chunkOXASK55Qjs.logger.warn(
434
- `You are using Node.js ${_process2.default.versions.node}. For weapp-tailwindcss, Node.js version >= v${_chunkACSKKIYMjs.WEAPP_TW_REQUIRED_NODE_VERSION} is required.`
434
+ `You are using Node.js ${_process2.default.versions.node}. For weapp-tailwindcss, Node.js version >= v${_chunkPLV4QGF4js.WEAPP_TW_REQUIRED_NODE_VERSION} is required.`
435
435
  );
436
436
  }
437
437
  var cli = _cac2.default.call(void 0, "weapp-tailwindcss");
@@ -441,13 +441,13 @@ cli.command("patch", "Apply Tailwind CSS runtime patches").alias("install").opti
441
441
  const ctx = createCliContext(void 0, resolvedCwd);
442
442
  const shouldClearCache = toBoolean(options.clearCache, false);
443
443
  if (shouldClearCache) {
444
- await _chunkACSKKIYMjs.clearTailwindcssPatcherCache.call(void 0, ctx.twPatcher, { removeDirectory: true });
444
+ await _chunkPLV4QGF4js.clearTailwindcssPatcherCache.call(void 0, ctx.twPatcher, { removeDirectory: true });
445
445
  }
446
- _chunkACSKKIYMjs.logTailwindcssTarget.call(void 0, "cli", ctx.twPatcher, ctx.tailwindcssBasedir);
446
+ _chunkPLV4QGF4js.logTailwindcssTarget.call(void 0, "cli", ctx.twPatcher, ctx.tailwindcssBasedir);
447
447
  await ctx.twPatcher.patch();
448
448
  const shouldRecordTarget = toBoolean(options.recordTarget, true);
449
449
  if (shouldRecordTarget) {
450
- const recordPath = await _chunkACSKKIYMjs.saveCliPatchTargetRecord.call(void 0, ctx.tailwindcssBasedir, ctx.twPatcher);
450
+ const recordPath = await _chunkPLV4QGF4js.saveCliPatchTargetRecord.call(void 0, ctx.tailwindcssBasedir, ctx.twPatcher);
451
451
  if (recordPath) {
452
452
  _chunkOXASK55Qjs.logger.info(`\u8BB0\u5F55 weapp-tw patch \u76EE\u6807 -> ${formatOutputPath(recordPath, resolvedCwd)}`);
453
453
  }
package/dist/cli.mjs CHANGED
@@ -7,8 +7,8 @@ import {
7
7
  getCompilerContext,
8
8
  logTailwindcssTarget,
9
9
  saveCliPatchTargetRecord
10
- } from "./chunk-W4ERVC6L.mjs";
11
- import "./chunk-HCXLLOIU.mjs";
10
+ } from "./chunk-WTOLVORM.mjs";
11
+ import "./chunk-7KTLLGAG.mjs";
12
12
  import "./chunk-DKPIYG24.mjs";
13
13
  import {
14
14
  defuOverrideArray
package/dist/core.js CHANGED
@@ -3,8 +3,8 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkACSKKIYMjs = require('./chunk-ACSKKIYM.js');
7
- require('./chunk-467NHGLF.js');
6
+ var _chunkPLV4QGF4js = require('./chunk-PLV4QGF4.js');
7
+ require('./chunk-2ZEOKKVA.js');
8
8
  require('./chunk-ZSTF2AEN.js');
9
9
  require('./chunk-UW3WHSZ5.js');
10
10
  require('./chunk-UJIUFWXE.js');
@@ -12,16 +12,16 @@ require('./chunk-UJIUFWXE.js');
12
12
  // src/core.ts
13
13
  var _shared = require('@weapp-tailwindcss/shared');
14
14
  function createContext(options = {}) {
15
- const opts = _chunkACSKKIYMjs.getCompilerContext.call(void 0, options);
15
+ const opts = _chunkPLV4QGF4js.getCompilerContext.call(void 0, options);
16
16
  const { templateHandler, styleHandler, jsHandler, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
17
17
  let runtimeSet = /* @__PURE__ */ new Set();
18
18
  const runtimeState = {
19
19
  twPatcher: initialTwPatcher,
20
- patchPromise: _chunkACSKKIYMjs.createTailwindPatchPromise.call(void 0, initialTwPatcher),
20
+ patchPromise: _chunkPLV4QGF4js.createTailwindPatchPromise.call(void 0, initialTwPatcher),
21
21
  refreshTailwindcssPatcher
22
22
  };
23
23
  async function refreshRuntimeState(force) {
24
- await _chunkACSKKIYMjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
24
+ await _chunkPLV4QGF4js.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
25
25
  }
26
26
  async function transformWxss(rawCss, options2) {
27
27
  await runtimeState.patchPromise;
@@ -30,7 +30,7 @@ function createContext(options = {}) {
30
30
  }));
31
31
  await refreshRuntimeState(true);
32
32
  await runtimeState.patchPromise;
33
- runtimeSet = await _chunkACSKKIYMjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
33
+ runtimeSet = await _chunkPLV4QGF4js.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
34
34
  return result;
35
35
  }
36
36
  async function transformJs(rawJs, options2 = {}) {
@@ -40,7 +40,7 @@ function createContext(options = {}) {
40
40
  } else {
41
41
  await refreshRuntimeState(true);
42
42
  await runtimeState.patchPromise;
43
- runtimeSet = await _chunkACSKKIYMjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
43
+ runtimeSet = await _chunkPLV4QGF4js.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
44
44
  }
45
45
  return await jsHandler(rawJs, runtimeSet, options2);
46
46
  }
@@ -49,7 +49,7 @@ function createContext(options = {}) {
49
49
  if (!_optionalChain([options2, 'optionalAccess', _2 => _2.runtimeSet]) && runtimeSet.size === 0) {
50
50
  await refreshRuntimeState(true);
51
51
  await runtimeState.patchPromise;
52
- runtimeSet = await _chunkACSKKIYMjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
52
+ runtimeSet = await _chunkPLV4QGF4js.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
53
53
  }
54
54
  return templateHandler(rawWxml, _shared.defuOverrideArray.call(void 0, options2, {
55
55
  runtimeSet
package/dist/core.mjs CHANGED
@@ -3,8 +3,8 @@ import {
3
3
  createTailwindPatchPromise,
4
4
  getCompilerContext,
5
5
  refreshTailwindRuntimeState
6
- } from "./chunk-W4ERVC6L.mjs";
7
- import "./chunk-HCXLLOIU.mjs";
6
+ } from "./chunk-WTOLVORM.mjs";
7
+ import "./chunk-7KTLLGAG.mjs";
8
8
  import "./chunk-DKPIYG24.mjs";
9
9
  import "./chunk-ZNKIYZRQ.mjs";
10
10
  import "./chunk-QGH4JZRW.mjs";
package/dist/gulp.js CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkK7AD7FLJjs = require('./chunk-K7AD7FLJ.js');
3
+ var _chunkN2ZUYGKAjs = require('./chunk-N2ZUYGKA.js');
4
4
  require('./chunk-LTJQUORK.js');
5
- require('./chunk-ACSKKIYM.js');
6
- require('./chunk-467NHGLF.js');
5
+ require('./chunk-PLV4QGF4.js');
6
+ require('./chunk-2ZEOKKVA.js');
7
7
  require('./chunk-ZSTF2AEN.js');
8
8
  require('./chunk-UW3WHSZ5.js');
9
9
  require('./chunk-UJIUFWXE.js');
10
10
 
11
11
 
12
- exports.createPlugins = _chunkK7AD7FLJjs.createPlugins;
12
+ exports.createPlugins = _chunkN2ZUYGKAjs.createPlugins;
package/dist/gulp.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  createPlugins
3
- } from "./chunk-5BZA7BAP.mjs";
3
+ } from "./chunk-NLLCK6RM.mjs";
4
4
  import "./chunk-RRHPTTCP.mjs";
5
- import "./chunk-W4ERVC6L.mjs";
6
- import "./chunk-HCXLLOIU.mjs";
5
+ import "./chunk-WTOLVORM.mjs";
6
+ import "./chunk-7KTLLGAG.mjs";
7
7
  import "./chunk-DKPIYG24.mjs";
8
8
  import "./chunk-ZNKIYZRQ.mjs";
9
9
  import "./chunk-QGH4JZRW.mjs";
package/dist/index.js CHANGED
@@ -2,18 +2,18 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkIXZDFEPLjs = require('./chunk-IXZDFEPL.js');
6
- require('./chunk-JPLWILCP.js');
5
+ var _chunk26ZRX6OHjs = require('./chunk-26ZRX6OH.js');
6
+ require('./chunk-UCA2DMVN.js');
7
7
 
8
8
 
9
- var _chunkK7AD7FLJjs = require('./chunk-K7AD7FLJ.js');
9
+ var _chunkN2ZUYGKAjs = require('./chunk-N2ZUYGKA.js');
10
10
 
11
11
 
12
- var _chunkZ6IWSDU3js = require('./chunk-Z6IWSDU3.js');
12
+ var _chunkW5Z3I3S2js = require('./chunk-W5Z3I3S2.js');
13
13
  require('./chunk-H34KPZQW.js');
14
14
  require('./chunk-LTJQUORK.js');
15
- require('./chunk-ACSKKIYM.js');
16
- require('./chunk-467NHGLF.js');
15
+ require('./chunk-PLV4QGF4.js');
16
+ require('./chunk-2ZEOKKVA.js');
17
17
  require('./chunk-ZSTF2AEN.js');
18
18
  require('./chunk-UW3WHSZ5.js');
19
19
  require('./chunk-UJIUFWXE.js');
@@ -22,4 +22,4 @@ require('./chunk-UJIUFWXE.js');
22
22
 
23
23
 
24
24
 
25
- exports.UnifiedViteWeappTailwindcssPlugin = _chunkZ6IWSDU3js.UnifiedViteWeappTailwindcssPlugin; exports.UnifiedWebpackPluginV5 = _chunkIXZDFEPLjs.UnifiedWebpackPluginV5; exports.createPlugins = _chunkK7AD7FLJjs.createPlugins; exports.weappTailwindcssPackageDir = _chunkIXZDFEPLjs.weappTailwindcssPackageDir;
25
+ exports.UnifiedViteWeappTailwindcssPlugin = _chunkW5Z3I3S2js.UnifiedViteWeappTailwindcssPlugin; exports.UnifiedWebpackPluginV5 = _chunk26ZRX6OHjs.UnifiedWebpackPluginV5; exports.createPlugins = _chunkN2ZUYGKAjs.createPlugins; exports.weappTailwindcssPackageDir = _chunk26ZRX6OHjs.weappTailwindcssPackageDir;
package/dist/index.mjs CHANGED
@@ -2,18 +2,18 @@ import "./chunk-YAN7TO2B.mjs";
2
2
  import {
3
3
  UnifiedWebpackPluginV5,
4
4
  weappTailwindcssPackageDir
5
- } from "./chunk-OJRQGFJR.mjs";
6
- import "./chunk-GVPBDBX4.mjs";
5
+ } from "./chunk-E3GZQTOH.mjs";
6
+ import "./chunk-KSHK56CW.mjs";
7
7
  import {
8
8
  createPlugins
9
- } from "./chunk-5BZA7BAP.mjs";
9
+ } from "./chunk-NLLCK6RM.mjs";
10
10
  import {
11
11
  UnifiedViteWeappTailwindcssPlugin
12
- } from "./chunk-6OTI5FPH.mjs";
12
+ } from "./chunk-UUVGNRUM.mjs";
13
13
  import "./chunk-JW7P34IH.mjs";
14
14
  import "./chunk-RRHPTTCP.mjs";
15
- import "./chunk-W4ERVC6L.mjs";
16
- import "./chunk-HCXLLOIU.mjs";
15
+ import "./chunk-WTOLVORM.mjs";
16
+ import "./chunk-7KTLLGAG.mjs";
17
17
  import "./chunk-DKPIYG24.mjs";
18
18
  import "./chunk-ZNKIYZRQ.mjs";
19
19
  import "./chunk-QGH4JZRW.mjs";
package/dist/presets.js CHANGED
@@ -3,7 +3,7 @@
3
3
  var _chunkOXASK55Qjs = require('./chunk-OXASK55Q.js');
4
4
 
5
5
 
6
- var _chunk467NHGLFjs = require('./chunk-467NHGLF.js');
6
+ var _chunk2ZEOKKVAjs = require('./chunk-2ZEOKKVA.js');
7
7
 
8
8
 
9
9
  var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
@@ -57,7 +57,7 @@ function toCssEntries(entries) {
57
57
  return Array.isArray(entries) ? entries : [entries];
58
58
  }
59
59
  function hbuilderx(options = {}) {
60
- const baseDir = _chunk467NHGLFjs.resolveTailwindcssBasedir.call(void 0, options.base);
60
+ const baseDir = _chunk2ZEOKKVAjs.resolveTailwindcssBasedir.call(void 0, options.base);
61
61
  const cssEntries = toCssEntries(options.cssEntries);
62
62
  const tailwindConfig = {
63
63
  v2: {
package/dist/presets.mjs CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-PMF2CCKK.mjs";
4
4
  import {
5
5
  resolveTailwindcssBasedir
6
- } from "./chunk-HCXLLOIU.mjs";
6
+ } from "./chunk-7KTLLGAG.mjs";
7
7
  import {
8
8
  defuOverrideArray
9
9
  } from "./chunk-ZNKIYZRQ.mjs";
package/dist/vite.js CHANGED
@@ -1,13 +1,13 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkZ6IWSDU3js = require('./chunk-Z6IWSDU3.js');
3
+ var _chunkW5Z3I3S2js = require('./chunk-W5Z3I3S2.js');
4
4
  require('./chunk-H34KPZQW.js');
5
5
  require('./chunk-LTJQUORK.js');
6
- require('./chunk-ACSKKIYM.js');
7
- require('./chunk-467NHGLF.js');
6
+ require('./chunk-PLV4QGF4.js');
7
+ require('./chunk-2ZEOKKVA.js');
8
8
  require('./chunk-ZSTF2AEN.js');
9
9
  require('./chunk-UW3WHSZ5.js');
10
10
  require('./chunk-UJIUFWXE.js');
11
11
 
12
12
 
13
- exports.UnifiedViteWeappTailwindcssPlugin = _chunkZ6IWSDU3js.UnifiedViteWeappTailwindcssPlugin;
13
+ exports.UnifiedViteWeappTailwindcssPlugin = _chunkW5Z3I3S2js.UnifiedViteWeappTailwindcssPlugin;
package/dist/vite.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  UnifiedViteWeappTailwindcssPlugin
3
- } from "./chunk-6OTI5FPH.mjs";
3
+ } from "./chunk-UUVGNRUM.mjs";
4
4
  import "./chunk-JW7P34IH.mjs";
5
5
  import "./chunk-RRHPTTCP.mjs";
6
- import "./chunk-W4ERVC6L.mjs";
7
- import "./chunk-HCXLLOIU.mjs";
6
+ import "./chunk-WTOLVORM.mjs";
7
+ import "./chunk-7KTLLGAG.mjs";
8
8
  import "./chunk-DKPIYG24.mjs";
9
9
  import "./chunk-ZNKIYZRQ.mjs";
10
10
  import "./chunk-QGH4JZRW.mjs";
@@ -1,13 +1,77 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }// src/bundlers/webpack/loaders/weapp-tw-runtime-loader.ts
2
2
  var _loaderutils = require('loader-utils'); var _loaderutils2 = _interopRequireDefault(_loaderutils);
3
+
4
+ // src/bundlers/shared/css-imports.ts
5
+ var _path = require('path'); var _path2 = _interopRequireDefault(_path);
6
+ var tailwindcssImportRE = /^tailwindcss(?:\/.*)?$/;
7
+ var tailwindcssCssImportStatementRE = /(@import\s+(?:url\(\s*)?)(["'])(tailwindcss(?:\/[^"']*)?\$?)(\2\s*\)?)/gi;
8
+ function normalizeTailwindcssSpecifier(specifier) {
9
+ if (specifier === "tailwindcss$") {
10
+ return "tailwindcss";
11
+ }
12
+ return specifier;
13
+ }
14
+ function getTailwindcssSubpath(specifier) {
15
+ if (specifier === "tailwindcss") {
16
+ return "index.css";
17
+ }
18
+ return specifier.slice("tailwindcss/".length);
19
+ }
20
+ function resolveTailwindcssImport(specifier, pkgDir, options) {
21
+ var _a;
22
+ const normalized = normalizeTailwindcssSpecifier(specifier);
23
+ if (!tailwindcssImportRE.test(normalized)) {
24
+ return null;
25
+ }
26
+ const join = (_a = options == null ? void 0 : options.join) != null ? _a : _path2.default.join;
27
+ const subpath = getTailwindcssSubpath(normalized);
28
+ return join(pkgDir, subpath);
29
+ }
30
+ function rewriteTailwindcssImportsInCode(code, pkgDir, options) {
31
+ let hasReplacements = false;
32
+ const rewritten = code.replace(
33
+ tailwindcssCssImportStatementRE,
34
+ (full, prefix, quote, specifier, suffix) => {
35
+ const replacement = resolveTailwindcssImport(specifier, pkgDir, options);
36
+ if (!replacement) {
37
+ return full;
38
+ }
39
+ hasReplacements = true;
40
+ return `${prefix}${quote}${replacement}${suffix}`;
41
+ }
42
+ );
43
+ return hasReplacements ? rewritten : void 0;
44
+ }
45
+
46
+ // src/bundlers/webpack/loaders/weapp-tw-runtime-loader.ts
47
+ function slash(p) {
48
+ return p.replace(/\\/g, "/");
49
+ }
50
+ function joinPosixPath(base, subpath) {
51
+ if (base.endsWith("/")) {
52
+ return `${base}${subpath}`;
53
+ }
54
+ return `${base}/${subpath}`;
55
+ }
56
+ function applyCssImportRewrite(source, options) {
57
+ const rewriteOptions = options == null ? void 0 : options.rewriteCssImports;
58
+ const pkgDir = rewriteOptions == null ? void 0 : rewriteOptions.pkgDir;
59
+ if (!pkgDir) {
60
+ return source;
61
+ }
62
+ const rewritten = rewriteTailwindcssImportsInCode(source, slash(pkgDir), {
63
+ join: joinPosixPath
64
+ });
65
+ return rewritten != null ? rewritten : source;
66
+ }
3
67
  var WeappTwRuntimeAopLoader = function(source) {
4
68
  var _a;
5
69
  const opt = _loaderutils2.default.getOptions(this);
6
70
  const maybePromise = (_a = opt == null ? void 0 : opt.getClassSet) == null ? void 0 : _a.call(opt);
7
71
  if (maybePromise && typeof maybePromise.then === "function") {
8
- return Promise.resolve(maybePromise).then(() => source);
72
+ return Promise.resolve(maybePromise).then(() => applyCssImportRewrite(source, opt));
9
73
  }
10
- return source;
74
+ return applyCssImportRewrite(source, opt);
11
75
  };
12
76
  var weapp_tw_runtime_loader_default = WeappTwRuntimeAopLoader;
13
77
 
package/dist/webpack.js CHANGED
@@ -1,16 +1,16 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunkIXZDFEPLjs = require('./chunk-IXZDFEPL.js');
5
- require('./chunk-JPLWILCP.js');
4
+ var _chunk26ZRX6OHjs = require('./chunk-26ZRX6OH.js');
5
+ require('./chunk-UCA2DMVN.js');
6
6
  require('./chunk-H34KPZQW.js');
7
7
  require('./chunk-LTJQUORK.js');
8
- require('./chunk-ACSKKIYM.js');
9
- require('./chunk-467NHGLF.js');
8
+ require('./chunk-PLV4QGF4.js');
9
+ require('./chunk-2ZEOKKVA.js');
10
10
  require('./chunk-ZSTF2AEN.js');
11
11
  require('./chunk-UW3WHSZ5.js');
12
12
  require('./chunk-UJIUFWXE.js');
13
13
 
14
14
 
15
15
 
16
- exports.UnifiedWebpackPluginV5 = _chunkIXZDFEPLjs.UnifiedWebpackPluginV5; exports.weappTailwindcssPackageDir = _chunkIXZDFEPLjs.weappTailwindcssPackageDir;
16
+ exports.UnifiedWebpackPluginV5 = _chunk26ZRX6OHjs.UnifiedWebpackPluginV5; exports.weappTailwindcssPackageDir = _chunk26ZRX6OHjs.weappTailwindcssPackageDir;
package/dist/webpack.mjs CHANGED
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  UnifiedWebpackPluginV5,
3
3
  weappTailwindcssPackageDir
4
- } from "./chunk-OJRQGFJR.mjs";
5
- import "./chunk-GVPBDBX4.mjs";
4
+ } from "./chunk-E3GZQTOH.mjs";
5
+ import "./chunk-KSHK56CW.mjs";
6
6
  import "./chunk-JW7P34IH.mjs";
7
7
  import "./chunk-RRHPTTCP.mjs";
8
- import "./chunk-W4ERVC6L.mjs";
9
- import "./chunk-HCXLLOIU.mjs";
8
+ import "./chunk-WTOLVORM.mjs";
9
+ import "./chunk-7KTLLGAG.mjs";
10
10
  import "./chunk-DKPIYG24.mjs";
11
11
  import "./chunk-ZNKIYZRQ.mjs";
12
12
  import "./chunk-QGH4JZRW.mjs";
package/dist/webpack4.js CHANGED
@@ -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 _chunkJPLWILCPjs = require('./chunk-JPLWILCP.js');
4
+ var _chunkUCA2DMVNjs = require('./chunk-UCA2DMVN.js');
5
5
 
6
6
 
7
7
 
@@ -18,8 +18,8 @@ var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
18
18
 
19
19
 
20
20
 
21
- var _chunkACSKKIYMjs = require('./chunk-ACSKKIYM.js');
22
- require('./chunk-467NHGLF.js');
21
+ var _chunkPLV4QGF4js = require('./chunk-PLV4QGF4.js');
22
+ require('./chunk-2ZEOKKVA.js');
23
23
  require('./chunk-ZSTF2AEN.js');
24
24
 
25
25
 
@@ -31,11 +31,11 @@ var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
31
31
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
32
32
  var _process = require('process'); var _process2 = _interopRequireDefault(_process);
33
33
  var _webpacksources = require('webpack-sources');
34
- var debug = _chunkACSKKIYMjs.createDebug.call(void 0, );
34
+ var debug = _chunkPLV4QGF4js.createDebug.call(void 0, );
35
35
  var weappTailwindcssPackageDir = _chunkH34KPZQWjs.resolvePackageDir.call(void 0, "weapp-tailwindcss");
36
36
  var UnifiedWebpackPluginV4 = class {
37
37
  constructor(options = {}) {
38
- this.options = _chunkACSKKIYMjs.getCompilerContext.call(void 0, options);
38
+ this.options = _chunkPLV4QGF4js.getCompilerContext.call(void 0, options);
39
39
  this.userSpecifiedRewriteCssImports = Object.prototype.hasOwnProperty.call(options, "rewriteCssImports");
40
40
  this.appType = this.options.appType;
41
41
  }
@@ -60,46 +60,53 @@ var UnifiedWebpackPluginV4 = class {
60
60
  }
61
61
  const shouldRewriteCssImports = this.options.rewriteCssImports !== false && (this.userSpecifiedRewriteCssImports || (_nullishCoalesce(initialTwPatcher.majorVersion, () => ( 0))) >= 4);
62
62
  if (shouldRewriteCssImports) {
63
- _chunkJPLWILCPjs.applyTailwindcssCssImportRewrite.call(void 0, compiler, {
63
+ _chunkUCA2DMVNjs.applyTailwindcssCssImportRewrite.call(void 0, compiler, {
64
64
  pkgDir: weappTailwindcssPackageDir,
65
65
  enabled: true
66
66
  });
67
67
  }
68
68
  const runtimeState = {
69
69
  twPatcher: initialTwPatcher,
70
- patchPromise: _chunkACSKKIYMjs.createTailwindPatchPromise.call(void 0, initialTwPatcher),
70
+ patchPromise: _chunkPLV4QGF4js.createTailwindPatchPromise.call(void 0, initialTwPatcher),
71
71
  refreshTailwindcssPatcher
72
72
  };
73
73
  const refreshRuntimeState = async (force) => {
74
- await _chunkACSKKIYMjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
74
+ await _chunkPLV4QGF4js.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
75
75
  };
76
76
  async function getClassSetInLoader() {
77
77
  await refreshRuntimeState(true);
78
78
  await runtimeState.patchPromise;
79
- await _chunkACSKKIYMjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
79
+ await _chunkPLV4QGF4js.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
80
80
  }
81
81
  onLoad();
82
82
  const loader = _nullishCoalesce(runtimeLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-runtime-loader.js")));
83
83
  const isExisted = _fs2.default.existsSync(loader);
84
- const WeappTwRuntimeAopLoader = {
84
+ const runtimeLoaderRewriteOptions = shouldRewriteCssImports ? {
85
+ pkgDir: weappTailwindcssPackageDir
86
+ } : void 0;
87
+ const runtimeLoaderOptions = {
88
+ getClassSet: getClassSetInLoader,
89
+ rewriteCssImports: runtimeLoaderRewriteOptions
90
+ };
91
+ const createRuntimeLoaderEntry = () => ({
85
92
  loader,
86
- options: {
87
- getClassSet: getClassSetInLoader
88
- },
93
+ options: runtimeLoaderOptions,
89
94
  ident: null,
90
95
  type: null
91
- };
92
- compiler.hooks.compilation.tap(_chunkACSKKIYMjs.pluginName, (compilation) => {
93
- compilation.hooks.normalModuleLoader.tap(_chunkACSKKIYMjs.pluginName, (_loaderContext, module) => {
96
+ });
97
+ compiler.hooks.compilation.tap(_chunkPLV4QGF4js.pluginName, (compilation) => {
98
+ compilation.hooks.normalModuleLoader.tap(_chunkPLV4QGF4js.pluginName, (_loaderContext, module) => {
94
99
  if (isExisted) {
95
100
  const idx = module.loaders.findIndex((x) => x.loader.includes("postcss-loader"));
96
101
  if (idx > -1) {
97
- module.loaders.unshift(WeappTwRuntimeAopLoader);
102
+ module.loaders.splice(idx + 1, 0, createRuntimeLoaderEntry());
103
+ } else {
104
+ module.loaders.push(createRuntimeLoaderEntry());
98
105
  }
99
106
  }
100
107
  });
101
108
  });
102
- compiler.hooks.emit.tapPromise(_chunkACSKKIYMjs.pluginName, async (compilation) => {
109
+ compiler.hooks.emit.tapPromise(_chunkPLV4QGF4js.pluginName, async (compilation) => {
103
110
  await runtimeState.patchPromise;
104
111
  onStart();
105
112
  debug("start");
@@ -165,7 +172,7 @@ var UnifiedWebpackPluginV4 = class {
165
172
  const groupedEntries = _chunkUW3WHSZ5js.getGroupedEntries.call(void 0, entries, this.options);
166
173
  await refreshRuntimeState(true);
167
174
  await runtimeState.patchPromise;
168
- const runtimeSet = await _chunkACSKKIYMjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
175
+ const runtimeSet = await _chunkPLV4QGF4js.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
169
176
  debug("get runtimeSet, class count: %d", runtimeSet.size);
170
177
  const tasks = [];
171
178
  if (Array.isArray(groupedEntries.html)) {
@@ -202,7 +209,7 @@ var UnifiedWebpackPluginV4 = class {
202
209
  const jsTaskFactories = [];
203
210
  if (Array.isArray(groupedEntries.js)) {
204
211
  for (const [file] of groupedEntries.js) {
205
- const cacheKey = _chunkJPLWILCPjs.getCacheKey.call(void 0, file);
212
+ const cacheKey = _chunkUCA2DMVNjs.getCacheKey.call(void 0, file);
206
213
  const assetSource = compilation.assets[file];
207
214
  if (!assetSource) {
208
215
  continue;
package/dist/webpack4.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  applyTailwindcssCssImportRewrite,
3
3
  getCacheKey
4
- } from "./chunk-GVPBDBX4.mjs";
4
+ } from "./chunk-KSHK56CW.mjs";
5
5
  import {
6
6
  pushConcurrentTaskFactories,
7
7
  resolveOutputSpecifier,
@@ -18,8 +18,8 @@ import {
18
18
  getCompilerContext,
19
19
  pluginName,
20
20
  refreshTailwindRuntimeState
21
- } from "./chunk-W4ERVC6L.mjs";
22
- import "./chunk-HCXLLOIU.mjs";
21
+ } from "./chunk-WTOLVORM.mjs";
22
+ import "./chunk-7KTLLGAG.mjs";
23
23
  import "./chunk-DKPIYG24.mjs";
24
24
  import {
25
25
  getGroupedEntries
@@ -83,20 +83,27 @@ var UnifiedWebpackPluginV4 = class {
83
83
  onLoad();
84
84
  const loader = runtimeLoaderPath ?? path.resolve(__dirname, "./weapp-tw-runtime-loader.js");
85
85
  const isExisted = fs.existsSync(loader);
86
- const WeappTwRuntimeAopLoader = {
86
+ const runtimeLoaderRewriteOptions = shouldRewriteCssImports ? {
87
+ pkgDir: weappTailwindcssPackageDir
88
+ } : void 0;
89
+ const runtimeLoaderOptions = {
90
+ getClassSet: getClassSetInLoader,
91
+ rewriteCssImports: runtimeLoaderRewriteOptions
92
+ };
93
+ const createRuntimeLoaderEntry = () => ({
87
94
  loader,
88
- options: {
89
- getClassSet: getClassSetInLoader
90
- },
95
+ options: runtimeLoaderOptions,
91
96
  ident: null,
92
97
  type: null
93
- };
98
+ });
94
99
  compiler.hooks.compilation.tap(pluginName, (compilation) => {
95
100
  compilation.hooks.normalModuleLoader.tap(pluginName, (_loaderContext, module) => {
96
101
  if (isExisted) {
97
102
  const idx = module.loaders.findIndex((x) => x.loader.includes("postcss-loader"));
98
103
  if (idx > -1) {
99
- module.loaders.unshift(WeappTwRuntimeAopLoader);
104
+ module.loaders.splice(idx + 1, 0, createRuntimeLoaderEntry());
105
+ } else {
106
+ module.loaders.push(createRuntimeLoaderEntry());
100
107
  }
101
108
  }
102
109
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "weapp-tailwindcss",
3
- "version": "4.8.2",
3
+ "version": "4.8.3",
4
4
  "description": "把 tailwindcss 原子化样式思想,带给小程序开发者们! bring tailwindcss to miniprogram developers!",
5
5
  "author": "ice breaker <1324318532@qq.com>",
6
6
  "license": "MIT",
@@ -178,8 +178,8 @@
178
178
  "tailwindcss-patch": "^8.2.4",
179
179
  "webpack-sources": "3.3.3",
180
180
  "@weapp-tailwindcss/logger": "1.1.0",
181
- "@weapp-tailwindcss/postcss": "2.0.3",
182
- "@weapp-tailwindcss/shared": "1.1.0"
181
+ "@weapp-tailwindcss/shared": "1.1.0",
182
+ "@weapp-tailwindcss/postcss": "2.0.3"
183
183
  },
184
184
  "scripts": {
185
185
  "dev": "tsup --watch --sourcemap",