weapp-tailwindcss 5.5.1 → 5.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundlers/shared/css-imports.d.ts +1 -0
- package/dist/bundlers/shared/framework-user-css.d.ts +3 -0
- package/dist/bundlers/shared/generator-css/output-import-shell.d.ts +6 -2
- package/dist/bundlers/shared/source-candidates/types-and-cache.d.ts +1 -1
- package/dist/bundlers/shared/v4-generation-core.d.ts +1 -0
- package/dist/bundlers/vite/frameworks/taro/index.d.ts +2 -1
- package/dist/bundlers/vite/generate-bundle/bundle-markup-candidates.d.ts +3 -2
- package/dist/bundlers/vite/generate-bundle/css-output-helpers.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/entry-style-graph.d.ts +6 -0
- package/dist/bundlers/vite/generate-bundle/runtime-configured-css.d.ts +1 -0
- package/dist/bundlers/vite/serve-js-transform.d.ts +1 -1
- package/dist/bundlers/vite/shared/create-framework-plugins.d.ts +2 -0
- package/dist/bundlers/vite/shared/framework-module-candidates.d.ts +1 -1
- package/dist/bundlers/webpack/loaders/watch-dependencies.d.ts +3 -1
- package/dist/bundlers/webpack/shared/loader-anchors.d.ts +1 -0
- package/dist/compiler/runtime-snapshot.d.ts +4 -1
- package/dist/{compiler-B0YSc0DY.js → compiler-C9X5Afn4.js} +3 -3
- package/dist/{compiler-D2ZJc3uA.cjs → compiler-DMPaUcH6.cjs} +6 -6
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{css-imports-BFMU7Hpd.cjs → css-imports-DXplvodk.cjs} +29 -0
- package/dist/{css-loader-runtime-CSv0lKqV.cjs → css-loader-runtime-DGqsWVua.cjs} +2 -1
- package/dist/{defaults-B5ep0ojb.js → defaults-CKx-4LcW.js} +1 -1
- package/dist/{defaults-BI9j1znS.cjs → defaults-CiGsr8Xq.cjs} +1 -1
- package/dist/defaults.cjs +1 -1
- package/dist/defaults.js +1 -1
- package/dist/{generator-DsrQ9txU.cjs → generator-BoZIiZD5.cjs} +130 -77
- package/dist/{generator-DyXTBPmE.js → generator-C2aWns8n.js} +119 -78
- package/dist/generator.cjs +1 -1
- package/dist/generator.js +1 -1
- package/dist/{gulp-DXeQfvVC.js → gulp-COAAztkm.js} +4 -4
- package/dist/{gulp-C9ENAx3f.cjs → gulp-D50z06nw.cjs} +5 -5
- package/dist/gulp.cjs +1 -1
- package/dist/gulp.js +1 -1
- package/dist/{hmr-timing-DNxQm-bN.js → hmr-timing-CTk1uZr9.js} +245 -183
- package/dist/{hmr-timing-Cz4IesEM.cjs → hmr-timing-DK0MJKpl.cjs} +5 -5
- package/dist/index.cjs +4 -4
- package/dist/index.js +4 -4
- package/dist/{pipeline-helpers-CSGnR5gh.cjs → pipeline-helpers-BzjYXNTa.cjs} +4 -4
- package/dist/postcss.cjs +1 -1
- package/dist/postcss.js +1 -1
- package/dist/presets.cjs +2 -2
- package/dist/presets.js +2 -2
- package/dist/rspack.cjs +6 -3
- package/dist/rspack.js +6 -3
- package/dist/{scoped-generator-kRj_5Axx.js → scoped-generator-C21A7fis.js} +3 -3
- package/dist/{scoped-generator-TVjEaOeP.cjs → scoped-generator-CTkuf9Ae.cjs} +3 -3
- package/dist/{source-candidate-scan-signature-B7cUxqqX.cjs → source-candidate-scan-signature-4mZDDaKT.cjs} +2 -2
- package/dist/{source-candidate-scan-signature-CsP4BQNa.js → source-candidate-scan-signature-BB5DfjO2.js} +2 -2
- package/dist/tailwindcss/v4-engine/css-import.d.ts +14 -0
- package/dist/{tailwindcss-C-jBBQfw.cjs → tailwindcss-Bji4u8In.cjs} +1 -1
- package/dist/{tailwindcss-BK9S7zuq.js → tailwindcss-c4PkOe1F.js} +1 -1
- package/dist/{transform-DUPOPZ54.cjs → transform-Cy0ddBWf.cjs} +14 -14
- package/dist/{transform-CfOzh007.js → transform-DmLonqPE.js} +14 -14
- package/dist/uni-app-x/border-preflight.d.ts +18 -0
- package/dist/uni-app-x/style-asset/source-parser.d.ts +2 -0
- package/dist/uni-app-x/style-reference-path.d.ts +1 -0
- package/dist/uni-app-x/transform.d.ts +2 -0
- package/dist/uni-app-x/vite/plugin-options.d.ts +2 -0
- package/dist/uni-app-x/vite/style-request.d.ts +5 -0
- package/dist/uni-app-x/vite/style-source.d.ts +14 -4
- package/dist/uni-app-x/vite/web-sfc-hmr.d.ts +14 -0
- package/dist/{v4-generation-core-CRNUU_Rr.cjs → v4-generation-core-DQeiq-g1.cjs} +243 -181
- package/dist/vite/web.cjs +1 -1
- package/dist/vite/web.js +1 -1
- package/dist/{vite-BXe-axax.js → vite-CaUxtQx5.js} +340 -88
- package/dist/{vite-D_mAIfTU.cjs → vite-OG66oLpb.cjs} +356 -85
- package/dist/vite.cjs +1 -1
- package/dist/vite.js +1 -1
- package/dist/{watch-dependencies-DLZDrWdH.cjs → watch-dependencies-GbC14Rlt.cjs} +14 -11
- package/dist/weapp-tw-css-generation-loader.cjs +3 -2
- package/dist/weapp-tw-css-import-rewrite-loader.cjs +11 -10
- package/dist/weapp-tw-runtime-classset-loader.cjs +16 -11
- package/dist/{web-Cv7ualrU.js → web-Bd-9OHFE.js} +7 -6
- package/dist/{web-B2Ea9K4B.cjs → web-CZKIefdl.cjs} +9 -8
- package/dist/{webpack-7Um2GFtx.js → webpack-Cyvq3H7Z.js} +38 -23
- package/dist/{webpack-Ce04-btG.cjs → webpack-DJGgU27Y.cjs} +37 -23
- package/dist/webpack.cjs +1 -1
- package/dist/webpack.js +1 -1
- package/package.json +7 -5
package/dist/postcss.cjs
CHANGED
|
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
-
const require_generator = require("./generator-
|
|
5
|
+
const require_generator = require("./generator-BoZIiZD5.cjs");
|
|
6
6
|
const weappTailwindcssPostcssPlugin = (0, require("@weapp-tailwindcss/postcss").createWeappTailwindcssPostcssPlugin)({
|
|
7
7
|
createGenerator: (source) => {
|
|
8
8
|
return require_generator.createWeappTailwindcssGenerator(source);
|
package/dist/postcss.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as normalizeWeappTailwindcssGeneratorOptions, t as createWeappTailwindcssGenerator, u as resolveTailwindV4Source } from "./generator-
|
|
1
|
+
import { i as normalizeWeappTailwindcssGeneratorOptions, t as createWeappTailwindcssGenerator, u as resolveTailwindV4Source } from "./generator-C2aWns8n.js";
|
|
2
2
|
import { createWeappTailwindcssPostcssPlugin } from "@weapp-tailwindcss/postcss";
|
|
3
3
|
const weappTailwindcssPostcssPlugin = createWeappTailwindcssPostcssPlugin({
|
|
4
4
|
createGenerator: (source) => {
|
package/dist/presets.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_rolldown_runtime = require("./rolldown-runtime-Ctb5zv51.cjs");
|
|
3
3
|
const require_framework = require("./framework.cjs");
|
|
4
|
-
const require_generator = require("./generator-
|
|
5
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
4
|
+
const require_generator = require("./generator-BoZIiZD5.cjs");
|
|
5
|
+
const require_tailwindcss = require("./tailwindcss-Bji4u8In.cjs");
|
|
6
6
|
require("./utils-CuKLf1Zv.cjs");
|
|
7
7
|
require("./logger-TlKT3xmR.cjs");
|
|
8
8
|
let node_path = require("node:path");
|
package/dist/presets.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { resolveTaroPlatform, resolveUniPlatformsFromEnv } from "./framework.js";
|
|
2
|
-
import { T as omitUndefined } from "./generator-
|
|
3
|
-
import { i as resolveUniAppXOptions, n as resolveTailwindcssBasedir } from "./tailwindcss-
|
|
2
|
+
import { T as omitUndefined } from "./generator-C2aWns8n.js";
|
|
3
|
+
import { i as resolveUniAppXOptions, n as resolveTailwindcssBasedir } from "./tailwindcss-c4PkOe1F.js";
|
|
4
4
|
import { n as defuOverrideArray } from "./utils-MVwpU07P.js";
|
|
5
5
|
import { t as logger } from "./logger-BNzxZbZj.js";
|
|
6
6
|
import path from "node:path";
|
package/dist/rspack.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_rolldown_runtime = require("./rolldown-runtime-Ctb5zv51.cjs");
|
|
3
|
-
const require_v4_generation_core = require("./v4-generation-core-
|
|
4
|
-
const require_webpack = require("./webpack-
|
|
3
|
+
const require_v4_generation_core = require("./v4-generation-core-DQeiq-g1.cjs");
|
|
4
|
+
const require_webpack = require("./webpack-DJGgU27Y.cjs");
|
|
5
5
|
let node_path = require("node:path");
|
|
6
6
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
7
7
|
//#region src/bundlers/rspack/rule-match.ts
|
|
@@ -141,7 +141,10 @@ function includesLoaderName(item, name) {
|
|
|
141
141
|
function createCssImportRewriteLoaderEntry(options) {
|
|
142
142
|
return {
|
|
143
143
|
loader: options.loader ?? node_path.default.resolve(__dirname, `./${CSS_IMPORT_REWRITE_LOADER_NAME}.cjs`),
|
|
144
|
-
|
|
144
|
+
options: {
|
|
145
|
+
generateCss: true,
|
|
146
|
+
...options.options
|
|
147
|
+
}
|
|
145
148
|
};
|
|
146
149
|
}
|
|
147
150
|
function resolveCssImportRewriteOptions(options) {
|
package/dist/rspack.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as isSourceStyleRequest } from "./hmr-timing-
|
|
2
|
-
import { n as weappTailwindcssPackageDir, r as __dirname, t as WeappTailwindcss } from "./webpack-
|
|
1
|
+
import { C as isSourceStyleRequest } from "./hmr-timing-CTk1uZr9.js";
|
|
2
|
+
import { n as weappTailwindcssPackageDir, r as __dirname, t as WeappTailwindcss } from "./webpack-Cyvq3H7Z.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
//#region src/bundlers/rspack/rule-match.ts
|
|
5
5
|
const STYLE_RULE_PROBES = [
|
|
@@ -138,7 +138,10 @@ function includesLoaderName(item, name) {
|
|
|
138
138
|
function createCssImportRewriteLoaderEntry(options) {
|
|
139
139
|
return {
|
|
140
140
|
loader: options.loader ?? path.resolve(__dirname, `./${CSS_IMPORT_REWRITE_LOADER_NAME}.cjs`),
|
|
141
|
-
|
|
141
|
+
options: {
|
|
142
|
+
generateCss: true,
|
|
143
|
+
...options.options
|
|
144
|
+
}
|
|
142
145
|
};
|
|
143
146
|
}
|
|
144
147
|
function resolveCssImportRewriteOptions(options) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { detectAppType } from "./framework.js";
|
|
2
2
|
import { n as hasCssMacroTailwindV4CustomVariantConditionalComments } from "./auto-2dg_uhEJ.js";
|
|
3
|
-
import { g as resolveTailwindV4EntriesFromCssCached, i as resolveUniAppXOptions } from "./tailwindcss-
|
|
4
|
-
import { C as isSourceStyleRequest } from "./hmr-timing-
|
|
5
|
-
import { o as normalizeStyleInjectorOptions } from "./source-candidate-scan-signature-
|
|
3
|
+
import { g as resolveTailwindV4EntriesFromCssCached, i as resolveUniAppXOptions } from "./tailwindcss-c4PkOe1F.js";
|
|
4
|
+
import { C as isSourceStyleRequest } from "./hmr-timing-CTk1uZr9.js";
|
|
5
|
+
import { o as normalizeStyleInjectorOptions } from "./source-candidate-scan-signature-BB5DfjO2.js";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { weappStyleInjector } from "weapp-style-injector/vite";
|
|
8
8
|
import { StyleInjector } from "weapp-style-injector/vite/taro";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-Ctb5zv51.cjs");
|
|
2
2
|
const require_framework = require("./framework.cjs");
|
|
3
3
|
require("./auto-DtU6f3X6.cjs");
|
|
4
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
5
|
-
const require_v4_generation_core = require("./v4-generation-core-
|
|
6
|
-
const require_source_candidate_scan_signature = require("./source-candidate-scan-signature-
|
|
4
|
+
const require_tailwindcss = require("./tailwindcss-Bji4u8In.cjs");
|
|
5
|
+
const require_v4_generation_core = require("./v4-generation-core-DQeiq-g1.cjs");
|
|
6
|
+
const require_source_candidate_scan_signature = require("./source-candidate-scan-signature-4mZDDaKT.cjs");
|
|
7
7
|
let node_path = require("node:path");
|
|
8
8
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
9
9
|
let weapp_style_injector_vite = require("weapp-style-injector/vite");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-Ctb5zv51.cjs");
|
|
2
|
-
const require_generator = require("./generator-
|
|
3
|
-
require("./tailwindcss-
|
|
2
|
+
const require_generator = require("./generator-BoZIiZD5.cjs");
|
|
3
|
+
require("./tailwindcss-Bji4u8In.cjs");
|
|
4
4
|
let node_path = require("node:path");
|
|
5
5
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
6
6
|
let node_module = require("node:module");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jt as toPosixPath } from "./generator-
|
|
2
|
-
import "./tailwindcss-
|
|
1
|
+
import { jt as toPosixPath } from "./generator-C2aWns8n.js";
|
|
2
|
+
import "./tailwindcss-c4PkOe1F.js";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
//#region src/style-injector/options.ts
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare function parseCssImportSpecifier(params: string): {
|
|
2
|
+
specifier: string;
|
|
3
|
+
raw: string;
|
|
4
|
+
quote: string | undefined;
|
|
5
|
+
} | undefined;
|
|
6
|
+
export declare function quoteCssImportSpecifier(file: string, quote?: string): string;
|
|
7
|
+
export declare function isTailwindCssImport(params: string): boolean;
|
|
8
|
+
export declare function parseImportSourceParam(params: string): {
|
|
9
|
+
none: boolean;
|
|
10
|
+
sourcePath: undefined;
|
|
11
|
+
} | {
|
|
12
|
+
none: boolean;
|
|
13
|
+
sourcePath: string;
|
|
14
|
+
} | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-Ctb5zv51.cjs");
|
|
2
|
-
const require_generator = require("./generator-
|
|
2
|
+
const require_generator = require("./generator-BoZIiZD5.cjs");
|
|
3
3
|
require("./utils-CuKLf1Zv.cjs");
|
|
4
4
|
let node_fs = require("node:fs");
|
|
5
5
|
let node_path = require("node:path");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { At as resolveTailwindV4CssSourceBase, C as findWorkspacePackageDir, Ct as expandTailwindSourceEntries, D as normalizeTailwindcssRuntimeOptions, Dt as parseConfigParam, E as normalizeExtendLengthUnits, Et as normalizeLegacyContentEntries,
|
|
1
|
+
import { At as resolveTailwindV4CssSourceBase, C as findWorkspacePackageDir, Ct as expandTailwindSourceEntries, D as normalizeTailwindcssRuntimeOptions, Dt as parseConfigParam, E as normalizeExtendLengthUnits, Et as normalizeLegacyContentEntries, Lt as resolveCssMacroTailwindV4Source, O as resolveTailwindcssOptions, Ot as resolveCssSourceEntries, S as findNearestPackageRoot, St as FULL_SOURCE_SCAN_PATTERN, T as omitUndefined, Vt as loadTailwindV4DesignSystem, b as isTailwindV4CssEntry, d as resolveTailwindV4SourceFromRuntime, h as hasConfiguredTailwindV4CssRoots, i as normalizeWeappTailwindcssGeneratorOptions, k as normalizeStringListOption, m as filterTailwindV4CssSourceRoots, p as resolveTailwindV4SourceOptionsFromRuntime, v as groupCssEntriesByBase, w as findWorkspaceRoot, x as normalizeCssEntries, y as guessBasedirFromEntries } from "./generator-C2aWns8n.js";
|
|
2
2
|
import { n as defuOverrideArray$1 } from "./utils-MVwpU07P.js";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const require_generator = require("./generator-
|
|
2
|
-
const require_compiler = require("./compiler-
|
|
3
|
-
const require_vite = require("./vite-
|
|
1
|
+
const require_generator = require("./generator-BoZIiZD5.cjs");
|
|
2
|
+
const require_compiler = require("./compiler-DMPaUcH6.cjs");
|
|
3
|
+
const require_vite = require("./vite-OG66oLpb.cjs");
|
|
4
4
|
let _tailwindcss_mangle_engine = require("@tailwindcss-mangle/engine");
|
|
5
5
|
let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
|
|
6
6
|
let _vue_compiler_dom = require("@vue/compiler-dom");
|
|
@@ -465,7 +465,9 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
|
|
|
465
465
|
if (localStyleCollector) updateDirectiveExpressionWithLocalStyle(ms, prop, templateOffset, jsHandler, localStyleCollector, options.webCustomAttributeDeep === true && shouldHandleCustom, runtimeSet);
|
|
466
466
|
else updateDirectiveExpression(ms, prop, templateOffset, jsHandler, runtimeSet);
|
|
467
467
|
}
|
|
468
|
+
if (options.borderPreflight && require_vite.shouldInjectBorderPreflight(node, options.borderPreflightRange)) require_vite.injectBorderPreflightClass(ms, node, templateOffset);
|
|
468
469
|
});
|
|
470
|
+
if (options.borderPreflight && !descriptor.styles.some((style) => style.content.includes(options.borderPreflight))) ms.prepend(`<style>\n${options.borderPreflight}\n</style>\n`);
|
|
469
471
|
}
|
|
470
472
|
if (descriptor.script && descriptor.script.start < descriptor.script.end) {
|
|
471
473
|
localStyleCollector?.collectRuntimeClasses(descriptor.script.content);
|
|
@@ -477,17 +479,15 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
|
|
|
477
479
|
const { code } = jsHandler(descriptor.scriptSetup.content, runtimeSet ?? /* @__PURE__ */ new Set(), defaultCreateJsHandlerOptions);
|
|
478
480
|
ms.update(descriptor.scriptSetup.start, descriptor.scriptSetup.end, localStyleCollector ? localStyleCollector.rewriteTransformedCode(code) : code);
|
|
479
481
|
}
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
})}`);
|
|
490
|
-
}
|
|
482
|
+
const scopedStyle = descriptor.styles.findLast((style) => STYLE_SCOPED_RE.test(style.attrs) && (!options.onWebLocalStyleRules || !require_vite.isUniAppXStyleSourceEmpty(style.content)));
|
|
483
|
+
if (localStyleCollector && options.onWebLocalStyleRules && descriptor.template) options.onWebLocalStyleRules(localStyleCollector.hasStyles() ? localStyleCollector.toStyleRules({ web: true }) : "");
|
|
484
|
+
if (localStyleCollector?.hasStyles() && scopedStyle && !options.onWebLocalStyleRules) {
|
|
485
|
+
const separator = scopedStyle.content.endsWith("\n") ? "" : "\n";
|
|
486
|
+
ms.appendLeft(scopedStyle.end, `${separator}${localStyleCollector.toStyleRules({ native: options.native })}`);
|
|
487
|
+
} else if (localStyleCollector?.hasStyles() && !scopedStyle) ms.append(`\n${localStyleCollector.toStyleBlock({
|
|
488
|
+
native: options.native || Boolean(options.onWebLocalStyleRules),
|
|
489
|
+
web: Boolean(options.onWebLocalStyleRules)
|
|
490
|
+
})}`);
|
|
491
491
|
}
|
|
492
492
|
const result = {
|
|
493
493
|
code: ms.toString(),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Mt as _defineProperty } from "./generator-
|
|
2
|
-
import { G as replaceWxml, H as analyzeSource, J as traverse$1, U as JsTokenUpdater, V as createAttributeMatcher, W as isClassContextLiteralPath, _ as generateCode, q as babelParse } from "./compiler-
|
|
3
|
-
import {
|
|
1
|
+
import { Mt as _defineProperty } from "./generator-C2aWns8n.js";
|
|
2
|
+
import { G as replaceWxml, H as analyzeSource, J as traverse$1, U as JsTokenUpdater, V as createAttributeMatcher, W as isClassContextLiteralPath, _ as generateCode, q as babelParse } from "./compiler-C9X5Afn4.js";
|
|
3
|
+
import { a as shouldEnablePageLocalStyle, i as shouldEnableComponentLocalStyle, n as injectBorderPreflightClass, o as isUniAppXStyleSourceEmpty, r as shouldInjectBorderPreflight } from "./vite-CaUxtQx5.js";
|
|
4
4
|
import { splitCandidateTokens } from "@tailwindcss-mangle/engine";
|
|
5
5
|
import { UNI_APP_X_IMPORTANT_APPLY_MARKER, normalizeUniAppXImportantApplyForSass } from "@weapp-tailwindcss/postcss";
|
|
6
6
|
import MagicString from "magic-string";
|
|
@@ -466,7 +466,9 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
|
|
|
466
466
|
if (localStyleCollector) updateDirectiveExpressionWithLocalStyle(ms, prop, templateOffset, jsHandler, localStyleCollector, options.webCustomAttributeDeep === true && shouldHandleCustom, runtimeSet);
|
|
467
467
|
else updateDirectiveExpression(ms, prop, templateOffset, jsHandler, runtimeSet);
|
|
468
468
|
}
|
|
469
|
+
if (options.borderPreflight && shouldInjectBorderPreflight(node, options.borderPreflightRange)) injectBorderPreflightClass(ms, node, templateOffset);
|
|
469
470
|
});
|
|
471
|
+
if (options.borderPreflight && !descriptor.styles.some((style) => style.content.includes(options.borderPreflight))) ms.prepend(`<style>\n${options.borderPreflight}\n</style>\n`);
|
|
470
472
|
}
|
|
471
473
|
if (descriptor.script && descriptor.script.start < descriptor.script.end) {
|
|
472
474
|
localStyleCollector?.collectRuntimeClasses(descriptor.script.content);
|
|
@@ -478,17 +480,15 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
|
|
|
478
480
|
const { code } = jsHandler(descriptor.scriptSetup.content, runtimeSet ?? /* @__PURE__ */ new Set(), defaultCreateJsHandlerOptions);
|
|
479
481
|
ms.update(descriptor.scriptSetup.start, descriptor.scriptSetup.end, localStyleCollector ? localStyleCollector.rewriteTransformedCode(code) : code);
|
|
480
482
|
}
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
})}`);
|
|
491
|
-
}
|
|
483
|
+
const scopedStyle = descriptor.styles.findLast((style) => STYLE_SCOPED_RE.test(style.attrs) && (!options.onWebLocalStyleRules || !isUniAppXStyleSourceEmpty(style.content)));
|
|
484
|
+
if (localStyleCollector && options.onWebLocalStyleRules && descriptor.template) options.onWebLocalStyleRules(localStyleCollector.hasStyles() ? localStyleCollector.toStyleRules({ web: true }) : "");
|
|
485
|
+
if (localStyleCollector?.hasStyles() && scopedStyle && !options.onWebLocalStyleRules) {
|
|
486
|
+
const separator = scopedStyle.content.endsWith("\n") ? "" : "\n";
|
|
487
|
+
ms.appendLeft(scopedStyle.end, `${separator}${localStyleCollector.toStyleRules({ native: options.native })}`);
|
|
488
|
+
} else if (localStyleCollector?.hasStyles() && !scopedStyle) ms.append(`\n${localStyleCollector.toStyleBlock({
|
|
489
|
+
native: options.native || Boolean(options.onWebLocalStyleRules),
|
|
490
|
+
web: Boolean(options.onWebLocalStyleRules)
|
|
491
|
+
})}`);
|
|
492
492
|
}
|
|
493
493
|
const result = {
|
|
494
494
|
code: ms.toString(),
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ElementNode } from '@vue/compiler-dom';
|
|
2
|
+
import type MagicString from 'magic-string';
|
|
3
|
+
import type { CssPreflightOptions } from '../types/index.js';
|
|
4
|
+
export declare const BORDER_PREFLIGHT_CLASS = "weapp-tw-border";
|
|
5
|
+
export declare function hoistUniAppXBorderPreflight(css: string): string;
|
|
6
|
+
export declare function createUniAppXBorderPreflight(options?: CssPreflightOptions): string | undefined;
|
|
7
|
+
export declare function resolveUniAppXBorderPreflightOptions(options: {
|
|
8
|
+
cssPreflight?: CssPreflightOptions;
|
|
9
|
+
cssPreflightRange?: 'all';
|
|
10
|
+
}, isWeb: boolean): {
|
|
11
|
+
borderPreflight: string;
|
|
12
|
+
borderPreflightRange: "all" | undefined;
|
|
13
|
+
} | {
|
|
14
|
+
borderPreflight?: never;
|
|
15
|
+
borderPreflightRange?: never;
|
|
16
|
+
};
|
|
17
|
+
export declare function shouldInjectBorderPreflight(node: ElementNode, range?: 'all'): boolean;
|
|
18
|
+
export declare function injectBorderPreflightClass(ms: MagicString, node: ElementNode, offset: number): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function resolveStyleReferencePath(sourceFile: string, request: string): string;
|
|
@@ -8,6 +8,8 @@ interface TransformUVueOptions {
|
|
|
8
8
|
enablePageLocalStyle?: boolean;
|
|
9
9
|
pageMatcher?: (id: string) => boolean;
|
|
10
10
|
native?: boolean;
|
|
11
|
+
borderPreflight?: string;
|
|
12
|
+
borderPreflightRange?: 'all';
|
|
11
13
|
webCustomAttributeDeep?: boolean;
|
|
12
14
|
onWebLocalStyleRules?: (rules: string) => void;
|
|
13
15
|
}
|
|
@@ -4,6 +4,8 @@ import type { AppType, ICustomAttributesEntities, InternalUserDefinedOptions, Js
|
|
|
4
4
|
export interface CreateUniAppXPluginsOptions {
|
|
5
5
|
appType: AppType;
|
|
6
6
|
customAttributesEntities: ICustomAttributesEntities;
|
|
7
|
+
cssPreflight?: InternalUserDefinedOptions['cssPreflight'];
|
|
8
|
+
cssPreflightRange?: InternalUserDefinedOptions['cssPreflightRange'];
|
|
7
9
|
disabledDefaultTemplateHandler: boolean | undefined;
|
|
8
10
|
mainCssChunkMatcher: NonNullable<InternalUserDefinedOptions['mainCssChunkMatcher']>;
|
|
9
11
|
registerModuleGraphCandidates?: ((id: string, source: string) => Promise<Set<string>>) | undefined;
|
|
@@ -12,4 +12,9 @@ export declare function resolvePreprocessorTransform(code: string, id: string, l
|
|
|
12
12
|
map: null;
|
|
13
13
|
} | undefined;
|
|
14
14
|
} | undefined;
|
|
15
|
+
export declare function reportStyleWarnings(result: {
|
|
16
|
+
warnings?: () => {
|
|
17
|
+
toString: () => string;
|
|
18
|
+
}[];
|
|
19
|
+
}): void;
|
|
15
20
|
export {};
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
import type { parseVueRequest } from '../../bundlers/vite/query.js';
|
|
2
2
|
type VueStyleQuery = ReturnType<typeof parseVueRequest>['query'];
|
|
3
|
-
export declare function
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
export declare function createUniAppXSfcStyleSources(): {
|
|
4
|
+
rememberSource(id: string, source: string): void;
|
|
5
|
+
rememberGenerated(id: string, source: string): void;
|
|
6
|
+
getGenerated: (id: string, index: number) => string | undefined;
|
|
7
|
+
hasGenerated(id: string): boolean;
|
|
8
|
+
load(id: string, index: number): {
|
|
9
|
+
code: string;
|
|
10
|
+
map: null;
|
|
11
|
+
} | undefined;
|
|
12
|
+
};
|
|
13
|
+
export declare function resolveUniAppXStyleSource(code: string, query: VueStyleQuery, generatedSource?: string): {
|
|
7
14
|
skip: true;
|
|
8
15
|
code?: never;
|
|
16
|
+
} | {
|
|
17
|
+
code: string;
|
|
18
|
+
skip?: never;
|
|
9
19
|
};
|
|
10
20
|
export declare function hasUniAppXImportantApply(source: string, normalize: (source: string) => string): boolean;
|
|
11
21
|
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { HmrContext } from 'vite';
|
|
2
|
+
import type { ViteHmrCssModuleVersionTracker } from '../../bundlers/vite/shared/framework-hmr-module-version.js';
|
|
3
|
+
interface WebSfcHmrOptions {
|
|
4
|
+
isEnabled: () => boolean;
|
|
5
|
+
transform: (source: string, id: string) => Promise<{
|
|
6
|
+
code: string;
|
|
7
|
+
} | undefined | null>;
|
|
8
|
+
hmrCssModuleVersions: ViteHmrCssModuleVersionTracker | undefined;
|
|
9
|
+
}
|
|
10
|
+
export declare function createUniAppXWebSfcHmr(options: WebSfcHmrOptions): {
|
|
11
|
+
prepare(ctx: HmrContext): Promise<void>;
|
|
12
|
+
finish(ctx: HmrContext): Promise<boolean>;
|
|
13
|
+
};
|
|
14
|
+
export {};
|