weapp-tailwindcss 5.0.0-next.5 → 5.0.0-next.8

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 (131) hide show
  1. package/dist/bundlers/shared/css-cleanup/at-rules.d.ts +2 -0
  2. package/dist/bundlers/shared/css-cleanup/color-gamut.d.ts +3 -0
  3. package/dist/bundlers/shared/css-cleanup/root-cleanups.d.ts +4 -0
  4. package/dist/bundlers/shared/css-cleanup/selectors.d.ts +8 -0
  5. package/dist/bundlers/shared/css-cleanup.d.ts +1 -2
  6. package/dist/bundlers/shared/generator-css/config-directive.d.ts +2 -0
  7. package/dist/bundlers/shared/generator-css/directives.d.ts +12 -0
  8. package/dist/bundlers/shared/generator-css/legacy-compat.d.ts +7 -0
  9. package/dist/bundlers/shared/generator-css/legacy-selectors.d.ts +5 -0
  10. package/dist/bundlers/shared/generator-css/legacy-units.d.ts +1 -0
  11. package/dist/bundlers/shared/generator-css/markers.d.ts +16 -0
  12. package/dist/bundlers/shared/generator-css/source-files.d.ts +11 -0
  13. package/dist/bundlers/shared/generator-css/source-resolver.d.ts +10 -0
  14. package/dist/bundlers/shared/generator-css.d.ts +10 -23
  15. package/dist/bundlers/vite/css-finalizer.d.ts +1 -1
  16. package/dist/bundlers/vite/generate-bundle/candidates.d.ts +2 -0
  17. package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +20 -0
  18. package/dist/bundlers/vite/generate-bundle/css-share-scope.d.ts +3 -0
  19. package/dist/bundlers/vite/generate-bundle/dirty-state.d.ts +1 -0
  20. package/dist/bundlers/vite/generate-bundle/js-entries.d.ts +2 -0
  21. package/dist/bundlers/vite/generate-bundle/js-handler-options.d.ts +8 -0
  22. package/dist/bundlers/vite/generate-bundle/js-linking.d.ts +13 -0
  23. package/dist/bundlers/vite/generate-bundle/metrics.d.ts +17 -0
  24. package/dist/bundlers/vite/generate-bundle/process-plan.d.ts +9 -0
  25. package/dist/bundlers/vite/generate-bundle/rollup-assets.d.ts +7 -0
  26. package/dist/bundlers/vite/generate-bundle/signatures.d.ts +8 -0
  27. package/dist/bundlers/vite/generate-bundle.d.ts +1 -1
  28. package/dist/bundlers/vite/official-tailwind-plugins.d.ts +5 -0
  29. package/dist/bundlers/vite/postcss-config.d.ts +6 -0
  30. package/dist/bundlers/vite/rewrite-css-imports.d.ts +1 -0
  31. package/dist/bundlers/vite/runtime-class-set.d.ts +22 -0
  32. package/dist/bundlers/vite/tailwind-basedir.d.ts +1 -0
  33. package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +1 -0
  34. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +1 -1
  35. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +2 -0
  36. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +1 -0
  37. package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +2 -0
  38. package/dist/cache-BVAiJV3J.js +502 -0
  39. package/dist/cache-CHs4DXui.mjs +434 -0
  40. package/dist/cli/helpers.d.ts +1 -2
  41. package/dist/cli/mount-options.d.ts +2 -2
  42. package/dist/cli/types.d.ts +0 -2
  43. package/dist/cli.js +107 -603
  44. package/dist/cli.mjs +118 -613
  45. package/dist/constants.d.ts +0 -1
  46. package/dist/context/tailwindcss.d.ts +1 -1
  47. package/dist/core.js +13 -20
  48. package/dist/core.mjs +8 -14
  49. package/dist/css-macro/postcss.js +1 -1
  50. package/dist/css-macro/postcss.mjs +1 -1
  51. package/dist/css-macro.js +2 -2
  52. package/dist/css-macro.mjs +2 -2
  53. package/dist/defaults.d.ts +15 -1
  54. package/dist/defaults.js +28 -7
  55. package/dist/defaults.mjs +25 -8
  56. package/dist/{generator-9UEp8OoQ.js → generator-DKkhJbOg.js} +24 -7
  57. package/dist/{generator-Dpp-5s8z.mjs → generator-UBmfduYg.mjs} +20 -3
  58. package/dist/{generator-css-MyjZhF0z.mjs → generator-css-BIapP56i.mjs} +691 -606
  59. package/dist/{generator-css-CGueCYbX.js → generator-css-Mksw8PgB.js} +703 -606
  60. package/dist/generator.js +1 -1
  61. package/dist/generator.mjs +1 -1
  62. package/dist/gulp.js +33 -21
  63. package/dist/gulp.mjs +29 -17
  64. package/dist/index.js +5 -5
  65. package/dist/index.mjs +4 -4
  66. package/dist/logger-BRy6XPQ2.js +1 -0
  67. package/dist/logger-Bub1jggA.mjs +2 -0
  68. package/dist/postcss/config-directive.d.ts +1 -0
  69. package/dist/postcss/context.d.ts +9 -0
  70. package/dist/postcss/source-files.d.ts +8 -0
  71. package/dist/postcss/tailwind-version.d.ts +3 -0
  72. package/dist/postcss-QIXwT40c.js +298 -0
  73. package/dist/postcss-w48mGIhe.mjs +288 -0
  74. package/dist/postcss.js +3 -285
  75. package/dist/postcss.mjs +1 -278
  76. package/dist/{recorder-D4BKt75Q.js → precheck-B32p-gLI.js} +139 -274
  77. package/dist/{recorder-BIW3Kuke.mjs → precheck-B4RH6ZNN.mjs} +105 -239
  78. package/dist/presets.js +6 -4
  79. package/dist/presets.mjs +4 -2
  80. package/dist/runtime-patch-CwN5ya72.mjs +71 -0
  81. package/dist/runtime-patch-D6mBo_KB.js +85 -0
  82. package/dist/tailwindcss/runtime-patch.d.ts +5 -0
  83. package/dist/tailwindcss/runtime.d.ts +2 -3
  84. package/dist/tailwindcss/targets.d.ts +1 -5
  85. package/dist/tailwindcss/v4/css-sources.d.ts +5 -0
  86. package/dist/tailwindcss/v4/patcher.d.ts +1 -1
  87. package/dist/{logger-D9clu_3f.js → tailwindcss-Bu-RWIHx.js} +70 -413
  88. package/dist/{logger-1gx9UllH.mjs → tailwindcss-C5IgPlQ0.mjs} +56 -382
  89. package/dist/types/index.d.ts +1 -6
  90. package/dist/uni-app-x/vite.d.ts +1 -1
  91. package/dist/{vite-fDM-UQpR.mjs → vite-BwgRVgxH.mjs} +677 -525
  92. package/dist/{vite-BkMGwDeH.js → vite-DyZuiyap.js} +704 -552
  93. package/dist/vite.js +1 -1
  94. package/dist/vite.mjs +1 -1
  95. package/dist/weapp-tw-css-import-rewrite-loader.js +10 -1
  96. package/dist/{webpack-CICGEKT9.js → webpack-CNV2dx3Q.js} +72 -37
  97. package/dist/{webpack-D2Wdk28V.mjs → webpack-CT6EEENx.mjs} +58 -23
  98. package/dist/webpack.js +1 -1
  99. package/dist/webpack.mjs +1 -1
  100. package/package.json +6 -9
  101. package/dist/bundlers/shared/generator-candidates.d.ts +0 -5
  102. package/dist/bundlers/webpack/shared/css-imports.d.ts +0 -6
  103. package/dist/cli/config.d.ts +0 -5
  104. package/dist/cli/helpers/patch-cwd.d.ts +0 -1
  105. package/dist/cli/mount-options/patch-status.d.ts +0 -2
  106. package/dist/cli/patch-options.d.ts +0 -6
  107. package/dist/cli/tokens.d.ts +0 -4
  108. package/dist/cli/workspace/package-dirs.d.ts +0 -3
  109. package/dist/cli/workspace/patch-package.d.ts +0 -3
  110. package/dist/cli/workspace/patch-utils.d.ts +0 -3
  111. package/dist/cli/workspace/types.d.ts +0 -11
  112. package/dist/cli/workspace/workspace-globs.d.ts +0 -2
  113. package/dist/cli/workspace/workspace-io.d.ts +0 -1
  114. package/dist/cli/workspace/workspace-lock.d.ts +0 -1
  115. package/dist/cli/workspace.d.ts +0 -2
  116. package/dist/js/syntax.d.ts +0 -10
  117. package/dist/patcher-options-DnqazL9E.js +0 -34
  118. package/dist/patcher-options-GuOwX0-k.mjs +0 -17
  119. package/dist/tailwindcss/recorder.d.ts +0 -13
  120. package/dist/tailwindcss/targets/paths.d.ts +0 -13
  121. package/dist/tailwindcss/targets/record-io.d.ts +0 -5
  122. package/dist/tailwindcss/targets/recorder.d.ts +0 -3
  123. package/dist/tailwindcss/targets/types.d.ts +0 -35
  124. package/dist/version-CWBxRFPB.js +0 -56
  125. package/dist/version-WNz3MwRv.mjs +0 -49
  126. /package/dist/{constants-p1dyh1x1.js → constants-BoB_6lFw.js} +0 -0
  127. /package/dist/{constants-B-_T5UnW.mjs → constants-E_loJC49.mjs} +0 -0
  128. /package/dist/{run-tasks-Cq5A5nVD.js → run-tasks-B50A3pxt.js} +0 -0
  129. /package/dist/{run-tasks-DUVrDJGl.mjs → run-tasks-DdNi-hkk.mjs} +0 -0
  130. /package/dist/{utils-DmC9_In3.js → utils-BiShvil9.js} +0 -0
  131. /package/dist/{utils-7DUGTFED.mjs → utils-Btw1iOVV.mjs} +0 -0
