@ayana/bento
Advanced tools
Comparing version 1.0.0-beta.4 to 1.0.0-beta.5
export * from './interfaces'; | ||
export * from './PluginAPI'; | ||
export * from './public'; |
@@ -6,3 +6,4 @@ 'use strict'; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./PluginAPI")); | ||
__export(require("./public")); | ||
//# sourceMappingURL=index.js.map |
@@ -1,6 +0,4 @@ | ||
import { Bento } from '../../Bento'; | ||
import { PluginAPI } from '../PluginAPI'; | ||
import { Component } from '../../components'; | ||
export interface Plugin { | ||
bento?: Bento; | ||
api?: PluginAPI; | ||
@@ -14,5 +12,5 @@ /** | ||
* Plugin Lifecycle Hook, Plugin Entrypoint | ||
* @param bento Bento | ||
* @param api Plugin API | ||
*/ | ||
onLoad?(bento?: Bento): Promise<void>; | ||
onLoad?(api?: PluginAPI): Promise<void>; | ||
/** | ||
@@ -19,0 +17,0 @@ * Plugin Lifecycle Hook, Plugin unload |
@@ -6,2 +6,3 @@ 'use strict'; | ||
const internal_1 = require("../../references/internal"); | ||
const PluginAPI_1 = require("../PluginAPI"); | ||
var PluginHook; | ||
@@ -128,8 +129,9 @@ (function (PluginHook) { | ||
this.references.addReference(plugin); | ||
// Define bento instance | ||
Object.defineProperty(plugin, 'bento', { | ||
configurable: false, | ||
// create and inject plugin api | ||
const api = new PluginAPI_1.PluginAPI(this.bento, plugin); | ||
Object.defineProperty(plugin, 'api', { | ||
configurable: true, | ||
writable: false, | ||
enumerable: true, | ||
value: this.bento, | ||
value: api, | ||
}); | ||
@@ -143,3 +145,3 @@ // plugin must be defined before calling onload. | ||
try { | ||
await plugin.onLoad(this.bento); | ||
await plugin.onLoad(plugin.api); | ||
} | ||
@@ -146,0 +148,0 @@ catch (e) { |
@@ -1,2 +0,2 @@ | ||
import { Bento } from '../../../Bento'; | ||
import { PluginAPI } from '../../PluginAPI'; | ||
export interface ConfigLoaderDefinition { | ||
@@ -8,3 +8,3 @@ name: string; | ||
export declare class ConfigLoader { | ||
bento: Bento; | ||
api: PluginAPI; | ||
name: string; | ||
@@ -11,0 +11,0 @@ private definitions; |
@@ -64,3 +64,3 @@ 'use strict'; | ||
async reloadValues() { | ||
if (this.bento == null) | ||
if (this.api == null) | ||
return; | ||
@@ -75,3 +75,3 @@ for (const definition of this.definitions.values()) { | ||
} | ||
this.bento.variables.setVariable(definition.name, value, source); | ||
this.api.getBento().variables.setVariable(definition.name, value, source); | ||
} | ||
@@ -78,0 +78,0 @@ } |
@@ -1,4 +0,4 @@ | ||
import { Bento } from '../../../Bento'; | ||
import { Component } from '../../../components'; | ||
import { DetectedComponent } from '../../../decorators/internal'; | ||
import { PluginAPI } from '../../PluginAPI'; | ||
/** | ||
@@ -11,3 +11,3 @@ * Abstract loader class containing an interface to the outside and core functionality | ||
*/ | ||
bento: Bento; | ||
api: PluginAPI; | ||
/** | ||
@@ -14,0 +14,0 @@ * This method can and will be called by components desiring to load peer components |
@@ -12,3 +12,3 @@ 'use strict'; | ||
*/ | ||
this.bento = null; | ||
this.api = null; | ||
} | ||
@@ -51,3 +51,3 @@ /** | ||
obj: nodeModule.default, | ||
esModule: true | ||
esModule: true, | ||
}; | ||
@@ -73,3 +73,3 @@ } | ||
obj: componentObject, | ||
esModule: true | ||
esModule: true, | ||
}; | ||
@@ -76,0 +76,0 @@ } |
@@ -1,5 +0,3 @@ | ||
import { Bento } from '../../../Bento'; | ||
import { ComponentLoader } from './ComponentLoader'; | ||
export declare class FSComponentLoader extends ComponentLoader { | ||
bento: Bento; | ||
name: string; | ||
@@ -6,0 +4,0 @@ private directories; |
@@ -32,3 +32,3 @@ 'use strict'; | ||
try { | ||
const name = await this.bento.addComponent(instance); | ||
const name = await this.api.getBento().addComponent(instance); | ||
this.components.add(name); | ||
@@ -70,5 +70,5 @@ } | ||
// gracefully handle bento not being attached yet | ||
if (this.bento != null) { | ||
if (this.api != null) { | ||
try { | ||
const name = await this.bento.addComponent(instance); | ||
const name = await this.api.getBento().addComponent(instance); | ||
this.components.add(name); | ||
@@ -75,0 +75,0 @@ } |
{ | ||
"name": "@ayana/bento", | ||
"version": "1.0.0-beta.4", | ||
"version": "1.0.0-beta.5", | ||
"description": "Modular runtime framework designed to solve complex tasks", | ||
@@ -5,0 +5,0 @@ "repository": "https://gitlab.com/ayana/libs/bento", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
212120
0