@makano/rew 1.2.82 → 1.2.83
Sign up to get free protection for your applications and to get access to all the features.
package/lib/rew/const/usage.js
CHANGED
@@ -34,6 +34,19 @@ module.exports.Usage = class Usage {
|
|
34
34
|
return new Usage.Group(group, {});
|
35
35
|
}
|
36
36
|
|
37
|
+
/**
|
38
|
+
*
|
39
|
+
* @param {...Usage} usages
|
40
|
+
* @returns {any[]}
|
41
|
+
*/
|
42
|
+
merge(...usages){
|
43
|
+
return new Usage(usages.map(u => u.name).join('-'), (...args) => {
|
44
|
+
return usages.map(u => {
|
45
|
+
return u.trigger(...args)
|
46
|
+
});
|
47
|
+
})
|
48
|
+
}
|
49
|
+
|
37
50
|
static Group = class UsageGroup {
|
38
51
|
g = []
|
39
52
|
constructor(g, props = {}){
|
@@ -419,7 +419,7 @@ const cpl = (module.exports.compile = function (file, options = {}) {
|
|
419
419
|
|
420
420
|
const babelify = (code, options) => babel.transformSync(code, {
|
421
421
|
presets: [
|
422
|
-
...(doJSX ? [[babelReact, { pragmaFrag: options.jsxPragmaFrag || execOptions.jsxPragmaFrag, pragma: options.jsxPragma || execOptions.jsxPragma }]] : [])
|
422
|
+
...(doJSX ? [[babelReact, { throwIfNamespace: false, pragmaFrag: options.jsxPragmaFrag || execOptions.jsxPragmaFrag, pragma: options.jsxPragma || execOptions.jsxPragma }]] : [])
|
423
423
|
],
|
424
424
|
plugins: [
|
425
425
|
...(doDecorators ? [[require('@babel/plugin-proposal-decorators'), { version: '2023-05' }], [require('@babel/plugin-proposal-class-properties'), { loose: true }], [require('@babel/plugin-transform-class-static-block'), {}]] : [])
|
@@ -128,10 +128,11 @@ module.exports.prepareContext = function (
|
|
128
128
|
childContext.parentNamespace = context;
|
129
129
|
const code = `(${trigger.toString()})()`;
|
130
130
|
if(name.onUse) name.onUse();
|
131
|
-
runtime.exec(code, childContext, code, context.module.filepath);
|
131
|
+
return runtime.exec(code, childContext, code, context.module.filepath);
|
132
132
|
} else if(name instanceof Usage) {
|
133
133
|
const v = name.trigger(...params) || true;
|
134
134
|
if(name.save !== false) context.__using__[name.name] = v;
|
135
|
+
return v;
|
135
136
|
} else {
|
136
137
|
context.__using__[name] = params.length ? params.length > 1 ? [...params] : params : true;
|
137
138
|
}
|