functionalscript 0.0.369 → 0.0.372
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/.vscode/tasks.json +41 -0
- package/com/cpp/com.hpp +18 -12
- package/com/cpp/module.f.cjs +78 -0
- package/com/cpp/test/build.cjs +5 -3
- package/com/cpp/test/main.cpp +4 -0
- package/com/cpp/test.f.cjs +35 -2
- package/com/cs/{main.f.cjs → module.f.cjs} +14 -20
- package/com/cs/test.f.cjs +9 -26
- package/com/{main.f.cjs → module.f.cjs} +1 -1
- package/com/types/{main.f.cjs → module.f.cjs} +25 -2
- package/com/types/test.f.cjs +25 -0
- package/commonjs/build/{main.f.cjs → module.f.cjs} +7 -7
- package/commonjs/build/test.f.cjs +6 -6
- package/commonjs/module/function/{main.f.cjs → module.f.cjs} +1 -1
- package/commonjs/module/{main.f.cjs → module.f.cjs} +2 -2
- package/commonjs/{main.f.cjs → module.f.cjs} +4 -4
- package/commonjs/package/dependencies/{main.f.cjs → module.f.cjs} +2 -2
- package/commonjs/package/dependencies/test.f.cjs +1 -1
- package/commonjs/package/{main.f.cjs → module.f.cjs} +2 -2
- package/commonjs/package/test.f.cjs +1 -1
- package/commonjs/path/{main.f.cjs → module.f.cjs} +3 -3
- package/commonjs/path/test.f.cjs +7 -7
- package/dev/{main.f.cjs → module.f.cjs} +0 -0
- package/html/{main.f.cjs → module.f.cjs} +3 -3
- package/html/test.f.cjs +1 -1
- package/io/commonjs/{main.cjs → module.cjs} +3 -3
- package/io/commonjs/test.cjs +2 -2
- package/io/result/{main.cjs → module.cjs} +1 -1
- package/json/{main.f.cjs → module.f.cjs} +5 -5
- package/json/test.f.cjs +3 -3
- package/json/tokenizer/{main.f.cjs → module.f.cjs} +3 -3
- package/json/tokenizer/test.f.cjs +4 -4
- package/module.f.cjs +14 -0
- package/package.json +2 -2
- package/sha2/{main.f.cjs → module.f.cjs} +1 -1
- package/sha2/test.f.cjs +4 -4
- package/test.f.cjs +2 -1
- package/text/encoding/{main.f.cjs → module.f.cjs} +2 -2
- package/text/encoding/test.f.cjs +4 -4
- package/text/{main.f.cjs → module.f.cjs} +1 -1
- package/text/test.f.cjs +2 -2
- package/tsconfig.json +1 -1
- package/types/array/{main.f.cjs → module.f.cjs} +1 -1
- package/types/array/test.f.cjs +3 -3
- package/types/btree/find/{main.f.cjs → module.f.cjs} +4 -4
- package/types/btree/find/test.f.cjs +7 -7
- package/types/btree/{main.f.cjs → module.f.cjs} +6 -6
- package/types/btree/remove/{main.f.cjs → module.f.cjs} +6 -6
- package/types/btree/remove/test.f.cjs +6 -6
- package/types/btree/set/{main.f.cjs → module.f.cjs} +4 -4
- package/types/btree/set/test.f.cjs +5 -5
- package/types/btree/test.f.cjs +8 -8
- package/types/btree/types/{main.f.cjs → module.f.cjs} +0 -0
- package/types/function/compare/{main.f.cjs → module.f.cjs} +1 -1
- package/types/function/compare/test.f.cjs +1 -1
- package/types/function/{main.f.cjs → module.f.cjs} +2 -2
- package/types/function/operator/{main.f.cjs → module.f.cjs} +0 -0
- package/types/list/{main.f.cjs → module.f.cjs} +2 -2
- package/types/list/test.f.cjs +4 -4
- package/types/map/{main.f.cjs → module.f.cjs} +9 -9
- package/types/map/test.f.cjs +3 -3
- package/types/module.f.cjs +20 -0
- package/types/object/{main.f.cjs → module.f.cjs} +2 -2
- package/types/object/test.f.cjs +1 -1
- package/types/option/{main.f.cjs → module.f.cjs} +0 -0
- package/types/option/test.f.cjs +1 -1
- package/types/range/{main.f.cjs → module.f.cjs} +0 -0
- package/types/range/test.f.cjs +1 -1
- package/types/result/{main.f.cjs → module.f.cjs} +0 -0
- package/types/stringset/{main.f.cjs → module.f.cjs} +5 -5
- package/types/stringset/test.f.cjs +1 -1
- package/com/cpp/main.f.cjs +0 -10
- package/main.f.cjs +0 -14
- package/types/main.f.cjs +0 -20
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "2.0.0",
|
|
3
|
+
"tasks": [
|
|
4
|
+
{
|
|
5
|
+
"label": "build",
|
|
6
|
+
"command": "dotnet",
|
|
7
|
+
"type": "process",
|
|
8
|
+
"args": [
|
|
9
|
+
"build",
|
|
10
|
+
"${workspaceFolder}/com/cs/test/test.csproj",
|
|
11
|
+
"/property:GenerateFullPaths=true",
|
|
12
|
+
"/consoleloggerparameters:NoSummary"
|
|
13
|
+
],
|
|
14
|
+
"problemMatcher": "$msCompile"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"label": "publish",
|
|
18
|
+
"command": "dotnet",
|
|
19
|
+
"type": "process",
|
|
20
|
+
"args": [
|
|
21
|
+
"publish",
|
|
22
|
+
"${workspaceFolder}/com/cs/test/test.csproj",
|
|
23
|
+
"/property:GenerateFullPaths=true",
|
|
24
|
+
"/consoleloggerparameters:NoSummary"
|
|
25
|
+
],
|
|
26
|
+
"problemMatcher": "$msCompile"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"label": "watch",
|
|
30
|
+
"command": "dotnet",
|
|
31
|
+
"type": "process",
|
|
32
|
+
"args": [
|
|
33
|
+
"watch",
|
|
34
|
+
"run",
|
|
35
|
+
"--project",
|
|
36
|
+
"${workspaceFolder}/com/cs/test/test.csproj"
|
|
37
|
+
],
|
|
38
|
+
"problemMatcher": "$msCompile"
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
}
|
package/com/cpp/com.hpp
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
#
|
|
2
|
-
#define COM_HPP
|
|
1
|
+
#pragma once
|
|
3
2
|
|
|
4
3
|
#include <cstdint>
|
|
4
|
+
#include <cstddef>
|
|
5
|
+
|
|
6
|
+
#if defined(__aarch64__)
|
|
7
|
+
#define COM_STDCALL
|
|
8
|
+
#elif defined(__clang__)
|
|
9
|
+
#define COM_STDCALL __attribute__((stdcall))
|
|
10
|
+
#else
|
|
11
|
+
#define COM_STDCALL __stdcall
|
|
12
|
+
#endif
|
|
5
13
|
|
|
6
14
|
namespace com
|
|
7
15
|
{
|
|
@@ -14,34 +22,32 @@ namespace com
|
|
|
14
22
|
|
|
15
23
|
typedef uint32_t HRESULT;
|
|
16
24
|
typedef uint32_t ULONG;
|
|
25
|
+
typedef int32_t BOOL;
|
|
17
26
|
|
|
18
27
|
class IUnknown
|
|
19
28
|
{
|
|
20
29
|
public:
|
|
21
|
-
virtual HRESULT
|
|
22
|
-
virtual ULONG
|
|
23
|
-
virtual ULONG
|
|
30
|
+
virtual HRESULT COM_STDCALL QueryInterface(GUID const &riid, IUnknown **const ppvObject) noexcept = 0;
|
|
31
|
+
virtual ULONG COM_STDCALL AddRef() noexcept = 0;
|
|
32
|
+
virtual ULONG COM_STDCALL Release() noexcept = 0;
|
|
24
33
|
};
|
|
25
34
|
|
|
26
35
|
template <class I>
|
|
27
|
-
class
|
|
36
|
+
class ref
|
|
28
37
|
{
|
|
29
38
|
public:
|
|
30
|
-
explicit
|
|
39
|
+
explicit ref(I &other) noexcept : p(other.p)
|
|
31
40
|
{
|
|
32
41
|
p.AddRef();
|
|
33
42
|
}
|
|
34
|
-
|
|
43
|
+
ref(ref const &other) noexcept : ref(other.p)
|
|
35
44
|
{
|
|
36
45
|
}
|
|
37
|
-
~
|
|
46
|
+
~ref() noexcept
|
|
38
47
|
{
|
|
39
48
|
p.Release();
|
|
40
49
|
}
|
|
41
|
-
|
|
42
50
|
private:
|
|
43
51
|
I &p;
|
|
44
52
|
};
|
|
45
53
|
}
|
|
46
|
-
|
|
47
|
-
#endif
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
const types = require('../types/module.f.cjs')
|
|
2
|
+
const text = require('../../text/module.f.cjs')
|
|
3
|
+
const obj = require('../../types/object/module.f.cjs')
|
|
4
|
+
const { list } = require('../../types/module.f.cjs')
|
|
5
|
+
|
|
6
|
+
/** @type {(name: string) => (body: text.Block) => text.Block} */
|
|
7
|
+
const struct = name => body => [`struct ${name}`, '{', body, '};']
|
|
8
|
+
|
|
9
|
+
/** @type {(t: types.BaseType) => string} */
|
|
10
|
+
const baseType = t => {
|
|
11
|
+
switch (t) {
|
|
12
|
+
case 'u8': return 'uint8_t'
|
|
13
|
+
case 'i8': return 'int8_t'
|
|
14
|
+
case 'u16': return 'uint16_t'
|
|
15
|
+
case 'i16': return 'int16_t'
|
|
16
|
+
case 'u32': return 'uint32_t'
|
|
17
|
+
case 'i32': return 'int32_t'
|
|
18
|
+
case 'u64': return 'uint64_t'
|
|
19
|
+
case 'i64': return 'int64_t'
|
|
20
|
+
case 'usize': return 'size_t'
|
|
21
|
+
case 'isize': return 'ptrdiff_t'
|
|
22
|
+
case 'f32': return 'float'
|
|
23
|
+
case 'f64': return 'double'
|
|
24
|
+
case 'bool': return '::com::BOOL'
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** @type {(name: string) => (lib: types.Library) => text.Block} */
|
|
29
|
+
const cpp = name => lib => {
|
|
30
|
+
|
|
31
|
+
/** @type {(i: (t: string) => string) => (t: types.Type) => string} */
|
|
32
|
+
const objectType = i => t => {
|
|
33
|
+
if (typeof(t) === 'string') { return baseType(t) }
|
|
34
|
+
if (t.length === 2) { return `${type(t[1])}*` }
|
|
35
|
+
const [id] = t
|
|
36
|
+
if (lib[id].interface === undefined) { return id }
|
|
37
|
+
return i(id)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const type = objectType(id => `::com::ref<${id}>`)
|
|
41
|
+
|
|
42
|
+
/** @type {(s: types.Field) => text.Item} */
|
|
43
|
+
const field = ([name, t]) => `${type(t)} ${name};`
|
|
44
|
+
|
|
45
|
+
/** @type {(s: types.Struct) => text.Block} */
|
|
46
|
+
const defStruct = s => list.map(field)(Object.entries(s.struct))
|
|
47
|
+
|
|
48
|
+
/** @type {(fa: types.FieldArray) => string} */
|
|
49
|
+
const result = types.result('void')(type)
|
|
50
|
+
|
|
51
|
+
/** @type {(p: types.Field) => string} */
|
|
52
|
+
const param = ([name, t]) => `${objectType(id => `${id}&`)(t)} ${name}`
|
|
53
|
+
|
|
54
|
+
/** @type {(m: types.Method) => text.Item} */
|
|
55
|
+
const method = ([name, paramArray]) =>
|
|
56
|
+
`virtual ${result(paramArray)} COM_STDCALL ${name}(${list.join(', ')(list.map(param)(types.paramList(paramArray)))}) = 0;`
|
|
57
|
+
|
|
58
|
+
/** @type {(i: types.Interface) => text.Block} */
|
|
59
|
+
const defInterface = i => list.map(method)(Object.entries(i.interface))
|
|
60
|
+
|
|
61
|
+
/** @type {(kv: obj.Entry<types.Definition>) => text.Block} */
|
|
62
|
+
const def = ([name, d]) => d.interface === undefined
|
|
63
|
+
? struct(name)(defStruct(d))
|
|
64
|
+
: struct(`${name}: ::com::IUnknown`)(defInterface(d))
|
|
65
|
+
|
|
66
|
+
return list.flat([
|
|
67
|
+
['#pragma once', ''],
|
|
68
|
+
text.curly
|
|
69
|
+
('namespace')
|
|
70
|
+
(name)
|
|
71
|
+
(list.flatMap(def)(Object.entries(lib)))
|
|
72
|
+
])
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
module.exports = {
|
|
76
|
+
/** @readonly */
|
|
77
|
+
cpp,
|
|
78
|
+
}
|
package/com/cpp/test/build.cjs
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
const fs = require('node:fs')
|
|
2
2
|
const cp = require('node:child_process')
|
|
3
|
-
|
|
3
|
+
const cpp = require('../test.f.cjs').result
|
|
4
|
+
const os = require('node:os');
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
fs.writeFileSync('_result.hpp', cpp)
|
|
6
7
|
try {
|
|
7
|
-
|
|
8
|
+
const flags = os.platform() === 'win32' ? '' : ' -std=c++11 -lc++'
|
|
9
|
+
console.log(cp.execSync(`clang${flags} main.cpp`).toString())
|
|
8
10
|
} catch (e) {
|
|
9
11
|
// @ts-ignore
|
|
10
12
|
console.error(e.output.toString())
|
package/com/cpp/test/main.cpp
CHANGED
package/com/cpp/test.f.cjs
CHANGED
|
@@ -1,3 +1,36 @@
|
|
|
1
|
-
const _ = require('./
|
|
1
|
+
const _ = require('./module.f.cjs')
|
|
2
|
+
const library = require('../types/test.f.cjs')
|
|
3
|
+
const text = require('../../text/module.f.cjs')
|
|
4
|
+
const list = require('../../types/list/module.f.cjs')
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
const f = () =>
|
|
7
|
+
{
|
|
8
|
+
const r = list.join('\n')(text.flat(' ')(_.cpp('My')(library)))
|
|
9
|
+
const e =
|
|
10
|
+
'#pragma once\n' +
|
|
11
|
+
'\n' +
|
|
12
|
+
'namespace My\n' +
|
|
13
|
+
'{\n' +
|
|
14
|
+
' struct Slice\n' +
|
|
15
|
+
' {\n' +
|
|
16
|
+
' uint8_t* Start;\n' +
|
|
17
|
+
' size_t Size;\n' +
|
|
18
|
+
' };\n' +
|
|
19
|
+
' struct IMy: ::com::IUnknown\n' +
|
|
20
|
+
' {\n' +
|
|
21
|
+
' virtual Slice COM_STDCALL GetSlice() = 0;\n' +
|
|
22
|
+
' virtual void COM_STDCALL SetSlice(Slice slice) = 0;\n' +
|
|
23
|
+
' virtual ::com::BOOL* COM_STDCALL GetUnsafe() = 0;\n' +
|
|
24
|
+
' virtual void COM_STDCALL SetUnsafe(Slice* p, uint32_t size) = 0;\n' +
|
|
25
|
+
' virtual ::com::BOOL COM_STDCALL Some(IMy& p) = 0;\n' +
|
|
26
|
+
' virtual ::com::ref<IMy> COM_STDCALL GetIMy() = 0;\n' +
|
|
27
|
+
' };\n' +
|
|
28
|
+
'}'
|
|
29
|
+
if (r !== e) { throw r }
|
|
30
|
+
return r
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
module.exports = {
|
|
34
|
+
/** @readonly */
|
|
35
|
+
result: f()
|
|
36
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const types = require('../types/
|
|
2
|
-
const text = require('../../text/
|
|
3
|
-
const list = require('../../types/list/
|
|
4
|
-
const obj = require('../../types/object/
|
|
1
|
+
const types = require('../types/module.f.cjs')
|
|
2
|
+
const text = require('../../text/module.f.cjs')
|
|
3
|
+
const list = require('../../types/list/module.f.cjs')
|
|
4
|
+
const obj = require('../../types/object/module.f.cjs')
|
|
5
5
|
|
|
6
6
|
/** @type {(v: string) => string} */
|
|
7
7
|
const using = v => `using ${v};`
|
|
@@ -42,40 +42,34 @@ const baseType = t => {
|
|
|
42
42
|
const unsafe = isUnsafe => isUnsafe ? 'unsafe ' : ''
|
|
43
43
|
|
|
44
44
|
/** @type {(t: types.Type) => readonly[boolean, string]} */
|
|
45
|
-
const
|
|
45
|
+
const fullType = t =>
|
|
46
46
|
typeof (t) === 'string' ? [false, baseType(t)] :
|
|
47
47
|
t.length === 1 ? [false, t[0]] :
|
|
48
|
-
[true, `${type(t[1])
|
|
48
|
+
[true, `${type(t[1])}*`]
|
|
49
|
+
|
|
50
|
+
/** @type {(m: types.Type) => string} */
|
|
51
|
+
const type = t => fullType(t)[1]
|
|
49
52
|
|
|
50
53
|
/** @type {(f: types.Field) => string} */
|
|
51
|
-
const param = ([name, t]) => `${type(t)
|
|
54
|
+
const param = ([name, t]) => `${type(t)} ${name}`
|
|
52
55
|
|
|
53
56
|
/** @type {(f: types.Field) => string} */
|
|
54
57
|
const field = ([name, comType]) => {
|
|
55
|
-
const [isUnsafe, t] =
|
|
58
|
+
const [isUnsafe, t] = fullType(comType)
|
|
56
59
|
return `public ${unsafe(isUnsafe)}${t} ${name};`
|
|
57
60
|
}
|
|
58
61
|
|
|
59
|
-
/** @type {(m: types.FieldArray) => string} */
|
|
60
|
-
const result = m => {
|
|
61
|
-
const result = m._
|
|
62
|
-
return result === undefined ? 'void' : type(result)[1]
|
|
63
|
-
}
|
|
64
|
-
|
|
65
62
|
/** @type {(field: types.Field) => boolean} */
|
|
66
|
-
const isUnsafeField = field =>
|
|
67
|
-
|
|
68
|
-
/** @type {(kv: obj.Entry<types.Type>) => boolean} */
|
|
69
|
-
const isParam = kv => kv[0] !== '_'
|
|
63
|
+
const isUnsafeField = field => fullType(field[1])[0]
|
|
70
64
|
|
|
71
65
|
/** @type {(e: obj.Entry<types.FieldArray>) => readonly string[]} */
|
|
72
66
|
const method = ([name, m]) => {
|
|
73
67
|
const paramAndResultList = Object.entries(m)
|
|
74
|
-
const
|
|
68
|
+
const pl = types.paramList(m)
|
|
75
69
|
const isUnsafe = list.some(list.map(isUnsafeField)(paramAndResultList))
|
|
76
70
|
return [
|
|
77
71
|
'[PreserveSig]',
|
|
78
|
-
`${unsafe(isUnsafe)}${result(m)} ${name}(${list.join(', ')(list.map(param)(
|
|
72
|
+
`${unsafe(isUnsafe)}${types.result('void')(type)(m)} ${name}(${list.join(', ')(list.map(param)(pl))});`
|
|
79
73
|
]
|
|
80
74
|
}
|
|
81
75
|
|
package/com/cs/test.f.cjs
CHANGED
|
@@ -1,29 +1,8 @@
|
|
|
1
|
-
const types = require('../types/
|
|
2
|
-
const _ = require('./
|
|
3
|
-
const list = require('../../types/list/
|
|
4
|
-
const text = require('../../text/
|
|
5
|
-
|
|
6
|
-
/** @type {types.Library} */
|
|
7
|
-
const library = {
|
|
8
|
-
Slice: {
|
|
9
|
-
struct: {
|
|
10
|
-
Start: ['*', 'u8'],
|
|
11
|
-
Size: 'usize',
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
IMy: {
|
|
15
|
-
guid: 'C66FB270-2D80-49AD-BB6E-88C1F90B805D',
|
|
16
|
-
interface: {
|
|
17
|
-
GetSlice: { _: ['Slice'] },
|
|
18
|
-
SetSlice: { slice: ['Slice'] },
|
|
19
|
-
GetUnsafe: { _: ['*', 'bool'] },
|
|
20
|
-
SetUnsafe: {
|
|
21
|
-
p: ['*', ['Slice']],
|
|
22
|
-
size: 'u32'
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
}
|
|
26
|
-
}
|
|
1
|
+
const types = require('../types/module.f.cjs')
|
|
2
|
+
const _ = require('./module.f.cjs')
|
|
3
|
+
const list = require('../../types/list/module.f.cjs')
|
|
4
|
+
const text = require('../../text/module.f.cjs')
|
|
5
|
+
const library = require('../types/test.f.cjs')
|
|
27
6
|
|
|
28
7
|
const f = () =>
|
|
29
8
|
{
|
|
@@ -52,6 +31,10 @@ const f = () =>
|
|
|
52
31
|
' unsafe bool* GetUnsafe();\n' +
|
|
53
32
|
' [PreserveSig]\n' +
|
|
54
33
|
' unsafe void SetUnsafe(Slice* p, uint size);\n' +
|
|
34
|
+
' [PreserveSig]\n' +
|
|
35
|
+
' bool Some(IMy p);\n' +
|
|
36
|
+
' [PreserveSig]\n' +
|
|
37
|
+
' IMy GetIMy();\n' +
|
|
55
38
|
' }\n' +
|
|
56
39
|
'}'
|
|
57
40
|
if (cs !== e) { throw [cs,e] }
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
const obj = require('../../types/object/module.f.cjs')
|
|
2
|
+
const list = require('../../types/list/module.f.cjs')
|
|
3
|
+
const { types } = require('../module.f.cjs')
|
|
4
|
+
|
|
1
5
|
/** @typedef {{readonly[k in string]: Definition}} Library */
|
|
2
6
|
|
|
3
7
|
/** @typedef {Struct|Interface} Definition */
|
|
@@ -11,7 +15,7 @@
|
|
|
11
15
|
|
|
12
16
|
/** @typedef {{readonly[k in string]: Type}} FieldArray */
|
|
13
17
|
|
|
14
|
-
/** @typedef {
|
|
18
|
+
/** @typedef {obj.Entry<Type>} Field */
|
|
15
19
|
|
|
16
20
|
/**
|
|
17
21
|
* @typedef {{
|
|
@@ -22,6 +26,8 @@
|
|
|
22
26
|
|
|
23
27
|
/** @typedef {{readonly[k in string]: FieldArray}} MethodArray */
|
|
24
28
|
|
|
29
|
+
/** @typedef {obj.Entry<FieldArray>} Method */
|
|
30
|
+
|
|
25
31
|
/** @typedef {BaseType|Id|Pointer} Type */
|
|
26
32
|
|
|
27
33
|
/** @typedef {readonly[string]} Id */
|
|
@@ -46,4 +52,21 @@
|
|
|
46
52
|
|
|
47
53
|
/** @typedef {readonly['*', Type]} Pointer */
|
|
48
54
|
|
|
49
|
-
|
|
55
|
+
/** @type {(kv: obj.Entry<Type>) => boolean} */
|
|
56
|
+
const isParam = ([name]) => name !== '_'
|
|
57
|
+
|
|
58
|
+
/** @type {(fa: FieldArray) => list.List<Field> } */
|
|
59
|
+
const paramList = fa => list.filter(isParam)(Object.entries(fa))
|
|
60
|
+
|
|
61
|
+
/** @type {<T>(v: T) => (f: (type: Type) => T) => (fa: FieldArray) => T} */
|
|
62
|
+
const result = v => f => fa => {
|
|
63
|
+
const type = fa._
|
|
64
|
+
return type === undefined ? v : f(type)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
module.exports = {
|
|
68
|
+
/** @readonly */
|
|
69
|
+
paramList,
|
|
70
|
+
/** @readonly */
|
|
71
|
+
result,
|
|
72
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const _ = require('./module.f.cjs')
|
|
2
|
+
|
|
3
|
+
/** @type {_.Library} */
|
|
4
|
+
module.exports = {
|
|
5
|
+
Slice: {
|
|
6
|
+
struct: {
|
|
7
|
+
Start: ['*', 'u8'],
|
|
8
|
+
Size: 'usize',
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
IMy: {
|
|
12
|
+
guid: 'C66FB270-2D80-49AD-BB6E-88C1F90B805D',
|
|
13
|
+
interface: {
|
|
14
|
+
GetSlice: { _: ['Slice'] },
|
|
15
|
+
SetSlice: { slice: ['Slice'] },
|
|
16
|
+
GetUnsafe: { _: ['*', 'bool'] },
|
|
17
|
+
SetUnsafe: {
|
|
18
|
+
p: ['*', ['Slice']],
|
|
19
|
+
size: 'u32'
|
|
20
|
+
},
|
|
21
|
+
Some: { p: ['IMy'], _: 'bool' },
|
|
22
|
+
GetIMy: { _: ['IMy'] }
|
|
23
|
+
},
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
const package_ = require('../package/
|
|
2
|
-
const module_ = require('../module/
|
|
3
|
-
const function_ = require('../module/function/
|
|
4
|
-
const map = require('../../types/map/
|
|
5
|
-
const object = require('../../types/object/
|
|
6
|
-
const path = require('../path/
|
|
7
|
-
const stringSet = require('../../types/stringset/
|
|
1
|
+
const package_ = require('../package/module.f.cjs')
|
|
2
|
+
const module_ = require('../module/module.f.cjs')
|
|
3
|
+
const function_ = require('../module/function/module.f.cjs')
|
|
4
|
+
const map = require('../../types/map/module.f.cjs')
|
|
5
|
+
const object = require('../../types/object/module.f.cjs')
|
|
6
|
+
const path = require('../path/module.f.cjs')
|
|
7
|
+
const stringSet = require('../../types/stringset/module.f.cjs')
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @template M
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const _ = require('./
|
|
2
|
-
const map = require('../../types/map/
|
|
3
|
-
const module_ = require('../module/
|
|
4
|
-
const function_ = require('../module/function/
|
|
5
|
-
const result = require('../../types/result/
|
|
6
|
-
const package_ = require('../package/
|
|
1
|
+
const _ = require('./module.f.cjs')
|
|
2
|
+
const map = require('../../types/map/module.f.cjs')
|
|
3
|
+
const module_ = require('../module/module.f.cjs')
|
|
4
|
+
const function_ = require('../module/function/module.f.cjs')
|
|
5
|
+
const result = require('../../types/result/module.f.cjs')
|
|
6
|
+
const package_ = require('../package/module.f.cjs')
|
|
7
7
|
|
|
8
8
|
/** @type {{ readonly [k in string]?: result.Result<function_.Function_, unknown> }} */
|
|
9
9
|
const compileMap = {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* An IO interface for creating and running module functions.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
const result = require('../../../types/result/
|
|
5
|
+
const result = require('../../../types/result/module.f.cjs')
|
|
6
6
|
|
|
7
7
|
/** @typedef {<M>(require: Require<M>) => (prior: M) => Result<M>} Function_ */
|
|
8
8
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const object = require('../../types/object/
|
|
1
|
+
const object = require('../../types/object/module.f.cjs')
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @template M
|
|
@@ -53,7 +53,7 @@ const idToString = id => `${id.package}/${id.path.join('/')}`
|
|
|
53
53
|
|
|
54
54
|
module.exports = {
|
|
55
55
|
/** @readonly */
|
|
56
|
-
function: require('./function/
|
|
56
|
+
function: require('./function/module.f.cjs'),
|
|
57
57
|
/** @readonly */
|
|
58
58
|
dir,
|
|
59
59
|
/** @readonly */
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
|
|
11
11
|
module.exports = {
|
|
12
12
|
/** @readonly */
|
|
13
|
-
build: require('./build/
|
|
13
|
+
build: require('./build/module.f.cjs'),
|
|
14
14
|
/** @readonly */
|
|
15
|
-
module: require('./module/
|
|
15
|
+
module: require('./module/module.f.cjs'),
|
|
16
16
|
/** @readonly */
|
|
17
|
-
package: require('./package/
|
|
17
|
+
package: require('./package/module.f.cjs'),
|
|
18
18
|
/** @readonly */
|
|
19
|
-
path: require('./path/
|
|
19
|
+
path: require('./path/module.f.cjs'),
|
|
20
20
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const json = require('../../../json/
|
|
2
|
-
const list = require('../../../types/list/
|
|
1
|
+
const json = require('../../../json/module.f.cjs')
|
|
2
|
+
const list = require('../../../types/list/module.f.cjs')
|
|
3
3
|
|
|
4
4
|
/** @typedef {readonly[string, string]} DependencyJson */
|
|
5
5
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const list = require("../../types/list/
|
|
2
|
-
const package_ = require("../package/
|
|
3
|
-
const module_ = require("../module/
|
|
1
|
+
const list = require("../../types/list/module.f.cjs")
|
|
2
|
+
const package_ = require("../package/module.f.cjs")
|
|
3
|
+
const module_ = require("../module/module.f.cjs")
|
|
4
4
|
|
|
5
5
|
/** @typedef {readonly string[]} Items */
|
|
6
6
|
|
package/commonjs/path/test.f.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
const _ = require('./
|
|
2
|
-
const { todo } = require('../../dev/
|
|
3
|
-
const json = require('../../json/
|
|
4
|
-
const { identity } = require('../../types/function/
|
|
5
|
-
const object = require('../../types/object/
|
|
6
|
-
const { at } = require('../../types/object/
|
|
7
|
-
const package_ = require('../package/
|
|
1
|
+
const _ = require('./module.f.cjs')
|
|
2
|
+
const { todo } = require('../../dev/module.f.cjs')
|
|
3
|
+
const json = require('../../json/module.f.cjs')
|
|
4
|
+
const { identity } = require('../../types/function/module.f.cjs')
|
|
5
|
+
const object = require('../../types/object/module.f.cjs')
|
|
6
|
+
const { at } = require('../../types/object/module.f.cjs')
|
|
7
|
+
const package_ = require('../package/module.f.cjs')
|
|
8
8
|
|
|
9
9
|
/** @type {(g: json.Unknown|undefined) => string} */
|
|
10
10
|
const stringify = g => {
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const list = require('../types/list/
|
|
2
|
-
const object = require('../types/object/
|
|
3
|
-
const { operator, compose } = require('../types/function/
|
|
1
|
+
const list = require('../types/list/module.f.cjs')
|
|
2
|
+
const object = require('../types/object/module.f.cjs')
|
|
3
|
+
const { operator, compose } = require('../types/function/module.f.cjs')
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @typedef {|
|
package/html/test.f.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const { tryCatch } = require('../result/
|
|
2
|
-
const { unwrap } = require('../../types/result/
|
|
3
|
-
const moduleFunction = require('../../commonjs/module/function/
|
|
1
|
+
const { tryCatch } = require('../result/module.cjs')
|
|
2
|
+
const { unwrap } = require('../../types/result/module.f.cjs')
|
|
3
|
+
const moduleFunction = require('../../commonjs/module/function/module.f.cjs')
|
|
4
4
|
|
|
5
5
|
/** @type {(f: Function) => moduleFunction.Function_} */
|
|
6
6
|
const build = f => immutableRequire => mutableData => {
|
package/io/commonjs/test.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const list = require('../types/list/
|
|
2
|
-
const object = require('../types/object/
|
|
3
|
-
const operator = require('../types/function/operator/
|
|
4
|
-
const { compose } = require('../types/function/
|
|
1
|
+
const list = require('../types/list/module.f.cjs')
|
|
2
|
+
const object = require('../types/object/module.f.cjs')
|
|
3
|
+
const operator = require('../types/function/operator/module.f.cjs')
|
|
4
|
+
const { compose } = require('../types/function/module.f.cjs')
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @typedef {{
|
|
@@ -111,7 +111,7 @@ const isObject = value => typeof value === 'object' && value !== null && !(value
|
|
|
111
111
|
|
|
112
112
|
module.exports = {
|
|
113
113
|
/** @readonly */
|
|
114
|
-
tokenizer: require('./tokenizer/
|
|
114
|
+
tokenizer: require('./tokenizer/module.f.cjs'),
|
|
115
115
|
/** @readonly */
|
|
116
116
|
setProperty,
|
|
117
117
|
/** @readonly */
|