@makano/rew 1.2.84 → 1.2.86
Sign up to get free protection for your applications and to get access to all the features.
package/lib/rew/const/usage.js
CHANGED
@@ -128,8 +128,10 @@ module.exports.prepareContext = function (
|
|
128
128
|
childContext.currentNamespace = name.namespace;
|
129
129
|
childContext.parentNamespace = parentContext;
|
130
130
|
const code = `(${trigger.toString()})()`;
|
131
|
-
if(name.onUse) name.onUse();
|
132
|
-
|
131
|
+
if(name.onUse) name.onUse();
|
132
|
+
const r = runtime.exec(code, childContext, code, context.module.filepath);
|
133
|
+
if(name.onAfterUse) name.onAfterUse();
|
134
|
+
return r;
|
133
135
|
} else if(name instanceof Usage) {
|
134
136
|
const v = name.trigger(...params) || true;
|
135
137
|
if(name.save !== false) context.__using__[name.name] = v;
|
@@ -147,6 +149,16 @@ module.exports.prepareContext = function (
|
|
147
149
|
}
|
148
150
|
}
|
149
151
|
|
152
|
+
if(!context.app){
|
153
|
+
context.appPackage = (packageName) => context.app = { config: { manifest: { package: packageName } } }
|
154
|
+
}
|
155
|
+
|
156
|
+
Object.defineProperty(context, 'packageName', {
|
157
|
+
get: () => context.app?.config?.manifest?.package,
|
158
|
+
enumerable: true,
|
159
|
+
configurable: true
|
160
|
+
});
|
161
|
+
|
150
162
|
if (
|
151
163
|
context.module.main ||
|
152
164
|
(options.fromMain == true && options.as == "main")
|