@makano/rew 1.1.8 → 1.1.9
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/coffeescript/browser.js +144 -139
- package/lib/coffeescript/cake.js +132 -133
- package/lib/coffeescript/coffeescript.js +437 -381
- package/lib/coffeescript/command.js +806 -724
- package/lib/coffeescript/grammar.js +1908 -2474
- package/lib/coffeescript/helpers.js +509 -473
- package/lib/coffeescript/index.js +228 -215
- package/lib/coffeescript/lexer.js +2282 -1909
- package/lib/coffeescript/nodes.js +9782 -9202
- package/lib/coffeescript/optparse.js +255 -227
- package/lib/coffeescript/parser.js +20305 -1265
- package/lib/coffeescript/register.js +107 -87
- package/lib/coffeescript/repl.js +307 -284
- package/lib/coffeescript/rewriter.js +1389 -1079
- package/lib/coffeescript/scope.js +176 -172
- package/lib/coffeescript/sourcemap.js +242 -227
- package/lib/rew/cli/cli.js +243 -202
- package/lib/rew/cli/log.js +31 -32
- package/lib/rew/cli/run.js +10 -12
- package/lib/rew/cli/utils.js +248 -176
- package/lib/rew/const/config_path.js +2 -3
- package/lib/rew/const/default.js +38 -35
- package/lib/rew/const/files.js +9 -9
- package/lib/rew/const/opt.js +8 -8
- package/lib/rew/css/theme.css +2 -2
- package/lib/rew/functions/core.js +55 -57
- package/lib/rew/functions/curl.js +23 -0
- package/lib/rew/functions/emitter.js +52 -55
- package/lib/rew/functions/exec.js +25 -21
- package/lib/rew/functions/export.js +18 -20
- package/lib/rew/functions/fs.js +55 -54
- package/lib/rew/functions/future.js +29 -21
- package/lib/rew/functions/id.js +8 -9
- package/lib/rew/functions/import.js +116 -110
- package/lib/rew/functions/map.js +13 -16
- package/lib/rew/functions/match.js +35 -26
- package/lib/rew/functions/path.js +8 -8
- package/lib/rew/functions/require.js +32 -33
- package/lib/rew/functions/sleep.js +2 -2
- package/lib/rew/functions/stdout.js +20 -20
- package/lib/rew/functions/types.js +96 -95
- package/lib/rew/html/ui.html +12 -13
- package/lib/rew/html/ui.js +205 -168
- package/lib/rew/main.js +14 -14
- package/lib/rew/misc/findAppInfo.js +14 -14
- package/lib/rew/misc/findAppPath.js +16 -16
- package/lib/rew/misc/seededid.js +9 -11
- package/lib/rew/models/enum.js +12 -12
- package/lib/rew/models/struct.js +30 -32
- package/lib/rew/modules/compiler.js +228 -177
- package/lib/rew/modules/context.js +33 -21
- package/lib/rew/modules/fs.js +10 -10
- package/lib/rew/modules/runtime.js +17 -21
- package/lib/rew/modules/yaml.js +27 -30
- package/lib/rew/pkgs/conf.js +80 -80
- package/lib/rew/pkgs/data.js +12 -7
- package/lib/rew/pkgs/date.js +27 -28
- package/lib/rew/pkgs/env.js +6 -8
- package/lib/rew/pkgs/modules/data/bintree.js +52 -52
- package/lib/rew/pkgs/modules/data/doublylinked.js +85 -85
- package/lib/rew/pkgs/modules/data/linkedList.js +73 -73
- package/lib/rew/pkgs/modules/data/queue.js +19 -20
- package/lib/rew/pkgs/modules/data/stack.js +19 -19
- package/lib/rew/pkgs/modules/threads/worker.js +36 -26
- package/lib/rew/pkgs/modules/ui/classes.js +182 -178
- package/lib/rew/pkgs/pkgs.js +9 -10
- package/lib/rew/pkgs/rune.js +391 -345
- package/lib/rew/pkgs/threads.js +57 -53
- package/lib/rew/pkgs/ui.js +148 -136
- package/package.json +1 -1
package/lib/rew/cli/cli.js
CHANGED
@@ -10,214 +10,255 @@ const { existsSync, readFileSync, writeFileSync, mkdirSync } = require('fs');
|
|
10
10
|
const { log } = require('./log');
|
11
11
|
const { compile } = require('../modules/compiler');
|
12
12
|
const crypto = require('crypto');
|
13
|
+
const { CONFIG_PATH } = require('../const/config_path');
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
(yargs) => {
|
19
|
-
yargs
|
20
|
-
.positional('file', {
|
21
|
-
describe: 'File to run',
|
22
|
-
type: 'string',
|
23
|
-
})
|
24
|
-
.option('watch', {
|
25
|
-
alias: 'w',
|
26
|
-
describe: 'Watch the file for changes',
|
27
|
-
type: 'boolean',
|
28
|
-
});
|
29
|
-
},
|
30
|
-
(argv) => {
|
31
|
-
const filePath = path.resolve(process.cwd(), argv.file);
|
32
|
-
if (!existsSync(filePath)) {
|
33
|
-
log('File not found:', argv.file, ':end');
|
34
|
-
return;
|
35
|
-
}
|
36
|
-
const watching = [];
|
37
|
-
const watchIt = (file) => {
|
38
|
-
if (watching.includes(file)) return;
|
39
|
-
watch(file).on('change', () => runIt());
|
40
|
-
watching.push(file);
|
41
|
-
}
|
42
|
-
let prevFork;
|
43
|
-
const runIt = () => {
|
44
|
-
if (argv.watch) console.clear();
|
45
|
-
if (prevFork && !prevFork.killed) prevFork.kill?.();
|
46
|
-
prevFork = fork(path.resolve(__dirname, './run.js'))
|
47
|
-
.on('message', (data) => {
|
48
|
-
if (argv.watch) {
|
49
|
-
data.forEach(file => {
|
50
|
-
watchIt(file);
|
51
|
-
});
|
52
|
-
}
|
53
|
-
}).send({ filePath, watch: argv.watch });
|
54
|
-
if (argv.watch) watchIt(filePath);
|
55
|
-
}
|
56
|
-
runIt();
|
57
|
-
}
|
58
|
-
)
|
59
|
-
.command(
|
60
|
-
'conf <command> [path] [key] [value]',
|
61
|
-
'Configuration management',
|
62
|
-
(yargs) => {
|
63
|
-
yargs
|
64
|
-
.positional('command', {
|
65
|
-
describe: 'Configuration command (get, set, remove)',
|
66
|
-
type: 'string',
|
67
|
-
choices: ['get', 'set', 'remove'],
|
68
|
-
})
|
69
|
-
.positional('path', {
|
70
|
-
describe: 'Configuration path',
|
71
|
-
type: 'string',
|
72
|
-
default: '',
|
73
|
-
})
|
74
|
-
.positional('key', {
|
75
|
-
describe: 'Key to get/set/remove',
|
76
|
-
type: 'string',
|
77
|
-
default: '',
|
78
|
-
})
|
79
|
-
.positional('value', {
|
80
|
-
describe: 'Value to set (only used with "set" command)',
|
81
|
-
type: 'string',
|
82
|
-
default: '',
|
83
|
-
});
|
84
|
-
},
|
85
|
-
(argv) => {
|
86
|
-
const { command, path, key, value } = argv;
|
87
|
-
const result = utils.conf(command, path, key, value);
|
88
|
-
if (result) console.log(result);
|
89
|
-
}
|
90
|
-
)
|
91
|
-
.command('create <path>', 'Create a new project', (yargs) => {
|
92
|
-
yargs
|
93
|
-
.positional('path', {
|
94
|
-
describe: 'Path of the project to create',
|
95
|
-
type: 'string',
|
96
|
-
});
|
97
|
-
},
|
98
|
-
(argv) => {
|
99
|
-
utils.createProject(argv.path);
|
100
|
-
}
|
101
|
-
)
|
102
|
-
.command('rune-keygen <secret>', 'Generate a rune encryption key', (yargs) => {
|
103
|
-
yargs.option('secret', {
|
104
|
-
describe: 'Secret used to generate encryption key',
|
105
|
-
type: 'string'
|
106
|
-
});
|
107
|
-
}, (argv) => {
|
108
|
-
const generateEncryptionKey = (secret) => {
|
109
|
-
if (secret) {
|
110
|
-
return crypto.createHash('sha256').update(secret).digest('hex');
|
111
|
-
} else {
|
112
|
-
return crypto.randomBytes(32).toString('hex');
|
113
|
-
}
|
114
|
-
};
|
115
|
-
|
116
|
-
const encryptionKey = generateEncryptionKey(argv.secret);
|
117
|
-
console.log('Encryption Key:', encryptionKey);
|
118
|
-
})
|
119
|
-
.command('ui-bin <path>', 'Build the UI bin for your own app', (yargs) => {
|
120
|
-
yargs
|
121
|
-
.positional('path', {
|
122
|
-
describe: 'Path of the output bin',
|
123
|
-
type: 'string',
|
124
|
-
});
|
125
|
-
},
|
126
|
-
(argv) => {
|
127
|
-
execSync('sh ' + path.resolve(__dirname, '../../../build.sh') + ' ' + argv.path);
|
128
|
-
}
|
129
|
-
)
|
130
|
-
.command('run <path | package>', 'Run an app', (yargs) => {
|
131
|
-
yargs
|
132
|
-
.positional('path', {
|
133
|
-
describe: 'Path of the app to run',
|
134
|
-
type: 'string',
|
135
|
-
});
|
136
|
-
},
|
137
|
-
(argv) => {
|
138
|
-
utils.runApp(argv.path);
|
139
|
-
}
|
140
|
-
)
|
141
|
-
.command('install <path>', 'Install an app', (yargs) => {
|
142
|
-
yargs
|
143
|
-
.positional('path', {
|
144
|
-
describe: 'Path of the app to install',
|
145
|
-
type: 'string',
|
146
|
-
});
|
147
|
-
},
|
148
|
-
async (argv) => {
|
149
|
-
if (argv.path.startsWith('github:')) utils.installApp(await utils.cloneGit(argv.path), true, true);
|
150
|
-
else utils.installApp(argv.path);
|
151
|
-
}
|
152
|
-
)
|
153
|
-
.command('build <file>', 'Build the specified file', (yargs) => {
|
154
|
-
yargs
|
155
|
-
.positional('file', {
|
156
|
-
describe: 'File to build',
|
157
|
-
type: 'string',
|
158
|
-
})
|
159
|
-
.option('output', {
|
160
|
-
alias: 'o',
|
161
|
-
describe: 'Output directory',
|
162
|
-
type: 'string',
|
163
|
-
});
|
164
|
-
}, (argv) => {
|
15
|
+
if(!existsSync(CONFIG_PATH)){
|
16
|
+
mkdirSync(CONFIG_PATH, { recursive: true });
|
17
|
+
utils.initFirst();
|
18
|
+
}
|
165
19
|
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
20
|
+
yargs(hideBin(process.argv))
|
21
|
+
.command(
|
22
|
+
'$0 <file>',
|
23
|
+
'Run the specified file',
|
24
|
+
(yargs) => {
|
25
|
+
yargs
|
26
|
+
.positional('file', {
|
27
|
+
describe: 'File to run',
|
28
|
+
type: 'string',
|
29
|
+
})
|
30
|
+
.option('watch', {
|
31
|
+
alias: 'w',
|
32
|
+
describe: 'Watch the file for changes',
|
33
|
+
type: 'boolean',
|
34
|
+
});
|
35
|
+
},
|
36
|
+
(argv) => {
|
37
|
+
const filePath = path.resolve(process.cwd(), argv.file);
|
38
|
+
if (!existsSync(filePath)) {
|
39
|
+
log('File not found:', argv.file, ':end');
|
40
|
+
return;
|
41
|
+
}
|
42
|
+
const watching = [];
|
43
|
+
const watchIt = (file) => {
|
44
|
+
if (watching.includes(file)) return;
|
45
|
+
watch(file).on('change', () => runIt());
|
46
|
+
watching.push(file);
|
47
|
+
};
|
48
|
+
let prevFork;
|
49
|
+
const runIt = () => {
|
50
|
+
if (argv.watch) console.clear();
|
51
|
+
if (prevFork && !prevFork.killed) prevFork.kill?.();
|
52
|
+
prevFork = fork(path.resolve(__dirname, './run.js'))
|
53
|
+
.on('message', (data) => {
|
54
|
+
if (argv.watch) {
|
55
|
+
data.forEach((file) => {
|
56
|
+
watchIt(file);
|
57
|
+
});
|
58
|
+
}
|
59
|
+
})
|
60
|
+
.send({ filePath, watch: argv.watch });
|
61
|
+
if (argv.watch) watchIt(filePath);
|
62
|
+
};
|
63
|
+
runIt();
|
64
|
+
},
|
65
|
+
)
|
66
|
+
.command(
|
67
|
+
'conf <command> [path] [key] [value]',
|
68
|
+
'Configuration management',
|
69
|
+
(yargs) => {
|
70
|
+
yargs
|
71
|
+
.positional('command', {
|
72
|
+
describe: 'Configuration command (get, set, remove)',
|
73
|
+
type: 'string',
|
74
|
+
choices: ['get', 'set', 'remove'],
|
75
|
+
})
|
76
|
+
.positional('path', {
|
77
|
+
describe: 'Configuration path',
|
78
|
+
type: 'string',
|
79
|
+
default: '',
|
80
|
+
})
|
81
|
+
.positional('key', {
|
82
|
+
describe: 'Key to get/set/remove',
|
83
|
+
type: 'string',
|
84
|
+
default: '',
|
85
|
+
})
|
86
|
+
.positional('value', {
|
87
|
+
describe: 'Value to set (only used with "set" command)',
|
88
|
+
type: 'string',
|
89
|
+
default: '',
|
90
|
+
});
|
91
|
+
},
|
92
|
+
(argv) => {
|
93
|
+
const { command, path, key, value } = argv;
|
94
|
+
const result = utils.conf(command, path, key, value);
|
95
|
+
if (result) console.log(result);
|
96
|
+
},
|
97
|
+
)
|
98
|
+
.command(
|
99
|
+
'create <path>',
|
100
|
+
'Create a new project',
|
101
|
+
(yargs) => {
|
102
|
+
yargs.positional('path', {
|
103
|
+
describe: 'Path of the project to create',
|
104
|
+
type: 'string',
|
105
|
+
});
|
106
|
+
},
|
107
|
+
(argv) => {
|
108
|
+
utils.createProject(argv.path);
|
109
|
+
},
|
110
|
+
)
|
111
|
+
.command(
|
112
|
+
'rune-keygen <secret>',
|
113
|
+
'Generate a rune encryption key',
|
114
|
+
(yargs) => {
|
115
|
+
yargs.option('secret', {
|
116
|
+
describe: 'Secret used to generate encryption key',
|
117
|
+
type: 'string',
|
118
|
+
});
|
119
|
+
},
|
120
|
+
(argv) => {
|
121
|
+
const generateEncryptionKey = (secret) => {
|
122
|
+
if (secret) {
|
123
|
+
return crypto.createHash('sha256').update(secret).digest('hex');
|
124
|
+
} else {
|
125
|
+
return crypto.randomBytes(32).toString('hex');
|
126
|
+
}
|
127
|
+
};
|
179
128
|
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
129
|
+
const encryptionKey = generateEncryptionKey(argv.secret);
|
130
|
+
console.log('Encryption Key:', encryptionKey);
|
131
|
+
},
|
132
|
+
)
|
133
|
+
.command(
|
134
|
+
'ui-bin <path>',
|
135
|
+
'Build the UI bin for your own app',
|
136
|
+
(yargs) => {
|
137
|
+
yargs.positional('path', {
|
138
|
+
describe: 'Path of the output bin',
|
139
|
+
type: 'string',
|
140
|
+
});
|
141
|
+
},
|
142
|
+
(argv) => {
|
143
|
+
execSync('sh ' + path.resolve(__dirname, '../../../build.sh') + ' ' + argv.path);
|
144
|
+
},
|
145
|
+
)
|
146
|
+
.command(
|
147
|
+
'run <path | package>',
|
148
|
+
'Run an app',
|
149
|
+
(yargs) => {
|
150
|
+
yargs.positional('path', {
|
151
|
+
describe: 'Path of the app to run',
|
152
|
+
type: 'string',
|
153
|
+
});
|
154
|
+
},
|
155
|
+
(argv) => {
|
156
|
+
utils.runApp(argv.path);
|
157
|
+
},
|
158
|
+
)
|
159
|
+
.command(
|
160
|
+
'install <path>',
|
161
|
+
'Install an app',
|
162
|
+
(yargs) => {
|
163
|
+
yargs.positional('path', {
|
164
|
+
describe: 'Path of the app to install',
|
165
|
+
type: 'string',
|
166
|
+
});
|
167
|
+
},
|
168
|
+
async (argv) => {
|
169
|
+
utils.installAppFrom(argv.path);
|
170
|
+
},
|
171
|
+
)
|
172
|
+
.command(
|
173
|
+
'repo <command> [name] [url]',
|
174
|
+
'Manage install repositories',
|
175
|
+
(yargs) => {
|
176
|
+
yargs.positional('command', {
|
177
|
+
describe: 'Command to add/remove/set',
|
178
|
+
type: 'string',
|
179
|
+
});
|
180
|
+
yargs.positional('name', {
|
181
|
+
describe: 'name of the repo',
|
182
|
+
type: 'string',
|
183
|
+
});
|
184
|
+
yargs.positional('url', {
|
185
|
+
describe: 'url of the repo',
|
186
|
+
type: 'string',
|
187
|
+
});
|
188
|
+
},
|
189
|
+
async (argv) => {
|
190
|
+
utils.repo(argv.command, argv.name, argv.url);
|
191
|
+
},
|
192
|
+
)
|
193
|
+
.command(
|
194
|
+
'build <file>',
|
195
|
+
'Build the specified file',
|
196
|
+
(yargs) => {
|
197
|
+
yargs
|
198
|
+
.positional('file', {
|
199
|
+
describe: 'File to build',
|
200
|
+
type: 'string',
|
201
|
+
})
|
202
|
+
.option('output', {
|
203
|
+
alias: 'o',
|
204
|
+
describe: 'Output directory',
|
205
|
+
type: 'string',
|
206
|
+
});
|
207
|
+
},
|
208
|
+
(argv) => {
|
209
|
+
function readFile(filePath) {
|
210
|
+
return readFileSync(filePath, { encoding: 'utf-8' });
|
211
|
+
}
|
188
212
|
|
189
|
-
|
190
|
-
|
191
|
-
|
213
|
+
function extractImports(content) {
|
214
|
+
const importRegex = /(\w+)\s*=\s*imp\s*['"](.+?)['"]/g;
|
215
|
+
const imports = [];
|
216
|
+
let match;
|
217
|
+
while ((match = importRegex.exec(content)) !== null) {
|
218
|
+
imports.push({ variable: match[1], url: match[2] });
|
219
|
+
}
|
220
|
+
return imports;
|
221
|
+
}
|
192
222
|
|
193
|
-
|
194
|
-
|
195
|
-
|
223
|
+
function writeCompiledFile(filePath, compiledCode) {
|
224
|
+
const dirName = outputDir ? outputDir : path.dirname(filePath);
|
225
|
+
if (!existsSync(dirName)) mkdirSync(dirName, { recursive: true });
|
226
|
+
const baseName = path.basename(filePath, path.extname(filePath));
|
227
|
+
const newFilePath = path.join(dirName, `${baseName}.js`);
|
228
|
+
writeFileSync(newFilePath, compiledCode, { encoding: 'utf-8' });
|
229
|
+
log(`Compiled: ${newFilePath}`);
|
230
|
+
}
|
196
231
|
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
} else if (existsSync(importedFilePath + '.coffee')) {
|
201
|
-
importsArray.push(importStatement);
|
202
|
-
processFile(importedFilePath + '.coffee', importsArray);
|
203
|
-
} else if (existsSync(importedFilePath + '.js')) {
|
204
|
-
importsArray.push(importStatement);
|
205
|
-
processFile(importedFilePath + '.js', importsArray);
|
206
|
-
}
|
232
|
+
function processFile(filePath, importsArray) {
|
233
|
+
const content = readFile(filePath);
|
234
|
+
const imports = extractImports(content);
|
207
235
|
|
208
|
-
|
209
|
-
|
236
|
+
imports.forEach((importStatement) => {
|
237
|
+
const importedFilePath = path.resolve(path.dirname(filePath), importStatement.url);
|
238
|
+
if (!importsArray.some((importObj) => importObj.url === importStatement.url)) {
|
239
|
+
if (existsSync(importedFilePath)) {
|
240
|
+
importsArray.push(importStatement);
|
241
|
+
processFile(importedFilePath, importsArray);
|
242
|
+
} else if (existsSync(importedFilePath + '.coffee')) {
|
243
|
+
importsArray.push(importStatement);
|
244
|
+
processFile(importedFilePath + '.coffee', importsArray);
|
245
|
+
} else if (existsSync(importedFilePath + '.js')) {
|
246
|
+
importsArray.push(importStatement);
|
247
|
+
processFile(importedFilePath + '.js', importsArray);
|
248
|
+
}
|
249
|
+
}
|
250
|
+
});
|
210
251
|
|
211
|
-
|
212
|
-
|
213
|
-
|
252
|
+
const compiled = compile({ content }, {});
|
253
|
+
writeCompiledFile(filePath, compiled);
|
254
|
+
}
|
214
255
|
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
256
|
+
const filePath = path.resolve(process.cwd(), argv.file);
|
257
|
+
const importsArray = [];
|
258
|
+
const outputDir = argv.output ? path.resolve(process.cwd(), argv.output) : null;
|
259
|
+
log('Start compile at', outputDir || 'default path');
|
260
|
+
processFile(filePath, importsArray);
|
261
|
+
log('Compiled', importsArray.length + 1, 'files.', ':end');
|
262
|
+
},
|
263
|
+
)
|
264
|
+
.help().argv;
|
package/lib/rew/cli/log.js
CHANGED
@@ -1,40 +1,39 @@
|
|
1
|
-
|
2
1
|
let start = true;
|
3
|
-
const startPrefix =
|
2
|
+
const startPrefix = '╭';
|
4
3
|
const middlePrefix = '├';
|
5
|
-
const separator =
|
6
|
-
const endPrefix =
|
4
|
+
const separator = '│';
|
5
|
+
const endPrefix = '╰';
|
7
6
|
|
8
|
-
const log = module.exports.log = function(...toPrint){
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
}
|
7
|
+
const log = (module.exports.log = function (...toPrint) {
|
8
|
+
let prefix = start ? startPrefix : middlePrefix;
|
9
|
+
let returns = false;
|
10
|
+
if (toPrint[toPrint.length - 1] == ':end') {
|
11
|
+
prefix = endPrefix;
|
12
|
+
toPrint.pop();
|
13
|
+
}
|
14
|
+
if (toPrint[toPrint.length - 1] == ':returns') {
|
15
|
+
returns = true;
|
16
|
+
toPrint.pop();
|
17
|
+
}
|
18
|
+
if (prefix == endPrefix && start) prefix = separator;
|
19
|
+
if (!start) console.log(separator);
|
20
|
+
if (start) start = false;
|
21
|
+
if (returns) return [prefix, ...toPrint].join(' ');
|
22
|
+
else console.log(prefix, ...toPrint);
|
23
|
+
});
|
25
24
|
|
26
|
-
module.exports.logget = function(...toPrint){
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
}
|
25
|
+
module.exports.logget = function (...toPrint) {
|
26
|
+
let args = [...toPrint];
|
27
|
+
if (toPrint[toPrint.length - 1] == ':end') {
|
28
|
+
let l = args.pop();
|
29
|
+
args.push(':returns', l);
|
30
|
+
} else {
|
31
|
+
args.push(':returns');
|
32
|
+
}
|
33
|
+
return log(...args);
|
34
|
+
};
|
36
35
|
|
37
36
|
log.startPrefix = startPrefix;
|
38
37
|
log.middlePrefix = middlePrefix;
|
39
38
|
log.separator = separator;
|
40
|
-
log.endPrefix = endPrefix;
|
39
|
+
log.endPrefix = endPrefix;
|
package/lib/rew/cli/run.js
CHANGED
@@ -1,17 +1,15 @@
|
|
1
1
|
const { run } = require('../main');
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
return run(filePath)
|
6
|
-
.context.module.imports;
|
3
|
+
function exec(filePath) {
|
4
|
+
return run(filePath).context.module.imports;
|
7
5
|
}
|
8
6
|
|
9
7
|
const onmsg = ({ filePath, watch }) => {
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
}
|
16
|
-
|
17
|
-
process.on('message', onmsg);
|
8
|
+
const imports = exec(filePath);
|
9
|
+
if (watch) {
|
10
|
+
process.send(imports);
|
11
|
+
}
|
12
|
+
process.off('message', onmsg);
|
13
|
+
};
|
14
|
+
|
15
|
+
process.on('message', onmsg);
|