@fictjs/compiler 0.2.2 → 0.2.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/dist/index.cjs +795 -204
- package/dist/index.d.cts +41 -1
- package/dist/index.d.ts +41 -1
- package/dist/index.js +791 -203
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -7,10 +7,22 @@ interface CompilerWarning {
|
|
|
7
7
|
line: number;
|
|
8
8
|
column: number;
|
|
9
9
|
}
|
|
10
|
+
type ReactiveExportKind = 'signal' | 'memo' | 'store';
|
|
11
|
+
interface HookReturnInfoSerializable {
|
|
12
|
+
objectProps?: Record<string, 'signal' | 'memo'>;
|
|
13
|
+
arrayProps?: Record<string, 'signal' | 'memo'>;
|
|
14
|
+
directAccessor?: 'signal' | 'memo';
|
|
15
|
+
}
|
|
16
|
+
interface ModuleReactiveMetadata {
|
|
17
|
+
exports: Record<string, ReactiveExportKind>;
|
|
18
|
+
hooks?: Record<string, HookReturnInfoSerializable>;
|
|
19
|
+
}
|
|
10
20
|
interface FictCompilerOptions {
|
|
11
21
|
dev?: boolean;
|
|
12
22
|
sourcemap?: boolean;
|
|
13
23
|
onWarn?: (warning: CompilerWarning) => void;
|
|
24
|
+
/** Internal: filename of the module being compiled. */
|
|
25
|
+
filename?: string;
|
|
14
26
|
/** Enable lazy evaluation of conditional derived values (Rule J optimization) */
|
|
15
27
|
lazyConditional?: boolean;
|
|
16
28
|
/** Enable getter caching within the same sync block (Rule L optimization) */
|
|
@@ -19,8 +31,32 @@ interface FictCompilerOptions {
|
|
|
19
31
|
fineGrainedDom?: boolean;
|
|
20
32
|
/** Enable HIR optimization passes (DCE/const-fold/CSE) */
|
|
21
33
|
optimize?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Optimization safety level.
|
|
36
|
+
* - 'safe': avoid non-constant algebraic rewrites to preserve JS semantics.
|
|
37
|
+
* - 'full': allow algebraic simplifications beyond constant folding.
|
|
38
|
+
*/
|
|
39
|
+
optimizeLevel?: 'safe' | 'full';
|
|
22
40
|
/** Allow inlining single-use derived values even when user-named */
|
|
23
41
|
inlineDerivedMemos?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Treat warnings as errors. Use true for all warnings, or provide a list of codes.
|
|
44
|
+
*/
|
|
45
|
+
warningsAsErrors?: boolean | string[];
|
|
46
|
+
/**
|
|
47
|
+
* Per-warning override. "off" suppresses, "error" throws, "warn" emits.
|
|
48
|
+
*/
|
|
49
|
+
warningLevels?: Record<string, 'off' | 'warn' | 'error'>;
|
|
50
|
+
/**
|
|
51
|
+
* Optional shared module metadata map for cross-module reactive imports.
|
|
52
|
+
* If omitted, the compiler uses a process-wide cache.
|
|
53
|
+
*/
|
|
54
|
+
moduleMetadata?: Map<string, ModuleReactiveMetadata>;
|
|
55
|
+
/**
|
|
56
|
+
* Optional hook to resolve module metadata for a given import source.
|
|
57
|
+
* Tooling can override the default resolution strategy.
|
|
58
|
+
*/
|
|
59
|
+
resolveModuleMetadata?: (source: string, importer?: string) => ModuleReactiveMetadata | null | undefined;
|
|
24
60
|
/**
|
|
25
61
|
* Optional TypeScript integration data provided by tooling (e.g., Vite plugin).
|
|
26
62
|
* The compiler currently ignores this, but it enables future type-aware passes.
|
|
@@ -33,6 +69,10 @@ interface FictCompilerOptions {
|
|
|
33
69
|
};
|
|
34
70
|
}
|
|
35
71
|
|
|
72
|
+
declare function resolveModuleMetadata(source: string, importer: string | undefined, options?: FictCompilerOptions): ModuleReactiveMetadata | undefined;
|
|
73
|
+
declare function setModuleMetadata(fileName: string | undefined, metadata: ModuleReactiveMetadata, options?: FictCompilerOptions): void;
|
|
74
|
+
declare function clearModuleMetadata(options?: FictCompilerOptions): void;
|
|
75
|
+
|
|
36
76
|
declare const createFictPlugin: (api: object, options: FictCompilerOptions | null | undefined, dirname: string) => BabelCore.PluginObj<BabelCore.PluginPass>;
|
|
37
77
|
|
|
38
|
-
export { type CompilerWarning, type FictCompilerOptions, createFictPlugin, createFictPlugin as default };
|
|
78
|
+
export { type CompilerWarning, type FictCompilerOptions, type HookReturnInfoSerializable, type ModuleReactiveMetadata, type ReactiveExportKind, clearModuleMetadata, createFictPlugin, createFictPlugin as default, resolveModuleMetadata, setModuleMetadata };
|
package/dist/index.d.ts
CHANGED
|
@@ -7,10 +7,22 @@ interface CompilerWarning {
|
|
|
7
7
|
line: number;
|
|
8
8
|
column: number;
|
|
9
9
|
}
|
|
10
|
+
type ReactiveExportKind = 'signal' | 'memo' | 'store';
|
|
11
|
+
interface HookReturnInfoSerializable {
|
|
12
|
+
objectProps?: Record<string, 'signal' | 'memo'>;
|
|
13
|
+
arrayProps?: Record<string, 'signal' | 'memo'>;
|
|
14
|
+
directAccessor?: 'signal' | 'memo';
|
|
15
|
+
}
|
|
16
|
+
interface ModuleReactiveMetadata {
|
|
17
|
+
exports: Record<string, ReactiveExportKind>;
|
|
18
|
+
hooks?: Record<string, HookReturnInfoSerializable>;
|
|
19
|
+
}
|
|
10
20
|
interface FictCompilerOptions {
|
|
11
21
|
dev?: boolean;
|
|
12
22
|
sourcemap?: boolean;
|
|
13
23
|
onWarn?: (warning: CompilerWarning) => void;
|
|
24
|
+
/** Internal: filename of the module being compiled. */
|
|
25
|
+
filename?: string;
|
|
14
26
|
/** Enable lazy evaluation of conditional derived values (Rule J optimization) */
|
|
15
27
|
lazyConditional?: boolean;
|
|
16
28
|
/** Enable getter caching within the same sync block (Rule L optimization) */
|
|
@@ -19,8 +31,32 @@ interface FictCompilerOptions {
|
|
|
19
31
|
fineGrainedDom?: boolean;
|
|
20
32
|
/** Enable HIR optimization passes (DCE/const-fold/CSE) */
|
|
21
33
|
optimize?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Optimization safety level.
|
|
36
|
+
* - 'safe': avoid non-constant algebraic rewrites to preserve JS semantics.
|
|
37
|
+
* - 'full': allow algebraic simplifications beyond constant folding.
|
|
38
|
+
*/
|
|
39
|
+
optimizeLevel?: 'safe' | 'full';
|
|
22
40
|
/** Allow inlining single-use derived values even when user-named */
|
|
23
41
|
inlineDerivedMemos?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Treat warnings as errors. Use true for all warnings, or provide a list of codes.
|
|
44
|
+
*/
|
|
45
|
+
warningsAsErrors?: boolean | string[];
|
|
46
|
+
/**
|
|
47
|
+
* Per-warning override. "off" suppresses, "error" throws, "warn" emits.
|
|
48
|
+
*/
|
|
49
|
+
warningLevels?: Record<string, 'off' | 'warn' | 'error'>;
|
|
50
|
+
/**
|
|
51
|
+
* Optional shared module metadata map for cross-module reactive imports.
|
|
52
|
+
* If omitted, the compiler uses a process-wide cache.
|
|
53
|
+
*/
|
|
54
|
+
moduleMetadata?: Map<string, ModuleReactiveMetadata>;
|
|
55
|
+
/**
|
|
56
|
+
* Optional hook to resolve module metadata for a given import source.
|
|
57
|
+
* Tooling can override the default resolution strategy.
|
|
58
|
+
*/
|
|
59
|
+
resolveModuleMetadata?: (source: string, importer?: string) => ModuleReactiveMetadata | null | undefined;
|
|
24
60
|
/**
|
|
25
61
|
* Optional TypeScript integration data provided by tooling (e.g., Vite plugin).
|
|
26
62
|
* The compiler currently ignores this, but it enables future type-aware passes.
|
|
@@ -33,6 +69,10 @@ interface FictCompilerOptions {
|
|
|
33
69
|
};
|
|
34
70
|
}
|
|
35
71
|
|
|
72
|
+
declare function resolveModuleMetadata(source: string, importer: string | undefined, options?: FictCompilerOptions): ModuleReactiveMetadata | undefined;
|
|
73
|
+
declare function setModuleMetadata(fileName: string | undefined, metadata: ModuleReactiveMetadata, options?: FictCompilerOptions): void;
|
|
74
|
+
declare function clearModuleMetadata(options?: FictCompilerOptions): void;
|
|
75
|
+
|
|
36
76
|
declare const createFictPlugin: (api: object, options: FictCompilerOptions | null | undefined, dirname: string) => BabelCore.PluginObj<BabelCore.PluginPass>;
|
|
37
77
|
|
|
38
|
-
export { type CompilerWarning, type FictCompilerOptions, createFictPlugin, createFictPlugin as default };
|
|
78
|
+
export { type CompilerWarning, type FictCompilerOptions, type HookReturnInfoSerializable, type ModuleReactiveMetadata, type ReactiveExportKind, clearModuleMetadata, createFictPlugin, createFictPlugin as default, resolveModuleMetadata, setModuleMetadata };
|