runtime-compiler 2.0.6 → 2.0.7
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/call.d.ts +1 -1
- package/index.d.ts +8 -6
- package/index.js +1 -1
- package/package.json +6 -6
package/call.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare const inject: <
|
|
|
6
6
|
const Deps extends LocalDependency<any>[],
|
|
7
7
|
const Args extends any[],
|
|
8
8
|
const Ret
|
|
9
|
-
>(deps: Deps, fn: (...args: [...{ [K in keyof Deps] : InferDependency<Deps[K]> }, ...Args]) => Ret) => (...args: Args) => Ret;
|
|
9
|
+
>(deps: Deps, fn: (...args: [...{ [K in keyof Deps] : InferDependency<Deps[K]> }, ...Args]) => Ret) => ((...args: Args) => Ret);
|
|
10
10
|
/**
|
|
11
11
|
* Get fn injected dependency list
|
|
12
12
|
*/
|
package/index.d.ts
CHANGED
|
@@ -14,12 +14,6 @@ export type InferDependency<T extends {
|
|
|
14
14
|
*/
|
|
15
15
|
export declare const injectDependency: <T>(val: string) => LocalDependency<T>;
|
|
16
16
|
/**
|
|
17
|
-
* Wait for a dependency to resolve.
|
|
18
|
-
* Use in `default` and `build` mode.
|
|
19
|
-
* @param name
|
|
20
|
-
*/
|
|
21
|
-
export declare const waitDependency: (name: string) => void;
|
|
22
|
-
/**
|
|
23
17
|
* Export a local dependency.
|
|
24
18
|
* Use in `default` and `build` mode.
|
|
25
19
|
* @param name
|
|
@@ -36,6 +30,14 @@ export declare const markExported: <T>() => ExportedDependency<T>;
|
|
|
36
30
|
*/
|
|
37
31
|
export declare const getDependency: <T>(idx: ExportedDependency<T>) => T;
|
|
38
32
|
/**
|
|
33
|
+
* Add extra code after dependency building
|
|
34
|
+
*/
|
|
35
|
+
export declare let extraCode: string;
|
|
36
|
+
/**
|
|
37
|
+
* Add extra code after dependency building
|
|
38
|
+
*/
|
|
39
|
+
export declare const addExtraCode: (str: string) => void;
|
|
40
|
+
/**
|
|
39
41
|
* Inject an external dependency.
|
|
40
42
|
*/
|
|
41
43
|
export declare const injectExternalDependency: (val: any) => string;
|
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{AsyncFunction}from"./utils.js";export let compiledDependencies=[];export let externalDependencies=[];export let cache={};export let localDeps=``;let localDepsCnt=0;export let injectDependency=e=>{localDeps+=`,$`+localDepsCnt+`=`+e;return`$`+ localDepsCnt++};export let
|
|
1
|
+
import{AsyncFunction}from"./utils.js";export let compiledDependencies=[];export let externalDependencies=[];export let cache={};export let localDeps=``;let localDepsCnt=0;export let injectDependency=e=>{localDeps+=`,$`+localDepsCnt+`=`+e;return`$`+ localDepsCnt++};export let exportedDeps=``;let exportedDepsCnt=0;export let exportDependency=e=>{exportedDeps+=e+`,`;return exportedDepsCnt++};export let markExported=()=>exportedDepsCnt++;export let getDependency=e=>compiledDependencies[e];export let extraCode=``;export let addExtraCode=e=>{extraCode+=e};export let injectExternalDependency=e=>`_`+externalDependencies.push(e);export let externalDependencyNames=()=>{let e=`_,`;for(let x=0;x<externalDependencies.length;x++)e+=`_`+(x+1)+`,`;return e};export let clear=()=>{externalDependencies.length=0;cache={};localDeps=``;localDepsCnt=0;exportedDeps=``;extraCode=``};export let finishHydration=()=>{externalDependencies.length=0;cache={}};export let lazyDependency=(e,x)=>{let S=Symbol();return()=>cache[S]??=e(x)};export let evaluateCode=()=>`{var $`+localDeps+`;_.push(`+exportedDeps+`);`+extraCode+`}`;export let evaluateToString=()=>`(`+externalDependencyNames()+`)=>`+evaluateCode();export let evaluateSync=()=>{try{Function(externalDependencyNames(),evaluateCode())(compiledDependencies,...externalDependencies)}finally{clear()}};export let evaluate=async()=>AsyncFunction(externalDependencyNames(),evaluateCode())(compiledDependencies,...externalDependencies).finally(clear);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "runtime-compiler",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.7",
|
|
4
4
|
"description": "Universal compiler system",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"repository": {},
|
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
"type": "module",
|
|
10
10
|
"exports": {
|
|
11
11
|
"./call": "./call.js",
|
|
12
|
-
"./
|
|
12
|
+
"./config": "./config/index.js",
|
|
13
13
|
"./config/mode/build": "./config/mode/build.js",
|
|
14
|
-
"./config/mode/hydrate": "./config/mode/hydrate.js",
|
|
15
|
-
"./config/loader/build": "./config/loader/build.js",
|
|
16
14
|
"./config/loader/hydrate": "./config/loader/hydrate.js",
|
|
17
|
-
"
|
|
18
|
-
"
|
|
15
|
+
".": "./index.js",
|
|
16
|
+
"./utils": "./utils.js",
|
|
17
|
+
"./config/loader/build": "./config/loader/build.js",
|
|
18
|
+
"./config/mode/hydrate": "./config/mode/hydrate.js"
|
|
19
19
|
}
|
|
20
20
|
}
|