functionalscript 0.1.596 → 0.1.597
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/com/cpp/module.f.d.mts +4 -4
- package/com/cpp/module.f.mjs +18 -18
- package/com/cs/module.f.mjs +1 -1
- package/com/rust/module.f.d.mts +7 -7
- package/com/rust/module.f.mjs +30 -30
- package/com/test/build.mjs +2 -2
- package/com/types/module.f.mjs +1 -1
- package/commonjs/module/module.f.mjs +1 -1
- package/commonjs/package/dependencies/module.f.d.mts +3 -3
- package/commonjs/package/dependencies/module.f.mjs +3 -3
- package/commonjs/package/module.f.d.mts +6 -6
- package/commonjs/package/module.f.mjs +4 -4
- package/commonjs/path/module.f.d.mts +7 -7
- package/commonjs/path/module.f.mjs +5 -5
- package/commonjs/path/test.f.mjs +7 -7
- package/commonjs/test.mjs +2 -2
- package/djs/module.f.mjs +1 -1
- package/djs/tokenizer/module.f.mjs +1 -1
- package/djs/tokenizer/test.f.mjs +1 -1
- package/html/module.f.mjs +1 -1
- package/js/tokenizer/test.f.mjs +3 -3
- package/json/parser/module.f.d.mts +3 -3
- package/json/parser/module.f.mjs +12 -12
- package/json/parser/test.f.mjs +2 -2
- package/json/serializer/module.f.mjs +2 -2
- package/json/tokenizer/module.f.d.mts +3 -3
- package/json/tokenizer/module.f.mjs +7 -7
- package/json/tokenizer/test.f.mjs +3 -3
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/secp/module.f.d.mts +8 -8
- package/secp/module.f.mjs +6 -6
- package/secp/test.f.mjs +5 -5
- package/sha2/module.f.mjs +1 -1
- package/sha2/test.f.mjs +0 -1
- package/text/utf16/test.f.mjs +2 -2
- package/text/utf8/module.f.d.mts +2 -2
- package/text/utf8/module.f.mjs +2 -2
- package/types/bigint/module.f.d.mts +8 -8
- package/types/bigint/module.f.mjs +5 -5
- package/types/btree/find/module.f.mjs +4 -4
- package/types/btree/find/test.f.mjs +2 -2
- package/types/btree/remove/module.f.d.mts +7 -7
- package/types/btree/remove/module.f.mjs +12 -12
- package/types/btree/remove/test.f.mjs +5 -5
- package/types/btree/set/module.f.d.mts +3 -3
- package/types/btree/set/module.f.mjs +6 -6
- package/types/btree/set/test.f.mjs +32 -32
- package/types/btree/test.f.mjs +7 -11
- package/types/byte_set/module.f.mjs +2 -2
- package/types/byte_set/test.f.mjs +3 -3
- package/types/function/compare/module.f.d.mts +7 -7
- package/types/function/compare/module.f.mjs +4 -4
- package/types/map/module.f.d.mts +2 -2
- package/types/map/module.f.mjs +4 -4
- package/types/range_map/module.f.d.mts +2 -2
- package/types/range_map/module.f.mjs +5 -5
- package/types/range_map/test.f.mjs +2 -2
- package/types/sorted_list/test.f.mjs +2 -2
- package/types/sorted_set/test.f.mjs +1 -1
package/com/cpp/module.f.d.mts
CHANGED
|
@@ -2,7 +2,7 @@ declare namespace _default {
|
|
|
2
2
|
export { cpp };
|
|
3
3
|
}
|
|
4
4
|
export default _default;
|
|
5
|
-
/** @type {(name: string) => (lib:
|
|
6
|
-
declare const cpp: (name: string) => (lib:
|
|
7
|
-
import * as
|
|
8
|
-
import * as
|
|
5
|
+
/** @type {(name: string) => (lib: Types.Library) => Text.Block} */
|
|
6
|
+
declare const cpp: (name: string) => (lib: Types.Library) => Text.Block;
|
|
7
|
+
import * as Types from '../types/module.f.mjs';
|
|
8
|
+
import * as Text from '../../text/module.f.mjs';
|
package/com/cpp/module.f.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import types, * as
|
|
2
|
-
import text, * as
|
|
3
|
-
import
|
|
1
|
+
import types, * as Types from '../types/module.f.mjs'
|
|
2
|
+
import text, * as Text from '../../text/module.f.mjs'
|
|
3
|
+
import * as O from '../../types/object/module.f.mjs'
|
|
4
4
|
import list from '../../types/list/module.f.mjs'
|
|
5
5
|
import string from '../../types/string/module.f.mjs'
|
|
6
6
|
const { join } = string
|
|
@@ -8,7 +8,7 @@ const { paramList } = types
|
|
|
8
8
|
const { map, flatMap, flat } = list
|
|
9
9
|
const { entries } = Object
|
|
10
10
|
|
|
11
|
-
/** @type {(name: string) => (body:
|
|
11
|
+
/** @type {(name: string) => (body: Text.Block) => Text.Block} */
|
|
12
12
|
const struct = name => body => [`struct ${name}`, '{', body, '};']
|
|
13
13
|
|
|
14
14
|
const baseTypeMap = {
|
|
@@ -27,7 +27,7 @@ const baseTypeMap = {
|
|
|
27
27
|
bool: 'bool',
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
/** @type {(t:
|
|
30
|
+
/** @type {(t: Types.BaseType) => string} */
|
|
31
31
|
const baseType = t => baseTypeMap[t]
|
|
32
32
|
|
|
33
33
|
const resultVoid = types.result('void')
|
|
@@ -43,17 +43,17 @@ const ptr = id => `${id} const*`
|
|
|
43
43
|
/** @type {(id: string) => string} */
|
|
44
44
|
const ref = id => `${id} const&`
|
|
45
45
|
|
|
46
|
-
/** @type {(p:
|
|
46
|
+
/** @type {(p: Types.Field) => string} */
|
|
47
47
|
const paramName = ([name]) => name
|
|
48
48
|
|
|
49
49
|
const mapParamName = map(paramName)
|
|
50
50
|
|
|
51
51
|
const joinComma = join(', ')
|
|
52
52
|
|
|
53
|
-
/** @type {(name: string) => (lib:
|
|
53
|
+
/** @type {(name: string) => (lib: Types.Library) => Text.Block} */
|
|
54
54
|
const cpp = name => lib => {
|
|
55
55
|
|
|
56
|
-
/** @type {(t:
|
|
56
|
+
/** @type {(t: Types.Type) => string|null} */
|
|
57
57
|
const interface_ = t => {
|
|
58
58
|
if (!(t instanceof Array) || t.length !== 1) {
|
|
59
59
|
return null
|
|
@@ -62,7 +62,7 @@ const cpp = name => lib => {
|
|
|
62
62
|
return 'interface' in lib[name] ? name : null
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
/** @type {(i: (t: string) => string) => (t:
|
|
65
|
+
/** @type {(i: (t: string) => string) => (t: Types.Type) => string} */
|
|
66
66
|
const objectType = i => t => {
|
|
67
67
|
if (typeof (t) === 'string') { return baseType(t) }
|
|
68
68
|
if (t.length === 2) { return `${type(t[1])} const*` }
|
|
@@ -74,27 +74,27 @@ const cpp = name => lib => {
|
|
|
74
74
|
|
|
75
75
|
const resultType = objectType(ptr)
|
|
76
76
|
|
|
77
|
-
/** @type {(s:
|
|
77
|
+
/** @type {(s: Types.Field) => Text.Item} */
|
|
78
78
|
const field = ([name, t]) => `${type(t)} ${name};`
|
|
79
79
|
|
|
80
80
|
const mapField = map(field)
|
|
81
81
|
|
|
82
|
-
/** @type {(s:
|
|
82
|
+
/** @type {(s: Types.Struct) => Text.Block} */
|
|
83
83
|
const defStruct = s => mapField(entries(s.struct))
|
|
84
84
|
|
|
85
|
-
/** @type {(fa:
|
|
85
|
+
/** @type {(fa: Types.FieldArray) => string} */
|
|
86
86
|
const cppResult = resultVoid(resultType)
|
|
87
87
|
|
|
88
|
-
/** @type {(p:
|
|
88
|
+
/** @type {(p: Types.Field) => string} */
|
|
89
89
|
const param = ([name, t]) => `${objectType(ref)(t)} ${name}`
|
|
90
90
|
|
|
91
91
|
const mapParam = map(param)
|
|
92
92
|
|
|
93
|
-
/** @type {(result: string) => (paramArrayStr: string) => (name: string) =>
|
|
93
|
+
/** @type {(result: string) => (paramArrayStr: string) => (name: string) => Text.Item} */
|
|
94
94
|
const methodHeader = result => paramArrayStr => name =>
|
|
95
95
|
`virtual ${result} ${name}${paramArrayStr} const noexcept = 0;`
|
|
96
96
|
|
|
97
|
-
/** @type {(m:
|
|
97
|
+
/** @type {(m: Types.Method) => readonly Text.Item[]} */
|
|
98
98
|
const method = ([name, paramArray]) => {
|
|
99
99
|
const result = cppResult(paramArray)
|
|
100
100
|
const paramL = paramList(paramArray)
|
|
@@ -115,7 +115,7 @@ const cpp = name => lib => {
|
|
|
115
115
|
|
|
116
116
|
const mapMethod = flatMap(method)
|
|
117
117
|
|
|
118
|
-
/** @type {(i:
|
|
118
|
+
/** @type {(i: Types.Interface) => Text.Block} */
|
|
119
119
|
const defInterface = ({ guid, interface: i }) => {
|
|
120
120
|
const g = guid.replaceAll('-', '');
|
|
121
121
|
const lo = g.substring(0, 16);
|
|
@@ -126,7 +126,7 @@ const cpp = name => lib => {
|
|
|
126
126
|
])
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
/** @type {(kv: O.Entry<
|
|
129
|
+
/** @type {(kv: O.Entry<Types.Definition>) => Text.Block} */
|
|
130
130
|
const def = ([name, d]) => 'interface' in d
|
|
131
131
|
? [
|
|
132
132
|
`class ${name} : public ::nanocom::IUnknown`,
|
|
@@ -137,7 +137,7 @@ const cpp = name => lib => {
|
|
|
137
137
|
]
|
|
138
138
|
: struct(name)(defStruct(d))
|
|
139
139
|
|
|
140
|
-
/** @type {(kv: O.Entry<
|
|
140
|
+
/** @type {(kv: O.Entry<Types.Definition>) => Text.Block} */
|
|
141
141
|
const forward = ([name]) => [`struct ${name};`]
|
|
142
142
|
|
|
143
143
|
const e = entries(lib)
|
package/com/cs/module.f.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import list, * as List from '../../types/list/module.f.mjs'
|
|
|
6
6
|
const { flat, map, some, flatMap } = list
|
|
7
7
|
import string from '../../types/string/module.f.mjs'
|
|
8
8
|
const { join } = string
|
|
9
|
-
import
|
|
9
|
+
import * as O from '../../types/object/module.f.mjs'
|
|
10
10
|
const { entries } = Object
|
|
11
11
|
|
|
12
12
|
/** @type {(v: string) => string} */
|
package/com/rust/module.f.d.mts
CHANGED
|
@@ -7,22 +7,22 @@ export type Where = {
|
|
|
7
7
|
readonly where: readonly string[];
|
|
8
8
|
};
|
|
9
9
|
export type WhereContent = OptionalProperty<Where> & {
|
|
10
|
-
readonly content:
|
|
10
|
+
readonly content: Text.Block;
|
|
11
11
|
};
|
|
12
12
|
export type Impl = {
|
|
13
13
|
readonly param?: string;
|
|
14
14
|
readonly trait: string;
|
|
15
15
|
readonly type: string;
|
|
16
16
|
readonly where?: readonly string[];
|
|
17
|
-
readonly content:
|
|
17
|
+
readonly content: Text.Block;
|
|
18
18
|
};
|
|
19
19
|
export type Trait = {
|
|
20
20
|
readonly pub?: true;
|
|
21
21
|
readonly type: string;
|
|
22
22
|
readonly where?: readonly string[];
|
|
23
|
-
readonly content:
|
|
23
|
+
readonly content: Text.Block;
|
|
24
24
|
};
|
|
25
|
-
/** @type {(library:
|
|
26
|
-
declare const rust: (library:
|
|
27
|
-
import * as
|
|
28
|
-
import * as
|
|
25
|
+
/** @type {(library: Types.Library) => Text.Block} */
|
|
26
|
+
declare const rust: (library: Types.Library) => Text.Block;
|
|
27
|
+
import * as Text from '../../text/module.f.mjs';
|
|
28
|
+
import * as Types from '../types/module.f.mjs';
|
package/com/rust/module.f.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import types, * as
|
|
1
|
+
import types, * as Types from '../types/module.f.mjs'
|
|
2
2
|
const { paramList } = types
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import * as Text from '../../text/module.f.mjs'
|
|
4
|
+
import * as O from '../../types/object/module.f.mjs'
|
|
5
5
|
import list, * as List from '../../types/list/module.f.mjs'
|
|
6
6
|
const { flat, map, flatMap } = list
|
|
7
7
|
const { entries } = Object
|
|
@@ -15,7 +15,7 @@ const rustField = field => `pub ${field},`
|
|
|
15
15
|
|
|
16
16
|
const mapRustField = map(rustField)
|
|
17
17
|
|
|
18
|
-
/** @type {(b: List.Thunk<string>) => (name: string) =>
|
|
18
|
+
/** @type {(b: List.Thunk<string>) => (name: string) => Text.Block} */
|
|
19
19
|
const rustStruct = b => name => [`#[repr(C)]`, `pub struct ${name} {`, mapRustField(b), `}`]
|
|
20
20
|
|
|
21
21
|
const commaJoin = join(', ')
|
|
@@ -28,21 +28,21 @@ const obj = name => `&${name}::Object`
|
|
|
28
28
|
|
|
29
29
|
const self = ['&self']
|
|
30
30
|
|
|
31
|
-
/** @type {(p:
|
|
31
|
+
/** @type {(p: Types.Field) => string} */
|
|
32
32
|
const paramName = ([n]) => n
|
|
33
33
|
|
|
34
|
-
/** @type {(p:
|
|
34
|
+
/** @type {(p: Types.FieldArray) => List.Thunk<string>} */
|
|
35
35
|
const callList = p => map(paramName)(paramList(p))
|
|
36
36
|
|
|
37
|
-
/** @type {(p:
|
|
37
|
+
/** @type {(p: Types.FieldArray) => string} */
|
|
38
38
|
const call = p => commaJoin(callList(p))
|
|
39
39
|
|
|
40
|
-
/** @type {(p:
|
|
40
|
+
/** @type {(p: Types.FieldArray) => string} */
|
|
41
41
|
const virtualCall = p => commaJoin(flat([['self'], callList(p)]))
|
|
42
42
|
|
|
43
43
|
const super_ = 'super::'
|
|
44
44
|
|
|
45
|
-
/** @type {(m:
|
|
45
|
+
/** @type {(m: Types.Method) => string} */
|
|
46
46
|
const assign = ([n]) => `${n}: Self::${n},`
|
|
47
47
|
|
|
48
48
|
const mapAssign = map(assign)
|
|
@@ -60,10 +60,10 @@ const rustType = n => `pub type ${n} = nanocom::${n}<Interface>;`
|
|
|
60
60
|
/** @typedef {{readonly where: readonly string[]}} Where */
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
|
-
* @typedef {OptionalProperty<Where> & {readonly content:
|
|
63
|
+
* @typedef {OptionalProperty<Where> & {readonly content: Text.Block}} WhereContent
|
|
64
64
|
*/
|
|
65
65
|
|
|
66
|
-
/** @type {(h: string) => (wh: WhereContent) =>
|
|
66
|
+
/** @type {(h: string) => (wh: WhereContent) => Text.Block} */
|
|
67
67
|
const whereContent = h => wh => {
|
|
68
68
|
const w = 'where' in wh ? [
|
|
69
69
|
h,
|
|
@@ -84,11 +84,11 @@ const whereContent = h => wh => {
|
|
|
84
84
|
* readonly trait: string
|
|
85
85
|
* readonly type: string
|
|
86
86
|
* readonly where?: readonly string[]
|
|
87
|
-
* readonly content:
|
|
87
|
+
* readonly content: Text.Block
|
|
88
88
|
* }} Impl
|
|
89
89
|
*/
|
|
90
90
|
|
|
91
|
-
/** @type {(impl: Impl) =>
|
|
91
|
+
/** @type {(impl: Impl) => Text.Block} */
|
|
92
92
|
const rustImpl = i => {
|
|
93
93
|
const p = 'param' in i ? `<${i.param}>` : ''
|
|
94
94
|
const header = `impl${p} ${i.trait} for ${i.type}`
|
|
@@ -100,7 +100,7 @@ const rustImpl = i => {
|
|
|
100
100
|
* readonly pub?: true
|
|
101
101
|
* readonly type: string
|
|
102
102
|
* readonly where?: readonly string[]
|
|
103
|
-
* readonly content:
|
|
103
|
+
* readonly content: Text.Block
|
|
104
104
|
* }} Trait
|
|
105
105
|
*/
|
|
106
106
|
|
|
@@ -109,14 +109,14 @@ const comma = s => `${s},`
|
|
|
109
109
|
|
|
110
110
|
const mapComma = map(comma)
|
|
111
111
|
|
|
112
|
-
/** @type {(t: Trait) =>
|
|
112
|
+
/** @type {(t: Trait) => Text.Block} */
|
|
113
113
|
const trait = t => {
|
|
114
114
|
const p = t.pub === true ? 'pub ' : ''
|
|
115
115
|
const h = `${p}trait ${t.type}`
|
|
116
116
|
return whereContent(h)(t)
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
/** @type {(t: Trait) =>
|
|
119
|
+
/** @type {(t: Trait) => Text.Block} */
|
|
120
120
|
const traitImpl = t => {
|
|
121
121
|
const i = rustImpl({
|
|
122
122
|
param: 'T',
|
|
@@ -130,12 +130,12 @@ const traitImpl = t => {
|
|
|
130
130
|
|
|
131
131
|
const where = ['Self: nanocom::Class<Interface = Interface>', 'nanocom::CObject<Self>: Ex']
|
|
132
132
|
|
|
133
|
-
/** @type {(library:
|
|
133
|
+
/** @type {(library: Types.Library) => Text.Block} */
|
|
134
134
|
const rust = library => {
|
|
135
135
|
|
|
136
|
-
/** @type {(p: string) => (o: (_: string) => string) => (t:
|
|
136
|
+
/** @type {(p: string) => (o: (_: string) => string) => (t: Types.Type) => string} */
|
|
137
137
|
const type = p => {
|
|
138
|
-
/** @type {(o: (_: string) => string) => (t:
|
|
138
|
+
/** @type {(o: (_: string) => string) => (t: Types.Type) => string} */
|
|
139
139
|
const f = o => t => {
|
|
140
140
|
if (typeof t === 'string') { return t }
|
|
141
141
|
if (t.length === 2) { return `*const ${f(ref)(t[1])}` }
|
|
@@ -146,7 +146,7 @@ const rust = library => {
|
|
|
146
146
|
return f
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
/** @type {(p: string) => (o: (_: string) => string) => (f:
|
|
149
|
+
/** @type {(p: string) => (o: (_: string) => string) => (f: Types.Field) => string} */
|
|
150
150
|
const pf = p => o => ([name, t]) => `${name}: ${type(p)(o)(t)}`
|
|
151
151
|
|
|
152
152
|
const param = pf(super_)(obj)
|
|
@@ -155,36 +155,36 @@ const rust = library => {
|
|
|
155
155
|
|
|
156
156
|
const mapField = map(pf('')(ref))
|
|
157
157
|
|
|
158
|
-
/** @type {(fa:
|
|
158
|
+
/** @type {(fa: Types.FieldArray) => (name: string) => Text.Block} */
|
|
159
159
|
const struct = fn(entries)
|
|
160
160
|
.then(mapField)
|
|
161
161
|
.then(rustStruct)
|
|
162
162
|
.result
|
|
163
163
|
|
|
164
|
-
/** @type {(first: readonly string[]) => (p:
|
|
164
|
+
/** @type {(first: readonly string[]) => (p: Types.FieldArray) => string} */
|
|
165
165
|
const func = first => p => {
|
|
166
166
|
const resultStr = '_' in p ? ` -> ${type(super_)(ref)(p._)}` : ''
|
|
167
167
|
const params = commaJoin(flat([first, mapParam(paramList(p))]))
|
|
168
168
|
return `(${params})${resultStr}`
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
/** @type {(n: string) => (p:
|
|
171
|
+
/** @type {(n: string) => (p: Types.FieldArray) => string} */
|
|
172
172
|
const virtualFnType = n => p => `extern "system" fn${n}${func(this_)(p)}`
|
|
173
173
|
|
|
174
|
-
/** @type {(m:
|
|
174
|
+
/** @type {(m: Types.Method) => string} */
|
|
175
175
|
const virtualFn = ([n, p]) => `${n}: unsafe ${virtualFnType('')(p)}`
|
|
176
176
|
|
|
177
177
|
const mapVirtualFn = map(virtualFn)
|
|
178
178
|
|
|
179
|
-
/** @type {(m:
|
|
179
|
+
/** @type {(m: Types.Method) => string} */
|
|
180
180
|
const headerFn = ([n, p]) => `fn ${n}${func(self)(p)}`
|
|
181
181
|
|
|
182
|
-
/** @type {(m:
|
|
182
|
+
/** @type {(m: Types.Method) => string} */
|
|
183
183
|
const traitFn = m => `${headerFn(m)};`
|
|
184
184
|
|
|
185
185
|
const mapTraitFn = map(traitFn)
|
|
186
186
|
|
|
187
|
-
/** @type {(m:
|
|
187
|
+
/** @type {(m: Types.Method) => Text.Block} */
|
|
188
188
|
const implFn = m => {
|
|
189
189
|
const [n, p] = m
|
|
190
190
|
return [
|
|
@@ -196,7 +196,7 @@ const rust = library => {
|
|
|
196
196
|
|
|
197
197
|
const flatMapImplFn = flatMap(implFn)
|
|
198
198
|
|
|
199
|
-
/** @type {(m:
|
|
199
|
+
/** @type {(m: Types.Method) => Text.Block} */
|
|
200
200
|
const impl = ([n, p]) => {
|
|
201
201
|
const type = virtualFnType(` ${n}`)(p)
|
|
202
202
|
return [
|
|
@@ -208,7 +208,7 @@ const rust = library => {
|
|
|
208
208
|
|
|
209
209
|
const flatMapImpl = flatMap(impl)
|
|
210
210
|
|
|
211
|
-
/** @type {(i:
|
|
211
|
+
/** @type {(i: Types.Interface) => (name: string) => Text.Block} */
|
|
212
212
|
const interface_ = ({ interface: i, guid }) => name => {
|
|
213
213
|
|
|
214
214
|
const e = entries(i)
|
|
@@ -252,7 +252,7 @@ const rust = library => {
|
|
|
252
252
|
]
|
|
253
253
|
}
|
|
254
254
|
|
|
255
|
-
/** @type {(type: O.Entry<
|
|
255
|
+
/** @type {(type: O.Entry<Types.Definition>) => Text.Block} */
|
|
256
256
|
const def = ([name, type]) => ('interface' in type ? interface_(type) : struct(type.struct))(name)
|
|
257
257
|
|
|
258
258
|
return flat([['#![allow(non_snake_case)]'], flatMap(def)(entries(library))])
|
package/com/test/build.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { writeFileSync } from 'node:fs'
|
|
2
2
|
import { execSync } from 'node:child_process'
|
|
3
3
|
import { platform, exit } from 'node:process'
|
|
4
|
-
import build, * as
|
|
4
|
+
import build, * as Build from './build.f.mjs'
|
|
5
5
|
const { cpp, cs, rust } = build
|
|
6
6
|
import string from '../../types/string/module.f.mjs'
|
|
7
7
|
const { join } = string
|
|
@@ -21,7 +21,7 @@ const nodeJs = {
|
|
|
21
21
|
platform,
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
/** @type {(f:
|
|
24
|
+
/** @type {(f: Build.Func) => void} */
|
|
25
25
|
const run = f => {
|
|
26
26
|
const { file: { name, content }, line } = f(nodeJs)
|
|
27
27
|
log(`${bold}writing: ${name}${reset}`)
|
package/com/types/module.f.mjs
CHANGED
|
@@ -5,6 +5,6 @@ export default _default;
|
|
|
5
5
|
export type DependencyJson = readonly [string, string];
|
|
6
6
|
export type DependencyMapJson = { readonly [k in string]: string; };
|
|
7
7
|
export type DependenciesJson = DependencyMapJson | null;
|
|
8
|
-
/** @type {(j:
|
|
9
|
-
declare const isDependenciesJson: (j:
|
|
10
|
-
import * as
|
|
8
|
+
/** @type {(j: Json.Unknown) => j is DependenciesJson} */
|
|
9
|
+
declare const isDependenciesJson: (j: Json.Unknown) => j is DependenciesJson;
|
|
10
|
+
import * as Json from '../../../json/module.f.mjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import json, * as
|
|
1
|
+
import json, * as Json from '../../../json/module.f.mjs'
|
|
2
2
|
const { isObject } = json
|
|
3
3
|
import list from '../../../types/list/module.f.mjs'
|
|
4
4
|
const { map, every } = list
|
|
@@ -10,10 +10,10 @@ const { entries } = Object
|
|
|
10
10
|
|
|
11
11
|
/** @typedef {DependencyMapJson|null} DependenciesJson */
|
|
12
12
|
|
|
13
|
-
/** @type {(entry:
|
|
13
|
+
/** @type {(entry: Json.Entry) => boolean} */
|
|
14
14
|
const isDependencyJson = ([, v]) => typeof v === 'string'
|
|
15
15
|
|
|
16
|
-
/** @type {(j:
|
|
16
|
+
/** @type {(j: Json.Unknown) => j is DependenciesJson} */
|
|
17
17
|
const isDependenciesJson = j => {
|
|
18
18
|
if (j === null) { return true }
|
|
19
19
|
if (!isObject(j)) { return false }
|
|
@@ -6,7 +6,7 @@ export default _default;
|
|
|
6
6
|
export type PackageJson = {
|
|
7
7
|
readonly name: string;
|
|
8
8
|
readonly version: string;
|
|
9
|
-
readonly dependencies?:
|
|
9
|
+
readonly dependencies?: Dependencies.DependenciesJson;
|
|
10
10
|
};
|
|
11
11
|
export type Package = {
|
|
12
12
|
readonly dependency: (localPackageId: string) => string | null;
|
|
@@ -18,10 +18,10 @@ import dependencies from './dependencies/module.f.mjs';
|
|
|
18
18
|
* @typedef {{
|
|
19
19
|
* readonly name: string
|
|
20
20
|
* readonly version: string
|
|
21
|
-
* readonly dependencies?:
|
|
21
|
+
* readonly dependencies?: Dependencies.DependenciesJson
|
|
22
22
|
* }} PackageJson
|
|
23
23
|
*/
|
|
24
|
-
/** @type {(j:
|
|
25
|
-
declare const isPackageJson: (j:
|
|
26
|
-
import * as
|
|
27
|
-
import * as
|
|
24
|
+
/** @type {(j: Json.Unknown) => j is PackageJson} */
|
|
25
|
+
declare const isPackageJson: (j: Json.Unknown) => j is PackageJson;
|
|
26
|
+
import * as Dependencies from './dependencies/module.f.mjs';
|
|
27
|
+
import * as Json from '../../json/module.f.mjs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import json, * as
|
|
1
|
+
import json, * as Json from '../../json/module.f.mjs'
|
|
2
2
|
const { isObject } = json
|
|
3
|
-
import dependencies, * as
|
|
3
|
+
import dependencies, * as Dependencies from './dependencies/module.f.mjs'
|
|
4
4
|
const { isDependenciesJson } = dependencies
|
|
5
5
|
import o from '../../types/object/module.f.mjs'
|
|
6
6
|
const { at } = o
|
|
@@ -9,11 +9,11 @@ const { at } = o
|
|
|
9
9
|
* @typedef {{
|
|
10
10
|
* readonly name: string
|
|
11
11
|
* readonly version: string
|
|
12
|
-
* readonly dependencies?:
|
|
12
|
+
* readonly dependencies?: Dependencies.DependenciesJson
|
|
13
13
|
* }} PackageJson
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
/** @type {(j:
|
|
16
|
+
/** @type {(j: Json.Unknown) => j is PackageJson} */
|
|
17
17
|
const isPackageJson = j => {
|
|
18
18
|
if (!isObject(j)) { return false }
|
|
19
19
|
if (typeof j.name !== 'string') { return false }
|
|
@@ -19,7 +19,7 @@ export type Path = {
|
|
|
19
19
|
readonly dir: boolean;
|
|
20
20
|
};
|
|
21
21
|
export type FoundResult = {
|
|
22
|
-
readonly id:
|
|
22
|
+
readonly id: Module.Id;
|
|
23
23
|
readonly source: string;
|
|
24
24
|
};
|
|
25
25
|
export type Result = FoundResult | null;
|
|
@@ -49,19 +49,19 @@ declare const parseGlobal: (d: (local: string) => string | null) => (dir: boolea
|
|
|
49
49
|
declare const parse: (packageId: string) => (dependencies: (local: string) => string | null) => (local: string) => (path: string) => Path | null;
|
|
50
50
|
/**
|
|
51
51
|
* @typedef {{
|
|
52
|
-
* readonly id:
|
|
52
|
+
* readonly id: Module.Id
|
|
53
53
|
* readonly source: string
|
|
54
54
|
* }} FoundResult
|
|
55
55
|
*/
|
|
56
56
|
/** @typedef {FoundResult| null} Result */
|
|
57
57
|
/**
|
|
58
|
-
* @type {(packageGet:
|
|
59
|
-
* (moduleId:
|
|
58
|
+
* @type {(packageGet: Package.Get) =>
|
|
59
|
+
* (moduleId: Module.Id) =>
|
|
60
60
|
* (path: string) =>
|
|
61
61
|
* Result
|
|
62
62
|
* }
|
|
63
63
|
*/
|
|
64
|
-
declare const parseAndFind: (packageGet:
|
|
64
|
+
declare const parseAndFind: (packageGet: Package.Get) => (moduleId: Module.Id) => (path: string) => Result;
|
|
65
65
|
import * as List from '../../types/list/module.f.mjs';
|
|
66
|
-
import * as
|
|
67
|
-
import * as
|
|
66
|
+
import * as Module from '../module/module.f.mjs';
|
|
67
|
+
import * as Package from '../package/module.f.mjs';
|
|
@@ -2,8 +2,8 @@ import list, * as List from '../../types/list/module.f.mjs'
|
|
|
2
2
|
const { next, fold, reverse, first, flat, toArray, filterMap, isEmpty, concat } = list
|
|
3
3
|
import string from '../../types/string/module.f.mjs'
|
|
4
4
|
const { join } = string
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import * as Package from '../package/module.f.mjs'
|
|
6
|
+
import * as Module from '../module/module.f.mjs'
|
|
7
7
|
|
|
8
8
|
/** @typedef {readonly string[]} Items */
|
|
9
9
|
|
|
@@ -132,7 +132,7 @@ const parse = packageId => dependencies => {
|
|
|
132
132
|
|
|
133
133
|
/**
|
|
134
134
|
* @typedef {{
|
|
135
|
-
* readonly id:
|
|
135
|
+
* readonly id: Module.Id
|
|
136
136
|
* readonly source: string
|
|
137
137
|
* }} FoundResult
|
|
138
138
|
*/
|
|
@@ -140,8 +140,8 @@ const parse = packageId => dependencies => {
|
|
|
140
140
|
/** @typedef {FoundResult| null} Result */
|
|
141
141
|
|
|
142
142
|
/**
|
|
143
|
-
* @type {(packageGet:
|
|
144
|
-
* (moduleId:
|
|
143
|
+
* @type {(packageGet: Package.Get) =>
|
|
144
|
+
* (moduleId: Module.Id) =>
|
|
145
145
|
* (path: string) =>
|
|
146
146
|
* Result
|
|
147
147
|
* }
|
package/commonjs/path/test.f.mjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import _ from './module.f.mjs'
|
|
2
2
|
import dev from '../../dev/module.f.mjs'
|
|
3
3
|
const { todo } = dev
|
|
4
|
-
import json, * as
|
|
4
|
+
import json, * as Json from '../../json/module.f.mjs'
|
|
5
5
|
import f from '../../types/function/module.f.mjs'
|
|
6
6
|
const { identity } = f
|
|
7
7
|
import object, * as O from '../../types/object/module.f.mjs'
|
|
8
8
|
const { at } = object
|
|
9
|
-
import * as
|
|
9
|
+
import * as Package from '../package/module.f.mjs'
|
|
10
10
|
|
|
11
11
|
/** @type {<T>(o: O.Map<T>) => (s: string) => T|null} */
|
|
12
12
|
const i = o => s => at(s)(o)
|
|
13
13
|
|
|
14
|
-
/** @type {(g:
|
|
14
|
+
/** @type {(g: Json.Unknown) => string} */
|
|
15
15
|
const stringify = json.stringify(identity)
|
|
16
16
|
|
|
17
17
|
export default {
|
|
@@ -70,7 +70,7 @@ export default {
|
|
|
70
70
|
},
|
|
71
71
|
},
|
|
72
72
|
9: () => {
|
|
73
|
-
/** @type {O.Map<
|
|
73
|
+
/** @type {O.Map<Package.Package>} */
|
|
74
74
|
const packages = {
|
|
75
75
|
'': {
|
|
76
76
|
dependency: () => todo(),
|
|
@@ -81,7 +81,7 @@ export default {
|
|
|
81
81
|
if (result !== '{"id":{"package":"","path":["a","c"]},"source":"return \\"a/c\\""}') { throw result }
|
|
82
82
|
},
|
|
83
83
|
10: () => {
|
|
84
|
-
/** @type {O.Map<
|
|
84
|
+
/** @type {O.Map<Package.Package>} */
|
|
85
85
|
const packages = {
|
|
86
86
|
'': {
|
|
87
87
|
dependency: x => {
|
|
@@ -131,7 +131,7 @@ export default {
|
|
|
131
131
|
}
|
|
132
132
|
},
|
|
133
133
|
11: () => {
|
|
134
|
-
/** @type {O.Map<
|
|
134
|
+
/** @type {O.Map<Package.Package>} */
|
|
135
135
|
const packages = {
|
|
136
136
|
'': {
|
|
137
137
|
dependency: x => {
|
|
@@ -158,7 +158,7 @@ export default {
|
|
|
158
158
|
}
|
|
159
159
|
},
|
|
160
160
|
12: () => {
|
|
161
|
-
/** @type {O.Map<
|
|
161
|
+
/** @type {O.Map<Package.Package>} */
|
|
162
162
|
const packages = {
|
|
163
163
|
'': {
|
|
164
164
|
dependency: x => {
|
package/commonjs/test.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _ from './module.mjs'
|
|
2
|
-
import
|
|
2
|
+
import * as Run from './module/function/module.f.mjs'
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
5
|
ok: () => {
|
|
@@ -32,7 +32,7 @@ export default {
|
|
|
32
32
|
const d = _.compile(depSource)
|
|
33
33
|
if (d[0] !== 'ok') { throw d }
|
|
34
34
|
|
|
35
|
-
/** @type {
|
|
35
|
+
/** @type {Run.Require<number>} */
|
|
36
36
|
const req = path => prior => {
|
|
37
37
|
if (path !== 'm') { throw path }
|
|
38
38
|
return d[1](req)(prior + 1)
|
package/djs/module.f.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import list, * as List from '../types/list/module.f.mjs'
|
|
|
2
2
|
const { flat, map } = list
|
|
3
3
|
import string from '../types/string/module.f.mjs'
|
|
4
4
|
const { concat } = string
|
|
5
|
-
import
|
|
5
|
+
import * as O from '../types/object/module.f.mjs'
|
|
6
6
|
import f from '../types/function/module.f.mjs'
|
|
7
7
|
const { compose, fn } = f
|
|
8
8
|
const { entries } = Object
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as Operator from '../../types/function/operator/module.f.mjs'
|
|
2
2
|
import list, * as List from '../../types/list/module.f.mjs'
|
|
3
3
|
const { empty, flat, stateScan } = list
|
|
4
4
|
import bf from '../../types/bigfloat/module.f.mjs'
|
package/djs/tokenizer/test.f.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import tokenizer, * as tokenizerT from './module.f.mjs'
|
|
2
2
|
import list from '../../types/list/module.f.mjs'
|
|
3
|
-
const { toArray
|
|
3
|
+
const { toArray } = list
|
|
4
4
|
import djs from '../module.f.mjs'
|
|
5
5
|
import o from '../../types/object/module.f.mjs'
|
|
6
6
|
const { sort } = o
|
package/html/module.f.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import list, * as List from '../types/list/module.f.mjs'
|
|
|
2
2
|
const { map, flatMap, flat, concat: listConcat } = list
|
|
3
3
|
import s from '../types/string/module.f.mjs'
|
|
4
4
|
const { concat: stringConcat } = s
|
|
5
|
-
import
|
|
5
|
+
import * as O from '../types/object/module.f.mjs'
|
|
6
6
|
import f from '../types/function/module.f.mjs'
|
|
7
7
|
const { compose } = f
|
|
8
8
|
import utf16 from '../text/utf16/module.f.mjs'
|