weapp-tailwindcss 4.8.7 → 4.8.9
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-JYHBNTYH.mjs → chunk-3BMQ6ZWL.mjs} +2 -2
- package/dist/{chunk-ZB6MFKXJ.mjs → chunk-3IP5JCFZ.mjs} +1 -1
- package/dist/{chunk-ZSTF2AEN.js → chunk-3URI7W6X.js} +11 -1
- package/dist/chunk-4KBHUV2C.js +136 -0
- package/dist/{chunk-KRRIFURM.mjs → chunk-5ROWVF7O.mjs} +191 -127
- package/dist/{chunk-MIC6E7DV.mjs → chunk-6OE4Q2BC.mjs} +100 -29
- package/dist/{chunk-5F64FE7K.js → chunk-6UW6DOPI.js} +5 -5
- package/dist/chunk-AGWNHP3C.mjs +136 -0
- package/dist/chunk-BYXBJQAS.js +1 -0
- package/dist/{chunk-BMUQ4OAB.mjs → chunk-FYYIFZ36.mjs} +13 -107
- package/dist/{chunk-YQQ3HDQD.mjs → chunk-H6YMPVI6.mjs} +2 -2
- package/dist/{chunk-JW7P34IH.mjs → chunk-HXYNNE6Q.mjs} +178 -59
- package/dist/{chunk-3XGTIDA6.mjs → chunk-IXK4ZWFR.mjs} +337 -169
- package/dist/{chunk-322IEI2K.js → chunk-J25ZFRYM.js} +172 -53
- package/dist/{chunk-GORSBZA2.js → chunk-M4NERJO7.js} +1 -1
- package/dist/{chunk-VONLQCG7.js → chunk-PBUQRF6F.js} +211 -147
- package/dist/{chunk-DKPIYG24.mjs → chunk-QF65JGNW.mjs} +11 -1
- package/dist/{chunk-ESYZLHZI.js → chunk-S2YGU6BU.js} +354 -186
- package/dist/{chunk-U4WEDSBF.js → chunk-XQKBWIFI.js} +7 -7
- package/dist/{chunk-WUJAJ42W.js → chunk-Z366CKKB.js} +118 -47
- package/dist/{chunk-7BASRP3P.js → chunk-ZTGB2D5W.js} +24 -118
- package/dist/cli.js +39 -32
- package/dist/cli.mjs +12 -5
- package/dist/core.js +11 -11
- package/dist/core.mjs +5 -5
- package/dist/css-macro/postcss.js +1 -1
- package/dist/css-macro/postcss.mjs +1 -1
- package/dist/css-macro.js +1 -1
- package/dist/css-macro.mjs +1 -1
- package/dist/defaults.js +3 -3
- package/dist/defaults.mjs +2 -2
- package/dist/gulp.js +7 -7
- package/dist/gulp.mjs +6 -6
- package/dist/index.js +11 -11
- package/dist/index.mjs +10 -10
- package/dist/postcss-html-transform.js +1 -1
- package/dist/postcss-html-transform.mjs +1 -1
- package/dist/presets.js +4 -4
- package/dist/presets.mjs +2 -2
- package/dist/reset.js +1 -1
- package/dist/reset.mjs +1 -1
- package/dist/types.d.mts +7 -0
- package/dist/types.d.ts +7 -0
- package/dist/types.js +1 -1
- package/dist/types.mjs +1 -1
- package/dist/vite.js +8 -8
- package/dist/vite.mjs +7 -7
- package/dist/{weapp-tw-runtime-loader.js → weapp-tw-css-import-rewrite-loader.js} +49 -18
- package/dist/weapp-tw-runtime-classset-loader.js +23 -0
- package/dist/webpack.d.mts +0 -1
- package/dist/webpack.d.ts +0 -1
- package/dist/webpack.js +9 -9
- package/dist/webpack.mjs +8 -8
- package/dist/webpack4.d.mts +0 -1
- package/dist/webpack4.d.ts +0 -1
- package/dist/webpack4.js +123 -48
- package/dist/webpack4.mjs +105 -30
- package/package.json +4 -4
- package/dist/chunk-PFUB74BL.mjs +0 -61
- package/dist/chunk-WYXD5IW7.js +0 -61
package/dist/vite.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
UnifiedViteWeappTailwindcssPlugin
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-5ROWVF7O.mjs";
|
|
4
|
+
import "./chunk-HXYNNE6Q.mjs";
|
|
5
5
|
import "./chunk-RRHPTTCP.mjs";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-3BMQ6ZWL.mjs";
|
|
7
|
+
import "./chunk-FYYIFZ36.mjs";
|
|
8
|
+
import "./chunk-IXK4ZWFR.mjs";
|
|
9
|
+
import "./chunk-QF65JGNW.mjs";
|
|
10
10
|
import "./chunk-ZNKIYZRQ.mjs";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-3IP5JCFZ.mjs";
|
|
12
12
|
export {
|
|
13
13
|
UnifiedViteWeappTailwindcssPlugin
|
|
14
14
|
};
|
|
@@ -1,8 +1,25 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }require('./chunk-BYXBJQAS.js');
|
|
2
|
+
|
|
3
|
+
// src/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.ts
|
|
4
|
+
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
2
5
|
var _loaderutils = require('loader-utils'); var _loaderutils2 = _interopRequireDefault(_loaderutils);
|
|
3
6
|
|
|
4
7
|
// src/bundlers/shared/css-imports.ts
|
|
5
8
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
9
|
+
|
|
10
|
+
// src/shared/mpx.ts
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
// src/shared/tailwindcss-css-redirect.ts
|
|
14
|
+
var _module = require('module'); var _module2 = _interopRequireDefault(_module);
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
// src/shared/mpx.ts
|
|
18
|
+
function isMpx(appType) {
|
|
19
|
+
return appType === "mpx";
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// src/bundlers/shared/css-imports.ts
|
|
6
23
|
var tailwindcssImportRE = /^tailwindcss(?:\/.*)?$/;
|
|
7
24
|
var tailwindcssCssImportStatementRE = /(@import\s+(?:url\(\s*)?)(["'])(tailwindcss(?:\/[^"']*)?\$?)(\2\s*\)?)/gi;
|
|
8
25
|
function normalizeTailwindcssSpecifier(specifier) {
|
|
@@ -23,6 +40,9 @@ function resolveTailwindcssImport(specifier, pkgDir, options) {
|
|
|
23
40
|
if (!tailwindcssImportRE.test(normalized)) {
|
|
24
41
|
return null;
|
|
25
42
|
}
|
|
43
|
+
if (isMpx(options == null ? void 0 : options.appType) && normalized === "tailwindcss") {
|
|
44
|
+
return "weapp-tailwindcss/index.css";
|
|
45
|
+
}
|
|
26
46
|
const join = (_a = options == null ? void 0 : options.join) != null ? _a : _path2.default.join;
|
|
27
47
|
const subpath = getTailwindcssSubpath(normalized);
|
|
28
48
|
return join(pkgDir, subpath);
|
|
@@ -43,7 +63,7 @@ function rewriteTailwindcssImportsInCode(code, pkgDir, options) {
|
|
|
43
63
|
return hasReplacements ? rewritten : void 0;
|
|
44
64
|
}
|
|
45
65
|
|
|
46
|
-
// src/bundlers/webpack/loaders/weapp-tw-
|
|
66
|
+
// src/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.ts
|
|
47
67
|
function slash(p) {
|
|
48
68
|
return p.replace(/\\/g, "/");
|
|
49
69
|
}
|
|
@@ -59,29 +79,40 @@ function applyCssImportRewrite(source, options) {
|
|
|
59
79
|
if (!pkgDir) {
|
|
60
80
|
return source;
|
|
61
81
|
}
|
|
62
|
-
const rewritten = rewriteTailwindcssImportsInCode(
|
|
63
|
-
|
|
64
|
-
|
|
82
|
+
const rewritten = rewriteTailwindcssImportsInCode(
|
|
83
|
+
source,
|
|
84
|
+
slash(pkgDir),
|
|
85
|
+
{
|
|
86
|
+
join: joinPosixPath,
|
|
87
|
+
appType: rewriteOptions.appType
|
|
88
|
+
}
|
|
89
|
+
);
|
|
65
90
|
return rewritten != null ? rewritten : source;
|
|
66
91
|
}
|
|
67
|
-
function
|
|
68
|
-
|
|
92
|
+
function transformCssImportRewriteSource(source, options) {
|
|
93
|
+
const isBuffer = Buffer.isBuffer(source);
|
|
94
|
+
const input = isBuffer ? source.toString("utf-8") : source;
|
|
95
|
+
const rewritten = applyCssImportRewrite(input, options);
|
|
96
|
+
if (rewritten === input) {
|
|
69
97
|
return source;
|
|
70
98
|
}
|
|
71
|
-
|
|
99
|
+
if (_process2.default.env.WEAPP_TW_LOADER_DEBUG) {
|
|
100
|
+
console.log("[weapp-tw-css-import-rewrite-loader] rewritten import", {
|
|
101
|
+
before: input.slice(0, 80),
|
|
102
|
+
after: rewritten.slice(0, 80)
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
return rewritten;
|
|
72
106
|
}
|
|
73
|
-
var
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const maybePromise = (_a = opt == null ? void 0 : opt.getClassSet) == null ? void 0 : _a.call(opt);
|
|
77
|
-
if (maybePromise && typeof maybePromise.then === "function") {
|
|
78
|
-
return Promise.resolve(maybePromise).then(() => transformSource(source, opt));
|
|
107
|
+
var WeappTwCssImportRewriteLoader = function(source) {
|
|
108
|
+
if (_process2.default.env.WEAPP_TW_LOADER_DEBUG) {
|
|
109
|
+
console.log("[weapp-tw-css-import-rewrite-loader] executing for", this.resourcePath);
|
|
79
110
|
}
|
|
80
|
-
|
|
111
|
+
const opt = _loaderutils2.default.getOptions(this);
|
|
112
|
+
return transformCssImportRewriteSource(source, opt);
|
|
81
113
|
};
|
|
82
|
-
var
|
|
114
|
+
var weapp_tw_css_import_rewrite_loader_default = WeappTwCssImportRewriteLoader;
|
|
83
115
|
|
|
84
116
|
|
|
85
|
-
exports.default = weapp_tw_runtime_loader_default;
|
|
86
117
|
|
|
87
|
-
|
|
118
|
+
exports.default = weapp_tw_css_import_rewrite_loader_default; exports.transformCssImportRewriteSource = transformCssImportRewriteSource;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }require('./chunk-BYXBJQAS.js');
|
|
2
|
+
|
|
3
|
+
// src/bundlers/webpack/loaders/weapp-tw-runtime-classset-loader.ts
|
|
4
|
+
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
5
|
+
var _loaderutils = require('loader-utils'); var _loaderutils2 = _interopRequireDefault(_loaderutils);
|
|
6
|
+
var WeappTwRuntimeClassSetLoader = function(source) {
|
|
7
|
+
var _a;
|
|
8
|
+
if (_process2.default.env.WEAPP_TW_LOADER_DEBUG) {
|
|
9
|
+
console.log("[weapp-tw-runtime-classset-loader] executing for", this.resourcePath);
|
|
10
|
+
}
|
|
11
|
+
const opt = _loaderutils2.default.getOptions(this);
|
|
12
|
+
const maybePromise = (_a = opt == null ? void 0 : opt.getClassSet) == null ? void 0 : _a.call(opt);
|
|
13
|
+
if (maybePromise && typeof maybePromise.then === "function") {
|
|
14
|
+
return Promise.resolve(maybePromise).then(() => source);
|
|
15
|
+
}
|
|
16
|
+
return source;
|
|
17
|
+
};
|
|
18
|
+
var weapp_tw_runtime_classset_loader_default = WeappTwRuntimeClassSetLoader;
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
exports.default = weapp_tw_runtime_classset_loader_default;
|
|
22
|
+
|
|
23
|
+
module.exports = exports.default;
|
package/dist/webpack.d.mts
CHANGED
|
@@ -17,7 +17,6 @@ declare const weappTailwindcssPackageDir: string;
|
|
|
17
17
|
declare class UnifiedWebpackPluginV5 implements IBaseWebpackPlugin {
|
|
18
18
|
options: InternalUserDefinedOptions;
|
|
19
19
|
appType?: AppType;
|
|
20
|
-
private readonly userSpecifiedRewriteCssImports;
|
|
21
20
|
constructor(options?: UserDefinedOptions);
|
|
22
21
|
apply(compiler: Compiler): void;
|
|
23
22
|
}
|
package/dist/webpack.d.ts
CHANGED
|
@@ -17,7 +17,6 @@ declare const weappTailwindcssPackageDir: string;
|
|
|
17
17
|
declare class UnifiedWebpackPluginV5 implements IBaseWebpackPlugin {
|
|
18
18
|
options: InternalUserDefinedOptions;
|
|
19
19
|
appType?: AppType;
|
|
20
|
-
private readonly userSpecifiedRewriteCssImports;
|
|
21
20
|
constructor(options?: UserDefinedOptions);
|
|
22
21
|
apply(compiler: Compiler): void;
|
|
23
22
|
}
|
package/dist/webpack.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('./chunk-
|
|
6
|
-
require('./chunk-
|
|
4
|
+
var _chunkZ366CKKBjs = require('./chunk-Z366CKKB.js');
|
|
5
|
+
require('./chunk-4KBHUV2C.js');
|
|
6
|
+
require('./chunk-J25ZFRYM.js');
|
|
7
7
|
require('./chunk-LTJQUORK.js');
|
|
8
|
-
require('./chunk-
|
|
9
|
-
require('./chunk-
|
|
10
|
-
require('./chunk-
|
|
11
|
-
require('./chunk-
|
|
8
|
+
require('./chunk-6UW6DOPI.js');
|
|
9
|
+
require('./chunk-ZTGB2D5W.js');
|
|
10
|
+
require('./chunk-S2YGU6BU.js');
|
|
11
|
+
require('./chunk-3URI7W6X.js');
|
|
12
12
|
require('./chunk-UW3WHSZ5.js');
|
|
13
|
-
require('./chunk-
|
|
13
|
+
require('./chunk-M4NERJO7.js');
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
exports.UnifiedWebpackPluginV5 =
|
|
17
|
+
exports.UnifiedWebpackPluginV5 = _chunkZ366CKKBjs.UnifiedWebpackPluginV5; exports.weappTailwindcssPackageDir = _chunkZ366CKKBjs.weappTailwindcssPackageDir;
|
package/dist/webpack.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
UnifiedWebpackPluginV5,
|
|
3
3
|
weappTailwindcssPackageDir
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-6OE4Q2BC.mjs";
|
|
5
|
+
import "./chunk-AGWNHP3C.mjs";
|
|
6
|
+
import "./chunk-HXYNNE6Q.mjs";
|
|
7
7
|
import "./chunk-RRHPTTCP.mjs";
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-3BMQ6ZWL.mjs";
|
|
9
|
+
import "./chunk-FYYIFZ36.mjs";
|
|
10
|
+
import "./chunk-IXK4ZWFR.mjs";
|
|
11
|
+
import "./chunk-QF65JGNW.mjs";
|
|
12
12
|
import "./chunk-ZNKIYZRQ.mjs";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-3IP5JCFZ.mjs";
|
|
14
14
|
export {
|
|
15
15
|
UnifiedWebpackPluginV5,
|
|
16
16
|
weappTailwindcssPackageDir
|
package/dist/webpack4.d.mts
CHANGED
|
@@ -18,7 +18,6 @@ declare const weappTailwindcssPackageDir: string;
|
|
|
18
18
|
declare class UnifiedWebpackPluginV4 implements IBaseWebpackPlugin {
|
|
19
19
|
options: InternalUserDefinedOptions;
|
|
20
20
|
appType?: AppType;
|
|
21
|
-
private readonly userSpecifiedRewriteCssImports;
|
|
22
21
|
constructor(options?: UserDefinedOptions);
|
|
23
22
|
apply(compiler: Compiler): void;
|
|
24
23
|
}
|
package/dist/webpack4.d.ts
CHANGED
|
@@ -18,7 +18,6 @@ declare const weappTailwindcssPackageDir: string;
|
|
|
18
18
|
declare class UnifiedWebpackPluginV4 implements IBaseWebpackPlugin {
|
|
19
19
|
options: InternalUserDefinedOptions;
|
|
20
20
|
appType?: AppType;
|
|
21
|
-
private readonly userSpecifiedRewriteCssImports;
|
|
22
21
|
constructor(options?: UserDefinedOptions);
|
|
23
22
|
apply(compiler: Compiler): void;
|
|
24
23
|
}
|
package/dist/webpack4.js
CHANGED
|
@@ -1,47 +1,55 @@
|
|
|
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 _chunkWYXD5IW7js = require('./chunk-WYXD5IW7.js');
|
|
5
4
|
|
|
6
5
|
|
|
7
6
|
|
|
7
|
+
var _chunk4KBHUV2Cjs = require('./chunk-4KBHUV2C.js');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
var _chunkJ25ZFRYMjs = require('./chunk-J25ZFRYM.js');
|
|
11
19
|
|
|
12
20
|
|
|
13
21
|
var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
|
|
14
22
|
|
|
15
23
|
|
|
16
|
-
var
|
|
24
|
+
var _chunk6UW6DOPIjs = require('./chunk-6UW6DOPI.js');
|
|
17
25
|
|
|
18
26
|
|
|
19
27
|
|
|
20
28
|
|
|
21
29
|
|
|
22
30
|
|
|
23
|
-
var
|
|
24
|
-
require('./chunk-
|
|
25
|
-
require('./chunk-
|
|
31
|
+
var _chunkZTGB2D5Wjs = require('./chunk-ZTGB2D5W.js');
|
|
32
|
+
require('./chunk-S2YGU6BU.js');
|
|
33
|
+
require('./chunk-3URI7W6X.js');
|
|
26
34
|
|
|
27
35
|
|
|
28
36
|
var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
|
|
29
|
-
require('./chunk-
|
|
37
|
+
require('./chunk-M4NERJO7.js');
|
|
30
38
|
|
|
31
39
|
// src/bundlers/webpack/BaseUnifiedPlugin/v4.ts
|
|
32
40
|
var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
|
|
33
41
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
34
42
|
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
35
43
|
var _webpacksources = require('webpack-sources');
|
|
36
|
-
var debug =
|
|
37
|
-
var weappTailwindcssPackageDir =
|
|
44
|
+
var debug = _chunkZTGB2D5Wjs.createDebug.call(void 0, );
|
|
45
|
+
var weappTailwindcssPackageDir = _chunkJ25ZFRYMjs.resolvePackageDir.call(void 0, "weapp-tailwindcss");
|
|
38
46
|
var UnifiedWebpackPluginV4 = class {
|
|
39
47
|
constructor(options = {}) {
|
|
40
|
-
this.options =
|
|
41
|
-
this.userSpecifiedRewriteCssImports = Object.prototype.hasOwnProperty.call(options, "rewriteCssImports");
|
|
48
|
+
this.options = _chunkZTGB2D5Wjs.getCompilerContext.call(void 0, options);
|
|
42
49
|
this.appType = this.options.appType;
|
|
43
50
|
}
|
|
44
51
|
apply(compiler) {
|
|
52
|
+
compiler.options = compiler.options || {};
|
|
45
53
|
const {
|
|
46
54
|
mainCssChunkMatcher,
|
|
47
55
|
disabled,
|
|
@@ -53,6 +61,7 @@ var UnifiedWebpackPluginV4 = class {
|
|
|
53
61
|
templateHandler,
|
|
54
62
|
jsHandler,
|
|
55
63
|
runtimeLoaderPath,
|
|
64
|
+
runtimeCssImportRewriteLoaderPath,
|
|
56
65
|
cache,
|
|
57
66
|
twPatcher: initialTwPatcher,
|
|
58
67
|
refreshTailwindcssPatcher
|
|
@@ -60,14 +69,18 @@ var UnifiedWebpackPluginV4 = class {
|
|
|
60
69
|
if (disabled) {
|
|
61
70
|
return;
|
|
62
71
|
}
|
|
63
|
-
const
|
|
72
|
+
const isTailwindcssV4 = (_nullishCoalesce(initialTwPatcher.majorVersion, () => ( 0))) >= 4;
|
|
73
|
+
const shouldRewriteCssImports = isTailwindcssV4 && this.options.rewriteCssImports !== false;
|
|
74
|
+
const isMpxApp = _chunkJ25ZFRYMjs.isMpx.call(void 0, this.appType);
|
|
64
75
|
if (shouldRewriteCssImports) {
|
|
65
|
-
|
|
76
|
+
_chunk4KBHUV2Cjs.applyTailwindcssCssImportRewrite.call(void 0, compiler, {
|
|
66
77
|
pkgDir: weappTailwindcssPackageDir,
|
|
67
|
-
enabled: true
|
|
78
|
+
enabled: true,
|
|
79
|
+
appType: this.appType
|
|
68
80
|
});
|
|
81
|
+
_chunkJ25ZFRYMjs.setupMpxTailwindcssRedirect.call(void 0, weappTailwindcssPackageDir, isMpxApp);
|
|
69
82
|
}
|
|
70
|
-
const patchRecorderState =
|
|
83
|
+
const patchRecorderState = _chunk6UW6DOPIjs.setupPatchRecorder.call(void 0, initialTwPatcher, this.options.tailwindcssBasedir, {
|
|
71
84
|
source: "runtime",
|
|
72
85
|
cwd: _nullishCoalesce(this.options.tailwindcssBasedir, () => ( _process2.default.cwd()))
|
|
73
86
|
});
|
|
@@ -78,48 +91,110 @@ var UnifiedWebpackPluginV4 = class {
|
|
|
78
91
|
onPatchCompleted: patchRecorderState.onPatchCompleted
|
|
79
92
|
};
|
|
80
93
|
const refreshRuntimeState = async (force) => {
|
|
81
|
-
await
|
|
94
|
+
await _chunkZTGB2D5Wjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
|
|
82
95
|
};
|
|
83
96
|
async function getClassSetInLoader() {
|
|
84
97
|
await refreshRuntimeState(true);
|
|
85
98
|
await runtimeState.patchPromise;
|
|
86
|
-
await
|
|
99
|
+
await _chunkZTGB2D5Wjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
|
|
87
100
|
}
|
|
88
|
-
|
|
89
|
-
const
|
|
90
|
-
const
|
|
101
|
+
const runtimeClassSetLoader = _nullishCoalesce(runtimeLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-runtime-classset-loader.js")));
|
|
102
|
+
const runtimeCssImportRewriteLoader = shouldRewriteCssImports ? _nullishCoalesce(runtimeCssImportRewriteLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-css-import-rewrite-loader.js"))) : void 0;
|
|
103
|
+
const runtimeClassSetLoaderExists = _fs2.default.existsSync(runtimeClassSetLoader);
|
|
104
|
+
const runtimeCssImportRewriteLoaderExists = runtimeCssImportRewriteLoader ? _fs2.default.existsSync(runtimeCssImportRewriteLoader) : false;
|
|
91
105
|
const runtimeLoaderRewriteOptions = shouldRewriteCssImports ? {
|
|
92
|
-
pkgDir: weappTailwindcssPackageDir
|
|
106
|
+
pkgDir: weappTailwindcssPackageDir,
|
|
107
|
+
appType: this.appType
|
|
93
108
|
} : void 0;
|
|
94
|
-
const
|
|
95
|
-
getClassSet: getClassSetInLoader
|
|
96
|
-
rewriteCssImports: runtimeLoaderRewriteOptions
|
|
109
|
+
const classSetLoaderOptions = {
|
|
110
|
+
getClassSet: getClassSetInLoader
|
|
97
111
|
};
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
112
|
+
const { findRewriteAnchor, findClassSetAnchor } = _chunk4KBHUV2Cjs.createLoaderAnchorFinders.call(void 0, this.appType);
|
|
113
|
+
const cssImportRewriteLoaderOptions = runtimeLoaderRewriteOptions ? {
|
|
114
|
+
rewriteCssImports: runtimeLoaderRewriteOptions
|
|
115
|
+
} : void 0;
|
|
116
|
+
onLoad();
|
|
117
|
+
if (shouldRewriteCssImports && isMpxApp) {
|
|
118
|
+
_chunkJ25ZFRYMjs.ensureMpxTailwindcssAliases.call(void 0, compiler, weappTailwindcssPackageDir);
|
|
119
|
+
}
|
|
120
|
+
if (runtimeCssImportRewriteLoader && shouldRewriteCssImports && cssImportRewriteLoaderOptions && isMpxApp) {
|
|
121
|
+
_chunkJ25ZFRYMjs.injectMpxCssRewritePreRules.call(void 0, compiler, runtimeCssImportRewriteLoader, cssImportRewriteLoaderOptions);
|
|
122
|
+
}
|
|
123
|
+
const createRuntimeClassSetLoaderEntry = () => ({
|
|
124
|
+
loader: runtimeClassSetLoader,
|
|
125
|
+
options: classSetLoaderOptions,
|
|
101
126
|
ident: null,
|
|
102
127
|
type: null
|
|
103
128
|
});
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
129
|
+
const createCssImportRewriteLoaderEntry = () => {
|
|
130
|
+
if (!runtimeCssImportRewriteLoader) {
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
loader: runtimeCssImportRewriteLoader,
|
|
135
|
+
options: cssImportRewriteLoaderOptions,
|
|
136
|
+
ident: null,
|
|
137
|
+
type: null
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
compiler.hooks.compilation.tap(_chunkZTGB2D5Wjs.pluginName, (compilation) => {
|
|
141
|
+
compilation.hooks.normalModuleLoader.tap(_chunkZTGB2D5Wjs.pluginName, (_loaderContext, module) => {
|
|
142
|
+
const hasRuntimeLoader = runtimeClassSetLoaderExists || runtimeCssImportRewriteLoaderExists;
|
|
143
|
+
if (!hasRuntimeLoader) {
|
|
107
144
|
return;
|
|
108
145
|
}
|
|
146
|
+
if (shouldRewriteCssImports && _chunkJ25ZFRYMjs.isMpx.call(void 0, this.appType) && typeof _loaderContext.resolve === "function") {
|
|
147
|
+
_chunkJ25ZFRYMjs.patchMpxLoaderResolve.call(void 0, _loaderContext, weappTailwindcssPackageDir, true);
|
|
148
|
+
}
|
|
109
149
|
const loaderEntries = module.loaders || [];
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
if (
|
|
150
|
+
let rewriteAnchorIdx = findRewriteAnchor(loaderEntries);
|
|
151
|
+
const classSetAnchorIdx = findClassSetAnchor(loaderEntries);
|
|
152
|
+
const isCssModule = _chunk4KBHUV2Cjs.isCssLikeModuleResource.call(void 0, module.resource, this.options.cssMatcher, this.appType);
|
|
153
|
+
if (_process2.default.env.WEAPP_TW_LOADER_DEBUG && isCssModule) {
|
|
154
|
+
debug("loader hook css module: %s loaders=%o anchors=%o", module.resource, loaderEntries.map((x) => x.loader), { rewriteAnchorIdx, classSetAnchorIdx });
|
|
155
|
+
}
|
|
156
|
+
if (_process2.default.env.WEAPP_TW_LOADER_DEBUG && typeof module.resource === "string" && module.resource.includes("app.css")) {
|
|
157
|
+
debug("app.css module loaders=%o anchors=%o", loaderEntries.map((x) => x.loader), { rewriteAnchorIdx, classSetAnchorIdx });
|
|
158
|
+
} else if (_process2.default.env.WEAPP_TW_LOADER_DEBUG && typeof module.resource === "string" && module.resource.endsWith(".css")) {
|
|
159
|
+
debug("css module seen: %s loaders=%o anchors=%o", module.resource, loaderEntries.map((x) => x.loader), { rewriteAnchorIdx, classSetAnchorIdx });
|
|
160
|
+
}
|
|
161
|
+
if (rewriteAnchorIdx === -1 && classSetAnchorIdx === -1 && !isCssModule) {
|
|
117
162
|
return;
|
|
118
163
|
}
|
|
119
|
-
|
|
164
|
+
const anchorlessInsert = (entry, position) => {
|
|
165
|
+
if (position === "after") {
|
|
166
|
+
loaderEntries.push(entry);
|
|
167
|
+
} else {
|
|
168
|
+
loaderEntries.unshift(entry);
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
if (runtimeLoaderRewriteOptions && runtimeCssImportRewriteLoaderExists && cssImportRewriteLoaderOptions && runtimeCssImportRewriteLoader) {
|
|
172
|
+
const existingIndex = loaderEntries.findIndex(
|
|
173
|
+
(entry) => _optionalChain([entry, 'access', _ => _.loader, 'optionalAccess', _2 => _2.includes, 'optionalCall', _3 => _3(runtimeCssImportRewriteLoader)])
|
|
174
|
+
);
|
|
175
|
+
const rewriteEntry = existingIndex !== -1 ? loaderEntries.splice(existingIndex, 1)[0] : createCssImportRewriteLoaderEntry();
|
|
176
|
+
if (rewriteEntry) {
|
|
177
|
+
const anchorIndex = findRewriteAnchor(loaderEntries);
|
|
178
|
+
if (anchorIndex === -1) {
|
|
179
|
+
anchorlessInsert(rewriteEntry, "after");
|
|
180
|
+
} else {
|
|
181
|
+
loaderEntries.splice(anchorIndex + 1, 0, rewriteEntry);
|
|
182
|
+
}
|
|
183
|
+
rewriteAnchorIdx = findRewriteAnchor(loaderEntries);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
if (runtimeClassSetLoaderExists && !_chunk4KBHUV2Cjs.hasLoaderEntry.call(void 0, loaderEntries, runtimeClassSetLoader)) {
|
|
187
|
+
const anchorIndex = findClassSetAnchor(loaderEntries);
|
|
188
|
+
if (anchorIndex === -1) {
|
|
189
|
+
anchorlessInsert(createRuntimeClassSetLoaderEntry(), "before");
|
|
190
|
+
} else {
|
|
191
|
+
const insertIndex = anchorIndex === -1 ? rewriteAnchorIdx : anchorIndex;
|
|
192
|
+
loaderEntries.splice(insertIndex, 0, createRuntimeClassSetLoaderEntry());
|
|
193
|
+
}
|
|
194
|
+
}
|
|
120
195
|
});
|
|
121
196
|
});
|
|
122
|
-
compiler.hooks.emit.tapPromise(
|
|
197
|
+
compiler.hooks.emit.tapPromise(_chunkZTGB2D5Wjs.pluginName, async (compilation) => {
|
|
123
198
|
await runtimeState.patchPromise;
|
|
124
199
|
onStart();
|
|
125
200
|
debug("start");
|
|
@@ -130,17 +205,17 @@ var UnifiedWebpackPluginV4 = class {
|
|
|
130
205
|
}
|
|
131
206
|
const assets = compilation.assets;
|
|
132
207
|
const entries = Object.entries(assets);
|
|
133
|
-
const outputDir = _optionalChain([compiler, 'access',
|
|
208
|
+
const outputDir = _optionalChain([compiler, 'access', _4 => _4.options, 'optionalAccess', _5 => _5.output, 'optionalAccess', _6 => _6.path]) ? _path2.default.resolve(compiler.options.output.path) : _process2.default.cwd();
|
|
134
209
|
const jsAssets = /* @__PURE__ */ new Map();
|
|
135
210
|
for (const [file] of entries) {
|
|
136
211
|
if (this.options.jsMatcher(file) || this.options.wxsMatcher(file)) {
|
|
137
|
-
const absolute =
|
|
212
|
+
const absolute = _chunkJ25ZFRYMjs.toAbsoluteOutputPath.call(void 0, file, outputDir);
|
|
138
213
|
jsAssets.set(absolute, file);
|
|
139
214
|
}
|
|
140
215
|
}
|
|
141
216
|
const moduleGraphOptions = {
|
|
142
217
|
resolve(specifier, importer) {
|
|
143
|
-
return
|
|
218
|
+
return _chunkJ25ZFRYMjs.resolveOutputSpecifier.call(void 0, specifier, importer, outputDir, (candidate) => jsAssets.has(candidate));
|
|
144
219
|
},
|
|
145
220
|
load: (id) => {
|
|
146
221
|
const assetName = jsAssets.get(id);
|
|
@@ -185,7 +260,7 @@ var UnifiedWebpackPluginV4 = class {
|
|
|
185
260
|
const groupedEntries = _chunkUW3WHSZ5js.getGroupedEntries.call(void 0, entries, this.options);
|
|
186
261
|
await refreshRuntimeState(true);
|
|
187
262
|
await runtimeState.patchPromise;
|
|
188
|
-
const runtimeSet = await
|
|
263
|
+
const runtimeSet = await _chunkZTGB2D5Wjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
|
|
189
264
|
debug("get runtimeSet, class count: %d", runtimeSet.size);
|
|
190
265
|
const tasks = [];
|
|
191
266
|
if (Array.isArray(groupedEntries.html)) {
|
|
@@ -222,14 +297,14 @@ var UnifiedWebpackPluginV4 = class {
|
|
|
222
297
|
const jsTaskFactories = [];
|
|
223
298
|
if (Array.isArray(groupedEntries.js)) {
|
|
224
299
|
for (const [file] of groupedEntries.js) {
|
|
225
|
-
const cacheKey =
|
|
300
|
+
const cacheKey = _chunk4KBHUV2Cjs.getCacheKey.call(void 0, file);
|
|
226
301
|
const assetSource = compilation.assets[file];
|
|
227
302
|
if (!assetSource) {
|
|
228
303
|
continue;
|
|
229
304
|
}
|
|
230
305
|
const initialValue = assetSource.source();
|
|
231
306
|
const initialRawSource = typeof initialValue === "string" ? initialValue : initialValue.toString();
|
|
232
|
-
const absoluteFile =
|
|
307
|
+
const absoluteFile = _chunkJ25ZFRYMjs.toAbsoluteOutputPath.call(void 0, file, outputDir);
|
|
233
308
|
jsTaskFactories.push(async () => {
|
|
234
309
|
await _chunkLTJQUORKjs.processCachedTask.call(void 0, {
|
|
235
310
|
cache,
|
|
@@ -243,8 +318,8 @@ var UnifiedWebpackPluginV4 = class {
|
|
|
243
318
|
},
|
|
244
319
|
transform: async () => {
|
|
245
320
|
const currentAsset = compilation.assets[file];
|
|
246
|
-
const currentValue = _optionalChain([currentAsset, 'optionalAccess',
|
|
247
|
-
const currentSource = typeof currentValue === "string" ? currentValue : _nullishCoalesce(_optionalChain([currentValue, 'optionalAccess',
|
|
321
|
+
const currentValue = _optionalChain([currentAsset, 'optionalAccess', _7 => _7.source, 'call', _8 => _8()]);
|
|
322
|
+
const currentSource = typeof currentValue === "string" ? currentValue : _nullishCoalesce(_optionalChain([currentValue, 'optionalAccess', _9 => _9.toString, 'call', _10 => _10()]), () => ( ""));
|
|
248
323
|
const { code, linked } = await jsHandler(currentSource, runtimeSet, {
|
|
249
324
|
filename: absoluteFile,
|
|
250
325
|
moduleGraph: moduleGraphOptions,
|
|
@@ -302,7 +377,7 @@ var UnifiedWebpackPluginV4 = class {
|
|
|
302
377
|
);
|
|
303
378
|
}
|
|
304
379
|
}
|
|
305
|
-
|
|
380
|
+
_chunkJ25ZFRYMjs.pushConcurrentTaskFactories.call(void 0, tasks, jsTaskFactories);
|
|
306
381
|
await Promise.all(tasks);
|
|
307
382
|
debug("end");
|
|
308
383
|
onEnd();
|