tailwind-styled-v4 5.0.10 → 5.0.11

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 (93) hide show
  1. package/README.md +245 -373
  2. package/dist/analyzer.js +75 -22
  3. package/dist/analyzer.js.map +1 -1
  4. package/dist/analyzer.mjs +74 -21
  5. package/dist/analyzer.mjs.map +1 -1
  6. package/dist/animate.js +4 -2
  7. package/dist/animate.js.map +1 -1
  8. package/dist/animate.mjs +4 -2
  9. package/dist/animate.mjs.map +1 -1
  10. package/dist/atomic.js +20 -5
  11. package/dist/atomic.js.map +1 -1
  12. package/dist/atomic.mjs +20 -5
  13. package/dist/atomic.mjs.map +1 -1
  14. package/dist/cli.js +174 -67
  15. package/dist/cli.js.map +1 -1
  16. package/dist/cli.mjs +171 -64
  17. package/dist/cli.mjs.map +1 -1
  18. package/dist/compiler.d.mts +7 -1
  19. package/dist/compiler.d.ts +7 -1
  20. package/dist/compiler.js +53 -27
  21. package/dist/compiler.js.map +1 -1
  22. package/dist/compiler.mjs +53 -27
  23. package/dist/compiler.mjs.map +1 -1
  24. package/dist/devtools.js.map +1 -1
  25. package/dist/devtools.mjs.map +1 -1
  26. package/dist/engine.js +159 -61
  27. package/dist/engine.js.map +1 -1
  28. package/dist/engine.mjs +159 -61
  29. package/dist/engine.mjs.map +1 -1
  30. package/dist/index.browser.mjs +1512 -0
  31. package/dist/index.browser.mjs.map +1 -0
  32. package/dist/index.d.mts +94 -12
  33. package/dist/index.d.ts +94 -12
  34. package/dist/index.js +436 -106
  35. package/dist/index.js.map +1 -1
  36. package/dist/index.mjs +436 -106
  37. package/dist/index.mjs.map +1 -1
  38. package/dist/next.js +1946 -47
  39. package/dist/next.js.map +1 -1
  40. package/dist/next.mjs +1929 -44
  41. package/dist/next.mjs.map +1 -1
  42. package/dist/plugin-api.js.map +1 -1
  43. package/dist/plugin-api.mjs.map +1 -1
  44. package/dist/plugin-registry.js +23 -10
  45. package/dist/plugin-registry.js.map +1 -1
  46. package/dist/plugin-registry.mjs +23 -11
  47. package/dist/plugin-registry.mjs.map +1 -1
  48. package/dist/plugin.js.map +1 -1
  49. package/dist/plugin.mjs.map +1 -1
  50. package/dist/rspack.js.map +1 -1
  51. package/dist/rspack.mjs.map +1 -1
  52. package/dist/scanner.js +72 -19
  53. package/dist/scanner.js.map +1 -1
  54. package/dist/scanner.mjs +71 -18
  55. package/dist/scanner.mjs.map +1 -1
  56. package/dist/shared.js +32 -15
  57. package/dist/shared.js.map +1 -1
  58. package/dist/shared.mjs +32 -15
  59. package/dist/shared.mjs.map +1 -1
  60. package/dist/svelte.js +38 -12
  61. package/dist/svelte.js.map +1 -1
  62. package/dist/svelte.mjs +38 -12
  63. package/dist/svelte.mjs.map +1 -1
  64. package/dist/syntax.js +17 -5
  65. package/dist/syntax.js.map +1 -1
  66. package/dist/syntax.mjs +17 -5
  67. package/dist/syntax.mjs.map +1 -1
  68. package/dist/theme.js +4 -2
  69. package/dist/theme.js.map +1 -1
  70. package/dist/theme.mjs +4 -2
  71. package/dist/theme.mjs.map +1 -1
  72. package/dist/turbopackLoader.js +87 -33
  73. package/dist/turbopackLoader.js.map +1 -1
  74. package/dist/turbopackLoader.mjs +87 -33
  75. package/dist/turbopackLoader.mjs.map +1 -1
  76. package/dist/tw.js +174 -67
  77. package/dist/tw.js.map +1 -1
  78. package/dist/tw.mjs +171 -64
  79. package/dist/tw.mjs.map +1 -1
  80. package/dist/vite.js +145 -63
  81. package/dist/vite.js.map +1 -1
  82. package/dist/vite.mjs +145 -63
  83. package/dist/vite.mjs.map +1 -1
  84. package/dist/vue.js +38 -12
  85. package/dist/vue.js.map +1 -1
  86. package/dist/vue.mjs +38 -12
  87. package/dist/vue.mjs.map +1 -1
  88. package/dist/webpackLoader.js +20 -5
  89. package/dist/webpackLoader.js.map +1 -1
  90. package/dist/webpackLoader.mjs +20 -5
  91. package/dist/webpackLoader.mjs.map +1 -1
  92. package/native/tailwind-styled-native.node +0 -0
  93. package/package.json +29 -24
