tailwind-styled-v4 5.0.13 → 5.0.14

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/dist/atomic.js +14 -14
  2. package/dist/atomic.js.map +1 -1
  3. package/dist/atomic.mjs +14 -14
  4. package/dist/atomic.mjs.map +1 -1
  5. package/dist/cli.js +14 -14
  6. package/dist/cli.js.map +1 -1
  7. package/dist/cli.mjs +14 -14
  8. package/dist/cli.mjs.map +1 -1
  9. package/dist/compiler.js +14 -14
  10. package/dist/compiler.js.map +1 -1
  11. package/dist/compiler.mjs +14 -14
  12. package/dist/compiler.mjs.map +1 -1
  13. package/dist/engine.js +14 -14
  14. package/dist/engine.js.map +1 -1
  15. package/dist/engine.mjs +14 -14
  16. package/dist/engine.mjs.map +1 -1
  17. package/dist/index.browser.mjs +3 -1
  18. package/dist/index.browser.mjs.map +1 -1
  19. package/dist/index.js +45 -25
  20. package/dist/index.js.map +1 -1
  21. package/dist/index.mjs +45 -25
  22. package/dist/index.mjs.map +1 -1
  23. package/dist/next.js +14 -14
  24. package/dist/next.js.map +1 -1
  25. package/dist/next.mjs +14 -14
  26. package/dist/next.mjs.map +1 -1
  27. package/dist/shared.d.mts +3 -2
  28. package/dist/shared.d.ts +3 -2
  29. package/dist/shared.js +14 -14
  30. package/dist/shared.js.map +1 -1
  31. package/dist/shared.mjs +14 -14
  32. package/dist/shared.mjs.map +1 -1
  33. package/dist/svelte.js +42 -24
  34. package/dist/svelte.js.map +1 -1
  35. package/dist/svelte.mjs +42 -24
  36. package/dist/svelte.mjs.map +1 -1
  37. package/dist/turbopackLoader.js +14 -14
  38. package/dist/turbopackLoader.js.map +1 -1
  39. package/dist/turbopackLoader.mjs +14 -14
  40. package/dist/turbopackLoader.mjs.map +1 -1
  41. package/dist/tw.js +14 -14
  42. package/dist/tw.js.map +1 -1
  43. package/dist/tw.mjs +14 -14
  44. package/dist/tw.mjs.map +1 -1
  45. package/dist/vite.js +14 -14
  46. package/dist/vite.js.map +1 -1
  47. package/dist/vite.mjs +14 -14
  48. package/dist/vite.mjs.map +1 -1
  49. package/dist/vue.js +42 -24
  50. package/dist/vue.js.map +1 -1
  51. package/dist/vue.mjs +42 -24
  52. package/dist/vue.mjs.map +1 -1
  53. package/dist/webpackLoader.js +14 -14
  54. package/dist/webpackLoader.js.map +1 -1
  55. package/dist/webpackLoader.mjs +14 -14
  56. package/dist/webpackLoader.mjs.map +1 -1
  57. package/package.json +3 -2
  58. package/native/index.node +0 -0
package/dist/index.js CHANGED
@@ -885,27 +885,15 @@ function resolveNativeBinary(runtimeDir) {
885
885
  }
886
886
  tried.push(`env:${envPath} (not found)`);
887
887
  }
888
- const prebuiltPkgs = PLATFORM_MAP[platform] ?? [];
889
- for (const pkg of prebuiltPkgs) {
890
- try {
891
- const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
892
- if (fs3__namespace.existsSync(candidate)) {
893
- return { path: candidate, source: "prebuilt", platform, tried };
894
- }
895
- tried.push(`prebuilt:${pkg} (resolved but missing)`);
896
- } catch {
897
- tried.push(`prebuilt:${pkg} (not installed)`);
898
- }
899
- }
900
888
  const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
