weapp-tailwindcss 5.1.7 → 5.1.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 (75) hide show
  1. package/dist/bundlers/framework-selector.d.ts +26 -0
  2. package/dist/bundlers/gulp/frameworks/native/index.d.ts +6 -0
  3. package/dist/bundlers/gulp/index.d.ts +4 -4
  4. package/dist/bundlers/gulp/shared/create-native-framework-plugins.d.ts +6 -0
  5. package/dist/bundlers/vite/css-finalizer.d.ts +2 -0
  6. package/dist/bundlers/vite/frameworks/generic/index.d.ts +2 -0
  7. package/dist/bundlers/vite/frameworks/taro/index.d.ts +2 -0
  8. package/dist/bundlers/vite/frameworks/uni-app/index.d.ts +2 -0
  9. package/dist/bundlers/vite/frameworks/uni-app-x/index.d.ts +2 -0
  10. package/dist/bundlers/vite/frameworks/weapp-vite/index.d.ts +2 -0
  11. package/dist/bundlers/vite/generate-bundle/css-output-helpers.d.ts +5 -1
  12. package/dist/bundlers/vite/generate-bundle/finalize.d.ts +5 -1
  13. package/dist/bundlers/vite/generate-bundle/root-style-output.d.ts +2 -2
  14. package/dist/bundlers/vite/generate-bundle/sfc-style-source.d.ts +8 -0
  15. package/dist/bundlers/vite/generate-bundle/types.d.ts +2 -0
  16. package/dist/bundlers/vite/index.d.ts +2 -4
  17. package/dist/bundlers/vite/processed-css-assets.d.ts +5 -0
  18. package/dist/bundlers/vite/shared/create-framework-plugins.d.ts +35 -0
  19. package/dist/bundlers/vite/shared/framework-strategy.d.ts +88 -0
  20. package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +1 -2
  21. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers.d.ts +1 -0
  22. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +3 -0
  23. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +1 -2
  24. package/dist/bundlers/webpack/frameworks/generic/index.d.ts +5 -0
  25. package/dist/bundlers/webpack/frameworks/index.d.ts +8 -0
  26. package/dist/bundlers/webpack/frameworks/mpx/index.d.ts +5 -0
  27. package/dist/bundlers/webpack/frameworks/taro/index.d.ts +5 -0
  28. package/dist/bundlers/webpack/frameworks/uni-app/index.d.ts +5 -0
  29. package/dist/bundlers/webpack/frameworks/weapp-vite/index.d.ts +5 -0
  30. package/dist/bundlers/webpack/shared/create-framework-plugin.d.ts +21 -0
  31. package/dist/bundlers/webpack/shared/loader-anchors.d.ts +4 -3
  32. package/dist/cli.js +8 -0
  33. package/dist/cli.mjs +8 -0
  34. package/dist/{context-C7KTDlrG.js → context-CRhUs_5e.js} +11 -3
  35. package/dist/{context-BqeDu1Ha.mjs → context-CfXr3hWz.mjs} +11 -3
  36. package/dist/core.js +1 -1
  37. package/dist/core.mjs +1 -1
  38. package/dist/{generator-DASZwC6t.js → generator-DaaFxR5V.js} +1 -1
  39. package/dist/{generator-BOt2Tvx3.mjs → generator-DugIHBgl.mjs} +1 -1
  40. package/dist/generator.js +2 -2
  41. package/dist/generator.mjs +2 -2
  42. package/dist/{gulp-alDZryyB.mjs → gulp-CRjkPsbX.mjs} +22 -7
  43. package/dist/{gulp-D6hsaTLM.js → gulp-JUfnhOOo.js} +22 -7
  44. package/dist/gulp.js +1 -1
  45. package/dist/gulp.mjs +1 -1
  46. package/dist/{hmr-timing-CYwVMRol.mjs → hmr-timing-BecOXMd8.mjs} +5 -5
  47. package/dist/{hmr-timing-BIr_CiPW.js → hmr-timing-DcIEXnf8.js} +5 -5
  48. package/dist/index.js +4 -4
  49. package/dist/index.mjs +4 -4
  50. package/dist/postcss.js +2 -2
  51. package/dist/postcss.mjs +2 -2
  52. package/dist/presets.js +2 -2
  53. package/dist/presets.mjs +2 -2
  54. package/dist/rspack.js +1 -1
  55. package/dist/rspack.mjs +1 -1
  56. package/dist/{source-candidate-scan-signature-Djr2Hw8y.js → source-candidate-scan-signature-10tvdJVC.js} +185 -98
  57. package/dist/{source-candidate-scan-signature-D97ZEXcj.mjs → source-candidate-scan-signature-DAg8QSgh.mjs} +162 -99
  58. package/dist/style-injector/internal.d.ts +18 -4
  59. package/dist/{tailwindcss-DPxJpRVP.js → tailwindcss-BZjZZi60.js} +1 -1
  60. package/dist/{tailwindcss-DDGD90w7.mjs → tailwindcss-PA2jHHpx.mjs} +1 -1
  61. package/dist/{transform-CvqqZBuq.js → transform-B0BxX3XB.js} +1 -1
  62. package/dist/{transform-DPPr79r2.mjs → transform-wNEbcZeQ.mjs} +1 -1
  63. package/dist/uni-app-x/vite.d.ts +1 -0
  64. package/dist/{v4-engine-3UmJkAY7.js → v4-engine-BZP2462H.js} +12 -0
  65. package/dist/{v4-engine-CYSrDVNp.mjs → v4-engine-CjjWONB0.mjs} +12 -0
  66. package/dist/{vite-BJRlG835.js → vite-GdzlG_lx.js} +1286 -818
  67. package/dist/{vite-XxJh7Xtu.mjs → vite-vf2-cDdk.mjs} +1284 -816
  68. package/dist/vite.js +1 -1
  69. package/dist/vite.mjs +1 -1
  70. package/dist/weapp-tw-css-import-rewrite-loader.js +21 -1
  71. package/dist/{webpack-eN8WzIT-.mjs → webpack-2s-TFhgm.mjs} +321 -216
  72. package/dist/{webpack-BxBOMUtY.js → webpack-BhM4Hqla.js} +320 -215
  73. package/dist/webpack.js +1 -1
  74. package/dist/webpack.mjs +1 -1
  75. package/package.json +3 -3
