runtime-compiler 3.0.9 → 3.1.1
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/index.d.ts +14 -10
- package/index.js +1 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -13,22 +13,27 @@ export type ExportedDependency<T> = number & {
|
|
|
13
13
|
export type Scope = [body: string, id: number];
|
|
14
14
|
/**
|
|
15
15
|
* Declare a variable in the current scope.
|
|
16
|
+
* Use in `default` and `build` mode.
|
|
16
17
|
*/
|
|
17
18
|
export declare const declareLocal: (<T>(scope: Scope, expr: Expression<T>) => Identifier<T>) | ((scope: Scope, expr: string) => string);
|
|
18
19
|
/**
|
|
19
|
-
* Export a local expression to a parent local variable
|
|
20
|
+
* Export a local expression to a parent local variable.
|
|
21
|
+
* Use in `default` and `build` mode.
|
|
20
22
|
*
|
|
21
23
|
* @example
|
|
22
24
|
* // Fork scope
|
|
23
|
-
* const childScope =
|
|
24
|
-
* body: '',
|
|
25
|
-
* id: parentScope.id
|
|
26
|
-
* };
|
|
25
|
+
* const childScope = ['', parentScope.id];
|
|
27
26
|
* // let d0;{let d1=1;d0=d1}
|
|
28
27
|
* const id = exportLocal(childScope, declareLocal(childScope, '1'), parentScope); // d0
|
|
29
28
|
*/
|
|
30
29
|
export declare const exportLocal: (<T>(scope: Scope, expr: Expression<T>, parentScope: Scope) => Identifier<T>) | ((scope: Scope, expr: string, parentScope: Scope) => string);
|
|
31
30
|
/**
|
|
31
|
+
* Mark current available variable id to be already in use.
|
|
32
|
+
* Use in `hydrate` mode.
|
|
33
|
+
* @param scope
|
|
34
|
+
*/
|
|
35
|
+
export declare const markDeclared: (scope: Scope) => void;
|
|
36
|
+
/**
|
|
32
37
|
* External dependencies
|
|
33
38
|
*/
|
|
34
39
|
export declare const $: any[];
|
|
@@ -54,11 +59,10 @@ export declare const markExported: <T>() => ExportedDependency<T>;
|
|
|
54
59
|
*/
|
|
55
60
|
export declare const getDependency: <T>(idx: ExportedDependency<T>) => T;
|
|
56
61
|
/**
|
|
57
|
-
*
|
|
62
|
+
* Get built statements and reset for next build.
|
|
58
63
|
*/
|
|
59
|
-
export declare const
|
|
64
|
+
export declare const getStatements: () => string;
|
|
60
65
|
/**
|
|
61
|
-
*
|
|
62
|
-
* Use in `default` mode.
|
|
66
|
+
* Inject an external dependency.
|
|
63
67
|
*/
|
|
64
|
-
export declare const
|
|
68
|
+
export declare const injectExternal: <T>(val: T) => Value<T>;
|
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export let declareLocal=(e,
|
|
1
|
+
import{isHydrating}from"./config/index.js";export let declareLocal=(e,l)=>(e[0]+=`let d`+e[1]+`=`+l+`;`,`d`+ e[1]++);export let exportLocal=(e,l,u)=>{let d=`d`+ u[1]++;u[0]+=`let `+d+`;{`+e[0]+d+`=`+l+`}`;return d};export let markDeclared=e=>{e[1]++};export let $=[];export let statements=``;export let exportScope=(e,l)=>(statements+=`{`+e[0]+`$[`+$.length+`]=`+l+`}`,$.length++);export let exportExpr=e=>(statements+=`$[`+$.length+`]=`+e+`;`,$.length++);export let markExported=()=>$.length++;export let getDependency=isHydrating?e=>$[e]:e=>{if(statements.length>0){globalThis.__rt_externals__=$;(0,eval)(`{let $=__rt_externals__;`+statements+`}`);globalThis.__rt_externals__=null;statements=``}return $[e]};export let getStatements=()=>{let e=statements;statements=``;return e};export let injectExternal=isHydrating?e=>($.push(e),``):e=>`$[`+($.push(e)-1)+`]`;
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"runtime-compiler","version":"3.
|
|
1
|
+
{"name":"runtime-compiler","version":"3.1.1","description":"Universal compiler system","keywords":[],"repository":{},"homepage":"","license":"MIT","type":"module","exports":{"./utils":"./utils.js",".":"./index.js","./config":"./config/index.js","./config/loader/build":"./config/loader/build.js","./config/mode/hydrate":"./config/mode/hydrate.js","./config/loader/hydrate":"./config/loader/hydrate.js","./config/mode/build":"./config/mode/build.js"}}
|