weapp-tailwindcss 5.0.0-next.3 → 5.0.0-next.30

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 (243) hide show
  1. package/README.md +6 -7
  2. package/bin/weapp-tailwindcss.js +1 -21
  3. package/dist/auto-TH1jG2UW.js +115 -0
  4. package/dist/auto-XyKTOP7B.mjs +78 -0
  5. package/dist/bundle-state-Bi-cQua6.mjs +413 -0
  6. package/dist/bundle-state-Ct_8GcSR.js +529 -0
  7. package/dist/bundlers/shared/cache.d.ts +6 -6
  8. package/dist/bundlers/shared/css-cleanup/at-rules.d.ts +1 -0
  9. package/dist/bundlers/shared/css-cleanup.d.ts +1 -4
  10. package/dist/bundlers/shared/css-imports.d.ts +3 -3
  11. package/dist/bundlers/shared/generated-css-marker.d.ts +3 -0
  12. package/dist/bundlers/shared/generator-css/config-directive.d.ts +2 -0
  13. package/dist/bundlers/shared/generator-css/directives.d.ts +20 -0
  14. package/dist/bundlers/shared/generator-css/legacy-compat.d.ts +7 -0
  15. package/dist/bundlers/shared/generator-css/legacy-selectors.d.ts +5 -0
  16. package/dist/bundlers/shared/generator-css/legacy-units.d.ts +1 -0
  17. package/dist/bundlers/shared/generator-css/markers.d.ts +28 -0
  18. package/dist/bundlers/shared/generator-css/source-files.d.ts +14 -0
  19. package/dist/bundlers/shared/generator-css/source-resolver.d.ts +24 -0
  20. package/dist/bundlers/shared/generator-css.d.ts +16 -22
  21. package/dist/bundlers/shared/hmr-timing.d.ts +22 -0
  22. package/dist/bundlers/shared/style-requests.d.ts +2 -0
  23. package/dist/bundlers/vite/bundle-state.d.ts +1 -0
  24. package/dist/bundlers/vite/css-finalizer.d.ts +7 -1
  25. package/dist/bundlers/vite/generate-bundle/candidates.d.ts +2 -0
  26. package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +24 -0
  27. package/dist/bundlers/vite/generate-bundle/css-share-scope.d.ts +4 -0
  28. package/dist/bundlers/vite/generate-bundle/dirty-state.d.ts +1 -0
  29. package/dist/bundlers/vite/generate-bundle/js-entries.d.ts +2 -0
  30. package/dist/bundlers/vite/generate-bundle/js-handler-options.d.ts +8 -0
  31. package/dist/bundlers/vite/generate-bundle/js-linking.d.ts +13 -0
  32. package/dist/bundlers/vite/generate-bundle/metrics.d.ts +17 -0
  33. package/dist/bundlers/vite/generate-bundle/process-plan.d.ts +9 -0
  34. package/dist/bundlers/vite/generate-bundle/rollup-assets.d.ts +7 -0
  35. package/dist/bundlers/vite/generate-bundle/signatures.d.ts +8 -0
  36. package/dist/bundlers/vite/generate-bundle.d.ts +14 -2
  37. package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +5 -1
  38. package/dist/bundlers/vite/index.d.ts +5 -2
  39. package/dist/bundlers/vite/official-tailwind-plugins.d.ts +5 -0
  40. package/dist/bundlers/vite/postcss-config.d.ts +6 -0
  41. package/dist/bundlers/vite/processed-css-assets.d.ts +32 -0
  42. package/dist/bundlers/vite/rewrite-css-imports.d.ts +8 -3
  43. package/dist/bundlers/vite/runtime-class-set.d.ts +25 -0
  44. package/dist/bundlers/vite/serve-css-generation.d.ts +11 -0
  45. package/dist/bundlers/vite/source-candidates.d.ts +19 -1
  46. package/dist/bundlers/vite/source-scan.d.ts +26 -0
  47. package/dist/bundlers/vite/static-config-content.d.ts +5 -0
  48. package/dist/bundlers/vite/tailwind-basedir.d.ts +1 -0
  49. package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +6 -0
  50. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +6 -2
  51. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +9 -3
  52. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +2 -1
  53. package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +31 -0
  54. package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +2 -6
  55. package/dist/bundlers/webpack/loaders/weapp-tw-runtime-classset-loader.d.ts +3 -7
  56. package/dist/cache/index.d.ts +6 -6
  57. package/dist/{chunk-8l464Juk.js → chunk-C5U5_Hdc.js} +14 -0
  58. package/dist/cli/context.d.ts +1 -14
  59. package/dist/cli/doctor/types.d.ts +11 -11
  60. package/dist/cli/helpers.d.ts +1 -2
  61. package/dist/cli/mount-options.d.ts +2 -0
  62. package/dist/cli/types.d.ts +0 -2
  63. package/dist/cli/vscode-entry.d.ts +3 -3
  64. package/dist/cli.js +758 -604
  65. package/dist/cli.mjs +766 -612
  66. package/dist/constants.d.ts +1 -2
  67. package/dist/context/runtime-package-replacements.d.ts +2 -0
  68. package/dist/context/style-options.d.ts +3 -0
  69. package/dist/core.js +12 -20
  70. package/dist/core.mjs +8 -14
  71. package/dist/css-macro/auto.d.ts +10 -0
  72. package/dist/css-macro/constants.d.ts +5 -2
  73. package/dist/css-macro/postcss.d.ts +1 -0
  74. package/dist/css-macro/postcss.js +7 -46
  75. package/dist/css-macro/postcss.mjs +2 -46
  76. package/dist/css-macro.d.ts +1 -0
  77. package/dist/css-macro.js +16 -7
  78. package/dist/css-macro.mjs +15 -6
  79. package/dist/defaults-8xrgzxFY.mjs +151 -0
  80. package/dist/defaults-zKUH2mDe.js +193 -0
  81. package/dist/defaults.d.ts +15 -1
  82. package/dist/defaults.js +6 -131
  83. package/dist/defaults.mjs +2 -129
  84. package/dist/escape.js +10 -2
  85. package/dist/escape.mjs +10 -2
  86. package/dist/generator/index.d.ts +1 -1
  87. package/dist/generator/options.d.ts +9 -8
  88. package/dist/generator/types.d.ts +3 -3
  89. package/dist/generator-CrU-Ghc1.js +90 -0
  90. package/dist/generator-Qw-tZ0Z2.mjs +65 -0
  91. package/dist/generator.js +12 -12
  92. package/dist/generator.mjs +2 -1
  93. package/dist/gulp.js +187 -48
  94. package/dist/gulp.mjs +180 -41
  95. package/dist/incremental-runtime-class-set-BdZHkoTs.mjs +1975 -0
  96. package/dist/incremental-runtime-class-set-BxvZONkv.js +2038 -0
  97. package/dist/index.d.ts +3 -2
  98. package/dist/index.js +19 -7
  99. package/dist/index.mjs +6 -5
  100. package/dist/js/babel/cache-options.d.ts +3 -0
  101. package/dist/js/babel/parse.d.ts +7 -4
  102. package/dist/js/index.d.ts +1 -0
  103. package/dist/js/literal-transform.d.ts +2 -0
  104. package/dist/js/precheck.d.ts +2 -2
  105. package/dist/logger-BNzxZbZj.mjs +2 -0
  106. package/dist/logger-TlKT3xmR.js +1 -0
  107. package/dist/postcss/config-directive.d.ts +1 -0
  108. package/dist/postcss/context.d.ts +9 -0
  109. package/dist/postcss/source-files.d.ts +8 -0
  110. package/dist/postcss/tailwind-version.d.ts +3 -0
  111. package/dist/postcss-C6zOQqlL.mjs +228 -0
  112. package/dist/postcss-C7BMYpEF.mjs +169 -0
  113. package/dist/postcss-CiYLsqZn.js +192 -0
  114. package/dist/postcss-DAWf9D3C.js +237 -0
  115. package/dist/postcss-html-transform.js +1 -1
  116. package/dist/postcss.d.ts +2 -2
  117. package/dist/postcss.js +3 -276
  118. package/dist/postcss.mjs +1 -269
  119. package/dist/precheck-D7K12zeX.mjs +4716 -0
  120. package/dist/precheck-D7gJSmJz.js +4842 -0
  121. package/dist/presets/index.d.ts +1 -0
  122. package/dist/presets/uni-app-x.d.ts +1 -0
  123. package/dist/presets.js +29 -13
  124. package/dist/presets.mjs +25 -11
  125. package/dist/reset.d.ts +1 -0
  126. package/dist/reset.js +1 -1
  127. package/dist/runtime-registry-DpcR3IHI.js +5496 -0
  128. package/dist/shared/mpx.d.ts +1 -0
  129. package/dist/source-candidates-CX2ozpKM.mjs +322 -0
  130. package/dist/source-candidates-DNM8iwXW.js +335 -0
  131. package/dist/tailwindcss/miniprogram.d.ts +1 -1
  132. package/dist/tailwindcss/patcher-options.d.ts +3 -51
  133. package/dist/tailwindcss/patcher.d.ts +1 -2
  134. package/dist/tailwindcss/remove-unsupported-css.d.ts +1 -2
  135. package/dist/tailwindcss/runtime/cache.d.ts +4 -3
  136. package/dist/tailwindcss/runtime-patch.d.ts +5 -0
  137. package/dist/tailwindcss/runtime.d.ts +11 -12
  138. package/dist/tailwindcss/source-scan.d.ts +35 -0
  139. package/dist/tailwindcss/targets.d.ts +1 -5
  140. package/dist/tailwindcss/v3-engine/types.d.ts +17 -14
  141. package/dist/tailwindcss/v4/css-entries.d.ts +2 -2
  142. package/dist/tailwindcss/v4/css-sources.d.ts +5 -0
  143. package/dist/tailwindcss/v4/patcher-options.d.ts +1 -23
  144. package/dist/tailwindcss/v4/patcher.d.ts +1 -0
  145. package/dist/tailwindcss/v4-engine/source.d.ts +2 -2
  146. package/dist/tailwindcss/v4-engine/types.d.ts +17 -5
  147. package/dist/tailwindcss/version.d.ts +4 -0
  148. package/dist/tailwindcss-B-e2RiXr.js +642 -0
  149. package/dist/tailwindcss-C7dJHZ0G.mjs +591 -0
  150. package/dist/typedoc.export.d.ts +0 -2
  151. package/dist/types/index.d.ts +52 -49
  152. package/dist/types/shared.d.ts +6 -0
  153. package/dist/types/user-defined-options/general.d.ts +25 -24
  154. package/dist/types/user-defined-options/important.d.ts +33 -28
  155. package/dist/types/user-defined-options/lifecycle.d.ts +4 -4
  156. package/dist/types/user-defined-options/matcher.d.ts +6 -6
  157. package/dist/uni-app-x/vite.d.ts +1 -1
  158. package/dist/unocss/index.d.ts +2 -0
  159. package/dist/utils/disabled.d.ts +2 -3
  160. package/dist/utils/object.d.ts +9 -0
  161. package/dist/utils/options.d.ts +2 -0
  162. package/dist/utils/regex.d.ts +1 -0
  163. package/dist/{utils-DmC9_In3.js → utils-D7Ygohep.js} +2 -2
  164. package/dist/{utils-7DUGTFED.mjs → utils-DsaS975I.mjs} +1 -1
  165. package/dist/v3-engine-CHItlVq5.js +3616 -0
  166. package/dist/v3-engine-DcvCCHfs.mjs +3321 -0
  167. package/dist/vite-C65DdWEj.js +24439 -0
  168. package/dist/vite-rmL1rsA_.mjs +24425 -0
  169. package/dist/vite.d.ts +1 -2
  170. package/dist/vite.js +3 -4
  171. package/dist/vite.mjs +2 -2
  172. package/dist/weapp-tw-css-import-rewrite-loader.js +5032 -18
  173. package/dist/weapp-tw-runtime-classset-loader.js +32 -9
  174. package/dist/webpack-BU2Er4qg.mjs +841 -0
  175. package/dist/webpack-CqGvjvSQ.js +851 -0
  176. package/dist/webpack.d.ts +1 -3
  177. package/dist/webpack.js +3 -4
  178. package/dist/webpack.mjs +2 -2
  179. package/package.json +38 -48
  180. package/dist/bundlers/shared/generator-candidates.d.ts +0 -5
  181. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-assets.d.ts +0 -14
  182. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-loaders.d.ts +0 -15
  183. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4.d.ts +0 -9
  184. package/dist/bundlers/webpack/shared/css-imports.d.ts +0 -6
  185. package/dist/cli/config.d.ts +0 -5
  186. package/dist/cli/helpers/patch-cwd.d.ts +0 -1
  187. package/dist/cli/mount-options/patch-status.d.ts +0 -2
  188. package/dist/cli/patch-options.d.ts +0 -6
  189. package/dist/cli/tokens.d.ts +0 -4
  190. package/dist/cli/workspace/package-dirs.d.ts +0 -3
  191. package/dist/cli/workspace/patch-package.d.ts +0 -3
  192. package/dist/cli/workspace/patch-utils.d.ts +0 -3
  193. package/dist/cli/workspace/types.d.ts +0 -11
  194. package/dist/cli/workspace/workspace-globs.d.ts +0 -2
  195. package/dist/cli/workspace/workspace-io.d.ts +0 -1
  196. package/dist/cli/workspace/workspace-lock.d.ts +0 -1
  197. package/dist/cli/workspace.d.ts +0 -2
  198. package/dist/constants-B-_T5UnW.mjs +0 -44
  199. package/dist/constants-p1dyh1x1.js +0 -73
  200. package/dist/css-imports-BbrbluP9.js +0 -177
  201. package/dist/css-imports-CSdPq_Sc.mjs +0 -128
  202. package/dist/experimental/index.d.ts +0 -2
  203. package/dist/experimental/oxc/ast-utils.d.ts +0 -30
  204. package/dist/experimental/oxc/index.d.ts +0 -2
  205. package/dist/experimental/oxc/module-specifiers.d.ts +0 -2
  206. package/dist/experimental/shared/cache.d.ts +0 -3
  207. package/dist/experimental/shared/transform.d.ts +0 -3
  208. package/dist/experimental/shared.d.ts +0 -8
  209. package/dist/experimental/swc/ast-utils.d.ts +0 -30
  210. package/dist/experimental/swc/index.d.ts +0 -2
  211. package/dist/experimental/swc/module-specifiers.d.ts +0 -2
  212. package/dist/generator-Y-Ikv4Fu.mjs +0 -1177
  213. package/dist/generator-css-Bwy_Uz89.mjs +0 -1097
  214. package/dist/generator-css-CRLrHW4F.js +0 -1124
  215. package/dist/generator-mmhXzZnv.js +0 -1276
  216. package/dist/js/syntax.d.ts +0 -10
  217. package/dist/lightningcss/index.d.ts +0 -8
  218. package/dist/lightningcss/style-handler/options.d.ts +0 -3
  219. package/dist/lightningcss/style-handler/selector-transform.d.ts +0 -10
  220. package/dist/lightningcss/style-handler/selector-utils.d.ts +0 -10
  221. package/dist/lightningcss/style-handler.d.ts +0 -17
  222. package/dist/loader-anchors-1MumTAtA.mjs +0 -205
  223. package/dist/loader-anchors-TrFvT6g1.js +0 -273
  224. package/dist/logger-BZ45DZJT.js +0 -1003
  225. package/dist/logger-BoVx1Dbt.mjs +0 -935
  226. package/dist/patcher-options-6gJN2EXy.js +0 -115
  227. package/dist/patcher-options-DQfR5xxT.mjs +0 -92
  228. package/dist/recorder-GdTJ3QqX.js +0 -2878
  229. package/dist/recorder-XdFvVASS.mjs +0 -2763
  230. package/dist/tailwindcss/recorder.d.ts +0 -13
  231. package/dist/tailwindcss/targets/paths.d.ts +0 -13
  232. package/dist/tailwindcss/targets/record-io.d.ts +0 -5
  233. package/dist/tailwindcss/targets/recorder.d.ts +0 -3
  234. package/dist/tailwindcss/targets/types.d.ts +0 -35
  235. package/dist/types/disabled-options.d.ts +0 -4
  236. package/dist/vite-BDywuCjn.mjs +0 -2186
  237. package/dist/vite-DgRh_GXn.js +0 -2199
  238. package/dist/webpack-CAJR4hhP.js +0 -456
  239. package/dist/webpack-CiHqVZTg.mjs +0 -441
  240. package/dist/webpack4.d.ts +0 -4
  241. package/dist/webpack4.js +0 -387
  242. package/dist/webpack4.mjs +0 -379
  243. package/scripts/postinstall.mjs +0 -59
