weapp-tailwindcss 4.12.0 → 5.0.0-next.1
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/babel/index.d.ts +3 -0
- package/dist/bundlers/gulp/index.d.ts +7 -0
- package/dist/bundlers/shared/cache.d.ts +16 -0
- package/dist/bundlers/shared/css-cleanup.d.ts +4 -0
- package/dist/bundlers/shared/css-imports.d.ts +8 -0
- package/dist/bundlers/shared/generator-candidates.d.ts +5 -0
- package/dist/bundlers/shared/generator-css.d.ts +41 -0
- package/dist/bundlers/shared/module-graph.d.ts +5 -0
- package/dist/bundlers/shared/run-tasks.d.ts +2 -0
- package/dist/bundlers/vite/bundle-entries.d.ts +14 -0
- package/dist/bundlers/vite/bundle-state.d.ts +43 -0
- package/dist/bundlers/vite/css-finalizer.d.ts +19 -0
- package/dist/bundlers/vite/generate-bundle.d.ts +20 -0
- package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +21 -0
- package/dist/bundlers/vite/index.d.ts +3 -0
- package/dist/bundlers/vite/js-precheck.d.ts +1 -0
- package/dist/bundlers/vite/query.d.ts +15 -0
- package/dist/bundlers/vite/resolve-app-type.d.ts +2 -0
- package/dist/bundlers/vite/rewrite-css-imports.d.ts +11 -0
- package/dist/bundlers/vite/runtime-affecting-signature.d.ts +2 -0
- package/dist/bundlers/vite/utils.d.ts +9 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +20 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-assets.d.ts +14 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-loaders.d.ts +15 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v4.d.ts +9 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +17 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +19 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +9 -0
- package/dist/bundlers/webpack/index.d.ts +1 -0
- package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +12 -0
- package/dist/bundlers/webpack/loaders/weapp-tw-runtime-classset-loader.d.ts +11 -0
- package/dist/bundlers/webpack/shared/css-imports.d.ts +6 -0
- package/dist/bundlers/webpack/shared/loader-anchors.d.ts +8 -0
- package/dist/cache/index.d.ts +38 -0
- package/dist/cache/md5.d.ts +1 -0
- package/dist/chunk-8l464Juk.js +28 -0
- package/dist/cli/config.d.ts +5 -0
- package/dist/cli/context.d.ts +16 -0
- package/dist/cli/doctor/constants.d.ts +7 -0
- package/dist/cli/doctor/types.d.ts +31 -0
- package/dist/cli/doctor.d.ts +4 -0
- package/dist/cli/helpers/options/format.d.ts +2 -0
- package/dist/cli/helpers/options/parse.d.ts +3 -0
- package/dist/cli/helpers/options/resolve.d.ts +1 -0
- package/dist/cli/helpers/options.d.ts +3 -0
- package/dist/cli/helpers/patch-cwd.d.ts +1 -0
- package/dist/cli/helpers.d.ts +5 -0
- package/dist/cli/mount-options/patch-status.d.ts +2 -0
- package/dist/cli/mount-options.d.ts +2 -0
- package/dist/cli/patch-options.d.ts +6 -0
- package/dist/cli/tokens.d.ts +4 -0
- package/dist/cli/types.d.ts +17 -0
- package/dist/cli/vscode-entry.d.ts +14 -0
- package/dist/cli/workspace/package-dirs.d.ts +3 -0
- package/dist/cli/workspace/patch-package.d.ts +3 -0
- package/dist/cli/workspace/patch-utils.d.ts +3 -0
- package/dist/cli/workspace/types.d.ts +11 -0
- package/dist/cli/workspace/workspace-globs.d.ts +2 -0
- package/dist/cli/workspace/workspace-io.d.ts +1 -0
- package/dist/cli/workspace/workspace-lock.d.ts +1 -0
- package/dist/cli/workspace.d.ts +2 -0
- package/dist/cli.d.ts +1 -2
- package/dist/cli.js +2425 -3524
- package/dist/cli.mjs +2402 -3505
- package/dist/constants-B-_T5UnW.mjs +44 -0
- package/dist/constants-p1dyh1x1.js +73 -0
- package/dist/constants.d.ts +13 -0
- package/dist/context/compiler-context-cache.d.ts +3 -0
- package/dist/context/custom-attributes.d.ts +2 -0
- package/dist/context/handlers.d.ts +6 -0
- package/dist/context/index.d.ts +7 -0
- package/dist/context/logger.d.ts +4 -0
- package/dist/context/tailwindcss/basedir.d.ts +1 -0
- package/dist/context/tailwindcss/rax.d.ts +2 -0
- package/dist/context/tailwindcss.d.ts +4 -0
- package/dist/context/workspace.d.ts +3 -0
- package/dist/core.d.ts +5 -21
- package/dist/core.js +138 -180
- package/dist/core.mjs +135 -180
- package/dist/css-imports-BbrbluP9.js +177 -0
- package/dist/css-imports-CSdPq_Sc.mjs +128 -0
- package/dist/css-macro/constants.d.ts +14 -0
- package/dist/css-macro/index.d.ts +15 -0
- package/dist/css-macro/postcss.d.ts +3 -7
- package/dist/css-macro/postcss.js +44 -58
- package/dist/css-macro/postcss.mjs +44 -56
- package/dist/css-macro.d.ts +1 -20
- package/dist/css-macro.js +37 -50
- package/dist/css-macro.mjs +33 -47
- package/dist/debug/index.d.ts +5 -0
- package/dist/defaults.d.ts +2 -11
- package/dist/defaults.js +132 -8
- package/dist/defaults.mjs +128 -7
- package/dist/escape.js +31 -54
- package/dist/escape.mjs +18 -25
- package/dist/experimental/index.d.ts +2 -0
- package/dist/experimental/oxc/ast-utils.d.ts +30 -0
- package/dist/experimental/oxc/index.d.ts +2 -0
- package/dist/experimental/oxc/module-specifiers.d.ts +2 -0
- package/dist/experimental/shared/cache.d.ts +3 -0
- package/dist/experimental/shared/transform.d.ts +3 -0
- package/dist/experimental/shared.d.ts +8 -0
- package/dist/experimental/swc/ast-utils.d.ts +30 -0
- package/dist/experimental/swc/index.d.ts +2 -0
- package/dist/experimental/swc/module-specifiers.d.ts +2 -0
- package/dist/generator/index.d.ts +11 -0
- package/dist/generator/options.d.ts +15 -0
- package/dist/generator/types.d.ts +19 -0
- package/dist/generator-CZ-JXw6T.js +492 -0
- package/dist/generator-Dwxgra97.mjs +399 -0
- package/dist/generator-css-CnYjiMrD.js +1084 -0
- package/dist/generator-css-DhPFjSzK.mjs +1057 -0
- package/dist/generator.d.ts +1 -0
- package/dist/generator.js +19 -0
- package/dist/generator.mjs +2 -0
- package/dist/gulp.d.ts +4 -24
- package/dist/gulp.js +271 -13
- package/dist/gulp.mjs +263 -13
- package/dist/index.d.ts +8 -15
- package/dist/index.js +12 -24
- package/dist/index.mjs +6 -24
- package/dist/js/JsTokenUpdater.d.ts +14 -0
- package/dist/js/ModuleGraph.d.ts +18 -0
- package/dist/js/NodePathWalker.d.ts +33 -0
- package/dist/js/babel/parse.d.ts +9 -0
- package/dist/js/babel/process.d.ts +4 -0
- package/dist/js/babel.d.ts +13 -0
- package/dist/js/class-context.d.ts +3 -0
- package/dist/js/evalTransforms.d.ts +7 -0
- package/dist/js/handlers.d.ts +5 -0
- package/dist/js/index.d.ts +4 -0
- package/dist/js/module-graph/ignored-exports.d.ts +18 -0
- package/dist/js/module-graph/types.d.ts +17 -0
- package/dist/js/node-path-walker/export-handlers.d.ts +12 -0
- package/dist/js/node-path-walker/import-tokens.d.ts +24 -0
- package/dist/js/precheck.d.ts +2 -0
- package/dist/js/sourceAnalysis.d.ts +17 -0
- package/dist/js/syntax.d.ts +10 -0
- package/dist/js/taggedTemplateIgnore.d.ts +13 -0
- package/dist/js/types.d.ts +11 -0
- package/dist/lightningcss/index.d.ts +8 -0
- package/dist/lightningcss/style-handler/options.d.ts +3 -0
- package/dist/lightningcss/style-handler/selector-transform.d.ts +10 -0
- package/dist/lightningcss/style-handler/selector-utils.d.ts +10 -0
- package/dist/lightningcss/style-handler.d.ts +17 -0
- package/dist/loader-anchors-DvwgIYdA.mjs +205 -0
- package/dist/loader-anchors-cprm4Klq.js +273 -0
- package/dist/logger/index.d.ts +2 -0
- package/dist/logger-BZ45DZJT.js +1003 -0
- package/dist/logger-BoVx1Dbt.mjs +935 -0
- package/dist/patcher-options-6gJN2EXy.js +115 -0
- package/dist/patcher-options-DQfR5xxT.mjs +92 -0
- package/dist/postcss-html-transform.d.ts +3 -3
- package/dist/postcss-html-transform.js +7 -10
- package/dist/postcss-html-transform.mjs +3 -6
- package/dist/postcss.d.ts +15 -0
- package/dist/postcss.js +278 -0
- package/dist/postcss.mjs +268 -0
- package/dist/presets/hbuilderx.d.ts +4 -0
- package/dist/presets/index.d.ts +3 -0
- package/dist/presets/shared.d.ts +10 -0
- package/dist/presets/taro.d.ts +4 -0
- package/dist/presets/uni-app-x.d.ts +16 -0
- package/dist/presets/uni-app.d.ts +4 -0
- package/dist/presets.d.ts +1 -76
- package/dist/presets.js +115 -163
- package/dist/presets.mjs +107 -163
- package/dist/recorder-B_XyZ576.mjs +2763 -0
- package/dist/recorder-rn_2v_nd.js +2878 -0
- package/dist/reset/index.d.ts +2 -0
- package/dist/reset.d.ts +1 -4
- package/dist/reset.js +19 -8
- package/dist/reset.mjs +2 -8
- package/dist/shared/classname-transform.d.ts +14 -0
- package/dist/shared/mpx.d.ts +7 -0
- package/dist/shared/tailwindcss-css-redirect.d.ts +1 -0
- package/dist/tailwindcss/index.d.ts +11 -0
- package/dist/tailwindcss/miniprogram.d.ts +1 -0
- package/dist/tailwindcss/patcher-options.d.ts +56 -0
- package/dist/tailwindcss/patcher-resolve.d.ts +4 -0
- package/dist/tailwindcss/patcher.d.ts +13 -0
- package/dist/tailwindcss/recorder.d.ts +13 -0
- package/dist/tailwindcss/remove-unsupported-css.d.ts +2 -0
- package/dist/tailwindcss/runtime/cache.d.ts +11 -0
- package/dist/tailwindcss/runtime-logs.d.ts +3 -0
- package/dist/tailwindcss/runtime.d.ts +29 -0
- package/dist/tailwindcss/targets/paths.d.ts +13 -0
- package/dist/tailwindcss/targets/record-io.d.ts +5 -0
- package/dist/tailwindcss/targets/recorder.d.ts +3 -0
- package/dist/tailwindcss/targets/types.d.ts +35 -0
- package/dist/tailwindcss/targets.d.ts +6 -0
- package/dist/tailwindcss/v3-engine/generator.d.ts +2 -0
- package/dist/tailwindcss/v3-engine/index.d.ts +4 -0
- package/dist/tailwindcss/v3-engine/miniprogram.d.ts +4 -0
- package/dist/tailwindcss/v3-engine/source.d.ts +5 -0
- package/dist/tailwindcss/v3-engine/types.d.ts +55 -0
- package/dist/tailwindcss/v4/config.d.ts +5 -0
- package/dist/tailwindcss/v4/css-entries.d.ts +7 -0
- package/dist/tailwindcss/v4/index.d.ts +2 -0
- package/dist/tailwindcss/v4/multi-patcher.d.ts +2 -0
- package/dist/tailwindcss/v4/patcher-options.d.ts +24 -0
- package/dist/tailwindcss/v4/patcher.d.ts +14 -0
- package/dist/tailwindcss/v4-engine/design-system.d.ts +1 -0
- package/dist/tailwindcss/v4-engine/generator.d.ts +2 -0
- package/dist/tailwindcss/v4-engine/index.d.ts +5 -0
- package/dist/tailwindcss/v4-engine/miniprogram.d.ts +4 -0
- package/dist/tailwindcss/v4-engine/source.d.ts +7 -0
- package/dist/tailwindcss/v4-engine/types.d.ts +17 -0
- package/dist/typedoc.export.d.ts +5 -0
- package/dist/types/base.d.ts +1 -0
- package/dist/types/disabled-options.d.ts +4 -0
- package/dist/types/index.d.ts +104 -0
- package/dist/types/shared.d.ts +7 -0
- package/dist/types/user-defined-options/general.d.ts +31 -0
- package/dist/types/user-defined-options/important.d.ts +37 -0
- package/dist/types/user-defined-options/index.d.ts +11 -0
- package/dist/types/user-defined-options/lifecycle.d.ts +6 -0
- package/dist/types/user-defined-options/matcher.d.ts +9 -0
- package/dist/types.d.ts +1 -150
- package/dist/types.js +0 -1
- package/dist/types.mjs +1 -1
- package/dist/uni-app-x/component-local-style.d.ts +19 -0
- package/dist/uni-app-x/index.d.ts +2 -0
- package/dist/uni-app-x/options.d.ts +12 -0
- package/dist/uni-app-x/style-isolation.d.ts +2 -0
- package/dist/uni-app-x/transform.d.ts +9 -0
- package/dist/uni-app-x/vite.d.ts +36 -0
- package/dist/utils/decode.d.ts +2 -0
- package/dist/utils/disabled.d.ts +6 -0
- package/dist/utils/hbuilderx.d.ts +5 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/nameMatcher.d.ts +4 -0
- package/dist/utils/resolve-package.d.ts +1 -0
- package/dist/utils/uni-platform.d.ts +11 -0
- package/dist/utils-7DUGTFED.mjs +48 -0
- package/dist/utils-DmC9_In3.js +61 -0
- package/dist/vite-BHpAqldo.js +1952 -0
- package/dist/vite-C8JlHiyR.mjs +1940 -0
- package/dist/vite.d.ts +4 -17
- package/dist/vite.js +5 -14
- package/dist/vite.mjs +2 -14
- package/dist/weapp-tw-css-import-rewrite-loader.js +59 -92
- package/dist/weapp-tw-runtime-classset-loader.js +31 -50
- package/dist/webpack-CABjKGGQ.mjs +441 -0
- package/dist/webpack-DNIJ0ysE.js +456 -0
- package/dist/webpack.d.ts +4 -25
- package/dist/webpack.js +6 -17
- package/dist/webpack.mjs +2 -17
- package/dist/webpack4.d.ts +4 -26
- package/dist/webpack4.js +375 -481
- package/dist/webpack4.mjs +366 -482
- package/dist/wxml/Tokenizer.d.ts +15 -0
- package/dist/wxml/custom-attributes.d.ts +4 -0
- package/dist/wxml/index.d.ts +2 -0
- package/dist/wxml/shared.d.ts +2 -0
- package/dist/wxml/tokenizer/types.d.ts +18 -0
- package/dist/wxml/utils/codegen/legacy-rewriter.d.ts +2 -0
- package/dist/wxml/utils/codegen/legacy-visitor.d.ts +8 -0
- package/dist/wxml/utils/codegen.d.ts +2 -0
- package/dist/wxml/utils/custom-template.d.ts +3 -0
- package/dist/wxml/utils/fragment-helpers.d.ts +6 -0
- package/dist/wxml/utils/fragment-updater.d.ts +4 -0
- package/dist/wxml/utils/template-fragments.d.ts +3 -0
- package/dist/wxml/utils.d.ts +8 -0
- package/dist/wxml/whitespace.d.ts +2 -0
- package/generator-placeholder.css +1 -0
- package/package.json +19 -5
- package/dist/chunk-24AGZQVR.js +0 -183
- package/dist/chunk-3VQKDHGP.mjs +0 -179
- package/dist/chunk-4AFQP74Z.js +0 -24
- package/dist/chunk-57SOQCAU.mjs +0 -582
- package/dist/chunk-5ZYHNDEK.mjs +0 -2439
- package/dist/chunk-76S2EME4.mjs +0 -34
- package/dist/chunk-A5PB4KZT.js +0 -138
- package/dist/chunk-DUHYLR2R.js +0 -276
- package/dist/chunk-DYLQ6UOI.js +0 -71
- package/dist/chunk-E7I5TW5K.js +0 -52
- package/dist/chunk-FS2NOOEB.js +0 -292
- package/dist/chunk-HVNGIKLS.js +0 -3930
- package/dist/chunk-JZQBZHN5.js +0 -579
- package/dist/chunk-KGTVD4EP.mjs +0 -3930
- package/dist/chunk-NNOQDMUP.mjs +0 -10
- package/dist/chunk-OF6MFURR.js +0 -34
- package/dist/chunk-OFB2KBRP.js +0 -2442
- package/dist/chunk-OOHJLO5M.mjs +0 -71
- package/dist/chunk-PCDYXXSK.mjs +0 -1515
- package/dist/chunk-RKISS72P.js +0 -7
- package/dist/chunk-RRQZL7FQ.mjs +0 -292
- package/dist/chunk-XAKAD2CR.mjs +0 -138
- package/dist/chunk-XZP3MREK.mjs +0 -276
- package/dist/chunk-ZAA5ZG3D.js +0 -1518
- package/dist/chunk-ZCH4YINE.mjs +0 -52
- package/dist/cli.d.mts +0 -2
- package/dist/core.d.mts +0 -26
- package/dist/css-macro/postcss.d.mts +0 -7
- package/dist/css-macro.d.mts +0 -18
- package/dist/defaults.d.mts +0 -11
- package/dist/gulp.d.mts +0 -24
- package/dist/index-BXrmQelt.d.mts +0 -672
- package/dist/index-BXrmQelt.d.ts +0 -672
- package/dist/index.d.mts +0 -15
- package/dist/postcss-html-transform.d.mts +0 -2
- package/dist/presets.d.mts +0 -76
- package/dist/reset.d.mts +0 -1
- package/dist/types.d.mts +0 -150
- package/dist/vite.d.mts +0 -17
- package/dist/webpack.d.mts +0 -25
- package/dist/webpack4.d.mts +0 -26
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
const require_chunk = require("./chunk-8l464Juk.js");
|
|
2
|
+
const require_recorder = require("./recorder-rn_2v_nd.js");
|
|
3
|
+
const require_css_imports = require("./css-imports-BbrbluP9.js");
|
|
4
|
+
let node_module = require("node:module");
|
|
5
|
+
node_module = require_chunk.__toESM(node_module);
|
|
6
|
+
let node_path = require("node:path");
|
|
7
|
+
node_path = require_chunk.__toESM(node_path);
|
|
8
|
+
//#region src/shared/tailwindcss-css-redirect.ts
|
|
9
|
+
const moduleWithMutableResolve = node_module.default;
|
|
10
|
+
const patched = /* @__PURE__ */ new WeakSet();
|
|
11
|
+
function installTailwindcssCssRedirect(pkgDir) {
|
|
12
|
+
const target = node_path.default.join(pkgDir, "index.css");
|
|
13
|
+
const original = moduleWithMutableResolve._resolveFilename;
|
|
14
|
+
if (patched.has(original)) return;
|
|
15
|
+
const replacements = new Set(["tailwindcss", "tailwindcss$"]);
|
|
16
|
+
const resolveTailwindcssCss = (request, parent, isMain, options) => {
|
|
17
|
+
if (replacements.has(request)) return target;
|
|
18
|
+
if (request.startsWith("tailwindcss/")) return node_path.default.join(pkgDir, request.slice(12));
|
|
19
|
+
return original(request, parent, isMain, options);
|
|
20
|
+
};
|
|
21
|
+
moduleWithMutableResolve._resolveFilename = resolveTailwindcssCss;
|
|
22
|
+
patched.add(moduleWithMutableResolve._resolveFilename);
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/shared/mpx.ts
|
|
26
|
+
const MPX_STYLE_RESOURCE_QUERY_RE$1 = /(?:^|[?&])type=styles(?:&|$)/;
|
|
27
|
+
function isMpxStyleResourceQuery(query) {
|
|
28
|
+
if (typeof query !== "string") return false;
|
|
29
|
+
return MPX_STYLE_RESOURCE_QUERY_RE$1.test(query);
|
|
30
|
+
}
|
|
31
|
+
function isMpx(appType) {
|
|
32
|
+
return appType === "mpx";
|
|
33
|
+
}
|
|
34
|
+
function getTailwindcssCssEntry(pkgDir) {
|
|
35
|
+
return node_path.default.join(pkgDir, "index.css");
|
|
36
|
+
}
|
|
37
|
+
function ensureMpxTailwindcssAliases(compiler, pkgDir) {
|
|
38
|
+
const tailwindcssCssEntry = getTailwindcssCssEntry(pkgDir);
|
|
39
|
+
compiler.options = compiler.options || {};
|
|
40
|
+
compiler.options.resolve = compiler.options.resolve || {};
|
|
41
|
+
const alias = compiler.options.resolve.alias ?? {};
|
|
42
|
+
if (Array.isArray(alias)) alias.push({
|
|
43
|
+
name: "tailwindcss",
|
|
44
|
+
alias: tailwindcssCssEntry
|
|
45
|
+
}, {
|
|
46
|
+
name: "tailwindcss$",
|
|
47
|
+
alias: tailwindcssCssEntry
|
|
48
|
+
});
|
|
49
|
+
else {
|
|
50
|
+
compiler.options.resolve.alias = alias;
|
|
51
|
+
alias.tailwindcss = tailwindcssCssEntry;
|
|
52
|
+
alias.tailwindcss$ = tailwindcssCssEntry;
|
|
53
|
+
}
|
|
54
|
+
return tailwindcssCssEntry;
|
|
55
|
+
}
|
|
56
|
+
function patchMpxLoaderResolve(loaderContext, pkgDir, enabled) {
|
|
57
|
+
if (!enabled || typeof loaderContext.resolve !== "function") return;
|
|
58
|
+
const originalResolve = loaderContext.resolve;
|
|
59
|
+
if (originalResolve.__weappTwPatched) return;
|
|
60
|
+
const tailwindcssCssEntry = getTailwindcssCssEntry(pkgDir);
|
|
61
|
+
const wrappedResolve = function(context, request, callback) {
|
|
62
|
+
if (request === "tailwindcss" || request === "tailwindcss$") return callback(null, tailwindcssCssEntry);
|
|
63
|
+
if (request?.startsWith("tailwindcss/")) return callback(null, node_path.default.join(pkgDir, request.slice(12)));
|
|
64
|
+
return originalResolve.call(this, context, request, callback);
|
|
65
|
+
};
|
|
66
|
+
wrappedResolve.__weappTwPatched = true;
|
|
67
|
+
loaderContext.resolve = wrappedResolve;
|
|
68
|
+
}
|
|
69
|
+
function setupMpxTailwindcssRedirect(pkgDir, enabled) {
|
|
70
|
+
if (enabled) installTailwindcssCssRedirect(pkgDir);
|
|
71
|
+
}
|
|
72
|
+
const CSS_EXT_RE$1 = /\.css$/i;
|
|
73
|
+
function injectMpxCssRewritePreRules(compiler, loader, loaderOptions) {
|
|
74
|
+
var _compiler$options;
|
|
75
|
+
if (!loader) return;
|
|
76
|
+
const moduleOptions = (_compiler$options = compiler.options).module ?? (_compiler$options.module = { rules: [] });
|
|
77
|
+
moduleOptions.rules = moduleOptions.rules || [];
|
|
78
|
+
const createRule = (match) => ({
|
|
79
|
+
...match,
|
|
80
|
+
enforce: "pre",
|
|
81
|
+
use: [{
|
|
82
|
+
loader,
|
|
83
|
+
options: loaderOptions
|
|
84
|
+
}]
|
|
85
|
+
});
|
|
86
|
+
moduleOptions.rules.unshift(createRule({ resourceQuery: (query) => isMpxStyleResourceQuery(query) }), createRule({
|
|
87
|
+
test: CSS_EXT_RE$1,
|
|
88
|
+
resourceQuery: (query) => !isMpxStyleResourceQuery(query)
|
|
89
|
+
}));
|
|
90
|
+
}
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region src/bundlers/webpack/shared/css-imports.ts
|
|
93
|
+
const CSS_EXT_RE = /\.(?:css|scss|sass|less|styl|pcss)$/i;
|
|
94
|
+
function stripResourceQuery$1(file) {
|
|
95
|
+
let idx = file.indexOf("?");
|
|
96
|
+
if (idx === -1) idx = file.indexOf("&");
|
|
97
|
+
return idx === -1 ? file : file.slice(0, idx);
|
|
98
|
+
}
|
|
99
|
+
function rewriteTailwindcssRequestForCss(data, pkgDir, appType) {
|
|
100
|
+
if (!data) return;
|
|
101
|
+
const request = data.request;
|
|
102
|
+
if (!request) return;
|
|
103
|
+
if (request !== "tailwindcss" && request !== "tailwindcss$" && !request.startsWith("tailwindcss/")) return;
|
|
104
|
+
const issuer = data.contextInfo?.issuer;
|
|
105
|
+
if (!issuer) return;
|
|
106
|
+
const normalizedIssuer = stripResourceQuery$1(issuer);
|
|
107
|
+
if (!CSS_EXT_RE.test(normalizedIssuer)) return;
|
|
108
|
+
const resolved = require_css_imports.resolveTailwindcssImport(request, pkgDir, { appType });
|
|
109
|
+
if (!resolved) return;
|
|
110
|
+
data.request = resolved;
|
|
111
|
+
}
|
|
112
|
+
function applyTailwindcssCssImportRewrite(compiler, options) {
|
|
113
|
+
if (!options.enabled) return;
|
|
114
|
+
compiler.hooks.normalModuleFactory.tap(require_recorder.pluginName, (factory) => {
|
|
115
|
+
factory.hooks.beforeResolve.tap(require_recorder.pluginName, (data) => {
|
|
116
|
+
rewriteTailwindcssRequestForCss(data, options.pkgDir, options.appType);
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
//#endregion
|
|
121
|
+
//#region src/bundlers/webpack/BaseUnifiedPlugin/shared.ts
|
|
122
|
+
const MPX_STYLE_RESOURCE_QUERY_RE = /(?:\?|&)type=styles\b/;
|
|
123
|
+
function getCacheKey(filename) {
|
|
124
|
+
return filename;
|
|
125
|
+
}
|
|
126
|
+
function stripResourceQuery(resource) {
|
|
127
|
+
if (typeof resource !== "string") return resource;
|
|
128
|
+
const queryIndex = resource.indexOf("?");
|
|
129
|
+
if (queryIndex !== -1) return resource.slice(0, queryIndex);
|
|
130
|
+
const hashIndex = resource.indexOf("#");
|
|
131
|
+
if (hashIndex !== -1) return resource.slice(0, hashIndex);
|
|
132
|
+
return resource;
|
|
133
|
+
}
|
|
134
|
+
function isCssLikeModuleResource(resource, cssMatcher, appType) {
|
|
135
|
+
if (typeof resource !== "string") return false;
|
|
136
|
+
const normalizedResource = stripResourceQuery(resource);
|
|
137
|
+
if (normalizedResource && cssMatcher(normalizedResource)) return true;
|
|
138
|
+
if (appType === "mpx") return MPX_STYLE_RESOURCE_QUERY_RE.test(resource);
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
function hasLoaderEntry(entries, target) {
|
|
142
|
+
if (!target) return false;
|
|
143
|
+
return entries.some((entry) => entry.loader?.includes?.(target));
|
|
144
|
+
}
|
|
145
|
+
function toChunkFiles(files) {
|
|
146
|
+
if (!files) return [];
|
|
147
|
+
if (Array.isArray(files)) return files;
|
|
148
|
+
return [...files];
|
|
149
|
+
}
|
|
150
|
+
function createAssetHashByChunkMap(chunks) {
|
|
151
|
+
const partsByFile = /* @__PURE__ */ new Map();
|
|
152
|
+
for (const chunk of chunks) {
|
|
153
|
+
const hash = typeof chunk.hash === "string" ? chunk.hash : void 0;
|
|
154
|
+
if (!hash) continue;
|
|
155
|
+
const chunkId = String(chunk.id ?? chunk.name ?? "");
|
|
156
|
+
for (const file of toChunkFiles(chunk.files)) {
|
|
157
|
+
if (!file) continue;
|
|
158
|
+
let parts = partsByFile.get(file);
|
|
159
|
+
if (!parts) {
|
|
160
|
+
parts = [];
|
|
161
|
+
partsByFile.set(file, parts);
|
|
162
|
+
}
|
|
163
|
+
parts.push(`${chunkId}:${hash}`);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
const hashByFile = /* @__PURE__ */ new Map();
|
|
167
|
+
for (const [file, parts] of partsByFile.entries()) hashByFile.set(file, parts.sort().join("|"));
|
|
168
|
+
return hashByFile;
|
|
169
|
+
}
|
|
170
|
+
function hasWatchChanges(compiler) {
|
|
171
|
+
return (compiler.modifiedFiles?.size ?? 0) > 0 || (compiler.removedFiles?.size ?? 0) > 0;
|
|
172
|
+
}
|
|
173
|
+
//#endregion
|
|
174
|
+
//#region src/bundlers/webpack/shared/loader-anchors.ts
|
|
175
|
+
const MPX_STRIP_CONDITIONAL_LOADER = "@mpxjs/webpack-plugin/lib/style-compiler/strip-conditional-loader";
|
|
176
|
+
const MPX_STYLE_COMPILER_LOADER = "@mpxjs/webpack-plugin/lib/style-compiler/index";
|
|
177
|
+
const MPX_REWRITE_PRECEDENCE_LOADERS = [MPX_STYLE_COMPILER_LOADER, MPX_STRIP_CONDITIONAL_LOADER];
|
|
178
|
+
function createFinder(targets) {
|
|
179
|
+
return (entries) => entries.findIndex((entry) => targets.some((target) => entry?.loader?.includes?.(target)));
|
|
180
|
+
}
|
|
181
|
+
function createPrioritizedFinder(targets) {
|
|
182
|
+
return (entries) => {
|
|
183
|
+
for (const target of targets) {
|
|
184
|
+
const idx = entries.findIndex((entry) => entry?.loader?.includes?.(target));
|
|
185
|
+
if (idx !== -1) return idx;
|
|
186
|
+
}
|
|
187
|
+
return -1;
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
function createLoaderAnchorFinders(appType) {
|
|
191
|
+
if (isMpx(appType)) return {
|
|
192
|
+
findRewriteAnchor: createPrioritizedFinder(MPX_REWRITE_PRECEDENCE_LOADERS),
|
|
193
|
+
findClassSetAnchor: createFinder([MPX_STYLE_COMPILER_LOADER])
|
|
194
|
+
};
|
|
195
|
+
const fallbackFinder = createFinder(["postcss-loader"]);
|
|
196
|
+
return {
|
|
197
|
+
findRewriteAnchor: fallbackFinder,
|
|
198
|
+
findClassSetAnchor: fallbackFinder
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
//#endregion
|
|
202
|
+
Object.defineProperty(exports, "applyTailwindcssCssImportRewrite", {
|
|
203
|
+
enumerable: true,
|
|
204
|
+
get: function() {
|
|
205
|
+
return applyTailwindcssCssImportRewrite;
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
Object.defineProperty(exports, "createAssetHashByChunkMap", {
|
|
209
|
+
enumerable: true,
|
|
210
|
+
get: function() {
|
|
211
|
+
return createAssetHashByChunkMap;
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
Object.defineProperty(exports, "createLoaderAnchorFinders", {
|
|
215
|
+
enumerable: true,
|
|
216
|
+
get: function() {
|
|
217
|
+
return createLoaderAnchorFinders;
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
Object.defineProperty(exports, "ensureMpxTailwindcssAliases", {
|
|
221
|
+
enumerable: true,
|
|
222
|
+
get: function() {
|
|
223
|
+
return ensureMpxTailwindcssAliases;
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
Object.defineProperty(exports, "getCacheKey", {
|
|
227
|
+
enumerable: true,
|
|
228
|
+
get: function() {
|
|
229
|
+
return getCacheKey;
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
Object.defineProperty(exports, "hasLoaderEntry", {
|
|
233
|
+
enumerable: true,
|
|
234
|
+
get: function() {
|
|
235
|
+
return hasLoaderEntry;
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
Object.defineProperty(exports, "hasWatchChanges", {
|
|
239
|
+
enumerable: true,
|
|
240
|
+
get: function() {
|
|
241
|
+
return hasWatchChanges;
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
Object.defineProperty(exports, "injectMpxCssRewritePreRules", {
|
|
245
|
+
enumerable: true,
|
|
246
|
+
get: function() {
|
|
247
|
+
return injectMpxCssRewritePreRules;
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
Object.defineProperty(exports, "isCssLikeModuleResource", {
|
|
251
|
+
enumerable: true,
|
|
252
|
+
get: function() {
|
|
253
|
+
return isCssLikeModuleResource;
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
Object.defineProperty(exports, "isMpx", {
|
|
257
|
+
enumerable: true,
|
|
258
|
+
get: function() {
|
|
259
|
+
return isMpx;
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
Object.defineProperty(exports, "patchMpxLoaderResolve", {
|
|
263
|
+
enumerable: true,
|
|
264
|
+
get: function() {
|
|
265
|
+
return patchMpxLoaderResolve;
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
Object.defineProperty(exports, "setupMpxTailwindcssRedirect", {
|
|
269
|
+
enumerable: true,
|
|
270
|
+
get: function() {
|
|
271
|
+
return setupMpxTailwindcssRedirect;
|
|
272
|
+
}
|
|
273
|
+
});
|