@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.
@@ -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;
@@ -81,6 +81,9 @@ module.exports.prepareContext = function (
81
81
  if(!context[i]) context[i] = object[i];
82
82
  }
83
83
  } }
84
+ Object.defineProperty(std.prototype, 'void', {
85
+ get: () => void 0
86
+ })
84
87
  context.std = std;
85
88
  }
86
89
  if (!context.process)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@makano/rew",
3
- "version": "1.2.971",
3
+ "version": "1.3.1",
4
4
  "description": "A simple coffescript runtime and app manager",
5
5
  "main": "main.js",
6
6
  "directories": {
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
  // }