weapp-tailwindcss 5.0.13 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +1 -1
- package/README.md +1 -1
- package/dist/auto-Ba6hDrse.mjs +13 -0
- package/dist/auto-DtU6f3X6.js +18 -0
- package/dist/bundlers/shared/css-cleanup.d.ts +1 -1
- package/dist/bundlers/shared/generator-css/directives.d.ts +2 -1
- package/dist/bundlers/shared/generator-css/generation-helpers.d.ts +21 -9
- package/dist/bundlers/shared/generator-css/local-imports.d.ts +3 -0
- package/dist/bundlers/shared/generator-css/source-resolver/apply-reference.d.ts +3 -0
- package/dist/bundlers/shared/generator-css/source-resolver/matching.d.ts +0 -1
- package/dist/bundlers/shared/generator-css/source-resolver/metadata.d.ts +1 -1
- package/dist/bundlers/shared/generator-css/source-resolver/types.d.ts +3 -3
- package/dist/bundlers/shared/generator-css/source-resolver.d.ts +1 -1
- package/dist/bundlers/shared/generator-css/types.d.ts +13 -1
- package/dist/bundlers/shared/generator-css/user-css.d.ts +5 -1
- package/dist/bundlers/shared/run-tasks.d.ts +1 -0
- package/dist/bundlers/shared/v4-generation-core.d.ts +11 -0
- package/dist/bundlers/vite/css-finalizer.d.ts +1 -1
- package/dist/bundlers/vite/css-memory.d.ts +10 -0
- package/dist/bundlers/vite/generate-bundle/candidates.d.ts +0 -1
- package/dist/bundlers/vite/generate-bundle/configured-css-sources.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/css-output.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/env-flags.d.ts +0 -1
- package/dist/bundlers/vite/generate-bundle/final-css-assets.d.ts +12 -0
- package/dist/bundlers/vite/generate-bundle/finalize.d.ts +5 -0
- package/dist/bundlers/vite/generate-bundle/memory-debug.d.ts +21 -18
- package/dist/bundlers/vite/generate-bundle/sfc-style-source.d.ts +3 -1
- package/dist/bundlers/vite/generate-bundle/source-candidate-scope.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/types.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/vite-css-cache.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle.d.ts +3 -1
- package/dist/bundlers/vite/incremental-runtime-class-set/escaped-candidates.d.ts +1 -0
- package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +3 -3
- package/dist/bundlers/vite/rewrite-css-imports.d.ts +1 -0
- package/dist/bundlers/vite/runtime-class-set.d.ts +5 -5
- package/dist/bundlers/vite/source-candidates/script.d.ts +1 -7
- package/dist/bundlers/vite/source-candidates.d.ts +9 -2
- package/dist/bundlers/vite/source-scan/css-entries.d.ts +2 -6
- package/dist/bundlers/vite/source-scan.d.ts +2 -2
- package/dist/bundlers/vite/uni-app-x-css-options.d.ts +1 -1
- package/dist/bundlers/vite/utils.d.ts +1 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +24 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/helpers.d.ts +48 -11
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/source-candidate-cache.d.ts +28 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +4 -2
- package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +10 -1
- package/dist/bundlers/webpack/shared/css-loader-runtime.d.ts +1 -0
- package/dist/cache/index.d.ts +1 -0
- package/dist/cli/mount-options.d.ts +2 -2
- package/dist/cli.js +124 -437
- package/dist/cli.mjs +120 -433
- package/dist/context/index.d.ts +3 -3
- package/dist/context/style-options.d.ts +4 -1
- package/dist/context/tailwindcss.d.ts +1 -1
- package/dist/{precheck-B0Z8yW7E.js → context-BHxLe743.js} +391 -153
- package/dist/{precheck-CRI90iL1.mjs → context-Mbzkek1q.mjs} +368 -137
- package/dist/core.js +15 -12
- package/dist/core.mjs +10 -7
- package/dist/css-macro.js +1 -1
- package/dist/css-macro.mjs +1 -1
- package/dist/{defaults-C_J_kBpw.js → defaults-CVcKbXBG.js} +4 -15
- package/dist/{defaults-Bqx18S1f.mjs → defaults-ZElj1zKc.mjs} +5 -10
- package/dist/defaults.d.ts +1 -7
- package/dist/defaults.js +1 -2
- package/dist/defaults.mjs +2 -2
- package/dist/generator/index.d.ts +6 -7
- package/dist/generator/options.d.ts +3 -3
- package/dist/generator/types.d.ts +9 -10
- package/dist/generator-9rUz4Hcb.js +170 -0
- package/dist/generator-Dc4qaPmT.mjs +123 -0
- package/dist/generator.js +10 -16
- package/dist/generator.mjs +3 -3
- package/dist/{gulp-XT8Jc7lH.js → gulp-B_sdP6dx.js} +47 -87
- package/dist/{gulp-DfOQERcV.mjs → gulp-uM36oIJs.mjs} +40 -80
- package/dist/gulp.js +1 -1
- package/dist/gulp.mjs +1 -1
- package/dist/{hmr-timing-DQIP_8qP.mjs → hmr-timing-BXMLsF4b.mjs} +1145 -842
- package/dist/{hmr-timing-BMftW7Us.js → hmr-timing-CogqkFaF.js} +1262 -881
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/dist/js/fast-path/oxc.d.ts +4 -0
- package/dist/js/precheck.d.ts +1 -0
- package/dist/postcss.js +3 -4
- package/dist/postcss.mjs +2 -3
- package/dist/presets.js +9 -19
- package/dist/presets.mjs +8 -18
- package/dist/runtime-branch/create-branch.d.ts +2 -0
- package/dist/runtime-branch/generator-target-env.d.ts +4 -0
- package/dist/runtime-branch/index.d.ts +6 -0
- package/dist/runtime-branch/mini-program.d.ts +2 -0
- package/dist/runtime-branch/native-app.d.ts +2 -0
- package/dist/runtime-branch/platform.d.ts +6 -0
- package/dist/runtime-branch/tailwind-version.d.ts +2 -0
- package/dist/runtime-branch/types.d.ts +37 -0
- package/dist/runtime-branch/web.d.ts +2 -0
- package/dist/runtime-branch.d.ts +1 -0
- package/dist/{bundle-state-CKWeTEhv.js → source-candidate-scan-signature-2ybpptAK.js} +261 -19
- package/dist/{bundle-state-zQ2MrDdi.mjs → source-candidate-scan-signature-Cvb5z1ha.mjs} +187 -17
- package/dist/tailwindcss/candidates.d.ts +7 -0
- package/dist/tailwindcss/index.d.ts +2 -2
- package/dist/tailwindcss/runtime/cache.d.ts +6 -6
- package/dist/tailwindcss/runtime-factory.d.ts +12 -0
- package/dist/tailwindcss/runtime-options.d.ts +8 -0
- package/dist/tailwindcss/runtime-types.d.ts +86 -0
- package/dist/tailwindcss/runtime.d.ts +6 -6
- package/dist/tailwindcss/source-scan.d.ts +1 -1
- package/dist/tailwindcss/targets.d.ts +2 -2
- package/dist/tailwindcss/v4/config.d.ts +3 -3
- package/dist/tailwindcss/v4/css-entries.d.ts +1 -0
- package/dist/tailwindcss/v4/css-sources.d.ts +4 -2
- package/dist/tailwindcss/v4/index.d.ts +1 -1
- package/dist/tailwindcss/v4/multi-runtime.d.ts +2 -0
- package/dist/tailwindcss/v4/runtime-factory.d.ts +15 -0
- package/dist/tailwindcss/v4/runtime-options.d.ts +2 -0
- package/dist/tailwindcss/v4-engine/design-system.d.ts +1 -1
- package/dist/tailwindcss/v4-engine/generator/css-compat.d.ts +1 -1
- package/dist/tailwindcss/v4-engine/generator/rpx-candidates.d.ts +3 -3
- package/dist/tailwindcss/v4-engine/generator/scan-sources.d.ts +1 -1
- package/dist/tailwindcss/v4-engine/generator.d.ts +10 -3
- package/dist/tailwindcss/v4-engine/index.d.ts +1 -1
- package/dist/tailwindcss/v4-engine/miniprogram.d.ts +7 -1
- package/dist/tailwindcss/v4-engine/source.d.ts +23 -6
- package/dist/tailwindcss/v4-engine/types.d.ts +8 -9
- package/dist/tailwindcss/version.d.ts +1 -1
- package/dist/tailwindcss-DHIYcqXT.js +1523 -0
- package/dist/tailwindcss-wyUHrfil.mjs +1418 -0
- package/dist/{transform-YmrmxuF3.js → transform-CQVOgmzM.js} +17 -17
- package/dist/{transform-DfcEjsZF.mjs → transform-tExdt40m.mjs} +2 -2
- package/dist/typedoc.export.d.ts +1 -1
- package/dist/types/index.d.ts +16 -17
- package/dist/types/shared.d.ts +1 -1
- package/dist/types/{typedoc-tailwindcss-patch.d.ts → typedoc-tailwindcss-runtime.d.ts} +4 -10
- package/dist/types/user-defined-options/general.d.ts +5 -3
- package/dist/types/user-defined-options/important.d.ts +2 -2
- package/dist/uni-app-x/style-asset.d.ts +1 -0
- package/dist/v4-engine-CF9zt4Cw.mjs +2396 -0
- package/dist/v4-engine-D4ubP7N5.js +2778 -0
- package/dist/{vite-CXHVsHmX.js → vite-CP0ylSxZ.js} +1081 -542
- package/dist/{vite-DjI09vVN.mjs → vite-CPO83EhA.mjs} +916 -376
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +5350 -4165
- package/dist/weapp-tw-runtime-classset-loader.js +15 -4
- package/dist/webpack-Bsek8VhR.js +2094 -0
- package/dist/webpack-BzqhJ8yK.mjs +2082 -0
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +4 -5
- package/dist/auto-CTp6wE5a.js +0 -33
- package/dist/auto-Cl8_hsG6.mjs +0 -22
- package/dist/bundlers/vite/incremental-runtime-class-set/v3-candidates.d.ts +0 -13
- package/dist/bundlers/vite/source-candidates/tailwind-v3-default-extractor.d.ts +0 -1
- package/dist/context/tailwindcss/rax.d.ts +0 -2
- package/dist/generator-CzpArpCL.js +0 -92
- package/dist/generator-ITLd7PTl.mjs +0 -67
- package/dist/tailwindcss/patcher-options.d.ts +0 -8
- package/dist/tailwindcss/patcher.d.ts +0 -12
- package/dist/tailwindcss/runtime-patch.d.ts +0 -5
- package/dist/tailwindcss/v3-engine/generator/cache-key.d.ts +0 -3
- package/dist/tailwindcss/v3-engine/generator/content.d.ts +0 -10
- package/dist/tailwindcss/v3-engine/generator/runtime-ready.d.ts +0 -2
- package/dist/tailwindcss/v3-engine/generator.d.ts +0 -19
- package/dist/tailwindcss/v3-engine/index.d.ts +0 -4
- package/dist/tailwindcss/v3-engine/miniprogram.d.ts +0 -4
- package/dist/tailwindcss/v3-engine/source.d.ts +0 -5
- package/dist/tailwindcss/v3-engine/types.d.ts +0 -61
- package/dist/tailwindcss/v4/multi-patcher.d.ts +0 -2
- package/dist/tailwindcss/v4/patcher-options.d.ts +0 -2
- package/dist/tailwindcss/v4/patcher.d.ts +0 -15
- package/dist/tailwindcss/v4-engine/tailwind-v3-compatibility.d.ts +0 -1
- package/dist/tailwindcss/v4-engine/tailwind-v3-default-colors.d.ts +0 -1
- package/dist/tailwindcss-DTq3uYBK.mjs +0 -556
- package/dist/tailwindcss-DZEwT3C_.js +0 -613
- package/dist/v3-engine-2rrgylhn.js +0 -4686
- package/dist/v3-engine-C6eJ0YzK.mjs +0 -4272
- package/dist/webpack-BcPpnT90.mjs +0 -1184
- package/dist/webpack-CfkUkMXG.js +0 -1196
- /package/dist/tailwindcss/{patcher-resolve.d.ts → runtime-resolve.d.ts} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_framework = require("./framework.js");
|
|
3
|
-
const require_generator = require("./generator-
|
|
4
|
-
const require_gulp = require("./gulp-
|
|
3
|
+
const require_generator = require("./generator-9rUz4Hcb.js");
|
|
4
|
+
const require_gulp = require("./gulp-B_sdP6dx.js");
|
|
5
5
|
const require_postcss = require("./postcss.js");
|
|
6
|
-
const require_vite = require("./vite-
|
|
7
|
-
const require_webpack = require("./webpack-
|
|
6
|
+
const require_vite = require("./vite-CP0ylSxZ.js");
|
|
7
|
+
const require_webpack = require("./webpack-Bsek8VhR.js");
|
|
8
8
|
let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
|
|
9
9
|
exports.WeappTailwindcss = require_vite.WeappTailwindcss;
|
|
10
10
|
exports.createPlugins = require_gulp.createPlugins;
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { detectAppType, detectAppTypeFromEnv, detectAppTypeFromPackageJson, isMpxPackage, isRunningInHBuilderX, isTaroPackage, isUniAppPackage, isUniAppVitePackage, isUniAppXManifest, isUniAppXPackage, isWeappVitePackage, resolveImplicitAppTypeFromViteRoot, resolveUniPlatform, resolveUniPlatformsFromEnv, resolveUniUtsPlatform } from "./framework.mjs";
|
|
2
|
-
import { t as createWeappTailwindcssGenerator } from "./generator-
|
|
3
|
-
import { t as createPlugins } from "./gulp-
|
|
2
|
+
import { t as createWeappTailwindcssGenerator } from "./generator-Dc4qaPmT.mjs";
|
|
3
|
+
import { t as createPlugins } from "./gulp-uM36oIJs.mjs";
|
|
4
4
|
import weappTailwindcssPostcssPlugin from "./postcss.mjs";
|
|
5
|
-
import { t as WeappTailwindcss } from "./vite-
|
|
6
|
-
import { n as weappTailwindcssPackageDir } from "./webpack-
|
|
5
|
+
import { t as WeappTailwindcss } from "./vite-CPO83EhA.mjs";
|
|
6
|
+
import { n as weappTailwindcssPackageDir } from "./webpack-BzqhJ8yK.mjs";
|
|
7
7
|
import { unitConversionComposeRules, unitConversionPresets } from "@weapp-tailwindcss/postcss";
|
|
8
8
|
export { WeappTailwindcss, createPlugins, createWeappTailwindcssGenerator, detectAppType, detectAppTypeFromEnv, detectAppTypeFromPackageJson, isMpxPackage, isRunningInHBuilderX, isTaroPackage, isUniAppPackage, isUniAppVitePackage, isUniAppXManifest, isUniAppXPackage, isWeappVitePackage, resolveImplicitAppTypeFromViteRoot, resolveUniPlatform, resolveUniPlatformsFromEnv, resolveUniUtsPlatform, unitConversionComposeRules, unitConversionPresets, weappTailwindcssPackageDir, weappTailwindcssPostcssPlugin };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { IJsHandlerOptions, JsHandlerResult } from '../../types';
|
|
2
|
+
export declare function isOxcParserRuntimeSupported(version?: string): boolean;
|
|
3
|
+
export declare function canUseOxcJsFastPath(options: IJsHandlerOptions): boolean;
|
|
4
|
+
export declare function oxcJsHandler(rawSource: string, options: IJsHandlerOptions): JsHandlerResult | undefined;
|
package/dist/js/precheck.d.ts
CHANGED
package/dist/postcss.js
CHANGED
|
@@ -2,15 +2,14 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
-
const
|
|
6
|
-
const require_generator = require("./generator-
|
|
5
|
+
const require_v4_engine = require("./v4-engine-D4ubP7N5.js");
|
|
6
|
+
const require_generator = require("./generator-9rUz4Hcb.js");
|
|
7
7
|
const weappTailwindcssPostcssPlugin = (0, require("@weapp-tailwindcss/postcss").createWeappTailwindcssPostcssPlugin)({
|
|
8
8
|
createGenerator: (source) => {
|
|
9
9
|
return require_generator.createWeappTailwindcssGenerator(source);
|
|
10
10
|
},
|
|
11
11
|
normalizeGeneratorOptions: (options) => require_generator.normalizeWeappTailwindcssGeneratorOptions(options),
|
|
12
|
-
|
|
13
|
-
resolveTailwindV4Source: (options) => require_v3_engine.resolveTailwindV4Source(options)
|
|
12
|
+
resolveTailwindV4Source: (options) => require_v4_engine.resolveTailwindV4Source(options)
|
|
14
13
|
});
|
|
15
14
|
//#endregion
|
|
16
15
|
exports.default = weappTailwindcssPostcssPlugin;
|
package/dist/postcss.mjs
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import { i as normalizeWeappTailwindcssGeneratorOptions, t as createWeappTailwindcssGenerator } from "./generator-
|
|
1
|
+
import { t as resolveTailwindV4Source } from "./v4-engine-CF9zt4Cw.mjs";
|
|
2
|
+
import { i as normalizeWeappTailwindcssGeneratorOptions, t as createWeappTailwindcssGenerator } from "./generator-Dc4qaPmT.mjs";
|
|
3
3
|
import { createWeappTailwindcssPostcssPlugin } from "@weapp-tailwindcss/postcss";
|
|
4
4
|
const weappTailwindcssPostcssPlugin = createWeappTailwindcssPostcssPlugin({
|
|
5
5
|
createGenerator: (source) => {
|
|
6
6
|
return createWeappTailwindcssGenerator(source);
|
|
7
7
|
},
|
|
8
8
|
normalizeGeneratorOptions: (options) => normalizeWeappTailwindcssGeneratorOptions(options),
|
|
9
|
-
resolveTailwindV3Source: (options) => resolveTailwindV3Source(options),
|
|
10
9
|
resolveTailwindV4Source: (options) => resolveTailwindV4Source(options)
|
|
11
10
|
});
|
|
12
11
|
//#endregion
|
package/dist/presets.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_chunk = require("./chunk-emK7D4bc.js");
|
|
3
|
-
const
|
|
3
|
+
const require_v4_engine = require("./v4-engine-D4ubP7N5.js");
|
|
4
4
|
const require_utils = require("./utils-BCa37Wqj.js");
|
|
5
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
5
|
+
const require_tailwindcss = require("./tailwindcss-DHIYcqXT.js");
|
|
6
6
|
require("./logger-TlKT3xmR.js");
|
|
7
7
|
let node_path = require("node:path");
|
|
8
8
|
node_path = require_chunk.__toESM(node_path);
|
|
@@ -21,19 +21,15 @@ function createBasePreset(options = {}) {
|
|
|
21
21
|
const { base, cssEntries, resolve, rawOptions, ...userOptions } = options;
|
|
22
22
|
const baseDir = require_tailwindcss.resolveTailwindcssBasedir(base);
|
|
23
23
|
const normalizedCssEntries = normalizeCssEntries(cssEntries);
|
|
24
|
-
const tailwindConfig = {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
base: baseDir,
|
|
29
|
-
cssEntries: normalizedCssEntries
|
|
30
|
-
})
|
|
31
|
-
};
|
|
24
|
+
const tailwindConfig = { v4: require_v4_engine.omitUndefined({
|
|
25
|
+
base: baseDir,
|
|
26
|
+
cssEntries: normalizedCssEntries
|
|
27
|
+
}) };
|
|
32
28
|
if (normalizedCssEntries && normalizedCssEntries.length > 0) tailwindConfig.version = 4;
|
|
33
29
|
const preset = {
|
|
34
30
|
tailwindcssBasedir: baseDir,
|
|
35
31
|
tailwindcss: tailwindConfig,
|
|
36
|
-
|
|
32
|
+
tailwindcssRuntimeOptions: {
|
|
37
33
|
projectRoot: baseDir,
|
|
38
34
|
tailwindcss: resolve ? {
|
|
39
35
|
...tailwindConfig,
|
|
@@ -85,11 +81,6 @@ function resolveInstalledTailwindDefaults(resolve) {
|
|
|
85
81
|
packageName: "tailwindcss",
|
|
86
82
|
postcssPlugin: "@tailwindcss/postcss"
|
|
87
83
|
};
|
|
88
|
-
if (major === 3) return {
|
|
89
|
-
version: 3,
|
|
90
|
-
packageName: "tailwindcss",
|
|
91
|
-
postcssPlugin: "tailwindcss"
|
|
92
|
-
};
|
|
93
84
|
}
|
|
94
85
|
function uniAppX(options) {
|
|
95
86
|
_weapp_tailwindcss_logger.logger.info(`UNI_PLATFORM: ${node_process.default.env["UNI_PLATFORM"]}`);
|
|
@@ -115,14 +106,13 @@ function uniAppX(options) {
|
|
|
115
106
|
unitConversion: options.unitConversion,
|
|
116
107
|
appType: "uni-app-x",
|
|
117
108
|
tailwindcssBasedir: options.base,
|
|
118
|
-
|
|
109
|
+
tailwindcssRuntimeOptions: {
|
|
119
110
|
projectRoot: options.base,
|
|
120
111
|
tailwindcss: {
|
|
121
112
|
...installedTailwindDefaults ?? {},
|
|
122
113
|
cwd: options.base,
|
|
123
114
|
resolve: resolvedResolve,
|
|
124
|
-
|
|
125
|
-
v4: require_v3_engine.omitUndefined({
|
|
115
|
+
v4: require_v4_engine.omitUndefined({
|
|
126
116
|
base: options.base,
|
|
127
117
|
cssEntries
|
|
128
118
|
})
|
package/dist/presets.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ct as omitUndefined } from "./v4-engine-CF9zt4Cw.mjs";
|
|
2
2
|
import { n as defuOverrideArray, o as resolveUniUtsPlatform } from "./utils-DodxWHGz.mjs";
|
|
3
|
-
import { i as resolveUniAppXOptions, n as resolveTailwindcssBasedir } from "./tailwindcss-
|
|
3
|
+
import { i as resolveUniAppXOptions, n as resolveTailwindcssBasedir } from "./tailwindcss-wyUHrfil.mjs";
|
|
4
4
|
import { t as logger } from "./logger-BNzxZbZj.mjs";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import process from "node:process";
|
|
@@ -15,19 +15,15 @@ function createBasePreset(options = {}) {
|
|
|
15
15
|
const { base, cssEntries, resolve, rawOptions, ...userOptions } = options;
|
|
16
16
|
const baseDir = resolveTailwindcssBasedir(base);
|
|
17
17
|
const normalizedCssEntries = normalizeCssEntries(cssEntries);
|
|
18
|
-
const tailwindConfig = {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
base: baseDir,
|
|
23
|
-
cssEntries: normalizedCssEntries
|
|
24
|
-
})
|
|
25
|
-
};
|
|
18
|
+
const tailwindConfig = { v4: omitUndefined({
|
|
19
|
+
base: baseDir,
|
|
20
|
+
cssEntries: normalizedCssEntries
|
|
21
|
+
}) };
|
|
26
22
|
if (normalizedCssEntries && normalizedCssEntries.length > 0) tailwindConfig.version = 4;
|
|
27
23
|
const preset = {
|
|
28
24
|
tailwindcssBasedir: baseDir,
|
|
29
25
|
tailwindcss: tailwindConfig,
|
|
30
|
-
|
|
26
|
+
tailwindcssRuntimeOptions: {
|
|
31
27
|
projectRoot: baseDir,
|
|
32
28
|
tailwindcss: resolve ? {
|
|
33
29
|
...tailwindConfig,
|
|
@@ -79,11 +75,6 @@ function resolveInstalledTailwindDefaults(resolve) {
|
|
|
79
75
|
packageName: "tailwindcss",
|
|
80
76
|
postcssPlugin: "@tailwindcss/postcss"
|
|
81
77
|
};
|
|
82
|
-
if (major === 3) return {
|
|
83
|
-
version: 3,
|
|
84
|
-
packageName: "tailwindcss",
|
|
85
|
-
postcssPlugin: "tailwindcss"
|
|
86
|
-
};
|
|
87
78
|
}
|
|
88
79
|
function uniAppX(options) {
|
|
89
80
|
logger.info(`UNI_PLATFORM: ${process.env["UNI_PLATFORM"]}`);
|
|
@@ -109,13 +100,12 @@ function uniAppX(options) {
|
|
|
109
100
|
unitConversion: options.unitConversion,
|
|
110
101
|
appType: "uni-app-x",
|
|
111
102
|
tailwindcssBasedir: options.base,
|
|
112
|
-
|
|
103
|
+
tailwindcssRuntimeOptions: {
|
|
113
104
|
projectRoot: options.base,
|
|
114
105
|
tailwindcss: {
|
|
115
106
|
...installedTailwindDefaults ?? {},
|
|
116
107
|
cwd: options.base,
|
|
117
108
|
resolve: resolvedResolve,
|
|
118
|
-
v3: { cwd: options.base },
|
|
119
109
|
v4: omitUndefined({
|
|
120
110
|
base: options.base,
|
|
121
111
|
cssEntries
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { RuntimeBranch, RuntimeBranchBaseContext, RuntimePlatformFamily } from './types';
|
|
2
|
+
export declare function createRuntimeBranch(base: RuntimeBranchBaseContext, platformFamily: RuntimePlatformFamily, options: Pick<RuntimeBranch, 'platform'> & Partial<Pick<RuntimeBranch, 'nativeAppPlatform'>>): RuntimeBranch;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { WeappTailwindcssGeneratorTarget } from './types';
|
|
2
|
+
export declare const generatorTargetEnvKeys: readonly ["UNI_PLATFORM", "UNI_UTS_PLATFORM", "MPX_CLI_MODE", "MPX_CURRENT_TARGET_MODE", "TARO_ENV", "WEAPP_TW_TARGET", "WEAPP_TAILWINDCSS_TARGET"];
|
|
3
|
+
export declare function shouldUseWebGeneratorTargetFromEnv(): boolean;
|
|
4
|
+
export declare function inferGeneratorTargetFromEnv(): WeappTailwindcssGeneratorTarget;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { RuntimeBranch, RuntimeBranchContext, RuntimeBranchGeneratorOptions } from './types';
|
|
2
|
+
export declare function resolveRuntimeBranch(context: RuntimeBranchContext): RuntimeBranch;
|
|
3
|
+
export declare function resolveGeneratorRuntimeBranch(options: RuntimeBranchGeneratorOptions, context?: Omit<RuntimeBranchContext, 'generatorTarget'>): RuntimeBranch;
|
|
4
|
+
export declare function shouldUseMiniProgramCssBranch(branch: RuntimeBranch): boolean;
|
|
5
|
+
export declare function shouldUseNativeAppCssBranch(branch: RuntimeBranch): boolean;
|
|
6
|
+
export type { NativeAppPlatform, RuntimeBranch, RuntimeBranchContext, RuntimeBranchGeneratorOptions, RuntimePlatformFamily, TailwindcssBranchVersion, } from './types';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { NativeAppPlatform, RuntimeBranchContext } from './types';
|
|
2
|
+
import type { UniUtsPlatformInfo } from '../utils';
|
|
3
|
+
export declare function isRuntimeUniAppXEnabled(value: RuntimeBranchContext['uniAppX']): boolean;
|
|
4
|
+
export declare function normalizeRuntimeUniUtsPlatform(value: RuntimeBranchContext['uniUtsPlatform']): UniUtsPlatformInfo;
|
|
5
|
+
export declare function resolveNativeAppPlatform(platform: UniUtsPlatformInfo): NativeAppPlatform;
|
|
6
|
+
export declare function resolveExplicitOrEnvPlatform(context: RuntimeBranchContext, uniUtsPlatform: UniUtsPlatformInfo): string | undefined;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
|
|
2
|
+
import type { AppType } from '../types/shared';
|
|
3
|
+
import type { UniUtsPlatformInfo } from '../utils';
|
|
4
|
+
export type TailwindcssBranchVersion = 4;
|
|
5
|
+
export type RuntimePlatformFamily = 'web' | 'mini-program' | 'native-app';
|
|
6
|
+
export type NativeAppPlatform = 'android' | 'ios' | 'harmony' | 'unknown';
|
|
7
|
+
export type WeappTailwindcssGeneratorTarget = 'weapp' | 'web';
|
|
8
|
+
export interface RuntimeBranchContext {
|
|
9
|
+
appType?: AppType | undefined;
|
|
10
|
+
generatorTarget: WeappTailwindcssGeneratorTarget;
|
|
11
|
+
platform?: IStyleHandlerOptions['platform'] | undefined;
|
|
12
|
+
tailwindcssMajorVersion?: number | undefined;
|
|
13
|
+
uniAppX?: boolean | {
|
|
14
|
+
enabled?: boolean | undefined;
|
|
15
|
+
} | undefined;
|
|
16
|
+
uniUtsPlatform?: string | UniUtsPlatformInfo | undefined;
|
|
17
|
+
}
|
|
18
|
+
export interface RuntimeBranch {
|
|
19
|
+
tailwindcssVersion: TailwindcssBranchVersion;
|
|
20
|
+
generatorTarget: WeappTailwindcssGeneratorTarget;
|
|
21
|
+
platformFamily: RuntimePlatformFamily;
|
|
22
|
+
platform: string | undefined;
|
|
23
|
+
nativeAppPlatform?: NativeAppPlatform | undefined;
|
|
24
|
+
isTailwindV4: boolean;
|
|
25
|
+
isWeb: boolean;
|
|
26
|
+
isMiniProgram: boolean;
|
|
27
|
+
isNativeApp: boolean;
|
|
28
|
+
}
|
|
29
|
+
export interface RuntimeBranchGeneratorOptions {
|
|
30
|
+
target: WeappTailwindcssGeneratorTarget;
|
|
31
|
+
branch?: RuntimeBranch | undefined;
|
|
32
|
+
}
|
|
33
|
+
export interface RuntimeBranchBaseContext {
|
|
34
|
+
context: RuntimeBranchContext;
|
|
35
|
+
tailwindcssVersion: TailwindcssBranchVersion;
|
|
36
|
+
uniUtsPlatform: UniUtsPlatformInfo;
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './runtime-branch/index';
|