weapp-tailwindcss 5.5.1 → 5.5.2

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.
Files changed (77) hide show
  1. package/dist/bundlers/shared/css-imports.d.ts +1 -0
  2. package/dist/bundlers/shared/framework-user-css.d.ts +3 -0
  3. package/dist/bundlers/shared/generator-css/output-import-shell.d.ts +6 -2
  4. package/dist/bundlers/shared/source-candidates/types-and-cache.d.ts +1 -1
  5. package/dist/bundlers/shared/v4-generation-core.d.ts +1 -0
  6. package/dist/bundlers/vite/frameworks/taro/index.d.ts +2 -1
  7. package/dist/bundlers/vite/generate-bundle/bundle-markup-candidates.d.ts +3 -2
  8. package/dist/bundlers/vite/generate-bundle/css-output-helpers.d.ts +1 -0
  9. package/dist/bundlers/vite/generate-bundle/entry-style-graph.d.ts +6 -0
  10. package/dist/bundlers/vite/generate-bundle/runtime-configured-css.d.ts +1 -0
  11. package/dist/bundlers/vite/serve-js-transform.d.ts +1 -1
  12. package/dist/bundlers/vite/shared/create-framework-plugins.d.ts +2 -0
  13. package/dist/bundlers/vite/shared/framework-module-candidates.d.ts +1 -1
  14. package/dist/bundlers/webpack/loaders/watch-dependencies.d.ts +3 -1
  15. package/dist/bundlers/webpack/shared/loader-anchors.d.ts +1 -0
  16. package/dist/compiler/runtime-snapshot.d.ts +4 -1
  17. package/dist/{compiler-D2ZJc3uA.cjs → compiler-BSMSbVVt.cjs} +6 -6
  18. package/dist/{compiler-B0YSc0DY.js → compiler-tHMcW3BT.js} +3 -3
  19. package/dist/core.cjs +1 -1
  20. package/dist/core.js +1 -1
  21. package/dist/{css-imports-BFMU7Hpd.cjs → css-imports-DsCSPIj2.cjs} +29 -0
  22. package/dist/{css-loader-runtime-CSv0lKqV.cjs → css-loader-runtime-DGqsWVua.cjs} +2 -1
  23. package/dist/{defaults-B5ep0ojb.js → defaults-CKx-4LcW.js} +1 -1
  24. package/dist/{defaults-BI9j1znS.cjs → defaults-CiGsr8Xq.cjs} +1 -1
  25. package/dist/defaults.cjs +1 -1
  26. package/dist/defaults.js +1 -1
  27. package/dist/{generator-DsrQ9txU.cjs → generator-CCw17l0G.cjs} +72 -67
  28. package/dist/{generator-DyXTBPmE.js → generator-DxEsInLz.js} +61 -68
  29. package/dist/generator.cjs +1 -1
  30. package/dist/generator.js +1 -1
  31. package/dist/{gulp-C9ENAx3f.cjs → gulp-C1r36Y_f.cjs} +5 -5
  32. package/dist/{gulp-DXeQfvVC.js → gulp-qGXKwQMZ.js} +4 -4
  33. package/dist/gulp.cjs +1 -1
  34. package/dist/gulp.js +1 -1
  35. package/dist/{hmr-timing-DNxQm-bN.js → hmr-timing-DixZjtTS.js} +245 -183
  36. package/dist/{hmr-timing-Cz4IesEM.cjs → hmr-timing-DuIbach8.cjs} +5 -5
  37. package/dist/index.cjs +4 -4
  38. package/dist/index.js +4 -4
  39. package/dist/{pipeline-helpers-CSGnR5gh.cjs → pipeline-helpers-CUwwOFt3.cjs} +4 -4
  40. package/dist/postcss.cjs +1 -1
  41. package/dist/postcss.js +1 -1
  42. package/dist/presets.cjs +2 -2
  43. package/dist/presets.js +2 -2
  44. package/dist/rspack.cjs +6 -3
  45. package/dist/rspack.js +6 -3
  46. package/dist/{scoped-generator-kRj_5Axx.js → scoped-generator-BJvL2CKZ.js} +3 -3
  47. package/dist/{scoped-generator-TVjEaOeP.cjs → scoped-generator-CO9xZ06m.cjs} +3 -3
  48. package/dist/{source-candidate-scan-signature-CsP4BQNa.js → source-candidate-scan-signature-CgJi--lh.js} +2 -2
  49. package/dist/{source-candidate-scan-signature-B7cUxqqX.cjs → source-candidate-scan-signature-_UPwg8oJ.cjs} +2 -2
  50. package/dist/tailwindcss/v4-engine/css-import.d.ts +14 -0
  51. package/dist/{tailwindcss-BK9S7zuq.js → tailwindcss-D2joPNdN.js} +1 -1
  52. package/dist/{tailwindcss-C-jBBQfw.cjs → tailwindcss-DhaLV5a2.cjs} +1 -1
  53. package/dist/{transform-CfOzh007.js → transform-BNtyKkZi.js} +14 -14
  54. package/dist/{transform-DUPOPZ54.cjs → transform-DAg85t9Z.cjs} +14 -14
  55. package/dist/uni-app-x/border-preflight.d.ts +18 -0
  56. package/dist/uni-app-x/style-asset/source-parser.d.ts +2 -0
  57. package/dist/uni-app-x/transform.d.ts +2 -0
  58. package/dist/uni-app-x/vite/plugin-options.d.ts +2 -0
  59. package/dist/uni-app-x/vite/style-source.d.ts +14 -4
  60. package/dist/{v4-generation-core-CRNUU_Rr.cjs → v4-generation-core-bOm8k4AY.cjs} +243 -181
  61. package/dist/vite/web.cjs +1 -1
  62. package/dist/vite/web.js +1 -1
  63. package/dist/{vite-BXe-axax.js → vite-C_JJxZWl.js} +271 -66
  64. package/dist/{vite-D_mAIfTU.cjs → vite-bJZi1V-l.cjs} +287 -63
  65. package/dist/vite.cjs +1 -1
  66. package/dist/vite.js +1 -1
  67. package/dist/{watch-dependencies-DLZDrWdH.cjs → watch-dependencies-GbC14Rlt.cjs} +14 -11
  68. package/dist/weapp-tw-css-generation-loader.cjs +3 -2
  69. package/dist/weapp-tw-css-import-rewrite-loader.cjs +11 -10
  70. package/dist/weapp-tw-runtime-classset-loader.cjs +16 -11
  71. package/dist/{web-B2Ea9K4B.cjs → web-B4wa3xrE.cjs} +9 -8
  72. package/dist/{web-Cv7ualrU.js → web-BiubXhxs.js} +7 -6
  73. package/dist/{webpack-7Um2GFtx.js → webpack-BDOQUv3J.js} +38 -23
  74. package/dist/{webpack-Ce04-btG.cjs → webpack-CsBe1G_1.cjs} +37 -23
  75. package/dist/webpack.cjs +1 -1
  76. package/dist/webpack.js +1 -1
  77. package/package.json +6 -4
