functionalscript 0.0.376 → 0.0.379
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/nodejs/version/main.cjs +5 -14
- package/nodejs/version/module.f.cjs +40 -0
- package/nodejs/version/test.f.cjs +88 -0
- package/package.json +2 -2
- package/test.f.cjs +1 -0
- package/text/encoding/README.md +9 -9
package/nodejs/version/main.cjs
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
const
|
|
1
|
+
const { version } = require('./module.f.cjs')
|
|
2
|
+
|
|
3
|
+
const child_process = require('node:child_process')
|
|
4
|
+
const fs = require('node:fs')
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const r = b.toString().split('\n').length
|
|
8
|
-
|
|
9
|
-
const v = `0.0.${r}`
|
|
10
|
-
|
|
11
|
-
console.log(`version: ${v}`)
|
|
12
|
-
|
|
13
|
-
const x = { ...package_json, version: v }
|
|
14
|
-
|
|
15
|
-
fs.writeFileSync('package.json', JSON.stringify(x, null, 2))
|
|
6
|
+
version({ child_process, fs })
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const pack = require('../../commonjs/package/module.f.cjs')
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {{
|
|
5
|
+
* readonly execSync: (cmd: string) => Buffer
|
|
6
|
+
* }} ChildProcess
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @template T
|
|
11
|
+
* @typedef {{
|
|
12
|
+
* readonly readFileSync: (name: string) => Buffer
|
|
13
|
+
* readonly writeFileSync: (name: string, content: string) => T
|
|
14
|
+
* }} Fs
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @template T
|
|
19
|
+
* @typedef {{
|
|
20
|
+
* readonly child_process: ChildProcess
|
|
21
|
+
* readonly fs: Fs<T>
|
|
22
|
+
* }} Node
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/** @type {<T>(node: Node<T>) => T} */
|
|
26
|
+
const version = ({ child_process, fs }) =>
|
|
27
|
+
fs.writeFileSync(
|
|
28
|
+
'package.json',
|
|
29
|
+
JSON.stringify(
|
|
30
|
+
{
|
|
31
|
+
...JSON.parse(fs.readFileSync('package.json').toString()),
|
|
32
|
+
version: `0.0.${child_process.execSync('git log --oneline').toString().split('\n').length - 1}`
|
|
33
|
+
},
|
|
34
|
+
null,
|
|
35
|
+
2))
|
|
36
|
+
|
|
37
|
+
module.exports = {
|
|
38
|
+
/** @readonly */
|
|
39
|
+
version,
|
|
40
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
const _ = require('./module.f.cjs')
|
|
2
|
+
|
|
3
|
+
const x = {
|
|
4
|
+
"name": "functionalscript",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"description": "FunctionalScript is a functional subset of JavaScript",
|
|
7
|
+
"main": "module.f.cjs",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"tsc": "tsc",
|
|
10
|
+
"test": "tsc && npm run test-only",
|
|
11
|
+
"version": "node ./nodejs/version/main.cjs",
|
|
12
|
+
"test-only": "node --trace-uncaught ./test.f.cjs"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/functionalscript/functionalscript.git"
|
|
17
|
+
},
|
|
18
|
+
"author": "NatFoam",
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"keywords": [
|
|
21
|
+
"lambda",
|
|
22
|
+
"functional-programming",
|
|
23
|
+
"closure",
|
|
24
|
+
"pure-functional",
|
|
25
|
+
"typescript",
|
|
26
|
+
"programming-language",
|
|
27
|
+
"lazy-evaluation"
|
|
28
|
+
],
|
|
29
|
+
"bugs": {
|
|
30
|
+
"url": "https://github.com/functionalscript/functionalscript/issues"
|
|
31
|
+
},
|
|
32
|
+
"homepage": "https://github.com/functionalscript/functionalscript#readme",
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/node": "^18.6.2",
|
|
35
|
+
"typescript": "^4.7.4"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const e = '{\n' +
|
|
40
|
+
' "name": "functionalscript",\n' +
|
|
41
|
+
' "version": "0.0.2",\n' +
|
|
42
|
+
' "description": "FunctionalScript is a functional subset of JavaScript",\n' +
|
|
43
|
+
' "main": "module.f.cjs",\n' +
|
|
44
|
+
' "scripts": {\n' +
|
|
45
|
+
' "tsc": "tsc",\n' +
|
|
46
|
+
' "test": "tsc && npm run test-only",\n' +
|
|
47
|
+
' "version": "node ./nodejs/version/main.cjs",\n' +
|
|
48
|
+
' "test-only": "node --trace-uncaught ./test.f.cjs"\n' +
|
|
49
|
+
' },\n' +
|
|
50
|
+
' "repository": {\n' +
|
|
51
|
+
' "type": "git",\n' +
|
|
52
|
+
' "url": "git+https://github.com/functionalscript/functionalscript.git"\n' +
|
|
53
|
+
' },\n' +
|
|
54
|
+
' "author": "NatFoam",\n' +
|
|
55
|
+
' "license": "MIT",\n' +
|
|
56
|
+
' "keywords": [\n' +
|
|
57
|
+
' "lambda",\n' +
|
|
58
|
+
' "functional-programming",\n' +
|
|
59
|
+
' "closure",\n' +
|
|
60
|
+
' "pure-functional",\n' +
|
|
61
|
+
' "typescript",\n' +
|
|
62
|
+
' "programming-language",\n' +
|
|
63
|
+
' "lazy-evaluation"\n' +
|
|
64
|
+
' ],\n' +
|
|
65
|
+
' "bugs": {\n' +
|
|
66
|
+
' "url": "https://github.com/functionalscript/functionalscript/issues"\n' +
|
|
67
|
+
' },\n' +
|
|
68
|
+
' "homepage": "https://github.com/functionalscript/functionalscript#readme",\n' +
|
|
69
|
+
' "devDependencies": {\n' +
|
|
70
|
+
' "@types/node": "^18.6.2",\n' +
|
|
71
|
+
' "typescript": "^4.7.4"\n' +
|
|
72
|
+
' }\n' +
|
|
73
|
+
'}'
|
|
74
|
+
|
|
75
|
+
{
|
|
76
|
+
/** @type {_.Node<string>} */
|
|
77
|
+
const node = {
|
|
78
|
+
child_process: { execSync: () => Buffer.from("123\n456\n") },
|
|
79
|
+
fs: {
|
|
80
|
+
readFileSync: () => Buffer.from(JSON.stringify(x)),
|
|
81
|
+
writeFileSync: (_, content) => content
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const v = _.version(node)
|
|
85
|
+
if (v !== e) { throw [v, e] }
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
module.exports = {}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "functionalscript",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.379",
|
|
4
4
|
"description": "FunctionalScript is a functional subset of JavaScript",
|
|
5
5
|
"main": "module.f.cjs",
|
|
6
6
|
"scripts": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"homepage": "https://github.com/functionalscript/functionalscript#readme",
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@types/node": "^18.6.
|
|
32
|
+
"@types/node": "^18.6.3",
|
|
33
33
|
"typescript": "^4.7.4"
|
|
34
34
|
}
|
|
35
35
|
}
|
package/test.f.cjs
CHANGED
package/text/encoding/README.md
CHANGED
|
@@ -20,7 +20,7 @@ Requirement: no loss for UTF8 => codepoint => UTF8
|
|
|
20
20
|
|[c,b,] |1110_xxxx 10xx_xxxx |10 bit|
|
|
21
21
|
|[d,] |1111_0xxx |3 bit |
|
|
22
22
|
|[d,c,] |1111_0xxx 10xx_xxxx |9 bit |
|
|
23
|
-
|[d,c,b]
|
|
23
|
+
|[d,c,b,] |1111_0xxx 10xx_xxxx 10xx_xxxx|15 bit|
|
|
24
24
|
|
|
25
25
|
Total error states:
|
|
26
26
|
|
|
@@ -37,10 +37,10 @@ Total error states:
|
|
|
37
37
|
|[d,] |1111_0xxx | 3 bit| |
|
|
38
38
|
|[c,] |1110_xxxx | 4 bit| |
|
|
39
39
|
|[b,] |110x_xxxx | 5 bit| |
|
|
40
|
-
|[e] |10xx_xxxx | 6 bit|
|
|
41
|
-
|[d,c,] |1111_0xxx 10xx_xxxx | 9 bit|
|
|
42
|
-
|[c,b,] |1110_xxxx 10xx_xxxx |10 bit|
|
|
43
|
-
|[d,c,b]
|
|
40
|
+
|[e] |10xx_xxxx | 6 bit|0000_0000 0xxx_xxxx|
|
|
41
|
+
|[d,c,] |1111_0xxx 10xx_xxxx | 9 bit|0000_001x xxxx_xxxx|
|
|
42
|
+
|[c,b,] |1110_xxxx 10xx_xxxx |10 bit|0000_01xx xxxx_xxxx|
|
|
43
|
+
|[d,c,b,] |1111_0xxx 10xx_xxxx 10xx_xxxx|15 bit|1xxx_xxxx xxxx_xxxx|
|
|
44
44
|
|
|
45
45
|
```js
|
|
46
46
|
/** @type {(input: List<u8|undefined>) => List<i32>} */
|
|
@@ -77,14 +77,14 @@ Total error states: 11 bit
|
|
|
77
77
|
|
|
78
78
|
```js
|
|
79
79
|
/** @type {(input: List<u16|undefined>) => List<i32>} */
|
|
80
|
-
const
|
|
80
|
+
const utf16ListToCodePointList
|
|
81
81
|
|
|
82
82
|
/** @type {(input: List<i32>) => List<u16>} */
|
|
83
|
-
const
|
|
83
|
+
const codePointListToUtf16List
|
|
84
84
|
|
|
85
85
|
/** @type {(input: string) => List<u16> */
|
|
86
|
-
const
|
|
86
|
+
const stringToUtf16List
|
|
87
87
|
|
|
88
88
|
/** @type {(input: List<u16>) => string} */
|
|
89
|
-
const
|
|
89
|
+
const utf16ListToString
|
|
90
90
|
```
|