@makano/rew 1.2.971 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/rew/cli/run.js +5 -0
- package/lib/rew/functions/import.js +1 -1
- package/lib/rew/modules/compiler.js +15 -1
- package/lib/rew/modules/context.js +3 -0
- package/package.json +1 -1
- package/runtime.d.ts +20 -0
package/lib/rew/cli/run.js
CHANGED
@@ -44,6 +44,11 @@ function runFileWithArgv(filePath, options = {}, cargv) {
|
|
44
44
|
}
|
45
45
|
if (argv.includes('--')) {
|
46
46
|
argv = argv.slice(argv.indexOf('--') + 1, argv.length);
|
47
|
+
} else {
|
48
|
+
const index = argv.find(p => filePath.endsWith(p.replace(/(\.|\.\.)\//, '/')));
|
49
|
+
if(index){
|
50
|
+
argv = argv.slice(argv.indexOf(index) + 1, argv.length);
|
51
|
+
}
|
47
52
|
}
|
48
53
|
runFile(filePath, options, argv);
|
49
54
|
}
|
@@ -71,7 +71,7 @@ module.exports.imp = function (runPath, context) {
|
|
71
71
|
const foundCache = cachedFiles.find((f) => f.filepath == type+':'+filepath);
|
72
72
|
|
73
73
|
if (!ispkg && foundCache) {
|
74
|
-
exports = options.useDefaultForPackages === false ? foundCache.exports.default || foundCache.exports : _returns(options, foundCache.exports);
|
74
|
+
exports = type === 'coffee' || type === REW_FILE_TYPE.EXTENSION ? foundCache.exports : options.useDefaultForPackages === false ? foundCache.exports.default || foundCache.exports : _returns(options, foundCache.exports);
|
75
75
|
}
|
76
76
|
|
77
77
|
if (!ispkg && !existsSync(filepath) && !foundCache) {
|
@@ -402,11 +402,25 @@ function compileRewStuff(content, options) {
|
|
402
402
|
straceLog('EXPORT() => TRANSLATING TO pub');
|
403
403
|
}
|
404
404
|
|
405
|
-
if (token.type === 'IDENTIFIER' && token.value === 'package' && nextToken.type == 'STRING') {
|
405
|
+
if (tokens[i-1]?.value !== '.' && token.type === 'IDENTIFIER' && token.value === 'package' && nextToken.type == 'STRING') {
|
406
406
|
token.value = 'appPackage';
|
407
407
|
straceLog('APP_PACKAGE_CHANGE()');
|
408
408
|
}
|
409
409
|
|
410
|
+
if (
|
411
|
+
token.type === 'OTHER' && token.value === '-' &&
|
412
|
+
nextToken.type == 'IDENTIFIER' && nextToken.value === 'wait'
|
413
|
+
) {
|
414
|
+
const { token: nextNextToken } = gnextToken(i, 2, tokens) || {};
|
415
|
+
if(nextNextToken?.type == 'IDENTIFIER'){
|
416
|
+
token.value = '';
|
417
|
+
hooks.push({
|
418
|
+
index: i + 3,
|
419
|
+
value: ','
|
420
|
+
});
|
421
|
+
}
|
422
|
+
}
|
423
|
+
|
410
424
|
if (token.type === 'IDENTIFIER' && token.value === 'using' && !options.disableUse) {
|
411
425
|
straceLog('USING()');
|
412
426
|
const next = nextToken.value;
|
package/package.json
CHANGED
package/runtime.d.ts
CHANGED
@@ -1006,4 +1006,24 @@ declare namespace Rew {
|
|
1006
1006
|
group(...group: any[]): { g: T, with: (props: any) => { g: T, [key: string]: any }, [key: string]: any }
|
1007
1007
|
}
|
1008
1008
|
|
1009
|
+
declare const std = {
|
1010
|
+
curl: curl,
|
1011
|
+
int: int,
|
1012
|
+
str: str,
|
1013
|
+
bool: bool,
|
1014
|
+
float: float,
|
1015
|
+
num: num,
|
1016
|
+
typeis: typeis,
|
1017
|
+
typex: typex,
|
1018
|
+
typei: typei,
|
1019
|
+
|
1020
|
+
prototype: {
|
1021
|
+
void: () => void 0,
|
1022
|
+
Main: () => [string, () => any],
|
1023
|
+
define: (name: string, object: any) => any,
|
1024
|
+
attach: (object: any) => any,
|
1025
|
+
ns: () => any
|
1026
|
+
}
|
1027
|
+
}
|
1028
|
+
|
1009
1029
|
// }
|