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.
- package/dist/atomic.js +14 -14
- package/dist/atomic.js.map +1 -1
- package/dist/atomic.mjs +14 -14
- package/dist/atomic.mjs.map +1 -1
- package/dist/cli.js +14 -14
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +14 -14
- package/dist/cli.mjs.map +1 -1
- package/dist/compiler.js +14 -14
- package/dist/compiler.js.map +1 -1
- package/dist/compiler.mjs +14 -14
- package/dist/compiler.mjs.map +1 -1
- package/dist/engine.js +14 -14
- package/dist/engine.js.map +1 -1
- package/dist/engine.mjs +14 -14
- package/dist/engine.mjs.map +1 -1
- package/dist/index.browser.mjs +3 -1
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.js +45 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +45 -25
- package/dist/index.mjs.map +1 -1
- package/dist/next.js +14 -14
- package/dist/next.js.map +1 -1
- package/dist/next.mjs +14 -14
- package/dist/next.mjs.map +1 -1
- package/dist/shared.d.mts +3 -2
- package/dist/shared.d.ts +3 -2
- package/dist/shared.js +14 -14
- package/dist/shared.js.map +1 -1
- package/dist/shared.mjs +14 -14
- package/dist/shared.mjs.map +1 -1
- package/dist/svelte.js +42 -24
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +42 -24
- package/dist/svelte.mjs.map +1 -1
- package/dist/turbopackLoader.js +14 -14
- package/dist/turbopackLoader.js.map +1 -1
- package/dist/turbopackLoader.mjs +14 -14
- package/dist/turbopackLoader.mjs.map +1 -1
- package/dist/tw.js +14 -14
- package/dist/tw.js.map +1 -1
- package/dist/tw.mjs +14 -14
- package/dist/tw.mjs.map +1 -1
- package/dist/vite.js +14 -14
- package/dist/vite.js.map +1 -1
- package/dist/vite.mjs +14 -14
- package/dist/vite.mjs.map +1 -1
- package/dist/vue.js +42 -24
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +42 -24
- package/dist/vue.mjs.map +1 -1
- package/dist/webpackLoader.js +14 -14
- package/dist/webpackLoader.js.map +1 -1
- package/dist/webpackLoader.mjs +14 -14
- package/dist/webpackLoader.mjs.map +1 -1
- package/package.json +3 -2
- package/native/index.node +0 -0
package/dist/index.mjs
CHANGED
|
@@ -860,27 +860,15 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
860
860
|
}
|
|
861
861
|
tried.push(`env:${envPath} (not found)`);
|
|
862
862
|
}
|
|
863
|
-
const prebuiltPkgs = PLATFORM_MAP[platform] ?? [];
|
|
864
|
-
for (const pkg of prebuiltPkgs) {
|
|
865
|
-
try {
|
|
866
|
-
const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
|
|
867
|
-
if (fs3.existsSync(candidate)) {
|
|
868
|
-
return { path: candidate, source: "prebuilt", platform, tried };
|
|
869
|
-
}
|
|
870
|
-
tried.push(`prebuilt:${pkg} (resolved but missing)`);
|
|
871
|
-
} catch {
|
|
872
|
-
tried.push(`prebuilt:${pkg} (not installed)`);
|
|
873
|
-
}
|
|
874
|
-
}
|
|
875
863
|
const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
|
|
876
|
-
const BINARY_NAMES_SELF = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
864
|
+
const BINARY_NAMES_SELF = ["tailwind-styled-native", "tailwind_styled_parser", "index"];
|
|
877
865
|
if (runtimeDir) {
|
|
878
866
|
for (const depth of ["..", path9.join("..", ".."), path9.join("..", "..", "..")]) {
|
|
879
867
|
const pkgRoot = path9.resolve(runtimeDir, depth);
|
|
880
868
|
for (const bin of BINARY_NAMES_SELF) {
|
|
881
869
|
for (const suffix of ["", `.${platform}`, `.${napiPlatform}`]) {
|
|
882
870
|
const candidate = path9.resolve(pkgRoot, "native", `${bin}${suffix}.node`);
|
|
883
|
-
tried.push(`
|
|
871
|
+
tried.push(`native:${candidate}`);
|
|
884
872
|
if (fs3.existsSync(candidate)) {
|
|
885
873
|
return { path: candidate, source: "prebuilt", platform, tried };
|
|
886
874
|
}
|
|
@@ -888,6 +876,18 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
888
876
|
}
|
|
889
877
|
}
|
|
890
878
|
}
|
|
879
|
+
const prebuiltPkgs = PLATFORM_MAP[platform] ?? [];
|
|
880
|
+
for (const pkg of prebuiltPkgs) {
|
|
881
|
+
try {
|
|
882
|
+
const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
|
|
883
|
+
if (fs3.existsSync(candidate)) {
|
|
884
|
+
return { path: candidate, source: "prebuilt", platform, tried };
|
|
885
|
+
}
|
|
886
|
+
tried.push(`prebuilt:${pkg} (resolved but missing)`);
|
|
887
|
+
} catch {
|
|
888
|
+
tried.push(`prebuilt:${pkg} (not installed)`);
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
891
|
const cwd = process.cwd();
|
|
892
892
|
const base = runtimeDir ?? cwd;
|
|
893
893
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
@@ -4771,24 +4771,31 @@ var init_native_bridge2 = __esm({
|
|
|
4771
4771
|
|
|
4772
4772
|
// packages/domain/core/src/native.ts
|
|
4773
4773
|
init_src2();
|
|
4774
|
-
var isBrowser4 = typeof window !== "undefined"
|
|
4775
|
-
var NATIVE_UNAVAILABLE_MESSAGE2 = "[tailwind-styled/core] Native binding is required but not available.\
|
|
4774
|
+
var isBrowser4 = typeof window !== "undefined" && typeof document !== "undefined";
|
|
4775
|
+
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";
|
|
4776
4776
|
var _nodeRequire = createRequire(import.meta.url);
|
|
4777
4777
|
var _loadNative2 = (path15) => _nodeRequire(path15);
|
|
4778
4778
|
var nativeBinding = null;
|
|
4779
4779
|
var bindingLoadAttempted = false;
|
|
4780
|
+
var bindingError = null;
|
|
4780
4781
|
var getBinding = () => {
|
|
4781
|
-
if (isBrowser4) {
|
|
4782
|
-
throw new Error(NATIVE_UNAVAILABLE_MESSAGE2 + "\n\nNative bindings are not available in browser. Use the compiled CSS output instead.");
|
|
4783
|
-
}
|
|
4784
4782
|
if (nativeBinding) return nativeBinding;
|
|
4783
|
+
if (bindingError) {
|
|
4784
|
+
throw bindingError;
|
|
4785
|
+
}
|
|
4785
4786
|
if (bindingLoadAttempted) {
|
|
4786
4787
|
throw new Error(NATIVE_UNAVAILABLE_MESSAGE2);
|
|
4787
4788
|
}
|
|
4788
4789
|
bindingLoadAttempted = true;
|
|
4789
4790
|
try {
|
|
4790
|
-
|
|
4791
|
-
|
|
4791
|
+
if (isBrowser4) {
|
|
4792
|
+
bindingError = new Error(
|
|
4793
|
+
"[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"
|
|
4794
|
+
);
|
|
4795
|
+
throw bindingError;
|
|
4796
|
+
}
|
|
4797
|
+
const runtimeDir = dirname(fileURLToPath(import.meta.url));
|
|
4798
|
+
const result = resolveNativeBinary(runtimeDir);
|
|
4792
4799
|
if (result.path && result.path.endsWith(".node")) {
|
|
4793
4800
|
const mod = _loadNative2(result.path);
|
|
4794
4801
|
if (mod?.batchSplitClasses) {
|
|
@@ -4796,11 +4803,22 @@ var getBinding = () => {
|
|
|
4796
4803
|
return nativeBinding;
|
|
4797
4804
|
}
|
|
4798
4805
|
}
|
|
4799
|
-
|
|
4806
|
+
bindingError = new Error(
|
|
4807
|
+
`${NATIVE_UNAVAILABLE_MESSAGE2}
|
|
4800
4808
|
|
|
4801
|
-
|
|
4809
|
+
Resolution Attempts:
|
|
4810
|
+
${result.tried.map((t2) => ` - ${t2}`).join("\n")}
|
|
4811
|
+
|
|
4812
|
+
Quick fixes:
|
|
4813
|
+
1. npm run build:rust # Build native binaries
|
|
4814
|
+
2. npm install # Reinstall with pre-built binaries
|
|
4815
|
+
3. TW_NATIVE_PATH=/path/to/index.node npm run dev # Specify binary path`
|
|
4816
|
+
);
|
|
4817
|
+
throw bindingError;
|
|
4802
4818
|
} catch (err) {
|
|
4803
|
-
|
|
4819
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
4820
|
+
bindingError = error;
|
|
4821
|
+
throw error;
|
|
4804
4822
|
}
|
|
4805
4823
|
};
|
|
4806
4824
|
var getNativeBinding = getBinding;
|
|
@@ -6024,7 +6042,9 @@ function parseTemplate(strings, exprs) {
|
|
|
6024
6042
|
if (cached) return cached;
|
|
6025
6043
|
const binding = getNativeBinding();
|
|
6026
6044
|
if (!binding?.parseTemplate) {
|
|
6027
|
-
throw new Error(
|
|
6045
|
+
throw new Error(
|
|
6046
|
+
"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: {...} })"
|
|
6047
|
+
);
|
|
6028
6048
|
}
|
|
6029
6049
|
const r = binding.parseTemplate(raw);
|
|
6030
6050
|
const subs = r.hasSubs ? JSON.parse(r.subsJson) : {};
|