@makano/rew 1.2.94 → 1.2.95

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.
@@ -115,6 +115,13 @@ const ValueIfy = (val) => {
115
115
  }
116
116
  }
117
117
 
118
+ function insertTokenAt(array, index, value) {
119
+ if (index < 0 || index > array.length) {
120
+ throw new RangeError('Index out of bounds');
121
+ }
122
+ array.splice(index, 0, value);
123
+ }
124
+
118
125
  const gnextToken = (i, n, tokens) => {
119
126
  return tokens[i + n] ? (tokens[i + n].type == 'WHITESPACE' ? gnextToken(i, n + 1, tokens) : { token: tokens[i + n], n, ti: i + n }) : null;
120
127
  };
@@ -409,6 +416,19 @@ function compileRewStuff(content, options) {
409
416
  } else straceLog('==> UNKNOWN');
410
417
  }
411
418
 
419
+ if (token.type === 'IDENTIFIER' && token.value === 'as' && !options.keepImports) {
420
+ const isFrom = gnextToken(i, 3, tokens);
421
+ const isInImport = tokens[i-2];
422
+ if(isFrom?.token.value == 'from' && isInImport?.value !== '*'){
423
+ insertTokenAt(tokens, i, { type: 'WHITESPACE', value: ' ' });
424
+ insertTokenAt(tokens, i, { type: 'OTHER', value: '*' });
425
+ insertTokenAt(tokens, i, { type: 'WHITESPACE', value: ' ' });
426
+ insertTokenAt(tokens, i, { type: 'IDENTIFIER', value: 'import' });
427
+ i -= 1;
428
+ continue;
429
+ }
430
+ }
431
+
412
432
  if (token.type === 'IDENTIFIER' && token.value === 'import' && !options.keepImports) {
413
433
  // console.log(nextToken.type);
414
434
  straceLog('IMPORT()');
@@ -441,8 +461,8 @@ function compileRewStuff(content, options) {
441
461
  }
442
462
  } else if (nextToken.value === '*') {
443
463
  const asToken = fnextToken(ind, tokens, 'IDENTIFIER', 'as');
444
- const nameToken = fnextToken(asToken.ri, tokens, 'STRING');
445
464
  if (asToken) {
465
+ const nameToken = fnextToken(asToken.ti, tokens, 'STRING');
446
466
  const nextToken = fnextToken(asToken.ti + 1, tokens, 'IDENTIFIER');
447
467
  defaultName = nextToken.value;
448
468
  straceLog('==>', defaultName, 'from', nameToken.value);
@@ -36,7 +36,8 @@ module.exports.runPath = function runPath(filepath, options = {}, custom_context
36
36
 
37
37
  if(context.app){
38
38
  const p = path.join(CONFIG_PATH, context.app.config.manifest.package, 'app');
39
- if(existsSync(p) && context.app.path !== p){
39
+ const p2 = path.join(CONFIG_PATH, context.app.config.manifest.package, 'app/.allow');
40
+ if(existsSync(p) && context.app.path !== p && !existsSync(p2)){
40
41
  console.log("App with the same package name has been installed. Conflicts happened. \nTo fix this, change your app's package name or remove the app making the conflict.");
41
42
  return {
42
43
  context: { module: { exports: null } },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@makano/rew",
3
- "version": "1.2.94",
3
+ "version": "1.2.95",
4
4
  "description": "A simple coffescript runtime and app manager",
5
5
  "main": "main.js",
6
6
  "directories": {