weapp-tailwindcss 5.0.13 → 5.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/class-selectors.d.ts +2 -0
- package/dist/bundlers/shared/generator-css/directives.d.ts +2 -1
- package/dist/bundlers/shared/generator-css/generation-helpers.d.ts +10 -6
- 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 +2 -2
- 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/generator-css/validate.d.ts +1 -0
- 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 +16 -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-assets.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/css-output-helpers.d.ts +39 -0
- package/dist/bundlers/vite/generate-bundle/css-output.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/env-flags.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/final-css-assets.d.ts +13 -0
- package/dist/bundlers/vite/generate-bundle/finalize.d.ts +7 -0
- package/dist/bundlers/vite/generate-bundle/html-processing.d.ts +26 -0
- package/dist/bundlers/vite/generate-bundle/js-processing.d.ts +4 -0
- package/dist/bundlers/vite/generate-bundle/memory-debug.d.ts +21 -18
- package/dist/bundlers/vite/generate-bundle/remembered-css-replay.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/remembered-css.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/root-style-output.d.ts +6 -0
- package/dist/bundlers/vite/generate-bundle/runtime-linked-source-memory.d.ts +25 -0
- 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/source-candidate-source.d.ts +9 -0
- package/dist/bundlers/vite/generate-bundle/tailwind-v4-css-source.d.ts +9 -0
- package/dist/bundlers/vite/generate-bundle/transform-filter.d.ts +15 -0
- package/dist/bundlers/vite/generate-bundle/types.d.ts +2 -1
- package/dist/bundlers/vite/generate-bundle/vite-css-cache.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle.d.ts +2 -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/plugin-cache.d.ts +15 -0
- package/dist/bundlers/vite/rewrite-css-imports.d.ts +1 -0
- package/dist/bundlers/vite/runtime-class-set.d.ts +5 -4
- 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 +26 -2
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/css-source-resolvers.d.ts +34 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/helpers.d.ts +48 -11
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/js-module-graph.d.ts +37 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers.d.ts +199 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/source-candidate-cache.d.ts +28 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/source-candidate-refresh.d.ts +11 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +1 -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 +138 -444
- package/dist/cli.mjs +134 -440
- package/dist/context/index.d.ts +3 -3
- package/dist/context/style-options.d.ts +5 -1
- package/dist/context/tailwindcss.d.ts +1 -1
- package/dist/{precheck-B0Z8yW7E.js → context-B6hVF7dr.js} +405 -156
- package/dist/{precheck-CRI90iL1.mjs → context-DlpKD7aN.mjs} +377 -141
- package/dist/core.js +15 -12
- package/dist/core.mjs +10 -7
- package/dist/css-macro/index.d.ts +3 -7
- package/dist/css-macro.js +1 -1
- package/dist/css-macro.mjs +1 -1
- package/dist/{defaults-Bqx18S1f.mjs → defaults-BhE26nSw.mjs} +12 -13
- package/dist/{defaults-C_J_kBpw.js → defaults-CmFBmxsr.js} +11 -18
- package/dist/defaults.d.ts +2 -8
- 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-6oMJtTDO.js +170 -0
- package/dist/generator-CjzBK7h-.mjs +123 -0
- package/dist/generator.js +10 -16
- package/dist/generator.mjs +3 -3
- package/dist/{gulp-XT8Jc7lH.js → gulp-BtGq6LP9.js} +49 -87
- package/dist/{gulp-DfOQERcV.mjs → gulp-DNU10Vtc.mjs} +42 -80
- package/dist/gulp.js +1 -1
- package/dist/gulp.mjs +1 -1
- package/dist/{hmr-timing-DQIP_8qP.mjs → hmr-timing-B0KuWDjV.mjs} +1197 -858
- package/dist/{hmr-timing-BMftW7Us.js → hmr-timing-CegXR9O4.js} +1356 -927
- 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-zQ2MrDdi.mjs → source-candidate-scan-signature-B5af2Ahe.mjs} +187 -17
- package/dist/{bundle-state-CKWeTEhv.js → source-candidate-scan-signature-BKYb9jxa.js} +261 -19
- 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 +87 -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 +15 -7
- package/dist/tailwindcss/v4-engine/types.d.ts +17 -10
- package/dist/tailwindcss/version.d.ts +1 -1
- package/dist/tailwindcss-B5mRo0-M.mjs +1423 -0
- package/dist/tailwindcss-dbrbY4cd.js +1528 -0
- package/dist/{transform-DfcEjsZF.mjs → transform-fRBeuuK-.mjs} +2 -2
- package/dist/{transform-YmrmxuF3.js → transform-vLwZpiTE.js} +17 -17
- 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/types/user-defined-options/matcher.d.ts +7 -0
- package/dist/uni-app-x/style-asset.d.ts +1 -0
- package/dist/v4-engine-C3qSwQ-e.mjs +2376 -0
- package/dist/v4-engine-ON_oSLfO.js +2752 -0
- package/dist/{vite-DjI09vVN.mjs → vite-CWRooooa.mjs} +1417 -540
- package/dist/{vite-CXHVsHmX.js → vite-w-RkgaTY.js} +1575 -698
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +5665 -4443
- package/dist/weapp-tw-runtime-classset-loader.js +15 -4
- package/dist/webpack-8PaV1gG3.mjs +2334 -0
- package/dist/webpack-CGgBOx9l.js +2346 -0
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +6 -7
- 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
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-emK7D4bc.js");
|
|
2
|
-
const
|
|
2
|
+
const require_context = require("./context-B6hVF7dr.js");
|
|
3
|
+
const require_tailwindcss = require("./tailwindcss-dbrbY4cd.js");
|
|
4
|
+
const require_hmr_timing = require("./hmr-timing-CegXR9O4.js");
|
|
3
5
|
let node_path = require("node:path");
|
|
4
6
|
node_path = require_chunk.__toESM(node_path);
|
|
5
7
|
let node_process = require("node:process");
|
|
@@ -80,10 +82,14 @@ function slash(p) {
|
|
|
80
82
|
return (0, _weapp_tailwindcss_shared.ensurePosix)(p);
|
|
81
83
|
}
|
|
82
84
|
const isWindows = node_process.default.platform === "win32";
|
|
83
|
-
const cssLangRE = new RegExp(`\\.(css|less|sass|scss|styl|stylus|pcss|postcss)(
|
|
85
|
+
const cssLangRE = new RegExp(`\\.(?:css|less|sass|scss|styl|stylus|pcss|postcss)(?:$|\\?)`);
|
|
86
|
+
const htmlLangRE = /\.html?(?:$|\?)/;
|
|
84
87
|
function isCSSRequest(request) {
|
|
85
88
|
return cssLangRE.test(request) || isSourceStyleRequest(request);
|
|
86
89
|
}
|
|
90
|
+
function isHTMLRequest(request) {
|
|
91
|
+
return htmlLangRE.test(request);
|
|
92
|
+
}
|
|
87
93
|
function normalizePath(id) {
|
|
88
94
|
return node_path.default.posix.normalize(isWindows ? (0, _weapp_tailwindcss_shared.ensurePosix)(id) : id);
|
|
89
95
|
}
|
|
@@ -119,9 +125,9 @@ function resolvePackageDir(name) {
|
|
|
119
125
|
}
|
|
120
126
|
//#endregion
|
|
121
127
|
//#region src/bundlers/shared/generated-css-marker.ts
|
|
122
|
-
const BUNDLER_GENERATED_CSS_MARKER_RE =
|
|
123
|
-
const BUNDLER_GENERATED_CSS_MARKER_GLOBAL_RE =
|
|
124
|
-
const BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE =
|
|
128
|
+
const BUNDLER_GENERATED_CSS_MARKER_RE = /\/\*!?\s*weapp-tailwindcss (?:vite|webpack)-generated-css(?:\s*:\s*[^\s*]+)?\s*\*\/\s*/i;
|
|
129
|
+
const BUNDLER_GENERATED_CSS_MARKER_GLOBAL_RE = /\/\*!?\s*weapp-tailwindcss (?:vite|webpack)-generated-css(?:\s*:\s*[^\s*]+)?\s*\*\/\s*/gi;
|
|
130
|
+
const BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE = /\/\*!?\s*weapp-tailwindcss (vite|webpack)-generated-css(?:\s*:\s*([^\s*]+))?\s*\*\/\s*/gi;
|
|
125
131
|
function createBundlerGeneratedCssMarker(bundler, file) {
|
|
126
132
|
return `/*! weapp-tailwindcss ${bundler}-generated-css:${encodeURIComponent(file)} */`;
|
|
127
133
|
}
|
|
@@ -150,6 +156,25 @@ function parseBundlerGeneratedCssMarkerBlocks(source) {
|
|
|
150
156
|
return blocks;
|
|
151
157
|
}
|
|
152
158
|
//#endregion
|
|
159
|
+
//#region src/bundlers/shared/v4-generation-core.ts
|
|
160
|
+
async function generateTailwindV4Css(options) {
|
|
161
|
+
const majorVersion = options.runtimeState.tailwindRuntime.majorVersion;
|
|
162
|
+
if (majorVersion !== 4) throw new Error("weapp-tailwindcss 生成管线仅支持 Tailwind CSS v4。");
|
|
163
|
+
const generated = await require_hmr_timing.generateCssByGenerator(options);
|
|
164
|
+
if (!generated) return;
|
|
165
|
+
return {
|
|
166
|
+
...generated,
|
|
167
|
+
classSet: generated.classSet,
|
|
168
|
+
dependencies: generated.dependencies,
|
|
169
|
+
metadata: {
|
|
170
|
+
file: options.file,
|
|
171
|
+
majorVersion,
|
|
172
|
+
outputFile: options.outputFile,
|
|
173
|
+
...generated.metadata ?? {}
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
//#endregion
|
|
153
178
|
//#region src/bundlers/vite/bundle-entries.ts
|
|
154
179
|
function readOutputEntry(entry) {
|
|
155
180
|
if (entry.output.type === "chunk") return entry.output.code;
|
|
@@ -203,10 +228,12 @@ const CSS_BLOCK_COMMENT_RE = /\/\*[\s\S]*?\*\//g;
|
|
|
203
228
|
const CSS_AROUND_PUNCTUATION_RE = /\s*([{}:;,>+~()])\s*/g;
|
|
204
229
|
const CSS_TRAILING_DECLARATION_SEMICOLON_RE = /;\}/g;
|
|
205
230
|
const CSS_WHITESPACE_RE = /\s+/g;
|
|
231
|
+
const JS_RUNTIME_AFFECTING_TEXT_HINT_RE = /["'`/]/;
|
|
232
|
+
const JS_INCOMPLETE_TRAILING_OPERATOR_RE = /(?:=>|[=+\-*%&|^!~?:,.({[\]])\s*$/;
|
|
206
233
|
function createHtmlRuntimeAffectingSignature(source) {
|
|
207
234
|
try {
|
|
208
235
|
const parts = [];
|
|
209
|
-
const parser = new
|
|
236
|
+
const parser = new require_context.Parser({
|
|
210
237
|
onattribute(name, value) {
|
|
211
238
|
parts.push(`a:${name}=${value}`);
|
|
212
239
|
},
|
|
@@ -226,15 +253,16 @@ function createHtmlRuntimeAffectingSignature(source) {
|
|
|
226
253
|
}
|
|
227
254
|
}
|
|
228
255
|
function createJsRuntimeAffectingSignature(source) {
|
|
256
|
+
if (!JS_RUNTIME_AFFECTING_TEXT_HINT_RE.test(source) && !JS_INCOMPLETE_TRAILING_OPERATOR_RE.test(source)) return "";
|
|
229
257
|
try {
|
|
230
|
-
const ast =
|
|
231
|
-
cache:
|
|
258
|
+
const ast = require_context.babelParse(source, {
|
|
259
|
+
cache: false,
|
|
232
260
|
cacheKey: "vite-runtime-affecting:unambiguous",
|
|
233
261
|
plugins: ["jsx", "typescript"],
|
|
234
262
|
sourceType: "unambiguous"
|
|
235
263
|
});
|
|
236
264
|
const parts = [];
|
|
237
|
-
|
|
265
|
+
require_context.traverse(ast, {
|
|
238
266
|
noScope: true,
|
|
239
267
|
StringLiteral(path) {
|
|
240
268
|
parts.push(`s:${path.node.value}`);
|
|
@@ -298,8 +326,8 @@ function readEntrySource(output) {
|
|
|
298
326
|
return output.source.toString();
|
|
299
327
|
}
|
|
300
328
|
function classifyBundleEntry(file, opts) {
|
|
329
|
+
if (opts.htmlMatcher(file) || isHTMLRequest(file)) return "html";
|
|
301
330
|
if (opts.cssMatcher(file) || isCSSRequest(file)) return "css";
|
|
302
|
-
if (opts.htmlMatcher(file)) return "html";
|
|
303
331
|
if (opts.jsMatcher(file) || opts.wxsMatcher(file)) return "js";
|
|
304
332
|
return "other";
|
|
305
333
|
}
|
|
@@ -334,12 +362,12 @@ function buildBundleSnapshot(bundle, opts, outDir, state, forceAll = false, opti
|
|
|
334
362
|
sourceHashByFile.set(file, hash);
|
|
335
363
|
const previousHash = state.sourceHashByFile.get(file);
|
|
336
364
|
const changed = previousHash == null || previousHash !== hash;
|
|
337
|
-
const previousRuntimeAffectingSignature = state.runtimeAffectingSignatureByFile.get(file);
|
|
338
365
|
const previousRuntimeAffectingHash = state.runtimeAffectingHashByFile.get(file);
|
|
339
|
-
const
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
366
|
+
const runtimeAffectingHash = !changed && previousRuntimeAffectingHash != null ? previousRuntimeAffectingHash : (() => {
|
|
367
|
+
const runtimeAffectingSignature = createRuntimeAffectingSourceSignature(source, type);
|
|
368
|
+
runtimeAffectingSignatureByFile.set(file, runtimeAffectingSignature);
|
|
369
|
+
return opts.cache.computeHash(runtimeAffectingSignature);
|
|
370
|
+
})();
|
|
343
371
|
runtimeAffectingHashByFile.set(file, runtimeAffectingHash);
|
|
344
372
|
if (changed) changedByType[type].add(file);
|
|
345
373
|
if (previousRuntimeAffectingHash == null || previousRuntimeAffectingHash !== runtimeAffectingHash) runtimeAffectingChangedByType[type].add(file);
|
|
@@ -392,16 +420,158 @@ function invertLinkedByEntry(linkedByEntry) {
|
|
|
392
420
|
}
|
|
393
421
|
return dependentsByLinkedFile;
|
|
394
422
|
}
|
|
423
|
+
function replaceMapEntries(target, source) {
|
|
424
|
+
target.clear();
|
|
425
|
+
for (const [key, value] of source) target.set(key, value);
|
|
426
|
+
return target;
|
|
427
|
+
}
|
|
428
|
+
function mergeMapEntries(target, source) {
|
|
429
|
+
for (const [key, value] of source) target.set(key, value);
|
|
430
|
+
return target;
|
|
431
|
+
}
|
|
395
432
|
function updateBundleBuildState(state, snapshot, linkedByEntry, options = {}) {
|
|
396
433
|
const incremental = options.incremental === true;
|
|
397
434
|
state.iteration += 1;
|
|
398
|
-
state.sourceHashByFile = incremental ?
|
|
399
|
-
state.runtimeAffectingSignatureByFile
|
|
400
|
-
state.runtimeAffectingHashByFile = incremental ?
|
|
401
|
-
state.linkedByEntry = incremental ?
|
|
435
|
+
state.sourceHashByFile = incremental ? mergeMapEntries(state.sourceHashByFile, snapshot.sourceHashByFile) : replaceMapEntries(state.sourceHashByFile, snapshot.sourceHashByFile);
|
|
436
|
+
state.runtimeAffectingSignatureByFile.clear();
|
|
437
|
+
state.runtimeAffectingHashByFile = incremental ? mergeMapEntries(state.runtimeAffectingHashByFile, snapshot.runtimeAffectingHashByFile) : replaceMapEntries(state.runtimeAffectingHashByFile, snapshot.runtimeAffectingHashByFile);
|
|
438
|
+
state.linkedByEntry = incremental ? mergeMapEntries(state.linkedByEntry, linkedByEntry) : replaceMapEntries(state.linkedByEntry, linkedByEntry);
|
|
402
439
|
state.dependentsByLinkedFile = invertLinkedByEntry(state.linkedByEntry);
|
|
403
440
|
}
|
|
404
441
|
//#endregion
|
|
442
|
+
//#region src/bundlers/vite/generate-bundle/signatures.ts
|
|
443
|
+
function summarizeStringDiff(previous, next) {
|
|
444
|
+
if (previous === next) return "same";
|
|
445
|
+
const previousLength = previous.length;
|
|
446
|
+
const nextLength = next.length;
|
|
447
|
+
const minLength = Math.min(previousLength, nextLength);
|
|
448
|
+
let prefixLength = 0;
|
|
449
|
+
while (prefixLength < minLength && previous.charCodeAt(prefixLength) === next.charCodeAt(prefixLength)) prefixLength += 1;
|
|
450
|
+
let previousSuffixCursor = previousLength - 1;
|
|
451
|
+
let nextSuffixCursor = nextLength - 1;
|
|
452
|
+
while (previousSuffixCursor >= prefixLength && nextSuffixCursor >= prefixLength && previous.charCodeAt(previousSuffixCursor) === next.charCodeAt(nextSuffixCursor)) {
|
|
453
|
+
previousSuffixCursor -= 1;
|
|
454
|
+
nextSuffixCursor -= 1;
|
|
455
|
+
}
|
|
456
|
+
const previousChangedLength = previousSuffixCursor >= prefixLength ? previousSuffixCursor - prefixLength + 1 : 0;
|
|
457
|
+
const nextChangedLength = nextSuffixCursor >= prefixLength ? nextSuffixCursor - prefixLength + 1 : 0;
|
|
458
|
+
return `changed@${prefixLength} old=${previousChangedLength} new=${nextChangedLength} len=${previousLength}->${nextLength}`;
|
|
459
|
+
}
|
|
460
|
+
function createLinkedImpactSignature(entry, linkedImpactsByEntry, sourceHashByFile) {
|
|
461
|
+
const changedLinkedFiles = linkedImpactsByEntry.get(entry);
|
|
462
|
+
if (!changedLinkedFiles || changedLinkedFiles.size === 0) return;
|
|
463
|
+
return [...changedLinkedFiles].sort().map((file) => {
|
|
464
|
+
return `${file}:${sourceHashByFile.get(file) ?? "missing"}`;
|
|
465
|
+
}).join(",");
|
|
466
|
+
}
|
|
467
|
+
function createJsHashSalt(runtimeSignature, linkedImpactSignature) {
|
|
468
|
+
if (!linkedImpactSignature) return runtimeSignature;
|
|
469
|
+
return `${runtimeSignature}:linked:${linkedImpactSignature}`;
|
|
470
|
+
}
|
|
471
|
+
function createStableTextSignature(input) {
|
|
472
|
+
let hash = 2166136261;
|
|
473
|
+
for (let i = 0; i < input.length; i++) {
|
|
474
|
+
hash ^= input.charCodeAt(i);
|
|
475
|
+
hash = Math.imul(hash, 16777619);
|
|
476
|
+
}
|
|
477
|
+
return (hash >>> 0).toString(36);
|
|
478
|
+
}
|
|
479
|
+
function createCandidateSignature(candidates) {
|
|
480
|
+
if (candidates.size === 0) return "empty";
|
|
481
|
+
return createStableTextSignature([...candidates].sort().join("\n"));
|
|
482
|
+
}
|
|
483
|
+
function getSnapshotHash(snapshotMap, file, fallback) {
|
|
484
|
+
return snapshotMap.get(file) ?? fallback;
|
|
485
|
+
}
|
|
486
|
+
function hasRuntimeAffectingSourceChanges(changedByType) {
|
|
487
|
+
return changedByType.html.size > 0 || changedByType.js.size > 0;
|
|
488
|
+
}
|
|
489
|
+
//#endregion
|
|
490
|
+
//#region src/bundlers/vite/generate-bundle/scoped-generator.ts
|
|
491
|
+
function hasOwnSourceDirectives(rawSource) {
|
|
492
|
+
return rawSource.includes("@source") || rawSource.includes("@config");
|
|
493
|
+
}
|
|
494
|
+
function createLocalSourceEntries(sourceFile) {
|
|
495
|
+
return [{
|
|
496
|
+
base: node_path.default.dirname(node_path.default.resolve(sourceFile.replace(/[?#].*$/, ""))),
|
|
497
|
+
negated: false,
|
|
498
|
+
pattern: "**/*"
|
|
499
|
+
}];
|
|
500
|
+
}
|
|
501
|
+
function intersectCandidates(first, second) {
|
|
502
|
+
const scoped = /* @__PURE__ */ new Set();
|
|
503
|
+
const [small, large] = first.size <= second.size ? [first, second] : [second, first];
|
|
504
|
+
for (const candidate of small) if (large.has(candidate)) scoped.add(candidate);
|
|
505
|
+
return scoped;
|
|
506
|
+
}
|
|
507
|
+
function resolveScopedSourceEntries(rawSource, sourceFile, resolvedEntries) {
|
|
508
|
+
if (!hasOwnSourceDirectives(rawSource)) return {
|
|
509
|
+
entries: resolvedEntries,
|
|
510
|
+
localEntries: void 0
|
|
511
|
+
};
|
|
512
|
+
const localEntries = createLocalSourceEntries(sourceFile);
|
|
513
|
+
if (!resolvedEntries || resolvedEntries.length === 0) return {
|
|
514
|
+
entries: localEntries,
|
|
515
|
+
localEntries: void 0
|
|
516
|
+
};
|
|
517
|
+
return {
|
|
518
|
+
entries: resolvedEntries,
|
|
519
|
+
localEntries
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
async function createScopedGeneratorCandidateSignature(rawSource, sourceFile, fallbackSignature, getSourceCandidatesForEntries, options = {}) {
|
|
523
|
+
if (!getSourceCandidatesForEntries || !hasOwnSourceDirectives(rawSource)) return fallbackSignature;
|
|
524
|
+
const { entries, localEntries } = resolveScopedSourceEntries(rawSource, sourceFile, (await require_tailwindcss.resolveTailwindV4EntriesFromCssCached(rawSource, node_path.default.dirname(node_path.default.resolve(sourceFile.replace(/[?#].*$/, "")))))?.entries);
|
|
525
|
+
if (entries === void 0) return fallbackSignature;
|
|
526
|
+
const scopedCandidates = getSourceCandidatesForEntries(entries);
|
|
527
|
+
const scopedSignature = createCandidateSignature(localEntries ? intersectCandidates(scopedCandidates, getSourceCandidatesForEntries(localEntries)) : scopedCandidates);
|
|
528
|
+
return options.includeFallbackSignature === true ? `${scopedSignature}:${fallbackSignature}` : scopedSignature;
|
|
529
|
+
}
|
|
530
|
+
async function createScopedGeneratorRuntime(options) {
|
|
531
|
+
const { cssHandlerOptions, fallbackRuntime, getSourceCandidatesForEntries, outputFile, rawSource, shouldExcludeSubpackageSourceCandidates, sourceFile, scopedSourceCandidateGetter } = options;
|
|
532
|
+
if (getSourceCandidatesForEntries && rawSource && sourceFile) {
|
|
533
|
+
const { entries, localEntries } = resolveScopedSourceEntries(rawSource, sourceFile, (await require_tailwindcss.resolveTailwindV4EntriesFromCssCached(rawSource, node_path.default.dirname(node_path.default.resolve(sourceFile.replace(/[?#].*$/, "")))))?.entries);
|
|
534
|
+
if (entries !== void 0 && (entries.length > 0 || hasOwnSourceDirectives(rawSource))) {
|
|
535
|
+
const scopedCandidates = scopedSourceCandidateGetter?.(entries) ?? getSourceCandidatesForEntries(entries);
|
|
536
|
+
if (!localEntries) return scopedCandidates;
|
|
537
|
+
return intersectCandidates(scopedCandidates, scopedSourceCandidateGetter?.(localEntries) ?? getSourceCandidatesForEntries(localEntries));
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
const scopedCandidates = scopedSourceCandidateGetter?.(void 0);
|
|
541
|
+
if (scopedCandidates && (scopedCandidates.size > 0 || shouldExcludeSubpackageSourceCandidates(outputFile, cssHandlerOptions))) return scopedCandidates;
|
|
542
|
+
if (!shouldExcludeSubpackageSourceCandidates(outputFile, cssHandlerOptions)) return fallbackRuntime;
|
|
543
|
+
return fallbackRuntime;
|
|
544
|
+
}
|
|
545
|
+
//#endregion
|
|
546
|
+
//#region src/bundlers/vite/source-candidate-scan-signature.ts
|
|
547
|
+
function normalizeSignaturePath(value) {
|
|
548
|
+
return slash(node_path.default.resolve(value));
|
|
549
|
+
}
|
|
550
|
+
function serializeInlineCandidates(inlineCandidates) {
|
|
551
|
+
return {
|
|
552
|
+
excluded: [...inlineCandidates?.excluded ?? []].sort(),
|
|
553
|
+
included: [...inlineCandidates?.included ?? []].sort()
|
|
554
|
+
};
|
|
555
|
+
}
|
|
556
|
+
function serializeSourceEntries(entries) {
|
|
557
|
+
return (entries ?? []).map((entry) => ({
|
|
558
|
+
base: normalizeSignaturePath(entry.base),
|
|
559
|
+
negated: entry.negated,
|
|
560
|
+
pattern: entry.pattern
|
|
561
|
+
})).sort((a, b) => `${a.base}\0${a.pattern}\0${a.negated}`.localeCompare(`${b.base}\0${b.pattern}\0${b.negated}`));
|
|
562
|
+
}
|
|
563
|
+
function createSourceCandidateScanSignature(input) {
|
|
564
|
+
return JSON.stringify({
|
|
565
|
+
inlineCandidates: serializeInlineCandidates(input.inlineCandidates),
|
|
566
|
+
outDir: input.outDir ? normalizeSignaturePath(input.outDir) : void 0,
|
|
567
|
+
roots: input.roots.map((root) => ({
|
|
568
|
+
entries: serializeSourceEntries(root.entries),
|
|
569
|
+
root: normalizeSignaturePath(root.root)
|
|
570
|
+
})),
|
|
571
|
+
scanAllSources: input.scanAllSources ?? false
|
|
572
|
+
});
|
|
573
|
+
}
|
|
574
|
+
//#endregion
|
|
405
575
|
Object.defineProperty(exports, "applyLinkedResults", {
|
|
406
576
|
enumerable: true,
|
|
407
577
|
get: function() {
|
|
@@ -414,6 +584,12 @@ Object.defineProperty(exports, "buildBundleSnapshot", {
|
|
|
414
584
|
return buildBundleSnapshot;
|
|
415
585
|
}
|
|
416
586
|
});
|
|
587
|
+
Object.defineProperty(exports, "classifyBundleEntry", {
|
|
588
|
+
enumerable: true,
|
|
589
|
+
get: function() {
|
|
590
|
+
return classifyBundleEntry;
|
|
591
|
+
}
|
|
592
|
+
});
|
|
417
593
|
Object.defineProperty(exports, "createBundleBuildState", {
|
|
418
594
|
enumerable: true,
|
|
419
595
|
get: function() {
|
|
@@ -432,30 +608,90 @@ Object.defineProperty(exports, "createBundlerGeneratedCssMarker", {
|
|
|
432
608
|
return createBundlerGeneratedCssMarker;
|
|
433
609
|
}
|
|
434
610
|
});
|
|
611
|
+
Object.defineProperty(exports, "createCandidateSignature", {
|
|
612
|
+
enumerable: true,
|
|
613
|
+
get: function() {
|
|
614
|
+
return createCandidateSignature;
|
|
615
|
+
}
|
|
616
|
+
});
|
|
617
|
+
Object.defineProperty(exports, "createJsHashSalt", {
|
|
618
|
+
enumerable: true,
|
|
619
|
+
get: function() {
|
|
620
|
+
return createJsHashSalt;
|
|
621
|
+
}
|
|
622
|
+
});
|
|
623
|
+
Object.defineProperty(exports, "createLinkedImpactSignature", {
|
|
624
|
+
enumerable: true,
|
|
625
|
+
get: function() {
|
|
626
|
+
return createLinkedImpactSignature;
|
|
627
|
+
}
|
|
628
|
+
});
|
|
435
629
|
Object.defineProperty(exports, "createRuntimeAffectingSourceSignature", {
|
|
436
630
|
enumerable: true,
|
|
437
631
|
get: function() {
|
|
438
632
|
return createRuntimeAffectingSourceSignature;
|
|
439
633
|
}
|
|
440
634
|
});
|
|
635
|
+
Object.defineProperty(exports, "createScopedGeneratorCandidateSignature", {
|
|
636
|
+
enumerable: true,
|
|
637
|
+
get: function() {
|
|
638
|
+
return createScopedGeneratorCandidateSignature;
|
|
639
|
+
}
|
|
640
|
+
});
|
|
641
|
+
Object.defineProperty(exports, "createScopedGeneratorRuntime", {
|
|
642
|
+
enumerable: true,
|
|
643
|
+
get: function() {
|
|
644
|
+
return createScopedGeneratorRuntime;
|
|
645
|
+
}
|
|
646
|
+
});
|
|
647
|
+
Object.defineProperty(exports, "createSourceCandidateScanSignature", {
|
|
648
|
+
enumerable: true,
|
|
649
|
+
get: function() {
|
|
650
|
+
return createSourceCandidateScanSignature;
|
|
651
|
+
}
|
|
652
|
+
});
|
|
441
653
|
Object.defineProperty(exports, "formatPostcssSourceMap", {
|
|
442
654
|
enumerable: true,
|
|
443
655
|
get: function() {
|
|
444
656
|
return formatPostcssSourceMap;
|
|
445
657
|
}
|
|
446
658
|
});
|
|
659
|
+
Object.defineProperty(exports, "generateTailwindV4Css", {
|
|
660
|
+
enumerable: true,
|
|
661
|
+
get: function() {
|
|
662
|
+
return generateTailwindV4Css;
|
|
663
|
+
}
|
|
664
|
+
});
|
|
665
|
+
Object.defineProperty(exports, "getSnapshotHash", {
|
|
666
|
+
enumerable: true,
|
|
667
|
+
get: function() {
|
|
668
|
+
return getSnapshotHash;
|
|
669
|
+
}
|
|
670
|
+
});
|
|
447
671
|
Object.defineProperty(exports, "hasBundlerGeneratedCssMarker", {
|
|
448
672
|
enumerable: true,
|
|
449
673
|
get: function() {
|
|
450
674
|
return hasBundlerGeneratedCssMarker;
|
|
451
675
|
}
|
|
452
676
|
});
|
|
677
|
+
Object.defineProperty(exports, "hasRuntimeAffectingSourceChanges", {
|
|
678
|
+
enumerable: true,
|
|
679
|
+
get: function() {
|
|
680
|
+
return hasRuntimeAffectingSourceChanges;
|
|
681
|
+
}
|
|
682
|
+
});
|
|
453
683
|
Object.defineProperty(exports, "isCSSRequest", {
|
|
454
684
|
enumerable: true,
|
|
455
685
|
get: function() {
|
|
456
686
|
return isCSSRequest;
|
|
457
687
|
}
|
|
458
688
|
});
|
|
689
|
+
Object.defineProperty(exports, "isHTMLRequest", {
|
|
690
|
+
enumerable: true,
|
|
691
|
+
get: function() {
|
|
692
|
+
return isHTMLRequest;
|
|
693
|
+
}
|
|
694
|
+
});
|
|
459
695
|
Object.defineProperty(exports, "isSourceStyleRequest", {
|
|
460
696
|
enumerable: true,
|
|
461
697
|
get: function() {
|
|
@@ -516,6 +752,12 @@ Object.defineProperty(exports, "stripRequestQuery", {
|
|
|
516
752
|
return stripRequestQuery;
|
|
517
753
|
}
|
|
518
754
|
});
|
|
755
|
+
Object.defineProperty(exports, "summarizeStringDiff", {
|
|
756
|
+
enumerable: true,
|
|
757
|
+
get: function() {
|
|
758
|
+
return summarizeStringDiff;
|
|
759
|
+
}
|
|
760
|
+
});
|
|
519
761
|
Object.defineProperty(exports, "toAbsoluteOutputPath", {
|
|
520
762
|
enumerable: true,
|
|
521
763
|
get: function() {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { IArbitraryValues } from '../types/shared';
|
|
2
|
+
export interface SourceCandidateExtractionOptions {
|
|
3
|
+
bareArbitraryValues?: IArbitraryValues['bareArbitraryValues'] | undefined;
|
|
4
|
+
extractor?: ((source: string, extension: string) => Promise<Iterable<string>> | Iterable<string>) | undefined;
|
|
5
|
+
}
|
|
6
|
+
export declare function extractCandidatesFromSource(source: string, extension: string, options?: SourceCandidateExtractionOptions): Promise<Set<string>>;
|
|
7
|
+
export declare function extractScriptStringCandidates(source: string, extension: string, options: SourceCandidateExtractionOptions): Promise<never[] | Set<string>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PackageResolvingOptions } from 'local-pkg';
|
|
2
2
|
import type { PackageJson } from 'pkg-types';
|
|
3
|
-
import {
|
|
3
|
+
import { createTailwindcssRuntime } from './runtime-factory';
|
|
4
4
|
declare function getTailwindcssPackageInfo(options?: PackageResolvingOptions): {
|
|
5
5
|
name: string;
|
|
6
6
|
version: string | undefined;
|
|
@@ -8,4 +8,4 @@ declare function getTailwindcssPackageInfo(options?: PackageResolvingOptions): {
|
|
|
8
8
|
packageJsonPath: string;
|
|
9
9
|
packageJson: PackageJson;
|
|
10
10
|
} | undefined;
|
|
11
|
-
export {
|
|
11
|
+
export { createTailwindcssRuntime, getTailwindcssPackageInfo, };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TailwindcssRuntimeLike } from '../../types';
|
|
2
2
|
interface RuntimeClassSetCacheEntry {
|
|
3
3
|
value?: Set<string> | undefined;
|
|
4
4
|
promise?: Promise<Set<string>> | undefined;
|
|
5
5
|
signature?: string | undefined;
|
|
6
6
|
}
|
|
7
|
-
export declare const
|
|
8
|
-
export declare function invalidateRuntimeClassSet(
|
|
9
|
-
export declare function getRuntimeClassSetCacheEntry(
|
|
10
|
-
export declare function getRuntimeClassSetSignature(
|
|
11
|
-
export declare function getRuntimeClassSetSignatureWithSources(
|
|
7
|
+
export declare const runtimeSignatureRuntimesSymbol: unique symbol;
|
|
8
|
+
export declare function invalidateRuntimeClassSet(tailwindRuntime?: TailwindcssRuntimeLike): void;
|
|
9
|
+
export declare function getRuntimeClassSetCacheEntry(tailwindRuntime: TailwindcssRuntimeLike): RuntimeClassSetCacheEntry;
|
|
10
|
+
export declare function getRuntimeClassSetSignature(tailwindRuntime: TailwindcssRuntimeLike): string;
|
|
11
|
+
export declare function getRuntimeClassSetSignatureWithSources(tailwindRuntime: TailwindcssRuntimeLike): Promise<string>;
|
|
12
12
|
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { LengthUnitsRuntimeOptions, TailwindCssRuntimeOptions } from './runtime-types';
|
|
2
|
+
import type { TailwindcssRuntimeLike } from '../types';
|
|
3
|
+
type TailwindUserOptions = NonNullable<TailwindCssRuntimeOptions['tailwindcss']>;
|
|
4
|
+
export interface CreateTailwindcssRuntimeOptions {
|
|
5
|
+
basedir?: string;
|
|
6
|
+
cacheDir?: string;
|
|
7
|
+
supportCustomLengthUnits?: boolean | LengthUnitsRuntimeOptions;
|
|
8
|
+
tailwindcss?: TailwindUserOptions;
|
|
9
|
+
tailwindcssRuntimeOptions?: TailwindCssRuntimeOptions;
|
|
10
|
+
}
|
|
11
|
+
export declare function createTailwindcssRuntime(options?: CreateTailwindcssRuntimeOptions): TailwindcssRuntimeLike;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { LengthUnitsRuntimeOptions, TailwindCssRuntimeOptions } from './runtime-types';
|
|
2
|
+
type TailwindUserOptions = NonNullable<TailwindCssRuntimeOptions['tailwindcss']>;
|
|
3
|
+
type TailwindApplyOptions = NonNullable<TailwindCssRuntimeOptions['apply']>;
|
|
4
|
+
type TailwindExtendLengthUnitsOption = TailwindApplyOptions['extendLengthUnits'];
|
|
5
|
+
export declare function resolveTailwindcssOptions(options?: TailwindCssRuntimeOptions): TailwindUserOptions | undefined;
|
|
6
|
+
export declare function normalizeExtendLengthUnits(value: boolean | LengthUnitsRuntimeOptions | undefined): TailwindExtendLengthUnitsOption | undefined;
|
|
7
|
+
export declare function normalizeTailwindcssRuntimeOptions(options?: TailwindCssRuntimeOptions): TailwindCssRuntimeOptions | undefined;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { PackageResolvingOptions } from 'local-pkg';
|
|
2
|
+
import type { TailwindSourceEntry } from './source-scan';
|
|
3
|
+
import type { TailwindV4SourceOptions } from './v4-engine';
|
|
4
|
+
type TailwindV4CssSource = NonNullable<TailwindV4SourceOptions['cssSources']>[number];
|
|
5
|
+
export interface LengthUnitsRuntimeOptions {
|
|
6
|
+
units?: string[] | undefined;
|
|
7
|
+
rem2rpx?: boolean | undefined;
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
export interface ExtendLengthUnitsOptions extends Partial<LengthUnitsRuntimeOptions> {
|
|
11
|
+
enabled?: boolean | undefined;
|
|
12
|
+
}
|
|
13
|
+
export type CacheStrategy = 'merge' | 'overwrite';
|
|
14
|
+
export type CacheDriver = 'file' | 'memory' | 'noop';
|
|
15
|
+
export interface CacheOptions {
|
|
16
|
+
enabled?: boolean | undefined;
|
|
17
|
+
cwd?: string | undefined;
|
|
18
|
+
dir?: string | undefined;
|
|
19
|
+
file?: string | undefined;
|
|
20
|
+
strategy?: CacheStrategy | undefined;
|
|
21
|
+
driver?: CacheDriver | undefined;
|
|
22
|
+
}
|
|
23
|
+
export interface ExtractOptions {
|
|
24
|
+
write?: boolean | undefined;
|
|
25
|
+
file?: string | undefined;
|
|
26
|
+
format?: 'json' | 'lines' | undefined;
|
|
27
|
+
pretty?: number | boolean | undefined;
|
|
28
|
+
removeUniversalSelector?: boolean | undefined;
|
|
29
|
+
}
|
|
30
|
+
export interface ExposeContextOptions {
|
|
31
|
+
refProperty?: string | undefined;
|
|
32
|
+
}
|
|
33
|
+
export interface ApplyOptions {
|
|
34
|
+
overwrite?: boolean | undefined;
|
|
35
|
+
exposeContext?: boolean | ExposeContextOptions | undefined;
|
|
36
|
+
extendLengthUnits?: false | ExtendLengthUnitsOptions | undefined;
|
|
37
|
+
}
|
|
38
|
+
export interface TailwindRuntimeOptionsBase {
|
|
39
|
+
config?: string | undefined;
|
|
40
|
+
cwd?: string | undefined;
|
|
41
|
+
postcssPlugin?: string | undefined;
|
|
42
|
+
}
|
|
43
|
+
export interface TailwindV4Options {
|
|
44
|
+
base?: string | undefined;
|
|
45
|
+
css?: string | undefined;
|
|
46
|
+
cssSources?: TailwindV4CssSource[] | undefined;
|
|
47
|
+
cssEntries?: string[] | undefined;
|
|
48
|
+
sources?: TailwindSourceEntry[] | undefined;
|
|
49
|
+
bareArbitraryValues?: boolean | {
|
|
50
|
+
units?: string[] | undefined;
|
|
51
|
+
} | undefined;
|
|
52
|
+
}
|
|
53
|
+
export interface TailwindCssOptions extends TailwindRuntimeOptionsBase {
|
|
54
|
+
version?: 4 | undefined;
|
|
55
|
+
packageName?: string | undefined;
|
|
56
|
+
resolve?: PackageResolvingOptions | undefined;
|
|
57
|
+
v4?: TailwindV4Options | undefined;
|
|
58
|
+
}
|
|
59
|
+
export interface TailwindCssRuntimeOptions {
|
|
60
|
+
projectRoot?: string | undefined;
|
|
61
|
+
tailwindcss?: TailwindCssOptions | undefined;
|
|
62
|
+
apply?: ApplyOptions | undefined;
|
|
63
|
+
extract?: ExtractOptions | undefined;
|
|
64
|
+
filter?: ((className: string) => boolean) | undefined;
|
|
65
|
+
cache?: boolean | CacheOptions | undefined;
|
|
66
|
+
}
|
|
67
|
+
export interface TailwindPackageInfo {
|
|
68
|
+
name: string;
|
|
69
|
+
version: string | undefined;
|
|
70
|
+
rootPath: string;
|
|
71
|
+
packageJsonPath: string;
|
|
72
|
+
packageJson: Record<string, unknown>;
|
|
73
|
+
}
|
|
74
|
+
export interface TailwindcssExtractOptions extends ExtractOptions {
|
|
75
|
+
}
|
|
76
|
+
export interface TailwindcssExtractResult {
|
|
77
|
+
classList: string[];
|
|
78
|
+
classSet: Set<string>;
|
|
79
|
+
filename?: string | undefined;
|
|
80
|
+
}
|
|
81
|
+
export interface TailwindContentTokenReport {
|
|
82
|
+
entries: unknown[];
|
|
83
|
+
filesScanned: number;
|
|
84
|
+
sources: unknown[];
|
|
85
|
+
skippedFiles: unknown[];
|
|
86
|
+
}
|
|
87
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RefreshTailwindcssRuntimeOptions, TailwindcssRuntimeLike } from '../types';
|
|
2
2
|
import { invalidateRuntimeClassSet } from './runtime/cache';
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const refreshTailwindcssRuntimeSymbol: unique symbol;
|
|
4
4
|
export interface CollectRuntimeClassSetOptions {
|
|
5
5
|
force?: boolean | undefined;
|
|
6
6
|
skipRefresh?: boolean | undefined;
|
|
@@ -10,11 +10,11 @@ export interface RefreshTailwindRuntimeStateOptions {
|
|
|
10
10
|
force: boolean;
|
|
11
11
|
clearCache?: boolean | undefined;
|
|
12
12
|
}
|
|
13
|
-
export declare function createTailwindRuntimeReadyPromise(
|
|
13
|
+
export declare function createTailwindRuntimeReadyPromise(tailwindRuntime: TailwindcssRuntimeLike): Promise<void>;
|
|
14
14
|
export interface TailwindRuntimeState {
|
|
15
|
-
|
|
15
|
+
tailwindRuntime: TailwindcssRuntimeLike;
|
|
16
16
|
readyPromise: Promise<void>;
|
|
17
|
-
|
|
17
|
+
refreshTailwindcssRuntime?: ((options?: RefreshTailwindcssRuntimeOptions) => Promise<TailwindcssRuntimeLike>) | undefined;
|
|
18
18
|
}
|
|
19
19
|
export declare function refreshTailwindRuntimeState(state: TailwindRuntimeState, forceOrOptions: boolean | RefreshTailwindRuntimeStateOptions): Promise<boolean>;
|
|
20
20
|
export interface EnsureRuntimeClassSetOptions {
|
|
@@ -24,5 +24,5 @@ export interface EnsureRuntimeClassSetOptions {
|
|
|
24
24
|
allowEmpty?: boolean | undefined;
|
|
25
25
|
}
|
|
26
26
|
export declare function ensureRuntimeClassSet(state: TailwindRuntimeState, options?: EnsureRuntimeClassSetOptions): Promise<Set<string>>;
|
|
27
|
-
declare function collectRuntimeClassSet(
|
|
27
|
+
declare function collectRuntimeClassSet(tailwindRuntime: TailwindcssRuntimeLike, options?: CollectRuntimeClassSetOptions): Promise<Set<string>>;
|
|
28
28
|
export { collectRuntimeClassSet, invalidateRuntimeClassSet };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function logTailwindcssTarget(
|
|
1
|
+
import type { TailwindcssRuntimeLike } from '../types';
|
|
2
|
+
export declare function logTailwindcssTarget(tailwindRuntime: TailwindcssRuntimeLike | undefined, baseDir?: string): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { InternalUserDefinedOptions,
|
|
1
|
+
import type { InternalUserDefinedOptions, TailwindcssRuntimeLike } from '../../types';
|
|
2
2
|
export declare const DEFAULT_CSS_CALC_CUSTOM_PROPERTIES: (string | RegExp)[];
|
|
3
3
|
export declare function normalizeCssEntriesConfig(entries: unknown): string[] | undefined;
|
|
4
|
-
export declare function warnMissingCssEntries(ctx: InternalUserDefinedOptions,
|
|
5
|
-
export declare function applyV4CssCalcDefaults(cssCalc: InternalUserDefinedOptions['cssCalc'],
|
|
4
|
+
export declare function warnMissingCssEntries(ctx: InternalUserDefinedOptions, tailwindRuntime: TailwindcssRuntimeLike | undefined): void;
|
|
5
|
+
export declare function applyV4CssCalcDefaults(cssCalc: InternalUserDefinedOptions['cssCalc'], tailwindRuntime: TailwindcssRuntimeLike | undefined): InternalUserDefinedOptions['cssCalc'];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export declare function isTailwindV4CssEntry(entry: string | undefined): entry is string;
|
|
1
2
|
export declare function guessBasedirFromEntries(entries?: string[]): string | undefined;
|
|
2
3
|
export declare function normalizeCssEntries(entries: string[] | undefined, anchor: string): string[] | undefined;
|
|
3
4
|
export interface GroupCssEntriesOptions {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import type { TailwindV4CssSource } from 'tailwindcss-
|
|
1
|
+
import type { TailwindV4CssSource } from '@tailwindcss-mangle/engine';
|
|
2
2
|
import type { UserDefinedOptions } from '../../types';
|
|
3
3
|
export declare function hasCssSourcesValue(value: unknown): boolean;
|
|
4
|
-
export declare function
|
|
4
|
+
export declare function isTailwindV4CssSourceRoot(source: unknown): source is TailwindV4CssSource;
|
|
5
|
+
export declare function filterTailwindV4CssSourceRoots(sources: TailwindV4CssSource[] | undefined): TailwindV4CssSource[] | undefined;
|
|
6
|
+
export declare function hasConfiguredTailwindV4CssRoots(options: Pick<UserDefinedOptions, 'cssEntries' | 'tailwindcss' | 'tailwindcssRuntimeOptions'>): boolean;
|
|
5
7
|
export declare function upsertTailwindV4CssSource(opts: UserDefinedOptions, source: TailwindV4CssSource): boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './config';
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './runtime-factory';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { TailwindCssRuntimeOptions } from '../runtime-types';
|
|
2
|
+
import type { CreateTailwindcssRuntimeOptions } from '../runtime-factory';
|
|
3
|
+
import type { InternalUserDefinedOptions, TailwindcssRuntimeLike } from '../../types';
|
|
4
|
+
export { groupCssEntriesByBase, guessBasedirFromEntries, normalizeCssEntries } from './css-entries';
|
|
5
|
+
export { createMultiTailwindcssRuntime } from './multi-runtime';
|
|
6
|
+
type TailwindUserOptions = NonNullable<TailwindCssRuntimeOptions['tailwindcss']>;
|
|
7
|
+
export interface TailwindcssRuntimeFactoryOptions {
|
|
8
|
+
tailwindcss?: TailwindUserOptions;
|
|
9
|
+
tailwindcssRuntimeOptions?: CreateTailwindcssRuntimeOptions['tailwindcssRuntimeOptions'];
|
|
10
|
+
supportCustomLengthUnits: InternalUserDefinedOptions['supportCustomLengthUnits'];
|
|
11
|
+
appType: InternalUserDefinedOptions['appType'];
|
|
12
|
+
bareArbitraryValues?: InternalUserDefinedOptions['arbitraryValues']['bareArbitraryValues'];
|
|
13
|
+
}
|
|
14
|
+
export declare function createTailwindcssRuntimeForBase(baseDir: string, cssEntries: string[] | undefined, options: TailwindcssRuntimeFactoryOptions): TailwindcssRuntimeLike;
|
|
15
|
+
export declare function tryCreateMultiTailwindcssRuntime(groups: Map<string, string[]>, options: TailwindcssRuntimeFactoryOptions): TailwindcssRuntimeLike | undefined;
|