tailwind-styled-v4 5.0.8 → 5.0.10
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/CHANGELOG.md +204 -416
- package/README.md +45 -15
- package/dist/{analyzeWorkspace-DuJKh7Ty.d.mts → analyzeWorkspace-BS5O4rhC.d.mts} +47 -2
- package/dist/{analyzeWorkspace-Ct_NTAWt.d.ts → analyzeWorkspace-DDOQdzzI.d.ts} +47 -2
- package/dist/analyzer.d.mts +5 -3
- package/dist/analyzer.d.ts +5 -3
- package/dist/analyzer.js +563 -468
- package/dist/analyzer.js.map +1 -1
- package/dist/analyzer.mjs +562 -467
- package/dist/analyzer.mjs.map +1 -1
- package/dist/animate.d.mts +4 -7
- package/dist/animate.d.ts +4 -7
- package/dist/animate.js +171 -265
- package/dist/animate.js.map +1 -1
- package/dist/animate.mjs +165 -264
- package/dist/animate.mjs.map +1 -1
- package/dist/atomic.d.mts +22 -1
- package/dist/atomic.d.ts +22 -1
- package/dist/atomic.js +221 -165
- package/dist/atomic.js.map +1 -1
- package/dist/atomic.mjs +200 -165
- package/dist/atomic.mjs.map +1 -1
- package/dist/cli.d.mts +60 -1
- package/dist/cli.d.ts +60 -1
- package/dist/cli.js +1261 -1517
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +1238 -1513
- package/dist/cli.mjs.map +1 -1
- package/dist/compiler.d.mts +38 -7
- package/dist/compiler.d.ts +38 -7
- package/dist/compiler.js +174 -197
- package/dist/compiler.js.map +1 -1
- package/dist/compiler.mjs +151 -194
- package/dist/compiler.mjs.map +1 -1
- package/dist/devtools.js +7 -31
- package/dist/devtools.js.map +1 -1
- package/dist/devtools.mjs +7 -31
- package/dist/devtools.mjs.map +1 -1
- package/dist/engine.d.mts +134 -63
- package/dist/engine.d.ts +134 -63
- package/dist/engine.js +2863 -2482
- package/dist/engine.js.map +1 -1
- package/dist/engine.mjs +2852 -2485
- package/dist/engine.mjs.map +1 -1
- package/dist/{index-eWAocnD2.d.mts → index-NDINUhLN.d.mts} +3 -1
- package/dist/{index-eWAocnD2.d.ts → index-NDINUhLN.d.ts} +3 -1
- package/dist/index.d.mts +63 -32
- package/dist/index.d.ts +63 -32
- package/dist/index.js +335 -169
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +315 -169
- package/dist/index.mjs.map +1 -1
- package/dist/{liveTokenEngine-DSUk88P6.d.ts → liveTokenEngine-CN9ian1R.d.ts} +1 -1
- package/dist/{liveTokenEngine-CX5_0c4q.d.mts → liveTokenEngine-DKoWRtqH.d.mts} +1 -1
- package/dist/next.d.mts +10 -4
- package/dist/next.d.ts +10 -4
- package/dist/next.js +32 -45
- package/dist/next.js.map +1 -1
- package/dist/next.mjs +30 -43
- package/dist/next.mjs.map +1 -1
- package/dist/plugin-api.d.mts +8 -2
- package/dist/plugin-api.d.ts +8 -2
- package/dist/plugin-api.js +14 -2
- package/dist/plugin-api.js.map +1 -1
- package/dist/plugin-api.mjs +14 -3
- package/dist/plugin-api.mjs.map +1 -1
- package/dist/plugin-registry.js +51 -11
- package/dist/plugin-registry.js.map +1 -1
- package/dist/plugin-registry.mjs +51 -11
- package/dist/plugin-registry.mjs.map +1 -1
- package/dist/plugin.d.mts +5 -7
- package/dist/plugin.d.ts +5 -7
- package/dist/plugin.js +16 -15
- package/dist/plugin.js.map +1 -1
- package/dist/plugin.mjs +16 -16
- package/dist/plugin.mjs.map +1 -1
- package/dist/rspack.js +17 -38
- package/dist/rspack.js.map +1 -1
- package/dist/rspack.mjs +15 -36
- package/dist/rspack.mjs.map +1 -1
- package/dist/runtime.d.mts +2 -2
- package/dist/runtime.d.ts +2 -2
- package/dist/scanner.d.mts +10 -1
- package/dist/scanner.d.ts +10 -1
- package/dist/scanner.js +298 -124
- package/dist/scanner.js.map +1 -1
- package/dist/scanner.mjs +296 -124
- package/dist/scanner.mjs.map +1 -1
- package/dist/shared.d.mts +1 -1
- package/dist/shared.d.ts +1 -1
- package/dist/shared.js +104 -176
- package/dist/shared.js.map +1 -1
- package/dist/shared.mjs +85 -176
- package/dist/shared.mjs.map +1 -1
- package/dist/storybook-addon.d.mts +1 -1
- package/dist/storybook-addon.d.ts +1 -1
- package/dist/svelte.d.mts +1 -1
- package/dist/svelte.d.ts +1 -1
- package/dist/svelte.js +166 -3
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +143 -1
- package/dist/svelte.mjs.map +1 -1
- package/dist/syntax.js +21 -21
- package/dist/syntax.js.map +1 -1
- package/dist/syntax.mjs +21 -21
- package/dist/syntax.mjs.map +1 -1
- package/dist/testing.js +9 -1
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +9 -1
- package/dist/testing.mjs.map +1 -1
- package/dist/theme.d.mts +2 -2
- package/dist/theme.d.ts +2 -2
- package/dist/theme.js +40 -112
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +37 -110
- package/dist/theme.mjs.map +1 -1
- package/dist/turbopackLoader.js +84 -126
- package/dist/turbopackLoader.js.map +1 -1
- package/dist/turbopackLoader.mjs +68 -124
- package/dist/turbopackLoader.mjs.map +1 -1
- package/dist/tw.js +1256 -1517
- package/dist/tw.js.map +1 -1
- package/dist/tw.mjs +1236 -1513
- package/dist/tw.mjs.map +1 -1
- package/dist/vite.js +1783 -823
- package/dist/vite.js.map +1 -1
- package/dist/vite.mjs +1767 -821
- package/dist/vite.mjs.map +1 -1
- package/dist/vue.d.mts +1 -1
- package/dist/vue.d.ts +1 -1
- package/dist/vue.js +165 -4
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +141 -1
- package/dist/vue.mjs.map +1 -1
- package/dist/webpackLoader.js +69 -108
- package/dist/webpackLoader.js.map +1 -1
- package/dist/webpackLoader.mjs +49 -104
- package/dist/webpackLoader.mjs.map +1 -1
- package/native/tailwind-styled-native.node +0 -0
- package/package.json +22 -24
package/dist/shared.js
CHANGED
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var crypto = require('crypto');
|
|
4
|
+
var fs2 = require('fs');
|
|
5
|
+
var path = require('path');
|
|
6
|
+
var url = require('url');
|
|
7
|
+
var module$1 = require('module');
|
|
3
8
|
var zod = require('zod');
|
|
4
9
|
|
|
5
10
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
11
|
+
function _interopNamespace(e) {
|
|
12
|
+
if (e && e.__esModule) return e;
|
|
13
|
+
var n = Object.create(null);
|
|
14
|
+
if (e) {
|
|
15
|
+
Object.keys(e).forEach(function (k) {
|
|
16
|
+
if (k !== 'default') {
|
|
17
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
18
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () { return e[k]; }
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
n.default = e;
|
|
26
|
+
return Object.freeze(n);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
var fs2__namespace = /*#__PURE__*/_interopNamespace(fs2);
|
|
30
|
+
var path__namespace = /*#__PURE__*/_interopNamespace(path);
|
|
31
|
+
|
|
6
32
|
/* tailwind-styled-v4 v5.0.4 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
|
|
7
33
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
8
34
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
@@ -239,9 +265,9 @@ function parseNative(schema, data, context) {
|
|
|
239
265
|
const result = schema.safeParse(data);
|
|
240
266
|
if (!result.success) {
|
|
241
267
|
const first = result.error.issues[0];
|
|
242
|
-
const
|
|
268
|
+
const path3 = first?.path?.join(".") ?? "(root)";
|
|
243
269
|
throw new Error(
|
|
244
|
-
`[${context}] Native binding returned unexpected data: ${
|
|
270
|
+
`[${context}] Native binding returned unexpected data: ${path3}: ${first?.message ?? "validation failed"}`
|
|
245
271
|
);
|
|
246
272
|
}
|
|
247
273
|
return result.data;
|
|
@@ -539,10 +565,13 @@ function getDirnameFromUrl(importMetaUrl) {
|
|
|
539
565
|
if (isBrowser2) return "";
|
|
540
566
|
try {
|
|
541
567
|
const nodeUrl = __require(NODE_URL);
|
|
542
|
-
|
|
568
|
+
const nodePath = __require(NODE_PATH);
|
|
569
|
+
return nodePath.dirname(nodeUrl.fileURLToPath(importMetaUrl));
|
|
543
570
|
} catch {
|
|
544
571
|
if (importMetaUrl.startsWith("file://")) {
|
|
545
|
-
|
|
572
|
+
const filePath = importMetaUrl.slice(7);
|
|
573
|
+
const lastSlash = filePath.lastIndexOf("/");
|
|
574
|
+
return lastSlash >= 0 ? filePath.slice(0, lastSlash) : filePath;
|
|
546
575
|
}
|
|
547
576
|
return "";
|
|
548
577
|
}
|
|
@@ -556,11 +585,11 @@ function resolvePath(...segments) {
|
|
|
556
585
|
return segments.join("/").replace(/\/+/g, "/");
|
|
557
586
|
}
|
|
558
587
|
}
|
|
559
|
-
function existsSync(
|
|
588
|
+
function existsSync(path3) {
|
|
560
589
|
if (isBrowser2) return false;
|
|
561
590
|
try {
|
|
562
591
|
const nodeFs = __require(NODE_FS);
|
|
563
|
-
return nodeFs.existsSync(
|
|
592
|
+
return nodeFs.existsSync(path3);
|
|
564
593
|
} catch {
|
|
565
594
|
return false;
|
|
566
595
|
}
|
|
@@ -767,50 +796,8 @@ function generateBarrelFile(exports$1, dir, opts = {}) {
|
|
|
767
796
|
}
|
|
768
797
|
return lines.join("\n");
|
|
769
798
|
}
|
|
770
|
-
|
|
771
|
-
// packages/domain/shared/src/native-resolution.ts
|
|
772
799
|
var isBrowser3 = typeof window !== "undefined" || typeof document !== "undefined";
|
|
773
|
-
var
|
|
774
|
-
function getNodeModuleRef2() {
|
|
775
|
-
if (isBrowser3) return null;
|
|
776
|
-
if (nodeModuleRef2 !== null) return nodeModuleRef2;
|
|
777
|
-
try {
|
|
778
|
-
const test = typeof __require === "function" ? __require("module") : null;
|
|
779
|
-
nodeModuleRef2 = test;
|
|
780
|
-
return test;
|
|
781
|
-
} catch {
|
|
782
|
-
nodeModuleRef2 = null;
|
|
783
|
-
return null;
|
|
784
|
-
}
|
|
785
|
-
}
|
|
786
|
-
var _nodeFs2 = null;
|
|
787
|
-
var _nodePath2 = null;
|
|
788
|
-
var _require = null;
|
|
789
|
-
function getNodeFs2() {
|
|
790
|
-
if (isBrowser3) return { existsSync: () => false };
|
|
791
|
-
const nodeRequire = getNodeModuleRef2();
|
|
792
|
-
if (!nodeRequire) return { existsSync: () => false };
|
|
793
|
-
if (!_nodeFs2) _nodeFs2 = nodeRequire.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared.js', document.baseURI).href)))("node:fs");
|
|
794
|
-
return _nodeFs2;
|
|
795
|
-
}
|
|
796
|
-
function getNodePath2() {
|
|
797
|
-
if (isBrowser3) return { resolve: () => "", dirname: "" };
|
|
798
|
-
const nodeRequire = getNodeModuleRef2();
|
|
799
|
-
if (!nodeRequire) return { resolve: () => "", dirname: "" };
|
|
800
|
-
if (!_nodePath2) _nodePath2 = nodeRequire.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared.js', document.baseURI).href)))("node:path");
|
|
801
|
-
return _nodePath2;
|
|
802
|
-
}
|
|
803
|
-
function getRequire(_importMetaUrl) {
|
|
804
|
-
if (isBrowser3) return () => {
|
|
805
|
-
throw new Error("node:module not available");
|
|
806
|
-
};
|
|
807
|
-
const nodeRequire = getNodeModuleRef2();
|
|
808
|
-
if (!nodeRequire) return () => {
|
|
809
|
-
throw new Error("require not available");
|
|
810
|
-
};
|
|
811
|
-
if (!_require) _require = nodeRequire.createRequire(_importMetaUrl);
|
|
812
|
-
return _require;
|
|
813
|
-
}
|
|
800
|
+
var _require = typeof __require !== "undefined" ? __require : module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared.js', document.baseURI).href)));
|
|
814
801
|
var PLATFORM_MAP = {
|
|
815
802
|
"linux-x64": ["@tailwind-styled/native-linux-x64"],
|
|
816
803
|
"linux-arm64": ["@tailwind-styled/native-linux-arm64"],
|
|
@@ -829,24 +816,21 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
829
816
|
if (isBrowser3) {
|
|
830
817
|
return { path: null, source: "not-found", platform, tried: ["not available in browser"] };
|
|
831
818
|
}
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
819
|
+
if (process.env.TWS_DISABLE_NATIVE === "1") {
|
|
820
|
+
return { path: null, source: "not-found", platform, tried: [] };
|
|
821
|
+
}
|
|
835
822
|
const envPath = process.env.TW_NATIVE_PATH?.trim();
|
|
836
823
|
if (envPath) {
|
|
837
|
-
if (
|
|
824
|
+
if (fs2__namespace.existsSync(envPath)) {
|
|
838
825
|
return { path: envPath, source: "env", platform, tried };
|
|
839
826
|
}
|
|
840
827
|
tried.push(`env:${envPath} (not found)`);
|
|
841
828
|
}
|
|
842
|
-
if (process.env.TWS_NO_NATIVE === "1" || process.env.TWS_NO_RUST === "1" || process.env.TWS_DISABLE_NATIVE === "1") {
|
|
843
|
-
return { path: null, source: "not-found", platform, tried: ["disabled by env"] };
|
|
844
|
-
}
|
|
845
829
|
const prebuiltPkgs = PLATFORM_MAP[platform] ?? [];
|
|
846
830
|
for (const pkg of prebuiltPkgs) {
|
|
847
831
|
try {
|
|
848
|
-
const candidate =
|
|
849
|
-
if (
|
|
832
|
+
const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
|
|
833
|
+
if (fs2__namespace.existsSync(candidate)) {
|
|
850
834
|
return { path: candidate, source: "prebuilt", platform, tried };
|
|
851
835
|
}
|
|
852
836
|
tried.push(`prebuilt:${pkg} (resolved but missing)`);
|
|
@@ -856,17 +840,33 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
856
840
|
}
|
|
857
841
|
const cwd = process.cwd();
|
|
858
842
|
const base = runtimeDir ?? cwd;
|
|
859
|
-
const
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
843
|
+
const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
|
|
844
|
+
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
845
|
+
const localCandidates = [];
|
|
846
|
+
for (const bin of BINARY_NAMES) {
|
|
847
|
+
localCandidates.push(path__namespace.resolve(base, `${bin}.node`));
|
|
848
|
+
localCandidates.push(path__namespace.resolve(base, "..", `${bin}.node`));
|
|
849
|
+
localCandidates.push(path__namespace.resolve(base, `${bin}.${platform}.node`));
|
|
850
|
+
localCandidates.push(path__namespace.resolve(base, `${bin}.${napiPlatform}.node`));
|
|
851
|
+
}
|
|
852
|
+
for (const startDir of [cwd, base]) {
|
|
853
|
+
let dir = startDir;
|
|
854
|
+
for (let i = 0; i < 6; i++) {
|
|
855
|
+
const nativeDir = path__namespace.resolve(dir, "native");
|
|
856
|
+
for (const bin of BINARY_NAMES) {
|
|
857
|
+
localCandidates.push(path__namespace.resolve(nativeDir, `${bin}.node`));
|
|
858
|
+
localCandidates.push(path__namespace.resolve(nativeDir, `${bin}.${platform}.node`));
|
|
859
|
+
localCandidates.push(path__namespace.resolve(nativeDir, `${bin}.${napiPlatform}.node`));
|
|
860
|
+
localCandidates.push(path__namespace.resolve(nativeDir, "target", "release", `${bin}.node`));
|
|
861
|
+
}
|
|
862
|
+
const parent = path__namespace.resolve(dir, "..");
|
|
863
|
+
if (parent === dir) break;
|
|
864
|
+
dir = parent;
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
867
|
for (const candidate of localCandidates) {
|
|
868
868
|
tried.push(`local:${candidate}`);
|
|
869
|
-
if (
|
|
869
|
+
if (fs2__namespace.existsSync(candidate)) {
|
|
870
870
|
return { path: candidate, source: "local", platform, tried };
|
|
871
871
|
}
|
|
872
872
|
}
|
|
@@ -882,8 +882,7 @@ function formatNativeNotFoundError(result) {
|
|
|
882
882
|
`Solutions:`,
|
|
883
883
|
` 1. Build locally: npm run build:rust`,
|
|
884
884
|
` 2. Install prebuilt: npm install @tailwind-styled/native-${result.platform}`,
|
|
885
|
-
` 3. Override path: TW_NATIVE_PATH=/path/to/parser.node
|
|
886
|
-
` 4. Disable native: TWS_DISABLE_NATIVE=1 (slower, JS fallback)`
|
|
885
|
+
` 3. Override path: TW_NATIVE_PATH=/path/to/parser.node`
|
|
887
886
|
];
|
|
888
887
|
return lines.join("\n");
|
|
889
888
|
}
|
|
@@ -891,9 +890,9 @@ function formatNativeNotFoundError(result) {
|
|
|
891
890
|
// packages/domain/shared/src/observability.ts
|
|
892
891
|
function createObservabilityClient(opts = {}) {
|
|
893
892
|
const { baseUrl = "http://localhost:7421", timeoutMs = 3e3 } = opts;
|
|
894
|
-
async function fetchJson(
|
|
893
|
+
async function fetchJson(path3) {
|
|
895
894
|
try {
|
|
896
|
-
const res = await fetch(`${baseUrl}${
|
|
895
|
+
const res = await fetch(`${baseUrl}${path3}`, {
|
|
897
896
|
signal: AbortSignal.timeout(timeoutMs)
|
|
898
897
|
});
|
|
899
898
|
if (!res.ok) return null;
|
|
@@ -922,52 +921,6 @@ function createObservabilityClient(opts = {}) {
|
|
|
922
921
|
}
|
|
923
922
|
|
|
924
923
|
// packages/domain/shared/src/index.ts
|
|
925
|
-
var isBrowser4 = typeof window !== "undefined" || typeof document !== "undefined";
|
|
926
|
-
var nodeModuleRef3 = null;
|
|
927
|
-
function getNodeModuleRef3() {
|
|
928
|
-
if (isBrowser4) return null;
|
|
929
|
-
if (nodeModuleRef3 !== null) return nodeModuleRef3;
|
|
930
|
-
try {
|
|
931
|
-
const test = typeof __require === "function" ? __require("module") : null;
|
|
932
|
-
nodeModuleRef3 = test;
|
|
933
|
-
return test;
|
|
934
|
-
} catch {
|
|
935
|
-
nodeModuleRef3 = null;
|
|
936
|
-
return null;
|
|
937
|
-
}
|
|
938
|
-
}
|
|
939
|
-
var _nodeCrypto = null;
|
|
940
|
-
var _nodeFs3 = null;
|
|
941
|
-
var _nodePath3 = null;
|
|
942
|
-
var _nodeUrl2 = null;
|
|
943
|
-
function getNodeCrypto() {
|
|
944
|
-
if (isBrowser4) throw new Error("node:crypto not available in browser");
|
|
945
|
-
const nodeRequire = getNodeModuleRef3();
|
|
946
|
-
if (!nodeRequire) throw new Error("require not available");
|
|
947
|
-
if (!_nodeCrypto) _nodeCrypto = nodeRequire.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared.js', document.baseURI).href)))("node:crypto");
|
|
948
|
-
return _nodeCrypto;
|
|
949
|
-
}
|
|
950
|
-
function getNodeFs3() {
|
|
951
|
-
if (isBrowser4) throw new Error("node:fs not available in browser");
|
|
952
|
-
const nodeRequire = getNodeModuleRef3();
|
|
953
|
-
if (!nodeRequire) throw new Error("require not available");
|
|
954
|
-
if (!_nodeFs3) _nodeFs3 = nodeRequire.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared.js', document.baseURI).href)))("node:fs");
|
|
955
|
-
return _nodeFs3;
|
|
956
|
-
}
|
|
957
|
-
function getNodePath3() {
|
|
958
|
-
if (isBrowser4) throw new Error("node:path not available in browser");
|
|
959
|
-
const nodeRequire = getNodeModuleRef3();
|
|
960
|
-
if (!nodeRequire) throw new Error("require not available");
|
|
961
|
-
if (!_nodePath3) _nodePath3 = nodeRequire.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared.js', document.baseURI).href)))("node:path");
|
|
962
|
-
return _nodePath3;
|
|
963
|
-
}
|
|
964
|
-
function getNodeUrl2() {
|
|
965
|
-
if (isBrowser4) throw new Error("node:url not available in browser");
|
|
966
|
-
const nodeRequire = getNodeModuleRef3();
|
|
967
|
-
if (!nodeRequire) throw new Error("require not available");
|
|
968
|
-
if (!_nodeUrl2) _nodeUrl2 = nodeRequire.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared.js', document.baseURI).href)))("node:url");
|
|
969
|
-
return _nodeUrl2;
|
|
970
|
-
}
|
|
971
924
|
function createLogger(namespace) {
|
|
972
925
|
const prefix = `[${namespace}]`;
|
|
973
926
|
return {
|
|
@@ -997,9 +950,9 @@ function createDebugLogger(namespace, label) {
|
|
|
997
950
|
}
|
|
998
951
|
};
|
|
999
952
|
}
|
|
1000
|
-
function formatIssuePath(
|
|
1001
|
-
if (!
|
|
1002
|
-
return
|
|
953
|
+
function formatIssuePath(path3) {
|
|
954
|
+
if (!path3 || path3.length === 0) return "(root)";
|
|
955
|
+
return path3.map(
|
|
1003
956
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
1004
957
|
).join(".");
|
|
1005
958
|
}
|
|
@@ -1036,8 +989,8 @@ var TwError = class _TwError extends Error {
|
|
|
1036
989
|
/** Buat TwError dari ZodError — dukung shape Zod v3 (`errors`) dan v4 (`issues`). */
|
|
1037
990
|
static fromZod(err) {
|
|
1038
991
|
const first = err.issues?.[0] ?? err.errors?.[0];
|
|
1039
|
-
const
|
|
1040
|
-
const message = first ? `${
|
|
992
|
+
const path3 = formatIssuePath(first?.path);
|
|
993
|
+
const message = first ? `${path3}: ${first.message}` : "Schema validation failed";
|
|
1041
994
|
return new _TwError("validation", "SCHEMA_VALIDATION_FAILED", message, err);
|
|
1042
995
|
}
|
|
1043
996
|
static wrap(source, code, err) {
|
|
@@ -1062,17 +1015,12 @@ function isTwError(err) {
|
|
|
1062
1015
|
return err instanceof TwError;
|
|
1063
1016
|
}
|
|
1064
1017
|
function loadNativeBinding(options) {
|
|
1065
|
-
if (isBrowser4) {
|
|
1066
|
-
return { binding: null, loadErrors: [{ path: "", message: "Native bindings not available in browser" }] };
|
|
1067
|
-
}
|
|
1068
1018
|
const { runtimeDir, candidates, isValid } = options;
|
|
1069
1019
|
const loadErrors = [];
|
|
1070
|
-
const path = getNodePath3();
|
|
1071
|
-
const fs = getNodeFs3();
|
|
1072
1020
|
for (const candidate of candidates) {
|
|
1073
|
-
const candidatePath =
|
|
1021
|
+
const candidatePath = path__namespace.default.resolve(runtimeDir, candidate);
|
|
1074
1022
|
try {
|
|
1075
|
-
if (!
|
|
1023
|
+
if (!fs2__namespace.default.existsSync(candidatePath) && !fs2__namespace.default.existsSync(candidatePath + ".node")) {
|
|
1076
1024
|
continue;
|
|
1077
1025
|
}
|
|
1078
1026
|
const mod = requireNativeModule(candidatePath);
|
|
@@ -1086,76 +1034,56 @@ function loadNativeBinding(options) {
|
|
|
1086
1034
|
}
|
|
1087
1035
|
return { binding: null, loadErrors };
|
|
1088
1036
|
}
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
});
|
|
1093
|
-
const nodeRequire = getNodeModuleRef3();
|
|
1094
|
-
if (!nodeRequire) return (() => {
|
|
1095
|
-
throw new Error("require not available");
|
|
1096
|
-
});
|
|
1097
|
-
return nodeRequire.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared.js', document.baseURI).href)));
|
|
1098
|
-
}
|
|
1099
|
-
var _require2 = getRequire2();
|
|
1100
|
-
function requireNativeModule(path) {
|
|
1101
|
-
return _require2(path);
|
|
1037
|
+
var _require2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared.js', document.baseURI).href)));
|
|
1038
|
+
function requireNativeModule(p) {
|
|
1039
|
+
return _require2(p);
|
|
1102
1040
|
}
|
|
1103
1041
|
function resolveNativeBindingCandidates(options) {
|
|
1104
|
-
|
|
1105
|
-
|
|
1042
|
+
const {
|
|
1043
|
+
envVarNames = ["TW_NATIVE_PATH", "TWS_NATIVE_PATH"],
|
|
1044
|
+
includeDefaultCandidates = true,
|
|
1045
|
+
enforceNodeExtensionForEnvPath = false
|
|
1046
|
+
} = options;
|
|
1047
|
+
const runtimeDir = options.runtimeDir || process.cwd();
|
|
1106
1048
|
const candidates = [];
|
|
1107
|
-
const path = getNodePath3();
|
|
1108
|
-
const fs = getNodeFs3();
|
|
1109
1049
|
for (const envVar of envVarNames) {
|
|
1110
1050
|
const envPath = process.env[envVar];
|
|
1111
1051
|
if (envPath) {
|
|
1112
|
-
|
|
1113
|
-
candidates.push(envPath + ".node");
|
|
1114
|
-
} else {
|
|
1115
|
-
candidates.push(envPath);
|
|
1116
|
-
}
|
|
1052
|
+
candidates.push(enforceNodeExtensionForEnvPath && !envPath.endsWith(".node") ? envPath + ".node" : envPath);
|
|
1117
1053
|
}
|
|
1118
1054
|
}
|
|
1119
1055
|
if (!includeDefaultCandidates) return candidates;
|
|
1120
|
-
if (
|
|
1056
|
+
if (fs2__namespace.default.existsSync(runtimeDir)) {
|
|
1121
1057
|
try {
|
|
1122
|
-
const
|
|
1123
|
-
|
|
1124
|
-
if (entry.endsWith(".node")) {
|
|
1125
|
-
candidates.push(entry);
|
|
1126
|
-
}
|
|
1058
|
+
for (const entry of fs2__namespace.default.readdirSync(runtimeDir)) {
|
|
1059
|
+
if (entry.endsWith(".node")) candidates.push(entry);
|
|
1127
1060
|
}
|
|
1128
1061
|
} catch {
|
|
1129
1062
|
}
|
|
1130
1063
|
}
|
|
1131
|
-
const
|
|
1132
|
-
const
|
|
1133
|
-
const
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1064
|
+
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
1065
|
+
const napiPlatform = process.platform === "linux" && process.arch === "x64" ? "linux-x64-gnu" : process.platform === "linux" && process.arch === "arm64" ? "linux-arm64-gnu" : `${process.platform}-${process.arch}`;
|
|
1066
|
+
for (const bin of BINARY_NAMES) {
|
|
1067
|
+
candidates.push(path__namespace.default.resolve(runtimeDir, `${bin}.node`));
|
|
1068
|
+
candidates.push(path__namespace.default.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
|
|
1069
|
+
candidates.push(path__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
|
|
1070
|
+
candidates.push(path__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
|
|
1071
|
+
candidates.push(path__namespace.default.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
|
|
1072
|
+
candidates.push(path__namespace.default.resolve(process.cwd(), "native", `${bin}.node`));
|
|
1073
|
+
candidates.push(path__namespace.default.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
|
|
1074
|
+
}
|
|
1137
1075
|
return Array.from(new Set(candidates));
|
|
1138
1076
|
}
|
|
1139
1077
|
function resolveRuntimeDir(dir, importMetaUrl) {
|
|
1140
|
-
if (
|
|
1141
|
-
if (dir) return getNodePath3().resolve(dir);
|
|
1078
|
+
if (dir) return path__namespace.default.resolve(dir);
|
|
1142
1079
|
try {
|
|
1143
|
-
return
|
|
1080
|
+
return path__namespace.default.dirname(url.fileURLToPath(importMetaUrl));
|
|
1144
1081
|
} catch {
|
|
1145
1082
|
return process.cwd();
|
|
1146
1083
|
}
|
|
1147
1084
|
}
|
|
1148
1085
|
function hashContent(content, algorithm = "md5", length) {
|
|
1149
|
-
|
|
1150
|
-
let hash2 = 0;
|
|
1151
|
-
for (let i = 0; i < content.length; i++) {
|
|
1152
|
-
const char = content.charCodeAt(i);
|
|
1153
|
-
hash2 = (hash2 << 5) - hash2 + char;
|
|
1154
|
-
hash2 = hash2 & hash2;
|
|
1155
|
-
}
|
|
1156
|
-
return Math.abs(hash2).toString(16).slice(0, length ?? 8);
|
|
1157
|
-
}
|
|
1158
|
-
const hash = getNodeCrypto().createHash(algorithm).update(content).digest("hex");
|
|
1086
|
+
const hash = crypto.createHash(algorithm).update(content).digest("hex");
|
|
1159
1087
|
return length ? hash.slice(0, length) : hash;
|
|
1160
1088
|
}
|
|
1161
1089
|
function formatErrorMessage(error) {
|