@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.
@@ -1,4 +1,3 @@
1
1
  Function.prototype.wait = function(...args) {
2
2
  return wait(this, ...args);
3
- };
4
- Function.prototype.globe = () => global
3
+ };
@@ -69,6 +69,7 @@ class Namespace extends module.exports.Usage {
69
69
  if(ns instanceof Namespace.Group){
70
70
  if(ns.onUse) this.onUse = ns.onUse;
71
71
  if(ns.parent) parent = ns.parent;
72
+ if(ns.onAfterUse) this.onAfterUse = ns.onAfterUse;
72
73
  cb = ns.g[1]
73
74
  ns = ns.g[0]
74
75
  }
@@ -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
- return runtime.exec(code, childContext, code, context.module.filepath);
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")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@makano/rew",
3
- "version": "1.2.84",
3
+ "version": "1.2.86",
4
4
  "description": "A simple coffescript runtime and app manager",
5
5
  "main": "main.js",
6
6
  "directories": {