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
package/dist/index.mjs
CHANGED
|
@@ -1,24 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from "./
|
|
5
|
-
import "./
|
|
6
|
-
|
|
7
|
-
createPlugins
|
|
8
|
-
} from "./chunk-XZP3MREK.mjs";
|
|
9
|
-
import {
|
|
10
|
-
UnifiedViteWeappTailwindcssPlugin
|
|
11
|
-
} from "./chunk-5ZYHNDEK.mjs";
|
|
12
|
-
import "./chunk-3VQKDHGP.mjs";
|
|
13
|
-
import "./chunk-76S2EME4.mjs";
|
|
14
|
-
import "./chunk-KGTVD4EP.mjs";
|
|
15
|
-
import "./chunk-PCDYXXSK.mjs";
|
|
16
|
-
import "./chunk-XAKAD2CR.mjs";
|
|
17
|
-
import "./chunk-OOHJLO5M.mjs";
|
|
18
|
-
import "./chunk-NNOQDMUP.mjs";
|
|
19
|
-
export {
|
|
20
|
-
UnifiedViteWeappTailwindcssPlugin,
|
|
21
|
-
UnifiedWebpackPluginV5,
|
|
22
|
-
createPlugins,
|
|
23
|
-
weappTailwindcssPackageDir
|
|
24
|
-
};
|
|
1
|
+
import { t as createWeappTailwindcssGenerator } from "./generator-Dwxgra97.mjs";
|
|
2
|
+
import { WeappTailwindcss as createPlugins } from "./gulp.mjs";
|
|
3
|
+
import weappTailwindcssPostcssPlugin from "./postcss.mjs";
|
|
4
|
+
import { t as UnifiedViteWeappTailwindcssPlugin } from "./vite-C8JlHiyR.mjs";
|
|
5
|
+
import { n as weappTailwindcssPackageDir, t as UnifiedWebpackPluginV5 } from "./webpack-CABjKGGQ.mjs";
|
|
6
|
+
export { UnifiedViteWeappTailwindcssPlugin, UnifiedWebpackPluginV5, createPlugins, createWeappTailwindcssGenerator, weappTailwindcssPackageDir, weappTailwindcssPostcssPlugin };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type MagicString from 'magic-string';
|
|
2
|
+
import type { JsToken } from './types';
|
|
3
|
+
export declare class JsTokenUpdater {
|
|
4
|
+
private tokens;
|
|
5
|
+
constructor({ value }?: {
|
|
6
|
+
value?: JsToken[];
|
|
7
|
+
});
|
|
8
|
+
addToken(token?: JsToken): void;
|
|
9
|
+
push(...args: JsToken[]): this;
|
|
10
|
+
get length(): number;
|
|
11
|
+
map(callbackfn: (value: JsToken, index: number, array: JsToken[]) => JsToken): this;
|
|
12
|
+
filter(callbackfn: (value: JsToken, index: number, array: JsToken[]) => unknown): this;
|
|
13
|
+
updateMagicString(ms: MagicString): MagicString;
|
|
14
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { JsModuleGraphOptions, LinkedJsModuleResult } from '../types';
|
|
2
|
+
import type { ModuleGraphEntry } from './module-graph/types';
|
|
3
|
+
export type { ModuleGraphEntry } from './module-graph/types';
|
|
4
|
+
export declare class JsModuleGraph {
|
|
5
|
+
private readonly modules;
|
|
6
|
+
private readonly queue;
|
|
7
|
+
private readonly resolve;
|
|
8
|
+
private readonly load;
|
|
9
|
+
private readonly filter?;
|
|
10
|
+
private readonly maxDepth;
|
|
11
|
+
private readonly baseOptions;
|
|
12
|
+
private readonly parserOptions?;
|
|
13
|
+
private readonly rootFilename;
|
|
14
|
+
private readonly ignoredExports;
|
|
15
|
+
constructor(entry: ModuleGraphEntry, graphOptions: JsModuleGraphOptions);
|
|
16
|
+
build(): Record<string, LinkedJsModuleResult> | undefined;
|
|
17
|
+
private collectDependencies;
|
|
18
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { NodePath } from '@babel/traverse';
|
|
2
|
+
import type { ArrayExpression, BinaryExpression, CallExpression, ExportAllDeclaration, ExportDeclaration, ExportDefaultDeclaration, ExportNamedDeclaration, LogicalExpression, Node, ObjectExpression, StringLiteral, TemplateElement, TemplateLiteral, VariableDeclarator } from '@babel/types';
|
|
3
|
+
import type { ImportToken } from './node-path-walker/import-tokens';
|
|
4
|
+
export type { ImportToken } from './node-path-walker/import-tokens';
|
|
5
|
+
export declare class NodePathWalker {
|
|
6
|
+
ignoreCallExpressionIdentifiers: (string | RegExp)[];
|
|
7
|
+
callback: (path: NodePath<StringLiteral | TemplateElement>) => void;
|
|
8
|
+
private isIgnoredCallIdentifier;
|
|
9
|
+
private hasIgnoredCallIdentifiers;
|
|
10
|
+
private importsStore;
|
|
11
|
+
private visitedStore;
|
|
12
|
+
constructor({ ignoreCallExpressionIdentifiers, callback }?: {
|
|
13
|
+
ignoreCallExpressionIdentifiers?: (string | RegExp)[];
|
|
14
|
+
callback?: (path: NodePath<StringLiteral | TemplateElement>) => void;
|
|
15
|
+
});
|
|
16
|
+
get imports(): Set<ImportToken>;
|
|
17
|
+
private getWritableImports;
|
|
18
|
+
private addImportToken;
|
|
19
|
+
private getVisited;
|
|
20
|
+
walkVariableDeclarator(path: NodePath<VariableDeclarator>): void;
|
|
21
|
+
walkTemplateLiteral(path: NodePath<TemplateLiteral>): void;
|
|
22
|
+
walkStringLiteral(path: NodePath<StringLiteral>): void;
|
|
23
|
+
walkBinaryExpression(path: NodePath<BinaryExpression>): void;
|
|
24
|
+
walkLogicalExpression(path: NodePath<LogicalExpression>): void;
|
|
25
|
+
walkObjectExpression(path: NodePath<ObjectExpression>): void;
|
|
26
|
+
walkArrayExpression(path: NodePath<ArrayExpression>): void;
|
|
27
|
+
walkNode(arg: NodePath<Node | null | undefined>): void;
|
|
28
|
+
walkCallExpression(path: NodePath<CallExpression>): void;
|
|
29
|
+
walkExportDeclaration(path: NodePath<ExportDeclaration>): void;
|
|
30
|
+
walkExportNamedDeclaration(path: NodePath<ExportNamedDeclaration>): void;
|
|
31
|
+
walkExportDefaultDeclaration(path: NodePath<ExportDefaultDeclaration>): void;
|
|
32
|
+
walkExportAllDeclaration(path: NodePath<ExportAllDeclaration>): void;
|
|
33
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ParseResult, ParserOptions } from '@babel/parser';
|
|
2
|
+
import type { File } from '@babel/types';
|
|
3
|
+
import { LRUCache } from 'lru-cache';
|
|
4
|
+
export declare const parseCache: LRUCache<string, ParseResult<File>>;
|
|
5
|
+
export declare function genCacheKey(source: string, options: any): string;
|
|
6
|
+
export declare function babelParse(code: string, opts?: (ParserOptions & {
|
|
7
|
+
cache?: boolean;
|
|
8
|
+
cacheKey?: string;
|
|
9
|
+
})): ParseResult<File>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { IJsHandlerOptions } from '../../types';
|
|
2
|
+
import type { SourceAnalysis } from '../sourceAnalysis';
|
|
3
|
+
import MagicString from 'magic-string';
|
|
4
|
+
export declare function processUpdatedSource(rawSource: string, options: IJsHandlerOptions, analysis: SourceAnalysis): MagicString;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ParseResult } from '@babel/parser';
|
|
2
|
+
import type { File } from '@babel/types';
|
|
3
|
+
import type { IJsHandlerOptions, JsHandlerResult } from '../types';
|
|
4
|
+
import type { EvalHandler } from './evalTransforms';
|
|
5
|
+
import type { SourceAnalysis } from './sourceAnalysis';
|
|
6
|
+
import { babelParse } from './babel/parse';
|
|
7
|
+
import { processUpdatedSource } from './babel/process';
|
|
8
|
+
export declare function analyzeSource(ast: ParseResult<File>, options: IJsHandlerOptions, handler?: EvalHandler, collectModuleMetadata?: boolean): SourceAnalysis;
|
|
9
|
+
export declare function jsHandler(rawSource: string, options: IJsHandlerOptions): JsHandlerResult;
|
|
10
|
+
export { babelParse, processUpdatedSource };
|
|
11
|
+
export { genCacheKey, parseCache } from './babel/parse';
|
|
12
|
+
export { isEvalPath } from './evalTransforms';
|
|
13
|
+
export type { SourceAnalysis } from './sourceAnalysis';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { NodePath } from '@babel/traverse';
|
|
2
|
+
import type { CallExpression, Node } from '@babel/types';
|
|
3
|
+
import type { IJsHandlerOptions, JsHandlerResult } from '../types';
|
|
4
|
+
import type { JsTokenUpdater } from './JsTokenUpdater';
|
|
5
|
+
export type EvalHandler = (source: string, opts: IJsHandlerOptions) => JsHandlerResult;
|
|
6
|
+
export declare function isEvalPath(path: NodePath<Node>): boolean;
|
|
7
|
+
export declare function walkEvalExpression(path: NodePath<CallExpression>, options: IJsHandlerOptions, updater: JsTokenUpdater, handler: EvalHandler): void;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { NodePath } from '@babel/traverse';
|
|
2
|
+
import type { StringLiteral, TemplateElement } from '@babel/types';
|
|
3
|
+
import type { IJsHandlerOptions } from '../types';
|
|
4
|
+
import type { JsToken } from './types';
|
|
5
|
+
export declare function replaceHandleValue(path: NodePath<StringLiteral | TemplateElement>, options: IJsHandlerOptions): JsToken | undefined;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { JsModuleGraphOptions } from '../../types';
|
|
2
|
+
import type { SourceAnalysis } from '../babel';
|
|
3
|
+
import type { ImportToken } from '../NodePathWalker';
|
|
4
|
+
import type { ModuleState } from './types';
|
|
5
|
+
interface IgnoredExportsTrackerOptions {
|
|
6
|
+
resolve: JsModuleGraphOptions['resolve'];
|
|
7
|
+
filter?: JsModuleGraphOptions['filter'];
|
|
8
|
+
modules: Map<string, ModuleState>;
|
|
9
|
+
}
|
|
10
|
+
export declare class IgnoredExportsTracker {
|
|
11
|
+
private readonly options;
|
|
12
|
+
private readonly ignoredExportNames;
|
|
13
|
+
constructor(options: IgnoredExportsTrackerOptions);
|
|
14
|
+
addIgnoredExport(filename: string, exportName: string): void;
|
|
15
|
+
registerIgnoredExportsFromTokens(resolved: string, tokens: ImportToken[]): void;
|
|
16
|
+
applyIgnoredExportsToAnalysis(filename: string, analysis: SourceAnalysis): void;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { IJsHandlerOptions } from '../../types';
|
|
2
|
+
import type { SourceAnalysis } from '../babel';
|
|
3
|
+
export interface ModuleState {
|
|
4
|
+
filename: string;
|
|
5
|
+
source: string;
|
|
6
|
+
analysis: SourceAnalysis;
|
|
7
|
+
}
|
|
8
|
+
export interface QueueItem {
|
|
9
|
+
filename: string;
|
|
10
|
+
depth: number;
|
|
11
|
+
}
|
|
12
|
+
export interface ModuleGraphEntry {
|
|
13
|
+
filename: string;
|
|
14
|
+
source: string;
|
|
15
|
+
analysis: SourceAnalysis;
|
|
16
|
+
handlerOptions: IJsHandlerOptions;
|
|
17
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { NodePath } from '@babel/traverse';
|
|
2
|
+
import type { ExportAllDeclaration, ExportDeclaration, ExportDefaultDeclaration, ExportNamedDeclaration, Node } from '@babel/types';
|
|
3
|
+
import type { ImportToken } from './import-tokens';
|
|
4
|
+
interface ExportWalkContext {
|
|
5
|
+
addImportToken: (token: ImportToken) => void;
|
|
6
|
+
walkNode: (path: NodePath<Node | null | undefined>) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function walkExportDeclaration(ctx: ExportWalkContext, path: NodePath<ExportDeclaration>): void;
|
|
9
|
+
export declare function walkExportNamedDeclaration(ctx: ExportWalkContext, path: NodePath<ExportNamedDeclaration>): void;
|
|
10
|
+
export declare function walkExportDefaultDeclaration(ctx: ExportWalkContext, path: NodePath<ExportDefaultDeclaration>): void;
|
|
11
|
+
export declare function walkExportAllDeclaration(ctx: ExportWalkContext, path: NodePath<ExportAllDeclaration>): void;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { NodePath } from '@babel/traverse';
|
|
2
|
+
import type { ExportAllDeclaration, ImportDeclaration, ImportDefaultSpecifier, ImportSpecifier, Node } from '@babel/types';
|
|
3
|
+
export interface ImportSpecifierImportToken {
|
|
4
|
+
declaration: NodePath<ImportDeclaration>;
|
|
5
|
+
specifier: NodePath<ImportSpecifier>;
|
|
6
|
+
local: string;
|
|
7
|
+
imported: string;
|
|
8
|
+
source: string;
|
|
9
|
+
type: 'ImportSpecifier';
|
|
10
|
+
}
|
|
11
|
+
export interface ImportDefaultSpecifierImportToken {
|
|
12
|
+
declaration: NodePath<ImportDeclaration>;
|
|
13
|
+
specifier: NodePath<ImportDefaultSpecifier>;
|
|
14
|
+
local: string;
|
|
15
|
+
source: string;
|
|
16
|
+
type: 'ImportDefaultSpecifier';
|
|
17
|
+
}
|
|
18
|
+
export interface ExportAllDeclarationImportToken {
|
|
19
|
+
declaration: NodePath<ExportAllDeclaration>;
|
|
20
|
+
source: string;
|
|
21
|
+
type: 'ExportAllDeclaration';
|
|
22
|
+
}
|
|
23
|
+
export type ImportToken = ImportSpecifierImportToken | ImportDefaultSpecifierImportToken | ExportAllDeclarationImportToken;
|
|
24
|
+
export declare function maybeAddImportToken(imports: Set<ImportToken>, arg: NodePath<Node | null | undefined>): boolean;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ParseResult } from '@babel/parser';
|
|
2
|
+
import type { NodePath } from '@babel/traverse';
|
|
3
|
+
import type { ExportDeclaration, File, ImportDeclaration, StringLiteral, TemplateElement } from '@babel/types';
|
|
4
|
+
import type { JsTokenUpdater } from './JsTokenUpdater';
|
|
5
|
+
import type { NodePathWalker } from './NodePathWalker';
|
|
6
|
+
import type { JsToken } from './types';
|
|
7
|
+
export interface SourceAnalysis {
|
|
8
|
+
ast: ParseResult<File>;
|
|
9
|
+
walker: NodePathWalker;
|
|
10
|
+
jsTokenUpdater: JsTokenUpdater;
|
|
11
|
+
targetPaths: NodePath<StringLiteral | TemplateElement>[];
|
|
12
|
+
importDeclarations: Set<NodePath<ImportDeclaration>>;
|
|
13
|
+
exportDeclarations: Set<NodePath<ExportDeclaration>>;
|
|
14
|
+
requireCallPaths: NodePath<StringLiteral>[];
|
|
15
|
+
ignoredPaths: WeakSet<NodePath<StringLiteral | TemplateElement>>;
|
|
16
|
+
}
|
|
17
|
+
export declare function collectModuleSpecifierReplacementTokens(analysis: SourceAnalysis, replacements: Record<string, string>): JsToken[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface DetectSyntaxOptions {
|
|
2
|
+
stripComments?: boolean;
|
|
3
|
+
}
|
|
4
|
+
export declare function hasESMSyntax(code: string, opts?: DetectSyntaxOptions): boolean;
|
|
5
|
+
export declare function hasCJSSyntax(code: string, opts?: DetectSyntaxOptions): boolean;
|
|
6
|
+
export declare function detectSyntax(code: string, opts?: DetectSyntaxOptions): {
|
|
7
|
+
hasESM: boolean;
|
|
8
|
+
hasCJS: boolean;
|
|
9
|
+
isMixed: boolean;
|
|
10
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { NodePath } from '@babel/traverse';
|
|
2
|
+
import type { Node } from '@babel/types';
|
|
3
|
+
import type { NameMatcher } from '../utils/nameMatcher';
|
|
4
|
+
interface TaggedTemplateIgnoreOptions {
|
|
5
|
+
matcher: NameMatcher;
|
|
6
|
+
names?: (string | RegExp)[];
|
|
7
|
+
}
|
|
8
|
+
interface TaggedTemplateIgnore {
|
|
9
|
+
shouldIgnore: (tagPath: NodePath<Node>) => boolean;
|
|
10
|
+
getEffectiveTagPath: (tagPath: NodePath<Node>) => NodePath<Node>;
|
|
11
|
+
}
|
|
12
|
+
export declare function createTaggedTemplateIgnore({ matcher, names }: TaggedTemplateIgnoreOptions): TaggedTemplateIgnore;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { NodePath } from '@babel/traverse';
|
|
2
|
+
import type { StringLiteral, TemplateElement } from '@babel/types';
|
|
3
|
+
export interface JsTokenMeta {
|
|
4
|
+
ignore?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface JsToken {
|
|
7
|
+
start: number;
|
|
8
|
+
end: number;
|
|
9
|
+
value: string;
|
|
10
|
+
path: NodePath<StringLiteral | TemplateElement>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Buffer } from 'node:buffer';
|
|
2
|
+
import { createLightningcssStyleHandler } from './style-handler';
|
|
3
|
+
export { createLightningcssStyleHandler };
|
|
4
|
+
export declare function transformCss(css?: string | Buffer): Promise<{
|
|
5
|
+
code: Buffer<ArrayBuffer>;
|
|
6
|
+
map: Buffer<ArrayBuffer> | undefined;
|
|
7
|
+
warnings: import("lightningcss").Warning[];
|
|
8
|
+
}>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss';
|
|
2
|
+
export declare function createRootSpecificityReplacer(options: IStyleHandlerOptions): ((code: string) => string) | undefined;
|
|
3
|
+
export declare function prepareStyleOptions(options?: Partial<IStyleHandlerOptions>): IStyleHandlerOptions;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss';
|
|
2
|
+
import type { SelectorComponent } from 'lightningcss';
|
|
3
|
+
type CustomAtRules = Record<string, never>;
|
|
4
|
+
export interface SelectorTransformContext {
|
|
5
|
+
options: IStyleHandlerOptions;
|
|
6
|
+
childCombinatorReplacement?: SelectorComponent[];
|
|
7
|
+
}
|
|
8
|
+
export declare function buildChildCombinatorReplacement(options: IStyleHandlerOptions): SelectorComponent[] | undefined;
|
|
9
|
+
export declare function createVisitor(ctx: SelectorTransformContext): import("lightningcss").Visitor<CustomAtRules>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Selector, SelectorComponent } from 'lightningcss';
|
|
2
|
+
export declare function createTypeSelector(name: string): SelectorComponent;
|
|
3
|
+
export declare function cloneComponent<T>(value: T): T;
|
|
4
|
+
export declare function cloneComponents(list: SelectorComponent[]): SelectorComponent[];
|
|
5
|
+
export declare function normalizeNestedSelectors(selectors: Selector[] | Selector | null | undefined): Selector[] | undefined;
|
|
6
|
+
export declare function assignNestedSelectors(target: SelectorComponent & {
|
|
7
|
+
selectors?: Selector[] | Selector | null;
|
|
8
|
+
}, value: Selector[] | undefined): void;
|
|
9
|
+
export declare function trimCombinators(components: SelectorComponent[]): SelectorComponent[];
|
|
10
|
+
export declare function matchesHiddenNot(component: SelectorComponent | undefined): boolean;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss';
|
|
2
|
+
import type { TransformOptions, Warning } from 'lightningcss';
|
|
3
|
+
type CustomAtRules = Record<string, never>;
|
|
4
|
+
export interface LightningcssStyleHandlerResult {
|
|
5
|
+
code: string;
|
|
6
|
+
map?: string;
|
|
7
|
+
warnings: Warning[];
|
|
8
|
+
}
|
|
9
|
+
export interface LightningcssTransformConfig {
|
|
10
|
+
filename?: string;
|
|
11
|
+
transformOptions?: Omit<TransformOptions<CustomAtRules>, 'filename' | 'code' | 'visitor'>;
|
|
12
|
+
}
|
|
13
|
+
interface LightningcssStyleHandler {
|
|
14
|
+
(rawSource: string, overrideOptions?: Partial<IStyleHandlerOptions>): Promise<LightningcssStyleHandlerResult>;
|
|
15
|
+
}
|
|
16
|
+
export declare function createLightningcssStyleHandler(options?: Partial<IStyleHandlerOptions>, config?: LightningcssTransformConfig): LightningcssStyleHandler;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { p as pluginName } from "./recorder-B_XyZ576.mjs";
|
|
2
|
+
import { t as resolveTailwindcssImport } from "./css-imports-CSdPq_Sc.mjs";
|
|
3
|
+
import Module from "node:module";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
//#region src/shared/tailwindcss-css-redirect.ts
|
|
7
|
+
const moduleWithMutableResolve = Module;
|
|
8
|
+
const patched = /* @__PURE__ */ new WeakSet();
|
|
9
|
+
function installTailwindcssCssRedirect(pkgDir) {
|
|
10
|
+
const target = path.join(pkgDir, "index.css");
|
|
11
|
+
const original = moduleWithMutableResolve._resolveFilename;
|
|
12
|
+
if (patched.has(original)) return;
|
|
13
|
+
const replacements = new Set(["tailwindcss", "tailwindcss$"]);
|
|
14
|
+
const resolveTailwindcssCss = (request, parent, isMain, options) => {
|
|
15
|
+
if (replacements.has(request)) return target;
|
|
16
|
+
if (request.startsWith("tailwindcss/")) return path.join(pkgDir, request.slice(12));
|
|
17
|
+
return original(request, parent, isMain, options);
|
|
18
|
+
};
|
|
19
|
+
moduleWithMutableResolve._resolveFilename = resolveTailwindcssCss;
|
|
20
|
+
patched.add(moduleWithMutableResolve._resolveFilename);
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/shared/mpx.ts
|
|
24
|
+
const MPX_STYLE_RESOURCE_QUERY_RE$1 = /(?:^|[?&])type=styles(?:&|$)/;
|
|
25
|
+
function isMpxStyleResourceQuery(query) {
|
|
26
|
+
if (typeof query !== "string") return false;
|
|
27
|
+
return MPX_STYLE_RESOURCE_QUERY_RE$1.test(query);
|
|
28
|
+
}
|
|
29
|
+
function isMpx(appType) {
|
|
30
|
+
return appType === "mpx";
|
|
31
|
+
}
|
|
32
|
+
function getTailwindcssCssEntry(pkgDir) {
|
|
33
|
+
return path.join(pkgDir, "index.css");
|
|
34
|
+
}
|
|
35
|
+
function ensureMpxTailwindcssAliases(compiler, pkgDir) {
|
|
36
|
+
const tailwindcssCssEntry = getTailwindcssCssEntry(pkgDir);
|
|
37
|
+
compiler.options = compiler.options || {};
|
|
38
|
+
compiler.options.resolve = compiler.options.resolve || {};
|
|
39
|
+
const alias = compiler.options.resolve.alias ?? {};
|
|
40
|
+
if (Array.isArray(alias)) alias.push({
|
|
41
|
+
name: "tailwindcss",
|
|
42
|
+
alias: tailwindcssCssEntry
|
|
43
|
+
}, {
|
|
44
|
+
name: "tailwindcss$",
|
|
45
|
+
alias: tailwindcssCssEntry
|
|
46
|
+
});
|
|
47
|
+
else {
|
|
48
|
+
compiler.options.resolve.alias = alias;
|
|
49
|
+
alias.tailwindcss = tailwindcssCssEntry;
|
|
50
|
+
alias.tailwindcss$ = tailwindcssCssEntry;
|
|
51
|
+
}
|
|
52
|
+
return tailwindcssCssEntry;
|
|
53
|
+
}
|
|
54
|
+
function patchMpxLoaderResolve(loaderContext, pkgDir, enabled) {
|
|
55
|
+
if (!enabled || typeof loaderContext.resolve !== "function") return;
|
|
56
|
+
const originalResolve = loaderContext.resolve;
|
|
57
|
+
if (originalResolve.__weappTwPatched) return;
|
|
58
|
+
const tailwindcssCssEntry = getTailwindcssCssEntry(pkgDir);
|
|
59
|
+
const wrappedResolve = function(context, request, callback) {
|
|
60
|
+
if (request === "tailwindcss" || request === "tailwindcss$") return callback(null, tailwindcssCssEntry);
|
|
61
|
+
if (request?.startsWith("tailwindcss/")) return callback(null, path.join(pkgDir, request.slice(12)));
|
|
62
|
+
return originalResolve.call(this, context, request, callback);
|
|
63
|
+
};
|
|
64
|
+
wrappedResolve.__weappTwPatched = true;
|
|
65
|
+
loaderContext.resolve = wrappedResolve;
|
|
66
|
+
}
|
|
67
|
+
function setupMpxTailwindcssRedirect(pkgDir, enabled) {
|
|
68
|
+
if (enabled) installTailwindcssCssRedirect(pkgDir);
|
|
69
|
+
}
|
|
70
|
+
const CSS_EXT_RE$1 = /\.css$/i;
|
|
71
|
+
function injectMpxCssRewritePreRules(compiler, loader, loaderOptions) {
|
|
72
|
+
var _compiler$options;
|
|
73
|
+
if (!loader) return;
|
|
74
|
+
const moduleOptions = (_compiler$options = compiler.options).module ?? (_compiler$options.module = { rules: [] });
|
|
75
|
+
moduleOptions.rules = moduleOptions.rules || [];
|
|
76
|
+
const createRule = (match) => ({
|
|
77
|
+
...match,
|
|
78
|
+
enforce: "pre",
|
|
79
|
+
use: [{
|
|
80
|
+
loader,
|
|
81
|
+
options: loaderOptions
|
|
82
|
+
}]
|
|
83
|
+
});
|
|
84
|
+
moduleOptions.rules.unshift(createRule({ resourceQuery: (query) => isMpxStyleResourceQuery(query) }), createRule({
|
|
85
|
+
test: CSS_EXT_RE$1,
|
|
86
|
+
resourceQuery: (query) => !isMpxStyleResourceQuery(query)
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region src/bundlers/webpack/shared/css-imports.ts
|
|
91
|
+
const CSS_EXT_RE = /\.(?:css|scss|sass|less|styl|pcss)$/i;
|
|
92
|
+
function stripResourceQuery$1(file) {
|
|
93
|
+
let idx = file.indexOf("?");
|
|
94
|
+
if (idx === -1) idx = file.indexOf("&");
|
|
95
|
+
return idx === -1 ? file : file.slice(0, idx);
|
|
96
|
+
}
|
|
97
|
+
function rewriteTailwindcssRequestForCss(data, pkgDir, appType) {
|
|
98
|
+
if (!data) return;
|
|
99
|
+
const request = data.request;
|
|
100
|
+
if (!request) return;
|
|
101
|
+
if (request !== "tailwindcss" && request !== "tailwindcss$" && !request.startsWith("tailwindcss/")) return;
|
|
102
|
+
const issuer = data.contextInfo?.issuer;
|
|
103
|
+
if (!issuer) return;
|
|
104
|
+
const normalizedIssuer = stripResourceQuery$1(issuer);
|
|
105
|
+
if (!CSS_EXT_RE.test(normalizedIssuer)) return;
|
|
106
|
+
const resolved = resolveTailwindcssImport(request, pkgDir, { appType });
|
|
107
|
+
if (!resolved) return;
|
|
108
|
+
data.request = resolved;
|
|
109
|
+
}
|
|
110
|
+
function applyTailwindcssCssImportRewrite(compiler, options) {
|
|
111
|
+
if (!options.enabled) return;
|
|
112
|
+
compiler.hooks.normalModuleFactory.tap(pluginName, (factory) => {
|
|
113
|
+
factory.hooks.beforeResolve.tap(pluginName, (data) => {
|
|
114
|
+
rewriteTailwindcssRequestForCss(data, options.pkgDir, options.appType);
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
//#endregion
|
|
119
|
+
//#region src/bundlers/webpack/BaseUnifiedPlugin/shared.ts
|
|
120
|
+
const MPX_STYLE_RESOURCE_QUERY_RE = /(?:\?|&)type=styles\b/;
|
|
121
|
+
function getCacheKey(filename) {
|
|
122
|
+
return filename;
|
|
123
|
+
}
|
|
124
|
+
function stripResourceQuery(resource) {
|
|
125
|
+
if (typeof resource !== "string") return resource;
|
|
126
|
+
const queryIndex = resource.indexOf("?");
|
|
127
|
+
if (queryIndex !== -1) return resource.slice(0, queryIndex);
|
|
128
|
+
const hashIndex = resource.indexOf("#");
|
|
129
|
+
if (hashIndex !== -1) return resource.slice(0, hashIndex);
|
|
130
|
+
return resource;
|
|
131
|
+
}
|
|
132
|
+
function isCssLikeModuleResource(resource, cssMatcher, appType) {
|
|
133
|
+
if (typeof resource !== "string") return false;
|
|
134
|
+
const normalizedResource = stripResourceQuery(resource);
|
|
135
|
+
if (normalizedResource && cssMatcher(normalizedResource)) return true;
|
|
136
|
+
if (appType === "mpx") return MPX_STYLE_RESOURCE_QUERY_RE.test(resource);
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
function hasLoaderEntry(entries, target) {
|
|
140
|
+
if (!target) return false;
|
|
141
|
+
return entries.some((entry) => entry.loader?.includes?.(target));
|
|
142
|
+
}
|
|
143
|
+
function toChunkFiles(files) {
|
|
144
|
+
if (!files) return [];
|
|
145
|
+
if (Array.isArray(files)) return files;
|
|
146
|
+
return [...files];
|
|
147
|
+
}
|
|
148
|
+
function createAssetHashByChunkMap(chunks) {
|
|
149
|
+
const partsByFile = /* @__PURE__ */ new Map();
|
|
150
|
+
for (const chunk of chunks) {
|
|
151
|
+
const hash = typeof chunk.hash === "string" ? chunk.hash : void 0;
|
|
152
|
+
if (!hash) continue;
|
|
153
|
+
const chunkId = String(chunk.id ?? chunk.name ?? "");
|
|
154
|
+
for (const file of toChunkFiles(chunk.files)) {
|
|
155
|
+
if (!file) continue;
|
|
156
|
+
let parts = partsByFile.get(file);
|
|
157
|
+
if (!parts) {
|
|
158
|
+
parts = [];
|
|
159
|
+
partsByFile.set(file, parts);
|
|
160
|
+
}
|
|
161
|
+
parts.push(`${chunkId}:${hash}`);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
const hashByFile = /* @__PURE__ */ new Map();
|
|
165
|
+
for (const [file, parts] of partsByFile.entries()) hashByFile.set(file, parts.sort().join("|"));
|
|
166
|
+
return hashByFile;
|
|
167
|
+
}
|
|
168
|
+
function hasWatchChanges(compiler) {
|
|
169
|
+
return (compiler.modifiedFiles?.size ?? 0) > 0 || (compiler.removedFiles?.size ?? 0) > 0;
|
|
170
|
+
}
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region ../../node_modules/.pnpm/tsdown@0.21.10_oxc-resolver@11.16.0_@emnapi+core@1.10.0_@emnapi+runtime@1.10.0__synckit_2e62271a4111dd71b1211b37ea0ad6f5/node_modules/tsdown/esm-shims.js
|
|
173
|
+
const getFilename = () => fileURLToPath(import.meta.url);
|
|
174
|
+
const getDirname = () => path.dirname(getFilename());
|
|
175
|
+
const __dirname = /* @__PURE__ */ getDirname();
|
|
176
|
+
//#endregion
|
|
177
|
+
//#region src/bundlers/webpack/shared/loader-anchors.ts
|
|
178
|
+
const MPX_STRIP_CONDITIONAL_LOADER = "@mpxjs/webpack-plugin/lib/style-compiler/strip-conditional-loader";
|
|
179
|
+
const MPX_STYLE_COMPILER_LOADER = "@mpxjs/webpack-plugin/lib/style-compiler/index";
|
|
180
|
+
const MPX_REWRITE_PRECEDENCE_LOADERS = [MPX_STYLE_COMPILER_LOADER, MPX_STRIP_CONDITIONAL_LOADER];
|
|
181
|
+
function createFinder(targets) {
|
|
182
|
+
return (entries) => entries.findIndex((entry) => targets.some((target) => entry?.loader?.includes?.(target)));
|
|
183
|
+
}
|
|
184
|
+
function createPrioritizedFinder(targets) {
|
|
185
|
+
return (entries) => {
|
|
186
|
+
for (const target of targets) {
|
|
187
|
+
const idx = entries.findIndex((entry) => entry?.loader?.includes?.(target));
|
|
188
|
+
if (idx !== -1) return idx;
|
|
189
|
+
}
|
|
190
|
+
return -1;
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
function createLoaderAnchorFinders(appType) {
|
|
194
|
+
if (isMpx(appType)) return {
|
|
195
|
+
findRewriteAnchor: createPrioritizedFinder(MPX_REWRITE_PRECEDENCE_LOADERS),
|
|
196
|
+
findClassSetAnchor: createFinder([MPX_STYLE_COMPILER_LOADER])
|
|
197
|
+
};
|
|
198
|
+
const fallbackFinder = createFinder(["postcss-loader"]);
|
|
199
|
+
return {
|
|
200
|
+
findRewriteAnchor: fallbackFinder,
|
|
201
|
+
findClassSetAnchor: fallbackFinder
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
//#endregion
|
|
205
|
+
export { hasLoaderEntry as a, applyTailwindcssCssImportRewrite as c, isMpx as d, patchMpxLoaderResolve as f, getCacheKey as i, ensureMpxTailwindcssAliases as l, __dirname as n, hasWatchChanges as o, setupMpxTailwindcssRedirect as p, createAssetHashByChunkMap as r, isCssLikeModuleResource as s, createLoaderAnchorFinders as t, injectMpxCssRewritePreRules as u };
|