@makano/rew 1.0.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.
Files changed (58) hide show
  1. package/bin/rew +9 -0
  2. package/bin/ui +0 -0
  3. package/bin/webkit_app +0 -0
  4. package/lib/coffeescript/browser.js +151 -0
  5. package/lib/coffeescript/cake.js +135 -0
  6. package/lib/coffeescript/coffeescript.js +409 -0
  7. package/lib/coffeescript/command.js +750 -0
  8. package/lib/coffeescript/grammar.js +2496 -0
  9. package/lib/coffeescript/helpers.js +477 -0
  10. package/lib/coffeescript/index.js +217 -0
  11. package/lib/coffeescript/lexer.js +1943 -0
  12. package/lib/coffeescript/nodes.js +9204 -0
  13. package/lib/coffeescript/optparse.js +230 -0
  14. package/lib/coffeescript/parser.js +1344 -0
  15. package/lib/coffeescript/register.js +100 -0
  16. package/lib/coffeescript/repl.js +305 -0
  17. package/lib/coffeescript/rewriter.js +1138 -0
  18. package/lib/coffeescript/scope.js +187 -0
  19. package/lib/coffeescript/sourcemap.js +229 -0
  20. package/lib/rew/cli/cli.js +117 -0
  21. package/lib/rew/cli/log.js +40 -0
  22. package/lib/rew/cli/run.js +20 -0
  23. package/lib/rew/cli/utils.js +122 -0
  24. package/lib/rew/const/default.js +35 -0
  25. package/lib/rew/const/files.js +15 -0
  26. package/lib/rew/css/theme.css +3 -0
  27. package/lib/rew/functions/core.js +85 -0
  28. package/lib/rew/functions/emitter.js +57 -0
  29. package/lib/rew/functions/export.js +9 -0
  30. package/lib/rew/functions/future.js +22 -0
  31. package/lib/rew/functions/id.js +13 -0
  32. package/lib/rew/functions/import.js +57 -0
  33. package/lib/rew/functions/map.js +17 -0
  34. package/lib/rew/functions/match.js +34 -0
  35. package/lib/rew/functions/sleep.js +5 -0
  36. package/lib/rew/functions/types.js +96 -0
  37. package/lib/rew/html/ui.html +223 -0
  38. package/lib/rew/main.js +17 -0
  39. package/lib/rew/models/enum.js +14 -0
  40. package/lib/rew/models/struct.js +41 -0
  41. package/lib/rew/modules/compiler.js +17 -0
  42. package/lib/rew/modules/context.js +50 -0
  43. package/lib/rew/modules/fs.js +19 -0
  44. package/lib/rew/modules/runtime.js +24 -0
  45. package/lib/rew/modules/utils.js +0 -0
  46. package/lib/rew/modules/yaml.js +36 -0
  47. package/lib/rew/pkgs/conf.js +92 -0
  48. package/lib/rew/pkgs/data.js +8 -0
  49. package/lib/rew/pkgs/date.js +98 -0
  50. package/lib/rew/pkgs/modules/data/bintree.js +66 -0
  51. package/lib/rew/pkgs/modules/data/doublylinked.js +100 -0
  52. package/lib/rew/pkgs/modules/data/linkedList.js +88 -0
  53. package/lib/rew/pkgs/modules/data/queue.js +28 -0
  54. package/lib/rew/pkgs/modules/data/stack.js +27 -0
  55. package/lib/rew/pkgs/modules/ui/classes.js +171 -0
  56. package/lib/rew/pkgs/pkgs.js +13 -0
  57. package/lib/rew/pkgs/ui.js +108 -0
  58. package/package.json +41 -0
