weapp-tailwindcss 5.1.6 → 5.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundlers/framework-selector.d.ts +26 -0
- package/dist/bundlers/gulp/frameworks/native/index.d.ts +6 -0
- package/dist/bundlers/gulp/index.d.ts +4 -4
- package/dist/bundlers/gulp/shared/create-native-framework-plugins.d.ts +6 -0
- package/dist/bundlers/vite/css-finalizer.d.ts +2 -0
- package/dist/bundlers/vite/frameworks/generic/index.d.ts +2 -0
- package/dist/bundlers/vite/frameworks/taro/index.d.ts +2 -0
- package/dist/bundlers/vite/frameworks/uni-app/index.d.ts +2 -0
- package/dist/bundlers/vite/frameworks/uni-app-x/index.d.ts +2 -0
- package/dist/bundlers/vite/frameworks/weapp-vite/index.d.ts +2 -0
- package/dist/bundlers/vite/generate-bundle/css-output-helpers.d.ts +5 -1
- package/dist/bundlers/vite/generate-bundle/finalize.d.ts +5 -1
- package/dist/bundlers/vite/generate-bundle/root-style-output.d.ts +2 -2
- package/dist/bundlers/vite/generate-bundle/sfc-style-source.d.ts +8 -0
- package/dist/bundlers/vite/generate-bundle/types.d.ts +2 -0
- package/dist/bundlers/vite/index.d.ts +2 -4
- package/dist/bundlers/vite/processed-css-assets.d.ts +5 -0
- package/dist/bundlers/vite/shared/create-framework-plugins.d.ts +35 -0
- package/dist/bundlers/vite/shared/framework-strategy.d.ts +88 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +1 -2
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers.d.ts +11 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +3 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +1 -2
- package/dist/bundlers/webpack/frameworks/generic/index.d.ts +5 -0
- package/dist/bundlers/webpack/frameworks/index.d.ts +8 -0
- package/dist/bundlers/webpack/frameworks/mpx/index.d.ts +5 -0
- package/dist/bundlers/webpack/frameworks/taro/index.d.ts +5 -0
- package/dist/bundlers/webpack/frameworks/uni-app/index.d.ts +5 -0
- package/dist/bundlers/webpack/frameworks/weapp-vite/index.d.ts +5 -0
- package/dist/bundlers/webpack/shared/create-framework-plugin.d.ts +21 -0
- package/dist/bundlers/webpack/shared/loader-anchors.d.ts +4 -3
- package/dist/cli.js +8 -0
- package/dist/cli.mjs +8 -0
- package/dist/{context-BCSk_YnL.js → context-CRhUs_5e.js} +13 -4
- package/dist/{context-3GGqW9vw.mjs → context-CfXr3hWz.mjs} +13 -4
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/{generator-CqWzj2Z1.js → generator-DaaFxR5V.js} +1 -1
- package/dist/{generator-CoT5vu9w.mjs → generator-DugIHBgl.mjs} +1 -1
- package/dist/generator.js +2 -2
- package/dist/generator.mjs +2 -2
- package/dist/{gulp-Bss4wJ8t.mjs → gulp-CRjkPsbX.mjs} +22 -7
- package/dist/{gulp-hXE1U4Cu.js → gulp-JUfnhOOo.js} +22 -7
- package/dist/gulp.js +1 -1
- package/dist/gulp.mjs +1 -1
- package/dist/{hmr-timing-Cfu-4Bnf.mjs → hmr-timing-BecOXMd8.mjs} +13 -7
- package/dist/{hmr-timing-Df4203aI.js → hmr-timing-DcIEXnf8.js} +13 -7
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/dist/postcss.js +2 -2
- package/dist/postcss.mjs +2 -2
- package/dist/presets.js +2 -2
- package/dist/presets.mjs +2 -2
- package/dist/rspack.js +1 -1
- package/dist/rspack.mjs +1 -1
- package/dist/{source-candidate-scan-signature-5Uk6U72B.js → source-candidate-scan-signature-10tvdJVC.js} +185 -98
- package/dist/{source-candidate-scan-signature-BbCmW975.mjs → source-candidate-scan-signature-DAg8QSgh.mjs} +162 -99
- package/dist/style-injector/internal.d.ts +18 -4
- package/dist/{tailwindcss-DYJ3HZD2.js → tailwindcss-BZjZZi60.js} +1 -1
- package/dist/{tailwindcss-Bjr3aphG.mjs → tailwindcss-PA2jHHpx.mjs} +1 -1
- package/dist/{transform-B6_y_yCB.js → transform-B0BxX3XB.js} +1 -1
- package/dist/{transform--155BmeJ.mjs → transform-wNEbcZeQ.mjs} +1 -1
- package/dist/uni-app-x/vite.d.ts +1 -0
- package/dist/uni-app-x/web-preflight-reset.d.ts +3 -0
- package/dist/{v4-engine-C9cmNlP8.js → v4-engine-BZP2462H.js} +44 -1
- package/dist/{v4-engine-DRQaCFMm.mjs → v4-engine-CjjWONB0.mjs} +45 -2
- package/dist/{vite-Baw9qNrc.js → vite-GdzlG_lx.js} +1332 -790
- package/dist/{vite-PdxjaqhO.mjs → vite-vf2-cDdk.mjs} +1330 -788
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +162 -7
- package/dist/{webpack-BffTDmod.mjs → webpack-2s-TFhgm.mjs} +583 -238
- package/dist/{webpack-C9u7mfGE.js → webpack-BhM4Hqla.js} +582 -237
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +3 -3
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { $ as hasTailwindGeneratedCssMarkers, A as stripTailwindSourceMediaFragments, D as removeTailwindV4GeneratorAtRules, Dt as inferGeneratorTargetFromEnv, E as removeTailwindV4GeneratedUserCssArtifacts, F as pruneMiniProgramGeneratedCss, H as hasTailwindSourceDirectives, K as parseImportRequest, L as stripMiniProgramCssSpecificityPlaceholders, N as finalizeMiniProgramCss, Q as hasTailwindGeneratedCss, T as removeMiniProgramHoverSelectors, U as normalizeTailwindConfigDirectives, V as hasTailwindRootDirectives, _ as resolveTailwindcssOptions, bt as resolveSourceScanPath, j as stripUnmatchedTailwindSourceMediaCloseFragments, lt as getTailwindV4IncrementalGenerateCacheStats, o as hasConfiguredTailwindV4CssRoots, q as removeTailwindSourceDirectives, s as upsertTailwindV4CssSource, z as hasTailwindApplyDirective } from "./v4-engine-
|
|
2
|
-
import { o as resolveRuntimeBranch } from "./generator-
|
|
1
|
+
import { $ as hasTailwindGeneratedCssMarkers, A as stripTailwindSourceMediaFragments, C as isCommentOnlyCss, D as removeTailwindV4GeneratorAtRules, Dt as inferGeneratorTargetFromEnv, E as removeTailwindV4GeneratedUserCssArtifacts, F as pruneMiniProgramGeneratedCss, H as hasTailwindSourceDirectives, K as parseImportRequest, L as stripMiniProgramCssSpecificityPlaceholders, N as finalizeMiniProgramCss, Q as hasTailwindGeneratedCss, T as removeMiniProgramHoverSelectors, U as normalizeTailwindConfigDirectives, V as hasTailwindRootDirectives, _ as resolveTailwindcssOptions, bt as resolveSourceScanPath, j as stripUnmatchedTailwindSourceMediaCloseFragments, lt as getTailwindV4IncrementalGenerateCacheStats, o as hasConfiguredTailwindV4CssRoots, q as removeTailwindSourceDirectives, s as upsertTailwindV4CssSource, z as hasTailwindApplyDirective } from "./v4-engine-CjjWONB0.mjs";
|
|
2
|
+
import { o as resolveRuntimeBranch } from "./generator-DugIHBgl.mjs";
|
|
3
3
|
import { r as getGroupedEntries } from "./utils-DodxWHGz.mjs";
|
|
4
|
-
import { S as createDebug, b as ensureRuntimeClassSet, f as _defineProperty, i as pluginName, l as shouldSkipJsTransform, n as normalizeStyleHandlerMajorVersion, r as resolveStyleOptionsFromContext, t as getCompilerContext, w as md5Hash, x as refreshTailwindRuntimeState, y as createTailwindRuntimeReadyPromise } from "./context-
|
|
5
|
-
import { l as getRuntimeClassSetSignature, p as resolveViteSourceScanEntries } from "./tailwindcss-
|
|
6
|
-
import { C as hasMiniProgramTailwindV4PreflightReset, D as isCssSourceTraceEnabled, E as createCssTokenSourceMap, O as processCachedTask, S as createCssSourceOrderAppend, T as createCssSourceTraceCacheSignature, _ as isPureLocalCssImportWrapper, a as isSourceCandidateRequest, b as scoreTailwindV4CssSourceFileMatch, c as collectStrictEscapedRuntimeCandidates, f as pushConcurrentTaskFactories, i as createSourceCandidateStore, l as createEscapeFragments, n as emitHmrTiming, o as resolveSourceCandidateScanFiles, p as resolveTaskConcurrency, s as createBundleRuntimeClassSetManager, w as annotateCssSourceTrace, x as removeGeneratedSelectorCompatCss } from "./hmr-timing-
|
|
7
|
-
import { A as
|
|
4
|
+
import { S as createDebug, b as ensureRuntimeClassSet, f as _defineProperty, i as pluginName, l as shouldSkipJsTransform, n as normalizeStyleHandlerMajorVersion, r as resolveStyleOptionsFromContext, t as getCompilerContext, w as md5Hash, x as refreshTailwindRuntimeState, y as createTailwindRuntimeReadyPromise } from "./context-CfXr3hWz.mjs";
|
|
5
|
+
import { g as resolveTailwindV4EntriesFromCssCached, l as getRuntimeClassSetSignature, p as resolveViteSourceScanEntries } from "./tailwindcss-PA2jHHpx.mjs";
|
|
6
|
+
import { C as hasMiniProgramTailwindV4PreflightReset, D as isCssSourceTraceEnabled, E as createCssTokenSourceMap, O as processCachedTask, S as createCssSourceOrderAppend, T as createCssSourceTraceCacheSignature, _ as isPureLocalCssImportWrapper, a as isSourceCandidateRequest, b as scoreTailwindV4CssSourceFileMatch, c as collectStrictEscapedRuntimeCandidates, f as pushConcurrentTaskFactories, i as createSourceCandidateStore, l as createEscapeFragments, n as emitHmrTiming, o as resolveSourceCandidateScanFiles, p as resolveTaskConcurrency, s as createBundleRuntimeClassSetManager, w as annotateCssSourceTrace, x as removeGeneratedSelectorCompatCss } from "./hmr-timing-BecOXMd8.mjs";
|
|
7
|
+
import { A as hasBundlerGeneratedCssMarker, B as resolveWebpackFrameworkProfile, C as generateTailwindV4Css, D as resolveOutputSpecifier, I as createBuiltinWebpackStyleInjectorPlugin, M as stripBundlerGeneratedCssMarkers, N as resolvePackageDir, O as toAbsoluteOutputPath, P as resolvePluginDisabledState, R as webpackStyleInjectorDelegates, T as stripRequestQuery, b as createRuntimeAffectingSourceSignature, d as classifyBundleEntry, f as createBundleBuildState, i as createCandidateSignature, p as updateBundleBuildState, r as createScopedGeneratorRuntime, t as createSourceCandidateScanSignature, w as isSourceStyleRequest } from "./source-candidate-scan-signature-DAg8QSgh.mjs";
|
|
8
8
|
import Module, { createRequire } from "node:module";
|
|
9
9
|
import fs from "node:fs";
|
|
10
10
|
import path from "node:path";
|
|
@@ -14,188 +14,7 @@ import { readFile, stat } from "node:fs/promises";
|
|
|
14
14
|
import micromatch from "micromatch";
|
|
15
15
|
import { MappingChars2String } from "@weapp-core/escape";
|
|
16
16
|
import { fileURLToPath } from "node:url";
|
|
17
|
-
//#region src/shared/tailwindcss-css-redirect.ts
|
|
18
|
-
const moduleWithMutableResolve = Module;
|
|
19
|
-
const patched = /* @__PURE__ */ new WeakSet();
|
|
20
|
-
function installTailwindcssCssRedirect(pkgDir) {
|
|
21
|
-
const target = path.join(pkgDir, "index.css");
|
|
22
|
-
const original = moduleWithMutableResolve._resolveFilename;
|
|
23
|
-
if (patched.has(original)) return;
|
|
24
|
-
const replacements = /* @__PURE__ */ new Set(["tailwindcss", "tailwindcss$"]);
|
|
25
|
-
const resolveTailwindcssCss = (request, parent, isMain, options) => {
|
|
26
|
-
if (replacements.has(request)) return target;
|
|
27
|
-
if (request.startsWith("tailwindcss/")) return path.join(pkgDir, request.slice(12));
|
|
28
|
-
return original(request, parent, isMain, options);
|
|
29
|
-
};
|
|
30
|
-
moduleWithMutableResolve._resolveFilename = resolveTailwindcssCss;
|
|
31
|
-
patched.add(moduleWithMutableResolve._resolveFilename);
|
|
32
|
-
}
|
|
33
|
-
//#endregion
|
|
34
|
-
//#region src/shared/mpx.ts
|
|
35
|
-
const localRequire = createRequire(import.meta.url);
|
|
36
|
-
const MPX_STYLE_RESOURCE_QUERY_RE$1 = /(?:^|[?&])type=styles(?:&|$)/;
|
|
37
|
-
const MPX_WEBPACK_PLUGIN_PACKAGE_RE = /@mpxjs[\\/]webpack-plugin[\\/]package\.json$/;
|
|
38
|
-
function isMpxStyleResourceQuery(query) {
|
|
39
|
-
if (typeof query !== "string") return false;
|
|
40
|
-
return MPX_STYLE_RESOURCE_QUERY_RE$1.test(query);
|
|
41
|
-
}
|
|
42
|
-
function isMpx(appType) {
|
|
43
|
-
return appType === "mpx";
|
|
44
|
-
}
|
|
45
|
-
function getTailwindcssCssEntry(pkgDir) {
|
|
46
|
-
return path.join(pkgDir, "index.css");
|
|
47
|
-
}
|
|
48
|
-
function resolveMpxWebpackPluginDir(compiler) {
|
|
49
|
-
const candidates = [
|
|
50
|
-
compiler?.context,
|
|
51
|
-
compiler?.options?.context,
|
|
52
|
-
process.cwd()
|
|
53
|
-
].filter((item) => typeof item === "string" && item.length > 0);
|
|
54
|
-
for (const candidate of candidates) try {
|
|
55
|
-
const projectRequire = createRequire(path.join(candidate, "package.json"));
|
|
56
|
-
return path.dirname(projectRequire.resolve("@mpxjs/webpack-plugin/package.json"));
|
|
57
|
-
} catch {}
|
|
58
|
-
const cachedPackageJson = Object.keys(localRequire.cache).find((file) => MPX_WEBPACK_PLUGIN_PACKAGE_RE.test(file));
|
|
59
|
-
if (cachedPackageJson) return path.dirname(cachedPackageJson);
|
|
60
|
-
try {
|
|
61
|
-
return path.dirname(localRequire.resolve("@mpxjs/webpack-plugin/package.json"));
|
|
62
|
-
} catch {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
function isMpxWebpackPluginRequest(request) {
|
|
67
|
-
return request === "@mpxjs/webpack-plugin" || Boolean(request?.startsWith("@mpxjs/webpack-plugin/"));
|
|
68
|
-
}
|
|
69
|
-
function resolveMpxWebpackPluginRequest(request, mpxWebpackPluginDir) {
|
|
70
|
-
if (request === "@mpxjs/webpack-plugin") return mpxWebpackPluginDir;
|
|
71
|
-
return path.join(mpxWebpackPluginDir, request.slice(22));
|
|
72
|
-
}
|
|
73
|
-
function addMpxWebpackPluginAlias(alias, pkgDir) {
|
|
74
|
-
const recordLoader = path.join(pkgDir, "lib/record-loader");
|
|
75
|
-
const styleCompiler = path.join(pkgDir, "lib/style-compiler/index");
|
|
76
|
-
const stripConditionalLoader = path.join(pkgDir, "lib/style-compiler/strip-conditional-loader");
|
|
77
|
-
if (Array.isArray(alias)) alias.push({
|
|
78
|
-
name: "@mpxjs/webpack-plugin/lib/record-loader",
|
|
79
|
-
alias: recordLoader
|
|
80
|
-
}, {
|
|
81
|
-
name: "@mpxjs/webpack-plugin/lib/style-compiler/index",
|
|
82
|
-
alias: styleCompiler
|
|
83
|
-
}, {
|
|
84
|
-
name: "@mpxjs/webpack-plugin/lib/style-compiler/strip-conditional-loader",
|
|
85
|
-
alias: stripConditionalLoader
|
|
86
|
-
}, {
|
|
87
|
-
name: /^@mpxjs\/webpack-plugin\//,
|
|
88
|
-
alias: pkgDir
|
|
89
|
-
});
|
|
90
|
-
else {
|
|
91
|
-
alias["@mpxjs/webpack-plugin"] = pkgDir;
|
|
92
|
-
alias["@mpxjs/webpack-plugin$"] = pkgDir;
|
|
93
|
-
alias["@mpxjs/webpack-plugin/lib/record-loader"] = recordLoader;
|
|
94
|
-
alias["@mpxjs/webpack-plugin/lib/style-compiler/index"] = styleCompiler;
|
|
95
|
-
alias["@mpxjs/webpack-plugin/lib/style-compiler/strip-conditional-loader"] = stripConditionalLoader;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
function ensureResolveLoaderAlias(compiler, mpxWebpackPluginDir) {
|
|
99
|
-
compiler.options.resolveLoader = compiler.options.resolveLoader || {};
|
|
100
|
-
const alias = compiler.options.resolveLoader.alias ?? {};
|
|
101
|
-
compiler.options.resolveLoader.alias = alias;
|
|
102
|
-
addMpxWebpackPluginAlias(alias, mpxWebpackPluginDir);
|
|
103
|
-
}
|
|
104
|
-
function resolveMpxWebpackPluginRequire(compiler) {
|
|
105
|
-
const candidates = [
|
|
106
|
-
compiler?.context,
|
|
107
|
-
compiler?.options?.context,
|
|
108
|
-
process.cwd()
|
|
109
|
-
].filter((item) => typeof item === "string" && item.length > 0);
|
|
110
|
-
for (const candidate of candidates) try {
|
|
111
|
-
const projectRequire = createRequire(path.join(candidate, "package.json"));
|
|
112
|
-
projectRequire.resolve("@mpxjs/webpack-plugin/package.json");
|
|
113
|
-
return projectRequire;
|
|
114
|
-
} catch {}
|
|
115
|
-
const cachedPackageJson = Object.keys(localRequire.cache).find((file) => MPX_WEBPACK_PLUGIN_PACKAGE_RE.test(file));
|
|
116
|
-
if (cachedPackageJson) return createRequire(cachedPackageJson);
|
|
117
|
-
return localRequire;
|
|
118
|
-
}
|
|
119
|
-
function patchMpxWebpackPluginNormalizeLib(compiler, mpxWebpackPluginDir) {
|
|
120
|
-
if (!mpxWebpackPluginDir) return false;
|
|
121
|
-
const projectRequire = resolveMpxWebpackPluginRequire(compiler);
|
|
122
|
-
let normalize;
|
|
123
|
-
try {
|
|
124
|
-
normalize = projectRequire("@mpxjs/webpack-plugin/lib/utils/normalize");
|
|
125
|
-
} catch {
|
|
126
|
-
return false;
|
|
127
|
-
}
|
|
128
|
-
if (typeof normalize.lib !== "function") return false;
|
|
129
|
-
if (normalize.lib.__weappTwPatched) return true;
|
|
130
|
-
const wrappedLib = (file) => path.join(mpxWebpackPluginDir, "lib", file);
|
|
131
|
-
wrappedLib.__weappTwPatched = true;
|
|
132
|
-
wrappedLib.__weappTwOriginal = normalize.lib;
|
|
133
|
-
normalize.lib = wrappedLib;
|
|
134
|
-
return true;
|
|
135
|
-
}
|
|
136
|
-
function ensureMpxTailwindcssAliases(compiler, pkgDir) {
|
|
137
|
-
const tailwindcssCssEntry = getTailwindcssCssEntry(pkgDir);
|
|
138
|
-
compiler.options = compiler.options || {};
|
|
139
|
-
compiler.options.resolve = compiler.options.resolve || {};
|
|
140
|
-
const mpxWebpackPluginDir = resolveMpxWebpackPluginDir(compiler);
|
|
141
|
-
patchMpxWebpackPluginNormalizeLib(compiler, mpxWebpackPluginDir);
|
|
142
|
-
if (mpxWebpackPluginDir) ensureResolveLoaderAlias(compiler, mpxWebpackPluginDir);
|
|
143
|
-
const alias = compiler.options.resolve.alias ?? {};
|
|
144
|
-
compiler.options.resolve.alias = alias;
|
|
145
|
-
if (Array.isArray(alias)) alias.push({
|
|
146
|
-
name: "tailwindcss",
|
|
147
|
-
alias: tailwindcssCssEntry
|
|
148
|
-
}, {
|
|
149
|
-
name: "tailwindcss$",
|
|
150
|
-
alias: tailwindcssCssEntry
|
|
151
|
-
});
|
|
152
|
-
else {
|
|
153
|
-
alias.tailwindcss = tailwindcssCssEntry;
|
|
154
|
-
alias.tailwindcss$ = tailwindcssCssEntry;
|
|
155
|
-
}
|
|
156
|
-
if (mpxWebpackPluginDir) addMpxWebpackPluginAlias(alias, mpxWebpackPluginDir);
|
|
157
|
-
return tailwindcssCssEntry;
|
|
158
|
-
}
|
|
159
|
-
function patchMpxLoaderResolve(loaderContext, pkgDir, enabled) {
|
|
160
|
-
if (!enabled || typeof loaderContext.resolve !== "function") return;
|
|
161
|
-
const originalResolve = loaderContext.resolve;
|
|
162
|
-
if (originalResolve.__weappTwPatched) return;
|
|
163
|
-
const tailwindcssCssEntry = getTailwindcssCssEntry(pkgDir);
|
|
164
|
-
const mpxWebpackPluginDir = resolveMpxWebpackPluginDir(loaderContext);
|
|
165
|
-
const wrappedResolve = function(context, request, callback) {
|
|
166
|
-
if (request === "tailwindcss" || request === "tailwindcss$") return callback(null, tailwindcssCssEntry);
|
|
167
|
-
if (request?.startsWith("tailwindcss/")) return callback(null, path.join(pkgDir, request.slice(12)));
|
|
168
|
-
if (mpxWebpackPluginDir && isMpxWebpackPluginRequest(request)) return callback(null, resolveMpxWebpackPluginRequest(request, mpxWebpackPluginDir));
|
|
169
|
-
return originalResolve.call(this, context, request, callback);
|
|
170
|
-
};
|
|
171
|
-
wrappedResolve.__weappTwPatched = true;
|
|
172
|
-
loaderContext.resolve = wrappedResolve;
|
|
173
|
-
}
|
|
174
|
-
function setupMpxTailwindcssRedirect(pkgDir, enabled) {
|
|
175
|
-
if (enabled) installTailwindcssCssRedirect(pkgDir);
|
|
176
|
-
}
|
|
177
|
-
const CSS_EXT_RE = /\.css$/i;
|
|
178
|
-
function injectMpxCssRewritePreRules(compiler, loader, loaderOptions) {
|
|
179
|
-
var _compiler$options;
|
|
180
|
-
if (!loader) return;
|
|
181
|
-
const moduleOptions = (_compiler$options = compiler.options).module ?? (_compiler$options.module = { rules: [] });
|
|
182
|
-
moduleOptions.rules = moduleOptions.rules || [];
|
|
183
|
-
const createRule = (match) => ({
|
|
184
|
-
...match,
|
|
185
|
-
enforce: "pre",
|
|
186
|
-
use: [{
|
|
187
|
-
loader,
|
|
188
|
-
options: loaderOptions
|
|
189
|
-
}]
|
|
190
|
-
});
|
|
191
|
-
moduleOptions.rules.unshift(createRule({ resourceQuery: (query) => isMpxStyleResourceQuery(query) }), createRule({
|
|
192
|
-
test: CSS_EXT_RE,
|
|
193
|
-
resourceQuery: (query) => !isMpxStyleResourceQuery(query)
|
|
194
|
-
}));
|
|
195
|
-
}
|
|
196
|
-
//#endregion
|
|
197
17
|
//#region src/bundlers/webpack/BaseUnifiedPlugin/shared.ts
|
|
198
|
-
const MPX_STYLE_RESOURCE_QUERY_RE = /(?:\?|&)type=styles\b/;
|
|
199
18
|
function getCacheKey(filename) {
|
|
200
19
|
return filename;
|
|
201
20
|
}
|
|
@@ -203,12 +22,11 @@ function stripResourceQuery(resource) {
|
|
|
203
22
|
if (typeof resource !== "string") return resource;
|
|
204
23
|
return stripRequestQuery(resource);
|
|
205
24
|
}
|
|
206
|
-
function isCssLikeModuleResource(resource, cssMatcher
|
|
25
|
+
function isCssLikeModuleResource(resource, cssMatcher) {
|
|
207
26
|
if (typeof resource !== "string") return false;
|
|
208
27
|
const normalizedResource = stripResourceQuery(resource);
|
|
209
28
|
if (normalizedResource && cssMatcher(normalizedResource)) return true;
|
|
210
29
|
if (isSourceStyleRequest(resource)) return true;
|
|
211
|
-
if (appType === "mpx") return MPX_STYLE_RESOURCE_QUERY_RE.test(resource);
|
|
212
30
|
return false;
|
|
213
31
|
}
|
|
214
32
|
function hasLoaderEntry(entries, target) {
|
|
@@ -352,6 +170,11 @@ function hasMissingRuntimeCandidates(classSet, candidates) {
|
|
|
352
170
|
for (const candidate of candidates) if (isRuntimeTransformCandidate(candidate) && !classSet.has(candidate)) return true;
|
|
353
171
|
return false;
|
|
354
172
|
}
|
|
173
|
+
function hasStaleRuntimeCandidates(classSet, candidates) {
|
|
174
|
+
if (!classSet || !candidates) return false;
|
|
175
|
+
for (const candidate of classSet) if (isRuntimeTransformCandidate(candidate) && !candidates.has(candidate)) return true;
|
|
176
|
+
return false;
|
|
177
|
+
}
|
|
355
178
|
function resolveGeneratedCssRuntimeCandidates(source, fallbackClassSet) {
|
|
356
179
|
const classSet = collectGeneratedCssRuntimeCandidates(source);
|
|
357
180
|
if (classSet.size > 0 || fallbackClassSet === void 0) return classSet;
|
|
@@ -390,6 +213,11 @@ function resolveWebpackGeneratorRawSource(rawSource, cssHandlerOptions) {
|
|
|
390
213
|
if (sourceCss && (hasTailwindRootDirectives(sourceCss, { importFallback: true }) || hasTailwindSourceDirectives(sourceCss, { importFallback: true }) || hasTailwindApplyDirective(sourceCss) || hasTailwindGeneratedCss(sourceCss) || hasTailwindGeneratedCssMarkers(sourceCss))) return sourceCss;
|
|
391
214
|
return rawSource;
|
|
392
215
|
}
|
|
216
|
+
function shouldConsumeWebpackLoaderGeneratedCss(options) {
|
|
217
|
+
if (!options.shouldRegenerateExplicitTailwindV4CssSource) return true;
|
|
218
|
+
if (options.watchMode === true && options.loaderGeneratedClassSet && options.sourceCandidates && (hasMissingRuntimeCandidates(options.loaderGeneratedClassSet, options.sourceCandidates) || hasStaleRuntimeCandidates(options.loaderGeneratedClassSet, options.sourceCandidates))) return false;
|
|
219
|
+
return options.hasBundlerGeneratedCssMarker;
|
|
220
|
+
}
|
|
393
221
|
function hasUsableWebpackGeneratorCssSources(cssSources) {
|
|
394
222
|
return Array.isArray(cssSources) && cssSources.some((source) => typeof source?.css === "string" && source.css.length > 0);
|
|
395
223
|
}
|
|
@@ -441,7 +269,8 @@ function hasProcessedCssAssetUrl(css) {
|
|
|
441
269
|
return /url\(\s*["']?data:/i.test(css);
|
|
442
270
|
}
|
|
443
271
|
function shouldUseWebpackAssetAsGeneratorUserCss(rawSource, generatorRawSource, options = {}) {
|
|
444
|
-
|
|
272
|
+
const rawMarkers = collectWebpackAssetUserCssMarkers(rawSource);
|
|
273
|
+
return rawSource !== generatorRawSource && (options.processed === true || !rawSource.includes("data:")) && !hasTailwindRootDirectives(rawSource, { importFallback: true }) && !hasTailwindSourceDirectives(rawSource, { importFallback: true }) && !hasTailwindApplyDirective(rawSource) && rawMarkers.size > 0 && !isOnlyWebpackTailwindGeneratedPreflightCss(rawSource) && (!hasTailwindGeneratedCssMarkers(rawSource) || hasAdditionalWebpackAssetUserCssMarkers(rawSource, generatorRawSource));
|
|
445
274
|
}
|
|
446
275
|
function collectWebpackAssetUserCssMarkers(source) {
|
|
447
276
|
const markers = /* @__PURE__ */ new Set();
|
|
@@ -463,6 +292,44 @@ function collectWebpackAssetUserCssMarkers(source) {
|
|
|
463
292
|
} catch {}
|
|
464
293
|
return markers;
|
|
465
294
|
}
|
|
295
|
+
function hasWebpackClassSelector(selector) {
|
|
296
|
+
return /(?:^|[^\w-])\.[_a-z\u00A0-\uFFFF\\-]/i.test(selector);
|
|
297
|
+
}
|
|
298
|
+
function isWebpackKeyframesRule(rule) {
|
|
299
|
+
let parent = rule.parent;
|
|
300
|
+
while (parent) {
|
|
301
|
+
if (parent.type === "atrule" && parent.name.endsWith("keyframes")) return true;
|
|
302
|
+
parent = parent.parent;
|
|
303
|
+
}
|
|
304
|
+
return false;
|
|
305
|
+
}
|
|
306
|
+
function collectWebpackBareSelectorUserCss(source) {
|
|
307
|
+
try {
|
|
308
|
+
const root = postcss.parse(removeTailwindSourceDirectives(stripTailwindSourceMediaFragments(removeTailwindV4GeneratorAtRules(source)), { importFallback: true }));
|
|
309
|
+
let changed = false;
|
|
310
|
+
root.walkAtRules((rule) => {
|
|
311
|
+
if (rule.name === "import" || rule.name === "font-face" || rule.name.endsWith("keyframes")) {
|
|
312
|
+
rule.remove();
|
|
313
|
+
changed = true;
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
root.walkRules((rule) => {
|
|
317
|
+
if (isWebpackKeyframesRule(rule) || rule.selectors.some((selector) => hasWebpackClassSelector(selector))) {
|
|
318
|
+
rule.remove();
|
|
319
|
+
changed = true;
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
root.walkAtRules((rule) => {
|
|
323
|
+
if (rule.nodes !== void 0 && rule.nodes.length === 0) {
|
|
324
|
+
rule.remove();
|
|
325
|
+
changed = true;
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
return changed ? root.toString() : source;
|
|
329
|
+
} catch {
|
|
330
|
+
return "";
|
|
331
|
+
}
|
|
332
|
+
}
|
|
466
333
|
const WEBPACK_TAILWIND_GENERATED_LAYER_NAMES = /* @__PURE__ */ new Set([
|
|
467
334
|
"theme",
|
|
468
335
|
"base",
|
|
@@ -471,6 +338,26 @@ const WEBPACK_TAILWIND_GENERATED_LAYER_NAMES = /* @__PURE__ */ new Set([
|
|
|
471
338
|
const WEBPACK_TAILWIND_UTILITY_RULE_MARKER_RE = /(?:^|[^\w-])\.[^,{]{0,512}(?:\\:|\\\[|\\#)/;
|
|
472
339
|
const WEBPACK_TAILWIND_UTILITY_PREFIX_RE = /^\.(?:-?(?:bg|text|border|ring|shadow|drop-shadow|[pmwhz]|px|py|pt|pr|pb|pl|mx|my|mt|mr|mb|ml|min-w|min-h|max-w|max-h|flex|grid|inline|block|hidden|rounded|opacity|translate|scale|rotate|skew|top|right|bottom|left|inset|gap|font|leading|tracking|underline|container)(?:[\-\\{]|$)|\\\[)/;
|
|
473
340
|
const WEBPACK_TAILWIND_BANNER_RE = /tailwindcss v4\./;
|
|
341
|
+
const WEBPACK_TAILWIND_PREFLIGHT_SELECTORS = /* @__PURE__ */ new Set([
|
|
342
|
+
"*",
|
|
343
|
+
":after",
|
|
344
|
+
":before",
|
|
345
|
+
"::after",
|
|
346
|
+
"::before",
|
|
347
|
+
"::backdrop",
|
|
348
|
+
"view",
|
|
349
|
+
"text"
|
|
350
|
+
]);
|
|
351
|
+
const WEBPACK_TAILWIND_PREFLIGHT_PROPS = /* @__PURE__ */ new Set([
|
|
352
|
+
"box-sizing",
|
|
353
|
+
"border",
|
|
354
|
+
"border-width",
|
|
355
|
+
"border-style",
|
|
356
|
+
"border-color",
|
|
357
|
+
"margin",
|
|
358
|
+
"padding"
|
|
359
|
+
]);
|
|
360
|
+
const WEBPACK_TAILWIND_THEME_TOKEN_RE = /^--(?:tw-|color-|spacing|breakpoint-|container-|text-|font-|tracking-|leading-|radius-|shadow-|inset-shadow-|drop-shadow-|ease-|animate-|blur-|perspective-|aspect-|default-)/;
|
|
474
361
|
function parseWebpackCssLayerNames(params) {
|
|
475
362
|
return params.split(",").map((name) => name.trim()).filter(Boolean);
|
|
476
363
|
}
|
|
@@ -506,18 +393,21 @@ function removeWebpackTailwindGeneratedAssetCss(source) {
|
|
|
506
393
|
return;
|
|
507
394
|
}
|
|
508
395
|
if (shouldRemoveLayer && !names.includes("utilities")) {
|
|
509
|
-
rule.
|
|
510
|
-
|
|
396
|
+
for (const child of [...rule.nodes ?? []]) if (isWebpackTailwindGeneratedLayerNode(child, names)) {
|
|
397
|
+
child.remove();
|
|
398
|
+
changed = true;
|
|
399
|
+
}
|
|
400
|
+
if (rule.nodes?.length === 0) {
|
|
401
|
+
rule.remove();
|
|
402
|
+
changed = true;
|
|
403
|
+
}
|
|
511
404
|
return;
|
|
512
405
|
}
|
|
513
406
|
if (shouldRemoveLayer) {
|
|
514
|
-
rule.
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
changed = true;
|
|
519
|
-
}
|
|
520
|
-
});
|
|
407
|
+
for (const child of [...rule.nodes ?? []]) if (isWebpackTailwindGeneratedLayerNode(child, names)) {
|
|
408
|
+
child.remove();
|
|
409
|
+
changed = true;
|
|
410
|
+
}
|
|
521
411
|
if (rule.nodes?.length === 0) {
|
|
522
412
|
rule.remove();
|
|
523
413
|
changed = true;
|
|
@@ -527,7 +417,7 @@ function removeWebpackTailwindGeneratedAssetCss(source) {
|
|
|
527
417
|
root.walkRules((rule) => {
|
|
528
418
|
if (rule.parent?.type === "atrule" && rule.parent.name === "layer") return;
|
|
529
419
|
const selector = rule.selector.trim();
|
|
530
|
-
if (WEBPACK_TAILWIND_UTILITY_RULE_MARKER_RE.test(selector)) {
|
|
420
|
+
if (WEBPACK_TAILWIND_UTILITY_RULE_MARKER_RE.test(selector) || isWebpackTailwindGeneratedPreflightRule(rule)) {
|
|
531
421
|
rule.remove();
|
|
532
422
|
changed = true;
|
|
533
423
|
}
|
|
@@ -550,14 +440,59 @@ function removeWebpackTailwindGeneratedAssetCss(source) {
|
|
|
550
440
|
}
|
|
551
441
|
}
|
|
552
442
|
function isWebpackTailwindGeneratedPrefixNode(node) {
|
|
553
|
-
if (node.type === "rule") return node
|
|
443
|
+
if (node.type === "rule") return isWebpackTailwindGeneratedRule(node, [
|
|
444
|
+
"theme",
|
|
445
|
+
"base",
|
|
446
|
+
"utilities"
|
|
447
|
+
], true);
|
|
554
448
|
if (node.type !== "atrule") return false;
|
|
555
449
|
const names = node.name === "layer" ? parseWebpackCssLayerNames(node.params) : [];
|
|
556
450
|
if (node.name === "property" && node.params.trim().startsWith("--tw-")) return true;
|
|
557
|
-
if (names.length > 0 && names.every((name) => WEBPACK_TAILWIND_GENERATED_LAYER_NAMES.has(name)))
|
|
451
|
+
if (names.length > 0 && names.every((name) => WEBPACK_TAILWIND_GENERATED_LAYER_NAMES.has(name))) {
|
|
452
|
+
if (node.nodes === void 0) return true;
|
|
453
|
+
return node.nodes.length > 0 && node.nodes.every((child) => isWebpackTailwindGeneratedLayerNode(child, names));
|
|
454
|
+
}
|
|
558
455
|
if (node.nodes === void 0 || node.nodes.length === 0) return false;
|
|
559
456
|
return node.nodes.every((child) => isWebpackTailwindGeneratedPrefixNode(child));
|
|
560
457
|
}
|
|
458
|
+
function isWebpackTailwindGeneratedLayerNode(node, layerNames) {
|
|
459
|
+
if (node.type === "rule") return isWebpackTailwindGeneratedRule(node, layerNames, false);
|
|
460
|
+
if (node.type !== "atrule") return false;
|
|
461
|
+
if (node.name === "property" && node.params.trim().startsWith("--tw-")) return true;
|
|
462
|
+
if (node.nodes === void 0 || node.nodes.length === 0) return false;
|
|
463
|
+
return node.nodes.every((child) => isWebpackTailwindGeneratedLayerNode(child, layerNames));
|
|
464
|
+
}
|
|
465
|
+
function isWebpackTailwindGeneratedRule(rule, layerNames, includePrefix) {
|
|
466
|
+
const selectors = rule.selectors ?? [rule.selector];
|
|
467
|
+
if (selectors.every((selector) => isWebpackTailwindGeneratedUtilitySelector(selector.trim(), includePrefix))) return true;
|
|
468
|
+
if (selectors.every((selector) => isWebpackTailwindGeneratedUtilitySelector(selector.trim(), true))) return true;
|
|
469
|
+
if (layerNames.includes("theme") && isWebpackTailwindGeneratedThemeRule(rule)) return true;
|
|
470
|
+
if (layerNames.includes("base") && isWebpackTailwindGeneratedPreflightRule(rule)) return true;
|
|
471
|
+
return false;
|
|
472
|
+
}
|
|
473
|
+
function isWebpackTailwindGeneratedThemeRule(rule) {
|
|
474
|
+
const declarations = (rule.nodes ?? []).filter((node) => node.type === "decl");
|
|
475
|
+
return declarations.length > 0 && declarations.every((decl) => WEBPACK_TAILWIND_THEME_TOKEN_RE.test(decl.prop) || decl.value.includes("--theme("));
|
|
476
|
+
}
|
|
477
|
+
function isWebpackTailwindGeneratedPreflightRule(rule) {
|
|
478
|
+
const selectors = rule.selectors ?? [rule.selector];
|
|
479
|
+
const declarations = (rule.nodes ?? []).filter((node) => node.type === "decl");
|
|
480
|
+
return selectors.length > 0 && declarations.length > 0 && selectors.every((selector) => {
|
|
481
|
+
const normalized = selector.trim().replace(/\s+/g, " ");
|
|
482
|
+
return WEBPACK_TAILWIND_PREFLIGHT_SELECTORS.has(normalized);
|
|
483
|
+
}) && declarations.every((decl) => WEBPACK_TAILWIND_PREFLIGHT_PROPS.has(decl.prop));
|
|
484
|
+
}
|
|
485
|
+
function isOnlyWebpackTailwindGeneratedPreflightCss(source) {
|
|
486
|
+
try {
|
|
487
|
+
const nodes = postcss.parse(source).nodes ?? [];
|
|
488
|
+
return nodes.length > 0 && nodes.every((node) => {
|
|
489
|
+
if (node.type === "rule") return isWebpackTailwindGeneratedPreflightRule(node);
|
|
490
|
+
return node.type === "atrule" && (node.nodes === void 0 || node.nodes.length === 0);
|
|
491
|
+
});
|
|
492
|
+
} catch {
|
|
493
|
+
return false;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
561
496
|
function isWebpackTailwindGeneratedUtilitySelector(selector, includePrefix) {
|
|
562
497
|
return WEBPACK_TAILWIND_UTILITY_RULE_MARKER_RE.test(selector) || includePrefix && WEBPACK_TAILWIND_UTILITY_PREFIX_RE.test(selector);
|
|
563
498
|
}
|
|
@@ -869,6 +804,26 @@ function stringifyWebpackSourceLike(source) {
|
|
|
869
804
|
}
|
|
870
805
|
//#endregion
|
|
871
806
|
//#region src/bundlers/webpack/BaseUnifiedPlugin/v5-assets/css-source-resolvers.ts
|
|
807
|
+
function normalizeWebpackCssSourceRef(file) {
|
|
808
|
+
return file.replaceAll("\\", "/");
|
|
809
|
+
}
|
|
810
|
+
function collectWebpackCssTokenSourceRefs(source) {
|
|
811
|
+
const refs = /* @__PURE__ */ new Set();
|
|
812
|
+
for (const line of source.split("\n")) {
|
|
813
|
+
if (!line.includes("/* tokens:") || !line.includes("<=")) continue;
|
|
814
|
+
const traceStart = line.indexOf("<=");
|
|
815
|
+
const traceEnd = line.indexOf("*/", traceStart);
|
|
816
|
+
const trace = line.slice(traceStart + 2, traceEnd >= 0 ? traceEnd : void 0);
|
|
817
|
+
for (const segment of trace.split("|")) {
|
|
818
|
+
const sourceList = segment.replace(/^[^<]*<=\s*/, "").split(",");
|
|
819
|
+
for (const ref of sourceList) {
|
|
820
|
+
const normalizedRef = ref.trim();
|
|
821
|
+
if (normalizedRef) refs.add(normalizeWebpackCssSourceRef(normalizedRef));
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
return refs;
|
|
826
|
+
}
|
|
872
827
|
function createWebpackCssSourceResolvers(options) {
|
|
873
828
|
const { activeWebpackAssetResourceFiles, appType, compilerOptions, compilation, cssAssetResources, cssHandlerOptionsCache, cssSources, cssUserHandlerOptionsCache, groupedCssEntriesLength, singleCssAssetFile, isWebGeneratorTarget, outputDir, runtimeState } = options;
|
|
874
829
|
const hasConfiguredTailwindV4SourceRoots = () => {
|
|
@@ -936,6 +891,19 @@ function createWebpackCssSourceResolvers(options) {
|
|
|
936
891
|
return activeAssetResource;
|
|
937
892
|
}
|
|
938
893
|
if (rawSource) {
|
|
894
|
+
const tokenSourceRefs = collectWebpackCssTokenSourceRefs(rawSource);
|
|
895
|
+
if (tokenSourceRefs.size > 0) {
|
|
896
|
+
const tokenSourceMatches = [...cssSources.keys()].filter((sourceFile) => {
|
|
897
|
+
const relativeSourceFile = normalizeWebpackCssSourceRef(path.relative(compilerOptions.tailwindcssBasedir, sourceFile));
|
|
898
|
+
const absoluteSourceFile = normalizeWebpackCssSourceRef(path.resolve(sourceFile));
|
|
899
|
+
return tokenSourceRefs.has(relativeSourceFile) || tokenSourceRefs.has(absoluteSourceFile);
|
|
900
|
+
}).sort();
|
|
901
|
+
if (tokenSourceMatches.length === 1) {
|
|
902
|
+
const sourceFile = tokenSourceMatches[0];
|
|
903
|
+
activeWebpackCssSourceFiles.add(sourceFile);
|
|
904
|
+
return sourceFile;
|
|
905
|
+
}
|
|
906
|
+
}
|
|
939
907
|
const representedTailwindSourceMatches = [...cssSources.entries()].filter(([, source]) => isWebpackCssSourceRepresentedInAsset(rawSource, source.css)).map(([sourceFile]) => ({
|
|
940
908
|
sourceFile,
|
|
941
909
|
score: scoreTailwindV4CssSourceFileMatch(file, sourceFile, {
|
|
@@ -1696,7 +1664,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
1696
1664
|
return rawSource;
|
|
1697
1665
|
};
|
|
1698
1666
|
const chunkHash = assetHashByChunk.get(file);
|
|
1699
|
-
const cssHandlerOptionsForProcessedAsset = getCssHandlerOptions(file);
|
|
1667
|
+
const cssHandlerOptionsForProcessedAsset = getCssHandlerOptions(file, readRawSource());
|
|
1700
1668
|
const processedCssAssetMetadata = { isMainCssChunk: cssHandlerOptionsForProcessedAsset.isMainChunk };
|
|
1701
1669
|
const processedSourceFile = cssHandlerOptionsForProcessedAsset.sourceOptions?.sourceFile;
|
|
1702
1670
|
const processedSourceCss = processedSourceFile ? cssSources.get(path.resolve(processedSourceFile))?.css : void 0;
|
|
@@ -1731,9 +1699,10 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
1731
1699
|
...source,
|
|
1732
1700
|
file: sourceFile
|
|
1733
1701
|
})), readCurrentProcessedRawSource()) !== void 0;
|
|
1702
|
+
const hasProcessedLoaderGeneratedUserCss = cachedSkipProcessedCssAsset === void 0 && processedLoaderGeneratedCss !== void 0 && hasAdditionalWebpackAssetUserCssMarkers(processedLoaderGeneratedCss.css, readCurrentProcessedRawSource());
|
|
1734
1703
|
const shouldFinalizeProcessedWebCssAsset = isWebGeneratorTarget && !shouldForceConfiguredMainCssGeneration && !shouldRegenerateProcessedTailwindV4SourceCss && hasTailwindSourceDirectives(readCurrentProcessedRawSource(), { importFallback: true });
|
|
1735
1704
|
const shouldPreserveFinalWebCssAsset = isWebGeneratorTarget && processedSourceFile === void 0 && !shouldForceConfiguredMainCssGeneration && (hasGeneratedCssMarker || hasTailwindGeneratedAssetCss);
|
|
1736
|
-
const shouldSkipKnownProcessedCssAsset = !shouldForceConfiguredMainCssGeneration && !shouldRegenerateProcessedTailwindV4SourceCss && !shouldRegenerateStaleProcessedWebCssAsset && (processedCssAssetKnown || isWebpackProcessedCssAsset?.(file, readCurrentProcessedRawSource(), processedCssAssetMetadata)) && !hasProcessedMainAssetUserCss && (!cssHandlerOptionsForProcessedAsset.isMainChunk || hasGeneratedCssMarker || hasTailwindGeneratedAssetCss);
|
|
1705
|
+
const shouldSkipKnownProcessedCssAsset = !shouldForceConfiguredMainCssGeneration && !shouldRegenerateProcessedTailwindV4SourceCss && !shouldRegenerateStaleProcessedWebCssAsset && (processedCssAssetKnown || isWebpackProcessedCssAsset?.(file, readCurrentProcessedRawSource(), processedCssAssetMetadata)) && !hasProcessedMainAssetUserCss && !hasProcessedLoaderGeneratedUserCss && (!cssHandlerOptionsForProcessedAsset.isMainChunk || hasGeneratedCssMarker || hasTailwindGeneratedAssetCss);
|
|
1737
1706
|
const shouldSkipProcessedCssAsset = cachedSkipProcessedCssAsset ?? (shouldFinalizeProcessedWebCssAsset || shouldPreserveFinalWebCssAsset || shouldSkipKnownProcessedCssAsset);
|
|
1738
1707
|
if (processedCssAssetKnown && cachedSkipProcessedCssAsset === void 0 && !shouldFinalizeProcessedWebCssAsset && !shouldPreserveFinalWebCssAsset) processedCssAssetSkipDecisionCache.set(processedCssDecisionCacheKey, shouldSkipProcessedCssAsset === true);
|
|
1739
1708
|
if (shouldSkipProcessedCssAsset) {
|
|
@@ -1758,12 +1727,29 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
1758
1727
|
},
|
|
1759
1728
|
transform: async () => {
|
|
1760
1729
|
const source = readCurrentProcessedRawSource();
|
|
1730
|
+
const processedBareSelectorSourceCss = processedSourceCss ?? (hasTailwindGeneratedAssetCss ? removeWebpackTailwindGeneratedAssetCss(source) : void 0);
|
|
1761
1731
|
const nextCss = stripTrailingLineWhitespace(finalizeCssAssetSource(hasTailwindGeneratedAssetCss && !hasGeneratedCssMarker ? isWebGeneratorTarget ? source : (await compilerOptions.styleHandler(source, cssHandlerOptionsForProcessedAsset)).css : source, {
|
|
1762
1732
|
cssPreflight: cssHandlerOptionsForProcessedAsset.isMainChunk,
|
|
1763
1733
|
generatedCss: hasGeneratedCssMarker || hasTailwindGeneratedAssetCss
|
|
1764
1734
|
}));
|
|
1735
|
+
const processedSourceBareUserCss = isWebGeneratorTarget || processedBareSelectorSourceCss === void 0 ? void 0 : createWebpackGeneratorUserCssSourceAppend({
|
|
1736
|
+
css: collectWebpackBareSelectorUserCss(processedBareSelectorSourceCss),
|
|
1737
|
+
processed: false
|
|
1738
|
+
});
|
|
1739
|
+
const finalizedProcessedSourceBareUserCss = processedSourceBareUserCss === void 0 ? "" : finalizeCssAssetSource(processedSourceBareUserCss.css, {
|
|
1740
|
+
cssPreflight: false,
|
|
1741
|
+
generatedCss: false
|
|
1742
|
+
});
|
|
1743
|
+
const missingProcessedSourceBareUserCss = finalizedProcessedSourceBareUserCss.trim().length === 0 ? "" : filterExistingCssRules(nextCss, finalizedProcessedSourceBareUserCss);
|
|
1744
|
+
const css = missingProcessedSourceBareUserCss.trim().length === 0 ? nextCss : createWebpackGeneratorUserCssSourceAppend({
|
|
1745
|
+
css: nextCss,
|
|
1746
|
+
processed: true
|
|
1747
|
+
}, {
|
|
1748
|
+
css: missingProcessedSourceBareUserCss,
|
|
1749
|
+
processed: true
|
|
1750
|
+
}).css;
|
|
1765
1751
|
debug("css skip webpack-loader-pipeline asset: %s", file);
|
|
1766
|
-
return { result: new ConcatSource(finalizeTracedCss(
|
|
1752
|
+
return { result: new ConcatSource(finalizeTracedCss(css, cssHandlerOptionsForProcessedAsset)) };
|
|
1767
1753
|
}
|
|
1768
1754
|
});
|
|
1769
1755
|
}, cssTaskFactories);
|
|
@@ -1832,7 +1818,14 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
1832
1818
|
const loaderGeneratedCss = sourceFile && !isWebGeneratorTarget ? generatedCssSources.get(path.resolve(sourceFile)) : void 0;
|
|
1833
1819
|
const sourceCss = sourceFile ? cssSources.get(path.resolve(sourceFile))?.css : void 0;
|
|
1834
1820
|
const shouldRegenerateExplicitTailwindV4CssSource = sourceCss !== void 0 && (hasTailwindSourceDirectives(sourceCss, { importFallback: true }) || sourceCss.includes("@config"));
|
|
1835
|
-
|
|
1821
|
+
const explicitTailwindV4SourceCandidates = shouldRegenerateExplicitTailwindV4CssSource && sourceCss && sourceFile && webpackSourceCandidates?.getSourceCandidatesForEntries ? await resolveTailwindV4EntriesFromCssCached(sourceCss, path.dirname(sourceFile)).then((resolved) => resolved?.entries ? webpackSourceCandidates.getSourceCandidatesForEntries(resolved.entries) : void 0) : void 0;
|
|
1822
|
+
if (loaderGeneratedCss && shouldConsumeWebpackLoaderGeneratedCss({
|
|
1823
|
+
hasBundlerGeneratedCssMarker: hasBundlerGeneratedCssMarker(currentRawSource),
|
|
1824
|
+
loaderGeneratedClassSet: loaderGeneratedCss.classSet,
|
|
1825
|
+
sourceCandidates: explicitTailwindV4SourceCandidates,
|
|
1826
|
+
shouldRegenerateExplicitTailwindV4CssSource,
|
|
1827
|
+
watchMode
|
|
1828
|
+
})) {
|
|
1836
1829
|
for (const className of loaderGeneratedCss.classSet) {
|
|
1837
1830
|
generatorRuntimeSet.add(className);
|
|
1838
1831
|
transformRuntimeSet.add(className);
|
|
@@ -1841,16 +1834,49 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
1841
1834
|
const currentRawSourceWithoutBundlerMarkers = stripBundlerGeneratedCssMarkers(currentRawSource);
|
|
1842
1835
|
const currentAssetHasProcessedUrl = hasProcessedCssAssetUrl(currentRawSourceWithoutBundlerMarkers) && currentRawSourceWithoutBundlerMarkers !== loaderGeneratedCss.css;
|
|
1843
1836
|
const currentAssetUserCss = currentAssetHasProcessedUrl ? currentRawSourceWithoutBundlerMarkers : shouldUseWebpackAssetAsGeneratorUserCss(currentRawSourceWithoutBundlerMarkers, loaderGeneratedCss.css, { processed: true }) ? removeGeneratedSelectorCompatCss(currentRawSourceWithoutBundlerMarkers, loaderGeneratedCss.css) : void 0;
|
|
1844
|
-
const
|
|
1845
|
-
|
|
1837
|
+
const isConfiguredMainCssSource = configuredMainCssEntryFiles.some((entry) => path.resolve(entry) === path.resolve(sourceFile));
|
|
1838
|
+
const loaderGeneratedCssWithoutMarkers = stripBundlerGeneratedCssMarkers(loaderGeneratedCss.css);
|
|
1839
|
+
const currentAssetUserCssWithoutMarkers = currentAssetUserCss === void 0 ? "" : stripBundlerGeneratedCssMarkers(currentAssetUserCss);
|
|
1840
|
+
const currentAssetMissingUserCss = !(currentAssetUserCssWithoutMarkers.trim().length > 0 && !isCommentOnlyCss(currentAssetUserCssWithoutMarkers)) ? "" : filterExistingCssRules(currentAssetUserCssWithoutMarkers, loaderGeneratedCssWithoutMarkers);
|
|
1841
|
+
if (isConfiguredMainCssSource && !cssHandlerOptions.isMainChunk && (currentAssetMissingUserCss.trim().length === 0 || isCommentOnlyCss(currentAssetMissingUserCss))) {
|
|
1842
|
+
debug("css skip duplicate webpack loader main generation: %s <- %s", file, sourceFile);
|
|
1843
|
+
return { result: new ConcatSource(finalizeTracedCss("", cssHandlerOptions)) };
|
|
1844
|
+
}
|
|
1845
|
+
const finalizedLoaderCss = finalizeCssAssetSource(currentAssetUserCss === void 0 ? loaderGeneratedCss.css : createWebpackGeneratorUserCssSourceAppend({
|
|
1846
|
+
css: currentAssetUserCss === void 0 ? loaderGeneratedCss.css : currentAssetHasProcessedUrl ? removeGeneratedSelectorCompatCss(loaderGeneratedCss.css, currentAssetUserCss) : filterExistingCssRules(currentAssetUserCss, loaderGeneratedCss.css),
|
|
1846
1847
|
processed: true
|
|
1847
|
-
}, {
|
|
1848
|
+
}, currentAssetUserCss === void 0 ? void 0 : {
|
|
1848
1849
|
css: currentAssetUserCss,
|
|
1849
1850
|
processed: true
|
|
1850
1851
|
}).css, {
|
|
1851
1852
|
cssPreflight: cssHandlerOptions.isMainChunk,
|
|
1852
1853
|
generatedCss: true
|
|
1853
|
-
})
|
|
1854
|
+
});
|
|
1855
|
+
const loaderSourceBareUserCss = isWebGeneratorTarget ? void 0 : createWebpackGeneratorUserCssSourceAppend(...[currentAssetUserCss === void 0 ? void 0 : {
|
|
1856
|
+
css: currentAssetUserCss,
|
|
1857
|
+
processed: true
|
|
1858
|
+
}, sourceCss === void 0 ? void 0 : {
|
|
1859
|
+
css: sourceCss,
|
|
1860
|
+
processed: false
|
|
1861
|
+
}].map((source) => {
|
|
1862
|
+
if (source === void 0) return;
|
|
1863
|
+
return {
|
|
1864
|
+
css: collectWebpackBareSelectorUserCss(source.css),
|
|
1865
|
+
processed: source.processed
|
|
1866
|
+
};
|
|
1867
|
+
}));
|
|
1868
|
+
const finalizedLoaderSourceBareUserCss = loaderSourceBareUserCss === void 0 ? "" : finalizeCssAssetSource(loaderSourceBareUserCss.css, {
|
|
1869
|
+
cssPreflight: false,
|
|
1870
|
+
generatedCss: false
|
|
1871
|
+
});
|
|
1872
|
+
const missingLoaderSourceBareUserCss = finalizedLoaderSourceBareUserCss.trim().length === 0 ? "" : filterExistingCssRules(finalizedLoaderCss, finalizedLoaderSourceBareUserCss);
|
|
1873
|
+
const css = finalizeTracedCss(missingLoaderSourceBareUserCss.trim().length === 0 ? finalizedLoaderCss : createWebpackGeneratorUserCssSourceAppend({
|
|
1874
|
+
css: finalizedLoaderCss,
|
|
1875
|
+
processed: true
|
|
1876
|
+
}, {
|
|
1877
|
+
css: missingLoaderSourceBareUserCss,
|
|
1878
|
+
processed: true
|
|
1879
|
+
}).css, cssHandlerOptions);
|
|
1854
1880
|
debug("css consume webpack loader generation: %s <- %s", file, sourceFile);
|
|
1855
1881
|
return { result: new ConcatSource(css) };
|
|
1856
1882
|
}
|
|
@@ -1941,7 +1967,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
1941
1967
|
generated = void 0;
|
|
1942
1968
|
}
|
|
1943
1969
|
else debug("css generator skipped for unmatched webpack main css asset: %s", file);
|
|
1944
|
-
const
|
|
1970
|
+
const finalizedGeneratedCss = generated ? finalizeCssAssetSource(isWebGeneratorTarget && currentRawSource.includes("tailwindcss v4.") ? createWebpackGeneratorUserCssSourceAppend({
|
|
1945
1971
|
css: generated.css,
|
|
1946
1972
|
processed: true
|
|
1947
1973
|
}, {
|
|
@@ -1950,7 +1976,36 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
1950
1976
|
})?.css ?? generated.css : generated.css, {
|
|
1951
1977
|
cssPreflight: cssHandlerOptions.isMainChunk,
|
|
1952
1978
|
generatedCss: true
|
|
1953
|
-
}) : isWebGeneratorTarget ? finalizeCssAssetSource(generatorRawSource, { generatedCss: false }) : finalizeCssAssetSource((await compilerOptions.styleHandler(generatorRawSource, cssHandlerOptions)).css, { generatedCss: false })
|
|
1979
|
+
}) : isWebGeneratorTarget ? finalizeCssAssetSource(generatorRawSource, { generatedCss: false }) : finalizeCssAssetSource((await compilerOptions.styleHandler(generatorRawSource, cssHandlerOptions)).css, { generatedCss: false });
|
|
1980
|
+
const sourceBareUserCss = isWebGeneratorTarget ? void 0 : createWebpackGeneratorUserCssSourceAppend(...[
|
|
1981
|
+
userRawSource,
|
|
1982
|
+
sourceCss === void 0 ? void 0 : {
|
|
1983
|
+
css: sourceCss,
|
|
1984
|
+
processed: sourceCssProcessed
|
|
1985
|
+
},
|
|
1986
|
+
{
|
|
1987
|
+
css: generatorRawSource,
|
|
1988
|
+
processed: false
|
|
1989
|
+
}
|
|
1990
|
+
].map((source) => {
|
|
1991
|
+
if (source === void 0) return;
|
|
1992
|
+
return {
|
|
1993
|
+
css: collectWebpackBareSelectorUserCss(source.css),
|
|
1994
|
+
processed: source.processed
|
|
1995
|
+
};
|
|
1996
|
+
}));
|
|
1997
|
+
const finalizedSourceBareUserCss = sourceBareUserCss === void 0 ? "" : finalizeCssAssetSource(sourceBareUserCss.css, {
|
|
1998
|
+
cssPreflight: false,
|
|
1999
|
+
generatedCss: false
|
|
2000
|
+
});
|
|
2001
|
+
const missingSourceBareUserCss = finalizedSourceBareUserCss.trim().length === 0 ? "" : filterExistingCssRules(finalizedGeneratedCss, finalizedSourceBareUserCss);
|
|
2002
|
+
const source = new ConcatSource(finalizeTracedCss(missingSourceBareUserCss.trim().length === 0 ? finalizedGeneratedCss : createWebpackGeneratorUserCssSourceAppend({
|
|
2003
|
+
css: finalizedGeneratedCss,
|
|
2004
|
+
processed: true
|
|
2005
|
+
}, {
|
|
2006
|
+
css: missingSourceBareUserCss,
|
|
2007
|
+
processed: true
|
|
2008
|
+
}).css, cssHandlerOptions));
|
|
1954
2009
|
if (generated) {
|
|
1955
2010
|
for (const className of generated.classSet) generatorRuntimeSet.add(className);
|
|
1956
2011
|
debug("css handle via tailwind v%s engine(%s): %s", runtimeState.tailwindRuntime.majorVersion, generated.target, file);
|
|
@@ -1998,11 +2053,188 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
1998
2053
|
});
|
|
1999
2054
|
}
|
|
2000
2055
|
//#endregion
|
|
2001
|
-
//#region ../../node_modules/.pnpm/tsdown@0.22.3_oxc-resolver@11.20.0_tsx@4.
|
|
2056
|
+
//#region ../../node_modules/.pnpm/tsdown@0.22.3_oxc-resolver@11.20.0_tsx@4.23.0_typescript@6.0.3_unrun@0.2.37_synckit@0.1_d637bff48b9176e0fee6cca26dd9f301/node_modules/tsdown/esm-shims.js
|
|
2002
2057
|
const getFilename = () => fileURLToPath(import.meta.url);
|
|
2003
2058
|
const getDirname = () => path.dirname(getFilename());
|
|
2004
2059
|
const __dirname = /* @__PURE__ */ getDirname();
|
|
2005
2060
|
//#endregion
|
|
2061
|
+
//#region src/shared/tailwindcss-css-redirect.ts
|
|
2062
|
+
const moduleWithMutableResolve = Module;
|
|
2063
|
+
const patched = /* @__PURE__ */ new WeakSet();
|
|
2064
|
+
function installTailwindcssCssRedirect(pkgDir) {
|
|
2065
|
+
const target = path.join(pkgDir, "index.css");
|
|
2066
|
+
const original = moduleWithMutableResolve._resolveFilename;
|
|
2067
|
+
if (patched.has(original)) return;
|
|
2068
|
+
const replacements = /* @__PURE__ */ new Set(["tailwindcss", "tailwindcss$"]);
|
|
2069
|
+
const resolveTailwindcssCss = (request, parent, isMain, options) => {
|
|
2070
|
+
if (replacements.has(request)) return target;
|
|
2071
|
+
if (request.startsWith("tailwindcss/")) return path.join(pkgDir, request.slice(12));
|
|
2072
|
+
return original(request, parent, isMain, options);
|
|
2073
|
+
};
|
|
2074
|
+
moduleWithMutableResolve._resolveFilename = resolveTailwindcssCss;
|
|
2075
|
+
patched.add(moduleWithMutableResolve._resolveFilename);
|
|
2076
|
+
}
|
|
2077
|
+
//#endregion
|
|
2078
|
+
//#region src/shared/mpx.ts
|
|
2079
|
+
const localRequire = createRequire(import.meta.url);
|
|
2080
|
+
const MPX_STYLE_RESOURCE_QUERY_RE = /(?:^|[?&])type=styles(?:&|$)/;
|
|
2081
|
+
const MPX_WEBPACK_PLUGIN_PACKAGE_RE = /@mpxjs[\\/]webpack-plugin[\\/]package\.json$/;
|
|
2082
|
+
function isMpxStyleResourceQuery(query) {
|
|
2083
|
+
if (typeof query !== "string") return false;
|
|
2084
|
+
return MPX_STYLE_RESOURCE_QUERY_RE.test(query);
|
|
2085
|
+
}
|
|
2086
|
+
function getTailwindcssCssEntry(pkgDir) {
|
|
2087
|
+
return path.join(pkgDir, "index.css");
|
|
2088
|
+
}
|
|
2089
|
+
function resolveMpxWebpackPluginDir(compiler) {
|
|
2090
|
+
const candidates = [
|
|
2091
|
+
compiler?.context,
|
|
2092
|
+
compiler?.options?.context,
|
|
2093
|
+
process.cwd()
|
|
2094
|
+
].filter((item) => typeof item === "string" && item.length > 0);
|
|
2095
|
+
for (const candidate of candidates) try {
|
|
2096
|
+
const projectRequire = createRequire(path.join(candidate, "package.json"));
|
|
2097
|
+
return path.dirname(projectRequire.resolve("@mpxjs/webpack-plugin/package.json"));
|
|
2098
|
+
} catch {}
|
|
2099
|
+
const cachedPackageJson = Object.keys(localRequire.cache).find((file) => MPX_WEBPACK_PLUGIN_PACKAGE_RE.test(file));
|
|
2100
|
+
if (cachedPackageJson) return path.dirname(cachedPackageJson);
|
|
2101
|
+
try {
|
|
2102
|
+
return path.dirname(localRequire.resolve("@mpxjs/webpack-plugin/package.json"));
|
|
2103
|
+
} catch {
|
|
2104
|
+
return;
|
|
2105
|
+
}
|
|
2106
|
+
}
|
|
2107
|
+
function isMpxWebpackPluginRequest(request) {
|
|
2108
|
+
return request === "@mpxjs/webpack-plugin" || Boolean(request?.startsWith("@mpxjs/webpack-plugin/"));
|
|
2109
|
+
}
|
|
2110
|
+
function resolveMpxWebpackPluginRequest(request, mpxWebpackPluginDir) {
|
|
2111
|
+
if (request === "@mpxjs/webpack-plugin") return mpxWebpackPluginDir;
|
|
2112
|
+
return path.join(mpxWebpackPluginDir, request.slice(22));
|
|
2113
|
+
}
|
|
2114
|
+
function addMpxWebpackPluginAlias(alias, pkgDir) {
|
|
2115
|
+
const recordLoader = path.join(pkgDir, "lib/record-loader");
|
|
2116
|
+
const styleCompiler = path.join(pkgDir, "lib/style-compiler/index");
|
|
2117
|
+
const stripConditionalLoader = path.join(pkgDir, "lib/style-compiler/strip-conditional-loader");
|
|
2118
|
+
if (Array.isArray(alias)) alias.push({
|
|
2119
|
+
name: "@mpxjs/webpack-plugin/lib/record-loader",
|
|
2120
|
+
alias: recordLoader
|
|
2121
|
+
}, {
|
|
2122
|
+
name: "@mpxjs/webpack-plugin/lib/style-compiler/index",
|
|
2123
|
+
alias: styleCompiler
|
|
2124
|
+
}, {
|
|
2125
|
+
name: "@mpxjs/webpack-plugin/lib/style-compiler/strip-conditional-loader",
|
|
2126
|
+
alias: stripConditionalLoader
|
|
2127
|
+
}, {
|
|
2128
|
+
name: /^@mpxjs\/webpack-plugin\//,
|
|
2129
|
+
alias: pkgDir
|
|
2130
|
+
});
|
|
2131
|
+
else {
|
|
2132
|
+
alias["@mpxjs/webpack-plugin"] = pkgDir;
|
|
2133
|
+
alias["@mpxjs/webpack-plugin$"] = pkgDir;
|
|
2134
|
+
alias["@mpxjs/webpack-plugin/lib/record-loader"] = recordLoader;
|
|
2135
|
+
alias["@mpxjs/webpack-plugin/lib/style-compiler/index"] = styleCompiler;
|
|
2136
|
+
alias["@mpxjs/webpack-plugin/lib/style-compiler/strip-conditional-loader"] = stripConditionalLoader;
|
|
2137
|
+
}
|
|
2138
|
+
}
|
|
2139
|
+
function ensureResolveLoaderAlias(compiler, mpxWebpackPluginDir) {
|
|
2140
|
+
compiler.options.resolveLoader = compiler.options.resolveLoader || {};
|
|
2141
|
+
const alias = compiler.options.resolveLoader.alias ?? {};
|
|
2142
|
+
compiler.options.resolveLoader.alias = alias;
|
|
2143
|
+
addMpxWebpackPluginAlias(alias, mpxWebpackPluginDir);
|
|
2144
|
+
}
|
|
2145
|
+
function resolveMpxWebpackPluginRequire(compiler) {
|
|
2146
|
+
const candidates = [
|
|
2147
|
+
compiler?.context,
|
|
2148
|
+
compiler?.options?.context,
|
|
2149
|
+
process.cwd()
|
|
2150
|
+
].filter((item) => typeof item === "string" && item.length > 0);
|
|
2151
|
+
for (const candidate of candidates) try {
|
|
2152
|
+
const projectRequire = createRequire(path.join(candidate, "package.json"));
|
|
2153
|
+
projectRequire.resolve("@mpxjs/webpack-plugin/package.json");
|
|
2154
|
+
return projectRequire;
|
|
2155
|
+
} catch {}
|
|
2156
|
+
const cachedPackageJson = Object.keys(localRequire.cache).find((file) => MPX_WEBPACK_PLUGIN_PACKAGE_RE.test(file));
|
|
2157
|
+
if (cachedPackageJson) return createRequire(cachedPackageJson);
|
|
2158
|
+
return localRequire;
|
|
2159
|
+
}
|
|
2160
|
+
function patchMpxWebpackPluginNormalizeLib(compiler, mpxWebpackPluginDir) {
|
|
2161
|
+
if (!mpxWebpackPluginDir) return false;
|
|
2162
|
+
const projectRequire = resolveMpxWebpackPluginRequire(compiler);
|
|
2163
|
+
let normalize;
|
|
2164
|
+
try {
|
|
2165
|
+
normalize = projectRequire("@mpxjs/webpack-plugin/lib/utils/normalize");
|
|
2166
|
+
} catch {
|
|
2167
|
+
return false;
|
|
2168
|
+
}
|
|
2169
|
+
if (typeof normalize.lib !== "function") return false;
|
|
2170
|
+
if (normalize.lib.__weappTwPatched) return true;
|
|
2171
|
+
const wrappedLib = (file) => path.join(mpxWebpackPluginDir, "lib", file);
|
|
2172
|
+
wrappedLib.__weappTwPatched = true;
|
|
2173
|
+
wrappedLib.__weappTwOriginal = normalize.lib;
|
|
2174
|
+
normalize.lib = wrappedLib;
|
|
2175
|
+
return true;
|
|
2176
|
+
}
|
|
2177
|
+
function ensureMpxTailwindcssAliases(compiler, pkgDir) {
|
|
2178
|
+
const tailwindcssCssEntry = getTailwindcssCssEntry(pkgDir);
|
|
2179
|
+
compiler.options = compiler.options || {};
|
|
2180
|
+
compiler.options.resolve = compiler.options.resolve || {};
|
|
2181
|
+
const mpxWebpackPluginDir = resolveMpxWebpackPluginDir(compiler);
|
|
2182
|
+
patchMpxWebpackPluginNormalizeLib(compiler, mpxWebpackPluginDir);
|
|
2183
|
+
if (mpxWebpackPluginDir) ensureResolveLoaderAlias(compiler, mpxWebpackPluginDir);
|
|
2184
|
+
const alias = compiler.options.resolve.alias ?? {};
|
|
2185
|
+
compiler.options.resolve.alias = alias;
|
|
2186
|
+
if (Array.isArray(alias)) alias.push({
|
|
2187
|
+
name: "tailwindcss",
|
|
2188
|
+
alias: tailwindcssCssEntry
|
|
2189
|
+
}, {
|
|
2190
|
+
name: "tailwindcss$",
|
|
2191
|
+
alias: tailwindcssCssEntry
|
|
2192
|
+
});
|
|
2193
|
+
else {
|
|
2194
|
+
alias.tailwindcss = tailwindcssCssEntry;
|
|
2195
|
+
alias.tailwindcss$ = tailwindcssCssEntry;
|
|
2196
|
+
}
|
|
2197
|
+
if (mpxWebpackPluginDir) addMpxWebpackPluginAlias(alias, mpxWebpackPluginDir);
|
|
2198
|
+
return tailwindcssCssEntry;
|
|
2199
|
+
}
|
|
2200
|
+
function patchMpxLoaderResolve(loaderContext, pkgDir, enabled) {
|
|
2201
|
+
if (!enabled || typeof loaderContext.resolve !== "function") return;
|
|
2202
|
+
const originalResolve = loaderContext.resolve;
|
|
2203
|
+
if (originalResolve.__weappTwPatched) return;
|
|
2204
|
+
const tailwindcssCssEntry = getTailwindcssCssEntry(pkgDir);
|
|
2205
|
+
const mpxWebpackPluginDir = resolveMpxWebpackPluginDir(loaderContext);
|
|
2206
|
+
const wrappedResolve = function(context, request, callback) {
|
|
2207
|
+
if (request === "tailwindcss" || request === "tailwindcss$") return callback(null, tailwindcssCssEntry);
|
|
2208
|
+
if (request?.startsWith("tailwindcss/")) return callback(null, path.join(pkgDir, request.slice(12)));
|
|
2209
|
+
if (mpxWebpackPluginDir && isMpxWebpackPluginRequest(request)) return callback(null, resolveMpxWebpackPluginRequest(request, mpxWebpackPluginDir));
|
|
2210
|
+
return originalResolve.call(this, context, request, callback);
|
|
2211
|
+
};
|
|
2212
|
+
wrappedResolve.__weappTwPatched = true;
|
|
2213
|
+
loaderContext.resolve = wrappedResolve;
|
|
2214
|
+
}
|
|
2215
|
+
function setupMpxTailwindcssRedirect(pkgDir, enabled) {
|
|
2216
|
+
if (enabled) installTailwindcssCssRedirect(pkgDir);
|
|
2217
|
+
}
|
|
2218
|
+
const CSS_EXT_RE = /\.css$/i;
|
|
2219
|
+
function injectMpxCssRewritePreRules(compiler, loader, loaderOptions) {
|
|
2220
|
+
var _compiler$options;
|
|
2221
|
+
if (!loader) return;
|
|
2222
|
+
const moduleOptions = (_compiler$options = compiler.options).module ?? (_compiler$options.module = { rules: [] });
|
|
2223
|
+
moduleOptions.rules = moduleOptions.rules || [];
|
|
2224
|
+
const createRule = (match) => ({
|
|
2225
|
+
...match,
|
|
2226
|
+
enforce: "pre",
|
|
2227
|
+
use: [{
|
|
2228
|
+
loader,
|
|
2229
|
+
options: loaderOptions
|
|
2230
|
+
}]
|
|
2231
|
+
});
|
|
2232
|
+
moduleOptions.rules.unshift(createRule({ resourceQuery: (query) => isMpxStyleResourceQuery(query) }), createRule({
|
|
2233
|
+
test: CSS_EXT_RE,
|
|
2234
|
+
resourceQuery: (query) => !isMpxStyleResourceQuery(query)
|
|
2235
|
+
}));
|
|
2236
|
+
}
|
|
2237
|
+
//#endregion
|
|
2006
2238
|
//#region src/bundlers/webpack/loaders/runtime-registry.ts
|
|
2007
2239
|
const runtimeRegistryHolder = globalThis;
|
|
2008
2240
|
const runtimeRegistry = runtimeRegistryHolder.__WEAPP_TW_WEBPACK_LOADER_RUNTIME_REGISTRY__ ?? (runtimeRegistryHolder.__WEAPP_TW_WEBPACK_LOADER_RUNTIME_REGISTRY__ = /* @__PURE__ */ new Map());
|
|
@@ -2029,11 +2261,13 @@ function createPrioritizedFinder(targets) {
|
|
|
2029
2261
|
return -1;
|
|
2030
2262
|
};
|
|
2031
2263
|
}
|
|
2032
|
-
function
|
|
2033
|
-
|
|
2264
|
+
function createMpxLoaderAnchorFinders() {
|
|
2265
|
+
return {
|
|
2034
2266
|
findRewriteAnchor: createPrioritizedFinder(MPX_REWRITE_PRECEDENCE_LOADERS),
|
|
2035
2267
|
findClassSetAnchor: createFinder([MPX_STYLE_COMPILER_LOADER])
|
|
2036
2268
|
};
|
|
2269
|
+
}
|
|
2270
|
+
function createDefaultLoaderAnchorFinders() {
|
|
2037
2271
|
const fallbackFinder = createFinder(["postcss-loader"]);
|
|
2038
2272
|
return {
|
|
2039
2273
|
findRewriteAnchor: fallbackFinder,
|
|
@@ -2043,8 +2277,7 @@ function createLoaderAnchorFinders(appType) {
|
|
|
2043
2277
|
//#endregion
|
|
2044
2278
|
//#region src/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.ts
|
|
2045
2279
|
function setupWebpackV5Loaders(options) {
|
|
2046
|
-
const { compiler, options: compilerOptions, appType, weappTailwindcssPackageDir, shouldRewriteCssImports, runtimeLoaderPath, registerAutoCssSource, runtimeState, getClassSetInLoader, getRuntimeSetInLoader, markWebpackProcessedCssSource, markWebpackCssSourceModule, registerWebpackGeneratedCss, registerWebpackCssSourceFile, getRuntimeWatchDependencies, runtimeRegistryKey = `weapp-tailwindcss-${Date.now()}-${Math.random().toString(36).slice(2)}`, debug } = options;
|
|
2047
|
-
const isMpxApp = isMpx(appType);
|
|
2280
|
+
const { compiler, options: compilerOptions, appType, weappTailwindcssPackageDir, shouldRewriteCssImports, runtimeLoaderPath, registerAutoCssSource, runtimeState, getClassSetInLoader, getRuntimeSetInLoader, markWebpackProcessedCssSource, markWebpackCssSourceModule, registerWebpackGeneratedCss, registerWebpackCssSourceFile, getRuntimeWatchDependencies, loaderAnchorFinders = createDefaultLoaderAnchorFinders(), mpxCssImportRewrite = false, runtimeRegistryKey = `weapp-tailwindcss-${Date.now()}-${Math.random().toString(36).slice(2)}`, debug } = options;
|
|
2048
2281
|
const generatorTarget = compilerOptions.generator?.target ?? inferGeneratorTargetFromEnv();
|
|
2049
2282
|
const generatorBranch = resolveRuntimeBranch({
|
|
2050
2283
|
appType: compilerOptions.appType,
|
|
@@ -2053,7 +2286,7 @@ function setupWebpackV5Loaders(options) {
|
|
|
2053
2286
|
tailwindcssMajorVersion: runtimeState.tailwindRuntime.majorVersion,
|
|
2054
2287
|
uniAppX: compilerOptions.uniAppX
|
|
2055
2288
|
});
|
|
2056
|
-
if (shouldRewriteCssImports &&
|
|
2289
|
+
if (shouldRewriteCssImports && mpxCssImportRewrite) ensureMpxTailwindcssAliases(compiler, weappTailwindcssPackageDir);
|
|
2057
2290
|
const runtimeClassSetLoader = runtimeLoaderPath ?? path.resolve(__dirname, "./weapp-tw-runtime-classset-loader.js");
|
|
2058
2291
|
const shouldInjectRuntimeClassSetLoader = !generatorBranch.isWeb;
|
|
2059
2292
|
const shouldInjectCssImportRewriteLoader = shouldRewriteCssImports || !generatorBranch.isWeb || runtimeState.tailwindRuntime.majorVersion === 4;
|
|
@@ -2084,9 +2317,9 @@ function setupWebpackV5Loaders(options) {
|
|
|
2084
2317
|
};
|
|
2085
2318
|
compiler.hooks.watchClose?.tap?.(pluginName, cleanupWebpackLoaderRuntime);
|
|
2086
2319
|
compiler.hooks.shutdown?.tap?.(pluginName, cleanupWebpackLoaderRuntime);
|
|
2087
|
-
const { findRewriteAnchor, findClassSetAnchor } =
|
|
2320
|
+
const { findRewriteAnchor, findClassSetAnchor } = loaderAnchorFinders;
|
|
2088
2321
|
const cssImportRewriteLoaderOptions = runtimeLoaderRewriteOptions ? { tailwindcssImportRewriteRuntimeKey: runtimeRegistryKey } : void 0;
|
|
2089
|
-
if (runtimeCssImportRewriteLoader && shouldRewriteCssImports && cssImportRewriteLoaderOptions &&
|
|
2322
|
+
if (runtimeCssImportRewriteLoader && shouldRewriteCssImports && cssImportRewriteLoaderOptions && mpxCssImportRewrite) injectMpxCssRewritePreRules(compiler, runtimeCssImportRewriteLoader, cssImportRewriteLoaderOptions);
|
|
2090
2323
|
const createRuntimeClassSetLoaderEntry = () => ({
|
|
2091
2324
|
loader: runtimeClassSetLoader,
|
|
2092
2325
|
options: { weappTailwindcssRuntimeKey: runtimeRegistryKey },
|
|
@@ -2106,7 +2339,7 @@ function setupWebpackV5Loaders(options) {
|
|
|
2106
2339
|
compiler.hooks.compilation.tap(pluginName, (compilation) => {
|
|
2107
2340
|
NormalModule.getCompilationHooks(compilation).loader.tap(pluginName, (_loaderContext, module) => {
|
|
2108
2341
|
if (!(runtimeClassSetLoaderExists || runtimeCssImportRewriteLoaderExists)) return;
|
|
2109
|
-
patchMpxLoaderResolve(_loaderContext, weappTailwindcssPackageDir, shouldRewriteCssImports &&
|
|
2342
|
+
patchMpxLoaderResolve(_loaderContext, weappTailwindcssPackageDir, shouldRewriteCssImports && mpxCssImportRewrite);
|
|
2110
2343
|
const loaderEntries = module.loaders || [];
|
|
2111
2344
|
let rewriteAnchorIdx = findRewriteAnchor(loaderEntries);
|
|
2112
2345
|
const classSetAnchorIdx = findClassSetAnchor(loaderEntries);
|
|
@@ -2152,10 +2385,13 @@ function setupWebpackV5Loaders(options) {
|
|
|
2152
2385
|
});
|
|
2153
2386
|
}
|
|
2154
2387
|
//#endregion
|
|
2155
|
-
//#region src/bundlers/webpack/
|
|
2388
|
+
//#region src/bundlers/webpack/shared/create-framework-plugin.ts
|
|
2156
2389
|
const debug = createDebug();
|
|
2157
2390
|
const weappTailwindcssPackageDir = resolvePackageDir("weapp-tailwindcss");
|
|
2158
2391
|
const outputIgnoredPredicatePath = Symbol("weapp-tailwindcss.outputIgnoredPredicatePath");
|
|
2392
|
+
function shouldKeepPreviousWebpackCssSource(previous, next) {
|
|
2393
|
+
return next.processed === true && previous.processed === false;
|
|
2394
|
+
}
|
|
2159
2395
|
function normalizeIgnoredList(ignored) {
|
|
2160
2396
|
return (Array.isArray(ignored) ? [...ignored] : [ignored]).filter((item) => typeof item === "string" || item instanceof RegExp || typeof item === "function");
|
|
2161
2397
|
}
|
|
@@ -2215,32 +2451,40 @@ function setupWebpackWatchOutputIgnore(compiler) {
|
|
|
2215
2451
|
}
|
|
2216
2452
|
});
|
|
2217
2453
|
}
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
var WeappTailwindcss = class {
|
|
2224
|
-
constructor(options = {}) {
|
|
2454
|
+
function isInternalUserDefinedOptions(options) {
|
|
2455
|
+
return typeof options.onLoad === "function" && typeof options.mainCssChunkMatcher === "function" && typeof options.tailwindRuntime === "object" && typeof options.refreshTailwindcssRuntime === "function";
|
|
2456
|
+
}
|
|
2457
|
+
var WebpackFrameworkPlugin = class {
|
|
2458
|
+
constructor(options = {}, frameworkBranch) {
|
|
2225
2459
|
_defineProperty(this, "options", void 0);
|
|
2226
2460
|
_defineProperty(this, "appType", void 0);
|
|
2227
2461
|
_defineProperty(this, "hasInitialTailwindCssRoots", void 0);
|
|
2462
|
+
_defineProperty(this, "frameworkBranch", void 0);
|
|
2463
|
+
this.frameworkBranch = frameworkBranch;
|
|
2228
2464
|
this.hasInitialTailwindCssRoots = hasConfiguredTailwindV4CssRoots(options);
|
|
2229
|
-
this.options = getCompilerContext({
|
|
2465
|
+
this.options = isInternalUserDefinedOptions(options) ? options : getCompilerContext({
|
|
2230
2466
|
...options,
|
|
2231
2467
|
__internalDeferMissingCssEntriesWarning: true
|
|
2232
2468
|
});
|
|
2233
2469
|
this.appType = this.options.appType;
|
|
2234
2470
|
}
|
|
2235
2471
|
apply(compiler) {
|
|
2472
|
+
debug("apply webpack framework plugin framework=%s", this.frameworkBranch.frameworkName);
|
|
2236
2473
|
compiler.options = compiler.options || {};
|
|
2237
2474
|
const { disabled, onLoad, runtimeLoaderPath, tailwindRuntime, refreshTailwindcssRuntime, styleInjector } = this.options;
|
|
2238
2475
|
const initialTailwindRuntime = tailwindRuntime;
|
|
2239
2476
|
const refreshTailwindRuntime = refreshTailwindcssRuntime;
|
|
2240
2477
|
const disabledOptions = resolvePluginDisabledState(disabled);
|
|
2241
2478
|
const shouldRewriteCssImports = this.options.rewriteCssImports === true;
|
|
2242
|
-
const
|
|
2243
|
-
|
|
2479
|
+
const frameworkProfile = resolveWebpackFrameworkProfile({
|
|
2480
|
+
appType: this.appType,
|
|
2481
|
+
detectEnv: true,
|
|
2482
|
+
env: process.env,
|
|
2483
|
+
root: compiler.options.context ?? compiler.context,
|
|
2484
|
+
uniAppX: this.options.uniAppX
|
|
2485
|
+
});
|
|
2486
|
+
this.appType = frameworkProfile.appType ?? this.appType;
|
|
2487
|
+
if (shouldRewriteCssImports) this.frameworkBranch.setupCssImportRewriteRedirect?.(weappTailwindcssPackageDir);
|
|
2244
2488
|
if (disabledOptions.plugin) return;
|
|
2245
2489
|
if (initialTailwindRuntime.majorVersion !== 4) throw new Error("weapp-tailwindcss/webpack 新生成管线仅支持 Tailwind CSS v4,请升级 tailwindcss 或停留在旧版 weapp-tailwindcss。");
|
|
2246
2490
|
setupWebpackWatchOutputIgnore(compiler);
|
|
@@ -2333,14 +2577,15 @@ var WeappTailwindcss = class {
|
|
|
2333
2577
|
const registerWebpackCssSourceFile = (source) => {
|
|
2334
2578
|
const file = path.resolve(source.file);
|
|
2335
2579
|
const previous = webpackCssSources.get(file);
|
|
2336
|
-
|
|
2580
|
+
const next = {
|
|
2581
|
+
css: typeof source.css === "string" ? normalizeTailwindConfigDirectives(source.css, path.dirname(file)) : source.css,
|
|
2582
|
+
processed: source.processed
|
|
2583
|
+
};
|
|
2584
|
+
if (previous && shouldKeepPreviousWebpackCssSource(previous, next)) {
|
|
2337
2585
|
currentWebpackCssSourceFiles.add(file);
|
|
2338
2586
|
return;
|
|
2339
2587
|
}
|
|
2340
|
-
webpackCssSources.set(file,
|
|
2341
|
-
css: typeof source.css === "string" ? normalizeTailwindConfigDirectives(source.css, path.dirname(file)) : source.css,
|
|
2342
|
-
processed: source.processed
|
|
2343
|
-
});
|
|
2588
|
+
webpackCssSources.set(file, next);
|
|
2344
2589
|
currentWebpackCssSourceFiles.add(file);
|
|
2345
2590
|
};
|
|
2346
2591
|
const registerWebpackGeneratedCss = (source) => {
|
|
@@ -2434,6 +2679,8 @@ var WeappTailwindcss = class {
|
|
|
2434
2679
|
contexts: runtimeWatchDependencyContexts
|
|
2435
2680
|
};
|
|
2436
2681
|
},
|
|
2682
|
+
loaderAnchorFinders: this.frameworkBranch.loaderAnchorFinders,
|
|
2683
|
+
mpxCssImportRewrite: this.frameworkBranch.mpxCssImportRewrite,
|
|
2437
2684
|
debug
|
|
2438
2685
|
});
|
|
2439
2686
|
setupWebpackV5ProcessAssetsHook({
|
|
@@ -2461,7 +2708,105 @@ var WeappTailwindcss = class {
|
|
|
2461
2708
|
prepareWebpackCssSources,
|
|
2462
2709
|
debug
|
|
2463
2710
|
});
|
|
2464
|
-
createBuiltinWebpackStyleInjectorPlugin(styleInjector, this.
|
|
2711
|
+
createBuiltinWebpackStyleInjectorPlugin(styleInjector, this.frameworkBranch.styleInjectorDelegate)?.apply(compiler);
|
|
2712
|
+
}
|
|
2713
|
+
};
|
|
2714
|
+
//#endregion
|
|
2715
|
+
//#region src/bundlers/webpack/frameworks/generic/index.ts
|
|
2716
|
+
var GenericWebpackPlugin = class extends WebpackFrameworkPlugin {
|
|
2717
|
+
constructor(options = {}) {
|
|
2718
|
+
super(options, {
|
|
2719
|
+
frameworkName: "generic",
|
|
2720
|
+
loaderAnchorFinders: createDefaultLoaderAnchorFinders(),
|
|
2721
|
+
styleInjectorDelegate: webpackStyleInjectorDelegates.generic
|
|
2722
|
+
});
|
|
2723
|
+
}
|
|
2724
|
+
};
|
|
2725
|
+
//#endregion
|
|
2726
|
+
//#region src/bundlers/webpack/frameworks/mpx/index.ts
|
|
2727
|
+
var MpxWebpackPlugin = class extends WebpackFrameworkPlugin {
|
|
2728
|
+
constructor(options = {}) {
|
|
2729
|
+
super(options, {
|
|
2730
|
+
frameworkName: "mpx",
|
|
2731
|
+
loaderAnchorFinders: createMpxLoaderAnchorFinders(),
|
|
2732
|
+
mpxCssImportRewrite: true,
|
|
2733
|
+
setupCssImportRewriteRedirect: (packageDir) => setupMpxTailwindcssRedirect(packageDir, true),
|
|
2734
|
+
styleInjectorDelegate: webpackStyleInjectorDelegates.mpx
|
|
2735
|
+
});
|
|
2736
|
+
}
|
|
2737
|
+
};
|
|
2738
|
+
//#endregion
|
|
2739
|
+
//#region src/bundlers/webpack/frameworks/taro/index.ts
|
|
2740
|
+
var TaroWebpackPlugin = class extends WebpackFrameworkPlugin {
|
|
2741
|
+
constructor(options = {}) {
|
|
2742
|
+
super(options, {
|
|
2743
|
+
frameworkName: "taro",
|
|
2744
|
+
loaderAnchorFinders: createDefaultLoaderAnchorFinders(),
|
|
2745
|
+
styleInjectorDelegate: webpackStyleInjectorDelegates.taro
|
|
2746
|
+
});
|
|
2747
|
+
}
|
|
2748
|
+
};
|
|
2749
|
+
//#endregion
|
|
2750
|
+
//#region src/bundlers/webpack/frameworks/uni-app/index.ts
|
|
2751
|
+
var UniAppWebpackPlugin = class extends WebpackFrameworkPlugin {
|
|
2752
|
+
constructor(options = {}) {
|
|
2753
|
+
super(options, {
|
|
2754
|
+
frameworkName: "uni-app",
|
|
2755
|
+
loaderAnchorFinders: createDefaultLoaderAnchorFinders(),
|
|
2756
|
+
styleInjectorDelegate: webpackStyleInjectorDelegates.uniApp
|
|
2757
|
+
});
|
|
2758
|
+
}
|
|
2759
|
+
};
|
|
2760
|
+
//#endregion
|
|
2761
|
+
//#region src/bundlers/webpack/frameworks/weapp-vite/index.ts
|
|
2762
|
+
var WeappViteWebpackPlugin = class extends WebpackFrameworkPlugin {
|
|
2763
|
+
constructor(options = {}) {
|
|
2764
|
+
super(options, {
|
|
2765
|
+
frameworkName: "weapp-vite",
|
|
2766
|
+
loaderAnchorFinders: createDefaultLoaderAnchorFinders(),
|
|
2767
|
+
styleInjectorDelegate: webpackStyleInjectorDelegates.generic
|
|
2768
|
+
});
|
|
2769
|
+
}
|
|
2770
|
+
};
|
|
2771
|
+
//#endregion
|
|
2772
|
+
//#region src/bundlers/webpack/frameworks/index.ts
|
|
2773
|
+
function createWebpackFrameworkPlugin(frameworkName, options = {}) {
|
|
2774
|
+
switch (frameworkName) {
|
|
2775
|
+
case "mpx": return new MpxWebpackPlugin(options);
|
|
2776
|
+
case "taro": return new TaroWebpackPlugin(options);
|
|
2777
|
+
case "uni-app": return new UniAppWebpackPlugin(options);
|
|
2778
|
+
case "generic": return new GenericWebpackPlugin(options);
|
|
2779
|
+
default: return new WeappViteWebpackPlugin(options);
|
|
2780
|
+
}
|
|
2781
|
+
}
|
|
2782
|
+
//#endregion
|
|
2783
|
+
//#region src/bundlers/webpack/BaseUnifiedPlugin/v5.ts
|
|
2784
|
+
/**
|
|
2785
|
+
* @name WeappTailwindcss
|
|
2786
|
+
* @description Webpack 入口只负责早期识别框架分支,具体 hook 由 framework 目录下的插件拥有。
|
|
2787
|
+
* @link https://tw.icebreaker.top/docs/intro
|
|
2788
|
+
*/
|
|
2789
|
+
var WeappTailwindcss = class {
|
|
2790
|
+
constructor(options = {}) {
|
|
2791
|
+
_defineProperty(this, "options", void 0);
|
|
2792
|
+
_defineProperty(this, "appType", void 0);
|
|
2793
|
+
this.options = getCompilerContext({
|
|
2794
|
+
...options,
|
|
2795
|
+
__internalDeferMissingCssEntriesWarning: true
|
|
2796
|
+
});
|
|
2797
|
+
this.appType = this.options.appType;
|
|
2798
|
+
}
|
|
2799
|
+
apply(compiler) {
|
|
2800
|
+
const plugin = createWebpackFrameworkPlugin(resolveWebpackFrameworkProfile({
|
|
2801
|
+
appType: this.appType,
|
|
2802
|
+
detectEnv: true,
|
|
2803
|
+
env: process.env,
|
|
2804
|
+
root: compiler.options?.context ?? compiler.context,
|
|
2805
|
+
uniAppX: this.options.uniAppX
|
|
2806
|
+
}).frameworkName, this.options);
|
|
2807
|
+
plugin.apply(compiler);
|
|
2808
|
+
this.options = plugin.options;
|
|
2809
|
+
this.appType = plugin.appType;
|
|
2465
2810
|
}
|
|
2466
2811
|
};
|
|
2467
2812
|
//#endregion
|