tailwind-styled-v4 5.1.16 → 5.1.17

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 (59) hide show
  1. package/dist/atomic.js +16 -4
  2. package/dist/atomic.js.map +1 -1
  3. package/dist/atomic.mjs +13 -2
  4. package/dist/atomic.mjs.map +1 -1
  5. package/dist/cli.js +80 -68
  6. package/dist/cli.js.map +1 -1
  7. package/dist/cli.mjs +77 -66
  8. package/dist/cli.mjs.map +1 -1
  9. package/dist/compiler.d.mts +84 -4
  10. package/dist/compiler.d.ts +84 -4
  11. package/dist/compiler.js +245 -15
  12. package/dist/compiler.js.map +1 -1
  13. package/dist/compiler.mjs +240 -14
  14. package/dist/compiler.mjs.map +1 -1
  15. package/dist/engine.js +209 -167
  16. package/dist/engine.js.map +1 -1
  17. package/dist/engine.mjs +200 -159
  18. package/dist/engine.mjs.map +1 -1
  19. package/dist/index.browser.mjs +1 -1
  20. package/dist/index.browser.mjs.map +1 -1
  21. package/dist/index.js +1 -1
  22. package/dist/index.js.map +1 -1
  23. package/dist/index.mjs +1 -1
  24. package/dist/index.mjs.map +1 -1
  25. package/dist/next.d.mts +16 -0
  26. package/dist/next.d.ts +16 -0
  27. package/dist/next.js +458 -158
  28. package/dist/next.js.map +1 -1
  29. package/dist/next.mjs +454 -154
  30. package/dist/next.mjs.map +1 -1
  31. package/dist/runtime.js +1 -1
  32. package/dist/runtime.js.map +1 -1
  33. package/dist/runtime.mjs +1 -1
  34. package/dist/runtime.mjs.map +1 -1
  35. package/dist/shared.js +106 -64
  36. package/dist/shared.js.map +1 -1
  37. package/dist/shared.mjs +101 -60
  38. package/dist/shared.mjs.map +1 -1
  39. package/dist/theme.js +1 -1
  40. package/dist/theme.js.map +1 -1
  41. package/dist/theme.mjs +1 -1
  42. package/dist/theme.mjs.map +1 -1
  43. package/dist/turbopackLoader.js +94 -52
  44. package/dist/turbopackLoader.js.map +1 -1
  45. package/dist/turbopackLoader.mjs +92 -51
  46. package/dist/turbopackLoader.mjs.map +1 -1
  47. package/dist/tw.js +80 -68
  48. package/dist/tw.js.map +1 -1
  49. package/dist/tw.mjs +77 -66
  50. package/dist/tw.mjs.map +1 -1
  51. package/dist/vite.js +172 -130
  52. package/dist/vite.js.map +1 -1
  53. package/dist/vite.mjs +166 -125
  54. package/dist/vite.mjs.map +1 -1
  55. package/dist/webpackLoader.js +28 -10
  56. package/dist/webpackLoader.js.map +1 -1
  57. package/dist/webpackLoader.mjs +26 -9
  58. package/dist/webpackLoader.mjs.map +1 -1
  59. package/package.json +1 -1
package/dist/shared.mjs CHANGED
@@ -230,9 +230,9 @@ function parseNative(schema, data, context) {
230
230
  const result = schema.safeParse(data);
231
231
  if (!result.success) {
232
232
  const first = result.error.issues[0];
233
- const path7 = first?.path?.join(".") ?? "(root)";
233
+ const path8 = first?.path?.join(".") ?? "(root)";
234
234
  throw new Error(
235
- `[${context}] Native binding returned unexpected data: ${path7}: ${first?.message ?? "validation failed"}`
235
+ `[${context}] Native binding returned unexpected data: ${path8}: ${first?.message ?? "validation failed"}`
236
236
  );
237
237
  }
238
238
  return result.data;
@@ -666,11 +666,11 @@ function resolvePath(...segments) {
666
666
  return segments.join("/").replace(/\/+/g, "/");
667
667
  }
668
668
  }