@@ -1,8 +1,9 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.js");
2
+ const require_framework = require("./framework.js");
2
3
  require("./auto-DtU6f3X6.js");
3
- const require_context = require("./context-C7KTDlrG.js");
4
- const require_tailwindcss = require("./tailwindcss-DPxJpRVP.js");
5
- const require_hmr_timing = require("./hmr-timing-BIr_CiPW.js");
4
+ const require_context = require("./context-CRhUs_5e.js");
5
+ const require_tailwindcss = require("./tailwindcss-BZjZZi60.js");
6
+ const require_hmr_timing = require("./hmr-timing-DcIEXnf8.js");
6
7
  let node_path = require("node:path");
7
8
  node_path = require_rolldown_runtime.__toESM(node_path);
8
9
  let node_process = require("node:process");
@@ -18,6 +19,69 @@ let weapp_style_injector_webpack_mpx = require("weapp-style-injector/webpack/mpx
18
19
  let weapp_style_injector_webpack_taro = require("weapp-style-injector/webpack/taro");
19
20
  let weapp_style_injector_webpack_uni_app = require("weapp-style-injector/webpack/uni-app");
20
21
  let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
22
+ //#region src/bundlers/framework-selector.ts
23
+ function resolveBundlerAppType(options) {
24
+ if (options.appType) return options.appType;
25
+ return require_framework.detectAppType({
26
+ cwd: options.cwd,
27
+ detectEnv: options.detectEnv,
28
+ env: options.env,
29
+ manifest: options.manifest,
30
+ packageJson: options.packageJson,
31
+ root: options.root,
32
+ searchUp: options.searchUp
33
+ });
34
+ }
35
+ function isUniAppXFramework(appType, uniAppX) {
36
+ return appType === "uni-app-x" || require_tailwindcss.resolveUniAppXOptions(uniAppX).enabled;
37
+ }
38
+ function resolveViteFrameworkProfile(options) {
39
+ const appType = resolveBundlerAppType(options);
40
+ if (isUniAppXFramework(appType, options.uniAppX)) return {
41
+ appType,
42
+ frameworkName: "uni-app-x"
43
+ };
44
+ if (appType === "uni-app" || appType === "uni-app-vite") return {
45
+ appType,
46
+ frameworkName: "uni-app"
47
+ };
48
+ if (appType === "taro") return {
49
+ appType,
50
+ frameworkName: "taro"
51
+ };
52
+ if (appType === "weapp-vite") return {
53
+ appType,
54
+ frameworkName: "weapp-vite"
55
+ };
56
+ return {
57
+ appType,
58
+ frameworkName: "generic"
59
+ };
60
+ }
61
+ function resolveWebpackFrameworkProfile(options) {
62
+ const appType = resolveBundlerAppType(options);
63
+ if (appType === "mpx") return {
64
+ appType,
65
+ frameworkName: "mpx"
66
+ };
67
+ if (appType === "taro") return {
68
+ appType,
69
+ frameworkName: "taro"
70
+ };
71
+ if (appType === "uni-app" || appType === "uni-app-vite" || isUniAppXFramework(appType, options.uniAppX)) return {
72
+ appType,
73
+ frameworkName: "uni-app"
74
+ };
75
+ if (appType === "weapp-vite") return {
76
+ appType,
77
+ frameworkName: "weapp-vite"
78
+ };
79
+ return {
80
+ appType,
81
+ frameworkName: "generic"
82
+ };
83
+ }
84
+ //#endregion
21
85
  //#region src/style-injector/options.ts
22
86
  function normalizeStyleInjectorOptions(options) {
23
87
  if (options === true) return {};
@@ -29,12 +93,6 @@ function normalizeStyleInjectorOptions(options) {
29
93
  function toPluginArray(pluginOrPlugins) {
30
94
  return Array.isArray(pluginOrPlugins) ? pluginOrPlugins : [pluginOrPlugins];
31
95
  }
32
- function isUniAppViteStyleInjectorApp(appType) {
33
- return appType === "uni-app-vite" || appType === "uni-app-x";
34
- }
35
- function isUniAppWebpackStyleInjectorApp(appType) {
36
- return appType === "uni-app" || appType === "uni-app-vite" || appType === "uni-app-x";
37
- }
38
96
  function normalizeWebpackStyleInjectorOptions(options) {
39
97
  const normalized = normalizeStyleInjectorOptions(options);
40
98
  if (!normalized) return;
@@ -60,7 +118,18 @@ function getGenerateBundleHandler(hook) {
60
118
  if (typeof hook === "function") return hook;
61
119
  if (hook && typeof hook === "object" && typeof hook.handler === "function") return hook.handler;
62
120
  }
63
- function createBuiltinViteStyleInjectorPlugins(options, getAppType) {
121
+ const viteStyleInjectorDelegates = {
122
+ generic: ((options) => [(0, weapp_style_injector_vite.weappStyleInjector)(options)]),
123
+ taro: ((options) => toPluginArray((0, weapp_style_injector_vite_taro.StyleInjector)(options))),
124
+ uniApp: ((options) => toPluginArray((0, weapp_style_injector_vite_uni_app.StyleInjector)(options)))
125
+ };
126
+ const webpackStyleInjectorDelegates = {
127
+ generic: ((options) => (0, weapp_style_injector_webpack.weappStyleInjectorWebpack)(options)),
128
+ mpx: ((options) => (0, weapp_style_injector_webpack_mpx.StyleInjector)(options)),
129
+ taro: ((options) => (0, weapp_style_injector_webpack_taro.StyleInjector)(options)),
130
+ uniApp: ((options) => (0, weapp_style_injector_webpack_uni_app.StyleInjector)(options))
131
+ };
132
+ function createBuiltinViteStyleInjectorPlugins(options, getDelegateFactory) {
64
133
  const normalized = normalizeStyleInjectorOptions(options);
65
134
  if (!normalized) return [];
66
135
  let config;
@@ -69,10 +138,7 @@ function createBuiltinViteStyleInjectorPlugins(options, getAppType) {
69
138
  let delegatesBuildStarted = false;
70
139
  const resolveDelegates = () => {
71
140
  if (delegates) return delegates;
72
- const appType = getAppType();
73
- if (isUniAppViteStyleInjectorApp(appType)) delegates = toPluginArray((0, weapp_style_injector_vite_uni_app.StyleInjector)(normalized));
74
- else if (appType === "taro") delegates = toPluginArray((0, weapp_style_injector_vite_taro.StyleInjector)(normalized));
75
- else delegates = [(0, weapp_style_injector_vite.weappStyleInjector)(normalized)];
141
+ delegates = getDelegateFactory()(normalized);
76
142
  return delegates;
77
143
  };
78
144
  const configureDelegates = async () => {
@@ -143,13 +209,56 @@ function createBuiltinViteStyleInjectorPlugins(options, getAppType) {
143
209
  }
144
210
  }];
145
211
  }
146
- function createBuiltinWebpackStyleInjectorPlugin(options, appType) {
212
+ function createBuiltinWebpackStyleInjectorPlugin(options, delegateFactory) {
147
213
  const normalized = normalizeWebpackStyleInjectorOptions(options);
148
214
  if (!normalized) return;
149
- if (isUniAppWebpackStyleInjectorApp(appType)) return (0, weapp_style_injector_webpack_uni_app.StyleInjector)(normalized);
150
- if (appType === "taro") return (0, weapp_style_injector_webpack_taro.StyleInjector)(normalized);
151
- if (appType === "mpx") return (0, weapp_style_injector_webpack_mpx.StyleInjector)(normalized);
152
- return (0, weapp_style_injector_webpack.weappStyleInjectorWebpack)(normalized);
215
+ return delegateFactory(normalized);
216
+ }
217
+ //#endregion
218
+ //#region src/utils/disabled.ts
219
+ function resolvePluginDisabledState(disabled) {
220
+ if (disabled === true) return { plugin: true };
221
+ if (disabled === false || disabled == null) return { plugin: false };
222
+ return { plugin: disabled.plugin ?? false };
223
+ }
224
+ //#endregion
225
+ //#region src/utils/resolve-package.ts
226
+ const require$1 = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
227
+ function resolvePackageDir(name) {
228
+ const pkgPath = require$1.resolve(`${name}/package.json`);
229
+ return node_path.default.dirname(pkgPath);
230
+ }
231
+ //#endregion
232
+ //#region src/bundlers/shared/generated-css-marker.ts
233
+ const BUNDLER_GENERATED_CSS_MARKER_RE = /\/\*!?\s*weapp-tailwindcss (?:vite|webpack)-generated-css(?:\s*:\s*[^\s*]+)?\s*\*\/\s*/i;
234
+ const BUNDLER_GENERATED_CSS_MARKER_GLOBAL_RE = /\/\*!?\s*weapp-tailwindcss (?:vite|webpack)-generated-css(?:\s*:\s*[^\s*]+)?\s*\*\/\s*/gi;
235
+ const BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE = /\/\*!?\s*weapp-tailwindcss (vite|webpack)-generated-css(?:\s*:\s*([^\s*]+))?\s*\*\/\s*/gi;
236
+ function createBundlerGeneratedCssMarker(bundler, file) {
237
+ return `/*! weapp-tailwindcss ${bundler}-generated-css:${encodeURIComponent(file)} */`;
238
+ }
239
+ function hasBundlerGeneratedCssMarker(source) {
240
+ return typeof source === "string" && BUNDLER_GENERATED_CSS_MARKER_RE.test(source);
241
+ }
242
+ function stripBundlerGeneratedCssMarkers(source) {
243
+ return source.replace(BUNDLER_GENERATED_CSS_MARKER_GLOBAL_RE, "");
244
+ }
245
+ function parseBundlerGeneratedCssMarkerBlocks(source) {
246
+ const blocks = [];
247
+ BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.lastIndex = 0;
248
+ let match = BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.exec(source);
249
+ while (match !== null) {
250
+ const cssStart = BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.lastIndex;
251
+ const nextMatch = BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.exec(source);
252
+ const cssEnd = nextMatch?.index ?? source.length;
253
+ const file = match[2] ? decodeURIComponent(match[2]) : void 0;
254
+ blocks.push({
255
+ bundler: match[1],
256
+ file,
257
+ css: source.slice(cssStart, cssEnd)
258
+ });
259
+ match = nextMatch;
260
+ }
261
+ return blocks;
153
262
  }
154
263
  //#endregion
155
264
  //#region src/bundlers/shared/module-graph.ts
@@ -220,85 +329,6 @@ function isSourceStyleRequest(request) {
220
329
  return STYLE_QUERY_RE.test(query) || STYLE_LANG_QUERY_RE.test(query);
221
330
  }
222
331
  //#endregion
223
- //#region src/bundlers/vite/utils.ts
224
- function slash(p) {
225
- return (0, _weapp_tailwindcss_shared.ensurePosix)(p);
226
- }
227
- const isWindows = node_process.default.platform === "win32";
228
- const cssLangRE = new RegExp(`\\.(?:css|less|sass|scss|styl|stylus|pcss|postcss)(?:$|\\?)`);
229
- const htmlLangRE = /\.html?(?:$|\?)/;
230
- function isCSSRequest(request) {
231
- return cssLangRE.test(request) || isSourceStyleRequest(request);
232
- }
233
- function isHTMLRequest(request) {
234
- return htmlLangRE.test(request);
235
- }
236
- function normalizePath(id) {
237
- return node_path.default.posix.normalize(isWindows ? (0, _weapp_tailwindcss_shared.ensurePosix)(id) : id);
238
- }
239
- async function formatPostcssSourceMap(rawMap, file) {
240
- const inputFileDir = node_path.default.dirname(file);
241
- const sources = rawMap.sources.map((source) => {
242
- const cleanSource = (0, _weapp_tailwindcss_shared.cleanUrl)(decodeURIComponent(source));
243
- if (cleanSource[0] === "<" && cleanSource.endsWith(">")) return `\0${cleanSource}`;
244
- return normalizePath(node_path.default.resolve(inputFileDir, cleanSource));
245
- });
246
- return {
247
- file,
248
- mappings: rawMap.mappings,
249
- names: rawMap.names,
250
- sources,
251
- sourcesContent: rawMap.sourcesContent,
252
- version: rawMap.version
253
- };
254
- }
255
- //#endregion
256
- //#region src/utils/disabled.ts
257
- function resolvePluginDisabledState(disabled) {
258
- if (disabled === true) return { plugin: true };
259
- if (disabled === false || disabled == null) return { plugin: false };
260
- return { plugin: disabled.plugin ?? false };
261
- }
262
- //#endregion
263
- //#region src/utils/resolve-package.ts
264
- const require$1 = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
265
- function resolvePackageDir(name) {
266
- const pkgPath = require$1.resolve(`${name}/package.json`);
267
- return node_path.default.dirname(pkgPath);
268
- }
269
- //#endregion
270
- //#region src/bundlers/shared/generated-css-marker.ts
271
- const BUNDLER_GENERATED_CSS_MARKER_RE = /\/\*!?\s*weapp-tailwindcss (?:vite|webpack)-generated-css(?:\s*:\s*[^\s*]+)?\s*\*\/\s*/i;
272
- const BUNDLER_GENERATED_CSS_MARKER_GLOBAL_RE = /\/\*!?\s*weapp-tailwindcss (?:vite|webpack)-generated-css(?:\s*:\s*[^\s*]+)?\s*\*\/\s*/gi;
273
- const BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE = /\/\*!?\s*weapp-tailwindcss (vite|webpack)-generated-css(?:\s*:\s*([^\s*]+))?\s*\*\/\s*/gi;
274
- function createBundlerGeneratedCssMarker(bundler, file) {
275
- return `/*! weapp-tailwindcss ${bundler}-generated-css:${encodeURIComponent(file)} */`;
276
- }
277
- function hasBundlerGeneratedCssMarker(source) {
278
- return typeof source === "string" && BUNDLER_GENERATED_CSS_MARKER_RE.test(source);
279
- }
280
- function stripBundlerGeneratedCssMarkers(source) {
281
- return source.replace(BUNDLER_GENERATED_CSS_MARKER_GLOBAL_RE, "");
282
- }
283
- function parseBundlerGeneratedCssMarkerBlocks(source) {
284
- const blocks = [];
285
- BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.lastIndex = 0;
286
- let match = BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.exec(source);
287
- while (match !== null) {
288
- const cssStart = BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.lastIndex;
289
- const nextMatch = BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.exec(source);
290
- const cssEnd = nextMatch?.index ?? source.length;
291
- const file = match[2] ? decodeURIComponent(match[2]) : void 0;
292
- blocks.push({
293
- bundler: match[1],
294
- file,
295
- css: source.slice(cssStart, cssEnd)
296
- });
297
- match = nextMatch;
298
- }
299
- return blocks;
300
- }
301
- //#endregion
302
332
  //#region src/bundlers/shared/v4-generation-core.ts
303
333
  async function generateTailwindV4Css(options) {
304
334
  const majorVersion = options.runtimeState.tailwindRuntime.majorVersion;
@@ -437,6 +467,39 @@ function createRuntimeAffectingSourceSignature(source, type) {
437
467
  return source;
438
468
  }
439
469
  //#endregion
470
+ //#region src/bundlers/vite/utils.ts
471
+ function slash(p) {
472
+ return (0, _weapp_tailwindcss_shared.ensurePosix)(p);
473
+ }
474
+ const isWindows = node_process.default.platform === "win32";
475
+ const cssLangRE = new RegExp(`\\.(?:css|less|sass|scss|styl|stylus|pcss|postcss)(?:$|\\?)`);
476
+ const htmlLangRE = /\.html?(?:$|\?)/;
477
+ function isCSSRequest(request) {
478
+ return cssLangRE.test(request) || isSourceStyleRequest(request);
479
+ }
480
+ function isHTMLRequest(request) {
481
+ return htmlLangRE.test(request);
482
+ }
483
+ function normalizePath(id) {
484
+ return node_path.default.posix.normalize(isWindows ? (0, _weapp_tailwindcss_shared.ensurePosix)(id) : id);
485
+ }
486
+ async function formatPostcssSourceMap(rawMap, file) {
487
+ const inputFileDir = node_path.default.dirname(file);
488
+ const sources = rawMap.sources.map((source) => {
489
+ const cleanSource = (0, _weapp_tailwindcss_shared.cleanUrl)(decodeURIComponent(source));
490
+ if (cleanSource[0] === "<" && cleanSource.endsWith(">")) return `\0${cleanSource}`;
491
+ return normalizePath(node_path.default.resolve(inputFileDir, cleanSource));
492
+ });
493
+ return {
494
+ file,
495
+ mappings: rawMap.mappings,
496
+ names: rawMap.names,
497
+ sources,
498
+ sourcesContent: rawMap.sourcesContent,
499
+ version: rawMap.version
500
+ };
501
+ }
502
+ //#endregion
440
503
  //#region src/bundlers/vite/bundle-state.ts
441
504
  function createBundleBuildState() {
442
505
  return {
@@ -904,6 +967,18 @@ Object.defineProperty(exports, "resolvePluginDisabledState", {
904
967
  return resolvePluginDisabledState;
905
968
  }
906
969
  });
970
+ Object.defineProperty(exports, "resolveViteFrameworkProfile", {
971
+ enumerable: true,
972
+ get: function() {
973
+ return resolveViteFrameworkProfile;
974
+ }
975
+ });
976
+ Object.defineProperty(exports, "resolveWebpackFrameworkProfile", {
977
+ enumerable: true,
978
+ get: function() {
979
+ return resolveWebpackFrameworkProfile;
980
+ }
981
+ });
907
982
  Object.defineProperty(exports, "slash", {
908
983
  enumerable: true,
909
984
  get: function() {
@@ -940,3 +1015,15 @@ Object.defineProperty(exports, "updateBundleBuildState", {
940
1015
  return updateBundleBuildState;
941
1016
  }
942
1017
  });
1018
+ Object.defineProperty(exports, "viteStyleInjectorDelegates", {
1019
+ enumerable: true,
1020
+ get: function() {
1021
+ return viteStyleInjectorDelegates;
1022
+ }
1023
+ });
1024
+ Object.defineProperty(exports, "webpackStyleInjectorDelegates", {
1025
+ enumerable: true,
1026
+ get: function() {
1027
+ return webpackStyleInjectorDelegates;
1028
+ }
1029
+ });
@@ -1,7 +1,8 @@
1
+ import { detectAppType } from "./framework.mjs";
1
2
  import { n as hasCssMacroTailwindV4CustomVariantConditionalComments } from "./auto-CrJJc5rK.mjs";
2
- import { g as traverse, h as babelParse, o as Parser } from "./context-BqeDu1Ha.mjs";
3
- import { g as resolveTailwindV4EntriesFromCssCached } from "./tailwindcss-DDGD90w7.mjs";
4
- import { u as generateCssByGenerator } from "./hmr-timing-CYwVMRol.mjs";
3
+ import { g as traverse, h as babelParse, o as Parser } from "./context-CfXr3hWz.mjs";
4
+ import { g as resolveTailwindV4EntriesFromCssCached, i as resolveUniAppXOptions } from "./tailwindcss-PA2jHHpx.mjs";
5
+ import { u as generateCssByGenerator } from "./hmr-timing-BecOXMd8.mjs";
5
6
  import { createRequire } from "node:module";
6
7
  import path from "node:path";
7
8
  import process from "node:process";
@@ -14,6 +15,69 @@ import { weappStyleInjectorWebpack } from "weapp-style-injector/webpack";
14
15
  import { StyleInjector as StyleInjector$2 } from "weapp-style-injector/webpack/mpx";
15
16
  import { StyleInjector as StyleInjector$3 } from "weapp-style-injector/webpack/taro";
16
17
  import { StyleInjector as StyleInjector$4 } from "weapp-style-injector/webpack/uni-app";
18
+ //#region src/bundlers/framework-selector.ts
19
+ function resolveBundlerAppType(options) {
20
+ if (options.appType) return options.appType;
21
+ return detectAppType({
22
+ cwd: options.cwd,
23
+ detectEnv: options.detectEnv,
24
+ env: options.env,
25
+ manifest: options.manifest,
26
+ packageJson: options.packageJson,
27
+ root: options.root,
28
+ searchUp: options.searchUp
29
+ });
30
+ }
31
+ function isUniAppXFramework(appType, uniAppX) {
32
+ return appType === "uni-app-x" || resolveUniAppXOptions(uniAppX).enabled;
33
+ }
34
+ function resolveViteFrameworkProfile(options) {
35
+ const appType = resolveBundlerAppType(options);
36
+ if (isUniAppXFramework(appType, options.uniAppX)) return {
37
+ appType,
38
+ frameworkName: "uni-app-x"
39
+ };
40
+ if (appType === "uni-app" || appType === "uni-app-vite") return {
41
+ appType,
42
+ frameworkName: "uni-app"
43
+ };
44
+ if (appType === "taro") return {
45
+ appType,
46
+ frameworkName: "taro"
47
+ };
48
+ if (appType === "weapp-vite") return {
49
+ appType,
50
+ frameworkName: "weapp-vite"
51
+ };
52
+ return {
53
+ appType,
54
+ frameworkName: "generic"
55
+ };
56
+ }
57
+ function resolveWebpackFrameworkProfile(options) {
58
+ const appType = resolveBundlerAppType(options);
59
+ if (appType === "mpx") return {
60
+ appType,
61
+ frameworkName: "mpx"
62
+ };
63
+ if (appType === "taro") return {
64
+ appType,
65
+ frameworkName: "taro"
66
+ };
67
+ if (appType === "uni-app" || appType === "uni-app-vite" || isUniAppXFramework(appType, options.uniAppX)) return {
68
+ appType,
69
+ frameworkName: "uni-app"
70
+ };
71
+ if (appType === "weapp-vite") return {
72
+ appType,
73
+ frameworkName: "weapp-vite"
74
+ };
75
+ return {
76
+ appType,
77
+ frameworkName: "generic"
78
+ };
79
+ }
80
+ //#endregion
17
81
  //#region src/style-injector/options.ts
18
82
  function normalizeStyleInjectorOptions(options) {
19
83
  if (options === true) return {};
@@ -25,12 +89,6 @@ function normalizeStyleInjectorOptions(options) {
25
89
  function toPluginArray(pluginOrPlugins) {
26
90
  return Array.isArray(pluginOrPlugins) ? pluginOrPlugins : [pluginOrPlugins];
27
91
  }
28
- function isUniAppViteStyleInjectorApp(appType) {
29
- return appType === "uni-app-vite" || appType === "uni-app-x";
30
- }
31
- function isUniAppWebpackStyleInjectorApp(appType) {
32
- return appType === "uni-app" || appType === "uni-app-vite" || appType === "uni-app-x";
33
- }
34
92
  function normalizeWebpackStyleInjectorOptions(options) {
35
93
  const normalized = normalizeStyleInjectorOptions(options);
36
94
  if (!normalized) return;
@@ -56,7 +114,18 @@ function getGenerateBundleHandler(hook) {
56
114
  if (typeof hook === "function") return hook;
57
115
  if (hook && typeof hook === "object" && typeof hook.handler === "function") return hook.handler;
58
116
  }
59
- function createBuiltinViteStyleInjectorPlugins(options, getAppType) {
117
+ const viteStyleInjectorDelegates = {
118
+ generic: ((options) => [weappStyleInjector(options)]),
119
+ taro: ((options) => toPluginArray(StyleInjector(options))),
120
+ uniApp: ((options) => toPluginArray(StyleInjector$1(options)))
121
+ };
122
+ const webpackStyleInjectorDelegates = {
123
+ generic: ((options) => weappStyleInjectorWebpack(options)),
124
+ mpx: ((options) => StyleInjector$2(options)),
125
+ taro: ((options) => StyleInjector$3(options)),
126
+ uniApp: ((options) => StyleInjector$4(options))
127
+ };
128
+ function createBuiltinViteStyleInjectorPlugins(options, getDelegateFactory) {
60
129
  const normalized = normalizeStyleInjectorOptions(options);
61
130
  if (!normalized) return [];
62
131
  let config;
@@ -65,10 +134,7 @@ function createBuiltinViteStyleInjectorPlugins(options, getAppType) {
65
134
  let delegatesBuildStarted = false;
66
135
  const resolveDelegates = () => {
67
136
  if (delegates) return delegates;
68
- const appType = getAppType();
69
- if (isUniAppViteStyleInjectorApp(appType)) delegates = toPluginArray(StyleInjector$1(normalized));
70
- else if (appType === "taro") delegates = toPluginArray(StyleInjector(normalized));
71
- else delegates = [weappStyleInjector(normalized)];
137
+ delegates = getDelegateFactory()(normalized);
72
138
  return delegates;
73
139
  };
74
140
  const configureDelegates = async () => {
@@ -139,13 +205,56 @@ function createBuiltinViteStyleInjectorPlugins(options, getAppType) {
139
205
  }
140
206
  }];
141
207
  }
142
- function createBuiltinWebpackStyleInjectorPlugin(options, appType) {
208
+ function createBuiltinWebpackStyleInjectorPlugin(options, delegateFactory) {
143
209
  const normalized = normalizeWebpackStyleInjectorOptions(options);
144
210
  if (!normalized) return;
145
- if (isUniAppWebpackStyleInjectorApp(appType)) return StyleInjector$4(normalized);
146
- if (appType === "taro") return StyleInjector$3(normalized);
147
- if (appType === "mpx") return StyleInjector$2(normalized);
148
- return weappStyleInjectorWebpack(normalized);
211
+ return delegateFactory(normalized);
212
+ }
213
+ //#endregion
214
+ //#region src/utils/disabled.ts
215
+ function resolvePluginDisabledState(disabled) {
216
+ if (disabled === true) return { plugin: true };
217
+ if (disabled === false || disabled == null) return { plugin: false };
218
+ return { plugin: disabled.plugin ?? false };
219
+ }
220
+ //#endregion
221
+ //#region src/utils/resolve-package.ts
222
+ const require = createRequire(import.meta.url);
223
+ function resolvePackageDir(name) {
224
+ const pkgPath = require.resolve(`${name}/package.json`);
225
+ return path.dirname(pkgPath);
226
+ }
227
+ //#endregion
228
+ //#region src/bundlers/shared/generated-css-marker.ts
229
+ const BUNDLER_GENERATED_CSS_MARKER_RE = /\/\*!?\s*weapp-tailwindcss (?:vite|webpack)-generated-css(?:\s*:\s*[^\s*]+)?\s*\*\/\s*/i;
230
+ const BUNDLER_GENERATED_CSS_MARKER_GLOBAL_RE = /\/\*!?\s*weapp-tailwindcss (?:vite|webpack)-generated-css(?:\s*:\s*[^\s*]+)?\s*\*\/\s*/gi;
231
+ const BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE = /\/\*!?\s*weapp-tailwindcss (vite|webpack)-generated-css(?:\s*:\s*([^\s*]+))?\s*\*\/\s*/gi;
232
+ function createBundlerGeneratedCssMarker(bundler, file) {
233
+ return `/*! weapp-tailwindcss ${bundler}-generated-css:${encodeURIComponent(file)} */`;
234
+ }
235
+ function hasBundlerGeneratedCssMarker(source) {
236
+ return typeof source === "string" && BUNDLER_GENERATED_CSS_MARKER_RE.test(source);
237
+ }
238
+ function stripBundlerGeneratedCssMarkers(source) {
239
+ return source.replace(BUNDLER_GENERATED_CSS_MARKER_GLOBAL_RE, "");
240
+ }
241
+ function parseBundlerGeneratedCssMarkerBlocks(source) {
242
+ const blocks = [];
243
+ BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.lastIndex = 0;
244
+ let match = BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.exec(source);
245
+ while (match !== null) {
246
+ const cssStart = BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.lastIndex;
247
+ const nextMatch = BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.exec(source);
248
+ const cssEnd = nextMatch?.index ?? source.length;
249
+ const file = match[2] ? decodeURIComponent(match[2]) : void 0;
250
+ blocks.push({
251
+ bundler: match[1],
252
+ file,
253
+ css: source.slice(cssStart, cssEnd)
254
+ });
255
+ match = nextMatch;
256
+ }
257
+ return blocks;
149
258
  }
150
259
  //#endregion
151
260
  //#region src/bundlers/shared/module-graph.ts
@@ -216,85 +325,6 @@ function isSourceStyleRequest(request) {
216
325
  return STYLE_QUERY_RE.test(query) || STYLE_LANG_QUERY_RE.test(query);
217
326
  }
218
327
  //#endregion
219
- //#region src/bundlers/vite/utils.ts
220
- function slash(p) {
221
- return ensurePosix(p);
222
- }
223
- const isWindows = process.platform === "win32";
224
- const cssLangRE = new RegExp(`\\.(?:css|less|sass|scss|styl|stylus|pcss|postcss)(?:$|\\?)`);
225
- const htmlLangRE = /\.html?(?:$|\?)/;
226
- function isCSSRequest(request) {
227
- return cssLangRE.test(request) || isSourceStyleRequest(request);
228
- }
229
- function isHTMLRequest(request) {
230
- return htmlLangRE.test(request);
231
- }
232
- function normalizePath(id) {
233
- return path.posix.normalize(isWindows ? ensurePosix(id) : id);
234
- }
235
- async function formatPostcssSourceMap(rawMap, file) {
236
- const inputFileDir = path.dirname(file);
237
- const sources = rawMap.sources.map((source) => {
238
- const cleanSource = cleanUrl(decodeURIComponent(source));
239
- if (cleanSource[0] === "<" && cleanSource.endsWith(">")) return `\0${cleanSource}`;
240
- return normalizePath(path.resolve(inputFileDir, cleanSource));
241
- });
242
- return {
243
- file,
244
- mappings: rawMap.mappings,
245
- names: rawMap.names,
246
- sources,
247
- sourcesContent: rawMap.sourcesContent,
248
- version: rawMap.version
249
- };
250
- }
251
- //#endregion
252
- //#region src/utils/disabled.ts
253
- function resolvePluginDisabledState(disabled) {
254
- if (disabled === true) return { plugin: true };
255
- if (disabled === false || disabled == null) return { plugin: false };
256
- return { plugin: disabled.plugin ?? false };
257
- }
258
- //#endregion
259
- //#region src/utils/resolve-package.ts
260
- const require = createRequire(import.meta.url);
261
- function resolvePackageDir(name) {
262
- const pkgPath = require.resolve(`${name}/package.json`);
263
- return path.dirname(pkgPath);
264
- }
265
- //#endregion
266
- //#region src/bundlers/shared/generated-css-marker.ts
267
- const BUNDLER_GENERATED_CSS_MARKER_RE = /\/\*!?\s*weapp-tailwindcss (?:vite|webpack)-generated-css(?:\s*:\s*[^\s*]+)?\s*\*\/\s*/i;
268
- const BUNDLER_GENERATED_CSS_MARKER_GLOBAL_RE = /\/\*!?\s*weapp-tailwindcss (?:vite|webpack)-generated-css(?:\s*:\s*[^\s*]+)?\s*\*\/\s*/gi;
269
- const BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE = /\/\*!?\s*weapp-tailwindcss (vite|webpack)-generated-css(?:\s*:\s*([^\s*]+))?\s*\*\/\s*/gi;
270
- function createBundlerGeneratedCssMarker(bundler, file) {
271
- return `/*! weapp-tailwindcss ${bundler}-generated-css:${encodeURIComponent(file)} */`;
272
- }
273
- function hasBundlerGeneratedCssMarker(source) {
274
- return typeof source === "string" && BUNDLER_GENERATED_CSS_MARKER_RE.test(source);
275
- }
276
- function stripBundlerGeneratedCssMarkers(source) {
277
- return source.replace(BUNDLER_GENERATED_CSS_MARKER_GLOBAL_RE, "");
278
- }
279
- function parseBundlerGeneratedCssMarkerBlocks(source) {
280
- const blocks = [];
281
- BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.lastIndex = 0;
282
- let match = BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.exec(source);
283
- while (match !== null) {
284
- const cssStart = BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.lastIndex;
285
- const nextMatch = BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.exec(source);
286
- const cssEnd = nextMatch?.index ?? source.length;
287
- const file = match[2] ? decodeURIComponent(match[2]) : void 0;
288
- blocks.push({
289
- bundler: match[1],
290
- file,
291
- css: source.slice(cssStart, cssEnd)
292
- });
293
- match = nextMatch;
294
- }
295
- return blocks;
296
- }
297
- //#endregion
298
328
  //#region src/bundlers/shared/v4-generation-core.ts
299
329
  async function generateTailwindV4Css(options) {
300
330
  const majorVersion = options.runtimeState.tailwindRuntime.majorVersion;
@@ -433,6 +463,39 @@ function createRuntimeAffectingSourceSignature(source, type) {
433
463
  return source;
434
464
  }
435
465
  //#endregion
466
+ //#region src/bundlers/vite/utils.ts
467
+ function slash(p) {
468
+ return ensurePosix(p);
469
+ }
470
+ const isWindows = process.platform === "win32";
471
+ const cssLangRE = new RegExp(`\\.(?:css|less|sass|scss|styl|stylus|pcss|postcss)(?:$|\\?)`);
472
+ const htmlLangRE = /\.html?(?:$|\?)/;
473
+ function isCSSRequest(request) {
474
+ return cssLangRE.test(request) || isSourceStyleRequest(request);
475
+ }
476
+ function isHTMLRequest(request) {
477
+ return htmlLangRE.test(request);
478
+ }
479
+ function normalizePath(id) {
480
+ return path.posix.normalize(isWindows ? ensurePosix(id) : id);
481
+ }
482
+ async function formatPostcssSourceMap(rawMap, file) {
483
+ const inputFileDir = path.dirname(file);
484
+ const sources = rawMap.sources.map((source) => {
485
+ const cleanSource = cleanUrl(decodeURIComponent(source));
486
+ if (cleanSource[0] === "<" && cleanSource.endsWith(">")) return `\0${cleanSource}`;
487
+ return normalizePath(path.resolve(inputFileDir, cleanSource));
488
+ });
489
+ return {
490
+ file,
491
+ mappings: rawMap.mappings,
492
+ names: rawMap.names,
493
+ sources,
494
+ sourcesContent: rawMap.sourcesContent,
495
+ version: rawMap.version
496
+ };
497
+ }
498
+ //#endregion
436
499
  //#region src/bundlers/vite/bundle-state.ts
437
500
  function createBundleBuildState() {
438
501
  return {
@@ -726,4 +789,4 @@ function createSourceCandidateScanSignature(input) {
726
789
  });
727
790
  }
728
791
  //#endregion
729
- export { isSourceStyleRequest as A, resolvePluginDisabledState as C, isHTMLRequest as D, isCSSRequest as E, createBuiltinViteStyleInjectorPlugins as F, createBuiltinWebpackStyleInjectorPlugin as I, normalizeOutputPathKey as M, resolveOutputSpecifier as N, normalizePath as O, toAbsoluteOutputPath as P, resolvePackageDir as S, formatPostcssSourceMap as T, generateTailwindV4Css as _, createJsHashSalt as a, parseBundlerGeneratedCssMarkerBlocks as b, hasRuntimeAffectingSourceChanges as c, classifyBundleEntry as d, createBundleBuildState as f, createBundleModuleGraphOptions as g, applyLinkedResults as h, createCandidateSignature as i, stripRequestQuery as j, slash as k, summarizeStringDiff as l, createRuntimeAffectingSourceSignature as m, createScopedGeneratorCandidateSignature as n, createLinkedImpactSignature as o, updateBundleBuildState as p, createScopedGeneratorRuntime as r, getSnapshotHash as s, createSourceCandidateScanSignature as t, buildBundleSnapshot as u, createBundlerGeneratedCssMarker as v, cleanUrl as w, stripBundlerGeneratedCssMarkers as x, hasBundlerGeneratedCssMarker as y };
792
+ export { hasBundlerGeneratedCssMarker as A, resolveWebpackFrameworkProfile as B, generateTailwindV4Css as C, resolveOutputSpecifier as D, normalizeOutputPathKey as E, createBuiltinViteStyleInjectorPlugins as F, createBuiltinWebpackStyleInjectorPlugin as I, viteStyleInjectorDelegates as L, stripBundlerGeneratedCssMarkers as M, resolvePackageDir as N, toAbsoluteOutputPath as O, resolvePluginDisabledState as P, webpackStyleInjectorDelegates as R, createBundleModuleGraphOptions as S, stripRequestQuery as T, isHTMLRequest as _, createJsHashSalt as a, createRuntimeAffectingSourceSignature as b, hasRuntimeAffectingSourceChanges as c, classifyBundleEntry as d, createBundleBuildState as f, isCSSRequest as g, formatPostcssSourceMap as h, createCandidateSignature as i, parseBundlerGeneratedCssMarkerBlocks as j, createBundlerGeneratedCssMarker as k, summarizeStringDiff as l, cleanUrl as m, createScopedGeneratorCandidateSignature as n, createLinkedImpactSignature as o, updateBundleBuildState as p, createScopedGeneratorRuntime as r, getSnapshotHash as s, createSourceCandidateScanSignature as t, buildBundleSnapshot as u, normalizePath as v, isSourceStyleRequest as w, applyLinkedResults as x, slash as y, resolveViteFrameworkProfile as z };