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/core.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
2
|
+
const require_context = require("./context-BHxLe743.js");
|
|
3
3
|
let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
|
|
4
4
|
//#region src/core.ts
|
|
5
5
|
const DEFAULT_MAIN_CHUNK_STYLE_OPTIONS = Object.freeze({ isMainChunk: true });
|
|
@@ -14,16 +14,19 @@ function resolveTransformWxssOptions(options) {
|
|
|
14
14
|
* @returns 返回一个包含 transformWxss、transformWxml 和 transformJs 方法的对象
|
|
15
15
|
*/
|
|
16
16
|
function createContext(options = {}) {
|
|
17
|
-
const
|
|
18
|
-
const
|
|
17
|
+
const opts = require_context.getCompilerContext(options);
|
|
18
|
+
const { templateHandler, styleHandler, jsHandler } = opts;
|
|
19
|
+
const initialTailwindRuntime = opts.tailwindRuntime;
|
|
20
|
+
const refreshTailwindcssRuntime = opts.refreshTailwindcssRuntime;
|
|
21
|
+
const readyPromise = require_context.createTailwindRuntimeReadyPromise(initialTailwindRuntime);
|
|
19
22
|
let runtimeSet = /* @__PURE__ */ new Set();
|
|
20
23
|
const runtimeState = {
|
|
21
|
-
|
|
24
|
+
tailwindRuntime: initialTailwindRuntime,
|
|
22
25
|
readyPromise,
|
|
23
|
-
|
|
26
|
+
refreshTailwindcssRuntime
|
|
24
27
|
};
|
|
25
28
|
const defaultJsHandlerOptionsCache = /* @__PURE__ */ new Map();
|
|
26
|
-
function getDefaultJsHandlerOptions(majorVersion = runtimeState.
|
|
29
|
+
function getDefaultJsHandlerOptions(majorVersion = runtimeState.tailwindRuntime.majorVersion) {
|
|
27
30
|
if (typeof majorVersion !== "number") return;
|
|
28
31
|
let cached = defaultJsHandlerOptionsCache.get(majorVersion);
|
|
29
32
|
if (!cached) {
|
|
@@ -35,7 +38,7 @@ function createContext(options = {}) {
|
|
|
35
38
|
function withRuntimeTailwindMajorVersion(options) {
|
|
36
39
|
if (!options) return getDefaultJsHandlerOptions();
|
|
37
40
|
if (typeof options.tailwindcssMajorVersion === "number") return options;
|
|
38
|
-
const majorVersion = runtimeState.
|
|
41
|
+
const majorVersion = runtimeState.tailwindRuntime.majorVersion;
|
|
39
42
|
if (typeof majorVersion !== "number") return options;
|
|
40
43
|
return {
|
|
41
44
|
...options,
|
|
@@ -106,25 +109,25 @@ function createContext(options = {}) {
|
|
|
106
109
|
async function transformWxss(rawCss, options) {
|
|
107
110
|
await runtimeState.readyPromise;
|
|
108
111
|
const result = await styleHandler(rawCss, resolveTransformWxssOptions(options));
|
|
109
|
-
runtimeSet = await
|
|
112
|
+
runtimeSet = await require_context.ensureRuntimeClassSet(runtimeState);
|
|
110
113
|
return result;
|
|
111
114
|
}
|
|
112
115
|
async function getRuntimeSet(options) {
|
|
113
116
|
await runtimeState.readyPromise;
|
|
114
|
-
runtimeSet = await
|
|
117
|
+
runtimeSet = await require_context.ensureRuntimeClassSet(runtimeState, options);
|
|
115
118
|
return runtimeSet;
|
|
116
119
|
}
|
|
117
120
|
async function transformJs(rawJs, options) {
|
|
118
121
|
await runtimeState.readyPromise;
|
|
119
122
|
if (options?.runtimeSet) runtimeSet = options.runtimeSet;
|
|
120
|
-
else if (runtimeSet.size === 0) runtimeSet = await
|
|
123
|
+
else if (runtimeSet.size === 0) runtimeSet = await require_context.ensureRuntimeClassSet(runtimeState, { forceCollect: true });
|
|
121
124
|
const resolvedOptions = resolveTransformJsOptions(options);
|
|
122
|
-
if (
|
|
125
|
+
if (require_context.shouldSkipJsTransform(rawJs, resolvedOptions)) return { code: rawJs };
|
|
123
126
|
return await jsHandler(rawJs, runtimeSet, resolvedOptions);
|
|
124
127
|
}
|
|
125
128
|
async function transformWxml(rawWxml, options) {
|
|
126
129
|
await runtimeState.readyPromise;
|
|
127
|
-
if (!options?.runtimeSet && runtimeSet.size === 0) runtimeSet = await
|
|
130
|
+
if (!options?.runtimeSet && runtimeSet.size === 0) runtimeSet = await require_context.ensureRuntimeClassSet(runtimeState, { forceCollect: true });
|
|
128
131
|
return templateHandler(rawWxml, resolveTransformWxmlOptions(options));
|
|
129
132
|
}
|
|
130
133
|
return {
|
package/dist/core.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as shouldSkipJsTransform, t as getCompilerContext, v as createTailwindRuntimeReadyPromise, y as ensureRuntimeClassSet } from "./context-Mbzkek1q.mjs";
|
|
2
2
|
import { defuOverrideArray } from "@weapp-tailwindcss/shared";
|
|
3
3
|
//#region src/core.ts
|
|
4
4
|
const DEFAULT_MAIN_CHUNK_STYLE_OPTIONS = Object.freeze({ isMainChunk: true });
|
|
@@ -13,16 +13,19 @@ function resolveTransformWxssOptions(options) {
|
|
|
13
13
|
* @returns 返回一个包含 transformWxss、transformWxml 和 transformJs 方法的对象
|
|
14
14
|
*/
|
|
15
15
|
function createContext(options = {}) {
|
|
16
|
-
const
|
|
17
|
-
const
|
|
16
|
+
const opts = getCompilerContext(options);
|
|
17
|
+
const { templateHandler, styleHandler, jsHandler } = opts;
|
|
18
|
+
const initialTailwindRuntime = opts.tailwindRuntime;
|
|
19
|
+
const refreshTailwindcssRuntime = opts.refreshTailwindcssRuntime;
|
|
20
|
+
const readyPromise = createTailwindRuntimeReadyPromise(initialTailwindRuntime);
|
|
18
21
|
let runtimeSet = /* @__PURE__ */ new Set();
|
|
19
22
|
const runtimeState = {
|
|
20
|
-
|
|
23
|
+
tailwindRuntime: initialTailwindRuntime,
|
|
21
24
|
readyPromise,
|
|
22
|
-
|
|
25
|
+
refreshTailwindcssRuntime
|
|
23
26
|
};
|
|
24
27
|
const defaultJsHandlerOptionsCache = /* @__PURE__ */ new Map();
|
|
25
|
-
function getDefaultJsHandlerOptions(majorVersion = runtimeState.
|
|
28
|
+
function getDefaultJsHandlerOptions(majorVersion = runtimeState.tailwindRuntime.majorVersion) {
|
|
26
29
|
if (typeof majorVersion !== "number") return;
|
|
27
30
|
let cached = defaultJsHandlerOptionsCache.get(majorVersion);
|
|
28
31
|
if (!cached) {
|
|
@@ -34,7 +37,7 @@ function createContext(options = {}) {
|
|
|
34
37
|
function withRuntimeTailwindMajorVersion(options) {
|
|
35
38
|
if (!options) return getDefaultJsHandlerOptions();
|
|
36
39
|
if (typeof options.tailwindcssMajorVersion === "number") return options;
|
|
37
|
-
const majorVersion = runtimeState.
|
|
40
|
+
const majorVersion = runtimeState.tailwindRuntime.majorVersion;
|
|
38
41
|
if (typeof majorVersion !== "number") return options;
|
|
39
42
|
return {
|
|
40
43
|
...options,
|
package/dist/css-macro.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-emK7D4bc.js");
|
|
2
|
-
const require_auto = require("./auto-
|
|
2
|
+
const require_auto = require("./auto-DtU6f3X6.js");
|
|
3
3
|
require("./utils-BCa37Wqj.js");
|
|
4
4
|
let tailwindcss_plugin = require("tailwindcss/plugin");
|
|
5
5
|
tailwindcss_plugin = require_chunk.__toESM(tailwindcss_plugin);
|
package/dist/css-macro.mjs
CHANGED
|
@@ -10,20 +10,14 @@ const CSS_FILE_PATTERN = /.+\.(?:wx|ac|jx|tt|q|c|ty)ss$/;
|
|
|
10
10
|
const HTML_FILE_PATTERN = /.+\.(?:(?:wx|ax|jx|ks|tt|q|ty|xhs)ml|swan)$/;
|
|
11
11
|
const JS_FILE_PATTERN = /.+\.[cm]?js?$/;
|
|
12
12
|
const alwaysFalse = () => false;
|
|
13
|
-
const TAILWIND_V3_CSS_PREFLIGHT = {
|
|
14
|
-
"box-sizing": "border-box",
|
|
15
|
-
"border-width": "0",
|
|
16
|
-
"border-style": "solid",
|
|
17
|
-
"border-color": "currentColor"
|
|
18
|
-
};
|
|
19
13
|
const TAILWIND_V4_CSS_PREFLIGHT = {
|
|
20
14
|
"box-sizing": "border-box",
|
|
21
15
|
"margin": "0",
|
|
22
16
|
"padding": "0",
|
|
23
17
|
"border": "0 solid"
|
|
24
18
|
};
|
|
25
|
-
function getDefaultCssPreflight(
|
|
26
|
-
return { ...
|
|
19
|
+
function getDefaultCssPreflight() {
|
|
20
|
+
return { ...TAILWIND_V4_CSS_PREFLIGHT };
|
|
27
21
|
}
|
|
28
22
|
function resolveDefaultCssPreflight(cssPreflight, tailwindcssMajorVersion) {
|
|
29
23
|
if (cssPreflight === false) return false;
|
|
@@ -108,9 +102,10 @@ function getDefaultOptions() {
|
|
|
108
102
|
ignoreCallExpressionIdentifiers: [],
|
|
109
103
|
ignoreTaggedTemplateExpressionIdentifiers: ["weappTwIgnore"],
|
|
110
104
|
replaceRuntimePackages: false,
|
|
105
|
+
rewriteCssImports: false,
|
|
111
106
|
generator: {},
|
|
112
107
|
cssSourceTrace: false,
|
|
113
|
-
|
|
108
|
+
tailwindcssRuntimeOptions: { filter(className) {
|
|
114
109
|
return !(0, _weapp_core_escape.isAllowedClassName)(className);
|
|
115
110
|
} },
|
|
116
111
|
logLevel: "info"
|
|
@@ -129,12 +124,6 @@ Object.defineProperty(exports, "HARD_PARSE_CACHE_MAX_ENTRIES", {
|
|
|
129
124
|
return HARD_PARSE_CACHE_MAX_ENTRIES;
|
|
130
125
|
}
|
|
131
126
|
});
|
|
132
|
-
Object.defineProperty(exports, "TAILWIND_V3_CSS_PREFLIGHT", {
|
|
133
|
-
enumerable: true,
|
|
134
|
-
get: function() {
|
|
135
|
-
return TAILWIND_V3_CSS_PREFLIGHT;
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
127
|
Object.defineProperty(exports, "TAILWIND_V4_CSS_PREFLIGHT", {
|
|
139
128
|
enumerable: true,
|
|
140
129
|
get: function() {
|
|
@@ -9,20 +9,14 @@ const CSS_FILE_PATTERN = /.+\.(?:wx|ac|jx|tt|q|c|ty)ss$/;
|
|
|
9
9
|
const HTML_FILE_PATTERN = /.+\.(?:(?:wx|ax|jx|ks|tt|q|ty|xhs)ml|swan)$/;
|
|
10
10
|
const JS_FILE_PATTERN = /.+\.[cm]?js?$/;
|
|
11
11
|
const alwaysFalse = () => false;
|
|
12
|
-
const TAILWIND_V3_CSS_PREFLIGHT = {
|
|
13
|
-
"box-sizing": "border-box",
|
|
14
|
-
"border-width": "0",
|
|
15
|
-
"border-style": "solid",
|
|
16
|
-
"border-color": "currentColor"
|
|
17
|
-
};
|
|
18
12
|
const TAILWIND_V4_CSS_PREFLIGHT = {
|
|
19
13
|
"box-sizing": "border-box",
|
|
20
14
|
"margin": "0",
|
|
21
15
|
"padding": "0",
|
|
22
16
|
"border": "0 solid"
|
|
23
17
|
};
|
|
24
|
-
function getDefaultCssPreflight(
|
|
25
|
-
return { ...
|
|
18
|
+
function getDefaultCssPreflight() {
|
|
19
|
+
return { ...TAILWIND_V4_CSS_PREFLIGHT };
|
|
26
20
|
}
|
|
27
21
|
function resolveDefaultCssPreflight(cssPreflight, tailwindcssMajorVersion) {
|
|
28
22
|
if (cssPreflight === false) return false;
|
|
@@ -107,13 +101,14 @@ function getDefaultOptions() {
|
|
|
107
101
|
ignoreCallExpressionIdentifiers: [],
|
|
108
102
|
ignoreTaggedTemplateExpressionIdentifiers: ["weappTwIgnore"],
|
|
109
103
|
replaceRuntimePackages: false,
|
|
104
|
+
rewriteCssImports: false,
|
|
110
105
|
generator: {},
|
|
111
106
|
cssSourceTrace: false,
|
|
112
|
-
|
|
107
|
+
tailwindcssRuntimeOptions: { filter(className) {
|
|
113
108
|
return !isAllowedClassName(className);
|
|
114
109
|
} },
|
|
115
110
|
logLevel: "info"
|
|
116
111
|
};
|
|
117
112
|
}
|
|
118
113
|
//#endregion
|
|
119
|
-
export {
|
|
114
|
+
export { DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH as a, resolveDefaultCssPreflight as i, getDefaultCssPreflight as n, HARD_PARSE_CACHE_MAX_ENTRIES as o, getDefaultOptions as r, TAILWIND_V4_CSS_PREFLIGHT as t };
|
package/dist/defaults.d.ts
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
import type { CssPreflightOptions, UserDefinedOptions } from './types';
|
|
2
|
-
export declare const TAILWIND_V3_CSS_PREFLIGHT: {
|
|
3
|
-
'box-sizing': string;
|
|
4
|
-
'border-width': string;
|
|
5
|
-
'border-style': string;
|
|
6
|
-
'border-color': string;
|
|
7
|
-
};
|
|
8
2
|
export declare const TAILWIND_V4_CSS_PREFLIGHT: {
|
|
9
3
|
'box-sizing': string;
|
|
10
4
|
margin: string;
|
|
11
5
|
padding: string;
|
|
12
6
|
border: string;
|
|
13
7
|
};
|
|
14
|
-
export declare function getDefaultCssPreflight(
|
|
8
|
+
export declare function getDefaultCssPreflight(): Exclude<CssPreflightOptions, false>;
|
|
15
9
|
export declare function resolveDefaultCssPreflight(cssPreflight: CssPreflightOptions | undefined, tailwindcssMajorVersion?: number): CssPreflightOptions;
|
|
16
10
|
export declare function getDefaultOptions(): UserDefinedOptions;
|
package/dist/defaults.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_defaults = require("./defaults-
|
|
3
|
-
exports.TAILWIND_V3_CSS_PREFLIGHT = require_defaults.TAILWIND_V3_CSS_PREFLIGHT;
|
|
2
|
+
const require_defaults = require("./defaults-CVcKbXBG.js");
|
|
4
3
|
exports.TAILWIND_V4_CSS_PREFLIGHT = require_defaults.TAILWIND_V4_CSS_PREFLIGHT;
|
|
5
4
|
exports.getDefaultCssPreflight = require_defaults.getDefaultCssPreflight;
|
|
6
5
|
exports.getDefaultOptions = require_defaults.getDefaultOptions;
|
package/dist/defaults.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { i as resolveDefaultCssPreflight, n as getDefaultCssPreflight, r as getDefaultOptions, t as TAILWIND_V4_CSS_PREFLIGHT } from "./defaults-ZElj1zKc.mjs";
|
|
2
|
+
export { TAILWIND_V4_CSS_PREFLIGHT, getDefaultCssPreflight, getDefaultOptions, resolveDefaultCssPreflight };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import type { TailwindResolvedSource, WeappTailwindcssGenerator } from './types';
|
|
2
|
-
import type {
|
|
3
|
-
import {
|
|
4
|
-
import { resolveTailwindV4Source, resolveTailwindV4SourceFromPatcher, resolveTailwindV4SourceFromPatchOptions, resolveTailwindV4SourceOptionsFromPatcher, transformTailwindV4CssByTarget, transformTailwindV4CssToWeapp } from '../tailwindcss/v4-engine';
|
|
2
|
+
import type { TailwindcssRuntimeLike } from '../types';
|
|
3
|
+
import { resolveTailwindV4Source, resolveTailwindV4SourceFromRuntime, resolveTailwindV4SourceFromRuntimeOptions, resolveTailwindV4SourceOptionsFromRuntime, transformTailwindV4CssByTarget, transformTailwindV4CssToWeapp } from '../tailwindcss/v4-engine';
|
|
5
4
|
export declare function createWeappTailwindcssGenerator(source: TailwindResolvedSource): WeappTailwindcssGenerator;
|
|
6
|
-
export declare function
|
|
7
|
-
export declare function
|
|
5
|
+
export declare function resolveTailwindSourceFromRuntime(tailwindRuntime: TailwindcssRuntimeLike): Promise<TailwindResolvedSource>;
|
|
6
|
+
export declare function createWeappTailwindcssGeneratorFromRuntime(tailwindRuntime: TailwindcssRuntimeLike): Promise<WeappTailwindcssGenerator>;
|
|
8
7
|
export { normalizeWeappTailwindcssGeneratorOptions, } from './options';
|
|
9
|
-
export {
|
|
8
|
+
export { resolveTailwindV4Source, resolveTailwindV4SourceFromRuntime, resolveTailwindV4SourceFromRuntimeOptions, resolveTailwindV4SourceOptionsFromRuntime, transformTailwindV4CssByTarget, transformTailwindV4CssToWeapp, };
|
|
10
9
|
export type { NormalizedWeappTailwindcssGeneratorOptions, WeappTailwindcssGeneratorOptions, WeappTailwindcssGeneratorUserOptions, } from './options';
|
|
11
|
-
export type { TailwindCandidateSource, TailwindGeneratorVersion, TailwindResolvedSource,
|
|
10
|
+
export type { TailwindCandidateSource, TailwindGeneratorVersion, TailwindResolvedSource, TailwindV4CandidateSource, TailwindV4DesignSystem, TailwindV4Engine, TailwindV4GenerateOptions, TailwindV4GenerateResult, TailwindV4GenerateTarget, TailwindV4ResolvedSource, TailwindV4SourceOptions, WeappTailwindcssGenerateOptions, WeappTailwindcssGenerateResult, WeappTailwindcssGenerator, WeappTailwindcssGeneratorTarget, } from './types';
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
|
|
2
2
|
import type { WeappTailwindcssGeneratorTarget } from './types';
|
|
3
|
+
import type { RuntimeBranch, RuntimeBranchContext } from '../runtime-branch';
|
|
3
4
|
import type { IArbitraryValues } from '../types/shared';
|
|
4
5
|
export interface WeappTailwindcssGeneratorOptions {
|
|
5
6
|
target?: WeappTailwindcssGeneratorTarget | undefined;
|
|
6
7
|
config?: string | undefined;
|
|
7
8
|
styleOptions?: Partial<IStyleHandlerOptions> | undefined;
|
|
8
9
|
importFallback?: boolean | undefined;
|
|
9
|
-
tailwindcssV3Compatibility?: boolean | undefined;
|
|
10
10
|
bareArbitraryValues?: IArbitraryValues['bareArbitraryValues'] | undefined;
|
|
11
11
|
}
|
|
12
12
|
export type WeappTailwindcssGeneratorUserOptions = WeappTailwindcssGeneratorOptions;
|
|
13
13
|
export interface NormalizedWeappTailwindcssGeneratorOptions {
|
|
14
14
|
target: WeappTailwindcssGeneratorTarget;
|
|
15
|
+
branch: RuntimeBranch;
|
|
15
16
|
config?: string | undefined;
|
|
16
17
|
styleOptions?: Partial<IStyleHandlerOptions> | undefined;
|
|
17
18
|
importFallback: boolean;
|
|
18
|
-
tailwindcssV3Compatibility: boolean;
|
|
19
19
|
bareArbitraryValues?: IArbitraryValues['bareArbitraryValues'] | undefined;
|
|
20
20
|
}
|
|
21
|
-
export declare function normalizeWeappTailwindcssGeneratorOptions(options: WeappTailwindcssGeneratorUserOptions | undefined): NormalizedWeappTailwindcssGeneratorOptions;
|
|
21
|
+
export declare function normalizeWeappTailwindcssGeneratorOptions(options: WeappTailwindcssGeneratorUserOptions | undefined, context?: Omit<RuntimeBranchContext, 'generatorTarget'>): NormalizedWeappTailwindcssGeneratorOptions;
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
|
|
2
|
-
import type {
|
|
2
|
+
import type { WeappTailwindcssGeneratorTarget } from '../runtime-branch';
|
|
3
3
|
import type { TailwindV4CandidateSource, TailwindV4DesignSystem, TailwindV4Engine, TailwindV4GenerateOptions, TailwindV4GenerateResult, TailwindV4GenerateTarget, TailwindV4ResolvedSource, TailwindV4SourceOptions } from '../tailwindcss/v4-engine';
|
|
4
|
-
export type WeappTailwindcssGeneratorTarget
|
|
5
|
-
export type TailwindGeneratorVersion =
|
|
6
|
-
export type TailwindCandidateSource =
|
|
7
|
-
export type TailwindResolvedSource =
|
|
8
|
-
export interface WeappTailwindcssGenerateOptions extends Omit<
|
|
4
|
+
export type { WeappTailwindcssGeneratorTarget };
|
|
5
|
+
export type TailwindGeneratorVersion = 4;
|
|
6
|
+
export type TailwindCandidateSource = TailwindV4CandidateSource;
|
|
7
|
+
export type TailwindResolvedSource = TailwindV4ResolvedSource;
|
|
8
|
+
export interface WeappTailwindcssGenerateOptions extends Omit<TailwindV4GenerateOptions, 'target'> {
|
|
9
9
|
target?: WeappTailwindcssGeneratorTarget | undefined;
|
|
10
10
|
styleOptions?: Partial<IStyleHandlerOptions> | undefined;
|
|
11
|
-
tailwindcssV3Compatibility?: boolean | undefined;
|
|
12
11
|
}
|
|
13
|
-
export type WeappTailwindcssGenerateResult =
|
|
12
|
+
export type WeappTailwindcssGenerateResult = TailwindV4GenerateResult & {
|
|
14
13
|
target: WeappTailwindcssGeneratorTarget;
|
|
15
14
|
rawCss: string;
|
|
16
15
|
};
|
|
17
|
-
export interface WeappTailwindcssGenerator extends Omit<
|
|
16
|
+
export interface WeappTailwindcssGenerator extends Omit<TailwindV4Engine, 'generate'> {
|
|
18
17
|
generate: (options?: WeappTailwindcssGenerateOptions) => Promise<WeappTailwindcssGenerateResult>;
|
|
19
18
|
}
|
|
20
|
-
export type {
|
|
19
|
+
export type { TailwindV4CandidateSource, TailwindV4DesignSystem, TailwindV4Engine, TailwindV4GenerateOptions, TailwindV4GenerateResult, TailwindV4GenerateTarget, TailwindV4ResolvedSource, TailwindV4SourceOptions, };
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
const require_v4_engine = require("./v4-engine-D4ubP7N5.js");
|
|
2
|
+
const require_utils = require("./utils-BCa37Wqj.js");
|
|
3
|
+
//#region src/runtime-branch/create-branch.ts
|
|
4
|
+
function createRuntimeBranch(base, platformFamily, options) {
|
|
5
|
+
const { context, tailwindcssVersion } = base;
|
|
6
|
+
return {
|
|
7
|
+
tailwindcssVersion,
|
|
8
|
+
generatorTarget: context.generatorTarget,
|
|
9
|
+
platformFamily,
|
|
10
|
+
platform: options.platform,
|
|
11
|
+
nativeAppPlatform: options.nativeAppPlatform,
|
|
12
|
+
isTailwindV4: tailwindcssVersion === 4,
|
|
13
|
+
isWeb: platformFamily === "web",
|
|
14
|
+
isMiniProgram: platformFamily === "mini-program",
|
|
15
|
+
isNativeApp: platformFamily === "native-app"
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/runtime-branch/mini-program.ts
|
|
20
|
+
function createMiniProgramRuntimeBranch(base) {
|
|
21
|
+
const { context, uniUtsPlatform } = base;
|
|
22
|
+
return createRuntimeBranch(base, "mini-program", { platform: typeof context.platform === "string" && context.platform.length > 0 ? context.platform : uniUtsPlatform.isMp ? uniUtsPlatform.normalized : context.platform });
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/runtime-branch/platform.ts
|
|
26
|
+
function isRuntimeUniAppXEnabled(value) {
|
|
27
|
+
return value === true || typeof value === "object" && value?.enabled !== false;
|
|
28
|
+
}
|
|
29
|
+
function normalizeRuntimeUniUtsPlatform(value) {
|
|
30
|
+
return typeof value === "object" && value !== null ? value : require_utils.resolveUniUtsPlatform(value);
|
|
31
|
+
}
|
|
32
|
+
function resolveNativeAppPlatform(platform) {
|
|
33
|
+
if (platform.isAppAndroid) return "android";
|
|
34
|
+
if (platform.isAppIos) return "ios";
|
|
35
|
+
if (platform.isAppHarmony) return "harmony";
|
|
36
|
+
return "unknown";
|
|
37
|
+
}
|
|
38
|
+
function resolveExplicitOrEnvPlatform(context, uniUtsPlatform) {
|
|
39
|
+
if (typeof context.platform === "string" && context.platform.length > 0) return context.platform;
|
|
40
|
+
return uniUtsPlatform.normalized;
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/runtime-branch/native-app.ts
|
|
44
|
+
function createNativeAppRuntimeBranch(base) {
|
|
45
|
+
return createRuntimeBranch(base, "native-app", {
|
|
46
|
+
platform: resolveExplicitOrEnvPlatform(base.context, base.uniUtsPlatform),
|
|
47
|
+
nativeAppPlatform: resolveNativeAppPlatform(base.uniUtsPlatform)
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/runtime-branch/tailwind-version.ts
|
|
52
|
+
function resolveTailwindcssBranchVersion(_majorVersion) {
|
|
53
|
+
return 4;
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/runtime-branch/web.ts
|
|
57
|
+
function createWebRuntimeBranch(base) {
|
|
58
|
+
return createRuntimeBranch(base, "web", { platform: resolveExplicitOrEnvPlatform(base.context, base.uniUtsPlatform) });
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/runtime-branch/index.ts
|
|
62
|
+
function shouldUseNativeAppBranch(base, uniUtsPlatform) {
|
|
63
|
+
return base.appType === "uni-app-x" && isRuntimeUniAppXEnabled(base.uniAppX) && uniUtsPlatform.isApp;
|
|
64
|
+
}
|
|
65
|
+
function resolveRuntimeBranch(context) {
|
|
66
|
+
const uniUtsPlatform = normalizeRuntimeUniUtsPlatform(context.uniUtsPlatform);
|
|
67
|
+
const base = {
|
|
68
|
+
context,
|
|
69
|
+
tailwindcssVersion: resolveTailwindcssBranchVersion(context.tailwindcssMajorVersion),
|
|
70
|
+
uniUtsPlatform
|
|
71
|
+
};
|
|
72
|
+
if (context.generatorTarget === "web") return createWebRuntimeBranch(base);
|
|
73
|
+
if (shouldUseNativeAppBranch(context, uniUtsPlatform)) return createNativeAppRuntimeBranch(base);
|
|
74
|
+
return createMiniProgramRuntimeBranch(base);
|
|
75
|
+
}
|
|
76
|
+
function resolveGeneratorRuntimeBranch(options, context = {}) {
|
|
77
|
+
return options.branch ?? resolveRuntimeBranch({
|
|
78
|
+
...context,
|
|
79
|
+
generatorTarget: options.target
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function shouldUseMiniProgramCssBranch(branch) {
|
|
83
|
+
return branch.platformFamily === "mini-program" || branch.platformFamily === "native-app";
|
|
84
|
+
}
|
|
85
|
+
function shouldUseNativeAppCssBranch(branch) {
|
|
86
|
+
return branch.platformFamily === "native-app";
|
|
87
|
+
}
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region src/generator/options.ts
|
|
90
|
+
function normalizeWeappTailwindcssGeneratorOptions(options, context = {}) {
|
|
91
|
+
const target = options?.target ?? require_v4_engine.inferGeneratorTargetFromEnv();
|
|
92
|
+
const branch = resolveRuntimeBranch({
|
|
93
|
+
...context,
|
|
94
|
+
generatorTarget: target
|
|
95
|
+
});
|
|
96
|
+
if (options == null) return {
|
|
97
|
+
target,
|
|
98
|
+
branch,
|
|
99
|
+
importFallback: false,
|
|
100
|
+
bareArbitraryValues: void 0
|
|
101
|
+
};
|
|
102
|
+
return {
|
|
103
|
+
target,
|
|
104
|
+
branch,
|
|
105
|
+
config: options.config,
|
|
106
|
+
styleOptions: options.styleOptions,
|
|
107
|
+
importFallback: options.importFallback ?? false,
|
|
108
|
+
bareArbitraryValues: options.bareArbitraryValues
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
//#endregion
|
|
112
|
+
//#region src/generator/index.ts
|
|
113
|
+
function createWeappTailwindcssGenerator(source) {
|
|
114
|
+
return require_v4_engine.createTailwindV4Engine(source);
|
|
115
|
+
}
|
|
116
|
+
async function resolveTailwindSourceFromRuntime(tailwindRuntime) {
|
|
117
|
+
return require_v4_engine.resolveTailwindV4SourceFromRuntime(tailwindRuntime);
|
|
118
|
+
}
|
|
119
|
+
async function createWeappTailwindcssGeneratorFromRuntime(tailwindRuntime) {
|
|
120
|
+
return createWeappTailwindcssGenerator(await resolveTailwindSourceFromRuntime(tailwindRuntime));
|
|
121
|
+
}
|
|
122
|
+
//#endregion
|
|
123
|
+
Object.defineProperty(exports, "createWeappTailwindcssGenerator", {
|
|
124
|
+
enumerable: true,
|
|
125
|
+
get: function() {
|
|
126
|
+
return createWeappTailwindcssGenerator;
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
Object.defineProperty(exports, "createWeappTailwindcssGeneratorFromRuntime", {
|
|
130
|
+
enumerable: true,
|
|
131
|
+
get: function() {
|
|
132
|
+
return createWeappTailwindcssGeneratorFromRuntime;
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
Object.defineProperty(exports, "normalizeWeappTailwindcssGeneratorOptions", {
|
|
136
|
+
enumerable: true,
|
|
137
|
+
get: function() {
|
|
138
|
+
return normalizeWeappTailwindcssGeneratorOptions;
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
Object.defineProperty(exports, "resolveGeneratorRuntimeBranch", {
|
|
142
|
+
enumerable: true,
|
|
143
|
+
get: function() {
|
|
144
|
+
return resolveGeneratorRuntimeBranch;
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
Object.defineProperty(exports, "resolveRuntimeBranch", {
|
|
148
|
+
enumerable: true,
|
|
149
|
+
get: function() {
|
|
150
|
+
return resolveRuntimeBranch;
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
Object.defineProperty(exports, "resolveTailwindSourceFromRuntime", {
|
|
154
|
+
enumerable: true,
|
|
155
|
+
get: function() {
|
|
156
|
+
return resolveTailwindSourceFromRuntime;
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
Object.defineProperty(exports, "shouldUseMiniProgramCssBranch", {
|
|
160
|
+
enumerable: true,
|
|
161
|
+
get: function() {
|
|
162
|
+
return shouldUseMiniProgramCssBranch;
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
Object.defineProperty(exports, "shouldUseNativeAppCssBranch", {
|
|
166
|
+
enumerable: true,
|
|
167
|
+
get: function() {
|
|
168
|
+
return shouldUseNativeAppCssBranch;
|
|
169
|
+
}
|
|
170
|
+
});
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { G as createTailwindV4Engine, lt as inferGeneratorTargetFromEnv, n as resolveTailwindV4SourceFromRuntime } from "./v4-engine-CF9zt4Cw.mjs";
|
|
2
|
+
import { o as resolveUniUtsPlatform } from "./utils-DodxWHGz.mjs";
|
|
3
|
+
//#region src/runtime-branch/create-branch.ts
|
|
4
|
+
function createRuntimeBranch(base, platformFamily, options) {
|
|
5
|
+
const { context, tailwindcssVersion } = base;
|
|
6
|
+
return {
|
|
7
|
+
tailwindcssVersion,
|
|
8
|
+
generatorTarget: context.generatorTarget,
|
|
9
|
+
platformFamily,
|
|
10
|
+
platform: options.platform,
|
|
11
|
+
nativeAppPlatform: options.nativeAppPlatform,
|
|
12
|
+
isTailwindV4: tailwindcssVersion === 4,
|
|
13
|
+
isWeb: platformFamily === "web",
|
|
14
|
+
isMiniProgram: platformFamily === "mini-program",
|
|
15
|
+
isNativeApp: platformFamily === "native-app"
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/runtime-branch/mini-program.ts
|
|
20
|
+
function createMiniProgramRuntimeBranch(base) {
|
|
21
|
+
const { context, uniUtsPlatform } = base;
|
|
22
|
+
return createRuntimeBranch(base, "mini-program", { platform: typeof context.platform === "string" && context.platform.length > 0 ? context.platform : uniUtsPlatform.isMp ? uniUtsPlatform.normalized : context.platform });
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/runtime-branch/platform.ts
|
|
26
|
+
function isRuntimeUniAppXEnabled(value) {
|
|
27
|
+
return value === true || typeof value === "object" && value?.enabled !== false;
|
|
28
|
+
}
|
|
29
|
+
function normalizeRuntimeUniUtsPlatform(value) {
|
|
30
|
+
return typeof value === "object" && value !== null ? value : resolveUniUtsPlatform(value);
|
|
31
|
+
}
|
|
32
|
+
function resolveNativeAppPlatform(platform) {
|
|
33
|
+
if (platform.isAppAndroid) return "android";
|
|
34
|
+
if (platform.isAppIos) return "ios";
|
|
35
|
+
if (platform.isAppHarmony) return "harmony";
|
|
36
|
+
return "unknown";
|
|
37
|
+
}
|
|
38
|
+
function resolveExplicitOrEnvPlatform(context, uniUtsPlatform) {
|
|
39
|
+
if (typeof context.platform === "string" && context.platform.length > 0) return context.platform;
|
|
40
|
+
return uniUtsPlatform.normalized;
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/runtime-branch/native-app.ts
|
|
44
|
+
function createNativeAppRuntimeBranch(base) {
|
|
45
|
+
return createRuntimeBranch(base, "native-app", {
|
|
46
|
+
platform: resolveExplicitOrEnvPlatform(base.context, base.uniUtsPlatform),
|
|
47
|
+
nativeAppPlatform: resolveNativeAppPlatform(base.uniUtsPlatform)
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/runtime-branch/tailwind-version.ts
|
|
52
|
+
function resolveTailwindcssBranchVersion(_majorVersion) {
|
|
53
|
+
return 4;
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/runtime-branch/web.ts
|
|
57
|
+
function createWebRuntimeBranch(base) {
|
|
58
|
+
return createRuntimeBranch(base, "web", { platform: resolveExplicitOrEnvPlatform(base.context, base.uniUtsPlatform) });
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/runtime-branch/index.ts
|
|
62
|
+
function shouldUseNativeAppBranch(base, uniUtsPlatform) {
|
|
63
|
+
return base.appType === "uni-app-x" && isRuntimeUniAppXEnabled(base.uniAppX) && uniUtsPlatform.isApp;
|
|
64
|
+
}
|
|
65
|
+
function resolveRuntimeBranch(context) {
|
|
66
|
+
const uniUtsPlatform = normalizeRuntimeUniUtsPlatform(context.uniUtsPlatform);
|
|
67
|
+
const base = {
|
|
68
|
+
context,
|
|
69
|
+
tailwindcssVersion: resolveTailwindcssBranchVersion(context.tailwindcssMajorVersion),
|
|
70
|
+
uniUtsPlatform
|
|
71
|
+
};
|
|
72
|
+
if (context.generatorTarget === "web") return createWebRuntimeBranch(base);
|
|
73
|
+
if (shouldUseNativeAppBranch(context, uniUtsPlatform)) return createNativeAppRuntimeBranch(base);
|
|
74
|
+
return createMiniProgramRuntimeBranch(base);
|
|
75
|
+
}
|
|
76
|
+
function resolveGeneratorRuntimeBranch(options, context = {}) {
|
|
77
|
+
return options.branch ?? resolveRuntimeBranch({
|
|
78
|
+
...context,
|
|
79
|
+
generatorTarget: options.target
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function shouldUseMiniProgramCssBranch(branch) {
|
|
83
|
+
return branch.platformFamily === "mini-program" || branch.platformFamily === "native-app";
|
|
84
|
+
}
|
|
85
|
+
function shouldUseNativeAppCssBranch(branch) {
|
|
86
|
+
return branch.platformFamily === "native-app";
|
|
87
|
+
}
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region src/generator/options.ts
|
|
90
|
+
function normalizeWeappTailwindcssGeneratorOptions(options, context = {}) {
|
|
91
|
+
const target = options?.target ?? inferGeneratorTargetFromEnv();
|
|
92
|
+
const branch = resolveRuntimeBranch({
|
|
93
|
+
...context,
|
|
94
|
+
generatorTarget: target
|
|
95
|
+
});
|
|
96
|
+
if (options == null) return {
|
|
97
|
+
target,
|
|
98
|
+
branch,
|
|
99
|
+
importFallback: false,
|
|
100
|
+
bareArbitraryValues: void 0
|
|
101
|
+
};
|
|
102
|
+
return {
|
|
103
|
+
target,
|
|
104
|
+
branch,
|
|
105
|
+
config: options.config,
|
|
106
|
+
styleOptions: options.styleOptions,
|
|
107
|
+
importFallback: options.importFallback ?? false,
|
|
108
|
+
bareArbitraryValues: options.bareArbitraryValues
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
//#endregion
|
|
112
|
+
//#region src/generator/index.ts
|
|
113
|
+
function createWeappTailwindcssGenerator(source) {
|
|
114
|
+
return createTailwindV4Engine(source);
|
|
115
|
+
}
|
|
116
|
+
async function resolveTailwindSourceFromRuntime(tailwindRuntime) {
|
|
117
|
+
return resolveTailwindV4SourceFromRuntime(tailwindRuntime);
|
|
118
|
+
}
|
|
119
|
+
async function createWeappTailwindcssGeneratorFromRuntime(tailwindRuntime) {
|
|
120
|
+
return createWeappTailwindcssGenerator(await resolveTailwindSourceFromRuntime(tailwindRuntime));
|
|
121
|
+
}
|
|
122
|
+
//#endregion
|
|
123
|
+
export { resolveGeneratorRuntimeBranch as a, shouldUseNativeAppCssBranch as c, normalizeWeappTailwindcssGeneratorOptions as i, createWeappTailwindcssGeneratorFromRuntime as n, resolveRuntimeBranch as o, resolveTailwindSourceFromRuntime as r, shouldUseMiniProgramCssBranch as s, createWeappTailwindcssGenerator as t };
|