@styleframe/loader 3.0.2 → 3.0.3
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 +10 -0
- package/dist/index.d.cts +146 -0
- package/dist/index.d.mts +146 -0
- package/dist/index.d.ts +146 -7
- package/package.json +15 -9
- package/dist/build.d.ts +0 -9
- package/dist/build.d.ts.map +0 -1
- package/dist/config.d.ts +0 -16
- package/dist/config.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/jiti.d.ts +0 -34
- package/dist/jiti.d.ts.map +0 -1
- package/dist/module.d.ts +0 -30
- package/dist/module.d.ts.map +0 -1
- package/dist/types.d.ts +0 -42
- package/dist/types.d.ts.map +0 -1
- package/dist/utils.d.ts +0 -2
- package/dist/utils.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @styleframe/loader
|
|
2
2
|
|
|
3
|
+
## 3.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#238](https://github.com/styleframe-dev/styleframe/pull/238) [`4ace91d`](https://github.com/styleframe-dev/styleframe/commit/4ace91d5e15020c29d585848ee66f6250946b2d1) Thanks [@alexgrozav](https://github.com/alexgrozav)! - Bundle type declarations on build. The shared Vite config now enables `vite-plugin-dts`'s `bundleTypes`, so each package ships a single rolled-up `.d.ts` per entry (via `@microsoft/api-extractor`) instead of a tree of per-file declarations. `@microsoft/api-extractor` is now a peer dependency of `@styleframe/config-vite`.
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`4ace91d`](https://github.com/styleframe-dev/styleframe/commit/4ace91d5e15020c29d585848ee66f6250946b2d1)]:
|
|
10
|
+
- @styleframe/core@3.6.1
|
|
11
|
+
- @styleframe/transpiler@3.4.1
|
|
12
|
+
|
|
3
13
|
## 3.0.2
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { Jiti } from 'jiti';
|
|
2
|
+
import { JitiOptions } from 'jiti';
|
|
3
|
+
import { Styleframe } from '@styleframe/core';
|
|
4
|
+
import { TranspileOptions } from '@styleframe/transpiler';
|
|
5
|
+
|
|
6
|
+
export declare function build(instance: Styleframe, { clean, outputDir, transpiler }?: BuildOptions): Promise<void>;
|
|
7
|
+
|
|
8
|
+
export declare type BuildOptions = {
|
|
9
|
+
clean?: boolean;
|
|
10
|
+
outputDir?: string;
|
|
11
|
+
transpiler?: TranspileOptions;
|
|
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
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Create a jiti instance with standard configuration.
|
|
31
|
+
*
|
|
32
|
+
* @param basePath - Directory to resolve imports from
|
|
33
|
+
* @param alias - Optional alias configuration for virtual modules
|
|
34
|
+
*/
|
|
35
|
+
export declare function createLoader(basePath: string, alias?: Record<string, string>): Jiti;
|
|
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
|
+
|
|
56
|
+
export declare function directoryExists(path: string): Promise<boolean>;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Export information for a recipe or selector
|
|
60
|
+
*/
|
|
61
|
+
export declare interface ExportInfo {
|
|
62
|
+
/** Export name (e.g., "buttonRecipe") */
|
|
63
|
+
name: string;
|
|
64
|
+
/** Type of export */
|
|
65
|
+
type: "recipe" | "selector";
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export { Jiti }
|
|
69
|
+
|
|
70
|
+
export { JitiOptions }
|
|
71
|
+
|
|
72
|
+
export declare function loadConfiguration({ cwd, entry, }?: {
|
|
73
|
+
cwd?: string;
|
|
74
|
+
entry?: string;
|
|
75
|
+
}): Promise<Styleframe>;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Load a module without validating the default export.
|
|
79
|
+
* Useful for extension files that may not have a default export.
|
|
80
|
+
*
|
|
81
|
+
* @param filePath - Absolute path to the module file
|
|
82
|
+
* @param options - Loading options (without validateInstance)
|
|
83
|
+
*/
|
|
84
|
+
export declare function loadExtensionModule(filePath: string, options?: Omit<LoadModuleOptions, "validateInstance">): Promise<LoadExtensionModuleResult>;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Result of loading an extension module (no instance validation)
|
|
88
|
+
*/
|
|
89
|
+
export declare interface LoadExtensionModuleResult {
|
|
90
|
+
/** The raw module exports */
|
|
91
|
+
module: Record<string, unknown>;
|
|
92
|
+
/** Tracked exports (recipes and selectors with _exportName set) */
|
|
93
|
+
exports: Map<string, ExportInfo>;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Load a TypeScript/JavaScript module using jiti.
|
|
98
|
+
* Tracks _exportName on recipes/selectors and validates the default export.
|
|
99
|
+
*
|
|
100
|
+
* @param filePath - Absolute path to the module file
|
|
101
|
+
* @param options - Loading options
|
|
102
|
+
*/
|
|
103
|
+
export declare function loadModule(filePath: string, options?: LoadModuleOptions): Promise<LoadModuleResult>;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Options for loading a module with jiti
|
|
107
|
+
*/
|
|
108
|
+
export declare interface LoadModuleOptions {
|
|
109
|
+
/** jiti alias configuration (e.g., for virtual modules) */
|
|
110
|
+
alias?: Record<string, string>;
|
|
111
|
+
/** Whether to validate that default export is a Styleframe instance (default: true) */
|
|
112
|
+
validateInstance?: boolean;
|
|
113
|
+
/** Optional shared jiti instance to reuse across multiple loads */
|
|
114
|
+
jiti?: Jiti;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Result of loading a module
|
|
119
|
+
*/
|
|
120
|
+
export declare interface LoadModuleResult {
|
|
121
|
+
/** The raw module exports */
|
|
122
|
+
module: Record<string, unknown>;
|
|
123
|
+
/** The default export (Styleframe instance) */
|
|
124
|
+
instance: Styleframe;
|
|
125
|
+
/** Tracked exports (recipes and selectors with _exportName set) */
|
|
126
|
+
exports: Map<string, ExportInfo>;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Track _exportName on recipes and selectors in a module.
|
|
131
|
+
* Returns a map of export info for recipes and selectors.
|
|
132
|
+
*/
|
|
133
|
+
export declare function trackExports(module: Record<string, unknown>): Map<string, ExportInfo>;
|
|
134
|
+
|
|
135
|
+
export declare function watchConfiguration({ cwd, entry, onUpdate, onError, }?: {
|
|
136
|
+
cwd?: string;
|
|
137
|
+
entry?: string;
|
|
138
|
+
onUpdate?: (config: Styleframe) => void;
|
|
139
|
+
onError?: (error: Error) => void;
|
|
140
|
+
}): Promise<{
|
|
141
|
+
config: Styleframe;
|
|
142
|
+
configFile: string;
|
|
143
|
+
unwatch: () => Promise<void>;
|
|
144
|
+
}>;
|
|
145
|
+
|
|
146
|
+
export { }
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { Jiti } from 'jiti';
|
|
2
|
+
import { JitiOptions } from 'jiti';
|
|
3
|
+
import { Styleframe } from '@styleframe/core';
|
|
4
|
+
import { TranspileOptions } from '@styleframe/transpiler';
|
|
5
|
+
|
|
6
|
+
export declare function build(instance: Styleframe, { clean, outputDir, transpiler }?: BuildOptions): Promise<void>;
|
|
7
|
+
|
|
8
|
+
export declare type BuildOptions = {
|
|
9
|
+
clean?: boolean;
|
|
10
|
+
outputDir?: string;
|
|
11
|
+
transpiler?: TranspileOptions;
|
|
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
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Create a jiti instance with standard configuration.
|
|
31
|
+
*
|
|
32
|
+
* @param basePath - Directory to resolve imports from
|
|
33
|
+
* @param alias - Optional alias configuration for virtual modules
|
|
34
|
+
*/
|
|
35
|
+
export declare function createLoader(basePath: string, alias?: Record<string, string>): Jiti;
|
|
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
|
+
|
|
56
|
+
export declare function directoryExists(path: string): Promise<boolean>;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Export information for a recipe or selector
|
|
60
|
+
*/
|
|
61
|
+
export declare interface ExportInfo {
|
|
62
|
+
/** Export name (e.g., "buttonRecipe") */
|
|
63
|
+
name: string;
|
|
64
|
+
/** Type of export */
|
|
65
|
+
type: "recipe" | "selector";
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export { Jiti }
|
|
69
|
+
|
|
70
|
+
export { JitiOptions }
|
|
71
|
+
|
|
72
|
+
export declare function loadConfiguration({ cwd, entry, }?: {
|
|
73
|
+
cwd?: string;
|
|
74
|
+
entry?: string;
|
|
75
|
+
}): Promise<Styleframe>;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Load a module without validating the default export.
|
|
79
|
+
* Useful for extension files that may not have a default export.
|
|
80
|
+
*
|
|
81
|
+
* @param filePath - Absolute path to the module file
|
|
82
|
+
* @param options - Loading options (without validateInstance)
|
|
83
|
+
*/
|
|
84
|
+
export declare function loadExtensionModule(filePath: string, options?: Omit<LoadModuleOptions, "validateInstance">): Promise<LoadExtensionModuleResult>;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Result of loading an extension module (no instance validation)
|
|
88
|
+
*/
|
|
89
|
+
export declare interface LoadExtensionModuleResult {
|
|
90
|
+
/** The raw module exports */
|
|
91
|
+
module: Record<string, unknown>;
|
|
92
|
+
/** Tracked exports (recipes and selectors with _exportName set) */
|
|
93
|
+
exports: Map<string, ExportInfo>;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Load a TypeScript/JavaScript module using jiti.
|
|
98
|
+
* Tracks _exportName on recipes/selectors and validates the default export.
|
|
99
|
+
*
|
|
100
|
+
* @param filePath - Absolute path to the module file
|
|
101
|
+
* @param options - Loading options
|
|
102
|
+
*/
|
|
103
|
+
export declare function loadModule(filePath: string, options?: LoadModuleOptions): Promise<LoadModuleResult>;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Options for loading a module with jiti
|
|
107
|
+
*/
|
|
108
|
+
export declare interface LoadModuleOptions {
|
|
109
|
+
/** jiti alias configuration (e.g., for virtual modules) */
|
|
110
|
+
alias?: Record<string, string>;
|
|
111
|
+
/** Whether to validate that default export is a Styleframe instance (default: true) */
|
|
112
|
+
validateInstance?: boolean;
|
|
113
|
+
/** Optional shared jiti instance to reuse across multiple loads */
|
|
114
|
+
jiti?: Jiti;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Result of loading a module
|
|
119
|
+
*/
|
|
120
|
+
export declare interface LoadModuleResult {
|
|
121
|
+
/** The raw module exports */
|
|
122
|
+
module: Record<string, unknown>;
|
|
123
|
+
/** The default export (Styleframe instance) */
|
|
124
|
+
instance: Styleframe;
|
|
125
|
+
/** Tracked exports (recipes and selectors with _exportName set) */
|
|
126
|
+
exports: Map<string, ExportInfo>;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Track _exportName on recipes and selectors in a module.
|
|
131
|
+
* Returns a map of export info for recipes and selectors.
|
|
132
|
+
*/
|
|
133
|
+
export declare function trackExports(module: Record<string, unknown>): Map<string, ExportInfo>;
|
|
134
|
+
|
|
135
|
+
export declare function watchConfiguration({ cwd, entry, onUpdate, onError, }?: {
|
|
136
|
+
cwd?: string;
|
|
137
|
+
entry?: string;
|
|
138
|
+
onUpdate?: (config: Styleframe) => void;
|
|
139
|
+
onError?: (error: Error) => void;
|
|
140
|
+
}): Promise<{
|
|
141
|
+
config: Styleframe;
|
|
142
|
+
configFile: string;
|
|
143
|
+
unwatch: () => Promise<void>;
|
|
144
|
+
}>;
|
|
145
|
+
|
|
146
|
+
export { }
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,146 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
|
|
1
|
+
import { Jiti } from 'jiti';
|
|
2
|
+
import { JitiOptions } from 'jiti';
|
|
3
|
+
import { Styleframe } from '@styleframe/core';
|
|
4
|
+
import { TranspileOptions } from '@styleframe/transpiler';
|
|
5
|
+
|
|
6
|
+
export declare function build(instance: Styleframe, { clean, outputDir, transpiler }?: BuildOptions): Promise<void>;
|
|
7
|
+
|
|
8
|
+
export declare type BuildOptions = {
|
|
9
|
+
clean?: boolean;
|
|
10
|
+
outputDir?: string;
|
|
11
|
+
transpiler?: TranspileOptions;
|
|
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
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Create a jiti instance with standard configuration.
|
|
31
|
+
*
|
|
32
|
+
* @param basePath - Directory to resolve imports from
|
|
33
|
+
* @param alias - Optional alias configuration for virtual modules
|
|
34
|
+
*/
|
|
35
|
+
export declare function createLoader(basePath: string, alias?: Record<string, string>): Jiti;
|
|
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
|
+
|
|
56
|
+
export declare function directoryExists(path: string): Promise<boolean>;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Export information for a recipe or selector
|
|
60
|
+
*/
|
|
61
|
+
export declare interface ExportInfo {
|
|
62
|
+
/** Export name (e.g., "buttonRecipe") */
|
|
63
|
+
name: string;
|
|
64
|
+
/** Type of export */
|
|
65
|
+
type: "recipe" | "selector";
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export { Jiti }
|
|
69
|
+
|
|
70
|
+
export { JitiOptions }
|
|
71
|
+
|
|
72
|
+
export declare function loadConfiguration({ cwd, entry, }?: {
|
|
73
|
+
cwd?: string;
|
|
74
|
+
entry?: string;
|
|
75
|
+
}): Promise<Styleframe>;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Load a module without validating the default export.
|
|
79
|
+
* Useful for extension files that may not have a default export.
|
|
80
|
+
*
|
|
81
|
+
* @param filePath - Absolute path to the module file
|
|
82
|
+
* @param options - Loading options (without validateInstance)
|
|
83
|
+
*/
|
|
84
|
+
export declare function loadExtensionModule(filePath: string, options?: Omit<LoadModuleOptions, "validateInstance">): Promise<LoadExtensionModuleResult>;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Result of loading an extension module (no instance validation)
|
|
88
|
+
*/
|
|
89
|
+
export declare interface LoadExtensionModuleResult {
|
|
90
|
+
/** The raw module exports */
|
|
91
|
+
module: Record<string, unknown>;
|
|
92
|
+
/** Tracked exports (recipes and selectors with _exportName set) */
|
|
93
|
+
exports: Map<string, ExportInfo>;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Load a TypeScript/JavaScript module using jiti.
|
|
98
|
+
* Tracks _exportName on recipes/selectors and validates the default export.
|
|
99
|
+
*
|
|
100
|
+
* @param filePath - Absolute path to the module file
|
|
101
|
+
* @param options - Loading options
|
|
102
|
+
*/
|
|
103
|
+
export declare function loadModule(filePath: string, options?: LoadModuleOptions): Promise<LoadModuleResult>;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Options for loading a module with jiti
|
|
107
|
+
*/
|
|
108
|
+
export declare interface LoadModuleOptions {
|
|
109
|
+
/** jiti alias configuration (e.g., for virtual modules) */
|
|
110
|
+
alias?: Record<string, string>;
|
|
111
|
+
/** Whether to validate that default export is a Styleframe instance (default: true) */
|
|
112
|
+
validateInstance?: boolean;
|
|
113
|
+
/** Optional shared jiti instance to reuse across multiple loads */
|
|
114
|
+
jiti?: Jiti;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Result of loading a module
|
|
119
|
+
*/
|
|
120
|
+
export declare interface LoadModuleResult {
|
|
121
|
+
/** The raw module exports */
|
|
122
|
+
module: Record<string, unknown>;
|
|
123
|
+
/** The default export (Styleframe instance) */
|
|
124
|
+
instance: Styleframe;
|
|
125
|
+
/** Tracked exports (recipes and selectors with _exportName set) */
|
|
126
|
+
exports: Map<string, ExportInfo>;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Track _exportName on recipes and selectors in a module.
|
|
131
|
+
* Returns a map of export info for recipes and selectors.
|
|
132
|
+
*/
|
|
133
|
+
export declare function trackExports(module: Record<string, unknown>): Map<string, ExportInfo>;
|
|
134
|
+
|
|
135
|
+
export declare function watchConfiguration({ cwd, entry, onUpdate, onError, }?: {
|
|
136
|
+
cwd?: string;
|
|
137
|
+
entry?: string;
|
|
138
|
+
onUpdate?: (config: Styleframe) => void;
|
|
139
|
+
onError?: (error: Error) => void;
|
|
140
|
+
}): Promise<{
|
|
141
|
+
config: Styleframe;
|
|
142
|
+
configFile: string;
|
|
143
|
+
unwatch: () => Promise<void>;
|
|
144
|
+
}>;
|
|
145
|
+
|
|
146
|
+
export { }
|
package/package.json
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@styleframe/loader",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"module": "./dist/index.js",
|
|
7
7
|
"main": "./dist/index.cjs",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./dist/index.d.mts",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"require": {
|
|
15
|
+
"types": "./dist/index.d.cts",
|
|
16
|
+
"default": "./dist/index.cjs"
|
|
17
|
+
}
|
|
13
18
|
}
|
|
14
19
|
},
|
|
15
20
|
"files": [
|
|
@@ -23,16 +28,17 @@
|
|
|
23
28
|
"jiti": "^2.4.2"
|
|
24
29
|
},
|
|
25
30
|
"peerDependencies": {
|
|
26
|
-
"@styleframe/core": "^3.6.
|
|
31
|
+
"@styleframe/core": "^3.6.1",
|
|
27
32
|
"@styleframe/license": "^2.0.2",
|
|
28
|
-
"@styleframe/transpiler": "^3.4.
|
|
33
|
+
"@styleframe/transpiler": "^3.4.1"
|
|
29
34
|
},
|
|
30
35
|
"devDependencies": {
|
|
36
|
+
"@microsoft/api-extractor": "^7.58.7",
|
|
31
37
|
"@styleframe/config-typescript": "^3.0.0",
|
|
32
|
-
"@styleframe/config-vite": "^3.0
|
|
33
|
-
"@styleframe/core": "^3.6.
|
|
38
|
+
"@styleframe/config-vite": "^3.1.0",
|
|
39
|
+
"@styleframe/core": "^3.6.1",
|
|
34
40
|
"@styleframe/license": "^2.0.2",
|
|
35
|
-
"@styleframe/transpiler": "^3.4.
|
|
41
|
+
"@styleframe/transpiler": "^3.4.1",
|
|
36
42
|
"@vitest/coverage-v8": "^4.1.7",
|
|
37
43
|
"tsx": "^4.20.6",
|
|
38
44
|
"typescript": "^5.8.3",
|
package/dist/build.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Styleframe } from '@styleframe/core';
|
|
2
|
-
import { TranspileOptions } from '@styleframe/transpiler';
|
|
3
|
-
export type BuildOptions = {
|
|
4
|
-
clean?: boolean;
|
|
5
|
-
outputDir?: string;
|
|
6
|
-
transpiler?: TranspileOptions;
|
|
7
|
-
};
|
|
8
|
-
export declare function build(instance: Styleframe, { clean, outputDir, transpiler }?: BuildOptions): Promise<void>;
|
|
9
|
-
//# sourceMappingURL=build.d.ts.map
|
package/dist/build.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAQ/D,MAAM,MAAM,YAAY,GAAG;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC9B,CAAC;AAEF,wBAAsB,KAAK,CAC1B,QAAQ,EAAE,UAAU,EACpB,EAAE,KAAY,EAAE,SAA0B,EAAE,UAAU,EAAE,GAAE,YAAiB,iBA0B3E"}
|
package/dist/config.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Styleframe } from '@styleframe/core';
|
|
2
|
-
export declare function loadConfiguration({ cwd, entry, }?: {
|
|
3
|
-
cwd?: string;
|
|
4
|
-
entry?: string;
|
|
5
|
-
}): Promise<Styleframe>;
|
|
6
|
-
export declare function watchConfiguration({ cwd, entry, onUpdate, onError, }?: {
|
|
7
|
-
cwd?: string;
|
|
8
|
-
entry?: string;
|
|
9
|
-
onUpdate?: (config: Styleframe) => void;
|
|
10
|
-
onError?: (error: Error) => void;
|
|
11
|
-
}): Promise<{
|
|
12
|
-
config: Styleframe;
|
|
13
|
-
configFile: string;
|
|
14
|
-
unwatch: () => Promise<void>;
|
|
15
|
-
}>;
|
|
16
|
-
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AA8BnD,wBAAsB,iBAAiB,CAAC,EACvC,GAAmB,EACnB,KAA2B,GAC3B,GAAE;IACF,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CACV,uBAUL;AAED,wBAAsB,kBAAkB,CAAC,EACxC,GAAmB,EACnB,KAA2B,EAC3B,QAAQ,EACR,OAAO,GACP,GAAE;IACF,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IACxC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAC5B;;;;GA0BL"}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
package/dist/jiti.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Jiti, JitiOptions } from 'jiti';
|
|
2
|
-
export type { Jiti, JitiOptions };
|
|
3
|
-
/**
|
|
4
|
-
* Creates a shared jiti instance with module caching enabled.
|
|
5
|
-
* Use this when loading multiple styleframe config files to avoid
|
|
6
|
-
* re-compiling shared dependencies.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* const jiti = createSharedJiti();
|
|
11
|
-
*
|
|
12
|
-
* // Both loads will share cached modules
|
|
13
|
-
* const config1 = await loadConfigurationFromPath('./button.styleframe.ts', { jiti });
|
|
14
|
-
* const config2 = await loadConfigurationFromPath('./badge.styleframe.ts', { jiti });
|
|
15
|
-
*
|
|
16
|
-
* // Invalidate cache when files change (for HMR)
|
|
17
|
-
* clearJitiCache(jiti, './theme/useTokens.ts');
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
export declare function createSharedJiti(options?: JitiOptions): Jiti;
|
|
21
|
-
/**
|
|
22
|
-
* Clears specific modules from the jiti cache.
|
|
23
|
-
* Call this when a file changes to ensure it's reloaded on next import.
|
|
24
|
-
*
|
|
25
|
-
* @param jiti - The jiti instance to clear cache from
|
|
26
|
-
* @param filePaths - Absolute paths of files to invalidate
|
|
27
|
-
*/
|
|
28
|
-
export declare function clearJitiCache(jiti: Jiti, ...filePaths: string[]): void;
|
|
29
|
-
/**
|
|
30
|
-
* Clears the entire jiti module cache.
|
|
31
|
-
* Useful for full rebuilds or when dependency graph is unclear.
|
|
32
|
-
*/
|
|
33
|
-
export declare function clearAllJitiCache(jiti: Jiti): void;
|
|
34
|
-
//# sourceMappingURL=jiti.d.ts.map
|
package/dist/jiti.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jiti.d.ts","sourceRoot":"","sources":["../src/jiti.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAG9C,YAAY,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;AAElC;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,WAAgB,GAAG,IAAI,CAMhE;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,SAAS,EAAE,MAAM,EAAE,GAAG,IAAI,CAqBvE;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAWlD"}
|
package/dist/module.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { ExportInfo, LoadExtensionModuleResult, LoadModuleOptions, LoadModuleResult } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Create a jiti instance with standard configuration.
|
|
4
|
-
*
|
|
5
|
-
* @param basePath - Directory to resolve imports from
|
|
6
|
-
* @param alias - Optional alias configuration for virtual modules
|
|
7
|
-
*/
|
|
8
|
-
export declare function createLoader(basePath: string, alias?: Record<string, string>): import('jiti').Jiti;
|
|
9
|
-
/**
|
|
10
|
-
* Track _exportName on recipes and selectors in a module.
|
|
11
|
-
* Returns a map of export info for recipes and selectors.
|
|
12
|
-
*/
|
|
13
|
-
export declare function trackExports(module: Record<string, unknown>): Map<string, ExportInfo>;
|
|
14
|
-
/**
|
|
15
|
-
* Load a TypeScript/JavaScript module using jiti.
|
|
16
|
-
* Tracks _exportName on recipes/selectors and validates the default export.
|
|
17
|
-
*
|
|
18
|
-
* @param filePath - Absolute path to the module file
|
|
19
|
-
* @param options - Loading options
|
|
20
|
-
*/
|
|
21
|
-
export declare function loadModule(filePath: string, options?: LoadModuleOptions): Promise<LoadModuleResult>;
|
|
22
|
-
/**
|
|
23
|
-
* Load a module without validating the default export.
|
|
24
|
-
* Useful for extension files that may not have a default export.
|
|
25
|
-
*
|
|
26
|
-
* @param filePath - Absolute path to the module file
|
|
27
|
-
* @param options - Loading options (without validateInstance)
|
|
28
|
-
*/
|
|
29
|
-
export declare function loadExtensionModule(filePath: string, options?: Omit<LoadModuleOptions, "validateInstance">): Promise<LoadExtensionModuleResult>;
|
|
30
|
-
//# sourceMappingURL=module.d.ts.map
|
package/dist/module.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACX,UAAU,EACV,yBAAyB,EACzB,iBAAiB,EACjB,gBAAgB,EAChB,MAAM,SAAS,CAAC;AAEjB;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,uBAM5E;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAC3B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAsBzB;AAED;;;;;;GAMG;AACH,wBAAsB,UAAU,CAC/B,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,iBAAsB,GAC7B,OAAO,CAAC,gBAAgB,CAAC,CAyB3B;AAED;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CACxC,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,IAAI,CAAC,iBAAiB,EAAE,kBAAkB,CAAM,GACvD,OAAO,CAAC,yBAAyB,CAAC,CASpC"}
|
package/dist/types.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { Styleframe } from '@styleframe/core';
|
|
2
|
-
/**
|
|
3
|
-
* Export information for a recipe or selector
|
|
4
|
-
*/
|
|
5
|
-
export interface ExportInfo {
|
|
6
|
-
/** Export name (e.g., "buttonRecipe") */
|
|
7
|
-
name: string;
|
|
8
|
-
/** Type of export */
|
|
9
|
-
type: "recipe" | "selector";
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Options for loading a module with jiti
|
|
13
|
-
*/
|
|
14
|
-
export interface LoadModuleOptions {
|
|
15
|
-
/** jiti alias configuration (e.g., for virtual modules) */
|
|
16
|
-
alias?: Record<string, string>;
|
|
17
|
-
/** Whether to validate that default export is a Styleframe instance (default: true) */
|
|
18
|
-
validateInstance?: boolean;
|
|
19
|
-
/** Optional shared jiti instance to reuse across multiple loads */
|
|
20
|
-
jiti?: import('jiti').Jiti;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Result of loading a module
|
|
24
|
-
*/
|
|
25
|
-
export interface LoadModuleResult {
|
|
26
|
-
/** The raw module exports */
|
|
27
|
-
module: Record<string, unknown>;
|
|
28
|
-
/** The default export (Styleframe instance) */
|
|
29
|
-
instance: Styleframe;
|
|
30
|
-
/** Tracked exports (recipes and selectors with _exportName set) */
|
|
31
|
-
exports: Map<string, ExportInfo>;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Result of loading an extension module (no instance validation)
|
|
35
|
-
*/
|
|
36
|
-
export interface LoadExtensionModuleResult {
|
|
37
|
-
/** The raw module exports */
|
|
38
|
-
module: Record<string, unknown>;
|
|
39
|
-
/** Tracked exports (recipes and selectors with _exportName set) */
|
|
40
|
-
exports: Map<string, ExportInfo>;
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB;IACrB,IAAI,EAAE,QAAQ,GAAG,UAAU,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC,2DAA2D;IAC3D,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,uFAAuF;IACvF,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,mEAAmE;IACnE,IAAI,CAAC,EAAE,OAAO,MAAM,EAAE,IAAI,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,+CAA+C;IAC/C,QAAQ,EAAE,UAAU,CAAC;IACrB,mEAAmE;IACnE,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACzC,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,mEAAmE;IACnE,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;CACjC"}
|
package/dist/utils.d.ts
DELETED
package/dist/utils.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,oBAOjD"}
|