@styleframe/loader 3.0.0 → 3.0.2

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/jiti.d.ts ADDED
@@ -0,0 +1,34 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,30 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,42 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,2 @@
1
+ export declare function directoryExists(path: string): Promise<boolean>;
2
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,oBAOjD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@styleframe/loader",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "type": "module",
5
5
  "types": "./dist/index.d.ts",
6
6
  "module": "./dist/index.js",
@@ -23,23 +23,22 @@
23
23
  "jiti": "^2.4.2"
24
24
  },
25
25
  "peerDependencies": {
26
- "@styleframe/core": "^3.0.0",
26
+ "@styleframe/core": "^3.6.0",
27
27
  "@styleframe/license": "^2.0.2",
28
- "@styleframe/transpiler": "^3.0.0"
28
+ "@styleframe/transpiler": "^3.4.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@styleframe/config-typescript": "^3.0.0",
32
- "@styleframe/config-vite": "^3.0.0",
33
- "@styleframe/core": "^3.0.0",
32
+ "@styleframe/config-vite": "^3.0.1",
33
+ "@styleframe/core": "^3.6.0",
34
34
  "@styleframe/license": "^2.0.2",
35
- "@styleframe/transpiler": "^3.0.0",
36
- "@vitest/coverage-v8": "^3.2.4",
35
+ "@styleframe/transpiler": "^3.4.0",
36
+ "@vitest/coverage-v8": "^4.1.7",
37
37
  "tsx": "^4.20.6",
38
38
  "typescript": "^5.8.3",
39
- "vite": "^7.0.6",
40
- "vite-plugin-dts": "^4.5.4",
41
- "vite-plugin-node": "^7.0.0",
42
- "vitest": "^3.2.4"
39
+ "vite": "^8.0.14",
40
+ "vite-plugin-dts": "^5.0.1",
41
+ "vitest": "^4.1.7"
43
42
  },
44
43
  "homepage": "https://github.com/styleframe-dev/styleframe#readme",
45
44
  "bugs": {
@@ -50,9 +49,6 @@
50
49
  "url": "git+https://github.com/styleframe-dev/styleframe.git"
51
50
  },
52
51
  "author": "Alex Grozav <alex@styleframe.dev>",
53
- "overrides": {
54
- "vite": "npm:rolldown-vite@latest"
55
- },
56
52
  "scripts": {
57
53
  "dev": "vite build --watch",
58
54
  "build": "pnpm typecheck && vite build",