package/dist/shared.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { createHash } from 'crypto';
2
- import * as fs2 from 'fs';
3
- import fs2__default from 'fs';
2
+ import * as fs from 'fs';
3
+ import fs__default from 'fs';
4
4
  import * as path from 'path';
5
5
  import path__default from 'path';
6
6
  import { fileURLToPath } from 'url';
@@ -777,12 +777,12 @@ function generateBarrelFile(exports$1, dir, opts = {}) {
777
777
  var isBrowser3 = typeof window !== "undefined" || typeof document !== "undefined";
778
778
  var _require = typeof __require !== "undefined" ? __require : createRequire(import.meta.url);
779
779
  var PLATFORM_MAP = {
780
- "linux-x64": ["@tailwind-styled/native-linux-x64"],
781
- "linux-arm64": ["@tailwind-styled/native-linux-arm64"],
780
+ "linux-x64": ["@tailwind-styled/native-linux-x64-gnu", "@tailwind-styled/native-linux-x64"],
781
+ "linux-arm64": ["@tailwind-styled/native-linux-arm64-gnu", "@tailwind-styled/native-linux-arm64"],
782
782
  "darwin-x64": ["@tailwind-styled/native-darwin-x64"],
783
783
  "darwin-arm64": ["@tailwind-styled/native-darwin-arm64"],
784
- "win32-x64": ["@tailwind-styled/native-win32-x64"],
785
- "win32-arm64": ["@tailwind-styled/native-win32-arm64"]
784
+ "win32-x64": ["@tailwind-styled/native-win32-x64-msvc", "@tailwind-styled/native-win32-x64"],
785
+ "win32-arm64": ["@tailwind-styled/native-win32-arm64-msvc", "@tailwind-styled/native-win32-arm64"]
786
786
  };
787
787
  function platformKey() {
788
788
  if (isBrowser3) return "browser";
@@ -799,7 +799,7 @@ function resolveNativeBinary(runtimeDir) {
799
799
  }
800
800
  const envPath = process.env.TW_NATIVE_PATH?.trim();
801
801
  if (envPath) {
802
- if (fs2.existsSync(envPath)) {
802
+ if (fs.existsSync(envPath)) {
803
803
  return { path: envPath, source: "env", platform, tried };
804
804
  }
805
805
  tried.push(`env:${envPath} (not found)`);
@@ -808,7 +808,7 @@ function resolveNativeBinary(runtimeDir) {
808
808
  for (const pkg of prebuiltPkgs) {
809
809
  try {
810
810
  const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
811
- if (fs2.existsSync(candidate)) {
811
+ if (fs.existsSync(candidate)) {
812
812
  return { path: candidate, source: "prebuilt", platform, tried };
813
813
  }
814
814
  tried.push(`prebuilt:${pkg} (resolved but missing)`);
@@ -816,9 +816,24 @@ function resolveNativeBinary(runtimeDir) {
816
816
  tried.push(`prebuilt:${pkg} (not installed)`);
817
817
  }
818
818
  }
819
+ const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
820
+ const BINARY_NAMES_SELF = ["tailwind-styled-native", "tailwind_styled_parser"];
821
+ if (runtimeDir) {
822
+ for (const depth of ["..", path.join("..", ".."), path.join("..", "..", "..")]) {
823
+ const pkgRoot = path.resolve(runtimeDir, depth);
824
+ for (const bin of BINARY_NAMES_SELF) {
825
+ for (const suffix of ["", `.${platform}`, `.${napiPlatform}`]) {
826
+ const candidate = path.resolve(pkgRoot, "native", `${bin}${suffix}.node`);
827
+ tried.push(`self-bundled:${candidate}`);
828
+ if (fs.existsSync(candidate)) {
829
+ return { path: candidate, source: "prebuilt", platform, tried };
830
+ }
831
+ }
832
+ }
833
+ }
834
+ }
819
835
  const cwd = process.cwd();
820
836
  const base = runtimeDir ?? cwd;
821
- const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
822
837
  const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
823
838
  const localCandidates = [];
824
839
  for (const bin of BINARY_NAMES) {
@@ -844,7 +859,7 @@ function resolveNativeBinary(runtimeDir) {
844
859
  }
845
860
  for (const candidate of localCandidates) {
846
861
  tried.push(`local:${candidate}`);
847
- if (fs2.existsSync(candidate)) {
862
+ if (fs.existsSync(candidate)) {
848
863
  return { path: candidate, source: "local", platform, tried };
849
864
  }
850
865
  }
@@ -998,7 +1013,7 @@ function loadNativeBinding(options) {
998
1013
  for (const candidate of candidates) {
999
1014
  const candidatePath = path__default.resolve(runtimeDir, candidate);
1000
1015
  try {
1001
- if (!fs2__default.existsSync(candidatePath) && !fs2__default.existsSync(candidatePath + ".node")) {
1016
+ if (!fs__default.existsSync(candidatePath) && !fs__default.existsSync(candidatePath + ".node")) {
1002
1017
  continue;
1003
1018
  }
1004
1019
  const mod = requireNativeModule(candidatePath);
@@ -1031,9 +1046,9 @@ function resolveNativeBindingCandidates(options) {
1031
1046
  }
1032
1047
  }
1033
1048
  if (!includeDefaultCandidates) return candidates;
1034
- if (fs2__default.existsSync(runtimeDir)) {
1049
+ if (fs__default.existsSync(runtimeDir)) {
1035
1050
  try {
1036
- for (const entry of fs2__default.readdirSync(runtimeDir)) {
1051
+ for (const entry of fs__default.readdirSync(runtimeDir)) {
1037
1052
  if (entry.endsWith(".node")) candidates.push(entry);
1038
1053
  }
1039
1054
  } catch {
@@ -1044,11 +1059,13 @@ function resolveNativeBindingCandidates(options) {
1044
1059
  for (const bin of BINARY_NAMES) {
1045
1060
  candidates.push(path__default.resolve(runtimeDir, `${bin}.node`));
1046
1061
  candidates.push(path__default.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
1062
+ candidates.push(path__default.resolve(runtimeDir, "..", "native", `${bin}.node`));
1063
+ candidates.push(path__default.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
1064
+ candidates.push(path__default.resolve(process.cwd(), "native", `${bin}.node`));
1065
+ candidates.push(path__default.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
1047
1066
  candidates.push(path__default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
1048
1067
  candidates.push(path__default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
1049
1068
  candidates.push(path__default.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
1050
- candidates.push(path__default.resolve(process.cwd(), "native", `${bin}.node`));
1051
- candidates.push(path__default.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
1052
1069
  }
1053
1070
  return Array.from(new Set(candidates));
1054
1071
  }