@makano/rew 1.2.76 → 1.2.78
Sign up to get free protection for your applications and to get access to all the features.
@@ -97,6 +97,7 @@ module.exports.imp = function (runPath, context) {
|
|
97
97
|
if (ispkg) {
|
98
98
|
const pkg = getPackage(filename)(context, options);
|
99
99
|
exports = pkg._onImport ? pkg._onImport() : pkg;
|
100
|
+
if(options.useDefaultForPackages) exports = { default: exports };
|
100
101
|
} else if (foundCache) {
|
101
102
|
} else if (type == REW_FILE_TYPE.TYPE || type == "coffee") {
|
102
103
|
exports = exec({});
|
@@ -297,7 +297,18 @@ function compileRewStuff(content, options) {
|
|
297
297
|
|
298
298
|
if (nextLastToken?.value == 'assert') {
|
299
299
|
result += ', ';
|
300
|
+
const assertionToken = gnextToken(nextLastToken.ti, 2, tokens);
|
301
|
+
if(assertionToken.token.type == 'OTHER' && assertionToken.token.value == '{'){
|
302
|
+
hooks.push({
|
303
|
+
index: assertionToken.token.ti,
|
304
|
+
value: ' useDefaultForPackages: true, '
|
305
|
+
})
|
306
|
+
} else {
|
307
|
+
result += 'useDefaultForPackages: true, '
|
308
|
+
}
|
300
309
|
i += 3;
|
310
|
+
} else {
|
311
|
+
result += ", { useDefaultForPackages: true }"
|
301
312
|
}
|
302
313
|
|
303
314
|
continue;
|
@@ -10,6 +10,7 @@ const execLib = require("../functions/exec");
|
|
10
10
|
const { findAppInfo } = require("../misc/findAppInfo");
|
11
11
|
const { USING_DEFAULT, Usage, Namespace } = require("../const/usage");
|
12
12
|
const runtime = require("./runtime");
|
13
|
+
const { permission } = require("process");
|
13
14
|
|
14
15
|
let mainFile = "";
|
15
16
|
const isMainFile = (filepath) => filepath == mainFile;
|
@@ -61,8 +62,13 @@ module.exports.prepareContext = function (
|
|
61
62
|
__execFile: global.fileName,
|
62
63
|
env: process.env,
|
63
64
|
cwd: () => process.cwd(),
|
65
|
+
abort: () => process.abort(),
|
66
|
+
kill: () => process.kill(),
|
67
|
+
exit: (code) => process.exit(code),
|
64
68
|
arch: process.arch,
|
65
|
-
pid: process.pid
|
69
|
+
pid: process.pid,
|
70
|
+
platform: process.platform,
|
71
|
+
permission: process.permission
|
66
72
|
};
|
67
73
|
|
68
74
|
context.global = context;
|