@styleframe/loader 3.0.0 → 3.0.1

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/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Jiti } from 'jiti';
2
+ import { JitiOptions } from 'jiti';
2
3
  import { Styleframe } from '@styleframe/core';
3
4
  import { TranspileOptions } from '@styleframe/transpiler';
4
5
 
@@ -10,6 +11,21 @@ export declare type BuildOptions = {
10
11
  transpiler?: TranspileOptions;
11
12
  };
12
13
 
14
+ /**
15
+ * Clears the entire jiti module cache.
16
+ * Useful for full rebuilds or when dependency graph is unclear.
17
+ */
18
+ export declare function clearAllJitiCache(jiti: Jiti): void;
19
+
20
+ /**
21
+ * Clears specific modules from the jiti cache.
22
+ * Call this when a file changes to ensure it's reloaded on next import.
23
+ *
24
+ * @param jiti - The jiti instance to clear cache from
25
+ * @param filePaths - Absolute paths of files to invalidate
26
+ */
27
+ export declare function clearJitiCache(jiti: Jiti, ...filePaths: string[]): void;
28
+
13
29
  /**
14
30
  * Create a jiti instance with standard configuration.
15
31
  *
@@ -18,6 +34,25 @@ export declare type BuildOptions = {
18
34
  */
19
35
  export declare function createLoader(basePath: string, alias?: Record<string, string>): Jiti;
20
36
 
37
+ /**
38
+ * Creates a shared jiti instance with module caching enabled.
39
+ * Use this when loading multiple styleframe config files to avoid
40
+ * re-compiling shared dependencies.
41
+ *
42
+ * @example
43
+ * ```ts
44
+ * const jiti = createSharedJiti();
45
+ *
46
+ * // Both loads will share cached modules
47
+ * const config1 = await loadConfigurationFromPath('./button.styleframe.ts', { jiti });
48
+ * const config2 = await loadConfigurationFromPath('./badge.styleframe.ts', { jiti });
49
+ *
50
+ * // Invalidate cache when files change (for HMR)
51
+ * clearJitiCache(jiti, './theme/useTokens.ts');
52
+ * ```
53
+ */
54
+ export declare function createSharedJiti(options?: JitiOptions): Jiti;
55
+
21
56
  export declare function directoryExists(path: string): Promise<boolean>;
22
57
 
23
58
  /**
@@ -30,6 +65,10 @@ export declare interface ExportInfo {
30
65
  type: "recipe" | "selector";
31
66
  }
32
67
 
68
+ export { Jiti }
69
+
70
+ export { JitiOptions }
71
+
33
72
  export declare function loadConfiguration({ cwd, entry, }?: {
34
73
  cwd?: string;
35
74
  entry?: string;
@@ -71,6 +110,8 @@ export declare interface LoadModuleOptions {
71
110
  alias?: Record<string, string>;
72
111
  /** Whether to validate that default export is a Styleframe instance (default: true) */
73
112
  validateInstance?: boolean;
113
+ /** Optional shared jiti instance to reuse across multiple loads */
114
+ jiti?: Jiti;
74
115
  }
75
116
 
76
117
  /**