functionalscript 0.1.599 → 0.1.601
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/.github/workflows/npm-publish.yml +2 -0
- package/README.md +20 -9
- package/dev/module.mjs +20 -10
- package/dev/test/module.f.mjs +1 -1
- package/dev/test.mjs +3 -3
- package/djs/README.md +32 -8
- package/funding.json +61 -0
- package/issues/README.md +10 -6
- package/issues/djs.md +57 -0
- package/issues/fs-load.md +13 -0
- package/issues/lang/1000-json.md +12 -0
- package/issues/lang/2110-default-export.md +11 -0
- package/issues/lang/2120-const.md +14 -0
- package/issues/lang/2130-default-import.md +10 -0
- package/issues/lang/2210-block-comment.md +12 -0
- package/issues/lang/2220-namespace-import.md +25 -0
- package/issues/lang/2310-undefined.md +7 -0
- package/issues/lang/2320-bigint.md +7 -0
- package/issues/lang/2330-grouping.md +11 -0
- package/issues/lang/2340-operators.md +41 -0
- package/issues/lang/2351-property-accessor.md +44 -0
- package/issues/lang/2352-property-call.md +43 -0
- package/issues/lang/2353-property-at.md +19 -0
- package/issues/lang/2360-built-in.md +74 -0
- package/issues/lang/2410-identifier-property.md +9 -0
- package/issues/lang/2420-line-comment.md +10 -0
- package/issues/lang/2430-trailing-comma.md +13 -0
- package/issues/lang/2440-shorthand.md +8 -0
- package/issues/lang/2450-destructuring.md +12 -0
- package/issues/lang/3110-function.md +11 -0
- package/issues/lang/3120-parameters.md +9 -0
- package/issues/lang/3130-body-const.md +12 -0
- package/issues/lang/3220-let.md +11 -0
- package/issues/lang/3310-expression.md +12 -0
- package/issues/lang/3320-one-parameter.md +10 -0
- package/issues/lang/3330-assignments.md +23 -0
- package/issues/lang/README.md +80 -0
- package/jsr.json +116 -2
- package/nodejs/version/main.mjs +1 -2
- package/nodejs/version/module.f.d.mts +5 -6
- package/nodejs/version/module.f.mjs +15 -16
- package/nodejs/version/test.f.mjs +45 -36
- package/package.json +2 -1
- package/types/list/test.f.mjs +3 -2
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Built-in Objects and Functions
|
|
2
|
+
|
|
3
|
+
The built-in objects are special. We can get a function, like `Object.getOwnPropertyDescriptor`, but not the `Object` itself.
|
|
4
|
+
|
|
5
|
+
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects
|
|
6
|
+
|
|
7
|
+
Some of the JS built-in objects and functions are "not allowed" in FS. It means, an FS compiler rejects code that contains "not allowed" objects and functions.
|
|
8
|
+
|
|
9
|
+
## Object
|
|
10
|
+
|
|
11
|
+
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object
|
|
12
|
+
|
|
13
|
+
Functions:
|
|
14
|
+
|
|
15
|
+
|Function |Priority |
|
|
16
|
+
|-------------------------|-----------|
|
|
17
|
+
|constructor |not allowed|
|
|
18
|
+
|assign |not allowed|
|
|
19
|
+
|create |not allowed|
|
|
20
|
+
|defineProperties |not allowed|
|
|
21
|
+
|defineProperty |not allowed|
|
|
22
|
+
|entries |1 |
|
|
23
|
+
|freeze |not allowed|
|
|
24
|
+
|fromEntries |1 |
|
|
25
|
+
|getOwnPropertyDescriptor |1 |
|
|
26
|
+
|getOwnPropertyDescriptors|1 |
|
|
27
|
+
|getOwnPropertyNames |1 |
|
|
28
|
+
|getOwnPropertySymbols |not allowed|
|
|
29
|
+
|getPrototypeOf |not allowed|
|
|
30
|
+
|groupBy |1 |
|
|
31
|
+
|hasOwn |1 |
|
|
32
|
+
|is |1 |
|
|
33
|
+
|isExtensible |not allowed|
|
|
34
|
+
|isFrozen |not allowed|
|
|
35
|
+
|isSealed |not allowed|
|
|
36
|
+
|keys |1 |
|
|
37
|
+
|preventExtensions |not allowed|
|
|
38
|
+
|seal |not allowed|
|
|
39
|
+
|setPrototypeOf |not allowed|
|
|
40
|
+
|values |1 |
|
|
41
|
+
|
|
42
|
+
## Array
|
|
43
|
+
|
|
44
|
+
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
45
|
+
|
|
46
|
+
|Function |Priority |
|
|
47
|
+
|-------------------------|-----------|
|
|
48
|
+
|from |1 |
|
|
49
|
+
|fromAsync |1 |
|
|
50
|
+
|isArray |1 |
|
|
51
|
+
|of |1 |
|
|
52
|
+
|
|
53
|
+
## BigInt
|
|
54
|
+
|
|
55
|
+
|Function |Priority |
|
|
56
|
+
|-------------------------|-----------|
|
|
57
|
+
|asIntN |1 |
|
|
58
|
+
|asUintN |1 |
|
|
59
|
+
|
|
60
|
+
## JSON
|
|
61
|
+
|
|
62
|
+
|Function |Priority |
|
|
63
|
+
|-------------------------|-----------|
|
|
64
|
+
|`isRawJSON` |3 |
|
|
65
|
+
|`parse` |2 |
|
|
66
|
+
|`rawJSON` |3 |
|
|
67
|
+
|`stringify` |2 |
|
|
68
|
+
|
|
69
|
+
## Others
|
|
70
|
+
|
|
71
|
+
`Infinity`
|
|
72
|
+
`isFinite()`
|
|
73
|
+
`isNaN()`
|
|
74
|
+
`NaN`
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Destructuring Assignment
|
|
2
|
+
|
|
3
|
+
```js
|
|
4
|
+
const { "a": a, "%": [c, d] } = { "a": null, "%": [true, false] }
|
|
5
|
+
export default {
|
|
6
|
+
"a": [a, c, d],
|
|
7
|
+
}
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
Depends on [const](./2120-const.md) and [function parameters](./3120-parameters.md).
|
|
11
|
+
|
|
12
|
+
See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Function
|
|
2
|
+
|
|
3
|
+
Parse a function that has no parameters and returns a constant.
|
|
4
|
+
|
|
5
|
+
```js
|
|
6
|
+
export default () => { return 6 }
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Depends on [default export](./2110-default-export.md).
|
|
10
|
+
|
|
11
|
+
See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Body Constants
|
|
2
|
+
|
|
3
|
+
Parse a const definition in a function body; a const can be used within that body after it is defined.
|
|
4
|
+
|
|
5
|
+
```js
|
|
6
|
+
export default () => {
|
|
7
|
+
const x = 43
|
|
8
|
+
return [3, x]
|
|
9
|
+
}
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Depends on [function](./3110-function.md) and [const](./2120-const.md).
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Additional Assignment Operators
|
|
2
|
+
|
|
3
|
+
These operators can be transformed into two operations in VM byte code.
|
|
4
|
+
|
|
5
|
+
|Type |Operator|Priority|
|
|
6
|
+
|-----------|--------|--------|
|
|
7
|
+
|Assignment |`+=` |2 |
|
|
8
|
+
| |`-=` |2 |
|
|
9
|
+
| |`*=` |2 |
|
|
10
|
+
| |`/=` |2 |
|
|
11
|
+
| |`%=` |2 |
|
|
12
|
+
| |`**=` |2 |
|
|
13
|
+
| |`<<=` |2 |
|
|
14
|
+
| |`>>=` |2 |
|
|
15
|
+
| |`>>>=` |2 |
|
|
16
|
+
| |`&=` |2 |
|
|
17
|
+
| |`^=` |2 |
|
|
18
|
+
| |`\|=` |2 |
|
|
19
|
+
| |`&&=` |2 |
|
|
20
|
+
| |`\|\|=` |2 |
|
|
21
|
+
| |`??=` |2 |
|
|
22
|
+
|Arithmetic |`++` |3 |
|
|
23
|
+
| |`--` |3 |
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# FunctionalScript Language
|
|
2
|
+
|
|
3
|
+
When we implement features of FunctionalScript, the first priority is a simplification of the VM.
|
|
4
|
+
|
|
5
|
+
File Types:
|
|
6
|
+
|
|
7
|
+
|File Type|Extension |Notes |
|
|
8
|
+
|---------|-----------------|------------|
|
|
9
|
+
|JSON |`.json` |Not a graph.|
|
|
10
|
+
|DJS |`.d.js`, `.d.mjs`|A graph. |
|
|
11
|
+
|FJS |`.f.js`, `.f.mjs`|Functions. |
|
|
12
|
+
|
|
13
|
+
**Note**: An FJS value can't be serialized without additional run-time infrastructure.
|
|
14
|
+
|
|
15
|
+
## 1. JSON
|
|
16
|
+
|
|
17
|
+
- [ ] [JSON](./1000-json.md).
|
|
18
|
+
|
|
19
|
+
## 2. DJS
|
|
20
|
+
|
|
21
|
+
The DJS form a graph of values. It can be serialized without additional run-time information.
|
|
22
|
+
|
|
23
|
+
File extensions: `.d.js` and `.d.mjs`.
|
|
24
|
+
|
|
25
|
+
### 2.1. Required
|
|
26
|
+
|
|
27
|
+
1. [ ] [default-export](./2110-default-export.md)
|
|
28
|
+
2. [ ] [const](./2120-const.md)
|
|
29
|
+
3. [ ] [default-import](./2130-default-import.md)
|
|
30
|
+
|
|
31
|
+
### 2.2. Priority 1
|
|
32
|
+
|
|
33
|
+
We need it to use JSDoc and TypeScript.
|
|
34
|
+
|
|
35
|
+
1. [ ] [block-comment](./2210-block-comment.md)
|
|
36
|
+
2. [ ] [namespace-import](./2220-namespace-import.md)
|
|
37
|
+
|
|
38
|
+
### 2.3. Priority 2
|
|
39
|
+
|
|
40
|
+
1. [ ] [undefined](./231-undefined.md)
|
|
41
|
+
2. [ ] [bigint](./232-bigint.md)
|
|
42
|
+
3. [ ] [grouping](./233-grouping.md)
|
|
43
|
+
4. [ ] [operators](./234-operators.md)
|
|
44
|
+
5. [ ] Property Accessors:
|
|
45
|
+
1. [ ] [property-accessor](./2351-property-accessor.md)
|
|
46
|
+
2. [ ] [property-call](./2352-property-call.md)
|
|
47
|
+
3. [ ] [at](./2353-at.md)
|
|
48
|
+
6. [ ] [global](./2360-built-in.md)
|
|
49
|
+
|
|
50
|
+
### 2.4. Syntactic Sugar
|
|
51
|
+
|
|
52
|
+
1. [ ] [identifier-property](./2410-identifier-property.md)
|
|
53
|
+
2. [ ] [line-comment](./2420-line-comment.md)
|
|
54
|
+
3. [ ] [trailing-comma](./2430-trailing-comma.md)
|
|
55
|
+
4. [ ] [shorthand](./2440-shorthand.md)
|
|
56
|
+
5. [ ] [destructuring](./2450-destructuring.md)
|
|
57
|
+
|
|
58
|
+
## 3. FJS
|
|
59
|
+
|
|
60
|
+
The FJS can have functions. The format requires additional run-time information for serialization.
|
|
61
|
+
|
|
62
|
+
File extensions: `.f.js` and `.f.mjs`.
|
|
63
|
+
|
|
64
|
+
### 3.1. Required
|
|
65
|
+
|
|
66
|
+
1. [ ] [function](./3110-function.md)
|
|
67
|
+
2. [ ] [parameters](./3120-parameters.md)
|
|
68
|
+
3. [ ] [body-const](./3130-body-const.md)
|
|
69
|
+
|
|
70
|
+
### 3.2. Priority 1
|
|
71
|
+
|
|
72
|
+
1. [ ] `if`
|
|
73
|
+
2. [ ] [let](./3220-let.md)
|
|
74
|
+
3. [ ] `while`
|
|
75
|
+
|
|
76
|
+
### 3.3. Syntactic Sugar
|
|
77
|
+
|
|
78
|
+
1. [ ] [expression](./321-expression.md)
|
|
79
|
+
2. [ ] [one-parameter](./322-one-parameter.md)
|
|
80
|
+
3. [ ] [assignments](./3330-assignments.md)
|
package/jsr.json
CHANGED
|
@@ -1,5 +1,119 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@functionalscript/functionalscript",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"exports":
|
|
3
|
+
"version": "0.1.601",
|
|
4
|
+
"exports": [
|
|
5
|
+
"./com/cpp/module.f.mjs",
|
|
6
|
+
"./com/cpp/test.f.mjs",
|
|
7
|
+
"./com/cpp/testlib.f.mjs",
|
|
8
|
+
"./com/cs/module.f.mjs",
|
|
9
|
+
"./com/cs/test.f.mjs",
|
|
10
|
+
"./com/cs/testlib.f.mjs",
|
|
11
|
+
"./com/rust/module.f.mjs",
|
|
12
|
+
"./com/rust/test.f.mjs",
|
|
13
|
+
"./com/rust/testlib.f.mjs",
|
|
14
|
+
"./com/test/build.f.mjs",
|
|
15
|
+
"./com/types/module.f.mjs",
|
|
16
|
+
"./com/types/testlib.f.mjs",
|
|
17
|
+
"./commonjs/build/module.f.mjs",
|
|
18
|
+
"./commonjs/build/test.f.mjs",
|
|
19
|
+
"./commonjs/module.f.mjs",
|
|
20
|
+
"./commonjs/module/function/module.f.mjs",
|
|
21
|
+
"./commonjs/module/module.f.mjs",
|
|
22
|
+
"./commonjs/package/dependencies/module.f.mjs",
|
|
23
|
+
"./commonjs/package/dependencies/test.f.mjs",
|
|
24
|
+
"./commonjs/package/module.f.mjs",
|
|
25
|
+
"./commonjs/package/test.f.mjs",
|
|
26
|
+
"./commonjs/path/module.f.mjs",
|
|
27
|
+
"./commonjs/path/test.f.mjs",
|
|
28
|
+
"./dev/module.f.mjs",
|
|
29
|
+
"./dev/test.f.mjs",
|
|
30
|
+
"./dev/test/module.f.mjs",
|
|
31
|
+
"./djs/module.f.mjs",
|
|
32
|
+
"./djs/parser/module.f.mjs",
|
|
33
|
+
"./djs/parser/test.f.mjs",
|
|
34
|
+
"./djs/test.f.mjs",
|
|
35
|
+
"./djs/tokenizer/module.f.mjs",
|
|
36
|
+
"./djs/tokenizer/test.f.mjs",
|
|
37
|
+
"./fsc/module.f.mjs",
|
|
38
|
+
"./fsc/test.f.mjs",
|
|
39
|
+
"./fsm/module.f.mjs",
|
|
40
|
+
"./fsm/test.f.mjs",
|
|
41
|
+
"./html/module.f.mjs",
|
|
42
|
+
"./html/test.f.mjs",
|
|
43
|
+
"./index.f.mjs",
|
|
44
|
+
"./js/tokenizer/module.f.mjs",
|
|
45
|
+
"./js/tokenizer/test.f.mjs",
|
|
46
|
+
"./json/module.f.mjs",
|
|
47
|
+
"./json/parser/module.f.mjs",
|
|
48
|
+
"./json/parser/test.f.mjs",
|
|
49
|
+
"./json/serializer/module.f.mjs",
|
|
50
|
+
"./json/serializer/test.f.mjs",
|
|
51
|
+
"./json/test.f.mjs",
|
|
52
|
+
"./json/tokenizer/module.f.mjs",
|
|
53
|
+
"./json/tokenizer/test.f.mjs",
|
|
54
|
+
"./nodejs/version/module.f.mjs",
|
|
55
|
+
"./nodejs/version/test.f.mjs",
|
|
56
|
+
"./prime_field/module.f.mjs",
|
|
57
|
+
"./prime_field/test.f.mjs",
|
|
58
|
+
"./secp/module.f.mjs",
|
|
59
|
+
"./secp/test.f.mjs",
|
|
60
|
+
"./sha2/module.f.mjs",
|
|
61
|
+
"./sha2/test.f.mjs",
|
|
62
|
+
"./text/ascii/module.f.mjs",
|
|
63
|
+
"./text/ascii/test.f.mjs",
|
|
64
|
+
"./text/module.f.mjs",
|
|
65
|
+
"./text/sgr/module.f.mjs",
|
|
66
|
+
"./text/test.f.mjs",
|
|
67
|
+
"./text/utf16/module.f.mjs",
|
|
68
|
+
"./text/utf16/test.f.mjs",
|
|
69
|
+
"./text/utf8/module.f.mjs",
|
|
70
|
+
"./text/utf8/test.f.mjs",
|
|
71
|
+
"./types/array/module.f.mjs",
|
|
72
|
+
"./types/array/test.f.mjs",
|
|
73
|
+
"./types/bigfloat/module.f.mjs",
|
|
74
|
+
"./types/bigfloat/test.f.mjs",
|
|
75
|
+
"./types/bigint/module.f.mjs",
|
|
76
|
+
"./types/bigint/test.f.mjs",
|
|
77
|
+
"./types/btree/find/module.f.mjs",
|
|
78
|
+
"./types/btree/find/test.f.mjs",
|
|
79
|
+
"./types/btree/module.f.mjs",
|
|
80
|
+
"./types/btree/remove/module.f.mjs",
|
|
81
|
+
"./types/btree/remove/test.f.mjs",
|
|
82
|
+
"./types/btree/set/module.f.mjs",
|
|
83
|
+
"./types/btree/set/test.f.mjs",
|
|
84
|
+
"./types/btree/test.f.mjs",
|
|
85
|
+
"./types/btree/types/module.f.mjs",
|
|
86
|
+
"./types/byte_set/module.f.mjs",
|
|
87
|
+
"./types/byte_set/test.f.mjs",
|
|
88
|
+
"./types/function/compare/module.f.mjs",
|
|
89
|
+
"./types/function/compare/test.f.mjs",
|
|
90
|
+
"./types/function/module.f.mjs",
|
|
91
|
+
"./types/function/operator/module.f.mjs",
|
|
92
|
+
"./types/function/test.f.mjs",
|
|
93
|
+
"./types/list/module.f.mjs",
|
|
94
|
+
"./types/list/test.f.mjs",
|
|
95
|
+
"./types/map/module.f.mjs",
|
|
96
|
+
"./types/map/test.f.mjs",
|
|
97
|
+
"./types/nibble_set/module.f.mjs",
|
|
98
|
+
"./types/nibble_set/test.f.mjs",
|
|
99
|
+
"./types/nullable/module.f.mjs",
|
|
100
|
+
"./types/nullable/test.f.mjs",
|
|
101
|
+
"./types/number/module.f.mjs",
|
|
102
|
+
"./types/number/test.f.mjs",
|
|
103
|
+
"./types/object/module.f.mjs",
|
|
104
|
+
"./types/object/test.f.mjs",
|
|
105
|
+
"./types/range/module.f.mjs",
|
|
106
|
+
"./types/range/test.f.mjs",
|
|
107
|
+
"./types/range_map/module.f.mjs",
|
|
108
|
+
"./types/range_map/test.f.mjs",
|
|
109
|
+
"./types/result/module.f.mjs",
|
|
110
|
+
"./types/sorted_list/module.f.mjs",
|
|
111
|
+
"./types/sorted_list/test.f.mjs",
|
|
112
|
+
"./types/sorted_set/module.f.mjs",
|
|
113
|
+
"./types/sorted_set/test.f.mjs",
|
|
114
|
+
"./types/string/module.f.mjs",
|
|
115
|
+
"./types/string/test.f.mjs",
|
|
116
|
+
"./types/string_set/module.f.mjs",
|
|
117
|
+
"./types/string_set/test.f.mjs"
|
|
118
|
+
]
|
|
5
119
|
}
|
package/nodejs/version/main.mjs
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
declare namespace _default {
|
|
2
|
-
export {
|
|
2
|
+
export { getVersion };
|
|
3
|
+
export { updateVersion };
|
|
3
4
|
}
|
|
4
5
|
export default _default;
|
|
5
|
-
export type ChildProcess = {
|
|
6
|
-
readonly execSync: (cmd: string) => Buffer;
|
|
7
|
-
};
|
|
8
6
|
export type Buffer = {};
|
|
9
7
|
export type Fs<T> = {
|
|
10
8
|
readonly readFileSync: (name: string) => Buffer;
|
|
11
9
|
readonly writeFileSync: (name: string, content: string) => T;
|
|
12
10
|
};
|
|
13
11
|
export type Node<T> = {
|
|
14
|
-
readonly child_process: ChildProcess;
|
|
15
12
|
readonly fs: Fs<T>;
|
|
16
13
|
};
|
|
14
|
+
/** @type {<T>(fs: Fs<T>) => string} */
|
|
15
|
+
declare const getVersion: <T>(fs: Fs<T>) => string;
|
|
17
16
|
/** @type {<T>(node: Node<T>) => readonly[T, T]} */
|
|
18
|
-
declare const
|
|
17
|
+
declare const updateVersion: <T>(node: Node<T>) => readonly [T, T];
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @typedef {{
|
|
3
|
-
* readonly execSync: (cmd: string) => Buffer
|
|
4
|
-
* }} ChildProcess
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
1
|
/** @typedef {{}} Buffer */
|
|
8
2
|
|
|
9
3
|
/**
|
|
@@ -17,24 +11,29 @@
|
|
|
17
11
|
/**
|
|
18
12
|
* @template T
|
|
19
13
|
* @typedef {{
|
|
20
|
-
* readonly child_process: ChildProcess
|
|
21
14
|
* readonly fs: Fs<T>
|
|
22
15
|
* }} Node
|
|
23
16
|
*/
|
|
24
17
|
|
|
25
18
|
const { stringify, parse } = JSON
|
|
26
19
|
|
|
20
|
+
/** @type {<T>(fs: Fs<T>) => string} */
|
|
21
|
+
const getVersion = fs => readJson(fs)('package').version
|
|
22
|
+
|
|
23
|
+
const jsonFile = (/** @type {string} */jsonFile) => `${jsonFile}.json`
|
|
24
|
+
|
|
25
|
+
/** @type {<T>(node: Fs<T>) => (name: string) => any} */
|
|
26
|
+
const readJson = fs => name => parse(fs.readFileSync(jsonFile(name)).toString())
|
|
27
|
+
|
|
27
28
|
/** @type {<T>(node: Node<T>) => readonly[T, T]} */
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
const f = (/** @type {string} */jsonFile) => {
|
|
31
|
-
const file = `${jsonFile}.json`
|
|
29
|
+
const updateVersion = ({ fs }) => {
|
|
30
|
+
const f = (/** @type {string} */name) => {
|
|
32
31
|
return fs.writeFileSync(
|
|
33
|
-
|
|
32
|
+
jsonFile(name),
|
|
34
33
|
stringify(
|
|
35
34
|
{
|
|
36
|
-
...
|
|
37
|
-
version
|
|
35
|
+
...readJson(fs)(name),
|
|
36
|
+
version: getVersion(fs)
|
|
38
37
|
},
|
|
39
38
|
null,
|
|
40
39
|
2))
|
|
@@ -46,6 +45,6 @@ const version = ({ child_process, fs }) => {
|
|
|
46
45
|
}
|
|
47
46
|
|
|
48
47
|
export default {
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
getVersion,
|
|
49
|
+
updateVersion,
|
|
51
50
|
}
|
|
@@ -1,44 +1,54 @@
|
|
|
1
1
|
import _, * as T from './module.f.mjs'
|
|
2
2
|
|
|
3
|
+
const version = '0.3.0'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @type {{
|
|
7
|
+
* readonly[k in string]: unknown
|
|
8
|
+
* }}
|
|
9
|
+
*/
|
|
3
10
|
const x = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"
|
|
11
|
+
'package.json': {
|
|
12
|
+
"name": "functionalscript",
|
|
13
|
+
version,
|
|
14
|
+
"description": "FunctionalScript is a functional subset of JavaScript",
|
|
15
|
+
"main": "module.f.cjs",
|
|
16
|
+
"scripts": {
|
|
17
|
+
"tsc": "tsc",
|
|
18
|
+
"test": "tsc && npm run test-only",
|
|
19
|
+
"version": "node ./nodejs/version/main.cjs",
|
|
20
|
+
"test-only": "node --trace-uncaught ./test.f.cjs"
|
|
21
|
+
},
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/functionalscript/functionalscript.git"
|
|
25
|
+
},
|
|
26
|
+
"author": "NatFoam",
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"keywords": [
|
|
29
|
+
"lambda",
|
|
30
|
+
"functional-programming",
|
|
31
|
+
"closure",
|
|
32
|
+
"pure-functional",
|
|
33
|
+
"typescript",
|
|
34
|
+
"programming-language",
|
|
35
|
+
"lazy-evaluation"
|
|
36
|
+
],
|
|
37
|
+
"bugs": {
|
|
38
|
+
"url": "https://github.com/functionalscript/functionalscript/issues"
|
|
39
|
+
},
|
|
40
|
+
"homepage": "https://github.com/functionalscript/functionalscript#readme",
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@types/node": "^18.6.2",
|
|
43
|
+
"typescript": "^4.7.4"
|
|
44
|
+
}
|
|
31
45
|
},
|
|
32
|
-
"
|
|
33
|
-
"devDependencies": {
|
|
34
|
-
"@types/node": "^18.6.2",
|
|
35
|
-
"typescript": "^4.7.4"
|
|
36
|
-
}
|
|
46
|
+
"jsr.json": {}
|
|
37
47
|
}
|
|
38
48
|
|
|
39
49
|
const e = '{\n' +
|
|
40
50
|
' "name": "functionalscript",\n' +
|
|
41
|
-
|
|
51
|
+
` "version": "${version}",\n` +
|
|
42
52
|
' "description": "FunctionalScript is a functional subset of JavaScript",\n' +
|
|
43
53
|
' "main": "module.f.cjs",\n' +
|
|
44
54
|
' "scripts": {\n' +
|
|
@@ -80,12 +90,11 @@ const buffer = s => ({
|
|
|
80
90
|
export default () => {
|
|
81
91
|
/** @type {T.Node<string>} */
|
|
82
92
|
const node = {
|
|
83
|
-
child_process: { execSync: () => buffer("123\n456\n") },
|
|
84
93
|
fs: {
|
|
85
|
-
readFileSync:
|
|
94
|
+
readFileSync: n => buffer(JSON.stringify(x[n])),
|
|
86
95
|
writeFileSync: (_, content) => content
|
|
87
96
|
}
|
|
88
97
|
}
|
|
89
|
-
const [n, d] = _.
|
|
98
|
+
const [n, d] = _.updateVersion(node)
|
|
90
99
|
if (n !== e) { throw [n, e] }
|
|
91
100
|
}
|
package/package.json
CHANGED
package/types/list/test.f.mjs
CHANGED
|
@@ -200,7 +200,8 @@ const stress = () => ({
|
|
|
200
200
|
/** @type {T.List<number>} */
|
|
201
201
|
let sequence = []
|
|
202
202
|
// 20_000_000 is too much
|
|
203
|
-
|
|
203
|
+
// 10_000_000 is too much for Deno 1
|
|
204
|
+
for (let i = 0; i < 5_000_000; ++i) {
|
|
204
205
|
sequence = _.concat(sequence)([i])
|
|
205
206
|
}
|
|
206
207
|
const r = _.toArray(sequence)
|
|
@@ -316,5 +317,5 @@ export default {
|
|
|
316
317
|
if (_.length(null) !== 0) { throw 0 }
|
|
317
318
|
if (_.length(_.flat([[1, 3], null, () => [3], _.concat([12])([4, 89])])) !== 6) { throw 6 }
|
|
318
319
|
},
|
|
319
|
-
//stress
|
|
320
|
+
// stress
|
|
320
321
|
}
|