uniwind-plugin-next 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +22 -25
  2. package/dist/_virtual/rolldown_runtime.mjs +7 -0
  3. package/dist/{webpack → common}/types.d.cts +1 -1
  4. package/dist/common/types.d.cts.map +1 -0
  5. package/dist/{webpack → common}/types.d.mts +1 -1
  6. package/dist/common/types.d.mts.map +1 -0
  7. package/dist/{webpack → common}/util.cjs +1 -1
  8. package/dist/{webpack → common}/util.mjs +1 -1
  9. package/dist/common/util.mjs.map +1 -0
  10. package/dist/index.d.cts +1 -1
  11. package/dist/index.d.mts +1 -1
  12. package/dist/index.mjs.map +1 -1
  13. package/dist/postcss/index.cjs +0 -3
  14. package/dist/postcss/index.mjs +0 -3
  15. package/dist/postcss/index.mjs.map +1 -1
  16. package/dist/{webpack/uniwind → uniwind}/package.cjs +1 -1
  17. package/dist/uniwind/package.mjs +6 -0
  18. package/dist/uniwind/package.mjs.map +1 -0
  19. package/dist/{webpack/uniwind → uniwind}/src/css/index.cjs +2 -2
  20. package/dist/{webpack/uniwind → uniwind}/src/css/index.mjs +1 -1
  21. package/dist/uniwind/src/css/index.mjs.map +1 -0
  22. package/dist/{webpack/uniwind → uniwind}/src/css/insets.cjs +1 -1
  23. package/dist/{webpack/uniwind → uniwind}/src/css/insets.mjs +1 -1
  24. package/dist/uniwind/src/css/insets.mjs.map +1 -0
  25. package/dist/{webpack/uniwind → uniwind}/src/css/themes.cjs +2 -2
  26. package/dist/{webpack/uniwind → uniwind}/src/css/themes.mjs +1 -1
  27. package/dist/uniwind/src/css/themes.mjs.map +1 -0
  28. package/dist/{webpack/uniwind → uniwind}/src/css/variants.cjs +1 -1
  29. package/dist/{webpack/uniwind → uniwind}/src/css/variants.mjs +1 -1
  30. package/dist/uniwind/src/css/variants.mjs.map +1 -0
  31. package/dist/{webpack/uniwind → uniwind}/src/metro/logger.cjs +1 -1
  32. package/dist/{webpack/uniwind → uniwind}/src/metro/logger.mjs +1 -1
  33. package/dist/uniwind/src/metro/logger.mjs.map +1 -0
  34. package/dist/{webpack/uniwind → uniwind}/src/utils/buildDtsFile.cjs +2 -2
  35. package/dist/{webpack/uniwind → uniwind}/src/utils/buildDtsFile.mjs +1 -1
  36. package/dist/uniwind/src/utils/buildDtsFile.mjs.map +1 -0
  37. package/dist/{webpack/uniwind → uniwind}/src/utils/stringifyThemes.cjs +1 -1
  38. package/dist/{webpack/uniwind → uniwind}/src/utils/stringifyThemes.mjs +1 -1
  39. package/dist/uniwind/src/utils/stringifyThemes.mjs.map +1 -0
  40. package/dist/webpack/UniwindWebpackPlugin.cjs +6 -4
  41. package/dist/webpack/UniwindWebpackPlugin.mjs +7 -4
  42. package/dist/webpack/UniwindWebpackPlugin.mjs.map +1 -1
  43. package/dist/webpack/withUniwindBase.cjs +6 -1
  44. package/dist/webpack/withUniwindBase.mjs +6 -1
  45. package/dist/webpack/withUniwindBase.mjs.map +1 -1
  46. package/package.json +3 -6
  47. package/dist/webpack/types.d.cts.map +0 -1
  48. package/dist/webpack/types.d.mts.map +0 -1
  49. package/dist/webpack/uniwind/package.mjs +0 -6
  50. package/dist/webpack/uniwind/package.mjs.map +0 -1
  51. package/dist/webpack/uniwind/src/css/index.mjs.map +0 -1
  52. package/dist/webpack/uniwind/src/css/insets.mjs.map +0 -1
  53. package/dist/webpack/uniwind/src/css/themes.mjs.map +0 -1
  54. package/dist/webpack/uniwind/src/css/variants.mjs.map +0 -1
  55. package/dist/webpack/uniwind/src/metro/logger.mjs.map +0 -1
  56. package/dist/webpack/uniwind/src/utils/buildDtsFile.mjs.map +0 -1
  57. package/dist/webpack/uniwind/src/utils/stringifyThemes.mjs.map +0 -1
  58. package/dist/webpack/util.mjs.map +0 -1
package/README.md CHANGED
@@ -1,22 +1,20 @@
1
1
  # uniwind-plugin-next
2
2
 