@@ -1,4 +1,5 @@
1
1
  import type { AppType } from '../../types/index.js';
2
+ export declare function normalizeResolvedTailwindcssImports(code: string, pkgDir: string | undefined): string;
2
3
  export interface ResolveTailwindcssImportOptions {
3
4
  join?: ((base: string, subpath: string) => string) | undefined;
4
5
  appType?: AppType | undefined;
@@ -0,0 +1,3 @@
1
+ import type { GenerateCssByGeneratorOptions, GenerateCssByGeneratorResult } from './generator-css.js';
2
+ import type { NormalizedWeappTailwindcssGeneratorOptions } from '../../generator/index.js';
3
+ export declare function restoreFrameworkProcessedUserCss(css: string, generated: GenerateCssByGeneratorResult, source: string, options: GenerateCssByGeneratorOptions, generatorOptions: NormalizedWeappTailwindcssGeneratorOptions): Promise<string>;
@@ -1,4 +1,8 @@
1
- export declare function normalizeMiniProgramImportShell(css: string): string;
1
+ export declare function normalizeMiniProgramImportShell(css: string, output?: {
2
+ outputFile: string;
3
+ outputFiles: Iterable<string>;
4
+ cssOnly?: boolean;
5
+ }): string;
2
6
  export declare function removeSelfMiniProgramOutputImports(css: string, outputFile: string): string;
3
7
  export declare function removeMiniProgramOutputImports(css: string): string;
4
- export declare function normalizeMiniProgramGeneratorCssSource(css: string, outputFile?: string | undefined): string;
8
+ export declare function normalizeMiniProgramGeneratorCssSource(css: string, outputFile?: string | undefined, outputFiles?: Iterable<string>): string;
@@ -6,7 +6,7 @@ export interface SourceCandidateStore {
6
6
  syncSource: (id: string, source: string) => Promise<void>;
7
7
  sync: (id: string, source: string) => Promise<void>;
8
8
  syncCss: (id: string, source: string) => Promise<void>;
9
- syncModuleSource: (id: string, source: string) => Promise<Set<string>>;
9
+ syncModuleSource: (id: string, source: string, extension?: string) => Promise<Set<string>>;
10
10
  merge: (id: string, source: string) => Promise<void>;
11
11
  syncFile: (id: string) => Promise<void>;
12
12
  syncCurrentSource: (id: string, source: string) => Promise<SourceCandidateChange>;
@@ -6,6 +6,7 @@ export interface TailwindV4GenerationCoreInput extends GenerateCssByGeneratorOpt
6
6
  compilationChanges?: CompilationDependencyChange[] | undefined;
7
7
  frameworkPostcssOwner?: InternalUserDefinedOptions | undefined;
8
8
  cssStage?: CssStage | undefined;
9
+ frameworkProcessedUserCss?: string | undefined;
9
10
  outputFile?: string | undefined;
10
11
  onCompilerShadowReport?: ((report: CompilerShadowReport) => void) | undefined;
11
12
  scope?: SourceScope | undefined;
@@ -1,4 +1,5 @@
1
+ import type { Plugin } from 'vite';
1
2
  import type { ViteFrameworkCssPipelineStrategy } from '../../shared/framework-strategy.js';
2
3
  import type { InternalUserDefinedOptions, UserDefinedOptions } from '../../../../types/index.js';
3
4
  export declare const taroCssPipelineStrategy: ViteFrameworkCssPipelineStrategy;
4
- export declare function createTaroVitePlugins(options?: UserDefinedOptions | InternalUserDefinedOptions): any[];
5
+ export declare function createTaroVitePlugins(options?: UserDefinedOptions | InternalUserDefinedOptions): (Plugin<any> | import("../../index.js").WeappTailwindcssVitePlugin)[] | undefined;
@@ -1,10 +1,11 @@
1
1
  import type { BundleSnapshot } from '../bundle-state.js';
2
2
  import type { SourceCandidateFilterOptions } from '../source-candidates.js';
3
3
  import type { createTransformFilter } from './transform-filter.js';
4
+ import type { RuntimeCompilationBuildState } from '../../../compiler/index.js';
4
5
  import type { TailwindSourceEntry } from '../../../tailwindcss/source-scan.js';
5
6
  interface CollectBundleMarkupCandidatesOptions {
6
7
  extractSourceCandidates?: ((file: string, source: string) => Promise<Set<string>>) | undefined;
7
- previousCandidatesByFile?: ReadonlyMap<string, Set<string>> | undefined;
8
+ previousCandidatesByFile?: RuntimeCompilationBuildState['bundleMarkupCandidatesByFile'] | undefined;
8
9
  preserveMissingFiles?: boolean | undefined;
9
10
  resolveSourceCandidateFile: (file: string) => string | undefined;
10
11
  rootDir: string;
@@ -12,7 +13,7 @@ interface CollectBundleMarkupCandidatesOptions {
12
13
  transformFilter: ReturnType<typeof createTransformFilter>;
13
14
  }
14
15
  export interface BundleMarkupCandidateCollection {
15
- candidatesByFile: Map<string, Set<string>>;
16
+ candidatesByFile: RuntimeCompilationBuildState['bundleMarkupCandidatesByFile'];
16
17
  values: Set<string>;
17
18
  valuesForEntries: (entries: TailwindSourceEntry[] | undefined, options?: SourceCandidateFilterOptions) => Set<string>;
18
19
  }
@@ -2,6 +2,7 @@ import type { OutputAsset, OutputChunk } from 'rollup';
2
2
  import type { ViteFrameworkCssPipelineContext, ViteFrameworkCssPipelineStrategy } from '../shared/framework-strategy.js';
3
3
  import type { InternalUserDefinedOptions } from '../../../types/index.js';
4
4
  export declare function resolveCssBundleOutputFile(options: {
5
+ assetOutputFile?: string | undefined;
5
6
  bundleFiles: string[];
6
7
  defaultStyleOutputExtension: string;
7
8
  file: string;
@@ -0,0 +1,6 @@
1
+ import type { OutputBundle } from 'rollup';
2
+ export declare function linkEntryChunkStyles(bundle: OutputBundle, options: {
3
+ matchesCss: (file: string) => boolean;
4
+ resolveOutputFile: (sourceFile: string) => string | undefined;
5
+ onUpdate?: ((file: string, oldVal: string, newVal: string) => void) | undefined;
6
+ }): void;
@@ -21,6 +21,7 @@ export declare function createConfiguredCssSourceRegistry(options: CreateConfigu
21
21
  resolveMatchedSourceOutputFile: (sourceFile: string) => string | undefined;
22
22
  };
23
23
  export interface CreateConfiguredCssRootResolversOptions {
24
+ rootImportShellTargets?: ReadonlyMap<string, string> | undefined;
24
25
  bundle: OutputBundle;
25
26
  bundleFiles: string[];
26
27
  cssPipelineContext: ViteFrameworkCssPipelineContext;
@@ -5,7 +5,7 @@ interface ViteServeJsTransformOptions {
5
5
  getCommand: () => string | undefined;
6
6
  jsHandler: InternalUserDefinedOptions['jsHandler'];
7
7
  shouldTransform: () => boolean;
8
- transformRuntime: () => Promise<Set<string>> | Set<string>;
8
+ transformRuntime: (id: string, source: string) => Promise<Set<string>> | Set<string>;
9
9
  }
10
10
  export declare function createViteServeJsTransformPlugin(options: ViteServeJsTransformOptions): Plugin;
11
11
  export {};
@@ -22,6 +22,8 @@ export interface ViteFrameworkBranchContext {
22
22
  sourceCandidatesBeforeExtraPlugin?: (plugin: Plugin) => boolean;
23
23
  }
24
24
  export interface ViteFrameworkExtraPluginContext {
25
+ cssPreflight: InternalUserDefinedOptions['cssPreflight'];
26
+ cssPreflightRange: InternalUserDefinedOptions['cssPreflightRange'];
25
27
  customAttributesEntities: ReturnType<typeof toCustomAttributesEntities>;
26
28
  disabledDefaultTemplateHandler: boolean | undefined;
27
29
  ensureRuntimeClassSet: (...args: any[]) => Promise<Set<string>>;
@@ -11,5 +11,5 @@ interface FrameworkModuleCandidateRegistrarOptions {
11
11
  sourceCandidateCollector: Pick<SourceCandidateStore, 'syncModuleSource'>;
12
12
  styleHandler: ValidateCandidatesByGeneratorOptions['styleHandler'];
13
13
  }
14
- export declare function createFrameworkModuleCandidateRegistrar(options: FrameworkModuleCandidateRegistrarOptions): (id: string, source: string) => Promise<Set<string>>;
14
+ export declare function createFrameworkModuleCandidateRegistrar(options: FrameworkModuleCandidateRegistrarOptions): (id: string, source: string, extension?: string) => Promise<Set<string>>;
15
15
  export {};
@@ -1,8 +1,10 @@
1
+ import type { Compiler } from 'webpack';
1
2
  interface WebpackWatchDependencyLoaderContext {
3
+ fs?: Pick<NonNullable<Compiler['inputFileSystem']>, 'stat'>;
2
4
  addDependency?: (file: string) => void;
3
5
  addMissingDependency?: (file: string) => void;
4
6
  addContextDependency?: (context: string) => void;
5
7
  }
6
- export declare function registerWebpackWatchFile(loaderContext: WebpackWatchDependencyLoaderContext, file: string): void;
8
+ export declare function registerWebpackWatchFile(loaderContext: WebpackWatchDependencyLoaderContext, file: string): Promise<void> | undefined;
7
9
  export declare function registerWebpackWatchContext(loaderContext: WebpackWatchDependencyLoaderContext, context: string): void;
8
10
  export {};
@@ -1,6 +1,7 @@
1
1
  export interface LoaderEntry {
2
2
  loader?: string;
3
3
  }
4
+ export declare function findCssPreprocessorIndex(entries: LoaderEntry[]): number;
4
5
  export interface LoaderAnchorFinders {
5
6
  findRewriteAnchor: (entries: LoaderEntry[]) => number;
6
7
  findClassSetAnchor: (entries: LoaderEntry[]) => number;
@@ -29,7 +29,10 @@ export interface RuntimeCompilationBuildState {
29
29
  runtimeAffectingHashByFile: Map<string, string>;
30
30
  linkedByEntry: Map<string, Set<string>>;
31
31
  dependentsByLinkedFile: Map<string, Set<string>>;
32
- bundleMarkupCandidatesByFile: Map<string, Set<string>>;
32
+ bundleMarkupCandidatesByFile: Map<string, {
33
+ sourceFile: string;
34
+ candidates: Set<string>;
35
+ }>;
33
36
  generatorCandidateSignature?: string | undefined;
34
37
  }
35
38
  export interface CreateRuntimeCompilationSnapshotOptions {
@@ -1,9 +1,9 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-Ctb5zv51.cjs");
2
2
  const require_framework = require("./framework.cjs");
3
- const require_generator = require("./generator-DsrQ9txU.cjs");
4
- const require_tailwindcss = require("./tailwindcss-C-jBBQfw.cjs");
3
+ const require_generator = require("./generator-CCw17l0G.cjs");
4
+ const require_tailwindcss = require("./tailwindcss-DhaLV5a2.cjs");
5
5
  require("./utils-CuKLf1Zv.cjs");
6
- const require_defaults = require("./defaults-BI9j1znS.cjs");
6
+ const require_defaults = require("./defaults-CiGsr8Xq.cjs");
7
7
  let node_path = require("node:path");
8
8
  node_path = require_rolldown_runtime.__toESM(node_path, 1);
9
9
  let node_process = require("node:process");
@@ -22974,8 +22974,8 @@ var StatementParser = class extends ExpressionParser {
22974
22974
  return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement");
22975
22975
  }
22976
22976
  verifyBreakContinue(node, isBreak) {
22977
- let i;
22978
- for (i = 0; i < this.state.labels.length; ++i) {
22977
+ let i = 0;
22978
+ for (; i < this.state.labels.length; ++i) {
22979
22979
  const lab = this.state.labels[i];
22980
22980
  if (node.label == null || lab.name === node.label.name) {
22981
22981
  if (lab.kind != null && (isBreak || lab.kind === 1)) break;
@@ -40031,7 +40031,7 @@ function toCustomAttributesEntities(customAttributes) {
40031
40031
  return Object.entries(customAttributes);
40032
40032
  }
40033
40033
  //#endregion
40034
- //#region ../../node_modules/.pnpm/oxc-walker@1.1.1_@oxc-project+types@0.148.0_oxc-parser@0.148.0_rolldown@1.2.6/node_modules/oxc-walker/dist/index.mjs
40034
+ //#region ../../node_modules/.pnpm/oxc-walker@1.1.1_@oxc-project+types@0.148.0_oxc-parser@0.148.0_rolldown@1.2.7/node_modules/oxc-walker/dist/index.mjs
40035
40035
  function isNode(v) {
40036
40036
  return v !== null && typeof v === "object" && typeof v.type === "string";
40037
40037
  }
@@ -1,8 +1,8 @@
1
1
  import { resolveMpxPlatform } from "./framework.js";
2
- import { A as resolveBooleanObjectOption, Bt as resolveValidTailwindV4Candidates$1, Ft as resolveCssMacroTailwindV4Source, Mt as _defineProperty, Rt as shouldUseUniAppWebRpxCompatibility, T as omitUndefined, Tt as isFileMatchedByTailwindSourceEntries, a as resolveGeneratorRuntimeBranch, bt as createTailwindV4Engine$1, d as resolveTailwindV4SourceFromRuntime, i as normalizeWeappTailwindcssGeneratorOptions, t as createWeappTailwindcssGenerator, u as resolveTailwindV4Source$1, zt as loadTailwindV4DesignSystem } from "./generator-DyXTBPmE.js";
3
- import { c as getRuntimeClassSetCacheEntry, d as invalidateRuntimeClassSet, i as resolveUniAppXOptions, o as applyV4CssCalcDefaults, s as warnMissingCssEntries, t as createTailwindcssRuntimeFromContext, u as getRuntimeClassSetSignatureWithSources } from "./tailwindcss-BK9S7zuq.js";
2
+ import { A as resolveBooleanObjectOption, Bt as shouldUseUniAppWebRpxCompatibility, Ht as resolveValidTailwindV4Candidates$1, Lt as resolveCssMacroTailwindV4Source, Mt as _defineProperty, T as omitUndefined, Tt as isFileMatchedByTailwindSourceEntries, Vt as loadTailwindV4DesignSystem, a as resolveGeneratorRuntimeBranch, bt as createTailwindV4Engine$1, d as resolveTailwindV4SourceFromRuntime, i as normalizeWeappTailwindcssGeneratorOptions, t as createWeappTailwindcssGenerator, u as resolveTailwindV4Source$1 } from "./generator-DxEsInLz.js";
3
+ import { c as getRuntimeClassSetCacheEntry, d as invalidateRuntimeClassSet, i as resolveUniAppXOptions, o as applyV4CssCalcDefaults, s as warnMissingCssEntries, t as createTailwindcssRuntimeFromContext, u as getRuntimeClassSetSignatureWithSources } from "./tailwindcss-D2joPNdN.js";
4
4
  import { i as isMap, n as defuOverrideArray$1 } from "./utils-MVwpU07P.js";
5
- import { a as DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH, i as resolveDefaultCssPreflight, o as HARD_PARSE_CACHE_MAX_ENTRIES, r as getDefaultOptions } from "./defaults-B5ep0ojb.js";
5
+ import { a as DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH, i as resolveDefaultCssPreflight, o as HARD_PARSE_CACHE_MAX_ENTRIES, r as getDefaultOptions } from "./defaults-CKx-4LcW.js";
6
6
  import { createRequire } from "node:module";
7
7
  import path from "node:path";
8
8
  import process from "node:process";
package/dist/core.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_compiler = require("./compiler-D2ZJc3uA.cjs");
2
+ const require_compiler = require("./compiler-BSMSbVVt.cjs");
3
3
  const require_runtime_state = require("./runtime-state-BBQcA0n5.cjs");
4
4
  let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
5
5
  let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
package/dist/core.js CHANGED
@@ -1,4 +1,4 @@
1
- import { C as createTailwindRuntimeReadyPromise, D as createCompilationEventBus, d as createCompiler, f as getCompilerContext, t as createCompilerRuntimeState, v as shouldSkipJsTransform, w as ensureRuntimeClassSet } from "./compiler-B0YSc0DY.js";
1
+ import { C as createTailwindRuntimeReadyPromise, D as createCompilationEventBus, d as createCompiler, f as getCompilerContext, t as createCompilerRuntimeState, v as shouldSkipJsTransform, w as ensureRuntimeClassSet } from "./compiler-tHMcW3BT.js";
2
2
  import { finalizeMiniProgramCss, finalizeMiniProgramCssRoot, postcss, removeTailwindSourceDirectivesRoot } from "@weapp-tailwindcss/postcss";
3
3
  import { defuOverrideArray } from "@weapp-tailwindcss/shared";
4
4
  //#region src/core.ts
@@ -1,9 +1,32 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-Ctb5zv51.cjs");
2
+ const require_generator = require("./generator-CCw17l0G.cjs");
2
3
  let node_path = require("node:path");
3
4
  node_path = require_rolldown_runtime.__toESM(node_path, 1);
5
+ let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
4
6
  //#region src/bundlers/shared/css-imports.ts
5
7
  const tailwindcssImportRE = /^(?:tailwindcss|weapp-tailwindcss)(?:\/.*)?$/;
6
8
  const tailwindcssCssImportStatementRE = /(@import\s+(?:url\(\s*)?)(["'])((?:tailwindcss|weapp-tailwindcss)(?:\/[^"']*)?\$?)(\2\s*\)?)/gi;
9
+ function normalizeResolvedTailwindcssImports(code, pkgDir) {
10
+ if (!pkgDir) return code;
11
+ const paths = /^[a-z]:[\\/]|^\\\\/i.test(pkgDir) ? node_path.default.win32 : node_path.default.posix;
12
+ const root = _weapp_tailwindcss_postcss.postcss.parse(code);
13
+ let changed = false;
14
+ root.walkAtRules("import", (rule) => {
15
+ const parsed = require_generator.parseCssImportSpecifier(rule.params);
16
+ if (!parsed || !paths.isAbsolute(parsed.specifier)) return;
17
+ const subpath = paths.relative(pkgDir, parsed.specifier);
18
+ if (![
19
+ "index.css",
20
+ "theme.css",
21
+ "utilities.css",
22
+ "preflight.css"
23
+ ].includes(subpath)) return;
24
+ const request = subpath === "index.css" ? "tailwindcss" : `tailwindcss/${subpath}`;
25
+ rule.params = rule.params.replace(parsed.raw, () => require_generator.quoteCssImportSpecifier(request, parsed.quote));
26
+ changed = true;
27
+ });
28
+ return changed ? root.toString() : code;
29
+ }
7
30
  function normalizeTailwindcssSpecifier(specifier) {
8
31
  if (specifier === "tailwindcss$" || specifier === "weapp-tailwindcss$") return specifier.slice(0, -1);
9
32
  return specifier;
@@ -29,6 +52,12 @@ function rewriteTailwindcssImportsInCode(code, pkgDir, options) {
29
52
  return hasReplacements ? rewritten : void 0;
30
53
  }
31
54
  //#endregion
55
+ Object.defineProperty(exports, "normalizeResolvedTailwindcssImports", {
56
+ enumerable: true,
57
+ get: function() {
58
+ return normalizeResolvedTailwindcssImports;
59
+ }
60
+ });
32
61
  Object.defineProperty(exports, "resolveTailwindcssImport", {
33
62
  enumerable: true,
34
63
  get: function() {
@@ -1,6 +1,7 @@
1
1
  //#region src/bundlers/webpack/shared/css-loader-runtime.ts
2
2
  function isWebpackCssLoaderRuntimeSource(source) {
3
- return source.includes("___CSS_LOADER_EXPORT___") && source.includes("___CSS_LOADER_API_IMPORT___") && source.includes("module.exports = ___CSS_LOADER_EXPORT___");
3
+ if (source.trimStart().startsWith("// extracted by mini-css-extract-plugin")) return true;
4
+ return source.includes("___CSS_LOADER_EXPORT___") && source.includes("___CSS_LOADER_API_IMPORT___") && (source.includes("module.exports = ___CSS_LOADER_EXPORT___") || source.includes("export default ___CSS_LOADER_EXPORT___"));
4
5
  }
5
6
  //#endregion
6
7
  Object.defineProperty(exports, "isWebpackCssLoaderRuntimeSource", {
@@ -6,7 +6,7 @@ const HARD_PARSE_CACHE_MAX_ENTRIES = 1024;
6
6
  //#endregion
7
7
  //#region src/defaults.ts
8
8
  const CSS_FILE_PATTERN = /.+\.(?:wx|ac|jx|tt|q|c|ty)ss$/;
9
- const HTML_FILE_PATTERN = /.+\.(?:(?:wx|ax|jx|ks|tt|q|ty|xhs)ml|swan)$/;
9
+ const HTML_FILE_PATTERN = /.+\.(?:(?:wx|ax|jx|ks|tt|q|qx|ty|xhs)ml|swan)$/;
10
10
  const JS_FILE_PATTERN = /.+\.[cm]?js?$/;
11
11
  const alwaysFalse = () => false;
12
12
  const TAILWIND_V4_CSS_PREFLIGHT = {
@@ -7,7 +7,7 @@ const HARD_PARSE_CACHE_MAX_ENTRIES = 1024;
7
7
  //#endregion
8
8
  //#region src/defaults.ts
9
9
  const CSS_FILE_PATTERN = /.+\.(?:wx|ac|jx|tt|q|c|ty)ss$/;
10
- const HTML_FILE_PATTERN = /.+\.(?:(?:wx|ax|jx|ks|tt|q|ty|xhs)ml|swan)$/;
10
+ const HTML_FILE_PATTERN = /.+\.(?:(?:wx|ax|jx|ks|tt|q|qx|ty|xhs)ml|swan)$/;
11
11
  const JS_FILE_PATTERN = /.+\.[cm]?js?$/;
12
12
  const alwaysFalse = () => false;
13
13
  const TAILWIND_V4_CSS_PREFLIGHT = {
package/dist/defaults.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_defaults = require("./defaults-BI9j1znS.cjs");
2
+ const require_defaults = require("./defaults-CiGsr8Xq.cjs");
3
3
  exports.TAILWIND_V4_CSS_PREFLIGHT = require_defaults.TAILWIND_V4_CSS_PREFLIGHT;
4
4
  exports.getDefaultCssPreflight = require_defaults.getDefaultCssPreflight;
5
5
  exports.getDefaultOptions = require_defaults.getDefaultOptions;
package/dist/defaults.js CHANGED
@@ -1,2 +1,2 @@
1
- import { i as resolveDefaultCssPreflight, n as getDefaultCssPreflight, r as getDefaultOptions, t as TAILWIND_V4_CSS_PREFLIGHT } from "./defaults-B5ep0ojb.js";
1
+ import { i as resolveDefaultCssPreflight, n as getDefaultCssPreflight, r as getDefaultOptions, t as TAILWIND_V4_CSS_PREFLIGHT } from "./defaults-CKx-4LcW.js";
2
2
  export { TAILWIND_V4_CSS_PREFLIGHT, getDefaultCssPreflight, getDefaultOptions, resolveDefaultCssPreflight };
@@ -12,6 +12,7 @@ let _tailwindcss_mangle_engine = require("@tailwindcss-mangle/engine");
12
12
  let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
13
13
  let lru_cache = require("lru-cache");
14
14
  let node_module = require("node:module");
15
+ let _csstools_css_tokenizer = require("@csstools/css-tokenizer");
15
16
  let node_fs_promises = require("node:fs/promises");
16
17
  let micromatch = require("micromatch");
17
18
  micromatch = require_rolldown_runtime.__toESM(micromatch, 1);
@@ -341,6 +342,47 @@ async function transformTailwindV4CssByTarget(css, target, options) {
341
342
  return shouldUseUniAppWebRpxCompatibility(options?.appType) ? transformTailwindV4WebRpxCss(resolvedWebCss) : resolvedWebCss;
342
343
  }
343
344
  //#endregion
345
+ //#region src/tailwindcss/v4-engine/css-import.ts
346
+ function parseCssImportSpecifier(params) {
347
+ const tokens = (0, _csstools_css_tokenizer.tokenize)({ css: params }).filter((token) => token[0] !== _csstools_css_tokenizer.TokenType.Whitespace && token[0] !== _csstools_css_tokenizer.TokenType.Comment);
348
+ const first = tokens[0];
349
+ if (!first) return;
350
+ if (first[0] === _csstools_css_tokenizer.TokenType.String || first[0] === _csstools_css_tokenizer.TokenType.URL) return {
351
+ specifier: first[4].value,
352
+ raw: first[1],
353
+ quote: first[0] === _csstools_css_tokenizer.TokenType.String ? first[1][0] : void 0
354
+ };
355
+ if (first[0] === _csstools_css_tokenizer.TokenType.Function && first[4].value.toLowerCase() === "url" && tokens[1]?.[0] === _csstools_css_tokenizer.TokenType.String && tokens[2]?.[0] === _csstools_css_tokenizer.TokenType.CloseParen) return {
356
+ specifier: tokens[1][4].value,
357
+ raw: params.slice(first[2], tokens[2][3] + 1),
358
+ quote: tokens[1][1][0]
359
+ };
360
+ }
361
+ function quoteCssImportSpecifier(file, quote = "\"") {
362
+ return `${quote}${(node_path.default.sep === "\\" || /^[a-z]:[\\/]|^\\\\/i.test(file) ? file.replaceAll("\\", "/") : file).replaceAll("\\", "\\\\").replaceAll(quote, `\\${quote}`).replaceAll("\n", "\\a ").replaceAll("\r", "\\d ")}${quote}`;
363
+ }
364
+ function isTailwindCssImport(params) {
365
+ const specifier = parseCssImportSpecifier(params)?.specifier;
366
+ if (!specifier) return false;
367
+ if (specifier === "tailwindcss" || specifier.startsWith("tailwindcss/")) return true;
368
+ const paths = specifier.includes("\\") ? node_path.default.win32 : node_path.default.posix;
369
+ return paths.basename(specifier) === "index.css" && paths.basename(paths.dirname(specifier)) === "tailwindcss";
370
+ }
371
+ function parseImportSourceParam(params) {
372
+ const tokens = (0, _csstools_css_tokenizer.tokenize)({ css: params }).filter((token) => token[0] !== _csstools_css_tokenizer.TokenType.Whitespace && token[0] !== _csstools_css_tokenizer.TokenType.Comment);
373
+ const index = tokens.findIndex((token) => token[0] === _csstools_css_tokenizer.TokenType.Function && token[4].value === "source");
374
+ const value = tokens[index + 1];
375
+ if (index < 0 || tokens[index + 2]?.[0] !== _csstools_css_tokenizer.TokenType.CloseParen) return;
376
+ if (value?.[0] === _csstools_css_tokenizer.TokenType.Ident && value[4].value === "none") return {
377
+ none: true,
378
+ sourcePath: void 0
379
+ };
380
+ return value?.[0] === _csstools_css_tokenizer.TokenType.String ? {
381
+ none: false,
382
+ sourcePath: value[4].value
383
+ } : void 0;
384
+ }
385
+ //#endregion
344
386
  //#region src/tailwindcss/v4-engine/tailwind-v4-default-colors.ts
345
387
  const TAILWIND_V4_COLOR_STEPS = [
346
388
  "50",
@@ -730,7 +772,7 @@ function resolveTailwindV4ThemeCssFromImport(css) {
730
772
  let resolved;
731
773
  root.walkAtRules("import", (rule) => {
732
774
  if (resolved) return;
733
- const specifier = parseCssImportSpecifier$2(rule.params);
775
+ const specifier = parseCssImportSpecifier(rule.params)?.specifier;
734
776
  if (!specifier || !node_path.default.isAbsolute(specifier) || node_path.default.basename(specifier) !== "index.css") return;
735
777
  const themeCss = node_path.default.join(node_path.default.dirname(specifier), "theme.css");
736
778
  if ((0, node_fs.existsSync)(themeCss)) resolved = themeCss;
@@ -762,15 +804,8 @@ function applyMiniProgramTailwindV4DefaultColorCss(css, source) {
762
804
  if (insertionIndex === 0) return `${themeCss}\n${css}`;
763
805
  return `${css.slice(0, insertionIndex)}\n${themeCss}\n${css.slice(insertionIndex)}`;
764
806
  }
765
- function parseCssImportSpecifier$2(params) {
766
- const value = params.trim();
767
- const quoted = /^(['"])(.*?)\1/.exec(value);
768
- if (quoted) return quoted[2];
769
- const url = /^url\(\s*(?:(['"])(.*?)\1|([^'")\s]+))\s*\)/.exec(value);
770
- return url?.[2] ?? url?.[3];
771
- }
772
807
  function isTailwindCssPreflightImport(params) {
773
- const specifier = parseCssImportSpecifier$2(params);
808
+ const specifier = parseCssImportSpecifier(params)?.specifier;
774
809
  return specifier === "tailwindcss/preflight.css" || specifier === "tailwindcss/preflight";
775
810
  }
776
811
  function removeTailwindV4PreflightImports(css) {
@@ -827,7 +862,7 @@ function createCompatibleSource(source, target) {
827
862
  };
828
863
  }
829
864
  //#endregion
830
- //#region \0@oxc-project+runtime@0.147.0/helpers/esm/typeof.js
865
+ //#region \0@oxc-project+runtime@0.148.0/helpers/esm/typeof.js
831
866
  function _typeof(o) {
832
867
  "@babel/helpers - typeof";
833
868
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -837,7 +872,7 @@ function _typeof(o) {
837
872
  }, _typeof(o);
838
873
  }
839
874
  //#endregion
840
- //#region \0@oxc-project+runtime@0.147.0/helpers/esm/toPrimitive.js
875
+ //#region \0@oxc-project+runtime@0.148.0/helpers/esm/toPrimitive.js
841
876
  function toPrimitive(t, r) {
842
877
  if ("object" != _typeof(t) || !t) return t;
843
878
  var e = t[Symbol.toPrimitive];
@@ -849,13 +884,13 @@ function toPrimitive(t, r) {
849
884
  return ("string" === r ? String : Number)(t);
850
885
  }
851
886
  //#endregion
852
- //#region \0@oxc-project+runtime@0.147.0/helpers/esm/toPropertyKey.js
887
+ //#region \0@oxc-project+runtime@0.148.0/helpers/esm/toPropertyKey.js
853
888
  function toPropertyKey(t) {
854
889
  var i = toPrimitive(t, "string");
855
890
  return "symbol" == _typeof(i) ? i : i + "";
856
891
  }
857
892
  //#endregion
858
- //#region \0@oxc-project+runtime@0.147.0/helpers/esm/defineProperty.js
893
+ //#region \0@oxc-project+runtime@0.148.0/helpers/esm/defineProperty.js
859
894
  function _defineProperty(e, r, t) {
860
895
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
861
896
  value: t,
@@ -923,6 +958,7 @@ const DEFAULT_SOURCE_SCAN_EXTENSIONS = [
923
958
  "ksml",
924
959
  "ttml",
925
960
  "qml",
961
+ "qxml",
926
962
  "tyml",
927
963
  "xhsml",
928
964
  "swan",
@@ -954,6 +990,7 @@ const FULL_SOURCE_SCAN_EXTENSIONS = [
954
990
  "ksml",
955
991
  "ttml",
956
992
  "qml",
993
+ "qxml",
957
994
  "tyml",
958
995
  "xhsml",
959
996
  "swan",
@@ -979,19 +1016,19 @@ function toPosixPath(value) {
979
1016
  return value.split(node_path.default.sep).join("/").split(node_path.default.win32.sep).join("/");
980
1017
  }
981
1018
  function resolveSourceScanPath(value) {
982
- const resolved = node_path.default.resolve(value);
983
- try {
984
- return node_fs.realpathSync.native(resolved);
985
- } catch {
986
- return resolved;
987
- }
1019
+ return resolveSourceScanPathWithApi(value, node_path.default);
988
1020
  }
989
1021
  function resolveSourceScanPathWithApi(value, pathApi) {
990
1022
  const resolved = pathApi.resolve(value);
991
- try {
992
- return node_fs.realpathSync.native(resolved);
993
- } catch {
994
- return resolved;
1023
+ let current = resolved;
1024
+ const missing = [];
1025
+ while (true) try {
1026
+ return pathApi.join(node_fs.realpathSync.native(current), ...missing.reverse());
1027
+ } catch (error) {
1028
+ const parent = pathApi.dirname(current);
1029
+ if (error.code !== "ENOENT" || parent === current) return resolved;
1030
+ missing.push(pathApi.basename(current));
1031
+ current = parent;
995
1032
  }
996
1033
  }
997
1034
  function normalizeEntryPattern(entry) {
@@ -1208,25 +1245,6 @@ const TAILWIND_V4_DEFAULT_IGNORED_SOURCE_PATTERNS = [
1208
1245
  "**/.env",
1209
1246
  "**/.env.*"
1210
1247
  ];
1211
- function parseImportSourceParam(params) {
1212
- const match = /\bsource\(\s*(none|(['"])(.*?)\2)\s*\)/.exec(params);
1213
- if (!match) return;
1214
- return {
1215
- none: match[1] === "none",
1216
- sourcePath: match[3]
1217
- };
1218
- }
1219
- function parseCssImportSpecifier$1(params) {
1220
- const value = params.trim();
1221
- const quoted = /^(['"])(.*?)\1/.exec(value);
1222
- if (quoted) return quoted[2];
1223
- const url = /^url\(\s*(?:(['"])(.*?)\1|([^'")\s]+))\s*\)/.exec(value);
1224
- return url?.[2] ?? url?.[3];
1225
- }
1226
- function isTailwindCssImport(params) {
1227
- const specifier = parseCssImportSpecifier$1(params);
1228
- return specifier === "tailwindcss" || specifier?.startsWith("tailwindcss/") || specifier?.replaceAll("\\", "/").endsWith("/tailwindcss/index.css");
1229
- }
1230
1248
  function resolveSourceBase(base, sourcePath) {
1231
1249
  return node_path.default.isAbsolute(sourcePath) ? sourcePath : node_path.default.resolve(base, sourcePath);
1232
1250
  }
@@ -2968,31 +2986,6 @@ function isBarePackageSpecifier(specifier) {
2968
2986
  function isPackageJsonImportSpecifier(specifier) {
2969
2987
  return typeof specifier === "string" && specifier.startsWith("#");
2970
2988
  }
2971
- function parseCssImportSpecifier(params) {
2972
- const value = params.trim();
2973
- const quoted = /^(['"])(.*?)\1/.exec(value);
2974
- if (quoted) {
2975
- const specifier = quoted[2];
2976
- if (specifier === void 0) return;
2977
- return {
2978
- quote: quoted[1],
2979
- raw: quoted[0],
2980
- specifier
2981
- };
2982
- }
2983
- const url = /^url\(\s*(?:(['"])(.*?)\1|([^'")\s]+))\s*\)/.exec(value);
2984
- if (!url) return;
2985
- const specifier = url[2] ?? url[3];
2986
- if (specifier === void 0) return;
2987
- return {
2988
- quote: url[1],
2989
- raw: url[0],
2990
- specifier
2991
- };
2992
- }
2993
- function quoteCssImportSpecifier(specifier, quote = "\"") {
2994
- return `${quote}${specifier.replaceAll("\\", "\\\\").replaceAll(quote, `\\${quote}`)}${quote}`;
2995
- }
2996
2989
  function createTailwindV4CssImportSpecifierSet(packageName) {
2997
2990
  const specifiers = /* @__PURE__ */ new Set(["tailwindcss"]);
2998
2991
  if (packageName && isBarePackageSpecifier(packageName)) specifiers.add(packageName);
@@ -3574,6 +3567,12 @@ Object.defineProperty(exports, "parseConfigParam", {
3574
3567
  return parseConfigParam;
3575
3568
  }
3576
3569
  });
3570
+ Object.defineProperty(exports, "parseCssImportSpecifier", {
3571
+ enumerable: true,
3572
+ get: function() {
3573
+ return parseCssImportSpecifier;
3574
+ }
3575
+ });
3577
3576
  Object.defineProperty(exports, "parseImportRequest", {
3578
3577
  enumerable: true,
3579
3578
  get: function() {
@@ -3592,6 +3591,12 @@ Object.defineProperty(exports, "prependConfigDirective", {
3592
3591
  return prependConfigDirective;
3593
3592
  }
3594
3593
  });
3594
+ Object.defineProperty(exports, "quoteCssImportSpecifier", {
3595
+ enumerable: true,
3596
+ get: function() {
3597
+ return quoteCssImportSpecifier;
3598
+ }
3599
+ });
3595
3600
  Object.defineProperty(exports, "removeMiniProgramInteractiveSelectors", {
3596
3601
  enumerable: true,
3597
3602
  get: function() {