runtime-compiler 4.0.3 → 4.0.4
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/README.md +6 -7
- package/env/aot.js +1 -1
- package/env/build.js +1 -1
- package/env/index.js +1 -1
- package/globals.d.ts +0 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,17 +3,16 @@ A code generation system.
|
|
|
3
3
|
# Usage
|
|
4
4
|
```ts
|
|
5
5
|
import { IS_AOT, IS_BUILD } from 'runtime-compiler/env';
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
// Only emit code if not in AOT mode
|
|
9
|
-
IS_AOT || emit(`return()=>console.log("Hi")`);
|
|
6
|
+
import { evaluate } from 'runtime-compiler/globals';
|
|
10
7
|
|
|
11
8
|
// Only log when building
|
|
12
9
|
IS_BUILD && console.log('Building...');
|
|
13
10
|
|
|
14
|
-
//
|
|
15
|
-
const fn = evaluate<() => void>();
|
|
16
|
-
|
|
11
|
+
// Only emit code if not in AOT mode
|
|
12
|
+
const fn = evaluate<() => void>(IS_AOT || `return()=>console.log("Hi")`);
|
|
13
|
+
|
|
14
|
+
// Run only when not in build mode
|
|
15
|
+
IS_BUILD || fn();
|
|
17
16
|
```
|
|
18
17
|
|
|
19
18
|
Build with `rolldown` or `vite`:
|
package/env/aot.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{__rtcpl_aot__}from"./index.js";__rtcpl_aot__();
|
package/env/build.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{__rtcpl_build__}from"./index.js";__rtcpl_build__();
|
package/env/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export let IS_JIT=!0;export let IS_BUILD=!1;export let IS_AOT=!1;export const
|
|
1
|
+
export let IS_JIT=!0;export let IS_BUILD=!1;export let IS_AOT=!1;export const __rtcpl_build__=()=>{IS_JIT=!1;IS_BUILD=!0;IS_AOT=!1};export const __rtcpl_aot__=()=>{IS_JIT=!1;IS_BUILD=!1;IS_AOT=!0};
|
package/globals.d.ts
CHANGED
|
@@ -4,5 +4,4 @@ export type Ref<T> = number & {
|
|
|
4
4
|
export declare const importRef: <T>(value: T) => Ref<T>;
|
|
5
5
|
export declare const createRef: <T>() => Ref<T>;
|
|
6
6
|
export declare let evaluate: <T>(content?: string | boolean | null | undefined) => T;
|
|
7
|
-
export declare const __rtcpl_aot_fns__: ((args: any[]) => any)[];
|
|
8
7
|
export declare const deref: <T>(id: Ref<T>) => T;
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"runtime-compiler","version":"4.0.
|
|
1
|
+
{"name":"runtime-compiler","version":"4.0.4","description":"A code generation system.","keywords":[],"homepage":"","license":"MIT","repository":"","type":"module","exports":{"./*":"./*.js","./build":"./build/index.js","./env":"./env/index.js"}}
|