3
- > This is an unofficial plugin, and is not affiliated with Uniwind or Next.js.
4
-
5
- [Uniwind](https://uniwind.dev/) config plugin for Next.js. Note that only Webpack-based projects are supported, there are no plans to support Turbopack-based projects.
3
+ [Uniwind](https://uniwind.dev/) config plugin for Next.js projects using Webpack. Turbopack-based projects are not supported at this stage.
6
4
 
7
5
  ## Example
8
6
  See a fully working example project here: [Demo](http://uniwind-next.a16n.dev/) ([Source](https://github.com/a16n-dev/uniwind-plugin-next/tree/main/examples/next-16))
9
7
 
10
-
11
8
  ## Compatibility
12
9
  See the table below for tested versions of `uniwind-plugin-next` and corresponding versions of `uniwind`. Other versions of `uniwind` may work, but are not guaranteed to.
13
10
 
14
11
  Tested on Next `16.1`, but other versions will likely work fine.
15
12
 
16
- | Uniwind | uniwind-plugin-next |
17
- |-----------------|---------------------|
18
- | `1.2.2`-`1.2.3` | `1.1.0`-`1.2.0` |
19
- | `1.2.4` | `1.3.0` |
13
+ | Uniwind | uniwind-plugin-next |
14
+ |-------------------|---------------------|
15
+ | `1.2.7` | `1.4.0` |
16
+ | `1.2.4` - `1.2.6` | `1.3.0` |
17
+ | `1.2.2`-`1.2.3` | `1.2.0` |
20
18
 
21
19
  ## Installation & setup
22
20
  This setup guide assumes you already have a next.js project setup with Tailwind v4
@@ -45,17 +43,6 @@ export default withUniwind(withExpo(nextConfig), {
45
43
  // See https://docs.uniwind.dev/api/metro-config#configuration-options
46
44
  });
47
45
  ```
48
- #### Uniwind Pro
49
-
50
- If you're using the pro version of Uniwind, use `withUniwindPro()` instead of `withUniwind()`.
51
-
52
- ```ts
53
- // next.config.ts
54
- import { withUniwindPro } from 'uniwind-plugin-next'
55
-
56
- export default withUniwindPro(withExpo(nextConfig), { ... });
57
- ```
58
-
59
46
 
60
47
  3. Add the postcss plugin
61
48
  ```js
@@ -81,17 +68,27 @@ const config = {
81
68
  ...
82
69
 
83
70
  return (
84
- <html lang="en" suppressHydrationWarning>
85
- ...
86
- </html>
71
+ <html lang="en" suppressHydrationWarning>
72
+ ...
73
+ </html>
87
74
  );
88
75
  ```
89
76
 
90
77
  6. Start the dev server to generate `uniwind-types.d.ts`. Make sure that it's included in your `tsconfig.json`'s `include` array.
91
78
 
79
+ ## Uniwind Pro
80
+
81
+ If you're using the pro version of Uniwind, use `withUniwindPro()` instead of `withUniwind()`.
82
+
83
+ ```ts
84
+ // next.config.ts
85
+ import { withUniwindPro } from 'uniwind-plugin-next'
86
+
87
+ export default withUniwindPro(withExpo(nextConfig), { ... });
88
+ ```
89
+
90
+
92
91
  ## SSR Considerations
93
92
  - This plugin marks all Uniwind web components with `'use client'` automatically, so you do not need to do this manually.
94
93
 
95
- - Be aware that some Uniwind features, such as `withUniwind` and `useResolveClassNames` will not work in a server environment, as they rely on accessing `window` or `document`.
96
-
97
- - Additional code is required to avoid a flash of unstyled content (FOUC). See the example project for reference.
94
+ - Be aware that some Uniwind features, such as `withUniwind` and `useResolveClassNames` will not work in a server environment, as they rely on accessing `window` or `document`.
@@ -0,0 +1,7 @@
1
+ import { createRequire } from "node:module";
2
+
3
+ //#region rolldown:runtime
4
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
5
+
6
+ //#endregion
7
+ export { __require };
@@ -1,4 +1,4 @@
1
- //#region src/webpack/types.d.ts
1
+ //#region src/common/types.d.ts
2
2
  type UniwindConfig = {
3
3
  cssEntryFile: string;
4
4
  extraThemes?: Array<string>;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.cts","names":[],"sources":["../../src/common/types.ts"],"sourcesContent":[],"mappings":";KAAY,aAAA;EAAA,YAAA,EAAA,MAAa;gBAET"}
@@ -1,4 +1,4 @@
1
- //#region src/webpack/types.d.ts
1
+ //#region src/common/types.d.ts
2
2
  type UniwindConfig = {
3
3
  cssEntryFile: string;
4
4
  extraThemes?: Array<string>;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.mts","names":[],"sources":["../../src/common/types.ts"],"sourcesContent":[],"mappings":";KAAY,aAAA;EAAA,YAAA,EAAA,MAAa;gBAET"}
@@ -1,5 +1,5 @@
1
1
 
2
- //#region src/webpack/util.ts
2
+ //#region src/common/util.ts
3
3
  const uniq = (arr) => Array.from(new Set(arr));
4
4
 
5
5
  //#endregion
@@ -1,4 +1,4 @@
1
- //#region src/webpack/util.ts
1
+ //#region src/common/util.ts
2
2
  const uniq = (arr) => Array.from(new Set(arr));
3
3
 
4
4
  //#endregion
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.mjs","names":[],"sources":["../../src/common/util.ts"],"sourcesContent":["export const uniq = <T>(arr: Array<T>) => Array.from(new Set(arr));\n"],"mappings":";AAAA,MAAa,QAAW,QAAkB,MAAM,KAAK,IAAI,IAAI,IAAI,CAAC"}
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { UniwindConfig } from "./webpack/types.cjs";
1
+ import { UniwindConfig } from "./common/types.cjs";
2
2
 
3
3
  //#region src/index.d.ts
4
4
  declare function withUniwind(nextConfig: any | undefined, uniwindConfig: UniwindConfig): any;
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { UniwindConfig } from "./webpack/types.mjs";
1
+ import { UniwindConfig } from "./common/types.mjs";
2
2
 
3
3
  //#region src/index.d.ts
4
4
  declare function withUniwind(nextConfig: any | undefined, uniwindConfig: UniwindConfig): any;
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { UniwindConfig } from \"./webpack/types\";\nimport { withUniwindBase } from \"./webpack/withUniwindBase\";\n\nexport function withUniwind(\n nextConfig: any = {},\n uniwindConfig: UniwindConfig,\n): any {\n return withUniwindBase(\"uniwind\", nextConfig, uniwindConfig);\n}\n\nexport function withUniwindPro(\n nextConfig: any = {},\n uniwindConfig: UniwindConfig,\n): any {\n return withUniwindBase(\"uniwind-pro\", nextConfig, uniwindConfig);\n}\n"],"mappings":";;;AAGA,SAAgB,YACd,aAAkB,EAAE,EACpB,eACK;AACL,QAAO,gBAAgB,WAAW,YAAY,cAAc;;AAG9D,SAAgB,eACd,aAAkB,EAAE,EACpB,eACK;AACL,QAAO,gBAAgB,eAAe,YAAY,cAAc"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { UniwindConfig } from \"./common/types\";\nimport { withUniwindBase } from \"./webpack/withUniwindBase\";\n\nexport function withUniwind(\n nextConfig: any = {},\n uniwindConfig: UniwindConfig,\n): any {\n return withUniwindBase(\"uniwind\", nextConfig, uniwindConfig);\n}\n\nexport function withUniwindPro(\n nextConfig: any = {},\n uniwindConfig: UniwindConfig,\n): any {\n return withUniwindBase(\"uniwind-pro\", nextConfig, uniwindConfig);\n}\n"],"mappings":";;;AAGA,SAAgB,YACd,aAAkB,EAAE,EACpB,eACK;AACL,QAAO,gBAAgB,WAAW,YAAY,cAAc;;AAG9D,SAAgB,eACd,aAAkB,EAAE,EACpB,eACK;AACL,QAAO,gBAAgB,eAAe,YAAY,cAAc"}
@@ -9,9 +9,6 @@ function UniwindPluginNext() {
9
9
  decl.value = decl.value.replace(/fontScale\(([^)]+)\)/g, "calc($1 * 1rem)");
10
10
  decl.value = decl.value.replace(/hairlineWidth\(\)/g, "1px");
11
11
  });
12
- root.walkAtRules("import", (rule) => {
13
- if (rule.params.replace(/['"]/g, "") === "uniwind") rule.params = "\"uniwind-plugin-next/css\"";
14
- });
15
12
  }
16
13
  };
17
14
  }
@@ -8,9 +8,6 @@ function UniwindPluginNext() {
8
8
  decl.value = decl.value.replace(/fontScale\(([^)]+)\)/g, "calc($1 * 1rem)");
9
9
  decl.value = decl.value.replace(/hairlineWidth\(\)/g, "1px");
10
10
  });
11
- root.walkAtRules("import", (rule) => {
12
- if (rule.params.replace(/['"]/g, "") === "uniwind") rule.params = "\"uniwind-plugin-next/css\"";
13
- });
14
11
  }
15
12
  };
16
13
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../src/postcss/index.ts"],"sourcesContent":["export default function UniwindPluginNext() {\n return {\n postcssPlugin: \"uniwind-plugin-next\",\n Once(root: any) {\n root.walkDecls((decl: any) => {\n // Transform pixelRatio(X) → calc(X * 1px)\n decl.value = decl.value.replace(\n /pixelRatio\\(([^)]+)\\)/g,\n \"calc($1 * 1px)\",\n );\n // Transform fontScale(X) → calc(X * 1rem)\n decl.value = decl.value.replace(\n /fontScale\\(([^)]+)\\)/g,\n \"calc($1 * 1rem)\",\n );\n // Transform hairlineWidth() → 1px\n decl.value = decl.value.replace(/hairlineWidth\\(\\)/g, \"1px\");\n });\n // Replace `@import 'uniwind'` with `@import 'uniwind-plugin-next'`\n root.walkAtRules(\"import\", (rule: any) => {\n const importPath = rule.params.replace(/['\"]/g, \"\");\n\n if (importPath === \"uniwind\") {\n rule.params = '\"uniwind-plugin-next/css\"';\n }\n });\n },\n };\n}\n\nUniwindPluginNext.postcss = true;\n"],"mappings":";AAAA,SAAwB,oBAAoB;AAC1C,QAAO;EACL,eAAe;EACf,KAAK,MAAW;AACd,QAAK,WAAW,SAAc;AAE5B,SAAK,QAAQ,KAAK,MAAM,QACtB,0BACA,iBACD;AAED,SAAK,QAAQ,KAAK,MAAM,QACtB,yBACA,kBACD;AAED,SAAK,QAAQ,KAAK,MAAM,QAAQ,sBAAsB,MAAM;KAC5D;AAEF,QAAK,YAAY,WAAW,SAAc;AAGxC,QAFmB,KAAK,OAAO,QAAQ,SAAS,GAAG,KAEhC,UACjB,MAAK,SAAS;KAEhB;;EAEL;;AAGH,kBAAkB,UAAU"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/postcss/index.ts"],"sourcesContent":["export default function UniwindPluginNext() {\n return {\n postcssPlugin: \"uniwind-plugin-next\",\n Once(root: any) {\n root.walkDecls((decl: any) => {\n // Transform pixelRatio(X) → calc(X * 1px)\n decl.value = decl.value.replace(\n /pixelRatio\\(([^)]+)\\)/g,\n \"calc($1 * 1px)\",\n );\n // Transform fontScale(X) → calc(X * 1rem)\n decl.value = decl.value.replace(\n /fontScale\\(([^)]+)\\)/g,\n \"calc($1 * 1rem)\",\n );\n // Transform hairlineWidth() → 1px\n decl.value = decl.value.replace(/hairlineWidth\\(\\)/g, \"1px\");\n });\n },\n };\n}\n\nUniwindPluginNext.postcss = true;\n"],"mappings":";AAAA,SAAwB,oBAAoB;AAC1C,QAAO;EACL,eAAe;EACf,KAAK,MAAW;AACd,QAAK,WAAW,SAAc;AAE5B,SAAK,QAAQ,KAAK,MAAM,QACtB,0BACA,iBACD;AAED,SAAK,QAAQ,KAAK,MAAM,QACtB,yBACA,kBACD;AAED,SAAK,QAAQ,KAAK,MAAM,QAAQ,sBAAsB,MAAM;KAC5D;;EAEL;;AAGH,kBAAkB,UAAU"}
@@ -1,5 +1,5 @@
1
1
 
2
- //#region src/webpack/uniwind/package.json
2
+ //#region src/uniwind/package.json
3
3
  var name = "uniwind";
4
4
 
5
5
  //#endregion
@@ -0,0 +1,6 @@
1
+ //#region src/uniwind/package.json
2
+ var name = "uniwind";
3
+
4
+ //#endregion
5
+ export { name };
6
+ //# sourceMappingURL=package.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package.mjs","names":[],"sources":["../../src/uniwind/package.json"],"sourcesContent":[""],"mappings":""}
@@ -1,4 +1,4 @@
1
- const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
1
+ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
2
  const require_insets = require('./insets.cjs');
3
3
  const require_themes = require('./themes.cjs');
4
4
  const require_variants = require('./variants.cjs');
@@ -7,7 +7,7 @@ path = require_rolldown_runtime.__toESM(path);
7
7
  let fs = require("fs");
8
8
  fs = require_rolldown_runtime.__toESM(fs);
9
9
 
10
- //#region src/webpack/uniwind/src/css/index.ts
10
+ //#region src/uniwind/src/css/index.ts
11
11
  const dirname = typeof __dirname !== "undefined" ? __dirname : __dirname;
12
12
  const buildCSS = async (themes, input) => {
13
13
  const variants = require_variants.generateCSSForVariants();
@@ -4,7 +4,7 @@ import { generateCSSForVariants } from "./variants.mjs";
4
4
  import path from "path";
5
5
  import fs from "fs";
6
6
 
7
- //#region src/webpack/uniwind/src/css/index.ts
7
+ //#region src/uniwind/src/css/index.ts
8
8
  const dirname = typeof __dirname !== "undefined" ? __dirname : import.meta.dirname;
9
9
  const buildCSS = async (themes, input) => {
10
10
  const variants = generateCSSForVariants();
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/uniwind/src/css/index.ts"],"sourcesContent":["import fs from \"fs\";\nimport path from \"path\";\nimport { generateCSSForInsets } from \"./insets\";\nimport { generateCSSForThemes } from \"./themes\";\nimport { generateCSSForVariants } from \"./variants\";\n\nconst dirname =\n typeof __dirname !== \"undefined\" ? __dirname : import.meta.dirname;\n\nexport const buildCSS = async (themes: Array<string>, input: string) => {\n const variants = generateCSSForVariants();\n const insets = generateCSSForInsets();\n const themesCSS = await generateCSSForThemes(themes, input);\n const cssFilePath = path.join(dirname, \"../../uniwind.css\");\n const oldCSSFile = fs.existsSync(cssFilePath)\n ? fs.readFileSync(cssFilePath, \"utf-8\")\n : \"\";\n\n const newCssFile = [variants, insets, themesCSS].join(\"\\n\");\n\n if (oldCSSFile === newCssFile) {\n return;\n }\n\n fs.writeFileSync(cssFilePath, newCssFile);\n};\n"],"mappings":";;;;;;;AAMA,MAAM,UACJ,OAAO,cAAc,cAAc,YAAY,OAAO,KAAK;AAE7D,MAAa,WAAW,OAAO,QAAuB,UAAkB;CACtE,MAAM,WAAW,wBAAwB;CACzC,MAAM,SAAS,sBAAsB;CACrC,MAAM,YAAY,MAAM,qBAAqB,QAAQ,MAAM;CAC3D,MAAM,cAAc,KAAK,KAAK,SAAS,oBAAoB;CAC3D,MAAM,aAAa,GAAG,WAAW,YAAY,GACzC,GAAG,aAAa,aAAa,QAAQ,GACrC;CAEJ,MAAM,aAAa;EAAC;EAAU;EAAQ;EAAU,CAAC,KAAK,KAAK;AAE3D,KAAI,eAAe,WACjB;AAGF,IAAG,cAAc,aAAa,WAAW"}
@@ -1,5 +1,5 @@
1
1
 
2
- //#region src/webpack/uniwind/src/css/insets.ts
2
+ //#region src/uniwind/src/css/insets.ts
3
3
  const types = [
4
4
  "margin",
5
5
  "padding",
@@ -1,4 +1,4 @@
1
- //#region src/webpack/uniwind/src/css/insets.ts
1
+ //#region src/uniwind/src/css/insets.ts
2
2
  const types = [
3
3
  "margin",
4
4
  "padding",
@@ -0,0 +1 @@
1
+ {"version":3,"file":"insets.mjs","names":[],"sources":["../../../../src/uniwind/src/css/insets.ts"],"sourcesContent":["const types = [\"margin\", \"padding\", \"inset\"] as const;\nconst sides = [\"inset\", \"x\", \"y\", \"top\", \"bottom\", \"left\", \"right\"] as const;\nconst safeAreaTypes = [\"safe\", \"safe-or-*\", \"safe-offset-*\"] as const;\nconst spacing = \"--spacing(--value(integer))\";\nconst length = \"--value([length])\";\n\ntype Side = (typeof sides)[number];\ntype TypeName = (typeof types)[number];\ntype SafeAreaType = (typeof safeAreaTypes)[number];\ntype Inset = \"top\" | \"bottom\" | \"left\" | \"right\";\n\nexport const generateCSSForInsets = () => {\n let css = `@utility h-screen-safe {\n height: calc(100vh - (env(safe-area-inset-top) + env(safe-area-inset-bottom)));\n}\\n\\n`;\n\n const getInsetsForSide = (side: Side): Array<Inset> => {\n switch (side) {\n case \"top\":\n return [\"top\"];\n case \"bottom\":\n return [\"bottom\"];\n case \"left\":\n return [\"left\"];\n case \"right\":\n return [\"right\"];\n case \"x\":\n return [\"left\", \"right\"];\n case \"y\":\n return [\"top\", \"bottom\"];\n case \"inset\":\n return [\"top\", \"bottom\", \"left\", \"right\"];\n default:\n side satisfies never;\n return [];\n }\n };\n\n const getUtilityName = (\n typeName: TypeName,\n side: Side,\n safeAreaType: SafeAreaType,\n ) => {\n if (typeName === \"inset\") {\n return `${side}-${safeAreaType}`;\n }\n\n const sideSuffix = side === \"inset\" ? \"\" : side.at(0);\n\n return `${typeName.at(0)}${sideSuffix}-${safeAreaType}`;\n };\n\n const getStyleProperty = (typeName: TypeName, inset: Inset) => {\n if (typeName === \"inset\") {\n return inset;\n }\n\n return `${typeName}-${inset}`;\n };\n\n const getStylesForSafeAreaType = (\n safeAreaType: SafeAreaType,\n styles: Array<string>,\n ) => {\n switch (safeAreaType) {\n case \"safe\":\n return styles;\n case \"safe-or-*\":\n return styles.flatMap((style) => {\n const styleWithoutSemicolon = style.replace(\";\", \"\");\n\n return [\n styleWithoutSemicolon.replace(\n /: (env.*)/,\n (_, env) => `: max(${env}, ${spacing});`,\n ),\n styleWithoutSemicolon.replace(\n /: (env.*)/,\n (_, env) => `: max(${env}, ${length});`,\n ),\n ];\n });\n case \"safe-offset-*\":\n return styles.flatMap((style) => {\n const styleWithoutSemicolon = style.replace(\";\", \"\");\n\n return [\n styleWithoutSemicolon.replace(\n /: (env.*)/,\n (_, env) => `: calc(${env} + ${spacing});`,\n ),\n styleWithoutSemicolon.replace(\n /: (env.*)/,\n (_, env) => `: calc(${env} + ${length});`,\n ),\n ];\n });\n default:\n safeAreaType satisfies never;\n return [];\n }\n };\n\n types.forEach((type) => {\n sides.forEach((side) => {\n const insets = getInsetsForSide(side);\n const styles = insets.map(\n (inset) =>\n `${getStyleProperty(type, inset)}: env(safe-area-inset-${inset});`,\n );\n\n safeAreaTypes.forEach((safeAreaType) => {\n const utilityName = getUtilityName(type, side, safeAreaType);\n\n css += [\n `@utility ${utilityName} {`,\n ...getStylesForSafeAreaType(safeAreaType, styles).map(\n (style) => ` ${style}`,\n ),\n \"}\",\n \"\",\n \"\",\n ].join(\"\\n\");\n });\n });\n });\n\n // Remove the last newline character\n return css.slice(0, -1);\n};\n"],"mappings":";AAAA,MAAM,QAAQ;CAAC;CAAU;CAAW;CAAQ;AAC5C,MAAM,QAAQ;CAAC;CAAS;CAAK;CAAK;CAAO;CAAU;CAAQ;CAAQ;AACnE,MAAM,gBAAgB;CAAC;CAAQ;CAAa;CAAgB;AAC5D,MAAM,UAAU;AAChB,MAAM,SAAS;AAOf,MAAa,6BAA6B;CACxC,IAAI,MAAM;;;CAIV,MAAM,oBAAoB,SAA6B;AACrD,UAAQ,MAAR;GACE,KAAK,MACH,QAAO,CAAC,MAAM;GAChB,KAAK,SACH,QAAO,CAAC,SAAS;GACnB,KAAK,OACH,QAAO,CAAC,OAAO;GACjB,KAAK,QACH,QAAO,CAAC,QAAQ;GAClB,KAAK,IACH,QAAO,CAAC,QAAQ,QAAQ;GAC1B,KAAK,IACH,QAAO,CAAC,OAAO,SAAS;GAC1B,KAAK,QACH,QAAO;IAAC;IAAO;IAAU;IAAQ;IAAQ;GAC3C,QAEE,QAAO,EAAE;;;CAIf,MAAM,kBACJ,UACA,MACA,iBACG;AACH,MAAI,aAAa,QACf,QAAO,GAAG,KAAK,GAAG;EAGpB,MAAM,aAAa,SAAS,UAAU,KAAK,KAAK,GAAG,EAAE;AAErD,SAAO,GAAG,SAAS,GAAG,EAAE,GAAG,WAAW,GAAG;;CAG3C,MAAM,oBAAoB,UAAoB,UAAiB;AAC7D,MAAI,aAAa,QACf,QAAO;AAGT,SAAO,GAAG,SAAS,GAAG;;CAGxB,MAAM,4BACJ,cACA,WACG;AACH,UAAQ,cAAR;GACE,KAAK,OACH,QAAO;GACT,KAAK,YACH,QAAO,OAAO,SAAS,UAAU;IAC/B,MAAM,wBAAwB,MAAM,QAAQ,KAAK,GAAG;AAEpD,WAAO,CACL,sBAAsB,QACpB,cACC,GAAG,QAAQ,SAAS,IAAI,IAAI,QAAQ,IACtC,EACD,sBAAsB,QACpB,cACC,GAAG,QAAQ,SAAS,IAAI,IAAI,OAAO,IACrC,CACF;KACD;GACJ,KAAK,gBACH,QAAO,OAAO,SAAS,UAAU;IAC/B,MAAM,wBAAwB,MAAM,QAAQ,KAAK,GAAG;AAEpD,WAAO,CACL,sBAAsB,QACpB,cACC,GAAG,QAAQ,UAAU,IAAI,KAAK,QAAQ,IACxC,EACD,sBAAsB,QACpB,cACC,GAAG,QAAQ,UAAU,IAAI,KAAK,OAAO,IACvC,CACF;KACD;GACJ,QAEE,QAAO,EAAE;;;AAIf,OAAM,SAAS,SAAS;AACtB,QAAM,SAAS,SAAS;GAEtB,MAAM,SADS,iBAAiB,KAAK,CACf,KACnB,UACC,GAAG,iBAAiB,MAAM,MAAM,CAAC,wBAAwB,MAAM,IAClE;AAED,iBAAc,SAAS,iBAAiB;IACtC,MAAM,cAAc,eAAe,MAAM,MAAM,aAAa;AAE5D,WAAO;KACL,YAAY,YAAY;KACxB,GAAG,yBAAyB,cAAc,OAAO,CAAC,KAC/C,UAAU,OAAO,QACnB;KACD;KACA;KACA;KACD,CAAC,KAAK,KAAK;KACZ;IACF;GACF;AAGF,QAAO,IAAI,MAAM,GAAG,GAAG"}
@@ -1,4 +1,4 @@
1
- const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
1
+ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
2
  const require_logger = require('../metro/logger.cjs');
3
3
  let path = require("path");
4
4
  path = require_rolldown_runtime.__toESM(path);
@@ -7,7 +7,7 @@ fs = require_rolldown_runtime.__toESM(fs);
7
7
  let _tailwindcss_node = require("@tailwindcss/node");
8
8
  let lightningcss = require("lightningcss");
9
9
 
10
- //#region src/webpack/uniwind/src/css/themes.ts
10
+ //#region src/uniwind/src/css/themes.ts
11
11
  const readFileSafe = (filePath) => {
12
12
  try {
13
13
  return fs.default.readFileSync(filePath, "utf-8");
@@ -4,7 +4,7 @@ import fs from "fs";
4
4
  import { compile } from "@tailwindcss/node";
5
5
  import { transform } from "lightningcss";
6
6
 
7
- //#region src/webpack/uniwind/src/css/themes.ts
7
+ //#region src/uniwind/src/css/themes.ts
8
8
  const readFileSafe = (filePath) => {
9
9
  try {
10
10
  return fs.readFileSync(filePath, "utf-8");
@@ -0,0 +1 @@
1
+ {"version":3,"file":"themes.mjs","names":[],"sources":["../../../../src/uniwind/src/css/themes.ts"],"sourcesContent":["import { compile } from \"@tailwindcss/node\";\nimport fs from \"fs\";\nimport { transform } from \"lightningcss\";\nimport path from \"path\";\nimport { Logger } from \"../metro/logger\";\n\nconst readFileSafe = (filePath: string) => {\n try {\n return fs.readFileSync(filePath, \"utf-8\");\n } catch {\n return null;\n }\n};\n\nconst isExcludedDependency = (url: string) =>\n [\n url.includes(\"node_modules/tailwindcss\"),\n url.includes(\"node_modules/@tailwindcss\"),\n url.includes(\"node_modules/uniwind\"),\n ].some(Boolean);\n\nexport const generateCSSForThemes = async (\n themes: Array<string>,\n input: string,\n) => {\n // css generation\n const themesVariables = Object.fromEntries(\n themes.map((theme) => [theme, new Set<string>()]),\n );\n\n const findVariantsRec = async (cssPath: string) => {\n const css = readFileSafe(cssPath);\n\n if (css === null) {\n return;\n }\n\n const { dependencies } = transform({\n code: Buffer.from(css),\n filename: \"uniwind.css\",\n analyzeDependencies: true,\n visitor: {\n Rule: (rule) => {\n if (rule.type === \"unknown\" && rule.value.name === \"variant\") {\n const [firstPrelude] = rule.value.prelude;\n\n if (\n firstPrelude?.type !== \"token\" ||\n firstPrelude.value.type !== \"ident\" ||\n !themes.includes(firstPrelude.value.value)\n ) {\n return;\n }\n\n const theme = firstPrelude.value.value;\n\n rule.value.block?.forEach((block) => {\n if (block.type === \"dashed-ident\") {\n themesVariables[theme]?.add(block.value);\n }\n });\n }\n },\n },\n });\n\n if (!Array.isArray(dependencies)) {\n return;\n }\n\n const importUrls = new Set<string>();\n const importsCSS = dependencies\n .filter((dependency) => {\n if (dependency.url.startsWith(\".\")) {\n importUrls.add(path.resolve(path.dirname(cssPath), dependency.url));\n\n return false;\n }\n\n return !isExcludedDependency(dependency.url);\n })\n .map((dependency) => `@import \"${dependency.url}\";`)\n .join(\"\\n\");\n\n await compile(importsCSS, {\n base: path.resolve(path.dirname(cssPath)),\n onDependency: (dependency) => {\n if (isExcludedDependency(dependency)) {\n return;\n }\n\n importUrls.add(dependency);\n },\n });\n\n for (const filePath of importUrls) {\n await findVariantsRec(filePath);\n }\n };\n\n await findVariantsRec(input);\n\n // Check if all themes have the same variables\n let hasErrors = false as boolean;\n const hasVariables = Object.values(themesVariables).some(\n (variables) => variables.size > 0,\n );\n\n Object.values(themesVariables).forEach((variables) => {\n Object.entries(themesVariables).forEach(\n ([checkedTheme, checkedVariables]) => {\n variables.forEach((variable) => {\n if (!checkedVariables.has(variable)) {\n Logger.error(\n `Theme ${checkedTheme} is missing variable ${variable}`,\n );\n hasErrors = true;\n }\n });\n },\n );\n });\n\n if (hasErrors) {\n Logger.error(\"All themes must have the same variables\");\n }\n\n const variablesCSS = hasVariables\n ? [\n \"\",\n \"@theme {\",\n ...Array.from(Object.values(themesVariables).at(0) ?? []).map(\n (variable) => ` ${variable}: unset;`,\n ),\n \"}\",\n ]\n : [];\n const uniwindCSS = [\n ...themes.map(\n (theme) => `@custom-variant ${theme} (&:where(.${theme}, .${theme} *));`,\n ),\n ...variablesCSS,\n ].join(\"\\n\");\n\n return uniwindCSS;\n};\n"],"mappings":";;;;;;;AAMA,MAAM,gBAAgB,aAAqB;AACzC,KAAI;AACF,SAAO,GAAG,aAAa,UAAU,QAAQ;SACnC;AACN,SAAO;;;AAIX,MAAM,wBAAwB,QAC5B;CACE,IAAI,SAAS,2BAA2B;CACxC,IAAI,SAAS,4BAA4B;CACzC,IAAI,SAAS,uBAAuB;CACrC,CAAC,KAAK,QAAQ;AAEjB,MAAa,uBAAuB,OAClC,QACA,UACG;CAEH,MAAM,kBAAkB,OAAO,YAC7B,OAAO,KAAK,UAAU,CAAC,uBAAO,IAAI,KAAa,CAAC,CAAC,CAClD;CAED,MAAM,kBAAkB,OAAO,YAAoB;EACjD,MAAM,MAAM,aAAa,QAAQ;AAEjC,MAAI,QAAQ,KACV;EAGF,MAAM,EAAE,iBAAiB,UAAU;GACjC,MAAM,OAAO,KAAK,IAAI;GACtB,UAAU;GACV,qBAAqB;GACrB,SAAS,EACP,OAAO,SAAS;AACd,QAAI,KAAK,SAAS,aAAa,KAAK,MAAM,SAAS,WAAW;KAC5D,MAAM,CAAC,gBAAgB,KAAK,MAAM;AAElC,SACE,cAAc,SAAS,WACvB,aAAa,MAAM,SAAS,WAC5B,CAAC,OAAO,SAAS,aAAa,MAAM,MAAM,CAE1C;KAGF,MAAM,QAAQ,aAAa,MAAM;AAEjC,UAAK,MAAM,OAAO,SAAS,UAAU;AACnC,UAAI,MAAM,SAAS,eACjB,iBAAgB,QAAQ,IAAI,MAAM,MAAM;OAE1C;;MAGP;GACF,CAAC;AAEF,MAAI,CAAC,MAAM,QAAQ,aAAa,CAC9B;EAGF,MAAM,6BAAa,IAAI,KAAa;AAcpC,QAAM,QAba,aAChB,QAAQ,eAAe;AACtB,OAAI,WAAW,IAAI,WAAW,IAAI,EAAE;AAClC,eAAW,IAAI,KAAK,QAAQ,KAAK,QAAQ,QAAQ,EAAE,WAAW,IAAI,CAAC;AAEnE,WAAO;;AAGT,UAAO,CAAC,qBAAqB,WAAW,IAAI;IAC5C,CACD,KAAK,eAAe,YAAY,WAAW,IAAI,IAAI,CACnD,KAAK,KAAK,EAEa;GACxB,MAAM,KAAK,QAAQ,KAAK,QAAQ,QAAQ,CAAC;GACzC,eAAe,eAAe;AAC5B,QAAI,qBAAqB,WAAW,CAClC;AAGF,eAAW,IAAI,WAAW;;GAE7B,CAAC;AAEF,OAAK,MAAM,YAAY,WACrB,OAAM,gBAAgB,SAAS;;AAInC,OAAM,gBAAgB,MAAM;CAG5B,IAAI,YAAY;CAChB,MAAM,eAAe,OAAO,OAAO,gBAAgB,CAAC,MACjD,cAAc,UAAU,OAAO,EACjC;AAED,QAAO,OAAO,gBAAgB,CAAC,SAAS,cAAc;AACpD,SAAO,QAAQ,gBAAgB,CAAC,SAC7B,CAAC,cAAc,sBAAsB;AACpC,aAAU,SAAS,aAAa;AAC9B,QAAI,CAAC,iBAAiB,IAAI,SAAS,EAAE;AACnC,YAAO,MACL,SAAS,aAAa,uBAAuB,WAC9C;AACD,iBAAY;;KAEd;IAEL;GACD;AAEF,KAAI,UACF,QAAO,MAAM,0CAA0C;CAGzD,MAAM,eAAe,eACjB;EACE;EACA;EACA,GAAG,MAAM,KAAK,OAAO,OAAO,gBAAgB,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,KACvD,aAAa,OAAO,SAAS,UAC/B;EACD;EACD,GACD,EAAE;AAQN,QAPmB,CACjB,GAAG,OAAO,KACP,UAAU,mBAAmB,MAAM,aAAa,MAAM,KAAK,MAAM,OACnE,EACD,GAAG,aACJ,CAAC,KAAK,KAAK"}
@@ -1,5 +1,5 @@
1
1
 
2
- //#region src/webpack/uniwind/src/css/variants.ts
2
+ //#region src/uniwind/src/css/variants.ts
3
3
  const variants = [
4
4
  "ios",
5
5
  "android",
@@ -1,4 +1,4 @@
1
- //#region src/webpack/uniwind/src/css/variants.ts
1
+ //#region src/uniwind/src/css/variants.ts
2
2
  const variants = [
3
3
  "ios",
4
4
  "android",
@@ -0,0 +1 @@
1
+ {"version":3,"file":"variants.mjs","names":[],"sources":["../../../../src/uniwind/src/css/variants.ts"],"sourcesContent":["const variants = [\"ios\", \"android\", \"web\", \"native\"];\n\nexport const generateCSSForVariants = () => {\n let css = \"\";\n\n variants.forEach((variant) => {\n css += `@custom-variant ${variant} (${variant === \"web\" ? \"html &\" : `@media ${variant}`});\\n`;\n });\n\n return css;\n};\n"],"mappings":";AAAA,MAAM,WAAW;CAAC;CAAO;CAAW;CAAO;CAAS;AAEpD,MAAa,+BAA+B;CAC1C,IAAI,MAAM;AAEV,UAAS,SAAS,YAAY;AAC5B,SAAO,mBAAmB,QAAQ,IAAI,YAAY,QAAQ,WAAW,UAAU,UAAU;GACzF;AAEF,QAAO"}
@@ -1,5 +1,5 @@
1
1
 
2
- //#region src/webpack/uniwind/src/metro/logger.ts
2
+ //#region src/uniwind/src/metro/logger.ts
3
3
  const red = "\x1B[91m";
4
4
  const yellow = "\x1B[33m";
5
5
  const blue = "\x1B[36m";
@@ -1,4 +1,4 @@
1
- //#region src/webpack/uniwind/src/metro/logger.ts
1
+ //#region src/uniwind/src/metro/logger.ts
2
2
  const red = "\x1B[91m";
3
3
  const yellow = "\x1B[33m";
4
4
  const blue = "\x1B[36m";
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.mjs","names":["name: string"],"sources":["../../../../src/uniwind/src/metro/logger.ts"],"sourcesContent":["/* eslint-disable no-console */\n\nconst red = \"\\x1b[91m\";\nconst yellow = \"\\x1b[33m\";\nconst blue = \"\\x1b[36m\";\nconst reset = \"\\x1b[0m\";\n\nexport class Logger {\n static debug = false;\n\n constructor(private readonly name: string) {}\n\n static log(message: string, meta = \"\") {\n if (!Logger.debug) {\n return;\n }\n\n console.log(`${blue}Uniwind ${meta}- ${message}${reset}`);\n }\n\n static error(message: string, meta = \"\") {\n console.log(`${red}Uniwind Error ${meta}- ${message}${reset}`);\n }\n\n static warn(message: string, meta = \"\") {\n if (!Logger.debug) {\n return;\n }\n\n console.log(`${yellow}Uniwind Warning ${meta}- ${message}${reset}`);\n }\n\n log(message: string) {\n Logger.log(message, `[${this.name} Processor] `);\n }\n\n error(message: string) {\n Logger.error(message, `[${this.name} Processor] `);\n }\n\n warn(message: string) {\n Logger.warn(message, `[${this.name} Processor] `);\n }\n}\n"],"mappings":";AAEA,MAAM,MAAM;AACZ,MAAM,SAAS;AACf,MAAM,OAAO;AACb,MAAM,QAAQ;AAEd,IAAa,SAAb,MAAa,OAAO;;eACH;;CAEf,YAAY,AAAiBA,MAAc;EAAd;;CAE7B,OAAO,IAAI,SAAiB,OAAO,IAAI;AACrC,MAAI,CAAC,OAAO,MACV;AAGF,UAAQ,IAAI,GAAG,KAAK,UAAU,KAAK,IAAI,UAAU,QAAQ;;CAG3D,OAAO,MAAM,SAAiB,OAAO,IAAI;AACvC,UAAQ,IAAI,GAAG,IAAI,gBAAgB,KAAK,IAAI,UAAU,QAAQ;;CAGhE,OAAO,KAAK,SAAiB,OAAO,IAAI;AACtC,MAAI,CAAC,OAAO,MACV;AAGF,UAAQ,IAAI,GAAG,OAAO,kBAAkB,KAAK,IAAI,UAAU,QAAQ;;CAGrE,IAAI,SAAiB;AACnB,SAAO,IAAI,SAAS,IAAI,KAAK,KAAK,cAAc;;CAGlD,MAAM,SAAiB;AACrB,SAAO,MAAM,SAAS,IAAI,KAAK,KAAK,cAAc;;CAGpD,KAAK,SAAiB;AACpB,SAAO,KAAK,SAAS,IAAI,KAAK,KAAK,cAAc"}
@@ -1,9 +1,9 @@
1
- const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
1
+ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
2
  const require_package = require('../../package.cjs');
3
3
  let fs = require("fs");
4
4
  fs = require_rolldown_runtime.__toESM(fs);
5
5
 
6
- //#region src/webpack/uniwind/src/utils/buildDtsFile.ts
6
+ //#region src/uniwind/src/utils/buildDtsFile.ts
7
7
  const buildDtsFile = (dtsPath, stringifiedThemes) => {
8
8
  const oldDtsContent = fs.default.existsSync(dtsPath) ? fs.default.readFileSync(dtsPath, "utf-8") : "";
9
9
  const dtsContent = [
@@ -1,7 +1,7 @@
1
1
  import { name } from "../../package.mjs";
2
2
  import fs from "fs";
3
3
 
4
- //#region src/webpack/uniwind/src/utils/buildDtsFile.ts
4
+ //#region src/uniwind/src/utils/buildDtsFile.ts
5
5
  const buildDtsFile = (dtsPath, stringifiedThemes) => {
6
6
  const oldDtsContent = fs.existsSync(dtsPath) ? fs.readFileSync(dtsPath, "utf-8") : "";
7
7
  const dtsContent = [
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildDtsFile.mjs","names":[],"sources":["../../../../src/uniwind/src/utils/buildDtsFile.ts"],"sourcesContent":["import fs from \"fs\";\nimport { name } from \"../../package.json\";\n\nexport const buildDtsFile = (dtsPath: string, stringifiedThemes: string) => {\n const oldDtsContent = fs.existsSync(dtsPath)\n ? fs.readFileSync(dtsPath, \"utf-8\")\n : \"\";\n const dtsContent = [\n `// NOTE: This file is generated by ${name} and it should not be edited manually.`,\n `/// <reference types=\"${name}/types\" />`,\n \"\",\n `declare module '${name}' {`,\n ` export interface UniwindConfig {`,\n ` themes: readonly ${stringifiedThemes}`,\n ` }`,\n `}`,\n \"\",\n `export {}`,\n \"\",\n ].join(\"\\n\");\n\n if (oldDtsContent === dtsContent) {\n return;\n }\n\n fs.writeFileSync(dtsPath, dtsContent);\n};\n"],"mappings":";;;;AAGA,MAAa,gBAAgB,SAAiB,sBAA8B;CAC1E,MAAM,gBAAgB,GAAG,WAAW,QAAQ,GACxC,GAAG,aAAa,SAAS,QAAQ,GACjC;CACJ,MAAM,aAAa;EACjB,sCAAsC,KAAK;EAC3C,yBAAyB,KAAK;EAC9B;EACA,mBAAmB,KAAK;EACxB;EACA,4BAA4B;EAC5B;EACA;EACA;EACA;EACA;EACD,CAAC,KAAK,KAAK;AAEZ,KAAI,kBAAkB,WACpB;AAGF,IAAG,cAAc,SAAS,WAAW"}
@@ -1,5 +1,5 @@
1
1
 
2
- //#region src/webpack/uniwind/src/utils/stringifyThemes.ts
2
+ //#region src/uniwind/src/utils/stringifyThemes.ts
3
3
  const stringifyThemes = (themes = []) => `[${themes.map((theme) => `'${theme}'`).join(", ")}]`;
4
4
 
5
5
  //#endregion
@@ -1,4 +1,4 @@
1
- //#region src/webpack/uniwind/src/utils/stringifyThemes.ts
1
+ //#region src/uniwind/src/utils/stringifyThemes.ts
2
2
  const stringifyThemes = (themes = []) => `[${themes.map((theme) => `'${theme}'`).join(", ")}]`;
3
3
 
4
4
  //#endregion
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stringifyThemes.mjs","names":[],"sources":["../../../../src/uniwind/src/utils/stringifyThemes.ts"],"sourcesContent":["export const stringifyThemes = (themes: Array<string> = []) =>\n `[${themes.map((theme) => `'${theme}'`).join(\", \")}]`;\n"],"mappings":";AAAA,MAAa,mBAAmB,SAAwB,EAAE,KACxD,IAAI,OAAO,KAAK,UAAU,IAAI,MAAM,GAAG,CAAC,KAAK,KAAK,CAAC"}
@@ -1,10 +1,11 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
- const require_index = require('./uniwind/src/css/index.cjs');
3
- const require_buildDtsFile = require('./uniwind/src/utils/buildDtsFile.cjs');
4
- const require_stringifyThemes = require('./uniwind/src/utils/stringifyThemes.cjs');
5
- const require_util = require('./util.cjs');
2
+ const require_util = require('../common/util.cjs');
3
+ const require_index = require('../uniwind/src/css/index.cjs');
4
+ const require_buildDtsFile = require('../uniwind/src/utils/buildDtsFile.cjs');
5
+ const require_stringifyThemes = require('../uniwind/src/utils/stringifyThemes.cjs');
6
6
  let path = require("path");
7
7
  path = require_rolldown_runtime.__toESM(path);
8
+ let fs_promises = require("fs/promises");
8
9
 
9
10
  //#region src/webpack/UniwindWebpackPlugin.ts
10
11
  const dirname = typeof __dirname !== "undefined" ? __dirname : __dirname;
@@ -26,6 +27,7 @@ var UniwindWebpackPlugin = class {
26
27
  this.hasRun = true;
27
28
  await require_index.buildCSS(this.themes, this.cssEntryFile);
28
29
  require_buildDtsFile.buildDtsFile(this.dtsFile, require_stringifyThemes.stringifyThemes(this.themes));
30
+ await (0, fs_promises.cp)(path.default.resolve(dirname, "../uniwind/uniwind.css"), path.default.join(path.default.dirname(require.resolve(this.packageName + "/package.json", { paths: [compiler.context] })), "uniwind.css"), { force: true });
29
31
  });
30
32
  compiler.options.module = compiler.options.module || { rules: [] };
31
33
  compiler.options.module.rules.push({
@@ -1,8 +1,10 @@
1
- import { buildCSS } from "./uniwind/src/css/index.mjs";
2
- import { buildDtsFile } from "./uniwind/src/utils/buildDtsFile.mjs";
3
- import { stringifyThemes } from "./uniwind/src/utils/stringifyThemes.mjs";
4
- import { uniq } from "./util.mjs";
1
+ import { __require } from "../_virtual/rolldown_runtime.mjs";
2
+ import { uniq } from "../common/util.mjs";
3
+ import { buildCSS } from "../uniwind/src/css/index.mjs";
4
+ import { buildDtsFile } from "../uniwind/src/utils/buildDtsFile.mjs";
5
+ import { stringifyThemes } from "../uniwind/src/utils/stringifyThemes.mjs";
5
6
  import path from "path";
7
+ import { cp } from "fs/promises";
6
8
 
7
9
  //#region src/webpack/UniwindWebpackPlugin.ts
8
10
  const dirname = typeof __dirname !== "undefined" ? __dirname : import.meta.dirname;
@@ -24,6 +26,7 @@ var UniwindWebpackPlugin = class {
24
26
  this.hasRun = true;
25
27
  await buildCSS(this.themes, this.cssEntryFile);
26
28
  buildDtsFile(this.dtsFile, stringifyThemes(this.themes));
29
+ await cp(path.resolve(dirname, "../uniwind/uniwind.css"), path.join(path.dirname(__require.resolve(this.packageName + "/package.json", { paths: [compiler.context] })), "uniwind.css"), { force: true });
27
30
  });
28
31
  compiler.options.module = compiler.options.module || { rules: [] };
29
32
  compiler.options.module.rules.push({
@@ -1 +1 @@
1
- {"version":3,"file":"UniwindWebpackPlugin.mjs","names":["packageName: uniwindPackageName"],"sources":["../../src/webpack/UniwindWebpackPlugin.ts"],"sourcesContent":["import { UniwindConfig, uniwindPackageName } from \"./types\";\nimport type { Compiler } from \"webpack\";\nimport path from \"path\";\nimport { buildCSS } from \"./uniwind/src/css\";\nimport { buildDtsFile } from \"./uniwind/src/utils/buildDtsFile\";\nimport { stringifyThemes } from \"./uniwind/src/utils/stringifyThemes\";\nimport { uniq } from \"./util\";\n\nconst dirname =\n typeof __dirname !== \"undefined\" ? __dirname : import.meta.dirname;\n\nexport class UniwindWebpackPlugin {\n private hasRun = false;\n private readonly themes: string[];\n private readonly dtsFile: string;\n private readonly cssEntryFile: string;\n\n constructor(\n private readonly packageName: uniwindPackageName,\n {\n cssEntryFile,\n extraThemes = [],\n dtsFile = \"uniwind-types.d.ts\",\n }: UniwindConfig,\n ) {\n this.themes = uniq([\"light\", \"dark\", ...(extraThemes ?? [])]);\n this.dtsFile = dtsFile;\n this.cssEntryFile = cssEntryFile;\n }\n\n apply(compiler: Compiler) {\n compiler.hooks.beforeCompile.tapPromise(\n \"UniwindWebpackPlugin\",\n async () => {\n if (this.hasRun) return;\n this.hasRun = true;\n\n // 1. Generate uniwind.css\n await buildCSS(this.themes, this.cssEntryFile);\n\n // 2. Generate uniwind-types.d.ts\n buildDtsFile(this.dtsFile, stringifyThemes(this.themes));\n },\n );\n\n // Inject the uniwind reinit() call\n compiler.options.module = compiler.options.module || { rules: [] };\n compiler.options.module.rules.push({\n test: /config\\.c?js$/,\n include: new RegExp(`${this.packageName}[\\\\/\\\\\\\\]dist`),\n use: [\n {\n loader: path.resolve(dirname, \"configInjectionLoader.js\"),\n options: {\n stringifiedThemes: stringifyThemes(this.themes),\n },\n },\n ],\n });\n // Add \"use client\" to uniwind web components\n compiler.options.module.rules.push({\n test: /\\.js$/,\n exclude: /index\\.js$/,\n include: new RegExp(\n `${this.packageName}[\\\\/\\\\\\\\]dist[\\\\/\\\\\\\\]module[\\\\/\\\\\\\\]components[\\\\/\\\\\\\\]web`,\n ),\n use: [\n {\n loader: path.resolve(dirname, \"clientDirectiveLoader.js\"),\n },\n ],\n });\n }\n}\n"],"mappings":";;;;;;;AAQA,MAAM,UACJ,OAAO,cAAc,cAAc,YAAY,OAAO,KAAK;AAE7D,IAAa,uBAAb,MAAkC;CAMhC,YACE,AAAiBA,aACjB,EACE,cACA,cAAc,EAAE,EAChB,UAAU,wBAEZ;EANiB;gBANF;AAaf,OAAK,SAAS,KAAK;GAAC;GAAS;GAAQ,GAAI,eAAe,EAAE;GAAE,CAAC;AAC7D,OAAK,UAAU;AACf,OAAK,eAAe;;CAGtB,MAAM,UAAoB;AACxB,WAAS,MAAM,cAAc,WAC3B,wBACA,YAAY;AACV,OAAI,KAAK,OAAQ;AACjB,QAAK,SAAS;AAGd,SAAM,SAAS,KAAK,QAAQ,KAAK,aAAa;AAG9C,gBAAa,KAAK,SAAS,gBAAgB,KAAK,OAAO,CAAC;IAE3D;AAGD,WAAS,QAAQ,SAAS,SAAS,QAAQ,UAAU,EAAE,OAAO,EAAE,EAAE;AAClE,WAAS,QAAQ,OAAO,MAAM,KAAK;GACjC,MAAM;GACN,yBAAS,IAAI,OAAO,GAAG,KAAK,YAAY,eAAe;GACvD,KAAK,CACH;IACE,QAAQ,KAAK,QAAQ,SAAS,2BAA2B;IACzD,SAAS,EACP,mBAAmB,gBAAgB,KAAK,OAAO,EAChD;IACF,CACF;GACF,CAAC;AAEF,WAAS,QAAQ,OAAO,MAAM,KAAK;GACjC,MAAM;GACN,SAAS;GACT,yBAAS,IAAI,OACX,GAAG,KAAK,YAAY,6DACrB;GACD,KAAK,CACH,EACE,QAAQ,KAAK,QAAQ,SAAS,2BAA2B,EAC1D,CACF;GACF,CAAC"}
1
+ {"version":3,"file":"UniwindWebpackPlugin.mjs","names":["packageName: uniwindPackageName"],"sources":["../../src/webpack/UniwindWebpackPlugin.ts"],"sourcesContent":["import type { Compiler } from \"webpack\";\nimport path from \"path\";\nimport { cp } from \"fs/promises\";\nimport { UniwindConfig, uniwindPackageName } from \"../common/types\";\nimport { uniq } from \"../common/util\";\nimport { buildCSS } from \"../uniwind/src/css\";\nimport { buildDtsFile } from \"../uniwind/src/utils/buildDtsFile\";\nimport { stringifyThemes } from \"../uniwind/src/utils/stringifyThemes\";\n\nconst dirname =\n typeof __dirname !== \"undefined\" ? __dirname : import.meta.dirname;\n\nexport class UniwindWebpackPlugin {\n private hasRun = false;\n private readonly themes: string[];\n private readonly dtsFile: string;\n private readonly cssEntryFile: string;\n\n constructor(\n private readonly packageName: uniwindPackageName,\n {\n cssEntryFile,\n extraThemes = [],\n dtsFile = \"uniwind-types.d.ts\",\n }: UniwindConfig,\n ) {\n this.themes = uniq([\"light\", \"dark\", ...(extraThemes ?? [])]);\n this.dtsFile = dtsFile;\n this.cssEntryFile = cssEntryFile;\n }\n\n apply(compiler: Compiler) {\n compiler.hooks.beforeCompile.tapPromise(\n \"UniwindWebpackPlugin\",\n async () => {\n if (this.hasRun) return;\n this.hasRun = true;\n\n // 1. Generate uniwind.css\n await buildCSS(this.themes, this.cssEntryFile);\n\n // 2. Generate uniwind-types.d.ts\n buildDtsFile(this.dtsFile, stringifyThemes(this.themes));\n\n // 3. Move uniwind.css to the uniwind package dist folder\n const builtCSSPath = path.resolve(dirname, \"../uniwind/uniwind.css\");\n const targetCSSPath = path.join(\n path.dirname(\n require.resolve(this.packageName + \"/package.json\", {\n paths: [compiler.context],\n }),\n ),\n \"uniwind.css\",\n );\n\n await cp(builtCSSPath, targetCSSPath, { force: true });\n },\n );\n\n // Inject the uniwind reinit() call\n compiler.options.module = compiler.options.module || { rules: [] };\n compiler.options.module.rules.push({\n test: /config\\.c?js$/,\n include: new RegExp(`${this.packageName}[\\\\/\\\\\\\\]dist`),\n use: [\n {\n loader: path.resolve(dirname, \"configInjectionLoader.js\"),\n options: {\n stringifiedThemes: stringifyThemes(this.themes),\n },\n },\n ],\n });\n // Add \"use client\" to uniwind web components\n compiler.options.module.rules.push({\n test: /\\.js$/,\n exclude: /index\\.js$/,\n include: new RegExp(\n `${this.packageName}[\\\\/\\\\\\\\]dist[\\\\/\\\\\\\\]module[\\\\/\\\\\\\\]components[\\\\/\\\\\\\\]web`,\n ),\n use: [\n {\n loader: path.resolve(dirname, \"clientDirectiveLoader.js\"),\n },\n ],\n });\n }\n}\n"],"mappings":";;;;;;;;;AASA,MAAM,UACJ,OAAO,cAAc,cAAc,YAAY,OAAO,KAAK;AAE7D,IAAa,uBAAb,MAAkC;CAMhC,YACE,AAAiBA,aACjB,EACE,cACA,cAAc,EAAE,EAChB,UAAU,wBAEZ;EANiB;gBANF;AAaf,OAAK,SAAS,KAAK;GAAC;GAAS;GAAQ,GAAI,eAAe,EAAE;GAAE,CAAC;AAC7D,OAAK,UAAU;AACf,OAAK,eAAe;;CAGtB,MAAM,UAAoB;AACxB,WAAS,MAAM,cAAc,WAC3B,wBACA,YAAY;AACV,OAAI,KAAK,OAAQ;AACjB,QAAK,SAAS;AAGd,SAAM,SAAS,KAAK,QAAQ,KAAK,aAAa;AAG9C,gBAAa,KAAK,SAAS,gBAAgB,KAAK,OAAO,CAAC;AAaxD,SAAM,GAVe,KAAK,QAAQ,SAAS,yBAAyB,EAC9C,KAAK,KACzB,KAAK,kBACK,QAAQ,KAAK,cAAc,iBAAiB,EAClD,OAAO,CAAC,SAAS,QAAQ,EAC1B,CAAC,CACH,EACD,cACD,EAEqC,EAAE,OAAO,MAAM,CAAC;IAEzD;AAGD,WAAS,QAAQ,SAAS,SAAS,QAAQ,UAAU,EAAE,OAAO,EAAE,EAAE;AAClE,WAAS,QAAQ,OAAO,MAAM,KAAK;GACjC,MAAM;GACN,yBAAS,IAAI,OAAO,GAAG,KAAK,YAAY,eAAe;GACvD,KAAK,CACH;IACE,QAAQ,KAAK,QAAQ,SAAS,2BAA2B;IACzD,SAAS,EACP,mBAAmB,gBAAgB,KAAK,OAAO,EAChD;IACF,CACF;GACF,CAAC;AAEF,WAAS,QAAQ,OAAO,MAAM,KAAK;GACjC,MAAM;GACN,SAAS;GACT,yBAAS,IAAI,OACX,GAAG,KAAK,YAAY,6DACrB;GACD,KAAK,CACH,EACE,QAAQ,KAAK,QAAQ,SAAS,2BAA2B,EAC1D,CACF;GACF,CAAC"}
@@ -1,5 +1,5 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
- const require_util = require('./util.cjs');
2
+ const require_util = require('../common/util.cjs');
3
3
  const require_UniwindWebpackPlugin = require('./UniwindWebpackPlugin.cjs');
4
4
  let webpack = require("webpack");
5
5
  webpack = require_rolldown_runtime.__toESM(webpack);
@@ -9,6 +9,8 @@ path = require_rolldown_runtime.__toESM(path);
9
9
  //#region src/webpack/withUniwindBase.ts
10
10
  const { NormalModuleReplacementPlugin } = webpack.default;
11
11
  function withUniwindBase(packageName, nextConfig = {}, uniwindConfig) {
12
+ if (typeof uniwindConfig === "undefined") throw new Error("Uniwind: You need to pass a second parameter to withUniwind");
13
+ if (typeof uniwindConfig.cssEntryFile === "undefined") throw new Error("Uniwind: You need to pass a css entry file to withUniwind, e.g. withUniwind(config, { cssEntryFile: \"./global.css\" })");
12
14
  return {
13
15
  ...nextConfig,
14
16
  transpilePackages: require_util.uniq([
@@ -23,6 +25,9 @@ function withUniwindBase(packageName, nextConfig = {}, uniwindConfig) {
23
25
  if ((resource.context || "").includes(`${path.default.sep}${packageName}${path.default.sep}dist${path.default.sep}module${path.default.sep}components${path.default.sep}web`)) resource.request = "react-native-web";
24
26
  else resource.request = `${packageName}/components/index`;
25
27
  }));
28
+ config.plugins.push(new webpack.default.NormalModuleReplacementPlugin(/^\.\/createOrderedCSSStyleSheet$/, (resource) => {
29
+ if ((resource.context || "").includes("react-native-web/dist/exports/StyleSheet")) resource.request = `${packageName}/components/createOrderedCSSStyleSheet`;
30
+ }));
26
31
  config.plugins.push(new require_UniwindWebpackPlugin.UniwindWebpackPlugin(packageName, uniwindConfig));
27
32
  if (typeof nextConfig.webpack === "function") return nextConfig.webpack(config, options);
28
33
  return config;
@@ -1,4 +1,4 @@
1
- import { uniq } from "./util.mjs";
1
+ import { uniq } from "../common/util.mjs";
2
2
  import { UniwindWebpackPlugin } from "./UniwindWebpackPlugin.mjs";
3
3
  import webpack from "webpack";
4
4
  import path from "path";
@@ -6,6 +6,8 @@ import path from "path";
6
6
  //#region src/webpack/withUniwindBase.ts
7
7
  const { NormalModuleReplacementPlugin } = webpack;
8
8
  function withUniwindBase(packageName, nextConfig = {}, uniwindConfig) {
9
+ if (typeof uniwindConfig === "undefined") throw new Error("Uniwind: You need to pass a second parameter to withUniwind");
10
+ if (typeof uniwindConfig.cssEntryFile === "undefined") throw new Error("Uniwind: You need to pass a css entry file to withUniwind, e.g. withUniwind(config, { cssEntryFile: \"./global.css\" })");
9
11
  return {
10
12
  ...nextConfig,
11
13
  transpilePackages: uniq([
@@ -20,6 +22,9 @@ function withUniwindBase(packageName, nextConfig = {}, uniwindConfig) {
20
22
  if ((resource.context || "").includes(`${path.sep}${packageName}${path.sep}dist${path.sep}module${path.sep}components${path.sep}web`)) resource.request = "react-native-web";
21
23
  else resource.request = `${packageName}/components/index`;
22
24
  }));
25
+ config.plugins.push(new webpack.NormalModuleReplacementPlugin(/^\.\/createOrderedCSSStyleSheet$/, (resource) => {
26
+ if ((resource.context || "").includes("react-native-web/dist/exports/StyleSheet")) resource.request = `${packageName}/components/createOrderedCSSStyleSheet`;
27
+ }));
23
28
  config.plugins.push(new UniwindWebpackPlugin(packageName, uniwindConfig));
24
29
  if (typeof nextConfig.webpack === "function") return nextConfig.webpack(config, options);
25
30
  return config;
@@ -1 +1 @@
1
- {"version":3,"file":"withUniwindBase.mjs","names":[],"sources":["../../src/webpack/withUniwindBase.ts"],"sourcesContent":["import webpack from \"webpack\";\nimport type { Configuration } from \"webpack\";\nimport path from \"path\";\nimport type { UniwindConfig, uniwindPackageName } from \"./types\";\nimport { UniwindWebpackPlugin } from \"./UniwindWebpackPlugin\";\nimport { uniq } from \"./util\";\n\nconst { NormalModuleReplacementPlugin } = webpack;\n\nexport function withUniwindBase(\n packageName: uniwindPackageName,\n nextConfig: any = {},\n uniwindConfig: UniwindConfig,\n): any {\n return {\n ...nextConfig,\n transpilePackages: uniq([\n ...(nextConfig.transpilePackages || []),\n packageName,\n \"react-native\",\n \"react-native-web\",\n ]),\n webpack(config: Configuration, options: any): Configuration {\n if (!config.plugins) config.plugins = [];\n\n // Rewrite imports, slightly more complex than usual because we need both:\n // Rewrite `react-native` imports to `uniwind/components/index`\n // Rewrite `react-native` imports within Uniwind components to `react-native-web`\n config.plugins.push(\n new NormalModuleReplacementPlugin(/^react-native$/, (resource) => {\n const context = resource.context || \"\";\n\n if (\n context.includes(\n `${path.sep}${packageName}${path.sep}dist${path.sep}module${path.sep}components${path.sep}web`,\n )\n ) {\n // Inside uniwind/dist → react-native-web\n resource.request = \"react-native-web\";\n } else {\n // Everywhere else → uniwnd/web\n resource.request = `${packageName}/components/index`;\n }\n }),\n );\n\n config.plugins.push(new UniwindWebpackPlugin(packageName, uniwindConfig));\n\n // Execute the user-defined webpack config.\n if (typeof nextConfig.webpack === \"function\") {\n return nextConfig.webpack(config, options);\n }\n\n return config;\n },\n };\n}\n"],"mappings":";;;;;;AAOA,MAAM,EAAE,kCAAkC;AAE1C,SAAgB,gBACd,aACA,aAAkB,EAAE,EACpB,eACK;AACL,QAAO;EACL,GAAG;EACH,mBAAmB,KAAK;GACtB,GAAI,WAAW,qBAAqB,EAAE;GACtC;GACA;GACA;GACD,CAAC;EACF,QAAQ,QAAuB,SAA6B;AAC1D,OAAI,CAAC,OAAO,QAAS,QAAO,UAAU,EAAE;AAKxC,UAAO,QAAQ,KACb,IAAI,8BAA8B,mBAAmB,aAAa;AAGhE,SAFgB,SAAS,WAAW,IAG1B,SACN,GAAG,KAAK,MAAM,cAAc,KAAK,IAAI,MAAM,KAAK,IAAI,QAAQ,KAAK,IAAI,YAAY,KAAK,IAAI,KAC3F,CAGD,UAAS,UAAU;QAGnB,UAAS,UAAU,GAAG,YAAY;KAEpC,CACH;AAED,UAAO,QAAQ,KAAK,IAAI,qBAAqB,aAAa,cAAc,CAAC;AAGzE,OAAI,OAAO,WAAW,YAAY,WAChC,QAAO,WAAW,QAAQ,QAAQ,QAAQ;AAG5C,UAAO;;EAEV"}
1
+ {"version":3,"file":"withUniwindBase.mjs","names":[],"sources":["../../src/webpack/withUniwindBase.ts"],"sourcesContent":["import webpack from \"webpack\";\nimport type { Configuration } from \"webpack\";\nimport path from \"path\";\nimport { UniwindWebpackPlugin } from \"./UniwindWebpackPlugin\";\nimport { UniwindConfig, uniwindPackageName } from \"../common/types\";\nimport { uniq } from \"../common/util\";\n\nconst { NormalModuleReplacementPlugin } = webpack;\n\nexport function withUniwindBase(\n packageName: uniwindPackageName,\n nextConfig: any = {},\n uniwindConfig: UniwindConfig,\n): any {\n if (typeof uniwindConfig === \"undefined\") {\n throw new Error(\n \"Uniwind: You need to pass a second parameter to withUniwind\",\n );\n }\n\n if (typeof uniwindConfig.cssEntryFile === \"undefined\") {\n throw new Error(\n 'Uniwind: You need to pass a css entry file to withUniwind, e.g. withUniwind(config, { cssEntryFile: \"./global.css\" })',\n );\n }\n\n return {\n ...nextConfig,\n transpilePackages: uniq([\n ...(nextConfig.transpilePackages || []),\n packageName,\n \"react-native\",\n \"react-native-web\",\n ]),\n webpack(config: Configuration, options: any): Configuration {\n if (!config.plugins) config.plugins = [];\n\n // Rewrite imports, slightly more complex than usual because we need both:\n // Rewrite `react-native` imports to `uniwind/components/index`\n // Rewrite `react-native` imports within Uniwind components to `react-native-web`\n config.plugins.push(\n new NormalModuleReplacementPlugin(/^react-native$/, (resource) => {\n const context = resource.context || \"\";\n\n if (\n context.includes(\n `${path.sep}${packageName}${path.sep}dist${path.sep}module${path.sep}components${path.sep}web`,\n )\n ) {\n // Inside uniwind/dist → react-native-web\n resource.request = \"react-native-web\";\n } else {\n // Everywhere else → uniwind/web\n resource.request = `${packageName}/components/index`;\n }\n }),\n );\n\n // Rewrite createOrderedCSSStyleSheet from react-native-web to the Uniwind version\n config.plugins.push(\n new webpack.NormalModuleReplacementPlugin(\n /^\\.\\/createOrderedCSSStyleSheet$/,\n (resource) => {\n const context = resource.context || \"\";\n\n // Scope rewrite to react-native-web only\n if (context.includes(\"react-native-web/dist/exports/StyleSheet\")) {\n resource.request = `${packageName}/components/createOrderedCSSStyleSheet`;\n }\n },\n ),\n );\n\n config.plugins.push(new UniwindWebpackPlugin(packageName, uniwindConfig));\n\n // Execute the user-defined webpack config.\n if (typeof nextConfig.webpack === \"function\") {\n return nextConfig.webpack(config, options);\n }\n\n return config;\n },\n };\n}\n"],"mappings":";;;;;;AAOA,MAAM,EAAE,kCAAkC;AAE1C,SAAgB,gBACd,aACA,aAAkB,EAAE,EACpB,eACK;AACL,KAAI,OAAO,kBAAkB,YAC3B,OAAM,IAAI,MACR,8DACD;AAGH,KAAI,OAAO,cAAc,iBAAiB,YACxC,OAAM,IAAI,MACR,0HACD;AAGH,QAAO;EACL,GAAG;EACH,mBAAmB,KAAK;GACtB,GAAI,WAAW,qBAAqB,EAAE;GACtC;GACA;GACA;GACD,CAAC;EACF,QAAQ,QAAuB,SAA6B;AAC1D,OAAI,CAAC,OAAO,QAAS,QAAO,UAAU,EAAE;AAKxC,UAAO,QAAQ,KACb,IAAI,8BAA8B,mBAAmB,aAAa;AAGhE,SAFgB,SAAS,WAAW,IAG1B,SACN,GAAG,KAAK,MAAM,cAAc,KAAK,IAAI,MAAM,KAAK,IAAI,QAAQ,KAAK,IAAI,YAAY,KAAK,IAAI,KAC3F,CAGD,UAAS,UAAU;QAGnB,UAAS,UAAU,GAAG,YAAY;KAEpC,CACH;AAGD,UAAO,QAAQ,KACb,IAAI,QAAQ,8BACV,qCACC,aAAa;AAIZ,SAHgB,SAAS,WAAW,IAGxB,SAAS,2CAA2C,CAC9D,UAAS,UAAU,GAAG,YAAY;KAGvC,CACF;AAED,UAAO,QAAQ,KAAK,IAAI,qBAAqB,aAAa,cAAc,CAAC;AAGzE,OAAI,OAAO,WAAW,YAAY,WAChC,QAAO,WAAW,QAAQ,QAAQ,QAAQ;AAG5C,UAAO;;EAEV"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uniwind-plugin-next",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "author": "Alexander Nicholson",
5
5
  "description": "Compatibility plugin for using Uniwind with Next.js",
6
6
  "homepage": "https://github.com/a16n-dev/uniwind-plugin-next#readme",
@@ -25,7 +25,7 @@
25
25
  "@tailwindcss/node": "^4",
26
26
  "lightningcss": ">=1.30.2",
27
27
  "postcss": "^8",
28
- "uniwind": "~1.2.2",
28
+ "uniwind": "^1.2.7",
29
29
  "webpack": "^5"
30
30
  },
31
31
  "exports": {
@@ -37,10 +37,7 @@
37
37
  "require": "./dist/postcss/index.cjs",
38
38
  "import": "./dist/postcss/index.mjs"
39
39
  },
40
- "./package.json": "./package.json",
41
- "./css": {
42
- "style": "./dist/webpack/uniwind/uniwind.css"
43
- }
40
+ "./package.json": "./package.json"
44
41
  },
45
42
  "main": "./dist/index.cjs",
46
43
  "module": "./dist/index.mjs",
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.cts","names":[],"sources":["../../src/webpack/types.ts"],"sourcesContent":[],"mappings":";KAAY,aAAA;EAAA,YAAA,EAAA,MAAa;gBAET"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.mts","names":[],"sources":["../../src/webpack/types.ts"],"sourcesContent":[],"mappings":";KAAY,aAAA;EAAA,YAAA,EAAA,MAAa;gBAET"}
@@ -1,6 +0,0 @@
1
- //#region src/webpack/uniwind/package.json
2
- var name = "uniwind";
3
-
4
- //#endregion
5
- export { name };
6
- //# sourceMappingURL=package.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"package.mjs","names":[],"sources":["../../../src/webpack/uniwind/package.json"],"sourcesContent":[""],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../../../src/webpack/uniwind/src/css/index.ts"],"sourcesContent":["import fs from \"fs\";\nimport path from \"path\";\nimport { generateCSSForInsets } from \"./insets\";\nimport { generateCSSForThemes } from \"./themes\";\nimport { generateCSSForVariants } from \"./variants\";\n\nconst dirname =\n typeof __dirname !== \"undefined\" ? __dirname : import.meta.dirname;\n\nexport const buildCSS = async (themes: Array<string>, input: string) => {\n const variants = generateCSSForVariants();\n const insets = generateCSSForInsets();\n const themesCSS = await generateCSSForThemes(themes, input);\n const cssFilePath = path.join(dirname, \"../../uniwind.css\");\n const oldCSSFile = fs.existsSync(cssFilePath)\n ? fs.readFileSync(cssFilePath, \"utf-8\")\n : \"\";\n\n const newCssFile = [variants, insets, themesCSS].join(\"\\n\");\n\n if (oldCSSFile === newCssFile) {\n return;\n }\n\n fs.writeFileSync(cssFilePath, newCssFile);\n};\n"],"mappings":";;;;;;;AAMA,MAAM,UACJ,OAAO,cAAc,cAAc,YAAY,OAAO,KAAK;AAE7D,MAAa,WAAW,OAAO,QAAuB,UAAkB;CACtE,MAAM,WAAW,wBAAwB;CACzC,MAAM,SAAS,sBAAsB;CACrC,MAAM,YAAY,MAAM,qBAAqB,QAAQ,MAAM;CAC3D,MAAM,cAAc,KAAK,KAAK,SAAS,oBAAoB;CAC3D,MAAM,aAAa,GAAG,WAAW,YAAY,GACzC,GAAG,aAAa,aAAa,QAAQ,GACrC;CAEJ,MAAM,aAAa;EAAC;EAAU;EAAQ;EAAU,CAAC,KAAK,KAAK;AAE3D,KAAI,eAAe,WACjB;AAGF,IAAG,cAAc,aAAa,WAAW"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"insets.mjs","names":[],"sources":["../../../../../src/webpack/uniwind/src/css/insets.ts"],"sourcesContent":["const types = [\"margin\", \"padding\", \"inset\"] as const;\nconst sides = [\"inset\", \"x\", \"y\", \"top\", \"bottom\", \"left\", \"right\"] as const;\nconst safeAreaTypes = [\"safe\", \"safe-or-*\", \"safe-offset-*\"] as const;\nconst spacing = \"--spacing(--value(integer))\";\nconst length = \"--value([length])\";\n\ntype Side = (typeof sides)[number];\ntype TypeName = (typeof types)[number];\ntype SafeAreaType = (typeof safeAreaTypes)[number];\ntype Inset = \"top\" | \"bottom\" | \"left\" | \"right\";\n\nexport const generateCSSForInsets = () => {\n let css = `@utility h-screen-safe {\n height: calc(100vh - (env(safe-area-inset-top) + env(safe-area-inset-bottom)));\n}\\n\\n`;\n\n const getInsetsForSide = (side: Side): Array<Inset> => {\n switch (side) {\n case \"top\":\n return [\"top\"];\n case \"bottom\":\n return [\"bottom\"];\n case \"left\":\n return [\"left\"];\n case \"right\":\n return [\"right\"];\n case \"x\":\n return [\"left\", \"right\"];\n case \"y\":\n return [\"top\", \"bottom\"];\n case \"inset\":\n return [\"top\", \"bottom\", \"left\", \"right\"];\n default:\n side satisfies never;\n return [];\n }\n };\n\n const getUtilityName = (\n typeName: TypeName,\n side: Side,\n safeAreaType: SafeAreaType,\n ) => {\n if (typeName === \"inset\") {\n return `${side}-${safeAreaType}`;\n }\n\n const sideSuffix = side === \"inset\" ? \"\" : side.at(0);\n\n return `${typeName.at(0)}${sideSuffix}-${safeAreaType}`;\n };\n\n const getStyleProperty = (typeName: TypeName, inset: Inset) => {\n if (typeName === \"inset\") {\n return inset;\n }\n\n return `${typeName}-${inset}`;\n };\n\n const getStylesForSafeAreaType = (\n safeAreaType: SafeAreaType,\n styles: Array<string>,\n ) => {\n switch (safeAreaType) {\n case \"safe\":\n return styles;\n case \"safe-or-*\":\n return styles.flatMap((style) => {\n const styleWithoutSemicolon = style.replace(\";\", \"\");\n\n return [\n styleWithoutSemicolon.replace(\n /: (env.*)/,\n (_, env) => `: max(${env}, ${spacing});`,\n ),\n styleWithoutSemicolon.replace(\n /: (env.*)/,\n (_, env) => `: max(${env}, ${length});`,\n ),\n ];\n });\n case \"safe-offset-*\":\n return styles.flatMap((style) => {\n const styleWithoutSemicolon = style.replace(\";\", \"\");\n\n return [\n styleWithoutSemicolon.replace(\n /: (env.*)/,\n (_, env) => `: calc(${env} + ${spacing});`,\n ),\n styleWithoutSemicolon.replace(\n /: (env.*)/,\n (_, env) => `: calc(${env} + ${length});`,\n ),\n ];\n });\n default:\n safeAreaType satisfies never;\n return [];\n }\n };\n\n types.forEach((type) => {\n sides.forEach((side) => {\n const insets = getInsetsForSide(side);\n const styles = insets.map(\n (inset) =>\n `${getStyleProperty(type, inset)}: env(safe-area-inset-${inset});`,\n );\n\n safeAreaTypes.forEach((safeAreaType) => {\n const utilityName = getUtilityName(type, side, safeAreaType);\n\n css += [\n `@utility ${utilityName} {`,\n ...getStylesForSafeAreaType(safeAreaType, styles).map(\n (style) => ` ${style}`,\n ),\n \"}\",\n \"\",\n \"\",\n ].join(\"\\n\");\n });\n });\n });\n\n // Remove the last newline character\n return css.slice(0, -1);\n};\n"],"mappings":";AAAA,MAAM,QAAQ;CAAC;CAAU;CAAW;CAAQ;AAC5C,MAAM,QAAQ;CAAC;CAAS;CAAK;CAAK;CAAO;CAAU;CAAQ;CAAQ;AACnE,MAAM,gBAAgB;CAAC;CAAQ;CAAa;CAAgB;AAC5D,MAAM,UAAU;AAChB,MAAM,SAAS;AAOf,MAAa,6BAA6B;CACxC,IAAI,MAAM;;;CAIV,MAAM,oBAAoB,SAA6B;AACrD,UAAQ,MAAR;GACE,KAAK,MACH,QAAO,CAAC,MAAM;GAChB,KAAK,SACH,QAAO,CAAC,SAAS;GACnB,KAAK,OACH,QAAO,CAAC,OAAO;GACjB,KAAK,QACH,QAAO,CAAC,QAAQ;GAClB,KAAK,IACH,QAAO,CAAC,QAAQ,QAAQ;GAC1B,KAAK,IACH,QAAO,CAAC,OAAO,SAAS;GAC1B,KAAK,QACH,QAAO;IAAC;IAAO;IAAU;IAAQ;IAAQ;GAC3C,QAEE,QAAO,EAAE;;;CAIf,MAAM,kBACJ,UACA,MACA,iBACG;AACH,MAAI,aAAa,QACf,QAAO,GAAG,KAAK,GAAG;EAGpB,MAAM,aAAa,SAAS,UAAU,KAAK,KAAK,GAAG,EAAE;AAErD,SAAO,GAAG,SAAS,GAAG,EAAE,GAAG,WAAW,GAAG;;CAG3C,MAAM,oBAAoB,UAAoB,UAAiB;AAC7D,MAAI,aAAa,QACf,QAAO;AAGT,SAAO,GAAG,SAAS,GAAG;;CAGxB,MAAM,4BACJ,cACA,WACG;AACH,UAAQ,cAAR;GACE,KAAK,OACH,QAAO;GACT,KAAK,YACH,QAAO,OAAO,SAAS,UAAU;IAC/B,MAAM,wBAAwB,MAAM,QAAQ,KAAK,GAAG;AAEpD,WAAO,CACL,sBAAsB,QACpB,cACC,GAAG,QAAQ,SAAS,IAAI,IAAI,QAAQ,IACtC,EACD,sBAAsB,QACpB,cACC,GAAG,QAAQ,SAAS,IAAI,IAAI,OAAO,IACrC,CACF;KACD;GACJ,KAAK,gBACH,QAAO,OAAO,SAAS,UAAU;IAC/B,MAAM,wBAAwB,MAAM,QAAQ,KAAK,GAAG;AAEpD,WAAO,CACL,sBAAsB,QACpB,cACC,GAAG,QAAQ,UAAU,IAAI,KAAK,QAAQ,IACxC,EACD,sBAAsB,QACpB,cACC,GAAG,QAAQ,UAAU,IAAI,KAAK,OAAO,IACvC,CACF;KACD;GACJ,QAEE,QAAO,EAAE;;;AAIf,OAAM,SAAS,SAAS;AACtB,QAAM,SAAS,SAAS;GAEtB,MAAM,SADS,iBAAiB,KAAK,CACf,KACnB,UACC,GAAG,iBAAiB,MAAM,MAAM,CAAC,wBAAwB,MAAM,IAClE;AAED,iBAAc,SAAS,iBAAiB;IACtC,MAAM,cAAc,eAAe,MAAM,MAAM,aAAa;AAE5D,WAAO;KACL,YAAY,YAAY;KACxB,GAAG,yBAAyB,cAAc,OAAO,CAAC,KAC/C,UAAU,OAAO,QACnB;KACD;KACA;KACA;KACD,CAAC,KAAK,KAAK;KACZ;IACF;GACF;AAGF,QAAO,IAAI,MAAM,GAAG,GAAG"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"themes.mjs","names":[],"sources":["../../../../../src/webpack/uniwind/src/css/themes.ts"],"sourcesContent":["import { compile } from \"@tailwindcss/node\";\nimport fs from \"fs\";\nimport { transform } from \"lightningcss\";\nimport path from \"path\";\nimport { Logger } from \"../metro/logger\";\n\nconst readFileSafe = (filePath: string) => {\n try {\n return fs.readFileSync(filePath, \"utf-8\");\n } catch {\n return null;\n }\n};\n\nconst isExcludedDependency = (url: string) =>\n [\n url.includes(\"node_modules/tailwindcss\"),\n url.includes(\"node_modules/@tailwindcss\"),\n url.includes(\"node_modules/uniwind\"),\n ].some(Boolean);\n\nexport const generateCSSForThemes = async (\n themes: Array<string>,\n input: string,\n) => {\n // css generation\n const themesVariables = Object.fromEntries(\n themes.map((theme) => [theme, new Set<string>()]),\n );\n\n const findVariantsRec = async (cssPath: string) => {\n const css = readFileSafe(cssPath);\n\n if (css === null) {\n return;\n }\n\n const { dependencies } = transform({\n code: Buffer.from(css),\n filename: \"uniwind.css\",\n analyzeDependencies: true,\n visitor: {\n Rule: (rule) => {\n if (rule.type === \"unknown\" && rule.value.name === \"variant\") {\n const [firstPrelude] = rule.value.prelude;\n\n if (\n firstPrelude?.type !== \"token\" ||\n firstPrelude.value.type !== \"ident\" ||\n !themes.includes(firstPrelude.value.value)\n ) {\n return;\n }\n\n const theme = firstPrelude.value.value;\n\n rule.value.block?.forEach((block) => {\n if (block.type === \"dashed-ident\") {\n themesVariables[theme]?.add(block.value);\n }\n });\n }\n },\n },\n });\n\n if (!Array.isArray(dependencies)) {\n return;\n }\n\n const importUrls = new Set<string>();\n const importsCSS = dependencies\n .filter((dependency) => {\n if (dependency.url.startsWith(\".\")) {\n importUrls.add(path.resolve(path.dirname(cssPath), dependency.url));\n\n return false;\n }\n\n return !isExcludedDependency(dependency.url);\n })\n .map((dependency) => `@import \"${dependency.url}\";`)\n .join(\"\\n\");\n\n await compile(importsCSS, {\n base: path.resolve(path.dirname(cssPath)),\n onDependency: (dependency) => {\n if (isExcludedDependency(dependency)) {\n return;\n }\n\n importUrls.add(dependency);\n },\n });\n\n for (const filePath of importUrls) {\n await findVariantsRec(filePath);\n }\n };\n\n await findVariantsRec(input);\n\n // Check if all themes have the same variables\n let hasErrors = false as boolean;\n const hasVariables = Object.values(themesVariables).some(\n (variables) => variables.size > 0,\n );\n\n Object.values(themesVariables).forEach((variables) => {\n Object.entries(themesVariables).forEach(\n ([checkedTheme, checkedVariables]) => {\n variables.forEach((variable) => {\n if (!checkedVariables.has(variable)) {\n Logger.error(\n `Theme ${checkedTheme} is missing variable ${variable}`,\n );\n hasErrors = true;\n }\n });\n },\n );\n });\n\n if (hasErrors) {\n Logger.error(\"All themes must have the same variables\");\n }\n\n const variablesCSS = hasVariables\n ? [\n \"\",\n \"@theme {\",\n ...Array.from(Object.values(themesVariables).at(0) ?? []).map(\n (variable) => ` ${variable}: unset;`,\n ),\n \"}\",\n ]\n : [];\n const uniwindCSS = [\n ...themes.map(\n (theme) => `@custom-variant ${theme} (&:where(.${theme}, .${theme} *));`,\n ),\n ...variablesCSS,\n ].join(\"\\n\");\n\n return uniwindCSS;\n};\n"],"mappings":";;;;;;;AAMA,MAAM,gBAAgB,aAAqB;AACzC,KAAI;AACF,SAAO,GAAG,aAAa,UAAU,QAAQ;SACnC;AACN,SAAO;;;AAIX,MAAM,wBAAwB,QAC5B;CACE,IAAI,SAAS,2BAA2B;CACxC,IAAI,SAAS,4BAA4B;CACzC,IAAI,SAAS,uBAAuB;CACrC,CAAC,KAAK,QAAQ;AAEjB,MAAa,uBAAuB,OAClC,QACA,UACG;CAEH,MAAM,kBAAkB,OAAO,YAC7B,OAAO,KAAK,UAAU,CAAC,uBAAO,IAAI,KAAa,CAAC,CAAC,CAClD;CAED,MAAM,kBAAkB,OAAO,YAAoB;EACjD,MAAM,MAAM,aAAa,QAAQ;AAEjC,MAAI,QAAQ,KACV;EAGF,MAAM,EAAE,iBAAiB,UAAU;GACjC,MAAM,OAAO,KAAK,IAAI;GACtB,UAAU;GACV,qBAAqB;GACrB,SAAS,EACP,OAAO,SAAS;AACd,QAAI,KAAK,SAAS,aAAa,KAAK,MAAM,SAAS,WAAW;KAC5D,MAAM,CAAC,gBAAgB,KAAK,MAAM;AAElC,SACE,cAAc,SAAS,WACvB,aAAa,MAAM,SAAS,WAC5B,CAAC,OAAO,SAAS,aAAa,MAAM,MAAM,CAE1C;KAGF,MAAM,QAAQ,aAAa,MAAM;AAEjC,UAAK,MAAM,OAAO,SAAS,UAAU;AACnC,UAAI,MAAM,SAAS,eACjB,iBAAgB,QAAQ,IAAI,MAAM,MAAM;OAE1C;;MAGP;GACF,CAAC;AAEF,MAAI,CAAC,MAAM,QAAQ,aAAa,CAC9B;EAGF,MAAM,6BAAa,IAAI,KAAa;AAcpC,QAAM,QAba,aAChB,QAAQ,eAAe;AACtB,OAAI,WAAW,IAAI,WAAW,IAAI,EAAE;AAClC,eAAW,IAAI,KAAK,QAAQ,KAAK,QAAQ,QAAQ,EAAE,WAAW,IAAI,CAAC;AAEnE,WAAO;;AAGT,UAAO,CAAC,qBAAqB,WAAW,IAAI;IAC5C,CACD,KAAK,eAAe,YAAY,WAAW,IAAI,IAAI,CACnD,KAAK,KAAK,EAEa;GACxB,MAAM,KAAK,QAAQ,KAAK,QAAQ,QAAQ,CAAC;GACzC,eAAe,eAAe;AAC5B,QAAI,qBAAqB,WAAW,CAClC;AAGF,eAAW,IAAI,WAAW;;GAE7B,CAAC;AAEF,OAAK,MAAM,YAAY,WACrB,OAAM,gBAAgB,SAAS;;AAInC,OAAM,gBAAgB,MAAM;CAG5B,IAAI,YAAY;CAChB,MAAM,eAAe,OAAO,OAAO,gBAAgB,CAAC,MACjD,cAAc,UAAU,OAAO,EACjC;AAED,QAAO,OAAO,gBAAgB,CAAC,SAAS,cAAc;AACpD,SAAO,QAAQ,gBAAgB,CAAC,SAC7B,CAAC,cAAc,sBAAsB;AACpC,aAAU,SAAS,aAAa;AAC9B,QAAI,CAAC,iBAAiB,IAAI,SAAS,EAAE;AACnC,YAAO,MACL,SAAS,aAAa,uBAAuB,WAC9C;AACD,iBAAY;;KAEd;IAEL;GACD;AAEF,KAAI,UACF,QAAO,MAAM,0CAA0C;CAGzD,MAAM,eAAe,eACjB;EACE;EACA;EACA,GAAG,MAAM,KAAK,OAAO,OAAO,gBAAgB,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,KACvD,aAAa,OAAO,SAAS,UAC/B;EACD;EACD,GACD,EAAE;AAQN,QAPmB,CACjB,GAAG,OAAO,KACP,UAAU,mBAAmB,MAAM,aAAa,MAAM,KAAK,MAAM,OACnE,EACD,GAAG,aACJ,CAAC,KAAK,KAAK"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"variants.mjs","names":[],"sources":["../../../../../src/webpack/uniwind/src/css/variants.ts"],"sourcesContent":["const variants = [\"ios\", \"android\", \"web\", \"native\"];\n\nexport const generateCSSForVariants = () => {\n let css = \"\";\n\n variants.forEach((variant) => {\n css += `@custom-variant ${variant} (${variant === \"web\" ? \"html &\" : `@media ${variant}`});\\n`;\n });\n\n return css;\n};\n"],"mappings":";AAAA,MAAM,WAAW;CAAC;CAAO;CAAW;CAAO;CAAS;AAEpD,MAAa,+BAA+B;CAC1C,IAAI,MAAM;AAEV,UAAS,SAAS,YAAY;AAC5B,SAAO,mBAAmB,QAAQ,IAAI,YAAY,QAAQ,WAAW,UAAU,UAAU;GACzF;AAEF,QAAO"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.mjs","names":["name: string"],"sources":["../../../../../src/webpack/uniwind/src/metro/logger.ts"],"sourcesContent":["/* eslint-disable no-console */\n\nconst red = \"\\x1b[91m\";\nconst yellow = \"\\x1b[33m\";\nconst blue = \"\\x1b[36m\";\nconst reset = \"\\x1b[0m\";\n\nexport class Logger {\n static debug = false;\n\n constructor(private readonly name: string) {}\n\n static log(message: string, meta = \"\") {\n if (!Logger.debug) {\n return;\n }\n\n console.log(`${blue}Uniwind ${meta}- ${message}${reset}`);\n }\n\n static error(message: string, meta = \"\") {\n console.log(`${red}Uniwind Error ${meta}- ${message}${reset}`);\n }\n\n static warn(message: string, meta = \"\") {\n if (!Logger.debug) {\n return;\n }\n\n console.log(`${yellow}Uniwind Warning ${meta}- ${message}${reset}`);\n }\n\n log(message: string) {\n Logger.log(message, `[${this.name} Processor] `);\n }\n\n error(message: string) {\n Logger.error(message, `[${this.name} Processor] `);\n }\n\n warn(message: string) {\n Logger.warn(message, `[${this.name} Processor] `);\n }\n}\n"],"mappings":";AAEA,MAAM,MAAM;AACZ,MAAM,SAAS;AACf,MAAM,OAAO;AACb,MAAM,QAAQ;AAEd,IAAa,SAAb,MAAa,OAAO;;eACH;;CAEf,YAAY,AAAiBA,MAAc;EAAd;;CAE7B,OAAO,IAAI,SAAiB,OAAO,IAAI;AACrC,MAAI,CAAC,OAAO,MACV;AAGF,UAAQ,IAAI,GAAG,KAAK,UAAU,KAAK,IAAI,UAAU,QAAQ;;CAG3D,OAAO,MAAM,SAAiB,OAAO,IAAI;AACvC,UAAQ,IAAI,GAAG,IAAI,gBAAgB,KAAK,IAAI,UAAU,QAAQ;;CAGhE,OAAO,KAAK,SAAiB,OAAO,IAAI;AACtC,MAAI,CAAC,OAAO,MACV;AAGF,UAAQ,IAAI,GAAG,OAAO,kBAAkB,KAAK,IAAI,UAAU,QAAQ;;CAGrE,IAAI,SAAiB;AACnB,SAAO,IAAI,SAAS,IAAI,KAAK,KAAK,cAAc;;CAGlD,MAAM,SAAiB;AACrB,SAAO,MAAM,SAAS,IAAI,KAAK,KAAK,cAAc;;CAGpD,KAAK,SAAiB;AACpB,SAAO,KAAK,SAAS,IAAI,KAAK,KAAK,cAAc"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"buildDtsFile.mjs","names":[],"sources":["../../../../../src/webpack/uniwind/src/utils/buildDtsFile.ts"],"sourcesContent":["import fs from \"fs\";\nimport { name } from \"../../package.json\";\n\nexport const buildDtsFile = (dtsPath: string, stringifiedThemes: string) => {\n const oldDtsContent = fs.existsSync(dtsPath)\n ? fs.readFileSync(dtsPath, \"utf-8\")\n : \"\";\n const dtsContent = [\n `// NOTE: This file is generated by ${name} and it should not be edited manually.`,\n `/// <reference types=\"${name}/types\" />`,\n \"\",\n `declare module '${name}' {`,\n ` export interface UniwindConfig {`,\n ` themes: readonly ${stringifiedThemes}`,\n ` }`,\n `}`,\n \"\",\n `export {}`,\n \"\",\n ].join(\"\\n\");\n\n if (oldDtsContent === dtsContent) {\n return;\n }\n\n fs.writeFileSync(dtsPath, dtsContent);\n};\n"],"mappings":";;;;AAGA,MAAa,gBAAgB,SAAiB,sBAA8B;CAC1E,MAAM,gBAAgB,GAAG,WAAW,QAAQ,GACxC,GAAG,aAAa,SAAS,QAAQ,GACjC;CACJ,MAAM,aAAa;EACjB,sCAAsC,KAAK;EAC3C,yBAAyB,KAAK;EAC9B;EACA,mBAAmB,KAAK;EACxB;EACA,4BAA4B;EAC5B;EACA;EACA;EACA;EACA;EACD,CAAC,KAAK,KAAK;AAEZ,KAAI,kBAAkB,WACpB;AAGF,IAAG,cAAc,SAAS,WAAW"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"stringifyThemes.mjs","names":[],"sources":["../../../../../src/webpack/uniwind/src/utils/stringifyThemes.ts"],"sourcesContent":["export const stringifyThemes = (themes: Array<string> = []) =>\n `[${themes.map((theme) => `'${theme}'`).join(\", \")}]`;\n"],"mappings":";AAAA,MAAa,mBAAmB,SAAwB,EAAE,KACxD,IAAI,OAAO,KAAK,UAAU,IAAI,MAAM,GAAG,CAAC,KAAK,KAAK,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"util.mjs","names":[],"sources":["../../src/webpack/util.ts"],"sourcesContent":["export const uniq = <T>(arr: Array<T>) => Array.from(new Set(arr));\n"],"mappings":";AAAA,MAAa,QAAW,QAAkB,MAAM,KAAK,IAAI,IAAI,IAAI,CAAC"}