@@ -1,10 +0,0 @@
1
- export interface DetectSyntaxOptions {
2
- stripComments?: boolean;
3
- }
4
- export declare function hasESMSyntax(code: string, opts?: DetectSyntaxOptions): boolean;
5
- export declare function hasCJSSyntax(code: string, opts?: DetectSyntaxOptions): boolean;
6
- export declare function detectSyntax(code: string, opts?: DetectSyntaxOptions): {
7
- hasESM: boolean;
8
- hasCJS: boolean;
9
- isMixed: boolean;
10
- };
@@ -1,8 +0,0 @@
1
- import { Buffer } from 'node:buffer';
2
- import { createLightningcssStyleHandler } from './style-handler';
3
- export { createLightningcssStyleHandler };
4
- export declare function transformCss(css?: string | Buffer): Promise<{
5
- code: Buffer<ArrayBuffer>;
6
- map: Buffer<ArrayBuffer> | undefined;
7
- warnings: import("lightningcss").Warning[];
8
- }>;
@@ -1,3 +0,0 @@
1
- import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss';
2
- export declare function createRootSpecificityReplacer(options: IStyleHandlerOptions): ((code: string) => string) | undefined;
3
- export declare function prepareStyleOptions(options?: Partial<IStyleHandlerOptions>): IStyleHandlerOptions;
@@ -1,10 +0,0 @@
1
- import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss';
2
- import type { SelectorComponent } from 'lightningcss';
3
- type CustomAtRules = Record<string, never>;
4
- export interface SelectorTransformContext {
5
- options: IStyleHandlerOptions;
6
- childCombinatorReplacement?: SelectorComponent[];
7
- }
8
- export declare function buildChildCombinatorReplacement(options: IStyleHandlerOptions): SelectorComponent[] | undefined;
9
- export declare function createVisitor(ctx: SelectorTransformContext): import("lightningcss").Visitor<CustomAtRules>;
10
- export {};
@@ -1,10 +0,0 @@
1
- import type { Selector, SelectorComponent } from 'lightningcss';
2
- export declare function createTypeSelector(name: string): SelectorComponent;
3
- export declare function cloneComponent<T>(value: T): T;
4
- export declare function cloneComponents(list: SelectorComponent[]): SelectorComponent[];
5
- export declare function normalizeNestedSelectors(selectors: Selector[] | Selector | null | undefined): Selector[] | undefined;
6
- export declare function assignNestedSelectors(target: SelectorComponent & {
7
- selectors?: Selector[] | Selector | null;
8
- }, value: Selector[] | undefined): void;
9
- export declare function trimCombinators(components: SelectorComponent[]): SelectorComponent[];
10
- export declare function matchesHiddenNot(component: SelectorComponent | undefined): boolean;
@@ -1,17 +0,0 @@
1
- import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss';
2
- import type { TransformOptions, Warning } from 'lightningcss';
3
- type CustomAtRules = Record<string, never>;
4
- export interface LightningcssStyleHandlerResult {
5
- code: string;
6
- map?: string;
7
- warnings: Warning[];
8
- }
9
- export interface LightningcssTransformConfig {
10
- filename?: string;
11
- transformOptions?: Omit<TransformOptions<CustomAtRules>, 'filename' | 'code' | 'visitor'>;
12
- }
13
- interface LightningcssStyleHandler {
14
- (rawSource: string, overrideOptions?: Partial<IStyleHandlerOptions>): Promise<LightningcssStyleHandlerResult>;
15
- }
16
- export declare function createLightningcssStyleHandler(options?: Partial<IStyleHandlerOptions>, config?: LightningcssTransformConfig): LightningcssStyleHandler;
17
- export {};
@@ -1,205 +0,0 @@
1
- import { p as pluginName } from "./recorder-XdFvVASS.mjs";
2
- import { t as resolveTailwindcssImport } from "./css-imports-CSdPq_Sc.mjs";
3
- import Module from "node:module";
4
- import path from "node:path";
5
- import { fileURLToPath } from "node:url";
6
- //#region src/shared/tailwindcss-css-redirect.ts
7
- const moduleWithMutableResolve = Module;
8
- const patched = /* @__PURE__ */ new WeakSet();
9
- function installTailwindcssCssRedirect(pkgDir) {
10
- const target = path.join(pkgDir, "index.css");
11
- const original = moduleWithMutableResolve._resolveFilename;
12
- if (patched.has(original)) return;
13
- const replacements = new Set(["tailwindcss", "tailwindcss$"]);
14
- const resolveTailwindcssCss = (request, parent, isMain, options) => {
15
- if (replacements.has(request)) return target;
16
- if (request.startsWith("tailwindcss/")) return path.join(pkgDir, request.slice(12));
17
- return original(request, parent, isMain, options);
18
- };
19
- moduleWithMutableResolve._resolveFilename = resolveTailwindcssCss;
20
- patched.add(moduleWithMutableResolve._resolveFilename);
21
- }
22
- //#endregion
23
- //#region src/shared/mpx.ts
24
- const MPX_STYLE_RESOURCE_QUERY_RE$1 = /(?:^|[?&])type=styles(?:&|$)/;
25
- function isMpxStyleResourceQuery(query) {
26
- if (typeof query !== "string") return false;
27
- return MPX_STYLE_RESOURCE_QUERY_RE$1.test(query);
28
- }
29
- function isMpx(appType) {
30
- return appType === "mpx";
31
- }
32
- function getTailwindcssCssEntry(pkgDir) {
33
- return path.join(pkgDir, "index.css");
34
- }
35
- function ensureMpxTailwindcssAliases(compiler, pkgDir) {
36
- const tailwindcssCssEntry = getTailwindcssCssEntry(pkgDir);
37
- compiler.options = compiler.options || {};
38
- compiler.options.resolve = compiler.options.resolve || {};
39
- const alias = compiler.options.resolve.alias ?? {};
40
- if (Array.isArray(alias)) alias.push({
41
- name: "tailwindcss",
42
- alias: tailwindcssCssEntry
43
- }, {
44
- name: "tailwindcss$",
45
- alias: tailwindcssCssEntry
46
- });
47
- else {
48
- compiler.options.resolve.alias = alias;
49
- alias.tailwindcss = tailwindcssCssEntry;
50
- alias.tailwindcss$ = tailwindcssCssEntry;
51
- }
52
- return tailwindcssCssEntry;
53
- }
54
- function patchMpxLoaderResolve(loaderContext, pkgDir, enabled) {
55
- if (!enabled || typeof loaderContext.resolve !== "function") return;
56
- const originalResolve = loaderContext.resolve;
57
- if (originalResolve.__weappTwPatched) return;
58
- const tailwindcssCssEntry = getTailwindcssCssEntry(pkgDir);
59
- const wrappedResolve = function(context, request, callback) {
60
- if (request === "tailwindcss" || request === "tailwindcss$") return callback(null, tailwindcssCssEntry);
61
- if (request?.startsWith("tailwindcss/")) return callback(null, path.join(pkgDir, request.slice(12)));
62
- return originalResolve.call(this, context, request, callback);
63
- };
64
- wrappedResolve.__weappTwPatched = true;
65
- loaderContext.resolve = wrappedResolve;
66
- }
67
- function setupMpxTailwindcssRedirect(pkgDir, enabled) {
68
- if (enabled) installTailwindcssCssRedirect(pkgDir);
69
- }
70
- const CSS_EXT_RE$1 = /\.css$/i;
71
- function injectMpxCssRewritePreRules(compiler, loader, loaderOptions) {
72
- var _compiler$options;
73
- if (!loader) return;
74
- const moduleOptions = (_compiler$options = compiler.options).module ?? (_compiler$options.module = { rules: [] });
75
- moduleOptions.rules = moduleOptions.rules || [];
76
- const createRule = (match) => ({
77
- ...match,
78
- enforce: "pre",
79
- use: [{
80
- loader,
81
- options: loaderOptions
82
- }]
83
- });
84
- moduleOptions.rules.unshift(createRule({ resourceQuery: (query) => isMpxStyleResourceQuery(query) }), createRule({
85
- test: CSS_EXT_RE$1,
86
- resourceQuery: (query) => !isMpxStyleResourceQuery(query)
87
- }));
88
- }
89
- //#endregion
90
- //#region src/bundlers/webpack/shared/css-imports.ts
91
- const CSS_EXT_RE = /\.(?:css|scss|sass|less|styl|pcss)$/i;
92
- function stripResourceQuery$1(file) {
93
- let idx = file.indexOf("?");
94
- if (idx === -1) idx = file.indexOf("&");
95
- return idx === -1 ? file : file.slice(0, idx);
96
- }
97
- function rewriteTailwindcssRequestForCss(data, pkgDir, appType) {
98
- if (!data) return;
99
- const request = data.request;
100
- if (!request) return;
101
- if (request !== "tailwindcss" && request !== "tailwindcss$" && !request.startsWith("tailwindcss/")) return;
102
- const issuer = data.contextInfo?.issuer;
103
- if (!issuer) return;
104
- const normalizedIssuer = stripResourceQuery$1(issuer);
105
- if (!CSS_EXT_RE.test(normalizedIssuer)) return;
106
- const resolved = resolveTailwindcssImport(request, pkgDir, { appType });
107
- if (!resolved) return;
108
- data.request = resolved;
109
- }
110
- function applyTailwindcssCssImportRewrite(compiler, options) {
111
- if (!options.enabled) return;
112
- compiler.hooks.normalModuleFactory.tap(pluginName, (factory) => {
113
- factory.hooks.beforeResolve.tap(pluginName, (data) => {
114
- rewriteTailwindcssRequestForCss(data, options.pkgDir, options.appType);
115
- });
116
- });
117
- }
118
- //#endregion
119
- //#region src/bundlers/webpack/BaseUnifiedPlugin/shared.ts
120
- const MPX_STYLE_RESOURCE_QUERY_RE = /(?:\?|&)type=styles\b/;
121
- function getCacheKey(filename) {
122
- return filename;
123
- }
124
- function stripResourceQuery(resource) {
125
- if (typeof resource !== "string") return resource;
126
- const queryIndex = resource.indexOf("?");
127
- if (queryIndex !== -1) return resource.slice(0, queryIndex);
128
- const hashIndex = resource.indexOf("#");
129
- if (hashIndex !== -1) return resource.slice(0, hashIndex);
130
- return resource;
131
- }
132
- function isCssLikeModuleResource(resource, cssMatcher, appType) {
133
- if (typeof resource !== "string") return false;
134
- const normalizedResource = stripResourceQuery(resource);
135
- if (normalizedResource && cssMatcher(normalizedResource)) return true;
136
- if (appType === "mpx") return MPX_STYLE_RESOURCE_QUERY_RE.test(resource);
137
- return false;
138
- }
139
- function hasLoaderEntry(entries, target) {
140
- if (!target) return false;
141
- return entries.some((entry) => entry.loader?.includes?.(target));
142
- }
143
- function toChunkFiles(files) {
144
- if (!files) return [];
145
- if (Array.isArray(files)) return files;
146
- return [...files];
147
- }
148
- function createAssetHashByChunkMap(chunks) {
149
- const partsByFile = /* @__PURE__ */ new Map();
150
- for (const chunk of chunks) {
151
- const hash = typeof chunk.hash === "string" ? chunk.hash : void 0;
152
- if (!hash) continue;
153
- const chunkId = String(chunk.id ?? chunk.name ?? "");
154
- for (const file of toChunkFiles(chunk.files)) {
155
- if (!file) continue;
156
- let parts = partsByFile.get(file);
157
- if (!parts) {
158
- parts = [];
159
- partsByFile.set(file, parts);
160
- }
161
- parts.push(`${chunkId}:${hash}`);
162
- }
163
- }
164
- const hashByFile = /* @__PURE__ */ new Map();
165
- for (const [file, parts] of partsByFile.entries()) hashByFile.set(file, parts.sort().join("|"));
166
- return hashByFile;
167
- }
168
- function hasWatchChanges(compiler) {
169
- return (compiler.modifiedFiles?.size ?? 0) > 0 || (compiler.removedFiles?.size ?? 0) > 0;
170
- }
171
- //#endregion
172
- //#region ../../node_modules/.pnpm/tsdown@0.21.10_synckit@0.11.12_typescript@5.9.3_vue-tsc@3.2.8_typescript@5.9.3_/node_modules/tsdown/esm-shims.js
173
- const getFilename = () => fileURLToPath(import.meta.url);
174
- const getDirname = () => path.dirname(getFilename());
175
- const __dirname = /* @__PURE__ */ getDirname();
176
- //#endregion
177
- //#region src/bundlers/webpack/shared/loader-anchors.ts
178
- const MPX_STRIP_CONDITIONAL_LOADER = "@mpxjs/webpack-plugin/lib/style-compiler/strip-conditional-loader";
179
- const MPX_STYLE_COMPILER_LOADER = "@mpxjs/webpack-plugin/lib/style-compiler/index";
180
- const MPX_REWRITE_PRECEDENCE_LOADERS = [MPX_STYLE_COMPILER_LOADER, MPX_STRIP_CONDITIONAL_LOADER];
181
- function createFinder(targets) {
182
- return (entries) => entries.findIndex((entry) => targets.some((target) => entry?.loader?.includes?.(target)));
183
- }
184
- function createPrioritizedFinder(targets) {
185
- return (entries) => {
186
- for (const target of targets) {
187
- const idx = entries.findIndex((entry) => entry?.loader?.includes?.(target));
188
- if (idx !== -1) return idx;
189
- }
190
- return -1;
191
- };
192
- }
193
- function createLoaderAnchorFinders(appType) {
194
- if (isMpx(appType)) return {
195
- findRewriteAnchor: createPrioritizedFinder(MPX_REWRITE_PRECEDENCE_LOADERS),
196
- findClassSetAnchor: createFinder([MPX_STYLE_COMPILER_LOADER])
197
- };
198
- const fallbackFinder = createFinder(["postcss-loader"]);
199
- return {
200
- findRewriteAnchor: fallbackFinder,
201
- findClassSetAnchor: fallbackFinder
202
- };
203
- }
204
- //#endregion
205
- export { hasLoaderEntry as a, applyTailwindcssCssImportRewrite as c, isMpx as d, patchMpxLoaderResolve as f, getCacheKey as i, ensureMpxTailwindcssAliases as l, __dirname as n, hasWatchChanges as o, setupMpxTailwindcssRedirect as p, createAssetHashByChunkMap as r, isCssLikeModuleResource as s, createLoaderAnchorFinders as t, injectMpxCssRewritePreRules as u };
@@ -1,273 +0,0 @@
1
- const require_chunk = require("./chunk-8l464Juk.js");
2
- const require_recorder = require("./recorder-GdTJ3QqX.js");
3
- const require_css_imports = require("./css-imports-BbrbluP9.js");
4
- let node_module = require("node:module");
5
- node_module = require_chunk.__toESM(node_module);
6
- let node_path = require("node:path");
7
- node_path = require_chunk.__toESM(node_path);
8
- //#region src/shared/tailwindcss-css-redirect.ts
9
- const moduleWithMutableResolve = node_module.default;
10
- const patched = /* @__PURE__ */ new WeakSet();
11
- function installTailwindcssCssRedirect(pkgDir) {
12
- const target = node_path.default.join(pkgDir, "index.css");
13
- const original = moduleWithMutableResolve._resolveFilename;
14
- if (patched.has(original)) return;
15
- const replacements = new Set(["tailwindcss", "tailwindcss$"]);
16
- const resolveTailwindcssCss = (request, parent, isMain, options) => {
17
- if (replacements.has(request)) return target;
18
- if (request.startsWith("tailwindcss/")) return node_path.default.join(pkgDir, request.slice(12));
19
- return original(request, parent, isMain, options);
20
- };
21
- moduleWithMutableResolve._resolveFilename = resolveTailwindcssCss;
22
- patched.add(moduleWithMutableResolve._resolveFilename);
23
- }
24
- //#endregion
25
- //#region src/shared/mpx.ts
26
- const MPX_STYLE_RESOURCE_QUERY_RE$1 = /(?:^|[?&])type=styles(?:&|$)/;
27
- function isMpxStyleResourceQuery(query) {
28
- if (typeof query !== "string") return false;
29
- return MPX_STYLE_RESOURCE_QUERY_RE$1.test(query);
30
- }
31
- function isMpx(appType) {
32
- return appType === "mpx";
33
- }
34
- function getTailwindcssCssEntry(pkgDir) {
35
- return node_path.default.join(pkgDir, "index.css");
36
- }
37
- function ensureMpxTailwindcssAliases(compiler, pkgDir) {
38
- const tailwindcssCssEntry = getTailwindcssCssEntry(pkgDir);
39
- compiler.options = compiler.options || {};
40
- compiler.options.resolve = compiler.options.resolve || {};
41
- const alias = compiler.options.resolve.alias ?? {};
42
- if (Array.isArray(alias)) alias.push({
43
- name: "tailwindcss",
44
- alias: tailwindcssCssEntry
45
- }, {
46
- name: "tailwindcss$",
47
- alias: tailwindcssCssEntry
48
- });
49
- else {
50
- compiler.options.resolve.alias = alias;
51
- alias.tailwindcss = tailwindcssCssEntry;
52
- alias.tailwindcss$ = tailwindcssCssEntry;
53
- }
54
- return tailwindcssCssEntry;
55
- }
56
- function patchMpxLoaderResolve(loaderContext, pkgDir, enabled) {
57
- if (!enabled || typeof loaderContext.resolve !== "function") return;
58
- const originalResolve = loaderContext.resolve;
59
- if (originalResolve.__weappTwPatched) return;
60
- const tailwindcssCssEntry = getTailwindcssCssEntry(pkgDir);
61
- const wrappedResolve = function(context, request, callback) {
62
- if (request === "tailwindcss" || request === "tailwindcss$") return callback(null, tailwindcssCssEntry);
63
- if (request?.startsWith("tailwindcss/")) return callback(null, node_path.default.join(pkgDir, request.slice(12)));
64
- return originalResolve.call(this, context, request, callback);
65
- };
66
- wrappedResolve.__weappTwPatched = true;
67
- loaderContext.resolve = wrappedResolve;
68
- }
69
- function setupMpxTailwindcssRedirect(pkgDir, enabled) {
70
- if (enabled) installTailwindcssCssRedirect(pkgDir);
71
- }
72
- const CSS_EXT_RE$1 = /\.css$/i;
73
- function injectMpxCssRewritePreRules(compiler, loader, loaderOptions) {
74
- var _compiler$options;
75
- if (!loader) return;
76
- const moduleOptions = (_compiler$options = compiler.options).module ?? (_compiler$options.module = { rules: [] });
77
- moduleOptions.rules = moduleOptions.rules || [];
78
- const createRule = (match) => ({
79
- ...match,
80
- enforce: "pre",
81
- use: [{
82
- loader,
83
- options: loaderOptions
84
- }]
85
- });
86
- moduleOptions.rules.unshift(createRule({ resourceQuery: (query) => isMpxStyleResourceQuery(query) }), createRule({
87
- test: CSS_EXT_RE$1,
88
- resourceQuery: (query) => !isMpxStyleResourceQuery(query)
89
- }));
90
- }
91
- //#endregion
92
- //#region src/bundlers/webpack/shared/css-imports.ts
93
- const CSS_EXT_RE = /\.(?:css|scss|sass|less|styl|pcss)$/i;
94
- function stripResourceQuery$1(file) {
95
- let idx = file.indexOf("?");
96
- if (idx === -1) idx = file.indexOf("&");
97
- return idx === -1 ? file : file.slice(0, idx);
98
- }
99
- function rewriteTailwindcssRequestForCss(data, pkgDir, appType) {
100
- if (!data) return;
101
- const request = data.request;
102
- if (!request) return;
103
- if (request !== "tailwindcss" && request !== "tailwindcss$" && !request.startsWith("tailwindcss/")) return;
104
- const issuer = data.contextInfo?.issuer;
105
- if (!issuer) return;
106
- const normalizedIssuer = stripResourceQuery$1(issuer);
107
- if (!CSS_EXT_RE.test(normalizedIssuer)) return;
108
- const resolved = require_css_imports.resolveTailwindcssImport(request, pkgDir, { appType });
109
- if (!resolved) return;
110
- data.request = resolved;
111
- }
112
- function applyTailwindcssCssImportRewrite(compiler, options) {
113
- if (!options.enabled) return;
114
- compiler.hooks.normalModuleFactory.tap(require_recorder.pluginName, (factory) => {
115
- factory.hooks.beforeResolve.tap(require_recorder.pluginName, (data) => {
116
- rewriteTailwindcssRequestForCss(data, options.pkgDir, options.appType);
117
- });
118
- });
119
- }
120
- //#endregion
121
- //#region src/bundlers/webpack/BaseUnifiedPlugin/shared.ts
122
- const MPX_STYLE_RESOURCE_QUERY_RE = /(?:\?|&)type=styles\b/;
123
- function getCacheKey(filename) {
124
- return filename;
125
- }
126
- function stripResourceQuery(resource) {
127
- if (typeof resource !== "string") return resource;
128
- const queryIndex = resource.indexOf("?");
129
- if (queryIndex !== -1) return resource.slice(0, queryIndex);
130
- const hashIndex = resource.indexOf("#");
131
- if (hashIndex !== -1) return resource.slice(0, hashIndex);
132
- return resource;
133
- }
134
- function isCssLikeModuleResource(resource, cssMatcher, appType) {
135
- if (typeof resource !== "string") return false;
136
- const normalizedResource = stripResourceQuery(resource);
137
- if (normalizedResource && cssMatcher(normalizedResource)) return true;
138
- if (appType === "mpx") return MPX_STYLE_RESOURCE_QUERY_RE.test(resource);
139
- return false;
140
- }
141
- function hasLoaderEntry(entries, target) {
142
- if (!target) return false;
143
- return entries.some((entry) => entry.loader?.includes?.(target));
144
- }
145
- function toChunkFiles(files) {
146
- if (!files) return [];
147
- if (Array.isArray(files)) return files;
148
- return [...files];
149
- }
150
- function createAssetHashByChunkMap(chunks) {
151
- const partsByFile = /* @__PURE__ */ new Map();
152
- for (const chunk of chunks) {
153
- const hash = typeof chunk.hash === "string" ? chunk.hash : void 0;
154
- if (!hash) continue;
155
- const chunkId = String(chunk.id ?? chunk.name ?? "");
156
- for (const file of toChunkFiles(chunk.files)) {
157
- if (!file) continue;
158
- let parts = partsByFile.get(file);
159
- if (!parts) {
160
- parts = [];
161
- partsByFile.set(file, parts);
162
- }
163
- parts.push(`${chunkId}:${hash}`);
164
- }
165
- }
166
- const hashByFile = /* @__PURE__ */ new Map();
167
- for (const [file, parts] of partsByFile.entries()) hashByFile.set(file, parts.sort().join("|"));
168
- return hashByFile;
169
- }
170
- function hasWatchChanges(compiler) {
171
- return (compiler.modifiedFiles?.size ?? 0) > 0 || (compiler.removedFiles?.size ?? 0) > 0;
172
- }
173
- //#endregion
174
- //#region src/bundlers/webpack/shared/loader-anchors.ts
175
- const MPX_STRIP_CONDITIONAL_LOADER = "@mpxjs/webpack-plugin/lib/style-compiler/strip-conditional-loader";
176
- const MPX_STYLE_COMPILER_LOADER = "@mpxjs/webpack-plugin/lib/style-compiler/index";
177
- const MPX_REWRITE_PRECEDENCE_LOADERS = [MPX_STYLE_COMPILER_LOADER, MPX_STRIP_CONDITIONAL_LOADER];
178
- function createFinder(targets) {
179
- return (entries) => entries.findIndex((entry) => targets.some((target) => entry?.loader?.includes?.(target)));
180
- }
181
- function createPrioritizedFinder(targets) {
182
- return (entries) => {
183
- for (const target of targets) {
184
- const idx = entries.findIndex((entry) => entry?.loader?.includes?.(target));
185
- if (idx !== -1) return idx;
186
- }
187
- return -1;
188
- };
189
- }
190
- function createLoaderAnchorFinders(appType) {
191
- if (isMpx(appType)) return {
192
- findRewriteAnchor: createPrioritizedFinder(MPX_REWRITE_PRECEDENCE_LOADERS),
193
- findClassSetAnchor: createFinder([MPX_STYLE_COMPILER_LOADER])
194
- };
195
- const fallbackFinder = createFinder(["postcss-loader"]);
196
- return {
197
- findRewriteAnchor: fallbackFinder,
198
- findClassSetAnchor: fallbackFinder
199
- };
200
- }
201
- //#endregion
202
- Object.defineProperty(exports, "applyTailwindcssCssImportRewrite", {
203
- enumerable: true,
204
- get: function() {
205
- return applyTailwindcssCssImportRewrite;
206
- }
207
- });
208
- Object.defineProperty(exports, "createAssetHashByChunkMap", {
209
- enumerable: true,
210
- get: function() {
211
- return createAssetHashByChunkMap;
212
- }
213
- });
214
- Object.defineProperty(exports, "createLoaderAnchorFinders", {
215
- enumerable: true,
216
- get: function() {
217
- return createLoaderAnchorFinders;
218
- }
219
- });
220
- Object.defineProperty(exports, "ensureMpxTailwindcssAliases", {
221
- enumerable: true,
222
- get: function() {
223
- return ensureMpxTailwindcssAliases;
224
- }
225
- });
226
- Object.defineProperty(exports, "getCacheKey", {
227
- enumerable: true,
228
- get: function() {
229
- return getCacheKey;
230
- }
231
- });
232
- Object.defineProperty(exports, "hasLoaderEntry", {
233
- enumerable: true,
234
- get: function() {
235
- return hasLoaderEntry;
236
- }
237
- });
238
- Object.defineProperty(exports, "hasWatchChanges", {
239
- enumerable: true,
240
- get: function() {
241
- return hasWatchChanges;
242
- }
243
- });
244
- Object.defineProperty(exports, "injectMpxCssRewritePreRules", {
245
- enumerable: true,
246
- get: function() {
247
- return injectMpxCssRewritePreRules;
248
- }
249
- });
250
- Object.defineProperty(exports, "isCssLikeModuleResource", {
251
- enumerable: true,
252
- get: function() {
253
- return isCssLikeModuleResource;
254
- }
255
- });
256
- Object.defineProperty(exports, "isMpx", {
257
- enumerable: true,
258
- get: function() {
259
- return isMpx;
260
- }
261
- });
262
- Object.defineProperty(exports, "patchMpxLoaderResolve", {
263
- enumerable: true,
264
- get: function() {
265
- return patchMpxLoaderResolve;
266
- }
267
- });
268
- Object.defineProperty(exports, "setupMpxTailwindcssRedirect", {
269
- enumerable: true,
270
- get: function() {
271
- return setupMpxTailwindcssRedirect;
272
- }
273
- });