tailwind-styled-v4 5.1.5 → 5.1.7

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/next.mjs CHANGED
@@ -3458,6 +3458,7 @@ __export(native_bridge_exports, {
3458
3458
  computeCacheStatsNative: () => computeCacheStatsNative,
3459
3459
  extractClassesNative: () => extractClassesNative,
3460
3460
  generateSubComponentTypesNative: () => generateSubComponentTypesNative,
3461
+ getLoadedScannerBindingPath: () => getLoadedScannerBindingPath,
3461
3462
  hasNativeScannerBinding: () => hasNativeScannerBinding,
3462
3463
  hasNativeWatchBinding: () => hasNativeWatchBinding,
3463
3464
  hashContentNative: () => hashContentNative,
@@ -3487,6 +3488,13 @@ function getDirname2() {
3487
3488
  }
3488
3489
  return process.cwd();
3489
3490
  }
3491
+ function getLoadedScannerBindingPath() {
3492
+ try {
3493
+ scannerGetBinding();
3494
+ } catch {
3495
+ }
3496
+ return scannerBridgeLoader.getLoadedPath();
3497
+ }
3490
3498
  function scanWorkspaceNative(root, extensions) {
3491
3499
  return scannerGetBinding().scanWorkspace(root, extensions ?? null);
3492
3500
  }
@@ -3703,7 +3711,8 @@ var init_native_bridge = __esm({
3703
3711
  const _state = {
3704
3712
  binding: void 0,
3705
3713
  loadError: null,
3706
- candidatePaths: []
3714
+ candidatePaths: [],
3715
+ loadedPath: null
3707
3716
  };
3708
3717
  const throwNativeBindingError = () => {
3709
3718
  const lines = [
@@ -3741,7 +3750,7 @@ var init_native_bridge = __esm({
3741
3750
  includeDefaultCandidates: true
3742
3751
  });
3743
3752
  _state.candidatePaths = candidates;
3744
- const { binding, loadErrors } = loadNativeBinding({
3753
+ const { binding, loadedPath, loadErrors } = loadNativeBinding({
3745
3754
  runtimeDir,
3746
3755
  candidates,
3747
3756
  isValid: isValidScannerBinding,
@@ -3750,6 +3759,7 @@ var init_native_bridge = __esm({
3750
3759
  if (binding) {
3751
3760
  log2(`scanner native binding loaded successfully`);
3752
3761
  _state.binding = binding;
3762
+ _state.loadedPath = loadedPath ?? null;
3753
3763
  return _state.binding;
3754
3764
  }
3755
3765
  if (loadErrors.length > 0) {
@@ -3761,10 +3771,12 @@ var init_native_bridge = __esm({
3761
3771
  return {
3762
3772
  get: scannerGetBinding2,
3763
3773
  scannerGetBinding: scannerGetBinding2,
3774
+ getLoadedPath: () => _state.loadedPath,
3764
3775
  reset: () => {
3765
3776
  _state.binding = void 0;
3766
3777
  _state.loadError = null;
3767
3778
  _state.candidatePaths = [];
3779
+ _state.loadedPath = null;
3768
3780
  }
3769
3781
  };
3770
3782
  };
@@ -3830,10 +3842,44 @@ function defaultCachePath(rootDir, cacheDir) {
3830
3842
  const dir = cacheDir ? path8.resolve(rootDir, cacheDir) : path8.join(process.cwd(), ".cache", "tailwind-styled");
3831
3843
  return path8.join(dir, "scanner-cache.json");
3832
3844
  }
3845
+ function metaPathFor(cachePath) {
3846
+ return cachePath.replace(/\.json$/, ".meta.json");
3847
+ }
3848
+ var _cachedFingerprint;
3849
+ function getBinaryFingerprint() {
3850
+ if (_cachedFingerprint !== void 0) return _cachedFingerprint;
3851
+ try {
3852
+ const loadedPath = getLoadedScannerBindingPath();
3853
+ if (!loadedPath) {
3854
+ _cachedFingerprint = null;
3855
+ return null;
3856
+ }
3857
+ const stat = fs6.statSync(loadedPath);
3858
+ _cachedFingerprint = `${stat.mtimeMs}:${stat.size}`;
3859
+ } catch {
3860
+ _cachedFingerprint = null;
3861
+ }
3862
+ return _cachedFingerprint;
3863
+ }
3833
3864
  var STALE_THRESHOLD_MS = 7 * 24 * 60 * 60 * 1e3;
3834
3865
  function readCache(rootDir, cacheDir) {
3835
3866
  const cachePath = defaultCachePath(rootDir, cacheDir);
3836
3867
  fs6.mkdirSync(path8.dirname(cachePath), { recursive: true });
3868
+ const currentFingerprint = getBinaryFingerprint();
3869
+ if (currentFingerprint !== null) {
3870
+ const metaPath = metaPathFor(cachePath);
3871
+ let storedFingerprint = null;
3872
+ try {
3873
+ storedFingerprint = JSON.parse(fs6.readFileSync(metaPath, "utf8")).binaryFingerprint ?? null;
3874
+ } catch {
3875
+ }
3876
+ if (storedFingerprint !== currentFingerprint) {
3877
+ console.warn(
3878
+ "[scanner] cache invalidated: native binary berubah sejak cache terakhir ditulis"
3879
+ );
3880
+ return [];
3881
+ }
3882
+ }
3837
3883
  const result = cacheReadNative(cachePath);
3838
3884
  if (!result) return [];
3839
3885
  return result.entries.map((e) => ({
@@ -3855,6 +3901,17 @@ function writeCache(rootDir, entries, cacheDir) {
3855
3901
  "Native cacheWrite failed. Run 'npm run build:rust' to rebuild native bindings."
3856
3902
  );
3857
3903
  }
3904
+ const currentFingerprint = getBinaryFingerprint();
3905
+ if (currentFingerprint !== null) {
3906
+ try {
3907
+ fs6.writeFileSync(
3908
+ metaPathFor(cachePath),
3909
+ JSON.stringify({ binaryFingerprint: currentFingerprint }),
3910
+ "utf8"
3911
+ );
3912
+ } catch {
3913
+ }
3914
+ }
3858
3915
  }
3859
3916
  function filePriority(mtimeMs, size, cached, nowMs = Date.now()) {
3860
3917
  return cachePriorityNative(