package/dist/vite.js CHANGED
@@ -1,4 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_vite = require("./vite-BkMGwDeH.js");
2
+ const require_vite = require("./vite-DyZuiyap.js");
3
3
  exports.WeappTailwindcss = require_vite.WeappTailwindcss;
4
4
  exports.weappTailwindcss = require_vite.WeappTailwindcss;
package/dist/vite.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { t as WeappTailwindcss } from "./vite-fDM-UQpR.mjs";
1
+ import { t as WeappTailwindcss } from "./vite-BwgRVgxH.mjs";
2
2
  export { WeappTailwindcss, WeappTailwindcss as weappTailwindcss };
@@ -41,6 +41,7 @@ function rewriteTailwindcssImportsInCode(code, pkgDir, options) {
41
41
  }
42
42
  //#endregion
43
43
  //#region src/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.ts
44
+ const TAILWIND_ROOT_DIRECTIVE_RE = /@(?:import\s+(?:url\(\s*)?["']?tailwindcss4?(?:\/[^"')\s]*)?|tailwind|config|custom-variant|plugin|source|theme|utility|variant)\b/;
44
45
  const getLoaderOptions = loader_utils.default.getOptions;
45
46
  function joinPosixPath(base, subpath) {
46
47
  if (base.endsWith("/")) return `${base}${subpath}`;
@@ -67,7 +68,15 @@ function transformCssImportRewriteSource(source, options) {
67
68
  }
68
69
  const WeappTwCssImportRewriteLoader = function(source) {
69
70
  if (node_process.default.env.WEAPP_TW_LOADER_DEBUG) node_process.default.stdout.write(`[weapp-tw-css-import-rewrite-loader] executing for ${this.resourcePath}\n`);
70
- return transformCssImportRewriteSource(source, getLoaderOptions(this));
71
+ const opt = getLoaderOptions(this);
72
+ const input = node_buffer.Buffer.isBuffer(source) ? source.toString("utf-8") : source;
73
+ const registerTask = typeof input === "string" && TAILWIND_ROOT_DIRECTIVE_RE.test(input) ? opt?.tailwindcssImportRewrite?.registerCssSource?.({
74
+ file: this.resourcePath,
75
+ css: input
76
+ }) : void 0;
77
+ const transform = () => transformCssImportRewriteSource(source, opt);
78
+ if (registerTask && typeof registerTask.then === "function") return Promise.resolve(registerTask).then(transform);
79
+ return transform();
71
80
  };
72
81
  //#endregion
73
82
  exports.default = WeappTwCssImportRewriteLoader;
@@ -1,10 +1,11 @@
1
1
  const require_chunk = require("./chunk-8l464Juk.js");
2
- const require_patcher_options = require("./patcher-options-DnqazL9E.js");
3
- const require_recorder = require("./recorder-D4BKt75Q.js");
4
- const require_utils = require("./utils-DmC9_In3.js");
5
- const require_logger = require("./logger-D9clu_3f.js");
6
- const require_generator_css = require("./generator-css-CGueCYbX.js");
7
- const require_run_tasks = require("./run-tasks-Cq5A5nVD.js");
2
+ const require_cache = require("./cache-BVAiJV3J.js");
3
+ const require_runtime_patch = require("./runtime-patch-D6mBo_KB.js");
4
+ const require_generator_css = require("./generator-css-Mksw8PgB.js");
5
+ const require_precheck = require("./precheck-B32p-gLI.js");
6
+ const require_utils = require("./utils-BiShvil9.js");
7
+ const require_tailwindcss = require("./tailwindcss-Bu-RWIHx.js");
8
+ const require_run_tasks = require("./run-tasks-B50A3pxt.js");
8
9
  let node_module = require("node:module");
9
10
  node_module = require_chunk.__toESM(node_module);
10
11
  let node_path = require("node:path");
@@ -31,7 +32,7 @@ function installTailwindcssCssRedirect(pkgDir) {
31
32
  }
32
33
  //#endregion
33
34
  //#region src/shared/mpx.ts
34
- const require$1 = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
35
+ const localRequire = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
35
36
  const MPX_STYLE_RESOURCE_QUERY_RE$1 = /(?:^|[?&])type=styles(?:&|$)/;
36
37
  function isMpxStyleResourceQuery(query) {
37
38
  if (typeof query !== "string") return false;
@@ -43,6 +44,18 @@ function isMpx(appType) {
43
44
  function getTailwindcssCssEntry(pkgDir) {
44
45
  return node_path.default.join(pkgDir, "index.css");
45
46
  }
47
+ function resolveMpxWebpackPluginDir(compiler) {
48
+ const candidates = [
49
+ compiler?.context,
50
+ compiler?.options?.context,
51
+ node_process.default.cwd()
52
+ ].filter((item) => typeof item === "string" && item.length > 0);
53
+ for (const candidate of candidates) try {
54
+ const projectRequire = (0, node_module.createRequire)(node_path.default.join(candidate, "package.json"));
55
+ return node_path.default.dirname(projectRequire.resolve("@mpxjs/webpack-plugin/package.json"));
56
+ } catch {}
57
+ return node_path.default.dirname(localRequire.resolve("@mpxjs/webpack-plugin/package.json"));
58
+ }
46
59
  function isMpxWebpackPluginRequest(request) {
47
60
  return request === "@mpxjs/webpack-plugin" || Boolean(request?.startsWith("@mpxjs/webpack-plugin/"));
48
61
  }
@@ -64,9 +77,9 @@ function ensureResolveLoaderAlias(compiler, mpxWebpackPluginDir) {
64
77
  }
65
78
  function ensureMpxTailwindcssAliases(compiler, pkgDir) {
66
79
  const tailwindcssCssEntry = getTailwindcssCssEntry(pkgDir);
67
- const mpxWebpackPluginDir = node_path.default.dirname(require$1.resolve("@mpxjs/webpack-plugin/package.json"));
68
80
  compiler.options = compiler.options || {};
69
81
  compiler.options.resolve = compiler.options.resolve || {};
82
+ const mpxWebpackPluginDir = resolveMpxWebpackPluginDir(compiler);
70
83
  ensureResolveLoaderAlias(compiler, mpxWebpackPluginDir);
71
84
  const alias = compiler.options.resolve.alias ?? {};
72
85
  compiler.options.resolve.alias = alias;
@@ -174,6 +187,9 @@ function createAssetHashByChunkMap(chunks) {
174
187
  for (const [file, parts] of partsByFile.entries()) hashByFile.set(file, parts.sort().join("|"));
175
188
  return hashByFile;
176
189
  }
190
+ function createRuntimeAwareCssHash(assetHash, sourceHash, runtimeSetHash) {
191
+ return `${assetHash ?? sourceHash}:${runtimeSetHash}`;
192
+ }
177
193
  function hasWatchChanges(compiler) {
178
194
  return (compiler.modifiedFiles?.size ?? 0) > 0 || (compiler.removedFiles?.size ?? 0) > 0;
179
195
  }
@@ -185,14 +201,14 @@ function setupWebpackV5ProcessAssetsHook(options) {
185
201
  const { ConcatSource } = sources;
186
202
  const cssHandlerOptionsCache = /* @__PURE__ */ new Map();
187
203
  const cssUserHandlerOptionsCache = /* @__PURE__ */ new Map();
188
- compiler.hooks.compilation.tap(require_recorder.pluginName, (compilation) => {
204
+ compiler.hooks.compilation.tap(require_precheck.pluginName, (compilation) => {
189
205
  compilation.hooks.processAssets.tapPromise({
190
- name: require_recorder.pluginName,
206
+ name: require_precheck.pluginName,
191
207
  stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
192
208
  }, async (assets) => {
193
209
  compilerOptions.onStart();
194
210
  debug("start");
195
- await runtimeState.patchPromise;
211
+ await runtimeState.readyPromise;
196
212
  for (const chunk of compilation.chunks) if (chunk.id && chunk.hash) compilerOptions.cache.calcHashValueChanged(chunk.id, chunk.hash);
197
213
  const assetHashByChunk = createAssetHashByChunkMap(compilation.chunks);
198
214
  const entries = Object.entries(assets);
@@ -263,7 +279,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
263
279
  };
264
280
  const forceRuntimeRefresh = getRuntimeRefreshRequirement();
265
281
  debug("processAssets ensure runtime set forceRefresh=%s major=%s", forceRuntimeRefresh, runtimeState.twPatcher.majorVersion ?? "unknown");
266
- const runtimeSet = await require_recorder.ensureRuntimeClassSet(runtimeState, {
282
+ const runtimeSet = await require_precheck.ensureRuntimeClassSet(runtimeState, {
267
283
  forceRefresh: forceRuntimeRefresh,
268
284
  forceCollect: true,
269
285
  clearCache: forceRuntimeRefresh,
@@ -271,7 +287,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
271
287
  });
272
288
  await refreshRuntimeMetadata(forceRuntimeRefresh);
273
289
  consumeRuntimeRefreshRequirement();
274
- const runtimeSetHash = compilerOptions.cache.computeHash([require_logger.getRuntimeClassSetSignature(runtimeState.twPatcher), [...runtimeSet].sort().join("\n")].join("\n\n"));
290
+ const runtimeSetHash = compilerOptions.cache.computeHash([require_cache.getRuntimeClassSetSignature(runtimeState.twPatcher), [...runtimeSet].sort().join("\n")].join("\n\n"));
275
291
  const defaultTemplateHandlerOptions = { runtimeSet };
276
292
  debug("get runtimeSet, class count: %d", runtimeSet.size);
277
293
  const tasks = [];
@@ -332,7 +348,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
332
348
  moduleGraph: moduleGraphOptions,
333
349
  babelParserOptions: { sourceFilename: absoluteFile }
334
350
  };
335
- if (require_recorder.shouldSkipJsTransform(currentSource, handlerOptions)) return { result: new ConcatSource(currentSource) };
351
+ if (require_precheck.shouldSkipJsTransform(currentSource, handlerOptions)) return { result: new ConcatSource(currentSource) };
336
352
  const { code, linked } = await compilerOptions.jsHandler(currentSource, runtimeSet, handlerOptions);
337
353
  const source = new ConcatSource(code);
338
354
  compilerOptions.onUpdate(file, currentSource, code);
@@ -347,8 +363,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
347
363
  const [file, originalSource] = element;
348
364
  const rawSource = originalSource.source().toString();
349
365
  const cacheKey = file;
350
- const chunkHash = assetHashByChunk.get(file);
351
- const runtimeAwareHash = chunkHash ? `${chunkHash}:${runtimeSetHash}` : void 0;
366
+ const runtimeAwareHash = createRuntimeAwareCssHash(assetHashByChunk.get(file), compilerOptions.cache.computeHash(rawSource), runtimeSetHash);
352
367
  tasks.push(require_generator_css.processCachedTask({
353
368
  cache: compilerOptions.cache,
354
369
  cacheKey,
@@ -362,7 +377,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
362
377
  debug("css cache hit: %s", file);
363
378
  },
364
379
  transform: async () => {
365
- await runtimeState.patchPromise;
380
+ await runtimeState.readyPromise;
366
381
  const cssHandlerOptions = getCssHandlerOptions(file);
367
382
  const generated = await require_generator_css.generateCssByGenerator({
368
383
  opts: compilerOptions,
@@ -422,7 +437,7 @@ function createLoaderAnchorFinders(appType) {
422
437
  //#endregion
423
438
  //#region src/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.ts
424
439
  function setupWebpackV5Loaders(options) {
425
- const { compiler, options: compilerOptions, appType, weappTailwindcssPackageDir, shouldRewriteCssImports, runtimeLoaderPath, getClassSetInLoader, getRuntimeWatchDependencies, debug } = options;
440
+ const { compiler, options: compilerOptions, appType, weappTailwindcssPackageDir, shouldRewriteCssImports, runtimeLoaderPath, registerAutoCssSource, getClassSetInLoader, getRuntimeWatchDependencies, debug } = options;
426
441
  const isMpxApp = isMpx(appType);
427
442
  if (shouldRewriteCssImports && isMpxApp) ensureMpxTailwindcssAliases(compiler, weappTailwindcssPackageDir);
428
443
  const runtimeClassSetLoader = runtimeLoaderPath ?? node_path.default.resolve(__dirname, "./weapp-tw-runtime-classset-loader.js");
@@ -431,7 +446,8 @@ function setupWebpackV5Loaders(options) {
431
446
  const runtimeCssImportRewriteLoaderExists = runtimeCssImportRewriteLoader ? node_fs.default.existsSync(runtimeCssImportRewriteLoader) : false;
432
447
  const runtimeLoaderRewriteOptions = shouldRewriteCssImports ? {
433
448
  pkgDir: weappTailwindcssPackageDir,
434
- appType
449
+ appType,
450
+ registerCssSource: registerAutoCssSource
435
451
  } : void 0;
436
452
  const classSetLoaderOptions = {
437
453
  getClassSet: getClassSetInLoader,
@@ -456,8 +472,8 @@ function setupWebpackV5Loaders(options) {
456
472
  };
457
473
  };
458
474
  const { NormalModule } = compiler.webpack;
459
- compiler.hooks.compilation.tap(require_recorder.pluginName, (compilation) => {
460
- NormalModule.getCompilationHooks(compilation).loader.tap(require_recorder.pluginName, (_loaderContext, module) => {
475
+ compiler.hooks.compilation.tap(require_precheck.pluginName, (compilation) => {
476
+ NormalModule.getCompilationHooks(compilation).loader.tap(require_precheck.pluginName, (_loaderContext, module) => {
461
477
  if (!(runtimeClassSetLoaderExists || runtimeCssImportRewriteLoaderExists)) return;
462
478
  patchMpxLoaderResolve(_loaderContext, weappTailwindcssPackageDir, shouldRewriteCssImports && isMpxApp);
463
479
  const loaderEntries = module.loaders || [];
@@ -505,7 +521,7 @@ function setupWebpackV5Loaders(options) {
505
521
  }
506
522
  //#endregion
507
523
  //#region src/bundlers/webpack/BaseUnifiedPlugin/v5.ts
508
- const debug = require_recorder.createDebug();
524
+ const debug = require_runtime_patch.createDebug();
509
525
  const weappTailwindcssPackageDir = require_run_tasks.resolvePackageDir("weapp-tailwindcss");
510
526
  /**
511
527
  * @name UnifiedWebpackPluginV5
@@ -514,7 +530,14 @@ const weappTailwindcssPackageDir = require_run_tasks.resolvePackageDir("weapp-ta
514
530
  */
515
531
  var UnifiedWebpackPluginV5 = class {
516
532
  constructor(options = {}) {
517
- this.options = require_recorder.getCompilerContext(options);
533
+ require_precheck._defineProperty(this, "options", void 0);
534
+ require_precheck._defineProperty(this, "appType", void 0);
535
+ require_precheck._defineProperty(this, "hasInitialTailwindCssRoots", void 0);
536
+ this.hasInitialTailwindCssRoots = require_tailwindcss.hasConfiguredTailwindV4CssRoots(options);
537
+ this.options = require_precheck.getCompilerContext({
538
+ ...options,
539
+ __internalDeferMissingCssEntriesWarning: true
540
+ });
518
541
  this.appType = this.options.appType;
519
542
  }
520
543
  apply(compiler) {
@@ -525,15 +548,10 @@ var UnifiedWebpackPluginV5 = class {
525
548
  const isMpxApp = isMpx(this.appType);
526
549
  if (shouldRewriteCssImports) setupMpxTailwindcssRedirect(weappTailwindcssPackageDir, isMpxApp);
527
550
  if (disabledOptions.plugin) return;
528
- const patchRecorderState = require_recorder.setupPatchRecorder(initialTwPatcher, this.options.tailwindcssBasedir, {
529
- source: "runtime",
530
- cwd: this.options.tailwindcssBasedir ?? node_process.default.cwd()
531
- });
532
551
  const runtimeState = {
533
552
  twPatcher: initialTwPatcher,
534
- patchPromise: patchRecorderState.patchPromise,
535
- refreshTailwindcssPatcher,
536
- onPatchCompleted: patchRecorderState.onPatchCompleted
553
+ readyPromise: require_precheck.createTailwindRuntimeReadyPromise(initialTwPatcher),
554
+ refreshTailwindcssPatcher
537
555
  };
538
556
  let runtimeSetPrepared = false;
539
557
  let runtimeSetSignature;
@@ -544,9 +562,13 @@ var UnifiedWebpackPluginV5 = class {
544
562
  const updateRuntimeWatchDependencies = async () => {
545
563
  runtimeWatchDependencyFiles.clear();
546
564
  runtimeWatchDependencyContexts.clear();
547
- const tailwindOptions = require_patcher_options.resolveTailwindcssOptions(runtimeState.twPatcher.options);
565
+ const tailwindOptions = require_cache.resolveTailwindcssOptions(runtimeState.twPatcher.options);
548
566
  if (tailwindOptions?.config) runtimeWatchDependencyFiles.add(tailwindOptions.config);
549
567
  for (const entry of tailwindOptions?.v4?.cssEntries ?? []) runtimeWatchDependencyFiles.add(entry);
568
+ for (const source of tailwindOptions?.v4?.cssSources ?? []) {
569
+ if (source.file) runtimeWatchDependencyFiles.add(source.file);
570
+ for (const dependency of source.dependencies ?? []) runtimeWatchDependencyFiles.add(dependency);
571
+ }
550
572
  for (const source of tailwindOptions?.v4?.sources ?? []) if (source?.base) runtimeWatchDependencyContexts.add(source.base);
551
573
  if (typeof runtimeState.twPatcher.collectContentTokens !== "function") return;
552
574
  try {
@@ -570,19 +592,31 @@ var UnifiedWebpackPluginV5 = class {
570
592
  runtimeMetadataPrepared = false;
571
593
  syncRuntimeRefreshRequirement();
572
594
  };
573
- compiler.hooks.invalid?.tap?.(require_recorder.pluginName, () => {
595
+ const registerAutoCssSource = async (source) => {
596
+ if (this.hasInitialTailwindCssRoots || (runtimeState.twPatcher.majorVersion ?? 0) < 4 || !source.file) return;
597
+ if (!require_tailwindcss.upsertTailwindV4CssSource(this.options, source)) return;
598
+ runtimeSetPrepared = false;
599
+ runtimeMetadataPrepared = false;
600
+ runtimeRefreshRequiredForCompilation = true;
601
+ await require_precheck.refreshTailwindRuntimeState(runtimeState, {
602
+ force: true,
603
+ clearCache: true
604
+ });
605
+ debug("detected tailwindcss v4 css source from webpack css module: %s", source.file);
606
+ };
607
+ compiler.hooks.invalid?.tap?.(require_precheck.pluginName, () => {
574
608
  runtimeRefreshRequiredForCompilation = true;
575
609
  });
576
- compiler.hooks.watchRun?.tap?.(require_recorder.pluginName, syncRuntimeRefreshRequirement);
577
- if (compiler.hooks.thisCompilation?.tap) compiler.hooks.thisCompilation.tap(require_recorder.pluginName, resetRuntimePreparation);
578
- else if (compiler.hooks.compilation?.tap) compiler.hooks.compilation.tap(require_recorder.pluginName, resetRuntimePreparation);
610
+ compiler.hooks.watchRun?.tap?.(require_precheck.pluginName, syncRuntimeRefreshRequirement);
611
+ if (compiler.hooks.thisCompilation?.tap) compiler.hooks.thisCompilation.tap(require_precheck.pluginName, resetRuntimePreparation);
612
+ else if (compiler.hooks.compilation?.tap) compiler.hooks.compilation.tap(require_precheck.pluginName, resetRuntimePreparation);
579
613
  async function getClassSetInLoader() {
580
614
  if (runtimeSetPrepared) return;
581
- const signature = require_logger.getRuntimeClassSetSignature(runtimeState.twPatcher);
615
+ const signature = require_cache.getRuntimeClassSetSignature(runtimeState.twPatcher);
582
616
  const forceRefresh = runtimeRefreshRequiredForCompilation || signature !== runtimeSetSignature;
583
617
  debug("runtime loader ensure class set forceRefresh=%s watchDirty=%s signatureChanged=%s", forceRefresh, runtimeRefreshRequiredForCompilation, signature !== runtimeSetSignature);
584
618
  runtimeSetPrepared = true;
585
- await require_recorder.ensureRuntimeClassSet(runtimeState, {
619
+ await require_precheck.ensureRuntimeClassSet(runtimeState, {
586
620
  forceRefresh,
587
621
  forceCollect: true,
588
622
  clearCache: forceRefresh,
@@ -600,6 +634,7 @@ var UnifiedWebpackPluginV5 = class {
600
634
  weappTailwindcssPackageDir,
601
635
  shouldRewriteCssImports,
602
636
  runtimeLoaderPath,
637
+ registerAutoCssSource,
603
638
  getClassSetInLoader,
604
639
  getRuntimeWatchDependencies() {
605
640
  return {
@@ -1,9 +1,10 @@
1
- import { r as resolveTailwindcssOptions } from "./patcher-options-GuOwX0-k.mjs";
2
- import { g as ensureRuntimeClassSet, n as shouldSkipJsTransform, p as pluginName, r as getCompilerContext, t as setupPatchRecorder, v as createDebug } from "./recorder-BIW3Kuke.mjs";
3
- import { r as getGroupedEntries } from "./utils-7DUGTFED.mjs";
4
- import { d as getRuntimeClassSetSignature } from "./logger-1gx9UllH.mjs";
5
- import { i as processCachedTask, t as generateCssByGenerator } from "./generator-css-MyjZhF0z.mjs";
6
- import { a as resolveOutputSpecifier, n as resolvePackageDir, o as toAbsoluteOutputPath, r as resolvePluginDisabledState, t as pushConcurrentTaskFactories } from "./run-tasks-DUVrDJGl.mjs";
1
+ import { c as resolveTailwindcssOptions, n as getRuntimeClassSetSignature } from "./cache-CHs4DXui.mjs";
2
+ import { n as createDebug } from "./runtime-patch-CwN5ya72.mjs";
3
+ import { r as processCachedTask, t as generateCssByGenerator } from "./generator-css-BIapP56i.mjs";
4
+ import { _ as ensureRuntimeClassSet, f as pluginName, g as createTailwindRuntimeReadyPromise, n as getCompilerContext, s as _defineProperty, t as shouldSkipJsTransform, v as refreshTailwindRuntimeState } from "./precheck-B4RH6ZNN.mjs";
5
+ import { r as getGroupedEntries } from "./utils-Btw1iOVV.mjs";
6
+ import { c as upsertTailwindV4CssSource, s as hasConfiguredTailwindV4CssRoots } from "./tailwindcss-C5IgPlQ0.mjs";
7
+ import { a as resolveOutputSpecifier, n as resolvePackageDir, o as toAbsoluteOutputPath, r as resolvePluginDisabledState, t as pushConcurrentTaskFactories } from "./run-tasks-DdNi-hkk.mjs";
7
8
  import Module, { createRequire } from "node:module";
8
9
  import path from "node:path";
9
10
  import process from "node:process";
@@ -27,7 +28,7 @@ function installTailwindcssCssRedirect(pkgDir) {
27
28
  }
28
29
  //#endregion
29
30
  //#region src/shared/mpx.ts
30
- const require = createRequire(import.meta.url);
31
+ const localRequire = createRequire(import.meta.url);
31
32
  const MPX_STYLE_RESOURCE_QUERY_RE$1 = /(?:^|[?&])type=styles(?:&|$)/;
32
33
  function isMpxStyleResourceQuery(query) {
33
34
  if (typeof query !== "string") return false;
@@ -39,6 +40,18 @@ function isMpx(appType) {
39
40
  function getTailwindcssCssEntry(pkgDir) {
40
41
  return path.join(pkgDir, "index.css");
41
42
  }
43
+ function resolveMpxWebpackPluginDir(compiler) {
44
+ const candidates = [
45
+ compiler?.context,
46
+ compiler?.options?.context,
47
+ process.cwd()
48
+ ].filter((item) => typeof item === "string" && item.length > 0);
49
+ for (const candidate of candidates) try {
50
+ const projectRequire = createRequire(path.join(candidate, "package.json"));
51
+ return path.dirname(projectRequire.resolve("@mpxjs/webpack-plugin/package.json"));
52
+ } catch {}
53
+ return path.dirname(localRequire.resolve("@mpxjs/webpack-plugin/package.json"));
54
+ }
42
55
  function isMpxWebpackPluginRequest(request) {
43
56
  return request === "@mpxjs/webpack-plugin" || Boolean(request?.startsWith("@mpxjs/webpack-plugin/"));
44
57
  }
@@ -60,9 +73,9 @@ function ensureResolveLoaderAlias(compiler, mpxWebpackPluginDir) {
60
73
  }
61
74
  function ensureMpxTailwindcssAliases(compiler, pkgDir) {
62
75
  const tailwindcssCssEntry = getTailwindcssCssEntry(pkgDir);
63
- const mpxWebpackPluginDir = path.dirname(require.resolve("@mpxjs/webpack-plugin/package.json"));
64
76
  compiler.options = compiler.options || {};
65
77
  compiler.options.resolve = compiler.options.resolve || {};
78
+ const mpxWebpackPluginDir = resolveMpxWebpackPluginDir(compiler);
66
79
  ensureResolveLoaderAlias(compiler, mpxWebpackPluginDir);
67
80
  const alias = compiler.options.resolve.alias ?? {};
68
81
  compiler.options.resolve.alias = alias;
@@ -170,6 +183,9 @@ function createAssetHashByChunkMap(chunks) {
170
183
  for (const [file, parts] of partsByFile.entries()) hashByFile.set(file, parts.sort().join("|"));
171
184
  return hashByFile;
172
185
  }
186
+ function createRuntimeAwareCssHash(assetHash, sourceHash, runtimeSetHash) {
187
+ return `${assetHash ?? sourceHash}:${runtimeSetHash}`;
188
+ }
173
189
  function hasWatchChanges(compiler) {
174
190
  return (compiler.modifiedFiles?.size ?? 0) > 0 || (compiler.removedFiles?.size ?? 0) > 0;
175
191
  }
@@ -188,7 +204,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
188
204
  }, async (assets) => {
189
205
  compilerOptions.onStart();
190
206
  debug("start");
191
- await runtimeState.patchPromise;
207
+ await runtimeState.readyPromise;
192
208
  for (const chunk of compilation.chunks) if (chunk.id && chunk.hash) compilerOptions.cache.calcHashValueChanged(chunk.id, chunk.hash);
193
209
  const assetHashByChunk = createAssetHashByChunkMap(compilation.chunks);
194
210
  const entries = Object.entries(assets);
@@ -343,8 +359,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
343
359
  const [file, originalSource] = element;
344
360
  const rawSource = originalSource.source().toString();
345
361
  const cacheKey = file;
346
- const chunkHash = assetHashByChunk.get(file);
347
- const runtimeAwareHash = chunkHash ? `${chunkHash}:${runtimeSetHash}` : void 0;
362
+ const runtimeAwareHash = createRuntimeAwareCssHash(assetHashByChunk.get(file), compilerOptions.cache.computeHash(rawSource), runtimeSetHash);
348
363
  tasks.push(processCachedTask({
349
364
  cache: compilerOptions.cache,
350
365
  cacheKey,
@@ -358,7 +373,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
358
373
  debug("css cache hit: %s", file);
359
374
  },
360
375
  transform: async () => {
361
- await runtimeState.patchPromise;
376
+ await runtimeState.readyPromise;
362
377
  const cssHandlerOptions = getCssHandlerOptions(file);
363
378
  const generated = await generateCssByGenerator({
364
379
  opts: compilerOptions,
@@ -388,7 +403,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
388
403
  });
389
404
  }
390
405
  //#endregion
391
- //#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
406
+ //#region ../../node_modules/.pnpm/tsdown@0.22.0_tsx@4.21.0_typescript@6.0.3_unrun@0.2.37_synckit@0.11.12__vue-tsc@3.2.8_typescript@6.0.3_/node_modules/tsdown/esm-shims.js
392
407
  const getFilename = () => fileURLToPath(import.meta.url);
393
408
  const getDirname = () => path.dirname(getFilename());
394
409
  const __dirname = /* @__PURE__ */ getDirname();
@@ -423,7 +438,7 @@ function createLoaderAnchorFinders(appType) {
423
438
  //#endregion
424
439
  //#region src/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.ts
425
440
  function setupWebpackV5Loaders(options) {
426
- const { compiler, options: compilerOptions, appType, weappTailwindcssPackageDir, shouldRewriteCssImports, runtimeLoaderPath, getClassSetInLoader, getRuntimeWatchDependencies, debug } = options;
441
+ const { compiler, options: compilerOptions, appType, weappTailwindcssPackageDir, shouldRewriteCssImports, runtimeLoaderPath, registerAutoCssSource, getClassSetInLoader, getRuntimeWatchDependencies, debug } = options;
427
442
  const isMpxApp = isMpx(appType);
428
443
  if (shouldRewriteCssImports && isMpxApp) ensureMpxTailwindcssAliases(compiler, weappTailwindcssPackageDir);
429
444
  const runtimeClassSetLoader = runtimeLoaderPath ?? path.resolve(__dirname, "./weapp-tw-runtime-classset-loader.js");
@@ -432,7 +447,8 @@ function setupWebpackV5Loaders(options) {
432
447
  const runtimeCssImportRewriteLoaderExists = runtimeCssImportRewriteLoader ? fs.existsSync(runtimeCssImportRewriteLoader) : false;
433
448
  const runtimeLoaderRewriteOptions = shouldRewriteCssImports ? {
434
449
  pkgDir: weappTailwindcssPackageDir,
435
- appType
450
+ appType,
451
+ registerCssSource: registerAutoCssSource
436
452
  } : void 0;
437
453
  const classSetLoaderOptions = {
438
454
  getClassSet: getClassSetInLoader,
@@ -515,7 +531,14 @@ const weappTailwindcssPackageDir = resolvePackageDir("weapp-tailwindcss");
515
531
  */
516
532
  var UnifiedWebpackPluginV5 = class {
517
533
  constructor(options = {}) {
518
- this.options = getCompilerContext(options);
534
+ _defineProperty(this, "options", void 0);
535
+ _defineProperty(this, "appType", void 0);
536
+ _defineProperty(this, "hasInitialTailwindCssRoots", void 0);
537
+ this.hasInitialTailwindCssRoots = hasConfiguredTailwindV4CssRoots(options);
538
+ this.options = getCompilerContext({
539
+ ...options,
540
+ __internalDeferMissingCssEntriesWarning: true
541
+ });
519
542
  this.appType = this.options.appType;
520
543
  }
521
544
  apply(compiler) {
@@ -526,15 +549,10 @@ var UnifiedWebpackPluginV5 = class {
526
549
  const isMpxApp = isMpx(this.appType);
527
550
  if (shouldRewriteCssImports) setupMpxTailwindcssRedirect(weappTailwindcssPackageDir, isMpxApp);
528
551
  if (disabledOptions.plugin) return;
529
- const patchRecorderState = setupPatchRecorder(initialTwPatcher, this.options.tailwindcssBasedir, {
530
- source: "runtime",
531
- cwd: this.options.tailwindcssBasedir ?? process.cwd()
532
- });
533
552
  const runtimeState = {
534
553
  twPatcher: initialTwPatcher,
535
- patchPromise: patchRecorderState.patchPromise,
536
- refreshTailwindcssPatcher,
537
- onPatchCompleted: patchRecorderState.onPatchCompleted
554
+ readyPromise: createTailwindRuntimeReadyPromise(initialTwPatcher),
555
+ refreshTailwindcssPatcher
538
556
  };
539
557
  let runtimeSetPrepared = false;
540
558
  let runtimeSetSignature;
@@ -548,6 +566,10 @@ var UnifiedWebpackPluginV5 = class {
548
566
  const tailwindOptions = resolveTailwindcssOptions(runtimeState.twPatcher.options);
549
567
  if (tailwindOptions?.config) runtimeWatchDependencyFiles.add(tailwindOptions.config);
550
568
  for (const entry of tailwindOptions?.v4?.cssEntries ?? []) runtimeWatchDependencyFiles.add(entry);
569
+ for (const source of tailwindOptions?.v4?.cssSources ?? []) {
570
+ if (source.file) runtimeWatchDependencyFiles.add(source.file);
571
+ for (const dependency of source.dependencies ?? []) runtimeWatchDependencyFiles.add(dependency);
572
+ }
551
573
  for (const source of tailwindOptions?.v4?.sources ?? []) if (source?.base) runtimeWatchDependencyContexts.add(source.base);
552
574
  if (typeof runtimeState.twPatcher.collectContentTokens !== "function") return;
553
575
  try {
@@ -571,6 +593,18 @@ var UnifiedWebpackPluginV5 = class {
571
593
  runtimeMetadataPrepared = false;
572
594
  syncRuntimeRefreshRequirement();
573
595
  };
596
+ const registerAutoCssSource = async (source) => {
597
+ if (this.hasInitialTailwindCssRoots || (runtimeState.twPatcher.majorVersion ?? 0) < 4 || !source.file) return;
598
+ if (!upsertTailwindV4CssSource(this.options, source)) return;
599
+ runtimeSetPrepared = false;
600
+ runtimeMetadataPrepared = false;
601
+ runtimeRefreshRequiredForCompilation = true;
602
+ await refreshTailwindRuntimeState(runtimeState, {
603
+ force: true,
604
+ clearCache: true
605
+ });
606
+ debug("detected tailwindcss v4 css source from webpack css module: %s", source.file);
607
+ };
574
608
  compiler.hooks.invalid?.tap?.(pluginName, () => {
575
609
  runtimeRefreshRequiredForCompilation = true;
576
610
  });
@@ -601,6 +635,7 @@ var UnifiedWebpackPluginV5 = class {
601
635
  weappTailwindcssPackageDir,
602
636
  shouldRewriteCssImports,
603
637
  runtimeLoaderPath,
638
+ registerAutoCssSource,
604
639
  getClassSetInLoader,
605
640
  getRuntimeWatchDependencies() {
606
641
  return {
package/dist/webpack.js CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_webpack = require("./webpack-CICGEKT9.js");
2
+ const require_webpack = require("./webpack-CNV2dx3Q.js");
3
3
  exports.UnifiedWebpackPluginV5 = require_webpack.UnifiedWebpackPluginV5;
4
4
  exports.WeappTailwindcss = require_webpack.UnifiedWebpackPluginV5;
5
5
  exports.weappTailwindcss = require_webpack.UnifiedWebpackPluginV5;
package/dist/webpack.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { n as weappTailwindcssPackageDir, t as UnifiedWebpackPluginV5 } from "./webpack-D2Wdk28V.mjs";
1
+ import { n as weappTailwindcssPackageDir, t as UnifiedWebpackPluginV5 } from "./webpack-CT6EEENx.mjs";
2
2
  export { UnifiedWebpackPluginV5, UnifiedWebpackPluginV5 as WeappTailwindcss, UnifiedWebpackPluginV5 as weappTailwindcss, weappTailwindcssPackageDir };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "weapp-tailwindcss",
3
- "version": "5.0.0-next.5",
3
+ "version": "5.0.0-next.8",
4
4
  "description": "把 tailwindcss 原子化样式思想,带给小程序开发者们! bring tailwindcss to miniprogram developers!",
5
5
  "author": "ice breaker <1324318532@qq.com>",
6
6
  "license": "MIT",
@@ -172,12 +172,10 @@
172
172
  "@babel/parser": "~7.29.3",
173
173
  "@babel/traverse": "~7.29.0",
174
174
  "@babel/types": "~7.29.0",
175
- "@tailwindcss-mangle/config": "^7.0.1",
176
175
  "@vue/compiler-dom": "^3.5.34",
177
176
  "@vue/compiler-sfc": "^3.5.34",
178
177
  "@weapp-core/escape": "~7.0.0",
179
178
  "@weapp-core/regex": "~1.0.1",
180
- "cac": "6.7.14",
181
179
  "comment-json": "^4.6.2",
182
180
  "debug": "~4.4.3",
183
181
  "fast-glob": "^3.3.3",
@@ -187,15 +185,14 @@
187
185
  "lru-cache": "10.4.3",
188
186
  "magic-string": "0.30.21",
189
187
  "postcss-load-config": "^6.0.1",
190
- "semver": "~7.7.4",
191
- "tailwindcss-patch": "9.3.2",
192
- "webpack-sources": "3.3.4",
193
- "yaml": "^2.8.4",
194
- "@weapp-tailwindcss/postcss": "2.2.1-next.0",
188
+ "semver": "~7.8.0",
189
+ "tailwindcss-patch": "9.3.3",
190
+ "yaml": "^2.9.0",
195
191
  "@weapp-tailwindcss/logger": "1.1.0",
192
+ "@weapp-tailwindcss/postcss": "2.2.1-next.1",
196
193
  "@weapp-tailwindcss/reset": "0.1.1-next.0",
197
194
  "@weapp-tailwindcss/shared": "1.1.3",
198
- "tailwindcss-config": "1.1.6-next.0"
195
+ "tailwindcss-config": "1.1.6-next.1"
199
196
  },
200
197
  "scripts": {
201
198
  "dev": "tsdown --watch --sourcemap",
@@ -1,5 +0,0 @@
1
- export interface GeneratorCandidateSource {
2
- content: string;
3
- extension?: string;
4
- }
5
- export declare function collectGeneratorCandidatesFromSources(sources: GeneratorCandidateSource[], baseCandidates?: Iterable<string>): Promise<Set<string>>;
@@ -1,6 +0,0 @@
1
- import type { AppType } from '../../../types';
2
- export declare function applyTailwindcssCssImportRewrite(compiler: any, options: {
3
- pkgDir: string;
4
- enabled: boolean;
5
- appType?: AppType;
6
- }): void;
@@ -1,5 +0,0 @@
1
- export interface TailwindcssMangleConfigModule {
2
- initConfig: (cwd: string) => Promise<void>;
3
- CONFIG_NAME: string;
4
- }
5
- export declare function loadTailwindcssMangleConfig(): Promise<TailwindcssMangleConfigModule | undefined>;
@@ -1 +0,0 @@
1
- export declare function resolvePatchDefaultCwd(currentCwd?: string): string;
@@ -1,2 +0,0 @@
1
- import type { PatchStatusReport } from 'tailwindcss-patch';
2
- export declare function logPatchStatusReport(report: PatchStatusReport): void;
@@ -1,6 +0,0 @@
1
- import type { TailwindCssPatchOptions } from 'tailwindcss-patch';
2
- type ExtendLengthUnitsFeature = Exclude<NonNullable<NonNullable<TailwindCssPatchOptions['apply']>['extendLengthUnits']>, false>;
3
- export declare const DEFAULT_EXTEND_LENGTH_UNITS_FEATURE: ExtendLengthUnitsFeature;
4
- export declare function withDefaultExtendLengthUnits(options: TailwindCssPatchOptions | undefined): TailwindCssPatchOptions;
5
- export declare function buildExtendLengthUnitsOverride(options: TailwindCssPatchOptions | undefined): TailwindCssPatchOptions | undefined;
6
- export {};
@@ -1,4 +0,0 @@
1
- import type { TailwindTokenReport } from 'tailwindcss-patch';
2
- export declare function collectTailwindTokens(patcher: unknown): Promise<TailwindTokenReport>;
3
- export declare function formatTokenLine(entry: TailwindTokenReport['entries'][number]): string;
4
- export declare function logTokenPreview(report: TailwindTokenReport, format: string, groupKey: 'relative' | 'absolute'): void;
@@ -1,3 +0,0 @@
1
- import { tryReadJson } from './workspace-io';
2
- export declare function resolveWorkspacePackageDirs(workspaceRoot: string): Promise<string[]>;
3
- export { tryReadJson };
@@ -1,3 +0,0 @@
1
- import type { WorkspacePatchOptions, WorkspacePatchResult } from './types';
2
- export declare function patchWorkspacePackage(workspaceRoot: string, dir: string, pkgName: string | undefined, options: WorkspacePatchOptions): Promise<WorkspacePatchResult>;
3
- export { summarizeWorkspaceResults } from './patch-utils';
@@ -1,3 +0,0 @@
1
- import type { WorkspacePatchResult } from './types';
2
- export declare function formatDisplayName(workspaceRoot: string, dir: string, name?: string): string;
3
- export declare function summarizeWorkspaceResults(results: WorkspacePatchResult[]): void;
@@ -1,11 +0,0 @@
1
- export interface WorkspacePatchOptions {
2
- cwd: string | undefined;
3
- clearCache?: boolean;
4
- recordTarget?: boolean;
5
- }
6
- export interface WorkspacePatchResult {
7
- dir: string;
8
- name?: string;
9
- status: 'patched' | 'skipped' | 'failed';
10
- message?: string;
11
- }
@@ -1,2 +0,0 @@
1
- export declare function parseWorkspaceGlobsFromPackageJson(workspaceRoot: string): string[];
2
- export declare function parseWorkspaceGlobsFromWorkspaceFile(workspaceRoot: string): string[];
@@ -1 +0,0 @@
1
- export declare function tryReadJson<T extends Record<string, any>>(file: string): T | undefined;
@@ -1 +0,0 @@
1
- export declare function parseImportersFromLock(workspaceRoot: string): string[];
@@ -1,2 +0,0 @@
1
- import type { WorkspacePatchOptions } from './workspace/types';
2
- export declare function patchWorkspace(options: WorkspacePatchOptions): Promise<void>;
@@ -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
- };