weapp-tailwindcss 5.2.13 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -8
- package/README.zh-CN.md +64 -0
- package/dist/bundlers/rspack/rule-match.d.ts +13 -0
- package/dist/bundlers/shared/source-candidates/scan-root.d.ts +1 -1
- package/dist/bundlers/shared/source-candidates/types-and-cache.d.ts +2 -0
- package/dist/bundlers/vite/generate-bundle/root-style-output.d.ts +7 -0
- package/dist/bundlers/vite/shared/create-framework-plugins.d.ts +1 -0
- package/dist/bundlers/vite/shared/framework-plugin-order.d.ts +2 -0
- package/dist/bundlers/vite/shared/framework-source-scan-session.d.ts +2 -2
- package/dist/{transform-BiHG42Rp.cjs → component-local-style-BirkN5f8.cjs} +33 -168
- package/dist/{transform-52FLRu-0.js → component-local-style-CFL4ClhS.js} +22 -174
- package/dist/generator/index.d.ts +2 -2
- package/dist/generator.cjs +7 -0
- package/dist/generator.js +2 -2
- package/dist/{gulp-DxKLSgXX.cjs → gulp-B0qcNiuP.cjs} +2 -2
- package/dist/{gulp-G--cGMcR.js → gulp-D1vDx4H1.js} +1 -1
- package/dist/gulp.cjs +1 -1
- package/dist/gulp.js +1 -1
- package/dist/{hmr-timing-iTua_Z55.js → hmr-timing-Dq1_msos.js} +19 -15
- package/dist/{hmr-timing-BtqnyxAO.cjs → hmr-timing-pF6k35pP.cjs} +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.js +3 -3
- package/dist/{pipeline-helpers-DnYpfbat.cjs → pipeline-helpers-DA5-EzbO.cjs} +1 -1
- package/dist/rspack.cjs +124 -7
- package/dist/rspack.js +124 -7
- package/dist/{source-candidate-scan-signature-Ggn8fzkT.cjs → source-candidate-scan-signature-DGQufJk3.cjs} +1 -1
- package/dist/{source-candidate-scan-signature-TKJIs7VF.js → source-candidate-scan-signature-DSsjYtlq.js} +1 -1
- package/dist/tailwindcss/candidates.d.ts +2 -2
- package/dist/transform-BYhgJszj.cjs +200 -0
- package/dist/transform-Ck31voUU.js +201 -0
- package/dist/uni-app-x/component-local-style.d.ts +3 -1
- package/dist/uni-app-x/transform.d.ts +2 -0
- package/dist/uni-app-x/vite/style-request.d.ts +1 -0
- package/dist/uni-app-x/vite/web-local-style.d.ts +6 -0
- package/dist/{v4-generation-core-D-zVR2mt.cjs → v4-generation-core-BEYGV4eB.cjs} +19 -15
- package/dist/{vite-B577QMUl.js → vite-DBgbFsei.js} +240 -82
- package/dist/{vite-BFWJAH16.cjs → vite-jftHIupF.cjs} +240 -82
- package/dist/vite.cjs +1 -1
- package/dist/vite.js +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.cjs +2 -2
- package/dist/{webpack-DLJkStre.js → webpack-BSIWFzAA.js} +3 -3
- package/dist/{webpack-DTqFKvcE.cjs → webpack-DhwW2cva.cjs} +4 -4
- package/dist/webpack.cjs +1 -1
- package/dist/webpack.js +1 -1
- package/package.json +9 -14
- package/README.en.md +0 -17
- package/bin/weapp-tailwindcss.cjs +0 -8
- package/dist/cli/context.d.ts +0 -3
- package/dist/cli/doctor/constants.d.ts +0 -7
- package/dist/cli/doctor/types.d.ts +0 -31
- package/dist/cli/doctor.d.ts +0 -4
- package/dist/cli/helpers/options/format.d.ts +0 -2
- package/dist/cli/helpers/options/parse.d.ts +0 -3
- package/dist/cli/helpers/options/resolve.d.ts +0 -1
- package/dist/cli/helpers/options.d.ts +0 -3
- package/dist/cli/helpers.d.ts +0 -4
- package/dist/cli/mount-options.d.ts +0 -4
- package/dist/cli/types.d.ts +0 -15
- package/dist/cli/vscode-entry.d.ts +0 -14
- package/dist/cli.cjs +0 -37065
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +0 -2298
|
@@ -111,9 +111,10 @@ function createDefaultIgnoredSources(root, outDirIgnore, entries, explicit) {
|
|
|
111
111
|
}] : []];
|
|
112
112
|
}
|
|
113
113
|
/** 创建与文件系统 root scan 一致的增量源码资格判断器。 */
|
|
114
|
-
function createSourceCandidateEligibilityMatcher(roots) {
|
|
114
|
+
function createSourceCandidateEligibilityMatcher(roots, eligibleFiles) {
|
|
115
|
+
const eligibleFileSet = eligibleFiles === void 0 ? void 0 : new Set([...eligibleFiles].map(require_generator.resolveSourceScanPath));
|
|
115
116
|
const matchers = roots.map((options) => {
|
|
116
|
-
const root =
|
|
117
|
+
const root = require_generator.resolveSourceScanPath(options.root);
|
|
117
118
|
const outDirIgnore = resolveOutDirIgnorePattern(root, options.outDir);
|
|
118
119
|
const entries = options.entries;
|
|
119
120
|
const explicit = options.explicit === true;
|
|
@@ -123,11 +124,11 @@ function createSourceCandidateEligibilityMatcher(roots) {
|
|
|
123
124
|
if (explicit) return hasPositiveEntry && require_generator.isFileMatchedByTailwindSourceEntries(resolvedFile, entries);
|
|
124
125
|
const relative = node_path.default.relative(root, resolvedFile);
|
|
125
126
|
if (!relative || relative.startsWith("..") || node_path.default.isAbsolute(relative)) return false;
|
|
126
|
-
return require_generator.isFileMatchedByTailwindSourceEntries(resolvedFile, entries) && !require_generator.isFileExcludedByTailwindSourceEntries(resolvedFile, ignoredSources);
|
|
127
|
+
return require_generator.isFileMatchedByTailwindSourceEntries(resolvedFile, entries) && !require_generator.isFileExcludedByTailwindSourceEntries(resolvedFile, ignoredSources) && (eligibleFileSet?.has(resolvedFile) ?? true);
|
|
127
128
|
};
|
|
128
129
|
});
|
|
129
130
|
return (file) => {
|
|
130
|
-
const resolvedFile =
|
|
131
|
+
const resolvedFile = require_generator.resolveSourceScanPath(file);
|
|
131
132
|
return matchers.some((matches) => matches(resolvedFile));
|
|
132
133
|
};
|
|
133
134
|
}
|
|
@@ -387,15 +388,19 @@ function createSourceCandidateStore(options = {}) {
|
|
|
387
388
|
throw error;
|
|
388
389
|
}
|
|
389
390
|
}
|
|
390
|
-
async function
|
|
391
|
-
|
|
391
|
+
async function resolveScanFiles({ entries, explicit, root, outDir }) {
|
|
392
|
+
return (await resolveSourceCandidateScanFiles({
|
|
392
393
|
entries,
|
|
393
394
|
explicit,
|
|
394
395
|
filter: isSourceCandidateRequest,
|
|
395
396
|
outDir,
|
|
396
397
|
root
|
|
397
|
-
});
|
|
398
|
-
|
|
398
|
+
})).map(require_generator.resolveSourceScanPath);
|
|
399
|
+
}
|
|
400
|
+
async function scanRoot(options) {
|
|
401
|
+
const resolvedFiles = await resolveScanFiles(options);
|
|
402
|
+
options.onFilesResolved?.(resolvedFiles);
|
|
403
|
+
await Promise.all(resolvedFiles.map(syncFile));
|
|
399
404
|
}
|
|
400
405
|
function replaceFinal(id, nextCandidates) {
|
|
401
406
|
const normalizedId = cleanUrl(id);
|
|
@@ -581,6 +586,7 @@ function createSourceCandidateStore(options = {}) {
|
|
|
581
586
|
syncFile,
|
|
582
587
|
syncCurrentSource,
|
|
583
588
|
syncCurrentFile,
|
|
589
|
+
resolveScanFiles,
|
|
584
590
|
scanRoot,
|
|
585
591
|
syncInline,
|
|
586
592
|
remove,
|
|
@@ -4842,9 +4848,9 @@ function resolveCompilationDependencies(dependencies) {
|
|
|
4842
4848
|
}));
|
|
4843
4849
|
}
|
|
4844
4850
|
async function executeGeneratorPipeline(context) {
|
|
4845
|
-
return runCompilerOwnerActivity(context.runtimeState, () => executeGeneratorPipelineWithOwner(context));
|
|
4851
|
+
return runCompilerOwnerActivity(context.runtimeState, () => executeGeneratorPipelineWithOwner(context, getCompilationSessionPool(context.runtimeState), getTailwindGenerationSessionPool(context.runtimeState)));
|
|
4846
4852
|
}
|
|
4847
|
-
async function executeGeneratorPipelineWithOwner(context) {
|
|
4853
|
+
async function executeGeneratorPipelineWithOwner(context, compilationPool, generationSession) {
|
|
4848
4854
|
const { cssHandlerOptions, debug, file, generatorBranch, generatorOptions, generatorRawSource, getSourceCandidatesForEntries, hasGeneratedCss, hasGeneratedMarkers, localImports, majorVersion, normalizeGeneratorSource, normalizedCssSources, options, opts, runtime, runtimeState, useMiniProgramCssBranch } = context;
|
|
4849
4855
|
await runtimeState.readyPromise;
|
|
4850
4856
|
const currentCssCandidates = collectGeneratorCssCandidates(generatorRawSource);
|
|
@@ -4867,7 +4873,6 @@ async function executeGeneratorPipelineWithOwner(context) {
|
|
|
4867
4873
|
const generatorStyleOptions = resolveGeneratorStyleOptions(opts, cssHandlerOptions, generatorOptions.styleOptions);
|
|
4868
4874
|
const configuredContainerCompat = hasConfiguredContainerCompatSources(generatorSourceRecords.map((record) => record.source));
|
|
4869
4875
|
const sourceConcurrency = resolveGeneratorSourceConcurrency();
|
|
4870
|
-
const generationSession = getTailwindGenerationSessionPool(runtimeState);
|
|
4871
4876
|
const preparedGenerationInputs = (await runWithConcurrency(generatorSourceRecords.map((record, index) => async () => {
|
|
4872
4877
|
const { metadata: sourceMetadata, source } = record;
|
|
4873
4878
|
const sourceCss = options.deferCssAdaptation ? (0, _weapp_tailwindcss_postcss.removeMatchingLocalCssImports)(source.css, localImports) : source.css;
|
|
@@ -4927,7 +4932,7 @@ async function executeGeneratorPipelineWithOwner(context) {
|
|
|
4927
4932
|
let compilationRevision;
|
|
4928
4933
|
let generated;
|
|
4929
4934
|
if (options.compilation?.enabled) {
|
|
4930
|
-
const execution = await
|
|
4935
|
+
const execution = await compilationPool.run({
|
|
4931
4936
|
scope: options.compilation.scope,
|
|
4932
4937
|
outputId: options.outputFile ?? file,
|
|
4933
4938
|
changes: options.compilation.changes,
|
|
@@ -5183,9 +5188,9 @@ async function generateCssByGenerator(options) {
|
|
|
5183
5188
|
//#endregion
|
|
5184
5189
|
//#region src/bundlers/shared/generator-css/validate.ts
|
|
5185
5190
|
async function validateCandidatesByGenerator(options) {
|
|
5186
|
-
return runCompilerOwnerActivity(options.runtimeState, () => validateCandidatesByGeneratorWithOwner(options));
|
|
5191
|
+
return runCompilerOwnerActivity(options.runtimeState, () => validateCandidatesByGeneratorWithOwner(options, getTailwindGenerationSessionPool(options.runtimeState)));
|
|
5187
5192
|
}
|
|
5188
|
-
async function validateCandidatesByGeneratorWithOwner(options) {
|
|
5193
|
+
async function validateCandidatesByGeneratorWithOwner(options, generationSession) {
|
|
5189
5194
|
const { candidates, cssHandlerOptions, debug, file, opts, rawSource, runtimeState } = options;
|
|
5190
5195
|
const majorVersion = runtimeState.tailwindRuntime.majorVersion;
|
|
5191
5196
|
if (majorVersion !== 4 || candidates.size === 0) return /* @__PURE__ */ new Set();
|
|
@@ -5200,7 +5205,6 @@ async function validateCandidatesByGeneratorWithOwner(options) {
|
|
|
5200
5205
|
cssEntries: opts.cssEntries,
|
|
5201
5206
|
runtime: candidates
|
|
5202
5207
|
});
|
|
5203
|
-
const generationSession = getTailwindGenerationSessionPool(runtimeState);
|
|
5204
5208
|
const classSets = await Promise.all(sourceRecords.map(async ({ source }) => {
|
|
5205
5209
|
return generationSession.validateCandidates(source, candidates);
|
|
5206
5210
|
}));
|