@makano/rew 1.1.81 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- 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 +312 -239
- package/lib/rew/cli/log.js +27 -27
- package/lib/rew/cli/run.js +8 -8
- package/lib/rew/cli/utils.js +368 -199
- package/lib/rew/const/config_path.js +2 -2
- package/lib/rew/const/default.js +38 -53
- package/lib/rew/const/files.js +11 -14
- package/lib/rew/const/opt.js +6 -6
- package/lib/rew/css/theme.css +1 -1
- package/lib/rew/functions/core.js +55 -55
- package/lib/rew/functions/curl.js +23 -0
- package/lib/rew/functions/emitter.js +52 -55
- package/lib/rew/functions/exec.js +25 -25
- package/lib/rew/functions/export.js +17 -17
- package/lib/rew/functions/fs.js +57 -59
- package/lib/rew/functions/future.js +29 -21
- package/lib/rew/functions/id.js +8 -9
- package/lib/rew/functions/import.js +106 -122
- package/lib/rew/functions/map.js +10 -10
- package/lib/rew/functions/match.js +35 -42
- package/lib/rew/functions/path.js +8 -8
- package/lib/rew/functions/require.js +32 -36
- package/lib/rew/functions/sleep.js +2 -2
- package/lib/rew/functions/stdout.js +18 -18
- package/lib/rew/functions/types.js +82 -106
- package/lib/rew/html/ui.html +12 -12
- package/lib/rew/html/ui.js +196 -201
- package/lib/rew/main.js +14 -14
- package/lib/rew/misc/bin.js +37 -0
- package/lib/rew/misc/findAppInfo.js +13 -13
- package/lib/rew/misc/findAppPath.js +15 -15
- package/lib/rew/misc/req.js +7 -0
- package/lib/rew/misc/seededid.js +8 -8
- package/lib/rew/models/enum.js +12 -12
- package/lib/rew/models/struct.js +30 -32
- package/lib/rew/modules/compiler.js +237 -209
- 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 +82 -92
- package/lib/rew/pkgs/data.js +10 -10
- package/lib/rew/pkgs/date.js +27 -27
- package/lib/rew/pkgs/env.js +5 -5
- package/lib/rew/pkgs/modules/data/bintree.js +51 -51
- package/lib/rew/pkgs/modules/data/doublylinked.js +84 -84
- package/lib/rew/pkgs/modules/data/linkedList.js +72 -72
- package/lib/rew/pkgs/modules/data/queue.js +18 -18
- package/lib/rew/pkgs/modules/data/stack.js +18 -18
- package/lib/rew/pkgs/modules/threads/worker.js +36 -36
- package/lib/rew/pkgs/modules/ui/classes.js +181 -184
- package/lib/rew/pkgs/pkgs.js +9 -9
- package/lib/rew/pkgs/rune.js +373 -410
- package/lib/rew/pkgs/threads.js +62 -66
- package/lib/rew/pkgs/ui.js +148 -160
- package/lib/rew/qrew/compile.js +12 -0
- package/package.json +4 -3
@@ -1,98 +1,98 @@
|
|
1
1
|
class DoublyNode {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
constructor(value) {
|
3
|
+
this.value = value;
|
4
|
+
this.next = null;
|
5
|
+
this.prev = null;
|
6
|
+
}
|
7
7
|
}
|
8
8
|
|
9
9
|
class DoublyLinkedList {
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
constructor() {
|
11
|
+
this.head = null;
|
12
|
+
this.tail = null;
|
13
|
+
this.length = 0;
|
14
|
+
}
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
16
|
+
append(value) {
|
17
|
+
const newNode = new DoublyNode(value);
|
18
|
+
if (!this.head) {
|
19
|
+
this.head = newNode;
|
20
|
+
this.tail = newNode;
|
21
|
+
} else {
|
22
|
+
this.tail.next = newNode;
|
23
|
+
newNode.prev = this.tail;
|
24
|
+
this.tail = newNode;
|
25
|
+
}
|
26
|
+
this.length++;
|
27
|
+
}
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
29
|
+
prepend(value) {
|
30
|
+
const newNode = new DoublyNode(value);
|
31
|
+
if (!this.head) {
|
32
|
+
this.head = newNode;
|
33
|
+
this.tail = newNode;
|
34
|
+
} else {
|
35
|
+
newNode.next = this.head;
|
36
|
+
this.head.prev = newNode;
|
37
|
+
this.head = newNode;
|
38
|
+
}
|
39
|
+
this.length++;
|
40
|
+
}
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
42
|
+
find(value) {
|
43
|
+
let current = this.head;
|
44
|
+
while (current) {
|
45
|
+
if (current.value === value) {
|
46
|
+
return current;
|
47
|
+
}
|
48
|
+
current = current.next;
|
49
|
+
}
|
50
|
+
return null;
|
51
|
+
}
|
52
52
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
53
|
+
delete(value) {
|
54
|
+
if (!this.head) {
|
55
|
+
return null;
|
56
|
+
}
|
57
57
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
58
|
+
if (this.head.value === value) {
|
59
|
+
this.head = this.head.next;
|
60
|
+
if (this.head) {
|
61
|
+
this.head.prev = null;
|
62
|
+
} else {
|
63
|
+
this.tail = null;
|
64
|
+
}
|
65
|
+
this.length--;
|
66
|
+
return;
|
67
|
+
}
|
68
68
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
69
|
+
let current = this.head;
|
70
|
+
while (current) {
|
71
|
+
if (current.value === value) {
|
72
|
+
if (current.next) {
|
73
|
+
current.next.prev = current.prev;
|
74
|
+
} else {
|
75
|
+
this.tail = current.prev;
|
76
|
+
}
|
77
|
+
if (current.prev) {
|
78
|
+
current.prev.next = current.next;
|
79
|
+
}
|
80
|
+
this.length--;
|
81
|
+
return;
|
82
|
+
}
|
83
|
+
current = current.next;
|
84
|
+
}
|
85
|
+
}
|
86
86
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
87
|
+
toArray() {
|
88
|
+
const elements = [];
|
89
|
+
let current = this.head;
|
90
|
+
while (current) {
|
91
|
+
elements.push(current.value);
|
92
|
+
current = current.next;
|
93
|
+
}
|
94
|
+
return elements;
|
95
|
+
}
|
96
96
|
}
|
97
97
|
|
98
98
|
DoublyLinkedList.Node = DoublyNode;
|
@@ -1,86 +1,86 @@
|
|
1
1
|
class Node {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
constructor(value) {
|
3
|
+
this.value = value;
|
4
|
+
this.next = null;
|
5
|
+
}
|
6
6
|
}
|
7
7
|
|
8
8
|
class LinkedList {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
constructor() {
|
10
|
+
this.head = null;
|
11
|
+
this.tail = null;
|
12
|
+
this.length = 0;
|
13
|
+
}
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
15
|
+
append(value) {
|
16
|
+
const newNode = new Node(value);
|
17
|
+
if (!this.head) {
|
18
|
+
this.head = newNode;
|
19
|
+
this.tail = newNode;
|
20
|
+
} else {
|
21
|
+
this.tail.next = newNode;
|
22
|
+
this.tail = newNode;
|
23
|
+
}
|
24
|
+
this.length++;
|
25
|
+
}
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
27
|
+
prepend(value) {
|
28
|
+
const newNode = new Node(value);
|
29
|
+
if (!this.head) {
|
30
|
+
this.head = newNode;
|
31
|
+
this.tail = newNode;
|
32
|
+
} else {
|
33
|
+
newNode.next = this.head;
|
34
|
+
this.head = newNode;
|
35
|
+
}
|
36
|
+
this.length++;
|
37
|
+
}
|
38
38
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
39
|
+
find(value) {
|
40
|
+
let current = this.head;
|
41
|
+
while (current) {
|
42
|
+
if (current.value === value) {
|
43
|
+
return current;
|
44
|
+
}
|
45
|
+
current = current.next;
|
46
|
+
}
|
47
|
+
return null;
|
48
|
+
}
|
49
49
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
50
|
+
delete(value) {
|
51
|
+
if (!this.head) {
|
52
|
+
return null;
|
53
|
+
}
|
54
54
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
55
|
+
if (this.head.value === value) {
|
56
|
+
this.head = this.head.next;
|
57
|
+
this.length--;
|
58
|
+
return;
|
59
|
+
}
|
60
60
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
61
|
+
let current = this.head;
|
62
|
+
while (current.next) {
|
63
|
+
if (current.next.value === value) {
|
64
|
+
current.next = current.next.next;
|
65
|
+
if (current.next === null) {
|
66
|
+
this.tail = current;
|
67
|
+
}
|
68
|
+
this.length--;
|
69
|
+
return;
|
70
|
+
}
|
71
|
+
current = current.next;
|
72
|
+
}
|
73
|
+
}
|
74
74
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
75
|
+
toArray() {
|
76
|
+
const elements = [];
|
77
|
+
let current = this.head;
|
78
|
+
while (current) {
|
79
|
+
elements.push(current.value);
|
80
|
+
current = current.next;
|
81
|
+
}
|
82
|
+
return elements;
|
83
|
+
}
|
84
84
|
}
|
85
85
|
|
86
86
|
LinkedList.Node = Node;
|
@@ -1,27 +1,27 @@
|
|
1
1
|
class Queue {
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
constructor() {
|
3
|
+
this.items = [];
|
4
|
+
}
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
enqueue(item) {
|
7
|
+
this.items.push(item);
|
8
|
+
}
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
dequeue() {
|
11
|
+
return this.items.shift();
|
12
|
+
}
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
isEmpty() {
|
15
|
+
return this.items.length === 0;
|
16
|
+
}
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
peek() {
|
19
|
+
return this.items[0];
|
20
|
+
}
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
toArray() {
|
23
|
+
return this.items.slice();
|
24
|
+
}
|
25
25
|
}
|
26
26
|
|
27
27
|
module.exports = { Queue };
|
@@ -1,27 +1,27 @@
|
|
1
1
|
class Stack {
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
constructor() {
|
3
|
+
this.items = [];
|
4
|
+
}
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
push(item) {
|
7
|
+
this.items.push(item);
|
8
|
+
}
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
pop() {
|
11
|
+
return this.items.pop();
|
12
|
+
}
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
isEmpty() {
|
15
|
+
return this.items.length === 0;
|
16
|
+
}
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
peek() {
|
19
|
+
return this.items[this.items.length - 1];
|
20
|
+
}
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
toArray() {
|
23
|
+
return this.items.slice();
|
24
|
+
}
|
25
25
|
}
|
26
26
|
|
27
27
|
module.exports = { Stack };
|
@@ -1,47 +1,47 @@
|
|
1
|
-
const { parentPort, workerData } = require(
|
2
|
-
const { exec } = require(
|
1
|
+
const { parentPort, workerData } = require('worker_threads');
|
2
|
+
const { exec } = require('../../../modules/runtime');
|
3
3
|
|
4
4
|
const target = {};
|
5
5
|
target.events = [];
|
6
6
|
target.on = (e, cb) => {
|
7
|
-
|
7
|
+
target.events.push({ e, cb });
|
8
8
|
};
|
9
9
|
target.off = (e) => {
|
10
|
-
|
10
|
+
target.events = target.events.filter((i) => i.e !== e);
|
11
11
|
};
|
12
12
|
target.emit = (e, data) => {
|
13
|
-
|
13
|
+
target.events.filter((i) => i.e == e).forEach((i) => i.cb(data));
|
14
14
|
};
|
15
15
|
|
16
|
-
parentPort.on(
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
16
|
+
parentPort.on('message', (data) => {
|
17
|
+
if (data.type === 'event') {
|
18
|
+
target.emit(data.event, data.data);
|
19
|
+
} else if (data.type === 'start') {
|
20
|
+
(async () => {
|
21
|
+
try {
|
22
|
+
exec(`(${workerData.cb}).call({ process }, context)`, {
|
23
|
+
print: (...a) => console.log(...a),
|
24
|
+
process: {
|
25
|
+
on: (e, cb) => {
|
26
|
+
target.on(e, cb);
|
27
|
+
},
|
28
|
+
off: (e) => {
|
29
|
+
target.off(e);
|
30
|
+
},
|
31
|
+
emit: (e, data) => {
|
32
|
+
parentPort.postMessage({ type: 'event', event: e, data });
|
33
|
+
},
|
34
|
+
exit: (code) => process.exit(code),
|
35
|
+
finish: (data) => {
|
36
|
+
parentPort.postMessage({ type: 'result', result: data });
|
37
|
+
process.exit(0);
|
38
|
+
},
|
39
|
+
},
|
40
|
+
context: workerData.context,
|
41
|
+
});
|
42
|
+
} catch (e) {
|
43
|
+
parentPort.postMessage({ type: 'error', error: e.message });
|
44
|
+
}
|
45
|
+
})();
|
46
|
+
}
|
47
47
|
});
|