weapp-tailwindcss 5.0.0-next.2 → 5.0.0-next.20
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 +6 -7
- package/bin/weapp-tailwindcss.js +1 -21
- package/dist/bundle-state-BlXvU4jl.js +530 -0
- package/dist/bundle-state-PO6MysTJ.mjs +414 -0
- package/dist/bundlers/shared/cache.d.ts +6 -6
- 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 +5 -0
- package/dist/bundlers/shared/css-cleanup/selectors.d.ts +8 -0
- package/dist/bundlers/shared/css-cleanup.d.ts +7 -3
- package/dist/bundlers/shared/css-imports.d.ts +3 -3
- package/dist/bundlers/shared/generated-css-marker.d.ts +3 -0
- package/dist/bundlers/shared/generator-css/config-directive.d.ts +2 -0
- package/dist/bundlers/shared/generator-css/directives.d.ts +20 -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 +28 -0
- package/dist/bundlers/shared/generator-css/source-files.d.ts +14 -0
- package/dist/bundlers/shared/generator-css/source-resolver.d.ts +24 -0
- package/dist/bundlers/shared/generator-css.d.ts +16 -22
- package/dist/bundlers/shared/hmr-timing.d.ts +22 -0
- package/dist/bundlers/shared/style-requests.d.ts +2 -0
- package/dist/bundlers/vite/bundle-state.d.ts +1 -0
- package/dist/bundlers/vite/css-finalizer.d.ts +7 -1
- package/dist/bundlers/vite/generate-bundle/candidates.d.ts +2 -0
- package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +24 -0
- package/dist/bundlers/vite/generate-bundle/css-share-scope.d.ts +4 -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 +14 -2
- package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +5 -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/processed-css-assets.d.ts +32 -0
- package/dist/bundlers/vite/rewrite-css-imports.d.ts +8 -3
- package/dist/bundlers/vite/runtime-class-set.d.ts +25 -0
- package/dist/bundlers/vite/source-candidates.d.ts +16 -1
- package/dist/bundlers/vite/source-scan.d.ts +26 -0
- package/dist/bundlers/vite/static-config-content.d.ts +5 -0
- package/dist/bundlers/vite/tailwind-basedir.d.ts +1 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +6 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +6 -2
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +9 -3
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +1 -0
- package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +31 -0
- package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +2 -6
- package/dist/bundlers/webpack/loaders/weapp-tw-runtime-classset-loader.d.ts +3 -7
- package/dist/cache/index.d.ts +6 -6
- package/dist/cli/context.d.ts +1 -14
- package/dist/cli/doctor/types.d.ts +11 -11
- 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/vscode-entry.d.ts +3 -3
- package/dist/cli.js +605 -611
- package/dist/cli.mjs +614 -620
- package/dist/constants.d.ts +1 -2
- package/dist/core.js +13 -20
- package/dist/core.mjs +8 -14
- package/dist/css-macro/postcss.js +3 -2
- package/dist/css-macro/postcss.mjs +3 -2
- 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-B1igPF_e.mjs +150 -0
- package/dist/defaults-IHhYxNeU.js +193 -0
- package/dist/defaults.d.ts +15 -1
- package/dist/defaults.js +6 -131
- package/dist/defaults.mjs +2 -129
- package/dist/escape.js +10 -2
- package/dist/escape.mjs +10 -2
- package/dist/generator/index.d.ts +1 -1
- package/dist/generator/options.d.ts +9 -8
- package/dist/generator/types.d.ts +3 -3
- package/dist/generator-DIuglJub.mjs +32 -0
- package/dist/generator-N4jy1HCk.js +55 -0
- package/dist/generator.js +12 -11
- package/dist/generator.mjs +2 -1
- package/dist/gulp.js +185 -47
- package/dist/gulp.mjs +179 -41
- package/dist/incremental-runtime-class-set-CJ0Pnsw2.js +2348 -0
- package/dist/incremental-runtime-class-set-hF-uiw6W.mjs +2285 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -6
- package/dist/index.mjs +5 -5
- package/dist/js/babel/cache-options.d.ts +3 -0
- package/dist/js/babel/parse.d.ts +7 -4
- package/dist/js/index.d.ts +1 -0
- package/dist/js/literal-transform.d.ts +2 -0
- package/dist/js/precheck.d.ts +2 -2
- package/dist/lightningcss/style-handler/selector-transform.d.ts +1 -1
- package/dist/lightningcss/style-handler.d.ts +3 -3
- package/dist/logger-CZUxvJJD.mjs +2 -0
- package/dist/logger-EVNB9z7i.js +1 -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-D4UdbBQ6.mjs +228 -0
- package/dist/postcss-DlY-YRvA.js +237 -0
- package/dist/postcss.d.ts +2 -2
- package/dist/postcss.js +3 -276
- package/dist/postcss.mjs +1 -269
- package/dist/{recorder-gYSNLfOP.js → precheck-BjEbVEpX.js} +218 -314
- package/dist/{recorder-zsgatmkB.mjs → precheck-tbk626YL.mjs} +186 -281
- package/dist/presets.js +13 -11
- package/dist/presets.mjs +11 -9
- package/dist/reset.d.ts +1 -0
- package/dist/runtime-registry-D5qnaSpo.js +5516 -0
- package/dist/shared/mpx.d.ts +1 -0
- package/dist/source-candidates-BrvneDDd.mjs +209 -0
- package/dist/source-candidates-gxijpPI3.js +222 -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/cache.d.ts +4 -3
- package/dist/tailwindcss/runtime-patch.d.ts +5 -0
- package/dist/tailwindcss/runtime.d.ts +11 -12
- package/dist/tailwindcss/source-scan.d.ts +35 -0
- package/dist/tailwindcss/targets.d.ts +1 -5
- package/dist/tailwindcss/v3-engine/types.d.ts +17 -14
- package/dist/tailwindcss/v4/css-entries.d.ts +2 -2
- package/dist/tailwindcss/v4/css-sources.d.ts +5 -0
- package/dist/tailwindcss/v4/patcher-options.d.ts +1 -23
- package/dist/tailwindcss/v4/patcher.d.ts +1 -0
- package/dist/tailwindcss/v4-engine/source.d.ts +2 -2
- package/dist/tailwindcss/v4-engine/types.d.ts +17 -5
- package/dist/tailwindcss/version.d.ts +4 -0
- package/dist/tailwindcss-BhG7BtB-.js +651 -0
- package/dist/tailwindcss-c6ROlNNW.mjs +600 -0
- package/dist/typedoc.export.d.ts +0 -2
- package/dist/types/index.d.ts +51 -48
- package/dist/types/shared.d.ts +3 -0
- package/dist/types/user-defined-options/general.d.ts +23 -23
- package/dist/types/user-defined-options/important.d.ts +31 -28
- package/dist/types/user-defined-options/lifecycle.d.ts +4 -4
- package/dist/types/user-defined-options/matcher.d.ts +6 -6
- package/dist/uni-app-x/vite.d.ts +1 -1
- package/dist/utils/disabled.d.ts +2 -3
- package/dist/utils/object.d.ts +9 -0
- package/dist/{utils-DmC9_In3.js → utils-4ODFyoqD.js} +1 -1
- package/dist/{utils-7DUGTFED.mjs → utils-CGBVVNm6.mjs} +1 -1
- package/dist/v3-engine-5LoZUH-4.js +3695 -0
- package/dist/v3-engine-DIXDEDmL.mjs +3406 -0
- package/dist/{vite-CrlzCNqz.mjs → vite-B5faZcbE.mjs} +1256 -1088
- package/dist/vite-MyXBNux0.js +2368 -0
- 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 +5157 -16
- package/dist/weapp-tw-runtime-classset-loader.js +32 -7
- package/dist/webpack-BnVyDmsD.mjs +836 -0
- package/dist/webpack-Mz1V0A9p.js +846 -0
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +27 -37
- 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/css-imports-BbrbluP9.js +0 -177
- package/dist/css-imports-CSdPq_Sc.mjs +0 -128
- 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/generator-Y-Ikv4Fu.mjs +0 -1177
- package/dist/generator-css-B5ejWUMv.mjs +0 -1098
- package/dist/generator-css-D3OdPRiS.js +0 -1125
- package/dist/generator-mmhXzZnv.js +0 -1276
- package/dist/js/syntax.d.ts +0 -10
- package/dist/loader-anchors-CNkWT8hx.js +0 -273
- package/dist/loader-anchors-TrU7EUr7.mjs +0 -205
- package/dist/logger-BZ45DZJT.js +0 -1003
- package/dist/logger-BoVx1Dbt.mjs +0 -935
- 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/vite-BC9U7ahn.js +0 -2199
- package/dist/webpack-Bu6M-Hbw.mjs +0 -441
- package/dist/webpack-DD7A6V0u.js +0 -456
- 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-B-_T5UnW.mjs → constants-BG12WAKw.mjs} +0 -0
- /package/dist/{constants-p1dyh1x1.js → constants-BeeyfJ9k.js} +0 -0
|
@@ -0,0 +1,846 @@
|
|
|
1
|
+
const require_chunk = require("./chunk-8l464Juk.js");
|
|
2
|
+
const require_v3_engine = require("./v3-engine-5LoZUH-4.js");
|
|
3
|
+
const require_incremental_runtime_class_set = require("./incremental-runtime-class-set-CJ0Pnsw2.js");
|
|
4
|
+
const require_precheck = require("./precheck-BjEbVEpX.js");
|
|
5
|
+
const require_utils = require("./utils-4ODFyoqD.js");
|
|
6
|
+
const require_tailwindcss = require("./tailwindcss-BhG7BtB-.js");
|
|
7
|
+
const require_bundle_state = require("./bundle-state-BlXvU4jl.js");
|
|
8
|
+
let node_fs = require("node:fs");
|
|
9
|
+
node_fs = require_chunk.__toESM(node_fs);
|
|
10
|
+
let node_module = require("node:module");
|
|
11
|
+
node_module = require_chunk.__toESM(node_module);
|
|
12
|
+
let node_path = require("node:path");
|
|
13
|
+
node_path = require_chunk.__toESM(node_path);
|
|
14
|
+
let node_process = require("node:process");
|
|
15
|
+
node_process = require_chunk.__toESM(node_process);
|
|
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 localRequire = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
|
|
35
|
+
const MPX_STYLE_RESOURCE_QUERY_RE$1 = /(?:^|[?&])type=styles(?:&|$)/;
|
|
36
|
+
const MPX_WEBPACK_PLUGIN_PACKAGE_RE = /@mpxjs[\\/]webpack-plugin[\\/]package\.json$/;
|
|
37
|
+
function isMpxStyleResourceQuery(query) {
|
|
38
|
+
if (typeof query !== "string") return false;
|
|
39
|
+
return MPX_STYLE_RESOURCE_QUERY_RE$1.test(query);
|
|
40
|
+
}
|
|
41
|
+
function isMpx(appType) {
|
|
42
|
+
return appType === "mpx";
|
|
43
|
+
}
|
|
44
|
+
function getTailwindcssCssEntry(pkgDir) {
|
|
45
|
+
return node_path.default.join(pkgDir, "index.css");
|
|
46
|
+
}
|
|
47
|
+
function resolveMpxWebpackPluginDir(compiler) {
|
|
48
|
+
const candidates = [
|
|
49
|
+
compiler?.context,
|
|
50
|
+
compiler?.options?.context,
|
|
51
|
+
node_process.default.cwd()
|
|
52
|
+
].filter((item) => typeof item === "string" && item.length > 0);
|
|
53
|
+
for (const candidate of candidates) try {
|
|
54
|
+
const projectRequire = (0, node_module.createRequire)(node_path.default.join(candidate, "package.json"));
|
|
55
|
+
return node_path.default.dirname(projectRequire.resolve("@mpxjs/webpack-plugin/package.json"));
|
|
56
|
+
} catch {}
|
|
57
|
+
const cachedPackageJson = Object.keys(localRequire.cache).find((file) => MPX_WEBPACK_PLUGIN_PACKAGE_RE.test(file));
|
|
58
|
+
if (cachedPackageJson) return node_path.default.dirname(cachedPackageJson);
|
|
59
|
+
try {
|
|
60
|
+
return node_path.default.dirname(localRequire.resolve("@mpxjs/webpack-plugin/package.json"));
|
|
61
|
+
} catch {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function isMpxWebpackPluginRequest(request) {
|
|
66
|
+
return request === "@mpxjs/webpack-plugin" || Boolean(request?.startsWith("@mpxjs/webpack-plugin/"));
|
|
67
|
+
}
|
|
68
|
+
function resolveMpxWebpackPluginRequest(request, mpxWebpackPluginDir) {
|
|
69
|
+
if (request === "@mpxjs/webpack-plugin") return mpxWebpackPluginDir;
|
|
70
|
+
return node_path.default.join(mpxWebpackPluginDir, request.slice(22));
|
|
71
|
+
}
|
|
72
|
+
function addMpxWebpackPluginAlias(alias, pkgDir) {
|
|
73
|
+
const recordLoader = node_path.default.join(pkgDir, "lib/record-loader");
|
|
74
|
+
const styleCompiler = node_path.default.join(pkgDir, "lib/style-compiler/index");
|
|
75
|
+
const stripConditionalLoader = node_path.default.join(pkgDir, "lib/style-compiler/strip-conditional-loader");
|
|
76
|
+
if (Array.isArray(alias)) alias.push({
|
|
77
|
+
name: "@mpxjs/webpack-plugin/lib/record-loader",
|
|
78
|
+
alias: recordLoader
|
|
79
|
+
}, {
|
|
80
|
+
name: "@mpxjs/webpack-plugin/lib/style-compiler/index",
|
|
81
|
+
alias: styleCompiler
|
|
82
|
+
}, {
|
|
83
|
+
name: "@mpxjs/webpack-plugin/lib/style-compiler/strip-conditional-loader",
|
|
84
|
+
alias: stripConditionalLoader
|
|
85
|
+
}, {
|
|
86
|
+
name: /^@mpxjs\/webpack-plugin\//,
|
|
87
|
+
alias: pkgDir
|
|
88
|
+
});
|
|
89
|
+
else {
|
|
90
|
+
alias["@mpxjs/webpack-plugin"] = pkgDir;
|
|
91
|
+
alias["@mpxjs/webpack-plugin$"] = pkgDir;
|
|
92
|
+
alias["@mpxjs/webpack-plugin/lib/record-loader"] = recordLoader;
|
|
93
|
+
alias["@mpxjs/webpack-plugin/lib/style-compiler/index"] = styleCompiler;
|
|
94
|
+
alias["@mpxjs/webpack-plugin/lib/style-compiler/strip-conditional-loader"] = stripConditionalLoader;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function ensureResolveLoaderAlias(compiler, mpxWebpackPluginDir) {
|
|
98
|
+
compiler.options.resolveLoader = compiler.options.resolveLoader || {};
|
|
99
|
+
const alias = compiler.options.resolveLoader.alias ?? {};
|
|
100
|
+
compiler.options.resolveLoader.alias = alias;
|
|
101
|
+
addMpxWebpackPluginAlias(alias, mpxWebpackPluginDir);
|
|
102
|
+
}
|
|
103
|
+
function resolveMpxWebpackPluginRequire(compiler) {
|
|
104
|
+
const candidates = [
|
|
105
|
+
compiler?.context,
|
|
106
|
+
compiler?.options?.context,
|
|
107
|
+
node_process.default.cwd()
|
|
108
|
+
].filter((item) => typeof item === "string" && item.length > 0);
|
|
109
|
+
for (const candidate of candidates) try {
|
|
110
|
+
const projectRequire = (0, node_module.createRequire)(node_path.default.join(candidate, "package.json"));
|
|
111
|
+
projectRequire.resolve("@mpxjs/webpack-plugin/package.json");
|
|
112
|
+
return projectRequire;
|
|
113
|
+
} catch {}
|
|
114
|
+
const cachedPackageJson = Object.keys(localRequire.cache).find((file) => MPX_WEBPACK_PLUGIN_PACKAGE_RE.test(file));
|
|
115
|
+
if (cachedPackageJson) return (0, node_module.createRequire)(cachedPackageJson);
|
|
116
|
+
return localRequire;
|
|
117
|
+
}
|
|
118
|
+
function patchMpxWebpackPluginNormalizeLib(compiler, mpxWebpackPluginDir) {
|
|
119
|
+
if (!mpxWebpackPluginDir) return false;
|
|
120
|
+
const projectRequire = resolveMpxWebpackPluginRequire(compiler);
|
|
121
|
+
let normalize;
|
|
122
|
+
try {
|
|
123
|
+
normalize = projectRequire("@mpxjs/webpack-plugin/lib/utils/normalize");
|
|
124
|
+
} catch {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
if (typeof normalize.lib !== "function") return false;
|
|
128
|
+
if (normalize.lib.__weappTwPatched) return true;
|
|
129
|
+
const wrappedLib = (file) => node_path.default.join(mpxWebpackPluginDir, "lib", file);
|
|
130
|
+
wrappedLib.__weappTwPatched = true;
|
|
131
|
+
wrappedLib.__weappTwOriginal = normalize.lib;
|
|
132
|
+
normalize.lib = wrappedLib;
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
135
|
+
function ensureMpxTailwindcssAliases(compiler, pkgDir) {
|
|
136
|
+
const tailwindcssCssEntry = getTailwindcssCssEntry(pkgDir);
|
|
137
|
+
compiler.options = compiler.options || {};
|
|
138
|
+
compiler.options.resolve = compiler.options.resolve || {};
|
|
139
|
+
const mpxWebpackPluginDir = resolveMpxWebpackPluginDir(compiler);
|
|
140
|
+
patchMpxWebpackPluginNormalizeLib(compiler, mpxWebpackPluginDir);
|
|
141
|
+
if (mpxWebpackPluginDir) ensureResolveLoaderAlias(compiler, mpxWebpackPluginDir);
|
|
142
|
+
const alias = compiler.options.resolve.alias ?? {};
|
|
143
|
+
compiler.options.resolve.alias = alias;
|
|
144
|
+
if (Array.isArray(alias)) alias.push({
|
|
145
|
+
name: "tailwindcss",
|
|
146
|
+
alias: tailwindcssCssEntry
|
|
147
|
+
}, {
|
|
148
|
+
name: "tailwindcss$",
|
|
149
|
+
alias: tailwindcssCssEntry
|
|
150
|
+
});
|
|
151
|
+
else {
|
|
152
|
+
alias.tailwindcss = tailwindcssCssEntry;
|
|
153
|
+
alias.tailwindcss$ = tailwindcssCssEntry;
|
|
154
|
+
}
|
|
155
|
+
if (mpxWebpackPluginDir) addMpxWebpackPluginAlias(alias, mpxWebpackPluginDir);
|
|
156
|
+
return tailwindcssCssEntry;
|
|
157
|
+
}
|
|
158
|
+
function patchMpxLoaderResolve(loaderContext, pkgDir, enabled) {
|
|
159
|
+
if (!enabled || typeof loaderContext.resolve !== "function") return;
|
|
160
|
+
const originalResolve = loaderContext.resolve;
|
|
161
|
+
if (originalResolve.__weappTwPatched) return;
|
|
162
|
+
const tailwindcssCssEntry = getTailwindcssCssEntry(pkgDir);
|
|
163
|
+
const mpxWebpackPluginDir = resolveMpxWebpackPluginDir(loaderContext);
|
|
164
|
+
const wrappedResolve = function(context, request, callback) {
|
|
165
|
+
if (request === "tailwindcss" || request === "tailwindcss$") return callback(null, tailwindcssCssEntry);
|
|
166
|
+
if (request?.startsWith("tailwindcss/")) return callback(null, node_path.default.join(pkgDir, request.slice(12)));
|
|
167
|
+
if (mpxWebpackPluginDir && isMpxWebpackPluginRequest(request)) return callback(null, resolveMpxWebpackPluginRequest(request, mpxWebpackPluginDir));
|
|
168
|
+
return originalResolve.call(this, context, request, callback);
|
|
169
|
+
};
|
|
170
|
+
wrappedResolve.__weappTwPatched = true;
|
|
171
|
+
loaderContext.resolve = wrappedResolve;
|
|
172
|
+
}
|
|
173
|
+
function setupMpxTailwindcssRedirect(pkgDir, enabled) {
|
|
174
|
+
if (enabled) installTailwindcssCssRedirect(pkgDir);
|
|
175
|
+
}
|
|
176
|
+
const CSS_EXT_RE = /\.css$/i;
|
|
177
|
+
function injectMpxCssRewritePreRules(compiler, loader, loaderOptions) {
|
|
178
|
+
var _compiler$options;
|
|
179
|
+
if (!loader) return;
|
|
180
|
+
const moduleOptions = (_compiler$options = compiler.options).module ?? (_compiler$options.module = { rules: [] });
|
|
181
|
+
moduleOptions.rules = moduleOptions.rules || [];
|
|
182
|
+
const createRule = (match) => ({
|
|
183
|
+
...match,
|
|
184
|
+
enforce: "pre",
|
|
185
|
+
use: [{
|
|
186
|
+
loader,
|
|
187
|
+
options: loaderOptions
|
|
188
|
+
}]
|
|
189
|
+
});
|
|
190
|
+
moduleOptions.rules.unshift(createRule({ resourceQuery: (query) => isMpxStyleResourceQuery(query) }), createRule({
|
|
191
|
+
test: CSS_EXT_RE,
|
|
192
|
+
resourceQuery: (query) => !isMpxStyleResourceQuery(query)
|
|
193
|
+
}));
|
|
194
|
+
}
|
|
195
|
+
//#endregion
|
|
196
|
+
//#region src/bundlers/webpack/BaseUnifiedPlugin/shared.ts
|
|
197
|
+
const MPX_STYLE_RESOURCE_QUERY_RE = /(?:\?|&)type=styles\b/;
|
|
198
|
+
function getCacheKey(filename) {
|
|
199
|
+
return filename;
|
|
200
|
+
}
|
|
201
|
+
function stripResourceQuery(resource) {
|
|
202
|
+
if (typeof resource !== "string") return resource;
|
|
203
|
+
return require_bundle_state.stripRequestQuery(resource);
|
|
204
|
+
}
|
|
205
|
+
function isCssLikeModuleResource(resource, cssMatcher, appType) {
|
|
206
|
+
if (typeof resource !== "string") return false;
|
|
207
|
+
const normalizedResource = stripResourceQuery(resource);
|
|
208
|
+
if (normalizedResource && cssMatcher(normalizedResource)) return true;
|
|
209
|
+
if (require_bundle_state.isSourceStyleRequest(resource)) return true;
|
|
210
|
+
if (appType === "mpx") return MPX_STYLE_RESOURCE_QUERY_RE.test(resource);
|
|
211
|
+
return false;
|
|
212
|
+
}
|
|
213
|
+
function hasLoaderEntry(entries, target) {
|
|
214
|
+
if (!target) return false;
|
|
215
|
+
return entries.some((entry) => entry.loader?.includes?.(target));
|
|
216
|
+
}
|
|
217
|
+
function normalizeWatchPath(file) {
|
|
218
|
+
return node_path.default.resolve(file);
|
|
219
|
+
}
|
|
220
|
+
function isFileInContext(file, context) {
|
|
221
|
+
const relative = node_path.default.relative(normalizeWatchPath(context), normalizeWatchPath(file));
|
|
222
|
+
return relative.length > 0 && !relative.startsWith("..") && !node_path.default.isAbsolute(relative);
|
|
223
|
+
}
|
|
224
|
+
function toChunkFiles(files) {
|
|
225
|
+
if (!files) return [];
|
|
226
|
+
if (Array.isArray(files)) return files;
|
|
227
|
+
return [...files];
|
|
228
|
+
}
|
|
229
|
+
function createAssetHashByChunkMap(chunks) {
|
|
230
|
+
const partsByFile = /* @__PURE__ */ new Map();
|
|
231
|
+
for (const chunk of chunks) {
|
|
232
|
+
const hash = typeof chunk.hash === "string" ? chunk.hash : void 0;
|
|
233
|
+
if (!hash) continue;
|
|
234
|
+
const chunkId = String(chunk.id ?? chunk.name ?? "");
|
|
235
|
+
for (const file of toChunkFiles(chunk.files)) {
|
|
236
|
+
if (!file) continue;
|
|
237
|
+
let parts = partsByFile.get(file);
|
|
238
|
+
if (!parts) {
|
|
239
|
+
parts = [];
|
|
240
|
+
partsByFile.set(file, parts);
|
|
241
|
+
}
|
|
242
|
+
parts.push(`${chunkId}:${hash}`);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
const hashByFile = /* @__PURE__ */ new Map();
|
|
246
|
+
for (const [file, parts] of partsByFile.entries()) hashByFile.set(file, parts.sort().join("|"));
|
|
247
|
+
return hashByFile;
|
|
248
|
+
}
|
|
249
|
+
function createRuntimeAwareCssHash(assetHash, sourceHash, runtimeSetHash) {
|
|
250
|
+
return `${assetHash ?? sourceHash}:${runtimeSetHash}`;
|
|
251
|
+
}
|
|
252
|
+
function isWatchFileInRuntimeDependencies(file, dependencies) {
|
|
253
|
+
const normalizedFile = normalizeWatchPath(file);
|
|
254
|
+
for (const dependency of dependencies.files ?? []) if (normalizeWatchPath(dependency) === normalizedFile) return true;
|
|
255
|
+
for (const context of dependencies.contexts ?? []) if (isFileInContext(normalizedFile, context)) return true;
|
|
256
|
+
return false;
|
|
257
|
+
}
|
|
258
|
+
//#endregion
|
|
259
|
+
//#region src/bundlers/webpack/BaseUnifiedPlugin/v5-assets.ts
|
|
260
|
+
function createWebpackSnapshotAssets(assets) {
|
|
261
|
+
return Object.fromEntries(Object.entries(assets).map(([file, asset]) => {
|
|
262
|
+
const source = asset.source();
|
|
263
|
+
return [file, {
|
|
264
|
+
fileName: file,
|
|
265
|
+
source: typeof source === "string" ? source : source?.toString() ?? "",
|
|
266
|
+
type: "asset"
|
|
267
|
+
}];
|
|
268
|
+
}));
|
|
269
|
+
}
|
|
270
|
+
function setupWebpackV5ProcessAssetsHook(options) {
|
|
271
|
+
const { compiler, options: compilerOptions, appType, runtimeState, getRuntimeRefreshRequirement, refreshRuntimeMetadata, isWebpackProcessedCssAsset, consumeRuntimeRefreshRequirement, isWatchMode, runtimeClassSetManager, debug } = options;
|
|
272
|
+
const { Compilation, sources } = compiler.webpack;
|
|
273
|
+
const { ConcatSource } = sources;
|
|
274
|
+
const cssHandlerOptionsCache = /* @__PURE__ */ new Map();
|
|
275
|
+
const cssUserHandlerOptionsCache = /* @__PURE__ */ new Map();
|
|
276
|
+
const bundleBuildState = require_bundle_state.createBundleBuildState();
|
|
277
|
+
const bundleRuntimeClassSetManager = runtimeClassSetManager ?? require_incremental_runtime_class_set.createBundleRuntimeClassSetManager();
|
|
278
|
+
let webpackWatchRuntimeScanInitialized = false;
|
|
279
|
+
compiler.hooks.compilation.tap(require_precheck.pluginName, (compilation) => {
|
|
280
|
+
compilation.hooks.processAssets.tapPromise({
|
|
281
|
+
name: require_precheck.pluginName,
|
|
282
|
+
stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
|
|
283
|
+
}, async (assets) => {
|
|
284
|
+
compilerOptions.onStart();
|
|
285
|
+
debug("start");
|
|
286
|
+
await runtimeState.readyPromise;
|
|
287
|
+
const hmrTimingStartedAt = performance.now();
|
|
288
|
+
for (const chunk of compilation.chunks) if (chunk.id && chunk.hash) compilerOptions.cache.calcHashValueChanged(chunk.id, chunk.hash);
|
|
289
|
+
const assetHashByChunk = createAssetHashByChunkMap(compilation.chunks);
|
|
290
|
+
const entries = Object.entries(assets);
|
|
291
|
+
const compilerOutputPath = compilation.compiler?.outputPath ?? compiler.outputPath;
|
|
292
|
+
const outputDir = compilerOutputPath ? node_path.default.resolve(compilerOutputPath) : compilation.outputOptions?.path ?? node_process.default.cwd();
|
|
293
|
+
const jsAssets = /* @__PURE__ */ new Map();
|
|
294
|
+
for (const [file] of entries) if (compilerOptions.jsMatcher(file) || compilerOptions.wxsMatcher(file)) {
|
|
295
|
+
const absolute = require_bundle_state.toAbsoluteOutputPath(file, outputDir);
|
|
296
|
+
jsAssets.set(absolute, file);
|
|
297
|
+
}
|
|
298
|
+
const moduleGraphOptions = {
|
|
299
|
+
resolve(specifier, importer) {
|
|
300
|
+
return require_bundle_state.resolveOutputSpecifier(specifier, importer, outputDir, (candidate) => jsAssets.has(candidate));
|
|
301
|
+
},
|
|
302
|
+
load: (id) => {
|
|
303
|
+
const assetName = jsAssets.get(id);
|
|
304
|
+
if (!assetName) return;
|
|
305
|
+
const asset = compilation.getAsset(assetName);
|
|
306
|
+
if (!asset) return;
|
|
307
|
+
const source = asset.source.source();
|
|
308
|
+
return typeof source === "string" ? source : source.toString();
|
|
309
|
+
},
|
|
310
|
+
filter(id) {
|
|
311
|
+
return jsAssets.has(id);
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
const applyLinkedResults = (linked) => {
|
|
315
|
+
if (!linked) return;
|
|
316
|
+
for (const [id, { code }] of Object.entries(linked)) {
|
|
317
|
+
const assetName = jsAssets.get(id);
|
|
318
|
+
if (!assetName) continue;
|
|
319
|
+
const asset = compilation.getAsset(assetName);
|
|
320
|
+
if (!asset) continue;
|
|
321
|
+
const previousSource = asset.source.source();
|
|
322
|
+
const previous = typeof previousSource === "string" ? previousSource : previousSource.toString();
|
|
323
|
+
if (previous === code) continue;
|
|
324
|
+
const source = new ConcatSource(code);
|
|
325
|
+
compilation.updateAsset(assetName, source);
|
|
326
|
+
compilerOptions.onUpdate(assetName, previous, code);
|
|
327
|
+
debug("js linked handle: %s", assetName);
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
const groupedEntries = require_utils.getGroupedEntries(entries, compilerOptions);
|
|
331
|
+
const getCssHandlerOptions = (file) => {
|
|
332
|
+
const majorVersion = runtimeState.twPatcher.majorVersion;
|
|
333
|
+
const isMainChunk = compilerOptions.mainCssChunkMatcher(file, appType);
|
|
334
|
+
const cacheKey = `${majorVersion ?? "unknown"}:${isMainChunk ? "1" : "0"}:${file}`;
|
|
335
|
+
const cached = cssHandlerOptionsCache.get(cacheKey);
|
|
336
|
+
if (cached) return cached;
|
|
337
|
+
const created = {
|
|
338
|
+
isMainChunk,
|
|
339
|
+
postcssOptions: { options: { from: file } },
|
|
340
|
+
...majorVersion === void 0 ? {} : { majorVersion }
|
|
341
|
+
};
|
|
342
|
+
cssHandlerOptionsCache.set(cacheKey, created);
|
|
343
|
+
return created;
|
|
344
|
+
};
|
|
345
|
+
const getCssUserHandlerOptions = (file) => {
|
|
346
|
+
const cacheKey = `${runtimeState.twPatcher.majorVersion ?? "unknown"}:${file}`;
|
|
347
|
+
const cached = cssUserHandlerOptionsCache.get(cacheKey);
|
|
348
|
+
if (cached) return cached;
|
|
349
|
+
const created = {
|
|
350
|
+
...getCssHandlerOptions(file),
|
|
351
|
+
isMainChunk: false
|
|
352
|
+
};
|
|
353
|
+
cssUserHandlerOptionsCache.set(cacheKey, created);
|
|
354
|
+
return created;
|
|
355
|
+
};
|
|
356
|
+
const forceRuntimeRefresh = getRuntimeRefreshRequirement();
|
|
357
|
+
debug("processAssets ensure runtime set forceRefresh=%s major=%s", forceRuntimeRefresh, runtimeState.twPatcher.majorVersion ?? "unknown");
|
|
358
|
+
let runtimeSet;
|
|
359
|
+
const watchMode = isWatchMode?.() === true;
|
|
360
|
+
if (watchMode && runtimeState.twPatcher.majorVersion === 4 && !forceRuntimeRefresh) {
|
|
361
|
+
const snapshot = require_bundle_state.buildBundleSnapshot(createWebpackSnapshotAssets(assets), compilerOptions, outputDir, bundleBuildState);
|
|
362
|
+
if (!webpackWatchRuntimeScanInitialized) {
|
|
363
|
+
for (const entry of snapshot.entries) if (entry.type === "html" || entry.type === "js") snapshot.runtimeAffectingChangedByType[entry.type].add(entry.file);
|
|
364
|
+
}
|
|
365
|
+
try {
|
|
366
|
+
runtimeSet = await bundleRuntimeClassSetManager.sync(runtimeState.twPatcher, snapshot);
|
|
367
|
+
} catch (error) {
|
|
368
|
+
debug("webpack incremental runtime set sync failed, fallback to full collect: %O", error);
|
|
369
|
+
await bundleRuntimeClassSetManager.reset();
|
|
370
|
+
runtimeSet = await require_precheck.ensureRuntimeClassSet(runtimeState, {
|
|
371
|
+
forceRefresh: false,
|
|
372
|
+
forceCollect: true,
|
|
373
|
+
clearCache: false,
|
|
374
|
+
allowEmpty: false
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
require_bundle_state.updateBundleBuildState(bundleBuildState, snapshot, /* @__PURE__ */ new Map(), { incremental: true });
|
|
378
|
+
webpackWatchRuntimeScanInitialized = true;
|
|
379
|
+
} else {
|
|
380
|
+
if (forceRuntimeRefresh) {
|
|
381
|
+
await bundleRuntimeClassSetManager.reset();
|
|
382
|
+
webpackWatchRuntimeScanInitialized = false;
|
|
383
|
+
}
|
|
384
|
+
runtimeSet = await require_precheck.ensureRuntimeClassSet(runtimeState, {
|
|
385
|
+
forceRefresh: forceRuntimeRefresh,
|
|
386
|
+
forceCollect: !watchMode || forceRuntimeRefresh,
|
|
387
|
+
clearCache: forceRuntimeRefresh,
|
|
388
|
+
allowEmpty: false
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
await refreshRuntimeMetadata(forceRuntimeRefresh);
|
|
392
|
+
consumeRuntimeRefreshRequirement();
|
|
393
|
+
const runtimeSetHash = compilerOptions.cache.computeHash([require_v3_engine.getRuntimeClassSetSignature(runtimeState.twPatcher), [...runtimeSet].sort().join("\n")].join("\n\n"));
|
|
394
|
+
const defaultTemplateHandlerOptions = { runtimeSet };
|
|
395
|
+
debug("get runtimeSet, class count: %d", runtimeSet.size);
|
|
396
|
+
const tasks = [];
|
|
397
|
+
if (Array.isArray(groupedEntries.html)) for (const element of groupedEntries.html) {
|
|
398
|
+
const [file, originalSource] = element;
|
|
399
|
+
const rawSource = originalSource.source().toString();
|
|
400
|
+
const cacheKey = file;
|
|
401
|
+
const chunkHash = assetHashByChunk.get(file);
|
|
402
|
+
tasks.push(require_incremental_runtime_class_set.processCachedTask({
|
|
403
|
+
cache: compilerOptions.cache,
|
|
404
|
+
cacheKey,
|
|
405
|
+
hashKey: `${file}:asset`,
|
|
406
|
+
rawSource,
|
|
407
|
+
hash: chunkHash,
|
|
408
|
+
applyResult(source) {
|
|
409
|
+
compilation.updateAsset(file, source);
|
|
410
|
+
},
|
|
411
|
+
onCacheHit() {
|
|
412
|
+
debug("html cache hit: %s", file);
|
|
413
|
+
},
|
|
414
|
+
transform: async () => {
|
|
415
|
+
const wxml = await compilerOptions.templateHandler(rawSource, defaultTemplateHandlerOptions);
|
|
416
|
+
const source = new ConcatSource(wxml);
|
|
417
|
+
compilerOptions.onUpdate(file, rawSource, wxml);
|
|
418
|
+
debug("html handle: %s", file);
|
|
419
|
+
return { result: source };
|
|
420
|
+
}
|
|
421
|
+
}));
|
|
422
|
+
}
|
|
423
|
+
const jsTaskFactories = [];
|
|
424
|
+
if (Array.isArray(groupedEntries.js)) for (const [file] of groupedEntries.js) {
|
|
425
|
+
const cacheKey = getCacheKey(file);
|
|
426
|
+
const asset = compilation.getAsset(file);
|
|
427
|
+
if (!asset) continue;
|
|
428
|
+
const absoluteFile = require_bundle_state.toAbsoluteOutputPath(file, outputDir);
|
|
429
|
+
const initialSource = asset.source.source();
|
|
430
|
+
const initialRawSource = typeof initialSource === "string" ? initialSource : initialSource.toString();
|
|
431
|
+
const chunkHash = assetHashByChunk.get(file);
|
|
432
|
+
jsTaskFactories.push(async () => {
|
|
433
|
+
await require_incremental_runtime_class_set.processCachedTask({
|
|
434
|
+
cache: compilerOptions.cache,
|
|
435
|
+
cacheKey,
|
|
436
|
+
hashKey: `${file}:asset`,
|
|
437
|
+
rawSource: initialRawSource,
|
|
438
|
+
hash: chunkHash,
|
|
439
|
+
applyResult(source) {
|
|
440
|
+
compilation.updateAsset(file, source);
|
|
441
|
+
},
|
|
442
|
+
onCacheHit() {
|
|
443
|
+
debug("js cache hit: %s", file);
|
|
444
|
+
},
|
|
445
|
+
transform: async () => {
|
|
446
|
+
const currentSourceValue = compilation.getAsset(file)?.source.source();
|
|
447
|
+
const currentSource = typeof currentSourceValue === "string" ? currentSourceValue : currentSourceValue?.toString() ?? "";
|
|
448
|
+
const handlerOptions = {
|
|
449
|
+
tailwindcssMajorVersion: runtimeState.twPatcher.majorVersion,
|
|
450
|
+
filename: absoluteFile,
|
|
451
|
+
moduleGraph: moduleGraphOptions,
|
|
452
|
+
babelParserOptions: { sourceFilename: absoluteFile }
|
|
453
|
+
};
|
|
454
|
+
if (require_precheck.shouldSkipJsTransform(currentSource, {
|
|
455
|
+
...handlerOptions,
|
|
456
|
+
classNameSet: runtimeSet
|
|
457
|
+
})) return { result: new ConcatSource(currentSource) };
|
|
458
|
+
const { code, linked } = await compilerOptions.jsHandler(currentSource, runtimeSet, handlerOptions);
|
|
459
|
+
const source = new ConcatSource(code);
|
|
460
|
+
compilerOptions.onUpdate(file, currentSource, code);
|
|
461
|
+
debug("js handle: %s", file);
|
|
462
|
+
applyLinkedResults(linked);
|
|
463
|
+
return { result: source };
|
|
464
|
+
}
|
|
465
|
+
});
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
if (Array.isArray(groupedEntries.css)) for (const element of groupedEntries.css) {
|
|
469
|
+
const [file, originalSource] = element;
|
|
470
|
+
const rawSource = originalSource.source().toString();
|
|
471
|
+
if (isWebpackProcessedCssAsset?.(file, rawSource)) {
|
|
472
|
+
const nextCss = require_bundle_state.stripBundlerGeneratedCssMarkers(rawSource);
|
|
473
|
+
tasks.push(require_incremental_runtime_class_set.processCachedTask({
|
|
474
|
+
cache: compilerOptions.cache,
|
|
475
|
+
cacheKey: file,
|
|
476
|
+
hashKey: `${file}:asset`,
|
|
477
|
+
rawSource,
|
|
478
|
+
hash: createRuntimeAwareCssHash(assetHashByChunk.get(file), compilerOptions.cache.computeHash(rawSource), runtimeSetHash),
|
|
479
|
+
applyResult(source) {
|
|
480
|
+
compilation.updateAsset(file, source);
|
|
481
|
+
},
|
|
482
|
+
onCacheHit() {
|
|
483
|
+
debug("css webpack-loader-pipeline cache hit: %s", file);
|
|
484
|
+
},
|
|
485
|
+
transform: async () => {
|
|
486
|
+
compilerOptions.onUpdate(file, rawSource, nextCss);
|
|
487
|
+
debug("css skip webpack-loader-pipeline asset: %s", file);
|
|
488
|
+
return { result: new ConcatSource(nextCss) };
|
|
489
|
+
}
|
|
490
|
+
}));
|
|
491
|
+
continue;
|
|
492
|
+
}
|
|
493
|
+
const cacheKey = file;
|
|
494
|
+
const runtimeAwareHash = createRuntimeAwareCssHash(assetHashByChunk.get(file), compilerOptions.cache.computeHash(rawSource), runtimeSetHash);
|
|
495
|
+
tasks.push(require_incremental_runtime_class_set.processCachedTask({
|
|
496
|
+
cache: compilerOptions.cache,
|
|
497
|
+
cacheKey,
|
|
498
|
+
hashKey: `${file}:asset`,
|
|
499
|
+
rawSource,
|
|
500
|
+
hash: runtimeAwareHash,
|
|
501
|
+
applyResult(source) {
|
|
502
|
+
compilation.updateAsset(file, source);
|
|
503
|
+
},
|
|
504
|
+
onCacheHit() {
|
|
505
|
+
debug("css cache hit: %s", file);
|
|
506
|
+
},
|
|
507
|
+
transform: async () => {
|
|
508
|
+
await runtimeState.readyPromise;
|
|
509
|
+
const cssHandlerOptions = getCssHandlerOptions(file);
|
|
510
|
+
const generated = await require_incremental_runtime_class_set.generateCssByGenerator({
|
|
511
|
+
opts: compilerOptions,
|
|
512
|
+
runtimeState,
|
|
513
|
+
runtime: runtimeSet,
|
|
514
|
+
rawSource,
|
|
515
|
+
file,
|
|
516
|
+
cssHandlerOptions,
|
|
517
|
+
cssUserHandlerOptions: getCssUserHandlerOptions(file),
|
|
518
|
+
styleHandler: compilerOptions.styleHandler,
|
|
519
|
+
debug
|
|
520
|
+
});
|
|
521
|
+
const css = generated?.css ?? (await compilerOptions.styleHandler(rawSource, cssHandlerOptions)).css;
|
|
522
|
+
const source = new ConcatSource(css);
|
|
523
|
+
compilerOptions.onUpdate(file, rawSource, css);
|
|
524
|
+
if (generated) debug("css handle via tailwind v%s engine(%s): %s", runtimeState.twPatcher.majorVersion, generated.target, file);
|
|
525
|
+
else debug("css handle: %s", file);
|
|
526
|
+
return { result: source };
|
|
527
|
+
}
|
|
528
|
+
}));
|
|
529
|
+
}
|
|
530
|
+
require_bundle_state.pushConcurrentTaskFactories(tasks, jsTaskFactories);
|
|
531
|
+
await Promise.all(tasks);
|
|
532
|
+
debug("end");
|
|
533
|
+
require_incremental_runtime_class_set.emitHmrTiming("webpack", "processAssets", performance.now() - hmrTimingStartedAt);
|
|
534
|
+
compilerOptions.onEnd();
|
|
535
|
+
});
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
//#endregion
|
|
539
|
+
//#region src/bundlers/webpack/loaders/runtime-registry.ts
|
|
540
|
+
const runtimeRegistryHolder = globalThis;
|
|
541
|
+
const runtimeRegistry = runtimeRegistryHolder.__WEAPP_TW_WEBPACK_LOADER_RUNTIME_REGISTRY__ ?? (runtimeRegistryHolder.__WEAPP_TW_WEBPACK_LOADER_RUNTIME_REGISTRY__ = /* @__PURE__ */ new Map());
|
|
542
|
+
function setWebpackLoaderRuntime(key, entry) {
|
|
543
|
+
runtimeRegistry.set(key, entry);
|
|
544
|
+
}
|
|
545
|
+
//#endregion
|
|
546
|
+
//#region src/bundlers/webpack/shared/loader-anchors.ts
|
|
547
|
+
const MPX_STRIP_CONDITIONAL_LOADER = "@mpxjs/webpack-plugin/lib/style-compiler/strip-conditional-loader";
|
|
548
|
+
const MPX_STYLE_COMPILER_LOADER = "@mpxjs/webpack-plugin/lib/style-compiler/index";
|
|
549
|
+
const MPX_REWRITE_PRECEDENCE_LOADERS = [MPX_STYLE_COMPILER_LOADER, MPX_STRIP_CONDITIONAL_LOADER];
|
|
550
|
+
function createFinder(targets) {
|
|
551
|
+
return (entries) => entries.findIndex((entry) => targets.some((target) => entry?.loader?.includes?.(target)));
|
|
552
|
+
}
|
|
553
|
+
function createPrioritizedFinder(targets) {
|
|
554
|
+
return (entries) => {
|
|
555
|
+
for (const target of targets) {
|
|
556
|
+
const idx = entries.findIndex((entry) => entry?.loader?.includes?.(target));
|
|
557
|
+
if (idx !== -1) return idx;
|
|
558
|
+
}
|
|
559
|
+
return -1;
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
function createLoaderAnchorFinders(appType) {
|
|
563
|
+
if (isMpx(appType)) return {
|
|
564
|
+
findRewriteAnchor: createPrioritizedFinder(MPX_REWRITE_PRECEDENCE_LOADERS),
|
|
565
|
+
findClassSetAnchor: createFinder([MPX_STYLE_COMPILER_LOADER])
|
|
566
|
+
};
|
|
567
|
+
const fallbackFinder = createFinder(["postcss-loader"]);
|
|
568
|
+
return {
|
|
569
|
+
findRewriteAnchor: fallbackFinder,
|
|
570
|
+
findClassSetAnchor: fallbackFinder
|
|
571
|
+
};
|
|
572
|
+
}
|
|
573
|
+
//#endregion
|
|
574
|
+
//#region src/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.ts
|
|
575
|
+
function setupWebpackV5Loaders(options) {
|
|
576
|
+
const { compiler, options: compilerOptions, appType, weappTailwindcssPackageDir, shouldRewriteCssImports, runtimeLoaderPath, registerAutoCssSource, runtimeState, getClassSetInLoader, getRuntimeSetInLoader, markWebpackProcessedCssSource, getRuntimeWatchDependencies, runtimeRegistryKey = `weapp-tailwindcss-${Date.now()}-${Math.random().toString(36).slice(2)}`, debug } = options;
|
|
577
|
+
const isMpxApp = isMpx(appType);
|
|
578
|
+
if (shouldRewriteCssImports && isMpxApp) ensureMpxTailwindcssAliases(compiler, weappTailwindcssPackageDir);
|
|
579
|
+
const runtimeClassSetLoader = runtimeLoaderPath ?? node_path.default.resolve(__dirname, "./weapp-tw-runtime-classset-loader.js");
|
|
580
|
+
const runtimeCssImportRewriteLoader = shouldRewriteCssImports ? node_path.default.resolve(__dirname, "./weapp-tw-css-import-rewrite-loader.js") : void 0;
|
|
581
|
+
const runtimeClassSetLoaderExists = node_fs.default.existsSync(runtimeClassSetLoader);
|
|
582
|
+
const runtimeCssImportRewriteLoaderExists = runtimeCssImportRewriteLoader ? node_fs.default.existsSync(runtimeCssImportRewriteLoader) : false;
|
|
583
|
+
const runtimeLoaderRewriteOptions = shouldRewriteCssImports ? {
|
|
584
|
+
pkgDir: weappTailwindcssPackageDir,
|
|
585
|
+
compilerOptions,
|
|
586
|
+
runtimeState,
|
|
587
|
+
...appType === void 0 ? {} : { appType },
|
|
588
|
+
...registerAutoCssSource === void 0 ? {} : { registerCssSource: registerAutoCssSource },
|
|
589
|
+
getRuntimeSet: getRuntimeSetInLoader,
|
|
590
|
+
...markWebpackProcessedCssSource === void 0 ? {} : { markGeneratedCssSource: markWebpackProcessedCssSource }
|
|
591
|
+
} : void 0;
|
|
592
|
+
setWebpackLoaderRuntime(runtimeRegistryKey, {
|
|
593
|
+
classSet: {
|
|
594
|
+
getClassSet: getClassSetInLoader,
|
|
595
|
+
getWatchDependencies: getRuntimeWatchDependencies
|
|
596
|
+
},
|
|
597
|
+
...runtimeLoaderRewriteOptions === void 0 ? {} : { cssImportRewrite: runtimeLoaderRewriteOptions }
|
|
598
|
+
});
|
|
599
|
+
const { findRewriteAnchor, findClassSetAnchor } = createLoaderAnchorFinders(appType);
|
|
600
|
+
const cssImportRewriteLoaderOptions = runtimeLoaderRewriteOptions ? { tailwindcssImportRewriteRuntimeKey: runtimeRegistryKey } : void 0;
|
|
601
|
+
if (runtimeCssImportRewriteLoader && shouldRewriteCssImports && cssImportRewriteLoaderOptions && isMpxApp) injectMpxCssRewritePreRules(compiler, runtimeCssImportRewriteLoader, cssImportRewriteLoaderOptions);
|
|
602
|
+
const createRuntimeClassSetLoaderEntry = () => ({
|
|
603
|
+
loader: runtimeClassSetLoader,
|
|
604
|
+
options: { weappTailwindcssRuntimeKey: runtimeRegistryKey },
|
|
605
|
+
ident: null,
|
|
606
|
+
type: null
|
|
607
|
+
});
|
|
608
|
+
const createCssImportRewriteLoaderEntry = () => {
|
|
609
|
+
if (!runtimeCssImportRewriteLoader || !cssImportRewriteLoaderOptions) return null;
|
|
610
|
+
return {
|
|
611
|
+
loader: runtimeCssImportRewriteLoader,
|
|
612
|
+
options: cssImportRewriteLoaderOptions,
|
|
613
|
+
ident: null,
|
|
614
|
+
type: null
|
|
615
|
+
};
|
|
616
|
+
};
|
|
617
|
+
const { NormalModule } = compiler.webpack;
|
|
618
|
+
compiler.hooks.compilation.tap(require_precheck.pluginName, (compilation) => {
|
|
619
|
+
NormalModule.getCompilationHooks(compilation).loader.tap(require_precheck.pluginName, (_loaderContext, module) => {
|
|
620
|
+
if (!(runtimeClassSetLoaderExists || runtimeCssImportRewriteLoaderExists)) return;
|
|
621
|
+
patchMpxLoaderResolve(_loaderContext, weappTailwindcssPackageDir, shouldRewriteCssImports && isMpxApp);
|
|
622
|
+
const loaderEntries = module.loaders || [];
|
|
623
|
+
let rewriteAnchorIdx = findRewriteAnchor(loaderEntries);
|
|
624
|
+
const classSetAnchorIdx = findClassSetAnchor(loaderEntries);
|
|
625
|
+
const isCssModule = isCssLikeModuleResource(module.resource, compilerOptions.cssMatcher, appType);
|
|
626
|
+
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), {
|
|
627
|
+
rewriteAnchorIdx,
|
|
628
|
+
classSetAnchorIdx
|
|
629
|
+
});
|
|
630
|
+
if (node_process.default.env["WEAPP_TW_LOADER_DEBUG"] && typeof module.resource === "string" && module.resource.includes("app.css")) debug("app.css module loaders=%o anchors=%o", loaderEntries.map((x) => x.loader), {
|
|
631
|
+
rewriteAnchorIdx,
|
|
632
|
+
classSetAnchorIdx
|
|
633
|
+
});
|
|
634
|
+
else if (node_process.default.env["WEAPP_TW_LOADER_DEBUG"] && typeof module.resource === "string" && module.resource.endsWith(".css")) debug("css module seen: %s loaders=%o anchors=%o", module.resource, loaderEntries.map((x) => x.loader), {
|
|
635
|
+
rewriteAnchorIdx,
|
|
636
|
+
classSetAnchorIdx
|
|
637
|
+
});
|
|
638
|
+
if (rewriteAnchorIdx === -1 && classSetAnchorIdx === -1 && !isCssModule) return;
|
|
639
|
+
const anchorlessInsert = (entry, position) => {
|
|
640
|
+
if (position === "after") loaderEntries.push(entry);
|
|
641
|
+
else loaderEntries.unshift(entry);
|
|
642
|
+
};
|
|
643
|
+
if (cssImportRewriteLoaderOptions && runtimeCssImportRewriteLoaderExists && runtimeCssImportRewriteLoader) {
|
|
644
|
+
const existingIndex = loaderEntries.findIndex((entry) => entry.loader?.includes?.(runtimeCssImportRewriteLoader));
|
|
645
|
+
const rewriteLoaderEntry = existingIndex !== -1 ? loaderEntries.splice(existingIndex, 1)[0] : createCssImportRewriteLoaderEntry();
|
|
646
|
+
if (rewriteLoaderEntry) {
|
|
647
|
+
const anchorIndex = findRewriteAnchor(loaderEntries);
|
|
648
|
+
if (anchorIndex === -1) anchorlessInsert(rewriteLoaderEntry, "after");
|
|
649
|
+
else loaderEntries.splice(anchorIndex + 1, 0, rewriteLoaderEntry);
|
|
650
|
+
rewriteAnchorIdx = findRewriteAnchor(loaderEntries);
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
if (runtimeClassSetLoaderExists && !hasLoaderEntry(loaderEntries, runtimeClassSetLoader)) {
|
|
654
|
+
const classSetLoaderEntry = createRuntimeClassSetLoaderEntry();
|
|
655
|
+
const anchorIndex = findClassSetAnchor(loaderEntries);
|
|
656
|
+
if (anchorIndex === -1) anchorlessInsert(classSetLoaderEntry, "before");
|
|
657
|
+
else {
|
|
658
|
+
const insertIndex = anchorIndex === -1 ? rewriteAnchorIdx : anchorIndex;
|
|
659
|
+
loaderEntries.splice(insertIndex, 0, classSetLoaderEntry);
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
});
|
|
663
|
+
});
|
|
664
|
+
}
|
|
665
|
+
//#endregion
|
|
666
|
+
//#region src/bundlers/webpack/BaseUnifiedPlugin/v5.ts
|
|
667
|
+
const debug = require_v3_engine.createDebug();
|
|
668
|
+
const weappTailwindcssPackageDir = require_bundle_state.resolvePackageDir("weapp-tailwindcss");
|
|
669
|
+
/**
|
|
670
|
+
* @name UnifiedWebpackPluginV5
|
|
671
|
+
* @description webpack5 核心转义插件
|
|
672
|
+
* @link https://tw.icebreaker.top/docs/intro
|
|
673
|
+
*/
|
|
674
|
+
var UnifiedWebpackPluginV5 = class {
|
|
675
|
+
constructor(options = {}) {
|
|
676
|
+
require_precheck._defineProperty(this, "options", void 0);
|
|
677
|
+
require_precheck._defineProperty(this, "appType", void 0);
|
|
678
|
+
require_precheck._defineProperty(this, "hasInitialTailwindCssRoots", void 0);
|
|
679
|
+
this.hasInitialTailwindCssRoots = require_tailwindcss.hasConfiguredTailwindV4CssRoots(options);
|
|
680
|
+
this.options = require_precheck.getCompilerContext({
|
|
681
|
+
...options,
|
|
682
|
+
__internalDeferMissingCssEntriesWarning: true
|
|
683
|
+
});
|
|
684
|
+
this.appType = this.options.appType;
|
|
685
|
+
}
|
|
686
|
+
apply(compiler) {
|
|
687
|
+
compiler.options = compiler.options || {};
|
|
688
|
+
const { disabled, onLoad, runtimeLoaderPath, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = this.options;
|
|
689
|
+
const disabledOptions = require_bundle_state.resolvePluginDisabledState(disabled);
|
|
690
|
+
const shouldRewriteCssImports = (initialTwPatcher.majorVersion ?? 0) >= 4;
|
|
691
|
+
const isMpxApp = isMpx(this.appType);
|
|
692
|
+
if (shouldRewriteCssImports) setupMpxTailwindcssRedirect(weappTailwindcssPackageDir, isMpxApp);
|
|
693
|
+
if (disabledOptions.plugin) return;
|
|
694
|
+
const runtimeState = {
|
|
695
|
+
twPatcher: initialTwPatcher,
|
|
696
|
+
readyPromise: require_precheck.createTailwindRuntimeReadyPromise(initialTwPatcher),
|
|
697
|
+
refreshTailwindcssPatcher
|
|
698
|
+
};
|
|
699
|
+
let runtimeSetPrepared = false;
|
|
700
|
+
let runtimeSetSignature;
|
|
701
|
+
let runtimeRefreshRequiredForCompilation = false;
|
|
702
|
+
let watchRunObserved = false;
|
|
703
|
+
const runtimeWatchDependencyFiles = /* @__PURE__ */ new Set();
|
|
704
|
+
const runtimeWatchDependencyContexts = /* @__PURE__ */ new Set();
|
|
705
|
+
const webpackProcessedCssSourceFiles = /* @__PURE__ */ new Set();
|
|
706
|
+
let runtimeMetadataPrepared = false;
|
|
707
|
+
const updateRuntimeWatchDependencies = async () => {
|
|
708
|
+
runtimeWatchDependencyFiles.clear();
|
|
709
|
+
runtimeWatchDependencyContexts.clear();
|
|
710
|
+
const tailwindOptions = require_v3_engine.resolveTailwindcssOptions(runtimeState.twPatcher.options);
|
|
711
|
+
if (tailwindOptions?.config) runtimeWatchDependencyFiles.add(tailwindOptions.config);
|
|
712
|
+
for (const entry of tailwindOptions?.v4?.cssEntries ?? []) runtimeWatchDependencyFiles.add(entry);
|
|
713
|
+
for (const source of tailwindOptions?.v4?.cssSources ?? []) {
|
|
714
|
+
if (source.file) runtimeWatchDependencyFiles.add(source.file);
|
|
715
|
+
for (const dependency of source.dependencies ?? []) runtimeWatchDependencyFiles.add(dependency);
|
|
716
|
+
}
|
|
717
|
+
for (const source of tailwindOptions?.v4?.sources ?? []) if (source?.base) runtimeWatchDependencyContexts.add(source.base);
|
|
718
|
+
if (typeof runtimeState.twPatcher.collectContentTokens !== "function") return;
|
|
719
|
+
try {
|
|
720
|
+
const report = await runtimeState.twPatcher.collectContentTokens();
|
|
721
|
+
for (const entry of report.entries ?? []) if (entry.file) runtimeWatchDependencyFiles.add(entry.file);
|
|
722
|
+
for (const source of report.sources ?? []) if (source?.base) runtimeWatchDependencyContexts.add(source.base);
|
|
723
|
+
} catch (error) {
|
|
724
|
+
debug("collect runtime watch dependencies failed: %O", error);
|
|
725
|
+
}
|
|
726
|
+
};
|
|
727
|
+
const ensureRuntimeMetadata = async (force = false) => {
|
|
728
|
+
if (runtimeMetadataPrepared && !force) return;
|
|
729
|
+
await updateRuntimeWatchDependencies();
|
|
730
|
+
runtimeMetadataPrepared = true;
|
|
731
|
+
};
|
|
732
|
+
const collectWatchChangedFiles = () => {
|
|
733
|
+
const compilerLike = compiler;
|
|
734
|
+
return new Set([...compilerLike.modifiedFiles ?? [], ...compilerLike.removedFiles ?? []]);
|
|
735
|
+
};
|
|
736
|
+
const hasRuntimeDependencyChanges = (files) => {
|
|
737
|
+
for (const file of files) if (isWatchFileInRuntimeDependencies(file, {
|
|
738
|
+
contexts: runtimeWatchDependencyContexts,
|
|
739
|
+
files: runtimeWatchDependencyFiles
|
|
740
|
+
})) return true;
|
|
741
|
+
return false;
|
|
742
|
+
};
|
|
743
|
+
const syncRuntimeRefreshRequirement = (markWatchRun = false) => {
|
|
744
|
+
if (markWatchRun) watchRunObserved = true;
|
|
745
|
+
const changedFiles = collectWatchChangedFiles();
|
|
746
|
+
runtimeRefreshRequiredForCompilation = runtimeRefreshRequiredForCompilation || hasRuntimeDependencyChanges(changedFiles);
|
|
747
|
+
};
|
|
748
|
+
const resetRuntimePreparation = () => {
|
|
749
|
+
runtimeSetPrepared = false;
|
|
750
|
+
syncRuntimeRefreshRequirement();
|
|
751
|
+
};
|
|
752
|
+
const registerAutoCssSource = async (source) => {
|
|
753
|
+
if (this.hasInitialTailwindCssRoots || (runtimeState.twPatcher.majorVersion ?? 0) < 4 || !source.file) return;
|
|
754
|
+
if (!require_tailwindcss.upsertTailwindV4CssSource(this.options, source)) return;
|
|
755
|
+
runtimeSetPrepared = false;
|
|
756
|
+
runtimeMetadataPrepared = false;
|
|
757
|
+
runtimeRefreshRequiredForCompilation = true;
|
|
758
|
+
await require_precheck.refreshTailwindRuntimeState(runtimeState, {
|
|
759
|
+
force: true,
|
|
760
|
+
clearCache: true
|
|
761
|
+
});
|
|
762
|
+
debug("detected tailwindcss v4 css source from webpack css module: %s", source.file);
|
|
763
|
+
};
|
|
764
|
+
const markWebpackProcessedCssSource = (file) => {
|
|
765
|
+
webpackProcessedCssSourceFiles.add(node_path.default.resolve(file));
|
|
766
|
+
};
|
|
767
|
+
compiler.hooks.invalid?.tap?.(require_precheck.pluginName, (fileName) => {
|
|
768
|
+
if (!fileName) return;
|
|
769
|
+
runtimeRefreshRequiredForCompilation = runtimeRefreshRequiredForCompilation || hasRuntimeDependencyChanges([node_path.default.resolve(fileName)]);
|
|
770
|
+
});
|
|
771
|
+
compiler.hooks.watchRun?.tap?.(require_precheck.pluginName, () => syncRuntimeRefreshRequirement(true));
|
|
772
|
+
if (compiler.hooks.thisCompilation?.tap) compiler.hooks.thisCompilation.tap(require_precheck.pluginName, resetRuntimePreparation);
|
|
773
|
+
else if (compiler.hooks.compilation?.tap) compiler.hooks.compilation.tap(require_precheck.pluginName, resetRuntimePreparation);
|
|
774
|
+
async function getClassSetInLoader() {
|
|
775
|
+
if (runtimeSetPrepared) return;
|
|
776
|
+
const signature = require_v3_engine.getRuntimeClassSetSignature(runtimeState.twPatcher);
|
|
777
|
+
const forceRefresh = runtimeRefreshRequiredForCompilation || signature !== runtimeSetSignature;
|
|
778
|
+
debug("runtime loader ensure class set forceRefresh=%s watchDirty=%s signatureChanged=%s", forceRefresh, runtimeRefreshRequiredForCompilation, signature !== runtimeSetSignature);
|
|
779
|
+
runtimeSetPrepared = true;
|
|
780
|
+
await require_precheck.ensureRuntimeClassSet(runtimeState, {
|
|
781
|
+
forceRefresh,
|
|
782
|
+
forceCollect: forceRefresh || !watchRunObserved,
|
|
783
|
+
clearCache: forceRefresh,
|
|
784
|
+
allowEmpty: true
|
|
785
|
+
});
|
|
786
|
+
await ensureRuntimeMetadata(forceRefresh);
|
|
787
|
+
runtimeSetSignature = signature;
|
|
788
|
+
runtimeRefreshRequiredForCompilation = false;
|
|
789
|
+
}
|
|
790
|
+
async function getRuntimeSetInLoader() {
|
|
791
|
+
await getClassSetInLoader();
|
|
792
|
+
return require_precheck.ensureRuntimeClassSet(runtimeState, { allowEmpty: true });
|
|
793
|
+
}
|
|
794
|
+
onLoad();
|
|
795
|
+
setupWebpackV5Loaders({
|
|
796
|
+
compiler,
|
|
797
|
+
options: this.options,
|
|
798
|
+
appType: this.appType,
|
|
799
|
+
weappTailwindcssPackageDir,
|
|
800
|
+
shouldRewriteCssImports,
|
|
801
|
+
runtimeLoaderPath,
|
|
802
|
+
registerAutoCssSource,
|
|
803
|
+
runtimeState,
|
|
804
|
+
getClassSetInLoader,
|
|
805
|
+
getRuntimeSetInLoader,
|
|
806
|
+
markWebpackProcessedCssSource,
|
|
807
|
+
getRuntimeWatchDependencies() {
|
|
808
|
+
return {
|
|
809
|
+
files: runtimeWatchDependencyFiles,
|
|
810
|
+
contexts: runtimeWatchDependencyContexts
|
|
811
|
+
};
|
|
812
|
+
},
|
|
813
|
+
debug
|
|
814
|
+
});
|
|
815
|
+
setupWebpackV5ProcessAssetsHook({
|
|
816
|
+
compiler,
|
|
817
|
+
options: this.options,
|
|
818
|
+
appType: this.appType,
|
|
819
|
+
runtimeState,
|
|
820
|
+
getRuntimeRefreshRequirement: () => runtimeRefreshRequiredForCompilation,
|
|
821
|
+
refreshRuntimeMetadata: ensureRuntimeMetadata,
|
|
822
|
+
isWebpackProcessedCssAsset(file, rawSource) {
|
|
823
|
+
return webpackProcessedCssSourceFiles.has(node_path.default.resolve(file)) || rawSource.includes("weapp-tailwindcss webpack-generated-css");
|
|
824
|
+
},
|
|
825
|
+
consumeRuntimeRefreshRequirement() {
|
|
826
|
+
runtimeRefreshRequiredForCompilation = false;
|
|
827
|
+
},
|
|
828
|
+
isWatchMode: () => watchRunObserved || compiler.options?.watch === true,
|
|
829
|
+
runtimeClassSetManager: this.options.__internalWebpackRuntimeClassSetManager,
|
|
830
|
+
debug
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
};
|
|
834
|
+
//#endregion
|
|
835
|
+
Object.defineProperty(exports, "UnifiedWebpackPluginV5", {
|
|
836
|
+
enumerable: true,
|
|
837
|
+
get: function() {
|
|
838
|
+
return UnifiedWebpackPluginV5;
|
|
839
|
+
}
|
|
840
|
+
});
|
|
841
|
+
Object.defineProperty(exports, "weappTailwindcssPackageDir", {
|
|
842
|
+
enumerable: true,
|
|
843
|
+
get: function() {
|
|
844
|
+
return weappTailwindcssPackageDir;
|
|
845
|
+
}
|
|
846
|
+
});
|