functionalscript 0.0.362 → 0.0.366
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/bun.yml +2 -2
- package/.github/workflows/deno.yml +1 -1
- package/com/cpp/main.f.cjs +10 -0
- package/com/cpp/test/build.cjs +11 -0
- package/com/cpp/test/main.cpp +5 -0
- package/com/cpp/test.f.cjs +3 -0
- package/com/cs/{main.f.js → main.f.cjs} +35 -35
- package/com/cs/test/{build.js → build.cjs} +1 -1
- package/com/cs/{test.f.js → test.f.cjs} +7 -13
- package/com/{main.f.js → main.f.cjs} +1 -1
- package/com/types/{main.f.js → main.f.cjs} +0 -0
- package/commonjs/build/{main.f.js → main.f.cjs} +7 -7
- package/commonjs/build/{test.f.js → test.f.cjs} +6 -6
- package/commonjs/{main.f.js → main.f.cjs} +8 -8
- package/commonjs/module/function/{main.f.js → main.f.cjs} +1 -1
- package/commonjs/module/{main.f.js → main.f.cjs} +2 -2
- package/commonjs/package/dependencies/{main.f.js → main.f.cjs} +2 -2
- package/commonjs/package/dependencies/{test.f.js → test.f.cjs} +1 -1
- package/commonjs/package/{main.f.js → main.f.cjs} +2 -2
- package/commonjs/package/{test.f.js → test.f.cjs} +2 -2
- package/commonjs/path/{main.f.js → main.f.cjs} +4 -4
- package/commonjs/path/{test.f.js → test.f.cjs} +7 -7
- package/dev/{main.f.js → main.f.cjs} +0 -0
- package/doc/README.md +9 -6
- package/html/{main.f.js → main.f.cjs} +4 -4
- package/html/{test.f.js → test.f.cjs} +1 -1
- package/io/commonjs/{main.js → main.cjs} +3 -3
- package/io/commonjs/{test.js → test.cjs} +2 -2
- package/io/nodejs/version/{main.js → main.cjs} +0 -0
- package/io/result/{main.js → main.cjs} +1 -1
- package/json/{main.f.js → main.f.cjs} +5 -5
- package/json/{test.f.js → test.f.cjs} +3 -3
- package/json/tokenizer/{main.f.js → main.f.cjs} +3 -3
- package/json/tokenizer/{test.f.js → test.f.cjs} +5 -5
- package/main.f.cjs +14 -0
- package/package.json +5 -5
- package/sha2/{main.f.js → main.f.cjs} +1 -1
- package/sha2/{test.f.js → test.f.cjs} +4 -4
- package/{test.f.js → test.f.cjs} +20 -20
- package/text/encoding/{main.f.js → main.f.cjs} +4 -4
- package/text/encoding/{test.f.js → test.f.cjs} +4 -4
- package/text/{main.f.js → main.f.cjs} +6 -1
- package/text/{test.f.js → test.f.cjs} +2 -2
- package/types/array/{main.f.js → main.f.cjs} +1 -1
- package/types/array/{test.f.js → test.f.cjs} +3 -3
- package/types/btree/find/{main.f.js → main.f.cjs} +4 -4
- package/types/btree/find/{test.f.js → test.f.cjs} +7 -7
- package/types/btree/{main.f.js → main.f.cjs} +6 -6
- package/types/btree/remove/{main.f.js → main.f.cjs} +6 -6
- package/types/btree/remove/{test.f.js → test.f.cjs} +6 -6
- package/types/btree/set/{main.f.js → main.f.cjs} +4 -4
- package/types/btree/set/{test.f.js → test.f.cjs} +5 -5
- package/types/btree/{test.f.js → test.f.cjs} +11 -11
- package/types/btree/types/{main.f.js → main.f.cjs} +0 -0
- package/types/function/compare/{main.f.js → main.f.cjs} +1 -1
- package/types/function/compare/{test.f.js → test.f.cjs} +1 -1
- package/types/function/{main.f.js → main.f.cjs} +2 -2
- package/types/function/operator/{main.f.js → main.f.cjs} +0 -0
- package/types/list/{main.f.js → main.f.cjs} +22 -25
- package/types/list/{test.f.js → test.f.cjs} +6 -6
- package/types/main.f.cjs +20 -0
- package/types/map/{main.f.js → main.f.cjs} +9 -9
- package/types/map/{test.f.js → test.f.cjs} +3 -3
- package/types/object/{main.f.js → main.f.cjs} +2 -2
- package/types/object/{test.f.js → test.f.cjs} +1 -1
- package/types/option/{main.f.js → main.f.cjs} +0 -0
- package/types/range/{main.f.js → main.f.cjs} +0 -0
- package/types/range/{test.f.js → test.f.cjs} +1 -1
- package/types/result/{main.f.js → main.f.cjs} +0 -0
- package/types/stringset/{main.f.js → main.f.cjs} +5 -5
- package/types/stringset/{test.f.js → test.f.cjs} +1 -1
- package/com/cpp/main.f.js +0 -1
- package/main.f.js +0 -14
- package/types/main.f.js +0 -20
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const fs = require('node:fs')
|
|
2
|
+
const cp = require('node:child_process')
|
|
3
|
+
// const cs = require('../test.f.js').result
|
|
4
|
+
|
|
5
|
+
// fs.writeFileSync('_result.cpp', cs)
|
|
6
|
+
try {
|
|
7
|
+
console.log(cp.execSync('clang main.cpp').toString())
|
|
8
|
+
} catch (e) {
|
|
9
|
+
// @ts-ignore
|
|
10
|
+
console.error(e.output.toString())
|
|
11
|
+
}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
const types = require('../types/main.f.
|
|
2
|
-
const text = require('../../text/main.f.
|
|
3
|
-
const list = require('../../types/list/main.f.
|
|
4
|
-
const obj = require('../../types/object/main.f.
|
|
1
|
+
const types = require('../types/main.f.cjs')
|
|
2
|
+
const text = require('../../text/main.f.cjs')
|
|
3
|
+
const list = require('../../types/list/main.f.cjs')
|
|
4
|
+
const obj = require('../../types/object/main.f.cjs')
|
|
5
5
|
|
|
6
6
|
/** @type {(v: string) => string} */
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
/** @type {(type: string) => (name: string) => (body: text.Block) => text.Block} */
|
|
10
|
-
const csBlock = type => name => body => [`${type} ${name}`, '{', body, '}']
|
|
7
|
+
const using = v => `using ${v};`
|
|
11
8
|
|
|
12
9
|
/**
|
|
13
10
|
* @type {(attributes: list.List<string>) =>
|
|
@@ -16,14 +13,14 @@ const csBlock = type => name => body => [`${type} ${name}`, '{', body, '}']
|
|
|
16
13
|
* (body: text.Block) =>
|
|
17
14
|
* list.List<text.Item>}
|
|
18
15
|
*/
|
|
19
|
-
const
|
|
16
|
+
const typeDef = attributes => type => name => body =>
|
|
20
17
|
list.flat([
|
|
21
18
|
list.map(v => `[${v}]`)(attributes),
|
|
22
|
-
|
|
19
|
+
text.curly(`public ${type}`)(name)(body)
|
|
23
20
|
])
|
|
24
21
|
|
|
25
22
|
/** @type {(t: types.BaseType) => string} */
|
|
26
|
-
const
|
|
23
|
+
const baseType = t => {
|
|
27
24
|
switch (t) {
|
|
28
25
|
case 'bool': return 'bool'
|
|
29
26
|
case 'f32': return 'float'
|
|
@@ -45,69 +42,72 @@ const csBaseType = t => {
|
|
|
45
42
|
const unsafe = isUnsafe => isUnsafe ? 'unsafe ' : ''
|
|
46
43
|
|
|
47
44
|
/** @type {(t: types.Type) => readonly[boolean, string]} */
|
|
48
|
-
const
|
|
49
|
-
typeof (t) === 'string' ? [false,
|
|
45
|
+
const type = t =>
|
|
46
|
+
typeof (t) === 'string' ? [false, baseType(t)] :
|
|
50
47
|
t.length === 1 ? [false, t[0]] :
|
|
51
|
-
[true, `${
|
|
48
|
+
[true, `${type(t[1])[1]}*`]
|
|
52
49
|
|
|
53
50
|
/** @type {(f: types.Field) => string} */
|
|
54
|
-
const
|
|
51
|
+
const param = ([name, t]) => `${type(t)[1]} ${name}`
|
|
55
52
|
|
|
56
53
|
/** @type {(f: types.Field) => string} */
|
|
57
|
-
const
|
|
58
|
-
const [isUnsafe, t] =
|
|
54
|
+
const field = ([name, comType]) => {
|
|
55
|
+
const [isUnsafe, t] = type(comType)
|
|
59
56
|
return `public ${unsafe(isUnsafe)}${t} ${name};`
|
|
60
57
|
}
|
|
61
58
|
|
|
62
|
-
/** @type {(m: types.FieldArray) =>
|
|
63
|
-
const
|
|
59
|
+
/** @type {(m: types.FieldArray) => string} */
|
|
60
|
+
const result = m => {
|
|
61
|
+
const result = m._
|
|
62
|
+
return result === undefined ? 'void' : type(result)[1]
|
|
63
|
+
}
|
|
64
64
|
|
|
65
65
|
/** @type {(field: types.Field) => boolean} */
|
|
66
|
-
const isUnsafeField = field =>
|
|
66
|
+
const isUnsafeField = field => type(field[1])[0]
|
|
67
67
|
|
|
68
68
|
/** @type {(kv: obj.Entry<types.Type>) => boolean} */
|
|
69
69
|
const isParam = kv => kv[0] !== '_'
|
|
70
70
|
|
|
71
71
|
/** @type {(e: obj.Entry<types.FieldArray>) => readonly string[]} */
|
|
72
|
-
const
|
|
73
|
-
const
|
|
74
|
-
const
|
|
75
|
-
const isUnsafe =
|
|
72
|
+
const method = ([name, m]) => {
|
|
73
|
+
const paramAndResultList = Object.entries(m)
|
|
74
|
+
const paramList = list.filter(isParam)(paramAndResultList)
|
|
75
|
+
const isUnsafe = list.some(list.map(isUnsafeField)(paramAndResultList))
|
|
76
76
|
return [
|
|
77
77
|
'[PreserveSig]',
|
|
78
|
-
`${unsafe(isUnsafe)}${result
|
|
78
|
+
`${unsafe(isUnsafe)}${result(m)} ${name}(${list.join(', ')(list.map(param)(paramList))});`
|
|
79
79
|
]
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
/** @type {(e: obj.Entry<types.Definition>) => list.List<text.Item>} */
|
|
83
|
-
const
|
|
83
|
+
const def = ([n, d]) => {
|
|
84
84
|
const i = d.interface
|
|
85
85
|
return i === undefined ?
|
|
86
|
-
|
|
86
|
+
typeDef
|
|
87
87
|
(['StructLayout(LayoutKind.Sequential)'])
|
|
88
88
|
('struct')
|
|
89
89
|
(n)
|
|
90
|
-
(
|
|
91
|
-
|
|
90
|
+
(list.map(field)(Object.entries(d.struct))) :
|
|
91
|
+
typeDef
|
|
92
92
|
([`Guid("${d.guid}")`, 'InterfaceType(ComInterfaceType.InterfaceIsIUnknown)'])
|
|
93
93
|
('interface')
|
|
94
94
|
(n)
|
|
95
|
-
(
|
|
95
|
+
(list.flatMap(method)(Object.entries(d.interface)))
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
/** @type {(name: string) => (library: types.Library) => text.Block} */
|
|
99
99
|
const cs = name => library => {
|
|
100
|
-
const v = list.flatMap(
|
|
100
|
+
const v = list.flatMap(def)(Object.entries(library))
|
|
101
101
|
|
|
102
102
|
/** @type {text.Block} */
|
|
103
103
|
const h = [
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
using('System'),
|
|
105
|
+
using('System.Runtime.InteropServices'),
|
|
106
106
|
''
|
|
107
107
|
]
|
|
108
108
|
|
|
109
|
-
const ns =
|
|
110
|
-
return
|
|
109
|
+
const ns = text.curly('namespace')(name)(() => v)
|
|
110
|
+
return list.flat([h, ns])
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
module.exports = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const types = require('../types/main.f.
|
|
2
|
-
const _ = require('./main.f.
|
|
3
|
-
const list = require('../../types/list/main.f.
|
|
4
|
-
const text = require('../../text/main.f.
|
|
1
|
+
const types = require('../types/main.f.cjs')
|
|
2
|
+
const _ = require('./main.f.cjs')
|
|
3
|
+
const list = require('../../types/list/main.f.cjs')
|
|
4
|
+
const text = require('../../text/main.f.cjs')
|
|
5
5
|
|
|
6
6
|
/** @type {types.Library} */
|
|
7
7
|
const library = {
|
|
@@ -14,15 +14,9 @@ const library = {
|
|
|
14
14
|
IMy: {
|
|
15
15
|
guid: 'C66FB270-2D80-49AD-BB6E-88C1F90B805D',
|
|
16
16
|
interface: {
|
|
17
|
-
GetSlice: {
|
|
18
|
-
|
|
19
|
-
},
|
|
20
|
-
SetSlice: {
|
|
21
|
-
slice: ['Slice']
|
|
22
|
-
},
|
|
23
|
-
GetUnsafe: {
|
|
24
|
-
_: ['*', 'bool']
|
|
25
|
-
},
|
|
17
|
+
GetSlice: { _: ['Slice'] },
|
|
18
|
+
SetSlice: { slice: ['Slice'] },
|
|
19
|
+
GetUnsafe: { _: ['*', 'bool'] },
|
|
26
20
|
SetUnsafe: {
|
|
27
21
|
p: ['*', ['Slice']],
|
|
28
22
|
size: 'u32'
|
|
File without changes
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
const package_ = require('../package/main.f.
|
|
2
|
-
const module_ = require('../module/main.f.
|
|
3
|
-
const function_ = require('../module/function/main.f.
|
|
4
|
-
const map = require('../../types/map/main.f.
|
|
5
|
-
const object = require('../../types/object/main.f.
|
|
6
|
-
const path = require('../path/main.f.
|
|
7
|
-
const stringSet = require('../../types/stringset/main.f.
|
|
1
|
+
const package_ = require('../package/main.f.cjs')
|
|
2
|
+
const module_ = require('../module/main.f.cjs')
|
|
3
|
+
const function_ = require('../module/function/main.f.cjs')
|
|
4
|
+
const map = require('../../types/map/main.f.cjs')
|
|
5
|
+
const object = require('../../types/object/main.f.cjs')
|
|
6
|
+
const path = require('../path/main.f.cjs')
|
|
7
|
+
const stringSet = require('../../types/stringset/main.f.cjs')
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @template M
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const _ = require('./main.f.
|
|
2
|
-
const map = require('../../types/map/main.f.
|
|
3
|
-
const module_ = require('../module/main.f.
|
|
4
|
-
const function_ = require('../module/function/main.f.
|
|
5
|
-
const result = require('../../types/result/main.f.
|
|
6
|
-
const package_ = require('../package/main.f.
|
|
1
|
+
const _ = require('./main.f.cjs')
|
|
2
|
+
const map = require('../../types/map/main.f.cjs')
|
|
3
|
+
const module_ = require('../module/main.f.cjs')
|
|
4
|
+
const function_ = require('../module/function/main.f.cjs')
|
|
5
|
+
const result = require('../../types/result/main.f.cjs')
|
|
6
|
+
const package_ = require('../package/main.f.cjs')
|
|
7
7
|
|
|
8
8
|
/** @type {{ readonly [k in string]?: result.Result<function_.Function_, unknown> }} */
|
|
9
9
|
const compileMap = {
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
/** @typedef {(packageName: string) => PackageMap|Package|undefined} PackageMap */
|
|
2
2
|
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
4
|
* @typedef {readonly[
|
|
5
|
-
* string,
|
|
6
|
-
* PackageMap,
|
|
5
|
+
* string,
|
|
6
|
+
* PackageMap,
|
|
7
7
|
* (fileName: string) => string|undefined
|
|
8
|
-
* ]} Package
|
|
8
|
+
* ]} Package
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
module.exports = {
|
|
12
12
|
/** @readonly */
|
|
13
|
-
build: require('./build/main.f.
|
|
13
|
+
build: require('./build/main.f.cjs'),
|
|
14
14
|
/** @readonly */
|
|
15
|
-
module: require('./module/main.f.
|
|
15
|
+
module: require('./module/main.f.cjs'),
|
|
16
16
|
/** @readonly */
|
|
17
|
-
package: require('./package/main.f.
|
|
17
|
+
package: require('./package/main.f.cjs'),
|
|
18
18
|
/** @readonly */
|
|
19
|
-
path: require('./path/main.f.
|
|
19
|
+
path: require('./path/main.f.cjs'),
|
|
20
20
|
}
|
|
@@ -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/main.f.
|
|
5
|
+
const result = require('../../../types/result/main.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/main.f.
|
|
1
|
+
const object = require('../../types/object/main.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/main.f.
|
|
56
|
+
function: require('./function/main.f.cjs'),
|
|
57
57
|
/** @readonly */
|
|
58
58
|
dir,
|
|
59
59
|
/** @readonly */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const json = require('../../../json/main.f.
|
|
2
|
-
const list = require('../../../types/list/main.f.
|
|
1
|
+
const json = require('../../../json/main.f.cjs')
|
|
2
|
+
const list = require('../../../types/list/main.f.cjs')
|
|
3
3
|
|
|
4
4
|
/** @typedef {readonly[string, string]} DependencyJson */
|
|
5
5
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const list = require("../../types/list/main.f.
|
|
2
|
-
const package_ = require("../package/main.f.
|
|
3
|
-
const module_ = require("../module/main.f.
|
|
1
|
+
const list = require("../../types/list/main.f.cjs")
|
|
2
|
+
const package_ = require("../package/main.f.cjs")
|
|
3
|
+
const module_ = require("../module/main.f.cjs")
|
|
4
4
|
|
|
5
5
|
/** @typedef {readonly string[]} Items */
|
|
6
6
|
|
|
@@ -98,7 +98,7 @@ const mapDependency = d => ([external, internal]) => {
|
|
|
98
98
|
* (items: list.List<string>) =>
|
|
99
99
|
* Path|undefined}
|
|
100
100
|
*/
|
|
101
|
-
const parseGlobal = dependencies =>
|
|
101
|
+
const parseGlobal = dependencies =>
|
|
102
102
|
{
|
|
103
103
|
const filterMap = list.filterMap(mapDependency(dependencies))
|
|
104
104
|
return dir => items => {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
const _ = require('./main.f.
|
|
2
|
-
const { todo } = require('../../dev/main.f.
|
|
3
|
-
const json = require('../../json/main.f.
|
|
4
|
-
const { identity } = require('../../types/function/main.f.
|
|
5
|
-
const object = require('../../types/object/main.f.
|
|
6
|
-
const { at } = require('../../types/object/main.f.
|
|
7
|
-
const package_ = require('../package/main.f.
|
|
1
|
+
const _ = require('./main.f.cjs')
|
|
2
|
+
const { todo } = require('../../dev/main.f.cjs')
|
|
3
|
+
const json = require('../../json/main.f.cjs')
|
|
4
|
+
const { identity } = require('../../types/function/main.f.cjs')
|
|
5
|
+
const object = require('../../types/object/main.f.cjs')
|
|
6
|
+
const { at } = require('../../types/object/main.f.cjs')
|
|
7
|
+
const package_ = require('../package/main.f.cjs')
|
|
8
8
|
|
|
9
9
|
/** @type {(g: json.Unknown|undefined) => string} */
|
|
10
10
|
const stringify = g => {
|
|
File without changes
|
package/doc/README.md
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
# Documentation
|
|
2
2
|
|
|
3
|
+
FunctionalScript files have `.f.cjs` file extensions because it's using a `Common.JS` module system. See
|
|
4
|
+
[ESM. Resolver Algorithm Specification](https://nodejs.org/api/esm.html#resolver-algorithm-specification).
|
|
5
|
+
|
|
3
6
|
## 1. Creating a New Repository
|
|
4
7
|
|
|
5
8
|
Creating from a template https://github.com/functionalscript/template/generate
|
|
6
9
|
|
|
7
|
-
## 1.1. Creating From Scratch
|
|
10
|
+
## 1.1. Creating From Scratch
|
|
8
11
|
|
|
9
12
|
Prerequisites:
|
|
10
13
|
|
|
@@ -16,10 +19,10 @@ Creating a new GitHub repository
|
|
|
16
19
|
|
|
17
20
|
1. Create a public git repository on GitHub using Node template.
|
|
18
21
|
2. Clone the repository.
|
|
19
|
-
3. Go to the root directory of the cloned repository.
|
|
22
|
+
3. Go to the root directory of the cloned repository.
|
|
20
23
|
4. Run `npm init`. It should create `package.json` file.
|
|
21
|
-
5. Create
|
|
22
|
-
6. Edit the `
|
|
24
|
+
5. Create a `main.f.cjs` file in the repository root directory.
|
|
25
|
+
6. Edit the `main.f.cjs` file. For example
|
|
23
26
|
```js
|
|
24
27
|
module.exports = "Hello world!"
|
|
25
28
|
```
|
|
@@ -54,7 +57,7 @@ module.exports = x => x * x
|
|
|
54
57
|
#### 2.2.1. Local File
|
|
55
58
|
|
|
56
59
|
```js
|
|
57
|
-
const x = require('./folder/
|
|
60
|
+
const x = require('./folder/main.f.cjs')
|
|
58
61
|
```
|
|
59
62
|
|
|
60
63
|
### 2.2.2. External Module
|
|
@@ -62,7 +65,7 @@ const x = require('./folder/index.js')
|
|
|
62
65
|
Run `npm install -D github:USER/REPO`
|
|
63
66
|
|
|
64
67
|
```js
|
|
65
|
-
const x = require(`REPO/DIR/FILE.
|
|
68
|
+
const x = require(`REPO/DIR/FILE.f.cjs`)
|
|
66
69
|
```
|
|
67
70
|
|
|
68
71
|
### 2.3. Functions
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const list = require('../types/list/main.f.
|
|
2
|
-
const object = require('../types/object/main.f.
|
|
3
|
-
const { operator, compose } = require('../types/function/main.f.
|
|
1
|
+
const list = require('../types/list/main.f.cjs')
|
|
2
|
+
const object = require('../types/object/main.f.cjs')
|
|
3
|
+
const { operator, compose } = require('../types/function/main.f.cjs')
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @typedef {|
|
|
@@ -73,7 +73,7 @@ const escapeCharCode = code => {
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
const escape = compose(list.
|
|
76
|
+
const escape = compose(list.toCharCodeList)(list.map(escapeCharCode))
|
|
77
77
|
|
|
78
78
|
/** @type {(n: Node) => list.List<string>} */
|
|
79
79
|
const node = n => typeof n === 'string' ? escape(n) : element(n)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const { tryCatch } = require('../result/main.
|
|
2
|
-
const { unwrap } = require('../../types/result/main.f.
|
|
3
|
-
const moduleFunction = require('../../commonjs/module/function/main.f.
|
|
1
|
+
const { tryCatch } = require('../result/main.cjs')
|
|
2
|
+
const { unwrap } = require('../../types/result/main.f.cjs')
|
|
3
|
+
const moduleFunction = require('../../commonjs/module/function/main.f.cjs')
|
|
4
4
|
|
|
5
5
|
/** @type {(f: Function) => moduleFunction.Function_} */
|
|
6
6
|
const build = f => immutableRequire => mutableData => {
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const list = require('../types/list/main.f.
|
|
2
|
-
const object = require('../types/object/main.f.
|
|
3
|
-
const operator = require('../types/function/operator/main.f.
|
|
4
|
-
const { compose } = require('../types/function/main.f.
|
|
1
|
+
const list = require('../types/list/main.f.cjs')
|
|
2
|
+
const object = require('../types/object/main.f.cjs')
|
|
3
|
+
const operator = require('../types/function/operator/main.f.cjs')
|
|
4
|
+
const { compose } = require('../types/function/main.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/main.f.
|
|
114
|
+
tokenizer: require('./tokenizer/main.f.cjs'),
|
|
115
115
|
/** @readonly */
|
|
116
116
|
setProperty,
|
|
117
117
|
/** @readonly */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const json = require('./main.f.
|
|
2
|
-
const { sort } = require('../types/object/main.f.
|
|
3
|
-
const { identity } = require('../types/function/main.f.
|
|
1
|
+
const json = require('./main.f.cjs')
|
|
2
|
+
const { sort } = require('../types/object/main.f.cjs')
|
|
3
|
+
const { identity } = require('../types/function/main.f.cjs')
|
|
4
4
|
|
|
5
5
|
if (json.setProperty("Hello")([])({}) !== "Hello") { throw 'error' }
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const operator = require('../../types/function/operator/main.f.
|
|
2
|
-
const list = require('../../types/list/main.f.
|
|
3
|
-
const range = require('../../types/range/main.f.
|
|
1
|
+
const operator = require('../../types/function/operator/main.f.cjs')
|
|
2
|
+
const list = require('../../types/list/main.f.cjs')
|
|
3
|
+
const range = require('../../types/range/main.f.cjs')
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @typedef {{
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
const tokenizer = require('./main.f.
|
|
2
|
-
const list = require('../../types/list/main.f.
|
|
3
|
-
const json = require('../main.f.
|
|
4
|
-
const { sort } = require('../../types/object/main.f.
|
|
1
|
+
const tokenizer = require('./main.f.cjs')
|
|
2
|
+
const list = require('../../types/list/main.f.cjs')
|
|
3
|
+
const json = require('../main.f.cjs')
|
|
4
|
+
const { sort } = require('../../types/object/main.f.cjs')
|
|
5
5
|
|
|
6
6
|
/** @type {(s: string) => readonly tokenizer.JsonToken[]} */
|
|
7
|
-
const tokenizeString = s => list.toArray(tokenizer.tokenize(list.
|
|
7
|
+
const tokenizeString = s => list.toArray(tokenizer.tokenize(list.toCharCodeList(s)))
|
|
8
8
|
|
|
9
9
|
const stringify = json.stringify(sort)
|
|
10
10
|
|
package/main.f.cjs
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
/** @readonly */
|
|
3
|
+
commonjs: require('./commonjs/main.f.cjs'),
|
|
4
|
+
/** @readonly */
|
|
5
|
+
dev: require('./dev/main.f.cjs'),
|
|
6
|
+
/** @readonly */
|
|
7
|
+
html: require('./html/main.f.cjs'),
|
|
8
|
+
/** @readonly */
|
|
9
|
+
json: require('./json/main.f.cjs'),
|
|
10
|
+
/** @readonly */
|
|
11
|
+
sha2: require('./sha2/main.f.cjs'),
|
|
12
|
+
/** @readonly */
|
|
13
|
+
types: require('./types/main.f.cjs'),
|
|
14
|
+
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "functionalscript",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.366",
|
|
4
4
|
"description": "FunctionalScript is a functional subset of JavaScript",
|
|
5
|
-
"main": "main.f.
|
|
5
|
+
"main": "main.f.cjs",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"tsc": "tsc",
|
|
8
8
|
"test": "tsc && npm run test-only",
|
|
9
|
-
"version": "node ./io/nodejs/version/main.
|
|
10
|
-
"test-only": "node --trace-uncaught ./test.f.
|
|
9
|
+
"version": "node ./io/nodejs/version/main.cjs",
|
|
10
|
+
"test-only": "node --trace-uncaught ./test.f.cjs"
|
|
11
11
|
},
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"homepage": "https://github.com/functionalscript/functionalscript#readme",
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@types/node": "^18.
|
|
32
|
+
"@types/node": "^18.6.2",
|
|
33
33
|
"typescript": "^4.7.4"
|
|
34
34
|
}
|
|
35
35
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const _ = require('./main.f.
|
|
2
|
-
const json = require('../json/main.f.
|
|
3
|
-
const { sort } = require('../types/object/main.f.
|
|
4
|
-
const list = require('../types/list/main.f.
|
|
1
|
+
const _ = require('./main.f.cjs')
|
|
2
|
+
const json = require('../json/main.f.cjs')
|
|
3
|
+
const { sort } = require('../types/object/main.f.cjs')
|
|
4
|
+
const list = require('../types/list/main.f.cjs')
|
|
5
5
|
|
|
6
6
|
/** @type {(a: number) => number} */
|
|
7
7
|
const toU32 = x => (x + 0x1_0000_0000) % 0x1_0000_0000
|