669
- function existsSync(path7) {
669
+ function existsSync(path8) {
670
670
  if (isBrowser2) return false;
671
671
  try {
672
672
  const nodeFs = __require(NODE_FS);
673
- return nodeFs.existsSync(path7);
673
+ return nodeFs.existsSync(path8);
674
674
  } catch {
675
675
  return false;
676
676
  }
@@ -1024,9 +1024,9 @@ var init_native_resolution = __esm({
1024
1024
  // packages/domain/shared/src/observability.ts
1025
1025
  function createObservabilityClient(opts = {}) {
1026
1026
  const { baseUrl = "http://localhost:7421", timeoutMs = 3e3 } = opts;
1027
- async function fetchJson(path7) {
1027
+ async function fetchJson(path8) {
1028
1028
  try {
1029
- const res = await fetch(`${baseUrl}${path7}`, {
1029
+ const res = await fetch(`${baseUrl}${path8}`, {
1030
1030
  signal: AbortSignal.timeout(timeoutMs)
1031
1031
  });
1032
1032
  if (!res.ok) return null;
@@ -1067,7 +1067,7 @@ var init_nativeBridge = __esm({
1067
1067
  "use strict";
1068
1068
  init_esm_shims();
1069
1069
  init_src2();
1070
- _loadNative = (path7) => __require(path7);
1070
+ _loadNative = (path8) => __require(path8);
1071
1071
  log = (...args) => {
1072
1072
  if (process.env.DEBUG?.includes("compiler:native")) {
1073
1073
  console.log("[compiler:native]", ...args);
@@ -2891,9 +2891,19 @@ var init_watch = __esm({
2891
2891
  }
2892
2892
  });
2893
2893
 
2894
- // packages/domain/compiler/src/index.ts
2894
+ // packages/domain/compiler/src/routeGraph.ts
2895
2895
  import fs2 from "fs";
2896
2896
  import path3 from "path";
2897
+ var init_routeGraph = __esm({
2898
+ "packages/domain/compiler/src/routeGraph.ts"() {
2899
+ "use strict";
2900
+ init_esm_shims();
2901
+ }
2902
+ });
2903
+
2904
+ // packages/domain/compiler/src/index.ts
2905
+ import fs3 from "fs";
2906
+ import path4 from "path";
2897
2907
  import { createRequire as createRequire4 } from "module";
2898
2908
  function _layoutClassesToCss(classes) {
2899
2909
  const native = getNativeBridge();
@@ -2929,7 +2939,7 @@ function extractContainerCssFromSource(source) {
2929
2939
  }
2930
2940
  return rules.join("\n");
2931
2941
  }
2932
- var _require2, transformSource, hasTwUsage, isAlreadyTransformed, shouldProcess, compileCssFromClasses, buildStyleTag, generateCssForClasses, eliminateDeadCss, findDeadVariants, runElimination, scanProjectUsage, generateSafelist, loadSafelist, loadTailwindConfig, getContentPaths, _CONTAINER_BREAKPOINTS, runLoaderTransform, shouldSkipFile, fileToRoute, getAllRoutes, getRouteClasses, registerFileClasses, registerGlobalClasses, _incrementalEngineInstance, getIncrementalEngine, resetIncrementalEngine, IncrementalEngine, getBucketEngine, resetBucketEngine, classifyNode, detectConflicts, bucketSort, analyzeFile, analyzeVariantUsage, injectClientDirective, injectServerOnlyComment, analyzeClasses, extractTwStateConfigs, generateStaticStateCss, extractAndGenerateStateCss;
2942
+ var _require2, transformSource, hasTwUsage, isAlreadyTransformed, shouldProcess, compileCssFromClasses, buildStyleTag, generateCssForClasses, eliminateDeadCss, findDeadVariants, runElimination, scanProjectUsage, generateSafelist, loadSafelist, loadTailwindConfig, getContentPaths, _CONTAINER_BREAKPOINTS, runLoaderTransform, shouldSkipFile, fileToRoute, getAllRoutes, _fileClassesMap, _globalClasses, getRouteClasses, getAllRegisteredClasses, registerFileClasses, registerGlobalClasses, resetRouteClassRegistry, _incrementalEngineInstance, getIncrementalEngine, resetIncrementalEngine, IncrementalEngine, getBucketEngine, resetBucketEngine, classifyNode, detectConflicts, bucketSort, analyzeFile, analyzeVariantUsage, injectClientDirective, injectServerOnlyComment, analyzeClasses, extractTwStateConfigs, generateStaticStateCss, extractAndGenerateStateCss;
2933
2943
  var init_src = __esm({
2934
2944
  "packages/domain/compiler/src/index.ts"() {
2935
2945
  "use strict";
@@ -2941,6 +2951,7 @@ var init_src = __esm({
2941
2951
  init_cache();
2942
2952
  init_redis();
2943
2953
  init_watch();
2954
+ init_routeGraph();
2944
2955
  _require2 = createRequire4(
2945
2956
  typeof __require !== "undefined" ? typeof __filename !== "undefined" ? `file://${__filename}` : "file://unknown" : import.meta.url
2946
2957
  );
@@ -3035,7 +3046,7 @@ var init_src = __esm({
3035
3046
  };
3036
3047
  scanProjectUsage = (dirs, cwd) => {
3037
3048
  const { batchExtractClasses: batchExtractClasses2 } = _require2("./parser");
3038
- const files = dirs.map((dir) => path3.resolve(cwd, dir));
3049
+ const files = dirs.map((dir) => path4.resolve(cwd, dir));
3039
3050
  const results = batchExtractClasses2(files) || [];
3040
3051
  const combined = {};
3041
3052
  for (const result of results) {
@@ -3052,13 +3063,13 @@ var init_src = __esm({
3052
3063
  const classes = scanProjectUsage(scanDirs, cwd || process.cwd());
3053
3064
  const allClasses = Object.keys(classes).sort();
3054
3065
  if (outputPath) {
3055
- fs2.writeFileSync(outputPath, JSON.stringify(allClasses, null, 2));
3066
+ fs3.writeFileSync(outputPath, JSON.stringify(allClasses, null, 2));
3056
3067
  }
3057
3068
  return allClasses;
3058
3069
  };
3059
3070
  loadSafelist = (safelistPath) => {
3060
3071
  try {
3061
- const content = fs2.readFileSync(safelistPath, "utf-8");
3072
+ const content = fs3.readFileSync(safelistPath, "utf-8");
3062
3073
  return JSON.parse(content);
3063
3074
  } catch {
3064
3075
  return [];
@@ -3072,8 +3083,8 @@ var init_src = __esm({
3072
3083
  "tailwind.config.cjs"
3073
3084
  ];
3074
3085
  for (const file of configFiles) {
3075
- const fullPath = path3.join(cwd, file);
3076
- if (fs2.existsSync(fullPath)) {
3086
+ const fullPath = path4.join(cwd, file);
3087
+ if (fs3.existsSync(fullPath)) {
3077
3088
  const mod = __require(fullPath);
3078
3089
  return mod.default || mod;
3079
3090
  }
@@ -3083,9 +3094,9 @@ var init_src = __esm({
3083
3094
  getContentPaths = (cwd = process.cwd()) => {
3084
3095
  return {
3085
3096
  content: [
3086
- path3.join(cwd, "src/**/*.{js,ts,jsx,tsx}"),
3087
- path3.join(cwd, "app/**/*.{js,ts,jsx,tsx}"),
3088
- path3.join(cwd, "pages/**/*.{js,ts,jsx,tsx}")
3097
+ path4.join(cwd, "src/**/*.{js,ts,jsx,tsx}"),
3098
+ path4.join(cwd, "app/**/*.{js,ts,jsx,tsx}"),
3099
+ path4.join(cwd, "pages/**/*.{js,ts,jsx,tsx}")
3089
3100
  ]
3090
3101
  };
3091
3102
  };
@@ -3156,10 +3167,38 @@ var init_src = __esm({
3156
3167
  }
3157
3168
  return ["/", "__global"];
3158
3169
  };
3159
- getRouteClasses = (_route) => /* @__PURE__ */ new Set();
3160
- registerFileClasses = (_filepath, _classes) => {
3170
+ _fileClassesMap = /* @__PURE__ */ new Map();
3171
+ _globalClasses = /* @__PURE__ */ new Set();
3172
+ getRouteClasses = (route) => {
3173
+ const result = /* @__PURE__ */ new Set();
3174
+ for (const [filepath, classes] of _fileClassesMap) {
3175
+ const fileRoute = fileToRoute(filepath) ?? "__global";
3176
+ if (fileRoute === route) {
3177
+ for (const cls of classes) result.add(cls);
3178
+ }
3179
+ }
3180
+ return result;
3181
+ };
3182
+ getAllRegisteredClasses = () => {
3183
+ const result = new Set(_globalClasses);
3184
+ for (const classes of _fileClassesMap.values()) {
3185
+ for (const cls of classes) result.add(cls);
3186
+ }
3187
+ return result;
3188
+ };
3189
+ registerFileClasses = (filepath, classes) => {
3190
+ if (!classes || classes.length === 0) {
3191
+ _fileClassesMap.delete(filepath);
3192
+ return;
3193
+ }
3194
+ _fileClassesMap.set(filepath, new Set(classes));
3195
+ };
3196
+ registerGlobalClasses = (classes) => {
3197
+ for (const cls of classes) _globalClasses.add(cls);
3161
3198
  };
3162
- registerGlobalClasses = (_classes) => {
3199
+ resetRouteClassRegistry = () => {
3200
+ _fileClassesMap.clear();
3201
+ _globalClasses.clear();
3163
3202
  };
3164
3203
  _incrementalEngineInstance = null;
3165
3204
  getIncrementalEngine = () => {
@@ -3350,6 +3389,7 @@ __export(internal_exports, {
3350
3389
  generateStaticStateCss: () => generateStaticStateCss,
3351
3390
  generateStaticStateCssNative: () => generateStaticStateCssNative,
3352
3391
  generateSubComponentTypes: () => generateSubComponentTypes,
3392
+ getAllRegisteredClasses: () => getAllRegisteredClasses,
3353
3393
  getAllRoutes: () => getAllRoutes,
3354
3394
  getBucketEngine: () => getBucketEngine,
3355
3395
  getCacheOptimizationHints: () => getCacheOptimizationHints,
@@ -3452,6 +3492,7 @@ __export(internal_exports, {
3452
3492
  resetIncrementalEngine: () => resetIncrementalEngine,
3453
3493
  resetMemoryStats: () => resetMemoryStats,
3454
3494
  resetResolverPoolStats: () => resetResolverPoolStats,
3495
+ resetRouteClassRegistry: () => resetRouteClassRegistry,
3455
3496
  resolveCascade: () => resolveCascade,
3456
3497
  resolveClassNames: () => resolveClassNames,
3457
3498
  resolveColorCached: () => resolveColorCached,
@@ -3513,8 +3554,8 @@ var init_internal = __esm({
3513
3554
  });
3514
3555
 
3515
3556
  // packages/domain/shared/src/staticStateExtractor.ts
3516
- import fs3 from "fs";
3517
- import path4 from "path";
3557
+ import fs4 from "fs";
3558
+ import path5 from "path";
3518
3559
  function getNative() {
3519
3560
  if (_native) return _native;
3520
3561
  try {
@@ -3544,17 +3585,17 @@ function getNative() {
3544
3585
  function* walkSourceFiles(dir) {
3545
3586
  let entries;
3546
3587
  try {
3547
- entries = fs3.readdirSync(dir, { withFileTypes: true });
3588
+ entries = fs4.readdirSync(dir, { withFileTypes: true });
3548
3589
  } catch {
3549
3590
  return;
3550
3591
  }
3551
3592
  for (const entry of entries) {
3552
- const fullPath = path4.join(dir, entry.name);
3593
+ const fullPath = path5.join(dir, entry.name);
3553
3594
  if (entry.isDirectory()) {
3554
3595
  if (IGNORE_PATTERNS.some((p) => entry.name === p || entry.name.startsWith(p))) continue;
3555
3596
  yield* walkSourceFiles(fullPath);
3556
3597
  } else if (entry.isFile()) {
3557
- const ext = path4.extname(entry.name);
3598
+ const ext = path5.extname(entry.name);
3558
3599
  if (SOURCE_EXTENSIONS.has(ext)) yield fullPath;
3559
3600
  }
3560
3601
  }
@@ -3618,7 +3659,7 @@ function extractStaticStateCss(srcDir, options = {}) {
3618
3659
  allConfigs.push(...configs);
3619
3660
  if (verbose) {
3620
3661
  process.stderr.write(
3621
- `[tw:static-state] ${path4.relative(srcDir, filePath)}: ${configs.length} komponen
3662
+ `[tw:static-state] ${path5.relative(srcDir, filePath)}: ${configs.length} komponen
3622
3663
  `
3623
3664
  );
3624
3665
  }
@@ -3629,7 +3670,7 @@ function extractStaticStateCss(srcDir, options = {}) {
3629
3670
  if (filesScanned >= maxFiles) break;
3630
3671
  let source;
3631
3672
  try {
3632
- source = fs3.readFileSync(filePath, "utf-8");
3673
+ source = fs4.readFileSync(filePath, "utf-8");
3633
3674
  } catch {
3634
3675
  continue;
3635
3676
  }
@@ -3642,7 +3683,7 @@ function extractStaticStateCss(srcDir, options = {}) {
3642
3683
  allConfigs.push(...configs);
3643
3684
  if (verbose) {
3644
3685
  process.stderr.write(
3645
- `[tw:static-state] ${path4.relative(srcDir, filePath)}: ${configs.length} komponen
3686
+ `[tw:static-state] ${path5.relative(srcDir, filePath)}: ${configs.length} komponen
3646
3687
  `
3647
3688
  );
3648
3689
  }
@@ -3736,12 +3777,12 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
3736
3777
  resolvedCss: options.resolvedCss || ""
3737
3778
  // ← ensure always passed
3738
3779
  });
3739
- const twClassesDir = path4.join(path4.dirname(safelistPath), "tw-classes");
3740
- fs3.mkdirSync(twClassesDir, { recursive: true });
3741
- const stateFilePath = path4.join(twClassesDir, TW_STATE_STATIC_FILENAME);
3780
+ const twClassesDir = path5.join(path5.dirname(safelistPath), "tw-classes");
3781
+ fs4.mkdirSync(twClassesDir, { recursive: true });
3782
+ const stateFilePath = path5.join(twClassesDir, TW_STATE_STATIC_FILENAME);
3742
3783
  if (result.rulesGenerated === 0) {
3743
3784
  try {
3744
- fs3.writeFileSync(
3785
+ fs4.writeFileSync(
3745
3786
  stateFilePath,
3746
3787
  "/* tw-state-static.css \u2014 tidak ada state rules yang di-generate */\n",
3747
3788
  "utf-8"
@@ -3751,7 +3792,7 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
3751
3792
  return `[tw:static-state] tidak ada state rules yang di-generate (${result.filesScanned} files di-scan)`;
3752
3793
  }
3753
3794
  try {
3754
- fs3.writeFileSync(stateFilePath, result.generatedCss, "utf-8");
3795
+ fs4.writeFileSync(stateFilePath, result.generatedCss, "utf-8");
3755
3796
  return [
3756
3797
  `[tw:static-state] ${result.rulesGenerated} static state rules di-generate`,
3757
3798
  ` \u2192 ${result.filesScanned} files scanned, ${result.filesWithStates} dengan states`,
@@ -3776,8 +3817,8 @@ var init_staticStateExtractor = __esm({
3776
3817
  });
3777
3818
 
3778
3819
  // packages/domain/shared/src/logger.ts
3779
- import fs4 from "fs";
3780
- import path5 from "path";
3820
+ import fs5 from "fs";
3821
+ import path6 from "path";
3781
3822
  function getEnvLevel() {
3782
3823
  const env = process.env.TWS_LOG_LEVEL?.toLowerCase();
3783
3824
  if (env && env in LEVELS) return env;
@@ -3787,8 +3828,8 @@ function setGlobalLogFile(filePath) {
3787
3828
  _globalLogFile = filePath;
3788
3829
  _logFileInitialized = false;
3789
3830
  try {
3790
- fs4.mkdirSync(path5.dirname(filePath), { recursive: true });
3791
- fs4.writeFileSync(
3831
+ fs5.mkdirSync(path6.dirname(filePath), { recursive: true });
3832
+ fs5.writeFileSync(
3792
3833
  filePath,
3793
3834
  `# tailwind-styled build log \u2014 ${(/* @__PURE__ */ new Date()).toISOString()}
3794
3835
  `,
@@ -3801,7 +3842,7 @@ function setGlobalLogFile(filePath) {
3801
3842
  function writeToFile(line) {
3802
3843
  if (!_globalLogFile || !_logFileInitialized) return;
3803
3844
  try {
3804
- fs4.appendFileSync(_globalLogFile, line);
3845
+ fs5.appendFileSync(_globalLogFile, line);
3805
3846
  } catch {
3806
3847
  }
3807
3848
  }
@@ -3842,8 +3883,8 @@ var init_logger = __esm({
3842
3883
 
3843
3884
  // packages/domain/shared/src/index.ts
3844
3885
  import { createHash } from "crypto";
3845
- import fs5 from "fs";
3846
- import path6 from "path";
3886
+ import fs6 from "fs";
3887
+ import path7 from "path";
3847
3888
  import { fileURLToPath as fileURLToPath2 } from "url";
3848
3889
  import { createRequire as createRequire5 } from "module";
3849
3890
  function createLogger2(namespace) {
@@ -3875,9 +3916,9 @@ function createDebugLogger(namespace, label) {
3875
3916
  }
3876
3917
  };
3877
3918
  }
3878
- function formatIssuePath(path7) {
3879
- if (!path7 || path7.length === 0) return "(root)";
3880
- return path7.map(
3919
+ function formatIssuePath(path8) {
3920
+ if (!path8 || path8.length === 0) return "(root)";
3921
+ return path8.map(
3881
3922
  (segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
3882
3923
  ).join(".");
3883
3924
  }
@@ -3891,9 +3932,9 @@ function loadNativeBinding(options) {
3891
3932
  const { runtimeDir, candidates, isValid } = options;
3892
3933
  const loadErrors = [];
3893
3934
  for (const candidate of candidates) {
3894
- const candidatePath = path6.resolve(runtimeDir, candidate);
3935
+ const candidatePath = path7.resolve(runtimeDir, candidate);
3895
3936
  try {
3896
- if (!fs5.existsSync(candidatePath) && !fs5.existsSync(candidatePath + ".node")) {
3937
+ if (!fs6.existsSync(candidatePath) && !fs6.existsSync(candidatePath + ".node")) {
3897
3938
  continue;
3898
3939
  }
3899
3940
  const mod = requireNativeModule(candidatePath);
@@ -3925,9 +3966,9 @@ function resolveNativeBindingCandidates(options) {
3925
3966
  }
3926
3967
  }
3927
3968
  if (!includeDefaultCandidates) return candidates;
3928
- if (fs5.existsSync(runtimeDir)) {
3969
+ if (fs6.existsSync(runtimeDir)) {
3929
3970
  try {
3930
- for (const entry of fs5.readdirSync(runtimeDir)) {
3971
+ for (const entry of fs6.readdirSync(runtimeDir)) {
3931
3972
  if (entry.endsWith(".node")) candidates.push(entry);
3932
3973
  }
3933
3974
  } catch {
@@ -3936,22 +3977,22 @@ function resolveNativeBindingCandidates(options) {
3936
3977
  const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
3937
3978
  const napiPlatform = process.platform === "linux" && process.arch === "x64" ? "linux-x64-gnu" : process.platform === "linux" && process.arch === "arm64" ? "linux-arm64-gnu" : `${process.platform}-${process.arch}`;
3938
3979
  for (const bin of BINARY_NAMES) {
3939
- candidates.push(path6.resolve(runtimeDir, `${bin}.node`));
3940
- candidates.push(path6.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
3941
- candidates.push(path6.resolve(runtimeDir, "..", "native", `${bin}.node`));
3942
- candidates.push(path6.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
3943
- candidates.push(path6.resolve(process.cwd(), "native", `${bin}.node`));
3944
- candidates.push(path6.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
3945
- candidates.push(path6.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
3946
- candidates.push(path6.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
3947
- candidates.push(path6.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
3980
+ candidates.push(path7.resolve(runtimeDir, `${bin}.node`));
3981
+ candidates.push(path7.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
3982
+ candidates.push(path7.resolve(runtimeDir, "..", "native", `${bin}.node`));
3983
+ candidates.push(path7.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
3984
+ candidates.push(path7.resolve(process.cwd(), "native", `${bin}.node`));
3985
+ candidates.push(path7.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
3986
+ candidates.push(path7.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
3987
+ candidates.push(path7.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
3988
+ candidates.push(path7.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
3948
3989
  }
3949
3990
  return Array.from(new Set(candidates));
3950
3991
  }
3951
3992
  function resolveRuntimeDir(dir, importMetaUrl) {
3952
- if (dir) return path6.resolve(dir);
3993
+ if (dir) return path7.resolve(dir);
3953
3994
  try {
3954
- return path6.dirname(fileURLToPath2(importMetaUrl));
3995
+ return path7.dirname(fileURLToPath2(importMetaUrl));
3955
3996
  } catch {
3956
3997
  return process.cwd();
3957
3998
  }
@@ -4016,8 +4057,8 @@ var init_src2 = __esm({
4016
4057
  /** Buat TwError dari ZodError — dukung shape Zod v3 (`errors`) dan v4 (`issues`). */
4017
4058
  static fromZod(err) {
4018
4059
  const first = err.issues?.[0] ?? err.errors?.[0];
4019
- const path7 = formatIssuePath(first?.path);
4020
- const message = first ? `${path7}: ${first.message}` : "Schema validation failed";
4060
+ const path8 = formatIssuePath(first?.path);
4061
+ const message = first ? `${path8}: ${first.message}` : "Schema validation failed";
4021
4062
  return new _TwError("validation", "SCHEMA_VALIDATION_FAILED", message, err);
4022
4063
  }
4023
4064
  static wrap(source, code, err) {