@@ -0,0 +1,187 @@
1
+ // Generated by CoffeeScript 2.7.0
2
+ (function() {
3
+ // The **Scope** class regulates lexical scoping within CoffeeScript. As you
4
+ // generate code, you create a tree of scopes in the same shape as the nested
5
+ // function bodies. Each scope knows about the variables declared within it,
6
+ // and has a reference to its parent enclosing scope. In this way, we know which
7
+ // variables are new and need to be declared with `var`, and which are shared
8
+ // with external scopes.
9
+ var Scope,
10
+ indexOf = [].indexOf;
11
+
12
+ exports.Scope = Scope = class Scope {
13
+ // Initialize a scope with its parent, for lookups up the chain,
14
+ // as well as a reference to the **Block** node it belongs to, which is
15
+ // where it should declare its variables, a reference to the function that
16
+ // it belongs to, and a list of variables referenced in the source code
17
+ // and therefore should be avoided when generating variables. Also track comments
18
+ // that should be output as part of variable declarations.
19
+ constructor(parent, expressions, method, referencedVars) {
20
+ var ref, ref1;
21
+ this.parent = parent;
22
+ this.expressions = expressions;
23
+ this.method = method;
24
+ this.referencedVars = referencedVars;
25
+ this.variables = [
26
+ {
27
+ name: 'arguments',
28
+ type: 'arguments'
29
+ }
30
+ ];
31
+ this.comments = {};
32
+ this.positions = {};
33
+ if (!this.parent) {
34
+ this.utilities = {};
35
+ }
36
+ // The `@root` is the top-level **Scope** object for a given file.
37
+ this.root = (ref = (ref1 = this.parent) != null ? ref1.root : void 0) != null ? ref : this;
38
+ }
39
+
40
+ // Adds a new variable or overrides an existing one.
41
+ add(name, type, immediate) {
42
+ if (this.shared && !immediate) {
43
+ return this.parent.add(name, type, immediate);
44
+ }
45
+ if (Object.prototype.hasOwnProperty.call(this.positions, name)) {
46
+ return this.variables[this.positions[name]].type = type;
47
+ } else {
48
+ return this.positions[name] = this.variables.push({name, type}) - 1;
49
+ }
50
+ }
51
+
52
+ // When `super` is called, we need to find the name of the current method we're
53
+ // in, so that we know how to invoke the same method of the parent class. This
54
+ // can get complicated if super is being called from an inner function.
55
+ // `namedMethod` will walk up the scope tree until it either finds the first
56
+ // function object that has a name filled in, or bottoms out.
57
+ namedMethod() {
58
+ var ref;
59
+ if (((ref = this.method) != null ? ref.name : void 0) || !this.parent) {
60
+ return this.method;
61
+ }
62
+ return this.parent.namedMethod();
63
+ }
64
+
65
+ // Look up a variable name in lexical scope, and declare it if it does not
66
+ // already exist.
67
+ find(name, type = 'var') {
68
+ if (this.check(name)) {
69
+ return true;
70
+ }
71
+ this.add(name, type);
72
+ return false;
73
+ }
74
+
75
+ // Reserve a variable name as originating from a function parameter for this
76
+ // scope. No `var` required for internal references.
77
+ parameter(name) {
78
+ if (this.shared && this.parent.check(name, true)) {
79
+ return;
80
+ }
81
+ return this.add(name, 'param');
82
+ }
83
+
84
+ // Just check to see if a variable has already been declared, without reserving,
85
+ // walks up to the root scope.
86
+ check(name) {
87
+ var ref;
88
+ return !!(this.type(name) || ((ref = this.parent) != null ? ref.check(name) : void 0));
89
+ }
90
+
91
+ // Generate a temporary variable name at the given index.
92
+ temporary(name, index, single = false) {
93
+ var diff, endCode, letter, newCode, num, startCode;
94
+ if (single) {
95
+ startCode = name.charCodeAt(0);
96
+ endCode = 'z'.charCodeAt(0);
97
+ diff = endCode - startCode;
98
+ newCode = startCode + index % (diff + 1);
99
+ letter = String.fromCharCode(newCode);
100
+ num = Math.floor(index / (diff + 1));
101
+ return `${letter}${num || ''}`;
102
+ } else {
103
+ return `${name}${index || ''}`;
104
+ }
105
+ }
106
+
107
+ // Gets the type of a variable.
108
+ type(name) {
109
+ var i, len, ref, v;
110
+ ref = this.variables;
111
+ for (i = 0, len = ref.length; i < len; i++) {
112
+ v = ref[i];
113
+ if (v.name === name) {
114
+ return v.type;
115
+ }
116
+ }
117
+ return null;
118
+ }
119
+
120
+ // If we need to store an intermediate result, find an available name for a
121
+ // compiler-generated variable. `_var`, `_var2`, and so on...
122
+ freeVariable(name, options = {}) {
123
+ var index, ref, temp;
124
+ index = 0;
125
+ while (true) {
126
+ temp = this.temporary(name, index, options.single);
127
+ if (!(this.check(temp) || indexOf.call(this.root.referencedVars, temp) >= 0)) {
128
+ break;
129
+ }
130
+ index++;
131
+ }
132
+ if ((ref = options.reserve) != null ? ref : true) {
133
+ this.add(temp, 'var', true);
134
+ }
135
+ return temp;
136
+ }
137
+
138
+ // Ensure that an assignment is made at the top of this scope
139
+ // (or at the top-level scope, if requested).
140
+ assign(name, value) {
141
+ this.add(name, {
142
+ value,
143
+ assigned: true
144
+ }, true);
145
+ return this.hasAssignments = true;
146
+ }
147
+
148
+ // Does this scope have any declared variables?
149
+ hasDeclarations() {
150
+ return !!this.declaredVariables().length;
151
+ }
152
+
153
+ // Return the list of variables first declared in this scope.
154
+ declaredVariables() {
155
+ var v;
156
+ return ((function() {
157
+ var i, len, ref, results;
158
+ ref = this.variables;
159
+ results = [];
160
+ for (i = 0, len = ref.length; i < len; i++) {
161
+ v = ref[i];
162
+ if (v.type === 'var') {
163
+ results.push(v.name);
164
+ }
165
+ }
166
+ return results;
167
+ }).call(this)).sort();
168
+ }
169
+
170
+ // Return the list of assignments that are supposed to be made at the top
171
+ // of this scope.
172
+ assignedVariables() {
173
+ var i, len, ref, results, v;
174
+ ref = this.variables;
175
+ results = [];
176
+ for (i = 0, len = ref.length; i < len; i++) {
177
+ v = ref[i];
178
+ if (v.type.assigned) {
179
+ results.push(`${v.name} = ${v.type.value}`);
180
+ }
181
+ }
182
+ return results;
183
+ }
184
+
185
+ };
186
+
187
+ }).call(this);
@@ -0,0 +1,229 @@
1
+ // Generated by CoffeeScript 2.7.0
2
+ (function() {
3
+ // Source maps allow JavaScript runtimes to match running JavaScript back to
4
+ // the original source code that corresponds to it. This can be minified
5
+ // JavaScript, but in our case, we're concerned with mapping pretty-printed
6
+ // JavaScript back to CoffeeScript.
7
+
8
+ // In order to produce maps, we must keep track of positions (line number, column number)
9
+ // that originated every node in the syntax tree, and be able to generate a
10
+ // [map file](https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit)
11
+ // — which is a compact, VLQ-encoded representation of the JSON serialization
12
+ // of this information — to write out alongside the generated JavaScript.
13
+
14
+ // LineMap
15
+ // -------
16
+
17
+ // A **LineMap** object keeps track of information about original line and column
18
+ // positions for a single line of output JavaScript code.
19
+ // **SourceMaps** are implemented in terms of **LineMaps**.
20
+ var LineMap, SourceMap;
21
+
22
+ LineMap = class LineMap {
23
+ constructor(line1) {
24
+ this.line = line1;
25
+ this.columns = [];
26
+ }
27
+
28
+ add(column, [sourceLine, sourceColumn], options = {}) {
29
+ if (this.columns[column] && options.noReplace) {
30
+ return;
31
+ }
32
+ return this.columns[column] = {
33
+ line: this.line,
34
+ column,
35
+ sourceLine,
36
+ sourceColumn
37
+ };
38
+ }
39
+
40
+ sourceLocation(column) {
41
+ var mapping;
42
+ while (!((mapping = this.columns[column]) || (column <= 0))) {
43
+ column--;
44
+ }
45
+ return mapping && [mapping.sourceLine, mapping.sourceColumn];
46
+ }
47
+
48
+ };
49
+
50
+ SourceMap = (function() {
51
+ var BASE64_CHARS, VLQ_CONTINUATION_BIT, VLQ_SHIFT, VLQ_VALUE_MASK;
52
+
53
+ // SourceMap
54
+ // ---------
55
+
56
+ // Maps locations in a single generated JavaScript file back to locations in
57
+ // the original CoffeeScript source file.
58
+
59
+ // This is intentionally agnostic towards how a source map might be represented on
60
+ // disk. Once the compiler is ready to produce a "v3"-style source map, we can walk
61
+ // through the arrays of line and column buffer to produce it.
62
+ class SourceMap {
63
+ constructor() {
64
+ this.lines = [];
65
+ }
66
+
67
+ // Adds a mapping to this SourceMap. `sourceLocation` and `generatedLocation`
68
+ // are both `[line, column]` arrays. If `options.noReplace` is true, then if there
69
+ // is already a mapping for the specified `line` and `column`, this will have no
70
+ // effect.
71
+ add(sourceLocation, generatedLocation, options = {}) {
72
+ var base, column, line, lineMap;
73
+ [line, column] = generatedLocation;
74
+ lineMap = ((base = this.lines)[line] || (base[line] = new LineMap(line)));
75
+ return lineMap.add(column, sourceLocation, options);
76
+ }
77
+
78
+ // Look up the original position of a given `line` and `column` in the generated
79
+ // code.
80
+ sourceLocation([line, column]) {
81
+ var lineMap;
82
+ while (!((lineMap = this.lines[line]) || (line <= 0))) {
83
+ line--;
84
+ }
85
+ return lineMap && lineMap.sourceLocation(column);
86
+ }
87
+
88
+ static registerCompiled(filename, source, sourcemap) {
89
+ if (sourcemap != null) {
90
+ return SourceMap.sourceMaps[filename] = sourcemap;
91
+ }
92
+ }
93
+
94
+ static getSourceMap(filename) {
95
+ return SourceMap.sourceMaps[filename];
96
+ }
97
+
98
+ // V3 SourceMap Generation
99
+ // -----------------------
100
+
101
+ // Builds up a V3 source map, returning the generated JSON as a string.
102
+ // `options.sourceRoot` may be used to specify the sourceRoot written to the source
103
+ // map. Also, `options.sourceFiles` and `options.generatedFile` may be passed to
104
+ // set "sources" and "file", respectively.
105
+ generate(options = {}, code = null) {
106
+ var buffer, i, j, lastColumn, lastSourceColumn, lastSourceLine, len, len1, lineMap, lineNumber, mapping, needComma, ref, ref1, sources, v3, writingline;
107
+ writingline = 0;
108
+ lastColumn = 0;
109
+ lastSourceLine = 0;
110
+ lastSourceColumn = 0;
111
+ needComma = false;
112
+ buffer = "";
113
+ ref = this.lines;
114
+ for (lineNumber = i = 0, len = ref.length; i < len; lineNumber = ++i) {
115
+ lineMap = ref[lineNumber];
116
+ if (lineMap) {
117
+ ref1 = lineMap.columns;
118
+ for (j = 0, len1 = ref1.length; j < len1; j++) {
119
+ mapping = ref1[j];
120
+ if (!(mapping)) {
121
+ continue;
122
+ }
123
+ while (writingline < mapping.line) {
124
+ lastColumn = 0;
125
+ needComma = false;
126
+ buffer += ";";
127
+ writingline++;
128
+ }
129
+ // Write a comma if we've already written a segment on this line.
130
+ if (needComma) {
131
+ buffer += ",";
132
+ needComma = false;
133
+ }
134
+ // Write the next segment. Segments can be 1, 4, or 5 values. If just one, then it
135
+ // is a generated column which doesn't match anything in the source code.
136
+
137
+ // The starting column in the generated source, relative to any previous recorded
138
+ // column for the current line:
139
+ buffer += this.encodeVlq(mapping.column - lastColumn);
140
+ lastColumn = mapping.column;
141
+ // The index into the list of sources:
142
+ buffer += this.encodeVlq(0);
143
+ // The starting line in the original source, relative to the previous source line.
144
+ buffer += this.encodeVlq(mapping.sourceLine - lastSourceLine);
145
+ lastSourceLine = mapping.sourceLine;
146
+ // The starting column in the original source, relative to the previous column.
147
+ buffer += this.encodeVlq(mapping.sourceColumn - lastSourceColumn);
148
+ lastSourceColumn = mapping.sourceColumn;
149
+ needComma = true;
150
+ }
151
+ }
152
+ }
153
+ // Produce the canonical JSON object format for a "v3" source map.
154
+ sources = options.sourceFiles ? options.sourceFiles : options.filename ? [options.filename] : ['<anonymous>'];
155
+ v3 = {
156
+ version: 3,
157
+ file: options.generatedFile || '',
158
+ sourceRoot: options.sourceRoot || '',
159
+ sources: sources,
160
+ names: [],
161
+ mappings: buffer
162
+ };
163
+ if (options.sourceMap || options.inlineMap) {
164
+ v3.sourcesContent = [code];
165
+ }
166
+ return v3;
167
+ }
168
+
169
+ encodeVlq(value) {
170
+ var answer, nextChunk, signBit, valueToEncode;
171
+ answer = '';
172
+ // Least significant bit represents the sign.
173
+ signBit = value < 0 ? 1 : 0;
174
+ // The next bits are the actual value.
175
+ valueToEncode = (Math.abs(value) << 1) + signBit;
176
+ // Make sure we encode at least one character, even if valueToEncode is 0.
177
+ while (valueToEncode || !answer) {
178
+ nextChunk = valueToEncode & VLQ_VALUE_MASK;
179
+ valueToEncode = valueToEncode >> VLQ_SHIFT;
180
+ if (valueToEncode) {
181
+ nextChunk |= VLQ_CONTINUATION_BIT;
182
+ }
183
+ answer += this.encodeBase64(nextChunk);
184
+ }
185
+ return answer;
186
+ }
187
+
188
+ encodeBase64(value) {
189
+ return BASE64_CHARS[value] || (function() {
190
+ throw new Error(`Cannot Base64 encode value: ${value}`);
191
+ })();
192
+ }
193
+
194
+ };
195
+
196
+ // Caching
197
+ // -------
198
+
199
+ // A static source maps cache `filename`: `map`. These are used for transforming
200
+ // stack traces and are currently set in `CoffeeScript.compile` for all files
201
+ // compiled with the source maps option.
202
+ SourceMap.sourceMaps = Object.create(null);
203
+
204
+ // Base64 VLQ Encoding
205
+ // -------------------
206
+
207
+ // Note that SourceMap VLQ encoding is "backwards". MIDI-style VLQ encoding puts
208
+ // the most-significant-bit (MSB) from the original value into the MSB of the VLQ
209
+ // encoded value (see [Wikipedia](https://en.wikipedia.org/wiki/File:Uintvar_coding.svg)).
210
+ // SourceMap VLQ does things the other way around, with the least significat four
211
+ // bits of the original value encoded into the first byte of the VLQ encoded value.
212
+ VLQ_SHIFT = 5;
213
+
214
+ VLQ_CONTINUATION_BIT = 1 << VLQ_SHIFT; // 0010 0000
215
+
216
+ VLQ_VALUE_MASK = VLQ_CONTINUATION_BIT - 1; // 0001 1111
217
+
218
+ // Regular Base64 Encoding
219
+ // -----------------------
220
+ BASE64_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
221
+
222
+ return SourceMap;
223
+
224
+ }).call(this);
225
+
226
+ // Our API for source maps is just the `SourceMap` class.
227
+ module.exports = SourceMap;
228
+
229
+ }).call(this);
@@ -0,0 +1,117 @@
1
+ #!/usr/bin/env node
2
+
3
+ const yargs = require('yargs/yargs');
4
+ const path = require('path');
5
+ const { hideBin } = require('yargs/helpers');
6
+ const { fork } = require('child_process');
7
+ const { watch } = require('chokidar');
8
+ const utils = require('./utils');
9
+
10
+ yargs(hideBin(process.argv))
11
+ .command(
12
+ '$0 <file>',
13
+ 'Run the specified file',
14
+ (yargs) => {
15
+ yargs
16
+ .positional('file', {
17
+ describe: 'File to run',
18
+ type: 'string',
19
+ })
20
+ .option('watch', {
21
+ alias: 'w',
22
+ describe: 'Watch the file for changes',
23
+ type: 'boolean',
24
+ });
25
+ },
26
+ (argv) => {
27
+ const filePath = path.resolve(process.cwd(), argv.file);
28
+ const watching = [];
29
+ const watchIt = (file) => {
30
+ if(watching.includes(file)) return;
31
+ watch(file).on('change', () => runIt());
32
+ watching.push(file);
33
+ }
34
+ let prevFork;
35
+ const runIt = () => {
36
+ if(argv.watch) console.clear();
37
+ if(prevFork && !prevFork.killed) prevFork.kill?.();
38
+ prevFork = fork(path.resolve(__dirname, './run.js'))
39
+ .on('message', (data) => {
40
+ if(argv.watch){
41
+ data.forEach(file => {
42
+ watchIt(file);
43
+ });
44
+ } else {
45
+ process.exit();
46
+ }
47
+ }).send({ filePath, watch: argv.watch });
48
+ if(argv.watch) watchIt(filePath);
49
+ }
50
+ runIt();
51
+ }
52
+ )
53
+ .command(
54
+ 'conf <command> [path] [key] [value]',
55
+ 'Configuration management',
56
+ (yargs) => {
57
+ yargs
58
+ .positional('command', {
59
+ describe: 'Configuration command (get, set, remove)',
60
+ type: 'string',
61
+ choices: ['get', 'set', 'remove'],
62
+ })
63
+ .positional('path', {
64
+ describe: 'Configuration path',
65
+ type: 'string',
66
+ default: '',
67
+ })
68
+ .positional('key', {
69
+ describe: 'Key to get/set/remove',
70
+ type: 'string',
71
+ default: '',
72
+ })
73
+ .positional('value', {
74
+ describe: 'Value to set (only used with "set" command)',
75
+ type: 'string',
76
+ default: '',
77
+ });
78
+ },
79
+ (argv) => {
80
+ const { command, path, key, value } = argv;
81
+ const result = utils.conf(command, path, key, value);
82
+ if(result) console.log(result);
83
+ }
84
+ )
85
+ .command('create <path>', 'Create a new project', (yargs) => {
86
+ yargs
87
+ .positional('path', {
88
+ describe: 'Path of the project to create',
89
+ type: 'string',
90
+ });
91
+ },
92
+ (argv) => {
93
+ utils.createProject(argv.path);
94
+ }
95
+ )
96
+ .command('run <path | package>', 'Run an app', (yargs) => {
97
+ yargs
98
+ .positional('path', {
99
+ describe: 'Path of the app to run',
100
+ type: 'string',
101
+ });
102
+ },
103
+ (argv) => {
104
+ utils.runApp(argv.path);
105
+ }
106
+ )
107
+ .command('build <file>', 'Build the specified file', (yargs) => {
108
+ yargs
109
+ .positional('file', {
110
+ describe: 'File to build',
111
+ type: 'string',
112
+ });
113
+ }, (argv) => {
114
+ console.log(`Building file: ${argv.file}`);
115
+ })
116
+ .help()
117
+ .argv;
@@ -0,0 +1,40 @@
1
+
2
+ let start = true;
3
+ const startPrefix = '╭';
4
+ const middlePrefix = '├';
5
+ const separator = '│';
6
+ const endPrefix = '╰';
7
+
8
+ const log = module.exports.log = function(...toPrint){
9
+ let prefix = start ? startPrefix : middlePrefix;
10
+ let returns = false;
11
+ if(toPrint[toPrint.length-1] == ':end') {
12
+ prefix = endPrefix;
13
+ toPrint.pop();
14
+ }
15
+ if(toPrint[toPrint.length-1] == ':returns') {
16
+ returns = true;
17
+ toPrint.pop();
18
+ }
19
+ if(prefix == endPrefix && start) prefix = separator;
20
+ if(!start) console.log(separator);
21
+ if(start) start = false;
22
+ if(returns) return [prefix, ...toPrint].join(' ');
23
+ else console.log(prefix, ...toPrint);
24
+ }
25
+
26
+ module.exports.logget = function(...toPrint){
27
+ let args = [...toPrint];
28
+ if(toPrint[toPrint.length-1] == ':end') {
29
+ let l = args.pop();
30
+ args.push(':returns', l);
31
+ } else {
32
+ args.push(':returns');
33
+ }
34
+ return log(...args);
35
+ }
36
+
37
+ log.startPrefix = startPrefix;
38
+ log.middlePrefix = middlePrefix;
39
+ log.separator = separator;
40
+ log.endPrefix = endPrefix;
@@ -0,0 +1,20 @@
1
+ const path = require('path');
2
+ const { run } = require('../main');
3
+ const { watch } = require('fs');
4
+
5
+
6
+ function exec(filePath){
7
+ return run(filePath)
8
+ .context.module.imports;
9
+ }
10
+
11
+
12
+ process.on('message', ({ filePath, watch }) => {
13
+ const imports = exec(filePath);
14
+ if(watch){
15
+ process.send(imports);
16
+ process.exit();
17
+ } else {
18
+ process.exit();
19
+ }
20
+ });