901
- const BINARY_NAMES_SELF = ["tailwind-styled-native", "tailwind_styled_parser"];
889
+ const BINARY_NAMES_SELF = ["tailwind-styled-native", "tailwind_styled_parser", "index"];
902
890
  if (runtimeDir) {
903
891
  for (const depth of ["..", path9__namespace.join("..", ".."), path9__namespace.join("..", "..", "..")]) {
904
892
  const pkgRoot = path9__namespace.resolve(runtimeDir, depth);
905
893
  for (const bin of BINARY_NAMES_SELF) {
906
894
  for (const suffix of ["", `.${platform}`, `.${napiPlatform}`]) {
907
895
  const candidate = path9__namespace.resolve(pkgRoot, "native", `${bin}${suffix}.node`);
908
- tried.push(`self-bundled:${candidate}`);
896
+ tried.push(`native:${candidate}`);
909
897
  if (fs3__namespace.existsSync(candidate)) {
910
898
  return { path: candidate, source: "prebuilt", platform, tried };
911
899
  }
@@ -913,6 +901,18 @@ function resolveNativeBinary(runtimeDir) {
913
901
  }
914
902
  }
915
903
  }
904
+ const prebuiltPkgs = PLATFORM_MAP[platform] ?? [];
905
+ for (const pkg of prebuiltPkgs) {
906
+ try {
907
+ const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
908
+ if (fs3__namespace.existsSync(candidate)) {
909
+ return { path: candidate, source: "prebuilt", platform, tried };
910
+ }
911
+ tried.push(`prebuilt:${pkg} (resolved but missing)`);
912
+ } catch {
913
+ tried.push(`prebuilt:${pkg} (not installed)`);
914
+ }
915
+ }
916
916
  const cwd = process.cwd();
917
917
  const base = runtimeDir ?? cwd;
918
918
  const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
@@ -4796,24 +4796,31 @@ var init_native_bridge2 = __esm({
4796
4796
 
4797
4797
  // packages/domain/core/src/native.ts
4798
4798
  init_src2();
4799
- var isBrowser4 = typeof window !== "undefined" || typeof document !== "undefined";
4800
- var NATIVE_UNAVAILABLE_MESSAGE2 = "[tailwind-styled/core] Native binding is required but not available.\nPlease ensure you have run: npm run build:rust";
4799
+ var isBrowser4 = typeof window !== "undefined" && typeof document !== "undefined";
4800
+ var NATIVE_UNAVAILABLE_MESSAGE2 = "[tailwind-styled/core] Native binding is required but not available.\nMake sure:\n 1. .node files were copied to dist/ during build\n 2. You installed the correct native package for your platform\n 3. npm run build:rust was executed successfully";
4801
4801
  var _nodeRequire = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)));
4802
4802
  var _loadNative2 = (path15) => _nodeRequire(path15);
4803
4803
  var nativeBinding = null;
4804
4804
  var bindingLoadAttempted = false;
4805
+ var bindingError = null;
4805
4806
  var getBinding = () => {
4806
- if (isBrowser4) {
4807
- throw new Error(NATIVE_UNAVAILABLE_MESSAGE2 + "\n\nNative bindings are not available in browser. Use the compiled CSS output instead.");
4808
- }
4809
4807
  if (nativeBinding) return nativeBinding;
4808
+ if (bindingError) {
4809
+ throw bindingError;
4810
+ }
4810
4811
  if (bindingLoadAttempted) {
4811
4812
  throw new Error(NATIVE_UNAVAILABLE_MESSAGE2);
4812
4813
  }
4813
4814
  bindingLoadAttempted = true;
4814
4815
  try {
4815
- const runtimeDir = isBrowser4 ? "" : path9.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href))));
4816
- const result = isBrowser4 ? { path: null, source: "not-found", platform: "browser", tried: [] } : resolveNativeBinary(runtimeDir);
4816
+ if (isBrowser4) {
4817
+ bindingError = new Error(
4818
+ "[tailwind-styled/core] Cannot use template literals (tw`...`) in browser environment.\n\nTemplate literal parsing requires native Rust bindings compiled to WebAssembly,\nwhich is not currently supported.\n\nSolutions:\n1. Use object config only: tw.button({ base: '...', variants: {...} })\n2. Pre-compile components on the server (Next.js Server Components)\n3. Use @tailwind-styled browser-safe packages if available\n\nFor more info: https://github.com/Dictionar32/css-in-rust/discussions"
4819
+ );
4820
+ throw bindingError;
4821
+ }
4822
+ const runtimeDir = path9.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href))));
4823
+ const result = resolveNativeBinary(runtimeDir);
4817
4824
  if (result.path && result.path.endsWith(".node")) {
4818
4825
  const mod = _loadNative2(result.path);
4819
4826
  if (mod?.batchSplitClasses) {
@@ -4821,11 +4828,22 @@ var getBinding = () => {
4821
4828
  return nativeBinding;
4822
4829
  }
4823
4830
  }
4824
- throw new Error(`${NATIVE_UNAVAILABLE_MESSAGE2}
4831
+ bindingError = new Error(
4832
+ `${NATIVE_UNAVAILABLE_MESSAGE2}
4825
4833
 
4826
- Tried: ${result.tried.join("\n")}`);
4834
+ Resolution Attempts:
4835
+ ${result.tried.map((t2) => ` - ${t2}`).join("\n")}
4836
+
4837
+ Quick fixes:
4838
+ 1. npm run build:rust # Build native binaries
4839
+ 2. npm install # Reinstall with pre-built binaries
4840
+ 3. TW_NATIVE_PATH=/path/to/index.node npm run dev # Specify binary path`
4841
+ );
4842
+ throw bindingError;
4827
4843
  } catch (err) {
4828
- throw err instanceof Error ? err : new Error(String(err));
4844
+ const error = err instanceof Error ? err : new Error(String(err));
4845
+ bindingError = error;
4846
+ throw error;
4829
4847
  }
4830
4848
  };
4831
4849
  var getNativeBinding = getBinding;
@@ -6049,7 +6067,9 @@ function parseTemplate(strings, exprs) {
6049
6067
  if (cached) return cached;
6050
6068
  const binding = getNativeBinding();
6051
6069
  if (!binding?.parseTemplate) {
6052
- throw new Error("FATAL: Native binding 'parseTemplate' is required but not available.");
6070
+ throw new Error(
6071
+ "FATAL: Native binding 'parseTemplate' is required but not available in this environment.\n\nThis function is only available on Node.js with native bindings loaded.\nFor browser environments, use object config instead:\n tw.button({ base: '...', variants: {...} })"
6072
+ );
6053
6073
  }
6054
6074
  const r = binding.parseTemplate(raw);
6055
6075
  const subs = r.hasSubs ? JSON.parse(r.subsJson) : {};