@farmfe/runtime
Advanced tools
Comparing version 0.12.8 to 0.12.9
# @farmfe/runtime | ||
## 0.12.9 | ||
### Patch Changes | ||
- 829d0945: fix typecheck error | ||
## 0.12.8 | ||
@@ -4,0 +10,0 @@ |
{ | ||
"name": "@farmfe/runtime", | ||
"version": "0.12.8", | ||
"version": "0.12.9", | ||
"description": "Runtime of Farm", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -36,3 +36,3 @@ import { Module } from "./module"; | ||
publicPaths: string[]; | ||
dynamicResources: Resource[]; | ||
dynamicResources: Resource[] = []; | ||
// dynamic module entry and resources map | ||
@@ -101,3 +101,3 @@ dynamicModuleResourcesMap: Record<string, number[]>; | ||
const module = new Module(moduleId, this.require.bind(this)); | ||
module.resource_pot = initializer.__farm_resource_pot__; | ||
module.resource_pot = initializer.__farm_resource_pot__!; | ||
// call the module created hook | ||
@@ -252,3 +252,3 @@ this.pluginContainer.hookSerial("moduleCreated", module); | ||
} else { | ||
return this.modules[moduleId].__farm_resource_pot__; | ||
return this.modules[moduleId].__farm_resource_pot__!; | ||
} | ||
@@ -255,0 +255,0 @@ } |
@@ -6,4 +6,4 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
// initialize promise if this module is a async module | ||
initializer: Promise<any>; | ||
resource_pot: string; | ||
initializer: Promise<any> | undefined; | ||
resource_pot: string = ""; | ||
meta: Record<string, any>; | ||
@@ -78,2 +78,3 @@ require: (id: string) => any; | ||
var newObj: any = { __proto__: null }; | ||
// @ts-ignore | ||
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; | ||
@@ -83,2 +84,3 @@ | ||
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { | ||
// @ts-ignore | ||
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; | ||
@@ -85,0 +87,0 @@ if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc); |
@@ -52,2 +52,3 @@ import { Module } from './module'; | ||
if (hook) { | ||
// @ts-ignore | ||
// await hook.apply(plugin, args); | ||
@@ -65,3 +66,3 @@ hook.apply(plugin, args); | ||
): // ): Promise<T> { | ||
T { | ||
T | undefined { | ||
for (const plugin of this.plugins) { | ||
@@ -71,2 +72,3 @@ const hook = plugin[hookName]; | ||
if (hook) { | ||
// @ts-ignore | ||
// const result = await hook.apply(plugin, args); | ||
@@ -76,7 +78,8 @@ const result = hook.apply(plugin, args); | ||
if (result) { | ||
return result; | ||
return result as T; | ||
} | ||
} | ||
} | ||
return undefined; | ||
} | ||
} |
@@ -69,4 +69,6 @@ // using native ability to load resources if target env is node. | ||
if (this._loadedResources[resource.path]) { | ||
return; | ||
return Promise.resolve(); | ||
// @ts-ignore | ||
} else if (this._loadingResources[resource.path]) { | ||
// @ts-ignore | ||
return this._loadingResources[resource.path]; | ||
@@ -119,2 +121,3 @@ } | ||
this._loadedResources[resource.path] = true; | ||
// @ts-ignore | ||
this._loadingResources[resource.path] = null; | ||
@@ -131,2 +134,3 @@ }) | ||
} else { | ||
// @ts-ignore | ||
this._loadingResources[resource.path] = null; | ||
@@ -133,0 +137,0 @@ throw new Error( |
30018
704