weapp-tailwindcss 5.0.0-next.3 → 5.0.0-next.7
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/README.md +4 -5
- package/bin/weapp-tailwindcss.js +1 -21
- package/dist/bundlers/shared/css-cleanup/at-rules.d.ts +2 -0
- package/dist/bundlers/shared/css-cleanup/color-gamut.d.ts +3 -0
- package/dist/bundlers/shared/css-cleanup/root-cleanups.d.ts +4 -0
- package/dist/bundlers/shared/css-cleanup/selectors.d.ts +8 -0
- package/dist/bundlers/shared/css-cleanup.d.ts +1 -2
- package/dist/bundlers/shared/generator-css/config-directive.d.ts +2 -0
- package/dist/bundlers/shared/generator-css/directives.d.ts +11 -0
- package/dist/bundlers/shared/generator-css/legacy-compat.d.ts +7 -0
- package/dist/bundlers/shared/generator-css/legacy-selectors.d.ts +5 -0
- package/dist/bundlers/shared/generator-css/legacy-units.d.ts +1 -0
- package/dist/bundlers/shared/generator-css/markers.d.ts +16 -0
- package/dist/bundlers/shared/generator-css/source-files.d.ts +11 -0
- package/dist/bundlers/shared/generator-css/source-resolver.d.ts +10 -0
- package/dist/bundlers/shared/generator-css.d.ts +12 -22
- package/dist/bundlers/vite/css-finalizer.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/candidates.d.ts +2 -0
- package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +20 -0
- package/dist/bundlers/vite/generate-bundle/css-share-scope.d.ts +3 -0
- package/dist/bundlers/vite/generate-bundle/dirty-state.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/js-entries.d.ts +2 -0
- package/dist/bundlers/vite/generate-bundle/js-handler-options.d.ts +8 -0
- package/dist/bundlers/vite/generate-bundle/js-linking.d.ts +13 -0
- package/dist/bundlers/vite/generate-bundle/metrics.d.ts +17 -0
- package/dist/bundlers/vite/generate-bundle/process-plan.d.ts +9 -0
- package/dist/bundlers/vite/generate-bundle/rollup-assets.d.ts +7 -0
- package/dist/bundlers/vite/generate-bundle/signatures.d.ts +8 -0
- package/dist/bundlers/vite/generate-bundle.d.ts +2 -1
- package/dist/bundlers/vite/index.d.ts +1 -1
- package/dist/bundlers/vite/official-tailwind-plugins.d.ts +5 -0
- package/dist/bundlers/vite/postcss-config.d.ts +6 -0
- package/dist/bundlers/vite/rewrite-css-imports.d.ts +1 -0
- package/dist/bundlers/vite/runtime-class-set.d.ts +22 -0
- package/dist/bundlers/vite/tailwind-basedir.d.ts +1 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +1 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +1 -1
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +0 -1
- package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +1 -1
- package/dist/cache-DPN5yKSX.js +497 -0
- package/dist/cache-nq0_XJoS.mjs +429 -0
- package/dist/cli/context.d.ts +0 -3
- package/dist/cli/helpers.d.ts +1 -2
- package/dist/cli/mount-options.d.ts +2 -0
- package/dist/cli/types.d.ts +0 -2
- package/dist/cli.js +108 -598
- package/dist/cli.mjs +119 -608
- package/dist/constants.d.ts +1 -2
- package/dist/context/tailwindcss.d.ts +1 -1
- package/dist/core.js +13 -20
- package/dist/core.mjs +8 -14
- package/dist/css-macro/postcss.js +1 -1
- package/dist/css-macro/postcss.mjs +1 -1
- package/dist/css-macro.d.ts +1 -0
- package/dist/css-macro.js +2 -2
- package/dist/css-macro.mjs +2 -2
- package/dist/defaults.d.ts +15 -1
- package/dist/defaults.js +33 -14
- package/dist/defaults.mjs +30 -15
- package/dist/generator/index.d.ts +1 -1
- package/dist/generator/options.d.ts +3 -4
- package/dist/{generator-Y-Ikv4Fu.mjs → generator-CzfdCZyd.mjs} +277 -23
- package/dist/{generator-mmhXzZnv.js → generator-TOp4uz7c.js} +281 -27
- package/dist/{generator-css-Bwy_Uz89.mjs → generator-css-B938WI9a.mjs} +694 -506
- package/dist/{generator-css-CRLrHW4F.js → generator-css-Dnpl-IY2.js} +699 -505
- package/dist/generator.js +1 -1
- package/dist/generator.mjs +1 -1
- package/dist/gulp.js +29 -28
- package/dist/gulp.mjs +25 -24
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -6
- package/dist/index.mjs +5 -5
- package/dist/js/index.d.ts +1 -0
- package/dist/js/literal-transform.d.ts +2 -0
- package/dist/logger-BRy6XPQ2.js +1 -0
- package/dist/logger-Bub1jggA.mjs +2 -0
- package/dist/postcss/config-directive.d.ts +1 -0
- package/dist/postcss/context.d.ts +9 -0
- package/dist/postcss/source-files.d.ts +8 -0
- package/dist/postcss/tailwind-version.d.ts +3 -0
- package/dist/postcss-BtAP6sQO.mjs +288 -0
- package/dist/postcss-WsXlC7A-.js +298 -0
- package/dist/postcss.d.ts +2 -2
- package/dist/postcss.js +3 -276
- package/dist/postcss.mjs +1 -269
- package/dist/{recorder-GdTJ3QqX.js → precheck-Dka94ArV.js} +141 -283
- package/dist/{recorder-XdFvVASS.mjs → precheck-DlrmwCc-.mjs} +106 -247
- package/dist/presets.js +6 -4
- package/dist/presets.mjs +4 -2
- package/dist/reset.d.ts +1 -0
- package/dist/{css-imports-BbrbluP9.js → run-tasks-B50A3pxt.js} +6 -55
- package/dist/{css-imports-CSdPq_Sc.mjs → run-tasks-DdNi-hkk.mjs} +5 -42
- package/dist/runtime-patch-pGdCqAEu.mjs +71 -0
- package/dist/runtime-patch-qwuisukL.js +85 -0
- package/dist/tailwindcss/miniprogram.d.ts +5 -1
- package/dist/tailwindcss/patcher-options.d.ts +3 -51
- package/dist/tailwindcss/patcher.d.ts +1 -2
- package/dist/tailwindcss/runtime-patch.d.ts +5 -0
- package/dist/tailwindcss/runtime.d.ts +2 -3
- package/dist/tailwindcss/targets.d.ts +1 -5
- package/dist/tailwindcss/v4/patcher-options.d.ts +1 -23
- package/dist/tailwindcss/v4/patcher.d.ts +2 -1
- package/dist/tailwindcss/v4-engine/types.d.ts +1 -1
- package/dist/tailwindcss/version.d.ts +4 -0
- package/dist/{logger-BoVx1Dbt.mjs → tailwindcss-BIJ185GB.mjs} +25 -434
- package/dist/{logger-BZ45DZJT.js → tailwindcss-T1U5T-iF.js} +30 -468
- package/dist/typedoc.export.d.ts +0 -2
- package/dist/types/index.d.ts +2 -9
- package/dist/types/shared.d.ts +3 -0
- package/dist/types/user-defined-options/general.d.ts +0 -2
- package/dist/types/user-defined-options/important.d.ts +3 -3
- package/dist/uni-app-x/vite.d.ts +1 -1
- package/dist/utils/disabled.d.ts +2 -3
- package/dist/{vite-BDywuCjn.mjs → vite-BXChkciE.mjs} +669 -481
- package/dist/{vite-DgRh_GXn.js → vite-D0CoRblu.js} +707 -519
- package/dist/vite.d.ts +1 -2
- package/dist/vite.js +3 -4
- package/dist/vite.mjs +2 -2
- package/dist/weapp-tw-css-import-rewrite-loader.js +1 -1
- package/dist/{webpack-CiHqVZTg.mjs → webpack-BNdGm9KL.mjs} +224 -38
- package/dist/{webpack-CAJR4hhP.js → webpack-D-sUCY0u.js} +250 -69
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +23 -35
- package/dist/bundlers/shared/generator-candidates.d.ts +0 -5
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-assets.d.ts +0 -14
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-loaders.d.ts +0 -15
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v4.d.ts +0 -9
- package/dist/bundlers/webpack/shared/css-imports.d.ts +0 -6
- package/dist/cli/config.d.ts +0 -5
- package/dist/cli/helpers/patch-cwd.d.ts +0 -1
- package/dist/cli/mount-options/patch-status.d.ts +0 -2
- package/dist/cli/patch-options.d.ts +0 -6
- package/dist/cli/tokens.d.ts +0 -4
- package/dist/cli/workspace/package-dirs.d.ts +0 -3
- package/dist/cli/workspace/patch-package.d.ts +0 -3
- package/dist/cli/workspace/patch-utils.d.ts +0 -3
- package/dist/cli/workspace/types.d.ts +0 -11
- package/dist/cli/workspace/workspace-globs.d.ts +0 -2
- package/dist/cli/workspace/workspace-io.d.ts +0 -1
- package/dist/cli/workspace/workspace-lock.d.ts +0 -1
- package/dist/cli/workspace.d.ts +0 -2
- package/dist/experimental/index.d.ts +0 -2
- package/dist/experimental/oxc/ast-utils.d.ts +0 -30
- package/dist/experimental/oxc/index.d.ts +0 -2
- package/dist/experimental/oxc/module-specifiers.d.ts +0 -2
- package/dist/experimental/shared/cache.d.ts +0 -3
- package/dist/experimental/shared/transform.d.ts +0 -3
- package/dist/experimental/shared.d.ts +0 -8
- package/dist/experimental/swc/ast-utils.d.ts +0 -30
- package/dist/experimental/swc/index.d.ts +0 -2
- package/dist/experimental/swc/module-specifiers.d.ts +0 -2
- package/dist/js/syntax.d.ts +0 -10
- package/dist/loader-anchors-1MumTAtA.mjs +0 -205
- package/dist/loader-anchors-TrFvT6g1.js +0 -273
- package/dist/patcher-options-6gJN2EXy.js +0 -115
- package/dist/patcher-options-DQfR5xxT.mjs +0 -92
- package/dist/tailwindcss/recorder.d.ts +0 -13
- package/dist/tailwindcss/targets/paths.d.ts +0 -13
- package/dist/tailwindcss/targets/record-io.d.ts +0 -5
- package/dist/tailwindcss/targets/recorder.d.ts +0 -3
- package/dist/tailwindcss/targets/types.d.ts +0 -35
- package/dist/types/disabled-options.d.ts +0 -4
- package/dist/webpack4.d.ts +0 -4
- package/dist/webpack4.js +0 -387
- package/dist/webpack4.mjs +0 -379
- package/scripts/postinstall.mjs +0 -59
- /package/dist/{constants-p1dyh1x1.js → constants-BoB_6lFw.js} +0 -0
- /package/dist/{constants-B-_T5UnW.mjs → constants-E_loJC49.mjs} +0 -0
- /package/dist/{utils-7DUGTFED.mjs → utils-BJjKRQgf.mjs} +0 -0
- /package/dist/{utils-DmC9_In3.js → utils-VZvGusYs.js} +0 -0
|
@@ -1,49 +1,214 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-8l464Juk.js");
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const require_generator_css = require("./generator-css-
|
|
7
|
-
const
|
|
8
|
-
|
|
2
|
+
const require_cache = require("./cache-DPN5yKSX.js");
|
|
3
|
+
const require_runtime_patch = require("./runtime-patch-qwuisukL.js");
|
|
4
|
+
const require_precheck = require("./precheck-Dka94ArV.js");
|
|
5
|
+
const require_utils = require("./utils-VZvGusYs.js");
|
|
6
|
+
const require_generator_css = require("./generator-css-Dnpl-IY2.js");
|
|
7
|
+
const require_run_tasks = require("./run-tasks-B50A3pxt.js");
|
|
8
|
+
let node_module = require("node:module");
|
|
9
|
+
node_module = require_chunk.__toESM(node_module);
|
|
9
10
|
let node_path = require("node:path");
|
|
10
11
|
node_path = require_chunk.__toESM(node_path);
|
|
11
12
|
let node_process = require("node:process");
|
|
12
13
|
node_process = require_chunk.__toESM(node_process);
|
|
13
14
|
let node_fs = require("node:fs");
|
|
14
15
|
node_fs = require_chunk.__toESM(node_fs);
|
|
15
|
-
//#region src/
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
//#region src/shared/tailwindcss-css-redirect.ts
|
|
17
|
+
const moduleWithMutableResolve = node_module.default;
|
|
18
|
+
const patched = /* @__PURE__ */ new WeakSet();
|
|
19
|
+
function installTailwindcssCssRedirect(pkgDir) {
|
|
20
|
+
const target = node_path.default.join(pkgDir, "index.css");
|
|
21
|
+
const original = moduleWithMutableResolve._resolveFilename;
|
|
22
|
+
if (patched.has(original)) return;
|
|
23
|
+
const replacements = new Set(["tailwindcss", "tailwindcss$"]);
|
|
24
|
+
const resolveTailwindcssCss = (request, parent, isMain, options) => {
|
|
25
|
+
if (replacements.has(request)) return target;
|
|
26
|
+
if (request.startsWith("tailwindcss/")) return node_path.default.join(pkgDir, request.slice(12));
|
|
27
|
+
return original(request, parent, isMain, options);
|
|
28
|
+
};
|
|
29
|
+
moduleWithMutableResolve._resolveFilename = resolveTailwindcssCss;
|
|
30
|
+
patched.add(moduleWithMutableResolve._resolveFilename);
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/shared/mpx.ts
|
|
34
|
+
const require$1 = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
|
|
35
|
+
const MPX_STYLE_RESOURCE_QUERY_RE$1 = /(?:^|[?&])type=styles(?:&|$)/;
|
|
36
|
+
function isMpxStyleResourceQuery(query) {
|
|
37
|
+
if (typeof query !== "string") return false;
|
|
38
|
+
return MPX_STYLE_RESOURCE_QUERY_RE$1.test(query);
|
|
39
|
+
}
|
|
40
|
+
function isMpx(appType) {
|
|
41
|
+
return appType === "mpx";
|
|
42
|
+
}
|
|
43
|
+
function getTailwindcssCssEntry(pkgDir) {
|
|
44
|
+
return node_path.default.join(pkgDir, "index.css");
|
|
45
|
+
}
|
|
46
|
+
function isMpxWebpackPluginRequest(request) {
|
|
47
|
+
return request === "@mpxjs/webpack-plugin" || Boolean(request?.startsWith("@mpxjs/webpack-plugin/"));
|
|
48
|
+
}
|
|
49
|
+
function addMpxWebpackPluginAlias(alias, pkgDir) {
|
|
50
|
+
if (Array.isArray(alias)) alias.push({
|
|
51
|
+
name: /^@mpxjs\/webpack-plugin\//,
|
|
52
|
+
alias: pkgDir
|
|
53
|
+
});
|
|
54
|
+
else {
|
|
55
|
+
alias["@mpxjs/webpack-plugin"] = pkgDir;
|
|
56
|
+
alias["@mpxjs/webpack-plugin$"] = pkgDir;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function ensureResolveLoaderAlias(compiler, mpxWebpackPluginDir) {
|
|
60
|
+
compiler.options.resolveLoader = compiler.options.resolveLoader || {};
|
|
61
|
+
const alias = compiler.options.resolveLoader.alias ?? {};
|
|
62
|
+
compiler.options.resolveLoader.alias = alias;
|
|
63
|
+
addMpxWebpackPluginAlias(alias, mpxWebpackPluginDir);
|
|
64
|
+
}
|
|
65
|
+
function ensureMpxTailwindcssAliases(compiler, pkgDir) {
|
|
66
|
+
const tailwindcssCssEntry = getTailwindcssCssEntry(pkgDir);
|
|
67
|
+
const mpxWebpackPluginDir = node_path.default.dirname(require$1.resolve("@mpxjs/webpack-plugin/package.json"));
|
|
68
|
+
compiler.options = compiler.options || {};
|
|
69
|
+
compiler.options.resolve = compiler.options.resolve || {};
|
|
70
|
+
ensureResolveLoaderAlias(compiler, mpxWebpackPluginDir);
|
|
71
|
+
const alias = compiler.options.resolve.alias ?? {};
|
|
72
|
+
compiler.options.resolve.alias = alias;
|
|
73
|
+
if (Array.isArray(alias)) alias.push({
|
|
74
|
+
name: /^@mpxjs\/webpack-plugin\//,
|
|
75
|
+
alias: mpxWebpackPluginDir
|
|
76
|
+
}, {
|
|
77
|
+
name: "tailwindcss",
|
|
78
|
+
alias: tailwindcssCssEntry
|
|
79
|
+
}, {
|
|
80
|
+
name: "tailwindcss$",
|
|
81
|
+
alias: tailwindcssCssEntry
|
|
82
|
+
});
|
|
83
|
+
else {
|
|
84
|
+
alias["@mpxjs/webpack-plugin"] = mpxWebpackPluginDir;
|
|
85
|
+
alias["@mpxjs/webpack-plugin$"] = mpxWebpackPluginDir;
|
|
86
|
+
alias.tailwindcss = tailwindcssCssEntry;
|
|
87
|
+
alias.tailwindcss$ = tailwindcssCssEntry;
|
|
88
|
+
}
|
|
89
|
+
return tailwindcssCssEntry;
|
|
90
|
+
}
|
|
91
|
+
function patchMpxLoaderResolve(loaderContext, pkgDir, enabled) {
|
|
92
|
+
if (!enabled || typeof loaderContext.resolve !== "function") return;
|
|
93
|
+
const originalResolve = loaderContext.resolve;
|
|
94
|
+
if (originalResolve.__weappTwPatched) return;
|
|
95
|
+
const tailwindcssCssEntry = getTailwindcssCssEntry(pkgDir);
|
|
96
|
+
const wrappedResolve = function(context, request, callback) {
|
|
97
|
+
if (request === "tailwindcss" || request === "tailwindcss$") return callback(null, tailwindcssCssEntry);
|
|
98
|
+
if (request?.startsWith("tailwindcss/")) return callback(null, node_path.default.join(pkgDir, request.slice(12)));
|
|
99
|
+
if (isMpxWebpackPluginRequest(request)) return originalResolve.call(this, node_process.default.cwd(), request, callback);
|
|
100
|
+
return originalResolve.call(this, context, request, callback);
|
|
101
|
+
};
|
|
102
|
+
wrappedResolve.__weappTwPatched = true;
|
|
103
|
+
loaderContext.resolve = wrappedResolve;
|
|
104
|
+
}
|
|
105
|
+
function setupMpxTailwindcssRedirect(pkgDir, enabled) {
|
|
106
|
+
if (enabled) installTailwindcssCssRedirect(pkgDir);
|
|
107
|
+
}
|
|
108
|
+
const CSS_EXT_RE = /\.css$/i;
|
|
109
|
+
function injectMpxCssRewritePreRules(compiler, loader, loaderOptions) {
|
|
110
|
+
var _compiler$options;
|
|
111
|
+
if (!loader) return;
|
|
112
|
+
const moduleOptions = (_compiler$options = compiler.options).module ?? (_compiler$options.module = { rules: [] });
|
|
113
|
+
moduleOptions.rules = moduleOptions.rules || [];
|
|
114
|
+
const createRule = (match) => ({
|
|
115
|
+
...match,
|
|
116
|
+
enforce: "pre",
|
|
117
|
+
use: [{
|
|
118
|
+
loader,
|
|
119
|
+
options: loaderOptions
|
|
120
|
+
}]
|
|
121
|
+
});
|
|
122
|
+
moduleOptions.rules.unshift(createRule({ resourceQuery: (query) => isMpxStyleResourceQuery(query) }), createRule({
|
|
123
|
+
test: CSS_EXT_RE,
|
|
124
|
+
resourceQuery: (query) => !isMpxStyleResourceQuery(query)
|
|
125
|
+
}));
|
|
126
|
+
}
|
|
127
|
+
//#endregion
|
|
128
|
+
//#region src/bundlers/webpack/BaseUnifiedPlugin/shared.ts
|
|
129
|
+
const MPX_STYLE_RESOURCE_QUERY_RE = /(?:\?|&)type=styles\b/;
|
|
130
|
+
function getCacheKey(filename) {
|
|
131
|
+
return filename;
|
|
132
|
+
}
|
|
133
|
+
function stripResourceQuery(resource) {
|
|
134
|
+
if (typeof resource !== "string") return resource;
|
|
135
|
+
const queryIndex = resource.indexOf("?");
|
|
136
|
+
if (queryIndex !== -1) return resource.slice(0, queryIndex);
|
|
137
|
+
const hashIndex = resource.indexOf("#");
|
|
138
|
+
if (hashIndex !== -1) return resource.slice(0, hashIndex);
|
|
139
|
+
return resource;
|
|
140
|
+
}
|
|
141
|
+
function isCssLikeModuleResource(resource, cssMatcher, appType) {
|
|
142
|
+
if (typeof resource !== "string") return false;
|
|
143
|
+
const normalizedResource = stripResourceQuery(resource);
|
|
144
|
+
if (normalizedResource && cssMatcher(normalizedResource)) return true;
|
|
145
|
+
if (appType === "mpx") return MPX_STYLE_RESOURCE_QUERY_RE.test(resource);
|
|
18
146
|
return false;
|
|
19
147
|
}
|
|
148
|
+
function hasLoaderEntry(entries, target) {
|
|
149
|
+
if (!target) return false;
|
|
150
|
+
return entries.some((entry) => entry.loader?.includes?.(target));
|
|
151
|
+
}
|
|
152
|
+
function toChunkFiles(files) {
|
|
153
|
+
if (!files) return [];
|
|
154
|
+
if (Array.isArray(files)) return files;
|
|
155
|
+
return [...files];
|
|
156
|
+
}
|
|
157
|
+
function createAssetHashByChunkMap(chunks) {
|
|
158
|
+
const partsByFile = /* @__PURE__ */ new Map();
|
|
159
|
+
for (const chunk of chunks) {
|
|
160
|
+
const hash = typeof chunk.hash === "string" ? chunk.hash : void 0;
|
|
161
|
+
if (!hash) continue;
|
|
162
|
+
const chunkId = String(chunk.id ?? chunk.name ?? "");
|
|
163
|
+
for (const file of toChunkFiles(chunk.files)) {
|
|
164
|
+
if (!file) continue;
|
|
165
|
+
let parts = partsByFile.get(file);
|
|
166
|
+
if (!parts) {
|
|
167
|
+
parts = [];
|
|
168
|
+
partsByFile.set(file, parts);
|
|
169
|
+
}
|
|
170
|
+
parts.push(`${chunkId}:${hash}`);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
const hashByFile = /* @__PURE__ */ new Map();
|
|
174
|
+
for (const [file, parts] of partsByFile.entries()) hashByFile.set(file, parts.sort().join("|"));
|
|
175
|
+
return hashByFile;
|
|
176
|
+
}
|
|
177
|
+
function createRuntimeAwareCssHash(assetHash, sourceHash, runtimeSetHash) {
|
|
178
|
+
return `${assetHash ?? sourceHash}:${runtimeSetHash}`;
|
|
179
|
+
}
|
|
180
|
+
function hasWatchChanges(compiler) {
|
|
181
|
+
return (compiler.modifiedFiles?.size ?? 0) > 0 || (compiler.removedFiles?.size ?? 0) > 0;
|
|
182
|
+
}
|
|
183
|
+
//#endregion
|
|
184
|
+
//#region src/bundlers/webpack/BaseUnifiedPlugin/v5-assets.ts
|
|
20
185
|
function setupWebpackV5ProcessAssetsHook(options) {
|
|
21
186
|
const { compiler, options: compilerOptions, appType, runtimeState, getRuntimeRefreshRequirement, refreshRuntimeMetadata, consumeRuntimeRefreshRequirement, debug } = options;
|
|
22
187
|
const { Compilation, sources } = compiler.webpack;
|
|
23
188
|
const { ConcatSource } = sources;
|
|
24
189
|
const cssHandlerOptionsCache = /* @__PURE__ */ new Map();
|
|
25
190
|
const cssUserHandlerOptionsCache = /* @__PURE__ */ new Map();
|
|
26
|
-
compiler.hooks.compilation.tap(
|
|
191
|
+
compiler.hooks.compilation.tap(require_precheck.pluginName, (compilation) => {
|
|
27
192
|
compilation.hooks.processAssets.tapPromise({
|
|
28
|
-
name:
|
|
193
|
+
name: require_precheck.pluginName,
|
|
29
194
|
stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
|
|
30
195
|
}, async (assets) => {
|
|
31
196
|
compilerOptions.onStart();
|
|
32
197
|
debug("start");
|
|
33
|
-
await runtimeState.
|
|
198
|
+
await runtimeState.readyPromise;
|
|
34
199
|
for (const chunk of compilation.chunks) if (chunk.id && chunk.hash) compilerOptions.cache.calcHashValueChanged(chunk.id, chunk.hash);
|
|
35
|
-
const assetHashByChunk =
|
|
200
|
+
const assetHashByChunk = createAssetHashByChunkMap(compilation.chunks);
|
|
36
201
|
const entries = Object.entries(assets);
|
|
37
202
|
const compilerOutputPath = compilation.compiler?.outputPath ?? compiler.outputPath;
|
|
38
203
|
const outputDir = compilerOutputPath ? node_path.default.resolve(compilerOutputPath) : compilation.outputOptions?.path ?? node_process.default.cwd();
|
|
39
204
|
const jsAssets = /* @__PURE__ */ new Map();
|
|
40
205
|
for (const [file] of entries) if (compilerOptions.jsMatcher(file) || compilerOptions.wxsMatcher(file)) {
|
|
41
|
-
const absolute =
|
|
206
|
+
const absolute = require_run_tasks.toAbsoluteOutputPath(file, outputDir);
|
|
42
207
|
jsAssets.set(absolute, file);
|
|
43
208
|
}
|
|
44
209
|
const moduleGraphOptions = {
|
|
45
210
|
resolve(specifier, importer) {
|
|
46
|
-
return
|
|
211
|
+
return require_run_tasks.resolveOutputSpecifier(specifier, importer, outputDir, (candidate) => jsAssets.has(candidate));
|
|
47
212
|
},
|
|
48
213
|
load: (id) => {
|
|
49
214
|
const assetName = jsAssets.get(id);
|
|
@@ -99,10 +264,9 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
99
264
|
cssUserHandlerOptionsCache.set(cacheKey, created);
|
|
100
265
|
return created;
|
|
101
266
|
};
|
|
102
|
-
const staleClassNameFallback = resolveWebpackStaleClassNameFallback(compilerOptions.staleClassNameFallback, compiler);
|
|
103
267
|
const forceRuntimeRefresh = getRuntimeRefreshRequirement();
|
|
104
268
|
debug("processAssets ensure runtime set forceRefresh=%s major=%s", forceRuntimeRefresh, runtimeState.twPatcher.majorVersion ?? "unknown");
|
|
105
|
-
const runtimeSet = await
|
|
269
|
+
const runtimeSet = await require_precheck.ensureRuntimeClassSet(runtimeState, {
|
|
106
270
|
forceRefresh: forceRuntimeRefresh,
|
|
107
271
|
forceCollect: true,
|
|
108
272
|
clearCache: forceRuntimeRefresh,
|
|
@@ -110,6 +274,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
110
274
|
});
|
|
111
275
|
await refreshRuntimeMetadata(forceRuntimeRefresh);
|
|
112
276
|
consumeRuntimeRefreshRequirement();
|
|
277
|
+
const runtimeSetHash = compilerOptions.cache.computeHash([require_cache.getRuntimeClassSetSignature(runtimeState.twPatcher), [...runtimeSet].sort().join("\n")].join("\n\n"));
|
|
113
278
|
const defaultTemplateHandlerOptions = { runtimeSet };
|
|
114
279
|
debug("get runtimeSet, class count: %d", runtimeSet.size);
|
|
115
280
|
const tasks = [];
|
|
@@ -141,10 +306,10 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
141
306
|
}
|
|
142
307
|
const jsTaskFactories = [];
|
|
143
308
|
if (Array.isArray(groupedEntries.js)) for (const [file] of groupedEntries.js) {
|
|
144
|
-
const cacheKey =
|
|
309
|
+
const cacheKey = getCacheKey(file);
|
|
145
310
|
const asset = compilation.getAsset(file);
|
|
146
311
|
if (!asset) continue;
|
|
147
|
-
const absoluteFile =
|
|
312
|
+
const absoluteFile = require_run_tasks.toAbsoluteOutputPath(file, outputDir);
|
|
148
313
|
const initialSource = asset.source.source();
|
|
149
314
|
const initialRawSource = typeof initialSource === "string" ? initialSource : initialSource.toString();
|
|
150
315
|
const chunkHash = assetHashByChunk.get(file);
|
|
@@ -165,13 +330,12 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
165
330
|
const currentSourceValue = compilation.getAsset(file)?.source.source();
|
|
166
331
|
const currentSource = typeof currentSourceValue === "string" ? currentSourceValue : currentSourceValue?.toString() ?? "";
|
|
167
332
|
const handlerOptions = {
|
|
168
|
-
staleClassNameFallback,
|
|
169
333
|
tailwindcssMajorVersion: runtimeState.twPatcher.majorVersion,
|
|
170
334
|
filename: absoluteFile,
|
|
171
335
|
moduleGraph: moduleGraphOptions,
|
|
172
336
|
babelParserOptions: { sourceFilename: absoluteFile }
|
|
173
337
|
};
|
|
174
|
-
if (
|
|
338
|
+
if (require_precheck.shouldSkipJsTransform(currentSource, handlerOptions)) return { result: new ConcatSource(currentSource) };
|
|
175
339
|
const { code, linked } = await compilerOptions.jsHandler(currentSource, runtimeSet, handlerOptions);
|
|
176
340
|
const source = new ConcatSource(code);
|
|
177
341
|
compilerOptions.onUpdate(file, currentSource, code);
|
|
@@ -186,13 +350,13 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
186
350
|
const [file, originalSource] = element;
|
|
187
351
|
const rawSource = originalSource.source().toString();
|
|
188
352
|
const cacheKey = file;
|
|
189
|
-
const
|
|
353
|
+
const runtimeAwareHash = createRuntimeAwareCssHash(assetHashByChunk.get(file), compilerOptions.cache.computeHash(rawSource), runtimeSetHash);
|
|
190
354
|
tasks.push(require_generator_css.processCachedTask({
|
|
191
355
|
cache: compilerOptions.cache,
|
|
192
356
|
cacheKey,
|
|
193
357
|
hashKey: `${file}:asset`,
|
|
194
358
|
rawSource,
|
|
195
|
-
hash:
|
|
359
|
+
hash: runtimeAwareHash,
|
|
196
360
|
applyResult(source) {
|
|
197
361
|
compilation.updateAsset(file, source);
|
|
198
362
|
},
|
|
@@ -200,7 +364,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
200
364
|
debug("css cache hit: %s", file);
|
|
201
365
|
},
|
|
202
366
|
transform: async () => {
|
|
203
|
-
await runtimeState.
|
|
367
|
+
await runtimeState.readyPromise;
|
|
204
368
|
const cssHandlerOptions = getCssHandlerOptions(file);
|
|
205
369
|
const generated = await require_generator_css.generateCssByGenerator({
|
|
206
370
|
opts: compilerOptions,
|
|
@@ -222,7 +386,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
222
386
|
}
|
|
223
387
|
}));
|
|
224
388
|
}
|
|
225
|
-
|
|
389
|
+
require_run_tasks.pushConcurrentTaskFactories(tasks, jsTaskFactories);
|
|
226
390
|
await Promise.all(tasks);
|
|
227
391
|
debug("end");
|
|
228
392
|
compilerOptions.onEnd();
|
|
@@ -230,13 +394,41 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
230
394
|
});
|
|
231
395
|
}
|
|
232
396
|
//#endregion
|
|
397
|
+
//#region src/bundlers/webpack/shared/loader-anchors.ts
|
|
398
|
+
const MPX_STRIP_CONDITIONAL_LOADER = "@mpxjs/webpack-plugin/lib/style-compiler/strip-conditional-loader";
|
|
399
|
+
const MPX_STYLE_COMPILER_LOADER = "@mpxjs/webpack-plugin/lib/style-compiler/index";
|
|
400
|
+
const MPX_REWRITE_PRECEDENCE_LOADERS = [MPX_STYLE_COMPILER_LOADER, MPX_STRIP_CONDITIONAL_LOADER];
|
|
401
|
+
function createFinder(targets) {
|
|
402
|
+
return (entries) => entries.findIndex((entry) => targets.some((target) => entry?.loader?.includes?.(target)));
|
|
403
|
+
}
|
|
404
|
+
function createPrioritizedFinder(targets) {
|
|
405
|
+
return (entries) => {
|
|
406
|
+
for (const target of targets) {
|
|
407
|
+
const idx = entries.findIndex((entry) => entry?.loader?.includes?.(target));
|
|
408
|
+
if (idx !== -1) return idx;
|
|
409
|
+
}
|
|
410
|
+
return -1;
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
function createLoaderAnchorFinders(appType) {
|
|
414
|
+
if (isMpx(appType)) return {
|
|
415
|
+
findRewriteAnchor: createPrioritizedFinder(MPX_REWRITE_PRECEDENCE_LOADERS),
|
|
416
|
+
findClassSetAnchor: createFinder([MPX_STYLE_COMPILER_LOADER])
|
|
417
|
+
};
|
|
418
|
+
const fallbackFinder = createFinder(["postcss-loader"]);
|
|
419
|
+
return {
|
|
420
|
+
findRewriteAnchor: fallbackFinder,
|
|
421
|
+
findClassSetAnchor: fallbackFinder
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
//#endregion
|
|
233
425
|
//#region src/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.ts
|
|
234
426
|
function setupWebpackV5Loaders(options) {
|
|
235
|
-
const { compiler, options: compilerOptions, appType, weappTailwindcssPackageDir, shouldRewriteCssImports, runtimeLoaderPath,
|
|
236
|
-
const isMpxApp =
|
|
237
|
-
if (shouldRewriteCssImports && isMpxApp)
|
|
427
|
+
const { compiler, options: compilerOptions, appType, weappTailwindcssPackageDir, shouldRewriteCssImports, runtimeLoaderPath, getClassSetInLoader, getRuntimeWatchDependencies, debug } = options;
|
|
428
|
+
const isMpxApp = isMpx(appType);
|
|
429
|
+
if (shouldRewriteCssImports && isMpxApp) ensureMpxTailwindcssAliases(compiler, weappTailwindcssPackageDir);
|
|
238
430
|
const runtimeClassSetLoader = runtimeLoaderPath ?? node_path.default.resolve(__dirname, "./weapp-tw-runtime-classset-loader.js");
|
|
239
|
-
const runtimeCssImportRewriteLoader = shouldRewriteCssImports ?
|
|
431
|
+
const runtimeCssImportRewriteLoader = shouldRewriteCssImports ? node_path.default.resolve(__dirname, "./weapp-tw-css-import-rewrite-loader.js") : void 0;
|
|
240
432
|
const runtimeClassSetLoaderExists = node_fs.default.existsSync(runtimeClassSetLoader);
|
|
241
433
|
const runtimeCssImportRewriteLoaderExists = runtimeCssImportRewriteLoader ? node_fs.default.existsSync(runtimeCssImportRewriteLoader) : false;
|
|
242
434
|
const runtimeLoaderRewriteOptions = shouldRewriteCssImports ? {
|
|
@@ -247,9 +439,9 @@ function setupWebpackV5Loaders(options) {
|
|
|
247
439
|
getClassSet: getClassSetInLoader,
|
|
248
440
|
getWatchDependencies: getRuntimeWatchDependencies
|
|
249
441
|
};
|
|
250
|
-
const { findRewriteAnchor, findClassSetAnchor } =
|
|
251
|
-
const cssImportRewriteLoaderOptions = runtimeLoaderRewriteOptions ? {
|
|
252
|
-
if (runtimeCssImportRewriteLoader && shouldRewriteCssImports && cssImportRewriteLoaderOptions && isMpxApp)
|
|
442
|
+
const { findRewriteAnchor, findClassSetAnchor } = createLoaderAnchorFinders(appType);
|
|
443
|
+
const cssImportRewriteLoaderOptions = runtimeLoaderRewriteOptions ? { tailwindcssImportRewrite: runtimeLoaderRewriteOptions } : void 0;
|
|
444
|
+
if (runtimeCssImportRewriteLoader && shouldRewriteCssImports && cssImportRewriteLoaderOptions && isMpxApp) injectMpxCssRewritePreRules(compiler, runtimeCssImportRewriteLoader, cssImportRewriteLoaderOptions);
|
|
253
445
|
const createRuntimeClassSetLoaderEntry = () => ({
|
|
254
446
|
loader: runtimeClassSetLoader,
|
|
255
447
|
options: classSetLoaderOptions,
|
|
@@ -266,14 +458,14 @@ function setupWebpackV5Loaders(options) {
|
|
|
266
458
|
};
|
|
267
459
|
};
|
|
268
460
|
const { NormalModule } = compiler.webpack;
|
|
269
|
-
compiler.hooks.compilation.tap(
|
|
270
|
-
NormalModule.getCompilationHooks(compilation).loader.tap(
|
|
461
|
+
compiler.hooks.compilation.tap(require_precheck.pluginName, (compilation) => {
|
|
462
|
+
NormalModule.getCompilationHooks(compilation).loader.tap(require_precheck.pluginName, (_loaderContext, module) => {
|
|
271
463
|
if (!(runtimeClassSetLoaderExists || runtimeCssImportRewriteLoaderExists)) return;
|
|
272
|
-
|
|
464
|
+
patchMpxLoaderResolve(_loaderContext, weappTailwindcssPackageDir, shouldRewriteCssImports && isMpxApp);
|
|
273
465
|
const loaderEntries = module.loaders || [];
|
|
274
466
|
let rewriteAnchorIdx = findRewriteAnchor(loaderEntries);
|
|
275
467
|
const classSetAnchorIdx = findClassSetAnchor(loaderEntries);
|
|
276
|
-
const isCssModule =
|
|
468
|
+
const isCssModule = isCssLikeModuleResource(module.resource, compilerOptions.cssMatcher, appType);
|
|
277
469
|
if (node_process.default.env.WEAPP_TW_LOADER_DEBUG && isCssModule) debug("loader hook css module: %s loaders=%o anchors=%o", module.resource, loaderEntries.map((x) => x.loader), {
|
|
278
470
|
rewriteAnchorIdx,
|
|
279
471
|
classSetAnchorIdx
|
|
@@ -301,7 +493,7 @@ function setupWebpackV5Loaders(options) {
|
|
|
301
493
|
rewriteAnchorIdx = findRewriteAnchor(loaderEntries);
|
|
302
494
|
}
|
|
303
495
|
}
|
|
304
|
-
if (runtimeClassSetLoaderExists && !
|
|
496
|
+
if (runtimeClassSetLoaderExists && !hasLoaderEntry(loaderEntries, runtimeClassSetLoader)) {
|
|
305
497
|
const classSetLoaderEntry = createRuntimeClassSetLoaderEntry();
|
|
306
498
|
const anchorIndex = findClassSetAnchor(loaderEntries);
|
|
307
499
|
if (anchorIndex === -1) anchorlessInsert(classSetLoaderEntry, "before");
|
|
@@ -315,8 +507,8 @@ function setupWebpackV5Loaders(options) {
|
|
|
315
507
|
}
|
|
316
508
|
//#endregion
|
|
317
509
|
//#region src/bundlers/webpack/BaseUnifiedPlugin/v5.ts
|
|
318
|
-
const debug =
|
|
319
|
-
const weappTailwindcssPackageDir =
|
|
510
|
+
const debug = require_runtime_patch.createDebug();
|
|
511
|
+
const weappTailwindcssPackageDir = require_run_tasks.resolvePackageDir("weapp-tailwindcss");
|
|
320
512
|
/**
|
|
321
513
|
* @name UnifiedWebpackPluginV5
|
|
322
514
|
* @description webpack5 核心转义插件
|
|
@@ -324,33 +516,23 @@ const weappTailwindcssPackageDir = require_css_imports.resolvePackageDir("weapp-
|
|
|
324
516
|
*/
|
|
325
517
|
var UnifiedWebpackPluginV5 = class {
|
|
326
518
|
constructor(options = {}) {
|
|
327
|
-
this
|
|
519
|
+
require_precheck._defineProperty(this, "options", void 0);
|
|
520
|
+
require_precheck._defineProperty(this, "appType", void 0);
|
|
521
|
+
this.options = require_precheck.getCompilerContext(options);
|
|
328
522
|
this.appType = this.options.appType;
|
|
329
523
|
}
|
|
330
524
|
apply(compiler) {
|
|
331
525
|
compiler.options = compiler.options || {};
|
|
332
|
-
const { disabled, onLoad, runtimeLoaderPath,
|
|
333
|
-
const disabledOptions =
|
|
334
|
-
const shouldRewriteCssImports = (initialTwPatcher.majorVersion ?? 0) >= 4
|
|
335
|
-
const isMpxApp =
|
|
336
|
-
if (shouldRewriteCssImports)
|
|
337
|
-
require_loader_anchors.applyTailwindcssCssImportRewrite(compiler, {
|
|
338
|
-
pkgDir: weappTailwindcssPackageDir,
|
|
339
|
-
enabled: true,
|
|
340
|
-
appType: this.appType
|
|
341
|
-
});
|
|
342
|
-
require_loader_anchors.setupMpxTailwindcssRedirect(weappTailwindcssPackageDir, isMpxApp);
|
|
343
|
-
}
|
|
526
|
+
const { disabled, onLoad, runtimeLoaderPath, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = this.options;
|
|
527
|
+
const disabledOptions = require_run_tasks.resolvePluginDisabledState(disabled);
|
|
528
|
+
const shouldRewriteCssImports = (initialTwPatcher.majorVersion ?? 0) >= 4;
|
|
529
|
+
const isMpxApp = isMpx(this.appType);
|
|
530
|
+
if (shouldRewriteCssImports) setupMpxTailwindcssRedirect(weappTailwindcssPackageDir, isMpxApp);
|
|
344
531
|
if (disabledOptions.plugin) return;
|
|
345
|
-
const patchRecorderState = require_recorder.setupPatchRecorder(initialTwPatcher, this.options.tailwindcssBasedir, {
|
|
346
|
-
source: "runtime",
|
|
347
|
-
cwd: this.options.tailwindcssBasedir ?? node_process.default.cwd()
|
|
348
|
-
});
|
|
349
532
|
const runtimeState = {
|
|
350
533
|
twPatcher: initialTwPatcher,
|
|
351
|
-
|
|
352
|
-
refreshTailwindcssPatcher
|
|
353
|
-
onPatchCompleted: patchRecorderState.onPatchCompleted
|
|
534
|
+
readyPromise: require_precheck.createTailwindRuntimeReadyPromise(initialTwPatcher),
|
|
535
|
+
refreshTailwindcssPatcher
|
|
354
536
|
};
|
|
355
537
|
let runtimeSetPrepared = false;
|
|
356
538
|
let runtimeSetSignature;
|
|
@@ -361,7 +543,7 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
361
543
|
const updateRuntimeWatchDependencies = async () => {
|
|
362
544
|
runtimeWatchDependencyFiles.clear();
|
|
363
545
|
runtimeWatchDependencyContexts.clear();
|
|
364
|
-
const tailwindOptions =
|
|
546
|
+
const tailwindOptions = require_cache.resolveTailwindcssOptions(runtimeState.twPatcher.options);
|
|
365
547
|
if (tailwindOptions?.config) runtimeWatchDependencyFiles.add(tailwindOptions.config);
|
|
366
548
|
for (const entry of tailwindOptions?.v4?.cssEntries ?? []) runtimeWatchDependencyFiles.add(entry);
|
|
367
549
|
for (const source of tailwindOptions?.v4?.sources ?? []) if (source?.base) runtimeWatchDependencyContexts.add(source.base);
|
|
@@ -380,26 +562,26 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
380
562
|
runtimeMetadataPrepared = true;
|
|
381
563
|
};
|
|
382
564
|
const syncRuntimeRefreshRequirement = () => {
|
|
383
|
-
runtimeRefreshRequiredForCompilation = runtimeRefreshRequiredForCompilation ||
|
|
565
|
+
runtimeRefreshRequiredForCompilation = runtimeRefreshRequiredForCompilation || hasWatchChanges(compiler);
|
|
384
566
|
};
|
|
385
567
|
const resetRuntimePreparation = () => {
|
|
386
568
|
runtimeSetPrepared = false;
|
|
387
569
|
runtimeMetadataPrepared = false;
|
|
388
570
|
syncRuntimeRefreshRequirement();
|
|
389
571
|
};
|
|
390
|
-
compiler.hooks.invalid?.tap?.(
|
|
572
|
+
compiler.hooks.invalid?.tap?.(require_precheck.pluginName, () => {
|
|
391
573
|
runtimeRefreshRequiredForCompilation = true;
|
|
392
574
|
});
|
|
393
|
-
compiler.hooks.watchRun?.tap?.(
|
|
394
|
-
if (compiler.hooks.thisCompilation?.tap) compiler.hooks.thisCompilation.tap(
|
|
395
|
-
else if (compiler.hooks.compilation?.tap) compiler.hooks.compilation.tap(
|
|
575
|
+
compiler.hooks.watchRun?.tap?.(require_precheck.pluginName, syncRuntimeRefreshRequirement);
|
|
576
|
+
if (compiler.hooks.thisCompilation?.tap) compiler.hooks.thisCompilation.tap(require_precheck.pluginName, resetRuntimePreparation);
|
|
577
|
+
else if (compiler.hooks.compilation?.tap) compiler.hooks.compilation.tap(require_precheck.pluginName, resetRuntimePreparation);
|
|
396
578
|
async function getClassSetInLoader() {
|
|
397
579
|
if (runtimeSetPrepared) return;
|
|
398
|
-
const signature =
|
|
580
|
+
const signature = require_cache.getRuntimeClassSetSignature(runtimeState.twPatcher);
|
|
399
581
|
const forceRefresh = runtimeRefreshRequiredForCompilation || signature !== runtimeSetSignature;
|
|
400
582
|
debug("runtime loader ensure class set forceRefresh=%s watchDirty=%s signatureChanged=%s", forceRefresh, runtimeRefreshRequiredForCompilation, signature !== runtimeSetSignature);
|
|
401
583
|
runtimeSetPrepared = true;
|
|
402
|
-
await
|
|
584
|
+
await require_precheck.ensureRuntimeClassSet(runtimeState, {
|
|
403
585
|
forceRefresh,
|
|
404
586
|
forceCollect: true,
|
|
405
587
|
clearCache: forceRefresh,
|
|
@@ -417,7 +599,6 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
417
599
|
weappTailwindcssPackageDir,
|
|
418
600
|
shouldRewriteCssImports,
|
|
419
601
|
runtimeLoaderPath,
|
|
420
|
-
runtimeCssImportRewriteLoaderPath,
|
|
421
602
|
getClassSetInLoader,
|
|
422
603
|
getRuntimeWatchDependencies() {
|
|
423
604
|
return {
|
package/dist/webpack.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_webpack = require("./webpack-
|
|
2
|
+
const require_webpack = require("./webpack-D-sUCY0u.js");
|
|
3
3
|
exports.UnifiedWebpackPluginV5 = require_webpack.UnifiedWebpackPluginV5;
|
|
4
4
|
exports.WeappTailwindcss = require_webpack.UnifiedWebpackPluginV5;
|
|
5
5
|
exports.weappTailwindcss = require_webpack.UnifiedWebpackPluginV5;
|
package/dist/webpack.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as weappTailwindcssPackageDir, t as UnifiedWebpackPluginV5 } from "./webpack-
|
|
1
|
+
import { n as weappTailwindcssPackageDir, t as UnifiedWebpackPluginV5 } from "./webpack-BNdGm9KL.mjs";
|
|
2
2
|
export { UnifiedWebpackPluginV5, UnifiedWebpackPluginV5 as WeappTailwindcss, UnifiedWebpackPluginV5 as weappTailwindcss, weappTailwindcssPackageDir };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weapp-tailwindcss",
|
|
3
|
-
"version": "5.0.0-next.
|
|
3
|
+
"version": "5.0.0-next.7",
|
|
4
4
|
"description": "把 tailwindcss 原子化样式思想,带给小程序开发者们! bring tailwindcss to miniprogram developers!",
|
|
5
5
|
"author": "ice breaker <1324318532@qq.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -61,11 +61,6 @@
|
|
|
61
61
|
"import": "./dist/webpack.mjs",
|
|
62
62
|
"require": "./dist/webpack.js"
|
|
63
63
|
},
|
|
64
|
-
"./webpack4": {
|
|
65
|
-
"types": "./dist/webpack4.d.ts",
|
|
66
|
-
"import": "./dist/webpack4.mjs",
|
|
67
|
-
"require": "./dist/webpack4.js"
|
|
68
|
-
},
|
|
69
64
|
"./core": {
|
|
70
65
|
"types": "./dist/core.d.ts",
|
|
71
66
|
"import": "./dist/core.mjs",
|
|
@@ -150,7 +145,6 @@
|
|
|
150
145
|
}
|
|
151
146
|
},
|
|
152
147
|
"bin": {
|
|
153
|
-
"weapp-tailwindcss-webpack-plugin": "bin/weapp-tailwindcss.js",
|
|
154
148
|
"weapp-tailwindcss": "bin/weapp-tailwindcss.js",
|
|
155
149
|
"weapp-tw": "bin/weapp-tailwindcss.js"
|
|
156
150
|
},
|
|
@@ -161,7 +155,6 @@
|
|
|
161
155
|
"generator-placeholder.css",
|
|
162
156
|
"index.css",
|
|
163
157
|
"preflight.css",
|
|
164
|
-
"scripts/postinstall.mjs",
|
|
165
158
|
"theme.css",
|
|
166
159
|
"uni-app-x.css",
|
|
167
160
|
"utilities.css",
|
|
@@ -179,12 +172,10 @@
|
|
|
179
172
|
"@babel/parser": "~7.29.3",
|
|
180
173
|
"@babel/traverse": "~7.29.0",
|
|
181
174
|
"@babel/types": "~7.29.0",
|
|
182
|
-
"@tailwindcss-mangle/config": "^7.0.1",
|
|
183
175
|
"@vue/compiler-dom": "^3.5.34",
|
|
184
176
|
"@vue/compiler-sfc": "^3.5.34",
|
|
185
177
|
"@weapp-core/escape": "~7.0.0",
|
|
186
178
|
"@weapp-core/regex": "~1.0.1",
|
|
187
|
-
"cac": "6.7.14",
|
|
188
179
|
"comment-json": "^4.6.2",
|
|
189
180
|
"debug": "~4.4.3",
|
|
190
181
|
"fast-glob": "^3.3.3",
|
|
@@ -194,43 +185,40 @@
|
|
|
194
185
|
"lru-cache": "10.4.3",
|
|
195
186
|
"magic-string": "0.30.21",
|
|
196
187
|
"postcss-load-config": "^6.0.1",
|
|
197
|
-
"semver": "~7.
|
|
198
|
-
"tailwindcss-patch": "9.2
|
|
199
|
-
"
|
|
200
|
-
"
|
|
188
|
+
"semver": "~7.8.0",
|
|
189
|
+
"tailwindcss-patch": "9.3.2",
|
|
190
|
+
"yaml": "^2.9.0",
|
|
191
|
+
"@weapp-tailwindcss/postcss": "2.2.1-next.0",
|
|
201
192
|
"@weapp-tailwindcss/logger": "1.1.0",
|
|
202
|
-
"@weapp-tailwindcss/
|
|
203
|
-
"@weapp-tailwindcss/
|
|
204
|
-
"tailwindcss-config": "1.1.6-next.0"
|
|
205
|
-
"@weapp-tailwindcss/shared": "1.1.3"
|
|
193
|
+
"@weapp-tailwindcss/reset": "0.1.1-next.0",
|
|
194
|
+
"@weapp-tailwindcss/shared": "1.1.3",
|
|
195
|
+
"tailwindcss-config": "1.1.6-next.0"
|
|
206
196
|
},
|
|
207
197
|
"scripts": {
|
|
208
198
|
"dev": "tsdown --watch --sourcemap",
|
|
209
|
-
"build": "tsdown && pnpm run build:types &&
|
|
210
|
-
"build:types": "tsc -p tsconfig.build.json --declaration --emitDeclarationOnly --declarationDir dist --noEmit false &&
|
|
199
|
+
"build": "tsdown && pnpm run build:types && pnpm --filter @weapp-tailwindcss/scripts ensure-escape-dts",
|
|
200
|
+
"build:types": "tsc -p tsconfig.build.json --declaration --emitDeclarationOnly --declarationDir dist --noEmit false && pnpm --filter @weapp-tailwindcss/scripts build:types",
|
|
211
201
|
"build:tsc": "cross-env NODE_ENV=development tsc --build tsconfig.json",
|
|
212
202
|
"build:cli": "cd plugins/cli && pnpm run build",
|
|
213
|
-
"build:css": "
|
|
214
|
-
"build:weapp-theme": "
|
|
215
|
-
"test": "
|
|
203
|
+
"build:css": "pnpm --filter @weapp-tailwindcss/scripts build:css",
|
|
204
|
+
"build:weapp-theme": "pnpm --filter @weapp-tailwindcss/scripts build:weapp-theme",
|
|
205
|
+
"test": "vitest run",
|
|
216
206
|
"test:dev": "vitest",
|
|
217
207
|
"test:ui": "vitest --ui",
|
|
218
208
|
"bench": "vitest bench --config ./vitest.config.ts",
|
|
219
|
-
"bench:vite-perf": "
|
|
220
|
-
"bench:vite-perf:summary": "
|
|
221
|
-
"bench:js-handlers": "
|
|
222
|
-
"bench:js-diff": "
|
|
209
|
+
"bench:vite-perf": "pnpm --filter @weapp-tailwindcss/scripts bench:vite-perf",
|
|
210
|
+
"bench:vite-perf:summary": "pnpm --filter @weapp-tailwindcss/scripts bench:vite-perf:summary",
|
|
211
|
+
"bench:js-handlers": "pnpm --filter @weapp-tailwindcss/scripts bench:js-handlers",
|
|
212
|
+
"bench:js-diff": "pnpm --filter @weapp-tailwindcss/scripts bench:js-diff",
|
|
223
213
|
"tsd": "tsd",
|
|
224
|
-
"clean": "
|
|
225
|
-
"get-decl": "
|
|
214
|
+
"clean": "pnpm --filter @weapp-tailwindcss/scripts clean:core",
|
|
215
|
+
"get-decl": "pnpm --filter @weapp-tailwindcss/scripts get-decl",
|
|
226
216
|
"ls:pack": "npm pack --dry-run",
|
|
227
|
-
"
|
|
228
|
-
"
|
|
229
|
-
"release": "tsx scripts/release.ts",
|
|
217
|
+
"colors": "pnpm --filter @weapp-tailwindcss/scripts colors",
|
|
218
|
+
"release": "pnpm --filter @weapp-tailwindcss/scripts release",
|
|
230
219
|
"lint": "eslint .",
|
|
231
220
|
"lint:fix": "eslint ./src --fix",
|
|
232
|
-
"
|
|
233
|
-
"
|
|
234
|
-
"test:watch-hmr": "node --import tsx scripts/watch-hmr-regression/index.ts"
|
|
221
|
+
"bench:vite-dev-hmr": "pnpm --filter @weapp-tailwindcss/scripts bench:vite-dev-hmr",
|
|
222
|
+
"test:watch-hmr": "pnpm --filter @weapp-tailwindcss/scripts test:watch-hmr"
|
|
235
223
|
}
|
|
236
224
|
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Compiler } from 'webpack4';
|
|
2
|
-
import type { AppType, InternalUserDefinedOptions } from '../../../types';
|
|
3
|
-
interface SetupWebpackV4EmitHookOptions {
|
|
4
|
-
compiler: Compiler;
|
|
5
|
-
options: InternalUserDefinedOptions;
|
|
6
|
-
appType?: AppType;
|
|
7
|
-
runtimeState: {
|
|
8
|
-
twPatcher: InternalUserDefinedOptions['twPatcher'];
|
|
9
|
-
patchPromise: Promise<void>;
|
|
10
|
-
};
|
|
11
|
-
debug: (format: string, ...args: unknown[]) => void;
|
|
12
|
-
}
|
|
13
|
-
export declare function setupWebpackV4EmitHook(options: SetupWebpackV4EmitHookOptions): void;
|
|
14
|
-
export {};
|