@styleframe/loader 2.4.1 → 3.0.0
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 +12 -0
- package/dist/index.cjs +696 -501
- package/dist/index.d.ts +75 -0
- package/dist/index.js +695 -500
- package/package.json +7 -7
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Jiti } from 'jiti';
|
|
1
2
|
import { Styleframe } from '@styleframe/core';
|
|
2
3
|
import { TranspileOptions } from '@styleframe/transpiler';
|
|
3
4
|
|
|
@@ -9,13 +10,87 @@ export declare type BuildOptions = {
|
|
|
9
10
|
transpiler?: TranspileOptions;
|
|
10
11
|
};
|
|
11
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Create a jiti instance with standard configuration.
|
|
15
|
+
*
|
|
16
|
+
* @param basePath - Directory to resolve imports from
|
|
17
|
+
* @param alias - Optional alias configuration for virtual modules
|
|
18
|
+
*/
|
|
19
|
+
export declare function createLoader(basePath: string, alias?: Record<string, string>): Jiti;
|
|
20
|
+
|
|
12
21
|
export declare function directoryExists(path: string): Promise<boolean>;
|
|
13
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Export information for a recipe or selector
|
|
25
|
+
*/
|
|
26
|
+
export declare interface ExportInfo {
|
|
27
|
+
/** Export name (e.g., "buttonRecipe") */
|
|
28
|
+
name: string;
|
|
29
|
+
/** Type of export */
|
|
30
|
+
type: "recipe" | "selector";
|
|
31
|
+
}
|
|
32
|
+
|
|
14
33
|
export declare function loadConfiguration({ cwd, entry, }?: {
|
|
15
34
|
cwd?: string;
|
|
16
35
|
entry?: string;
|
|
17
36
|
}): Promise<Styleframe>;
|
|
18
37
|
|
|
38
|
+
/**
|
|
39
|
+
* Load a module without validating the default export.
|
|
40
|
+
* Useful for extension files that may not have a default export.
|
|
41
|
+
*
|
|
42
|
+
* @param filePath - Absolute path to the module file
|
|
43
|
+
* @param options - Loading options (without validateInstance)
|
|
44
|
+
*/
|
|
45
|
+
export declare function loadExtensionModule(filePath: string, options?: Omit<LoadModuleOptions, "validateInstance">): Promise<LoadExtensionModuleResult>;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Result of loading an extension module (no instance validation)
|
|
49
|
+
*/
|
|
50
|
+
export declare interface LoadExtensionModuleResult {
|
|
51
|
+
/** The raw module exports */
|
|
52
|
+
module: Record<string, unknown>;
|
|
53
|
+
/** Tracked exports (recipes and selectors with _exportName set) */
|
|
54
|
+
exports: Map<string, ExportInfo>;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Load a TypeScript/JavaScript module using jiti.
|
|
59
|
+
* Tracks _exportName on recipes/selectors and validates the default export.
|
|
60
|
+
*
|
|
61
|
+
* @param filePath - Absolute path to the module file
|
|
62
|
+
* @param options - Loading options
|
|
63
|
+
*/
|
|
64
|
+
export declare function loadModule(filePath: string, options?: LoadModuleOptions): Promise<LoadModuleResult>;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Options for loading a module with jiti
|
|
68
|
+
*/
|
|
69
|
+
export declare interface LoadModuleOptions {
|
|
70
|
+
/** jiti alias configuration (e.g., for virtual modules) */
|
|
71
|
+
alias?: Record<string, string>;
|
|
72
|
+
/** Whether to validate that default export is a Styleframe instance (default: true) */
|
|
73
|
+
validateInstance?: boolean;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Result of loading a module
|
|
78
|
+
*/
|
|
79
|
+
export declare interface LoadModuleResult {
|
|
80
|
+
/** The raw module exports */
|
|
81
|
+
module: Record<string, unknown>;
|
|
82
|
+
/** The default export (Styleframe instance) */
|
|
83
|
+
instance: Styleframe;
|
|
84
|
+
/** Tracked exports (recipes and selectors with _exportName set) */
|
|
85
|
+
exports: Map<string, ExportInfo>;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Track _exportName on recipes and selectors in a module.
|
|
90
|
+
* Returns a map of export info for recipes and selectors.
|
|
91
|
+
*/
|
|
92
|
+
export declare function trackExports(module: Record<string, unknown>): Map<string, ExportInfo>;
|
|
93
|
+
|
|
19
94
|
export declare function watchConfiguration({ cwd, entry, onUpdate, onError, }?: {
|
|
20
95
|
cwd?: string;
|
|
21
96
|
entry?: string;
|