weapp-tailwindcss 5.0.0-next.3 → 5.0.0-next.7
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.md +4 -5
- package/bin/weapp-tailwindcss.js +1 -21
- package/dist/bundlers/shared/css-cleanup/at-rules.d.ts +2 -0
- package/dist/bundlers/shared/css-cleanup/color-gamut.d.ts +3 -0
- package/dist/bundlers/shared/css-cleanup/root-cleanups.d.ts +4 -0
- package/dist/bundlers/shared/css-cleanup/selectors.d.ts +8 -0
- package/dist/bundlers/shared/css-cleanup.d.ts +1 -2
- package/dist/bundlers/shared/generator-css/config-directive.d.ts +2 -0
- package/dist/bundlers/shared/generator-css/directives.d.ts +11 -0
- package/dist/bundlers/shared/generator-css/legacy-compat.d.ts +7 -0
- package/dist/bundlers/shared/generator-css/legacy-selectors.d.ts +5 -0
- package/dist/bundlers/shared/generator-css/legacy-units.d.ts +1 -0
- package/dist/bundlers/shared/generator-css/markers.d.ts +16 -0
- package/dist/bundlers/shared/generator-css/source-files.d.ts +11 -0
- package/dist/bundlers/shared/generator-css/source-resolver.d.ts +10 -0
- package/dist/bundlers/shared/generator-css.d.ts +12 -22
- package/dist/bundlers/vite/css-finalizer.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/candidates.d.ts +2 -0
- package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +20 -0
- package/dist/bundlers/vite/generate-bundle/css-share-scope.d.ts +3 -0
- package/dist/bundlers/vite/generate-bundle/dirty-state.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/js-entries.d.ts +2 -0
- package/dist/bundlers/vite/generate-bundle/js-handler-options.d.ts +8 -0
- package/dist/bundlers/vite/generate-bundle/js-linking.d.ts +13 -0
- package/dist/bundlers/vite/generate-bundle/metrics.d.ts +17 -0
- package/dist/bundlers/vite/generate-bundle/process-plan.d.ts +9 -0
- package/dist/bundlers/vite/generate-bundle/rollup-assets.d.ts +7 -0
- package/dist/bundlers/vite/generate-bundle/signatures.d.ts +8 -0
- package/dist/bundlers/vite/generate-bundle.d.ts +2 -1
- package/dist/bundlers/vite/index.d.ts +1 -1
- package/dist/bundlers/vite/official-tailwind-plugins.d.ts +5 -0
- package/dist/bundlers/vite/postcss-config.d.ts +6 -0
- package/dist/bundlers/vite/rewrite-css-imports.d.ts +1 -0
- package/dist/bundlers/vite/runtime-class-set.d.ts +22 -0
- package/dist/bundlers/vite/tailwind-basedir.d.ts +1 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +1 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +1 -1
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +0 -1
- package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +1 -1
- package/dist/cache-DPN5yKSX.js +497 -0
- package/dist/cache-nq0_XJoS.mjs +429 -0
- package/dist/cli/context.d.ts +0 -3
- package/dist/cli/helpers.d.ts +1 -2
- package/dist/cli/mount-options.d.ts +2 -0
- package/dist/cli/types.d.ts +0 -2
- package/dist/cli.js +108 -598
- package/dist/cli.mjs +119 -608
- package/dist/constants.d.ts +1 -2
- package/dist/context/tailwindcss.d.ts +1 -1
- package/dist/core.js +13 -20
- package/dist/core.mjs +8 -14
- package/dist/css-macro/postcss.js +1 -1
- package/dist/css-macro/postcss.mjs +1 -1
- package/dist/css-macro.d.ts +1 -0
- package/dist/css-macro.js +2 -2
- package/dist/css-macro.mjs +2 -2
- package/dist/defaults.d.ts +15 -1
- package/dist/defaults.js +33 -14
- package/dist/defaults.mjs +30 -15
- package/dist/generator/index.d.ts +1 -1
- package/dist/generator/options.d.ts +3 -4
- package/dist/{generator-Y-Ikv4Fu.mjs → generator-CzfdCZyd.mjs} +277 -23
- package/dist/{generator-mmhXzZnv.js → generator-TOp4uz7c.js} +281 -27
- package/dist/{generator-css-Bwy_Uz89.mjs → generator-css-B938WI9a.mjs} +694 -506
- package/dist/{generator-css-CRLrHW4F.js → generator-css-Dnpl-IY2.js} +699 -505
- package/dist/generator.js +1 -1
- package/dist/generator.mjs +1 -1
- package/dist/gulp.js +29 -28
- package/dist/gulp.mjs +25 -24
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -6
- package/dist/index.mjs +5 -5
- package/dist/js/index.d.ts +1 -0
- package/dist/js/literal-transform.d.ts +2 -0
- package/dist/logger-BRy6XPQ2.js +1 -0
- package/dist/logger-Bub1jggA.mjs +2 -0
- package/dist/postcss/config-directive.d.ts +1 -0
- package/dist/postcss/context.d.ts +9 -0
- package/dist/postcss/source-files.d.ts +8 -0
- package/dist/postcss/tailwind-version.d.ts +3 -0
- package/dist/postcss-BtAP6sQO.mjs +288 -0
- package/dist/postcss-WsXlC7A-.js +298 -0
- package/dist/postcss.d.ts +2 -2
- package/dist/postcss.js +3 -276
- package/dist/postcss.mjs +1 -269
- package/dist/{recorder-GdTJ3QqX.js → precheck-Dka94ArV.js} +141 -283
- package/dist/{recorder-XdFvVASS.mjs → precheck-DlrmwCc-.mjs} +106 -247
- package/dist/presets.js +6 -4
- package/dist/presets.mjs +4 -2
- package/dist/reset.d.ts +1 -0
- package/dist/{css-imports-BbrbluP9.js → run-tasks-B50A3pxt.js} +6 -55
- package/dist/{css-imports-CSdPq_Sc.mjs → run-tasks-DdNi-hkk.mjs} +5 -42
- package/dist/runtime-patch-pGdCqAEu.mjs +71 -0
- package/dist/runtime-patch-qwuisukL.js +85 -0
- package/dist/tailwindcss/miniprogram.d.ts +5 -1
- package/dist/tailwindcss/patcher-options.d.ts +3 -51
- package/dist/tailwindcss/patcher.d.ts +1 -2
- package/dist/tailwindcss/runtime-patch.d.ts +5 -0
- package/dist/tailwindcss/runtime.d.ts +2 -3
- package/dist/tailwindcss/targets.d.ts +1 -5
- package/dist/tailwindcss/v4/patcher-options.d.ts +1 -23
- package/dist/tailwindcss/v4/patcher.d.ts +2 -1
- package/dist/tailwindcss/v4-engine/types.d.ts +1 -1
- package/dist/tailwindcss/version.d.ts +4 -0
- package/dist/{logger-BoVx1Dbt.mjs → tailwindcss-BIJ185GB.mjs} +25 -434
- package/dist/{logger-BZ45DZJT.js → tailwindcss-T1U5T-iF.js} +30 -468
- package/dist/typedoc.export.d.ts +0 -2
- package/dist/types/index.d.ts +2 -9
- package/dist/types/shared.d.ts +3 -0
- package/dist/types/user-defined-options/general.d.ts +0 -2
- package/dist/types/user-defined-options/important.d.ts +3 -3
- package/dist/uni-app-x/vite.d.ts +1 -1
- package/dist/utils/disabled.d.ts +2 -3
- package/dist/{vite-BDywuCjn.mjs → vite-BXChkciE.mjs} +669 -481
- package/dist/{vite-DgRh_GXn.js → vite-D0CoRblu.js} +707 -519
- package/dist/vite.d.ts +1 -2
- package/dist/vite.js +3 -4
- package/dist/vite.mjs +2 -2
- package/dist/weapp-tw-css-import-rewrite-loader.js +1 -1
- package/dist/{webpack-CiHqVZTg.mjs → webpack-BNdGm9KL.mjs} +224 -38
- package/dist/{webpack-CAJR4hhP.js → webpack-D-sUCY0u.js} +250 -69
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +23 -35
- package/dist/bundlers/shared/generator-candidates.d.ts +0 -5
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-assets.d.ts +0 -14
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-loaders.d.ts +0 -15
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v4.d.ts +0 -9
- package/dist/bundlers/webpack/shared/css-imports.d.ts +0 -6
- package/dist/cli/config.d.ts +0 -5
- package/dist/cli/helpers/patch-cwd.d.ts +0 -1
- package/dist/cli/mount-options/patch-status.d.ts +0 -2
- package/dist/cli/patch-options.d.ts +0 -6
- package/dist/cli/tokens.d.ts +0 -4
- package/dist/cli/workspace/package-dirs.d.ts +0 -3
- package/dist/cli/workspace/patch-package.d.ts +0 -3
- package/dist/cli/workspace/patch-utils.d.ts +0 -3
- package/dist/cli/workspace/types.d.ts +0 -11
- package/dist/cli/workspace/workspace-globs.d.ts +0 -2
- package/dist/cli/workspace/workspace-io.d.ts +0 -1
- package/dist/cli/workspace/workspace-lock.d.ts +0 -1
- package/dist/cli/workspace.d.ts +0 -2
- package/dist/experimental/index.d.ts +0 -2
- package/dist/experimental/oxc/ast-utils.d.ts +0 -30
- package/dist/experimental/oxc/index.d.ts +0 -2
- package/dist/experimental/oxc/module-specifiers.d.ts +0 -2
- package/dist/experimental/shared/cache.d.ts +0 -3
- package/dist/experimental/shared/transform.d.ts +0 -3
- package/dist/experimental/shared.d.ts +0 -8
- package/dist/experimental/swc/ast-utils.d.ts +0 -30
- package/dist/experimental/swc/index.d.ts +0 -2
- package/dist/experimental/swc/module-specifiers.d.ts +0 -2
- package/dist/js/syntax.d.ts +0 -10
- package/dist/loader-anchors-1MumTAtA.mjs +0 -205
- package/dist/loader-anchors-TrFvT6g1.js +0 -273
- package/dist/patcher-options-6gJN2EXy.js +0 -115
- package/dist/patcher-options-DQfR5xxT.mjs +0 -92
- package/dist/tailwindcss/recorder.d.ts +0 -13
- package/dist/tailwindcss/targets/paths.d.ts +0 -13
- package/dist/tailwindcss/targets/record-io.d.ts +0 -5
- package/dist/tailwindcss/targets/recorder.d.ts +0 -3
- package/dist/tailwindcss/targets/types.d.ts +0 -35
- package/dist/types/disabled-options.d.ts +0 -4
- package/dist/webpack4.d.ts +0 -4
- package/dist/webpack4.js +0 -387
- package/dist/webpack4.mjs +0 -379
- package/scripts/postinstall.mjs +0 -59
- /package/dist/{constants-p1dyh1x1.js → constants-BoB_6lFw.js} +0 -0
- /package/dist/{constants-B-_T5UnW.mjs → constants-E_loJC49.mjs} +0 -0
- /package/dist/{utils-7DUGTFED.mjs → utils-BJjKRQgf.mjs} +0 -0
- /package/dist/{utils-DmC9_In3.js → utils-VZvGusYs.js} +0 -0
package/dist/constants.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export declare const runtimeAopLoader = "weapp-tw-runtime-aop-loader";
|
|
2
|
-
export declare const ManglePluginHooks = "ManglePluginHooks";
|
|
3
2
|
export declare const WeappTailwindcssWebpackPluginOptimizeChunkAssetsHooks = "WeappTailwindcssWebpackPluginOptimizeChunkAssetsHooks";
|
|
4
|
-
export declare const pluginName = "weapp-tailwindcss
|
|
3
|
+
export declare const pluginName = "weapp-tailwindcss";
|
|
5
4
|
export declare const vitePluginName = "weapp-tailwindcss:adaptor";
|
|
6
5
|
export declare const WEAPP_TW_REQUIRED_NODE_VERSION = "20.19.0";
|
|
7
6
|
export declare const WEAPP_TW_REQUIRED_NODE_VERSION_RANGE = "^20.19.0 || >=22.12.0";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { InternalUserDefinedOptions } from '../types';
|
|
2
2
|
import { resolveTailwindcssBasedir } from './tailwindcss/basedir';
|
|
3
|
-
export declare function createTailwindcssPatcherFromContext(ctx: InternalUserDefinedOptions): import("@/types").TailwindcssPatcherLike;
|
|
3
|
+
export declare function createTailwindcssPatcherFromContext(ctx: InternalUserDefinedOptions): import("@/types").TailwindcssPatcherLike | undefined;
|
|
4
4
|
export { resolveTailwindcssBasedir };
|
package/dist/core.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
let node_process = require("node:process");
|
|
5
|
-
node_process = require_chunk.__toESM(node_process);
|
|
2
|
+
require("./chunk-8l464Juk.js");
|
|
3
|
+
const require_precheck = require("./precheck-Dka94ArV.js");
|
|
6
4
|
let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
|
|
7
5
|
//#region src/core.ts
|
|
8
6
|
const DEFAULT_MAIN_CHUNK_STYLE_OPTIONS = Object.freeze({ isMainChunk: true });
|
|
@@ -17,18 +15,13 @@ function resolveTransformWxssOptions(options) {
|
|
|
17
15
|
* @returns 返回一个包含 transformWxss、transformWxml 和 transformJs 方法的对象
|
|
18
16
|
*/
|
|
19
17
|
function createContext(options = {}) {
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const patchRecorderState = require_recorder.setupPatchRecorder(initialTwPatcher, opts.tailwindcssBasedir, {
|
|
23
|
-
source: "runtime",
|
|
24
|
-
cwd: opts.tailwindcssBasedir ?? node_process.default.cwd()
|
|
25
|
-
});
|
|
18
|
+
const { templateHandler, styleHandler, jsHandler, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = require_precheck.getCompilerContext(options);
|
|
19
|
+
const readyPromise = require_precheck.createTailwindRuntimeReadyPromise(initialTwPatcher);
|
|
26
20
|
let runtimeSet = /* @__PURE__ */ new Set();
|
|
27
21
|
const runtimeState = {
|
|
28
22
|
twPatcher: initialTwPatcher,
|
|
29
|
-
|
|
30
|
-
refreshTailwindcssPatcher
|
|
31
|
-
onPatchCompleted: patchRecorderState.onPatchCompleted
|
|
23
|
+
readyPromise,
|
|
24
|
+
refreshTailwindcssPatcher
|
|
32
25
|
};
|
|
33
26
|
const defaultJsHandlerOptionsCache = /* @__PURE__ */ new Map();
|
|
34
27
|
function getDefaultJsHandlerOptions(majorVersion = runtimeState.twPatcher.majorVersion) {
|
|
@@ -112,25 +105,25 @@ function createContext(options = {}) {
|
|
|
112
105
|
});
|
|
113
106
|
}
|
|
114
107
|
async function transformWxss(rawCss, options) {
|
|
115
|
-
await runtimeState.
|
|
108
|
+
await runtimeState.readyPromise;
|
|
116
109
|
const result = await styleHandler(rawCss, resolveTransformWxssOptions(options));
|
|
117
|
-
runtimeSet = await
|
|
110
|
+
runtimeSet = await require_precheck.ensureRuntimeClassSet(runtimeState, {
|
|
118
111
|
forceRefresh: true,
|
|
119
112
|
forceCollect: true
|
|
120
113
|
});
|
|
121
114
|
return result;
|
|
122
115
|
}
|
|
123
116
|
async function transformJs(rawJs, options) {
|
|
124
|
-
await runtimeState.
|
|
117
|
+
await runtimeState.readyPromise;
|
|
125
118
|
if (options?.runtimeSet) runtimeSet = options.runtimeSet;
|
|
126
|
-
else if (runtimeSet.size === 0) runtimeSet = await
|
|
119
|
+
else if (runtimeSet.size === 0) runtimeSet = await require_precheck.ensureRuntimeClassSet(runtimeState, { forceCollect: true });
|
|
127
120
|
const resolvedOptions = resolveTransformJsOptions(options);
|
|
128
|
-
if (
|
|
121
|
+
if (require_precheck.shouldSkipJsTransform(rawJs, resolvedOptions)) return { code: rawJs };
|
|
129
122
|
return await jsHandler(rawJs, runtimeSet, resolvedOptions);
|
|
130
123
|
}
|
|
131
124
|
async function transformWxml(rawWxml, options) {
|
|
132
|
-
await runtimeState.
|
|
133
|
-
if (!options?.runtimeSet && runtimeSet.size === 0) runtimeSet = await
|
|
125
|
+
await runtimeState.readyPromise;
|
|
126
|
+
if (!options?.runtimeSet && runtimeSet.size === 0) runtimeSet = await require_precheck.ensureRuntimeClassSet(runtimeState, { forceCollect: true });
|
|
134
127
|
return templateHandler(rawWxml, resolveTransformWxmlOptions(options));
|
|
135
128
|
}
|
|
136
129
|
return {
|
package/dist/core.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import process from "node:process";
|
|
1
|
+
import { _ as ensureRuntimeClassSet, g as createTailwindRuntimeReadyPromise, n as getCompilerContext, t as shouldSkipJsTransform } from "./precheck-DlrmwCc-.mjs";
|
|
3
2
|
import { defuOverrideArray } from "@weapp-tailwindcss/shared";
|
|
4
3
|
//#region src/core.ts
|
|
5
4
|
const DEFAULT_MAIN_CHUNK_STYLE_OPTIONS = Object.freeze({ isMainChunk: true });
|
|
@@ -14,18 +13,13 @@ function resolveTransformWxssOptions(options) {
|
|
|
14
13
|
* @returns 返回一个包含 transformWxss、transformWxml 和 transformJs 方法的对象
|
|
15
14
|
*/
|
|
16
15
|
function createContext(options = {}) {
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const patchRecorderState = setupPatchRecorder(initialTwPatcher, opts.tailwindcssBasedir, {
|
|
20
|
-
source: "runtime",
|
|
21
|
-
cwd: opts.tailwindcssBasedir ?? process.cwd()
|
|
22
|
-
});
|
|
16
|
+
const { templateHandler, styleHandler, jsHandler, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = getCompilerContext(options);
|
|
17
|
+
const readyPromise = createTailwindRuntimeReadyPromise(initialTwPatcher);
|
|
23
18
|
let runtimeSet = /* @__PURE__ */ new Set();
|
|
24
19
|
const runtimeState = {
|
|
25
20
|
twPatcher: initialTwPatcher,
|
|
26
|
-
|
|
27
|
-
refreshTailwindcssPatcher
|
|
28
|
-
onPatchCompleted: patchRecorderState.onPatchCompleted
|
|
21
|
+
readyPromise,
|
|
22
|
+
refreshTailwindcssPatcher
|
|
29
23
|
};
|
|
30
24
|
const defaultJsHandlerOptionsCache = /* @__PURE__ */ new Map();
|
|
31
25
|
function getDefaultJsHandlerOptions(majorVersion = runtimeState.twPatcher.majorVersion) {
|
|
@@ -109,7 +103,7 @@ function createContext(options = {}) {
|
|
|
109
103
|
});
|
|
110
104
|
}
|
|
111
105
|
async function transformWxss(rawCss, options) {
|
|
112
|
-
await runtimeState.
|
|
106
|
+
await runtimeState.readyPromise;
|
|
113
107
|
const result = await styleHandler(rawCss, resolveTransformWxssOptions(options));
|
|
114
108
|
runtimeSet = await ensureRuntimeClassSet(runtimeState, {
|
|
115
109
|
forceRefresh: true,
|
|
@@ -118,7 +112,7 @@ function createContext(options = {}) {
|
|
|
118
112
|
return result;
|
|
119
113
|
}
|
|
120
114
|
async function transformJs(rawJs, options) {
|
|
121
|
-
await runtimeState.
|
|
115
|
+
await runtimeState.readyPromise;
|
|
122
116
|
if (options?.runtimeSet) runtimeSet = options.runtimeSet;
|
|
123
117
|
else if (runtimeSet.size === 0) runtimeSet = await ensureRuntimeClassSet(runtimeState, { forceCollect: true });
|
|
124
118
|
const resolvedOptions = resolveTransformJsOptions(options);
|
|
@@ -126,7 +120,7 @@ function createContext(options = {}) {
|
|
|
126
120
|
return await jsHandler(rawJs, runtimeSet, resolvedOptions);
|
|
127
121
|
}
|
|
128
122
|
async function transformWxml(rawWxml, options) {
|
|
129
|
-
await runtimeState.
|
|
123
|
+
await runtimeState.readyPromise;
|
|
130
124
|
if (!options?.runtimeSet && runtimeSet.size === 0) runtimeSet = await ensureRuntimeClassSet(runtimeState, { forceCollect: true });
|
|
131
125
|
return templateHandler(rawWxml, resolveTransformWxmlOptions(options));
|
|
132
126
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as matchCustomPropertyFromValue, i as ifndef, r as ifdef } from "../constants-
|
|
1
|
+
import { a as matchCustomPropertyFromValue, i as ifndef, r as ifdef } from "../constants-E_loJC49.mjs";
|
|
2
2
|
//#region src/css-macro/postcss.ts
|
|
3
3
|
const IFDEF_ENDIF_RE = /#(?:ifn?def|endif)/;
|
|
4
4
|
const creator = () => {
|
package/dist/css-macro.d.ts
CHANGED
package/dist/css-macro.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-8l464Juk.js");
|
|
2
|
-
require("./utils-
|
|
3
|
-
const require_constants = require("./constants-
|
|
2
|
+
require("./utils-VZvGusYs.js");
|
|
3
|
+
const require_constants = require("./constants-BoB_6lFw.js");
|
|
4
4
|
let tailwindcss_plugin = require("tailwindcss/plugin");
|
|
5
5
|
tailwindcss_plugin = require_chunk.__toESM(tailwindcss_plugin);
|
|
6
6
|
let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
|
package/dist/css-macro.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as defu } from "./utils-
|
|
2
|
-
import { n as createNegativeMediaQuery, t as createMediaQuery } from "./constants-
|
|
1
|
+
import { t as defu } from "./utils-BJjKRQgf.mjs";
|
|
2
|
+
import { n as createNegativeMediaQuery, t as createMediaQuery } from "./constants-E_loJC49.mjs";
|
|
3
3
|
import plugin from "tailwindcss/plugin";
|
|
4
4
|
//#region src/css-macro/index.ts
|
|
5
5
|
const defaultOptions = {
|
package/dist/defaults.d.ts
CHANGED
|
@@ -1,2 +1,16 @@
|
|
|
1
|
-
import type { UserDefinedOptions } from './types';
|
|
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
|
+
export declare const TAILWIND_V4_CSS_PREFLIGHT: {
|
|
9
|
+
'box-sizing': string;
|
|
10
|
+
margin: string;
|
|
11
|
+
padding: string;
|
|
12
|
+
border: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function getDefaultCssPreflight(tailwindcssMajorVersion?: number): Exclude<CssPreflightOptions, false>;
|
|
15
|
+
export declare function resolveDefaultCssPreflight(cssPreflight: CssPreflightOptions | undefined, tailwindcssMajorVersion?: number): CssPreflightOptions;
|
|
2
16
|
export declare function getDefaultOptions(): UserDefinedOptions;
|
package/dist/defaults.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("./chunk-8l464Juk.js");
|
|
3
|
-
require("./utils-
|
|
3
|
+
require("./utils-VZvGusYs.js");
|
|
4
4
|
let _weapp_core_escape = require("@weapp-core/escape");
|
|
5
5
|
let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
|
|
6
6
|
//#region src/defaults.ts
|
|
@@ -31,6 +31,28 @@ const MAIN_CSS_CHUNK_MATCHERS = {
|
|
|
31
31
|
"kbone": (file) => KBONE_MAIN_CSS_RE.test(file)
|
|
32
32
|
};
|
|
33
33
|
const alwaysFalse = () => false;
|
|
34
|
+
const TAILWIND_V3_CSS_PREFLIGHT = {
|
|
35
|
+
"box-sizing": "border-box",
|
|
36
|
+
"border-width": "0",
|
|
37
|
+
"border-style": "solid",
|
|
38
|
+
"border-color": "currentColor"
|
|
39
|
+
};
|
|
40
|
+
const TAILWIND_V4_CSS_PREFLIGHT = {
|
|
41
|
+
"box-sizing": "border-box",
|
|
42
|
+
"margin": "0",
|
|
43
|
+
"padding": "0",
|
|
44
|
+
"border": "0 solid"
|
|
45
|
+
};
|
|
46
|
+
function getDefaultCssPreflight(tailwindcssMajorVersion) {
|
|
47
|
+
return { ...tailwindcssMajorVersion === 4 ? TAILWIND_V4_CSS_PREFLIGHT : TAILWIND_V3_CSS_PREFLIGHT };
|
|
48
|
+
}
|
|
49
|
+
function resolveDefaultCssPreflight(cssPreflight, tailwindcssMajorVersion) {
|
|
50
|
+
if (cssPreflight === false) return false;
|
|
51
|
+
return {
|
|
52
|
+
...getDefaultCssPreflight(tailwindcssMajorVersion),
|
|
53
|
+
...cssPreflight ?? {}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
34
56
|
function createMainCssChunkMatcher() {
|
|
35
57
|
return (file, appType) => {
|
|
36
58
|
if (!appType) {
|
|
@@ -71,12 +93,7 @@ function getDefaultOptions() {
|
|
|
71
93
|
},
|
|
72
94
|
mainCssChunkMatcher: createMainCssChunkMatcher(),
|
|
73
95
|
wxsMatcher: alwaysFalse,
|
|
74
|
-
cssPreflight:
|
|
75
|
-
"box-sizing": "border-box",
|
|
76
|
-
"border-width": "0",
|
|
77
|
-
"border-style": "solid",
|
|
78
|
-
"border-color": "currentColor"
|
|
79
|
-
},
|
|
96
|
+
cssPreflight: getDefaultCssPreflight(3),
|
|
80
97
|
disabled: false,
|
|
81
98
|
onLoad: _weapp_tailwindcss_shared.noop,
|
|
82
99
|
onStart: _weapp_tailwindcss_shared.noop,
|
|
@@ -85,11 +102,13 @@ function getDefaultOptions() {
|
|
|
85
102
|
customAttributes: {},
|
|
86
103
|
customReplaceDictionary: _weapp_core_escape.MappingChars2String,
|
|
87
104
|
appType: void 0,
|
|
88
|
-
arbitraryValues: {
|
|
105
|
+
arbitraryValues: {
|
|
106
|
+
allowDoubleQuotes: false,
|
|
107
|
+
bareArbitraryValues: false
|
|
108
|
+
},
|
|
89
109
|
cssChildCombinatorReplaceValue: ["view", "text"],
|
|
90
110
|
inlineWxs: false,
|
|
91
111
|
injectAdditionalCssVarScope: false,
|
|
92
|
-
rewriteCssImports: true,
|
|
93
112
|
jsPreserveClass: (keyword) => {
|
|
94
113
|
/**
|
|
95
114
|
* 默认保留 keyword
|
|
@@ -97,7 +116,6 @@ function getDefaultOptions() {
|
|
|
97
116
|
if (keyword === "*") return true;
|
|
98
117
|
return false;
|
|
99
118
|
},
|
|
100
|
-
staleClassNameFallback: void 0,
|
|
101
119
|
disabledDefaultTemplateHandler: false,
|
|
102
120
|
cssSelectorReplacement: {
|
|
103
121
|
root: [
|
|
@@ -118,10 +136,7 @@ function getDefaultOptions() {
|
|
|
118
136
|
ignoreCallExpressionIdentifiers: [],
|
|
119
137
|
ignoreTaggedTemplateExpressionIdentifiers: ["weappTwIgnore"],
|
|
120
138
|
replaceRuntimePackages: false,
|
|
121
|
-
generator: {
|
|
122
|
-
mode: "auto",
|
|
123
|
-
target: "weapp"
|
|
124
|
-
},
|
|
139
|
+
generator: { target: "weapp" },
|
|
125
140
|
tailwindcssPatcherOptions: { filter(className) {
|
|
126
141
|
return !(0, _weapp_core_escape.isAllowedClassName)(className);
|
|
127
142
|
} },
|
|
@@ -129,4 +144,8 @@ function getDefaultOptions() {
|
|
|
129
144
|
};
|
|
130
145
|
}
|
|
131
146
|
//#endregion
|
|
147
|
+
exports.TAILWIND_V3_CSS_PREFLIGHT = TAILWIND_V3_CSS_PREFLIGHT;
|
|
148
|
+
exports.TAILWIND_V4_CSS_PREFLIGHT = TAILWIND_V4_CSS_PREFLIGHT;
|
|
149
|
+
exports.getDefaultCssPreflight = getDefaultCssPreflight;
|
|
132
150
|
exports.getDefaultOptions = getDefaultOptions;
|
|
151
|
+
exports.resolveDefaultCssPreflight = resolveDefaultCssPreflight;
|
package/dist/defaults.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as noop } from "./utils-
|
|
1
|
+
import { a as noop } from "./utils-BJjKRQgf.mjs";
|
|
2
2
|
import { MappingChars2String, isAllowedClassName } from "@weapp-core/escape";
|
|
3
3
|
//#region src/defaults.ts
|
|
4
4
|
const CSS_FILE_PATTERN = /.+\.(?:wx|ac|jx|tt|q|c|ty)ss$/;
|
|
@@ -28,6 +28,28 @@ const MAIN_CSS_CHUNK_MATCHERS = {
|
|
|
28
28
|
"kbone": (file) => KBONE_MAIN_CSS_RE.test(file)
|
|
29
29
|
};
|
|
30
30
|
const alwaysFalse = () => false;
|
|
31
|
+
const TAILWIND_V3_CSS_PREFLIGHT = {
|
|
32
|
+
"box-sizing": "border-box",
|
|
33
|
+
"border-width": "0",
|
|
34
|
+
"border-style": "solid",
|
|
35
|
+
"border-color": "currentColor"
|
|
36
|
+
};
|
|
37
|
+
const TAILWIND_V4_CSS_PREFLIGHT = {
|
|
38
|
+
"box-sizing": "border-box",
|
|
39
|
+
"margin": "0",
|
|
40
|
+
"padding": "0",
|
|
41
|
+
"border": "0 solid"
|
|
42
|
+
};
|
|
43
|
+
function getDefaultCssPreflight(tailwindcssMajorVersion) {
|
|
44
|
+
return { ...tailwindcssMajorVersion === 4 ? TAILWIND_V4_CSS_PREFLIGHT : TAILWIND_V3_CSS_PREFLIGHT };
|
|
45
|
+
}
|
|
46
|
+
function resolveDefaultCssPreflight(cssPreflight, tailwindcssMajorVersion) {
|
|
47
|
+
if (cssPreflight === false) return false;
|
|
48
|
+
return {
|
|
49
|
+
...getDefaultCssPreflight(tailwindcssMajorVersion),
|
|
50
|
+
...cssPreflight ?? {}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
31
53
|
function createMainCssChunkMatcher() {
|
|
32
54
|
return (file, appType) => {
|
|
33
55
|
if (!appType) {
|
|
@@ -68,12 +90,7 @@ function getDefaultOptions() {
|
|
|
68
90
|
},
|
|
69
91
|
mainCssChunkMatcher: createMainCssChunkMatcher(),
|
|
70
92
|
wxsMatcher: alwaysFalse,
|
|
71
|
-
cssPreflight:
|
|
72
|
-
"box-sizing": "border-box",
|
|
73
|
-
"border-width": "0",
|
|
74
|
-
"border-style": "solid",
|
|
75
|
-
"border-color": "currentColor"
|
|
76
|
-
},
|
|
93
|
+
cssPreflight: getDefaultCssPreflight(3),
|
|
77
94
|
disabled: false,
|
|
78
95
|
onLoad: noop,
|
|
79
96
|
onStart: noop,
|
|
@@ -82,11 +99,13 @@ function getDefaultOptions() {
|
|
|
82
99
|
customAttributes: {},
|
|
83
100
|
customReplaceDictionary: MappingChars2String,
|
|
84
101
|
appType: void 0,
|
|
85
|
-
arbitraryValues: {
|
|
102
|
+
arbitraryValues: {
|
|
103
|
+
allowDoubleQuotes: false,
|
|
104
|
+
bareArbitraryValues: false
|
|
105
|
+
},
|
|
86
106
|
cssChildCombinatorReplaceValue: ["view", "text"],
|
|
87
107
|
inlineWxs: false,
|
|
88
108
|
injectAdditionalCssVarScope: false,
|
|
89
|
-
rewriteCssImports: true,
|
|
90
109
|
jsPreserveClass: (keyword) => {
|
|
91
110
|
/**
|
|
92
111
|
* 默认保留 keyword
|
|
@@ -94,7 +113,6 @@ function getDefaultOptions() {
|
|
|
94
113
|
if (keyword === "*") return true;
|
|
95
114
|
return false;
|
|
96
115
|
},
|
|
97
|
-
staleClassNameFallback: void 0,
|
|
98
116
|
disabledDefaultTemplateHandler: false,
|
|
99
117
|
cssSelectorReplacement: {
|
|
100
118
|
root: [
|
|
@@ -115,10 +133,7 @@ function getDefaultOptions() {
|
|
|
115
133
|
ignoreCallExpressionIdentifiers: [],
|
|
116
134
|
ignoreTaggedTemplateExpressionIdentifiers: ["weappTwIgnore"],
|
|
117
135
|
replaceRuntimePackages: false,
|
|
118
|
-
generator: {
|
|
119
|
-
mode: "auto",
|
|
120
|
-
target: "weapp"
|
|
121
|
-
},
|
|
136
|
+
generator: { target: "weapp" },
|
|
122
137
|
tailwindcssPatcherOptions: { filter(className) {
|
|
123
138
|
return !isAllowedClassName(className);
|
|
124
139
|
} },
|
|
@@ -126,4 +141,4 @@ function getDefaultOptions() {
|
|
|
126
141
|
};
|
|
127
142
|
}
|
|
128
143
|
//#endregion
|
|
129
|
-
export { getDefaultOptions };
|
|
144
|
+
export { TAILWIND_V3_CSS_PREFLIGHT, TAILWIND_V4_CSS_PREFLIGHT, getDefaultCssPreflight, getDefaultOptions, resolveDefaultCssPreflight };
|
|
@@ -7,5 +7,5 @@ export declare function resolveTailwindSourceFromPatcher(patcher: TailwindcssPat
|
|
|
7
7
|
export declare function createWeappTailwindcssGeneratorFromPatcher(patcher: TailwindcssPatcherLike): Promise<WeappTailwindcssGenerator>;
|
|
8
8
|
export { normalizeWeappTailwindcssGeneratorOptions, } from './options';
|
|
9
9
|
export { resolveTailwindV3Source, resolveTailwindV3SourceFromPatcher, resolveTailwindV3SourceOptionsFromPatcher, resolveTailwindV4Source, resolveTailwindV4SourceFromPatcher, resolveTailwindV4SourceFromPatchOptions, resolveTailwindV4SourceOptionsFromPatcher, transformTailwindV3CssByTarget, transformTailwindV3CssToWeapp, transformTailwindV4CssByTarget, transformTailwindV4CssToWeapp, };
|
|
10
|
-
export type { NormalizedWeappTailwindcssGeneratorOptions,
|
|
10
|
+
export type { NormalizedWeappTailwindcssGeneratorOptions, WeappTailwindcssGeneratorOptions, WeappTailwindcssGeneratorUserOptions, } from './options';
|
|
11
11
|
export type { TailwindCandidateSource, TailwindGeneratorVersion, TailwindResolvedSource, TailwindV3CandidateSource, TailwindV3Engine, TailwindV3GenerateOptions, TailwindV3GenerateResult, TailwindV3GenerateTarget, TailwindV3ResolvedSource, TailwindV3SourceOptions, TailwindV4CandidateSource, TailwindV4DesignSystem, TailwindV4Engine, TailwindV4GenerateOptions, TailwindV4GenerateResult, TailwindV4GenerateTarget, TailwindV4ResolvedSource, TailwindV4SourceOptions, WeappTailwindcssGenerateOptions, WeappTailwindcssGenerateResult, WeappTailwindcssGenerator, WeappTailwindcssGeneratorTarget, } from './types';
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
|
|
2
2
|
import type { WeappTailwindcssGeneratorTarget } from './types';
|
|
3
|
-
export type WeappTailwindcssGeneratorMode = 'auto' | 'force' | 'off';
|
|
4
3
|
export interface WeappTailwindcssGeneratorOptions {
|
|
5
|
-
mode?: WeappTailwindcssGeneratorMode;
|
|
6
4
|
target?: WeappTailwindcssGeneratorTarget;
|
|
5
|
+
config?: string;
|
|
7
6
|
styleOptions?: Partial<IStyleHandlerOptions>;
|
|
8
7
|
tailwindcssV3Compatibility?: boolean;
|
|
9
8
|
}
|
|
10
|
-
export type WeappTailwindcssGeneratorUserOptions =
|
|
9
|
+
export type WeappTailwindcssGeneratorUserOptions = WeappTailwindcssGeneratorOptions;
|
|
11
10
|
export interface NormalizedWeappTailwindcssGeneratorOptions {
|
|
12
|
-
mode: WeappTailwindcssGeneratorMode;
|
|
13
11
|
target: WeappTailwindcssGeneratorTarget;
|
|
12
|
+
config?: string;
|
|
14
13
|
styleOptions?: Partial<IStyleHandlerOptions>;
|
|
15
14
|
tailwindcssV3Compatibility: boolean;
|
|
16
15
|
}
|