functionalscript 0.3.4 → 0.3.6
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.ts +10 -0
- package/com/cpp/module.f.js +107 -0
- package/com/cpp/test.f.d.ts +2 -0
- package/com/cpp/{test.f.ts → test.f.js} +9 -11
- package/com/cpp/testlib.f.d.ts +2 -0
- package/com/cpp/testlib.f.js +5 -0
- package/com/cs/module.f.d.ts +12 -0
- package/com/cs/module.f.js +80 -0
- package/com/cs/test.f.d.ts +2 -0
- package/com/cs/{test.f.ts → test.f.js} +9 -11
- package/com/cs/testlib.f.d.ts +2 -0
- package/com/cs/testlib.f.js +5 -0
- package/com/rust/module.f.d.ts +15 -0
- package/com/rust/module.f.js +169 -0
- package/com/rust/test.f.d.ts +2 -0
- package/com/rust/{test.f.ts → test.f.js} +7 -7
- package/com/rust/testlib.f.d.ts +2 -0
- package/com/rust/testlib.f.js +5 -0
- package/com/test/build.f.d.ts +20 -0
- package/com/test/build.f.js +58 -0
- package/com/types/module.f.d.ts +28 -0
- package/com/types/module.f.js +8 -0
- package/com/types/testlib.f.d.ts +44 -0
- package/com/types/{testlib.f.ts → testlib.f.js} +2 -3
- package/commonjs/build/module.f.d.ts +6 -0
- package/commonjs/build/module.f.js +69 -0
- package/commonjs/build/test.f.d.ts +2 -0
- package/commonjs/build/test.f.js +96 -0
- package/commonjs/module/function/{module.f.ts → module.f.d.ts} +5 -10
- package/commonjs/module/function/module.f.js +4 -0
- package/commonjs/module/module.f.d.ts +18 -0
- package/commonjs/module/module.f.js +12 -0
- package/commonjs/module.f.d.ts +6 -0
- package/commonjs/module.f.js +1 -0
- package/commonjs/package/dependencies/module.f.d.ts +7 -0
- package/commonjs/package/dependencies/module.f.js +13 -0
- package/commonjs/package/dependencies/test.f.d.ts +2 -0
- package/commonjs/package/dependencies/test.f.js +15 -0
- package/commonjs/package/module.f.d.ts +17 -0
- package/commonjs/package/module.f.js +18 -0
- package/commonjs/package/test.f.d.ts +2 -0
- package/commonjs/package/test.f.js +27 -0
- package/commonjs/path/module.f.d.ts +24 -0
- package/commonjs/path/module.f.js +114 -0
- package/commonjs/path/test.f.d.ts +25 -0
- package/commonjs/path/{test.f.ts → test.f.js} +123 -89
- package/crypto/prime_field/module.f.d.ts +43 -0
- package/crypto/prime_field/module.f.js +78 -0
- package/crypto/prime_field/test.f.d.ts +13 -0
- package/crypto/prime_field/test.f.js +149 -0
- package/crypto/secp/module.f.d.ts +68 -0
- package/crypto/secp/module.f.js +127 -0
- package/crypto/secp/test.f.d.ts +5 -0
- package/crypto/secp/test.f.js +72 -0
- package/crypto/sha2/module.f.d.ts +13 -0
- package/crypto/sha2/module.f.js +145 -0
- package/crypto/sha2/test.f.d.ts +9 -0
- package/crypto/sha2/test.f.js +82 -0
- package/dev/module.f.d.ts +1 -0
- package/dev/module.f.js +1 -0
- package/dev/test/module.f.d.ts +20 -0
- package/dev/test/module.f.js +75 -0
- package/dev/test.f.d.ts +9 -0
- package/dev/{test.f.ts → test.f.js} +22 -24
- package/djs/module.f.d.ts +17 -0
- package/djs/module.f.js +63 -0
- package/djs/parser/module.f.d.ts +12 -0
- package/djs/parser/module.f.js +333 -0
- package/djs/parser/test.f.d.ts +12 -0
- package/djs/parser/test.f.js +717 -0
- package/djs/serializer/module.f.d.ts +9 -0
- package/djs/serializer/module.f.js +81 -0
- package/djs/test/input.f.d.ts +2 -0
- package/djs/test/input.f.js +4 -0
- package/djs/test/m.f.d.ts +2 -0
- package/djs/test/m.f.js +1 -0
- package/djs/test.f.d.ts +12 -0
- package/djs/test.f.js +84 -0
- package/djs/tokenizer/module.f.d.ts +8 -0
- package/djs/tokenizer/module.f.js +60 -0
- package/djs/tokenizer/test.f.d.ts +7 -0
- package/djs/tokenizer/test.f.js +529 -0
- package/fsc/module.f.d.ts +5 -0
- package/fsc/module.f.js +75 -0
- package/fsc/test.f.d.ts +4 -0
- package/fsc/test.f.js +19 -0
- package/fsm/module.f.d.ts +13 -0
- package/fsm/module.f.js +59 -0
- package/fsm/test.f.d.ts +5 -0
- package/fsm/test.f.js +137 -0
- package/html/module.f.d.ts +13 -0
- package/html/module.f.js +58 -0
- package/html/test.f.d.ts +9 -0
- package/html/test.f.js +42 -0
- package/issues/test.f.d.ts +16 -0
- package/issues/test.f.js +70 -0
- package/js/tokenizer/module.f.d.ts +86 -0
- package/js/tokenizer/module.f.js +503 -0
- package/js/tokenizer/test.f.d.ts +9 -0
- package/js/tokenizer/test.f.js +905 -0
- package/json/module.f.d.ts +20 -0
- package/json/module.f.js +68 -0
- package/json/parser/module.f.d.ts +5 -0
- package/json/parser/module.f.js +155 -0
- package/json/parser/test.f.d.ts +5 -0
- package/json/parser/test.f.js +328 -0
- package/json/serializer/module.f.d.ts +7 -0
- package/json/serializer/module.f.js +21 -0
- package/json/serializer/test.f.d.ts +8 -0
- package/json/serializer/test.f.js +87 -0
- package/json/test.f.d.ts +8 -0
- package/json/test.f.js +61 -0
- package/json/tokenizer/module.f.d.ts +8 -0
- package/json/tokenizer/module.f.js +52 -0
- package/json/tokenizer/test.f.d.ts +6 -0
- package/json/tokenizer/test.f.js +419 -0
- package/nanvm-lib/tests/test.f.d.ts +27 -0
- package/nanvm-lib/tests/test.f.js +84 -0
- package/nodejs/version/module.f.d.ts +11 -0
- package/nodejs/version/module.f.js +16 -0
- package/nodejs/version/test.f.d.ts +2 -0
- package/nodejs/version/{test.f.ts → test.f.js} +13 -22
- package/package.json +9 -5
- package/text/ascii/module.f.d.ts +129 -0
- package/text/ascii/module.f.js +148 -0
- package/text/ascii/test.f.d.ts +4 -0
- package/text/ascii/test.f.js +14 -0
- package/text/module.f.d.ts +8 -0
- package/text/module.f.js +10 -0
- package/text/sgr/module.f.d.ts +8 -0
- package/text/sgr/module.f.js +8 -0
- package/text/test.f.d.ts +2 -0
- package/text/test.f.js +18 -0
- package/text/utf16/module.f.d.ts +9 -0
- package/text/utf16/module.f.js +66 -0
- package/text/utf16/test.f.d.ts +6 -0
- package/text/utf16/test.f.js +144 -0
- package/text/utf8/module.f.d.ts +6 -0
- package/text/utf8/module.f.js +112 -0
- package/text/utf8/test.f.d.ts +6 -0
- package/text/utf8/test.f.js +175 -0
- package/types/array/module.f.d.ts +21 -0
- package/types/array/module.f.js +23 -0
- package/types/array/test.f.d.ts +10 -0
- package/types/array/test.f.js +116 -0
- package/types/bigfloat/module.f.d.ts +3 -0
- package/types/bigfloat/module.f.js +66 -0
- package/types/bigfloat/test.f.d.ts +6 -0
- package/types/bigfloat/test.f.js +349 -0
- package/types/bigint/module.f.d.ts +54 -0
- package/types/bigint/{module.f.ts → module.f.js} +42 -65
- package/types/bigint/test.f.d.ts +16 -0
- package/types/bigint/test.f.js +199 -0
- package/types/bit_vec/module.f.d.ts +134 -0
- package/types/bit_vec/{module.f.ts → module.f.js} +47 -65
- package/types/bit_vec/test.f.d.ts +22 -0
- package/types/bit_vec/test.f.js +210 -0
- package/types/btree/find/module.f.d.ts +20 -0
- package/types/btree/find/module.f.js +84 -0
- package/types/btree/find/test.f.d.ts +2 -0
- package/types/btree/find/test.f.js +152 -0
- package/types/btree/module.f.d.ts +4 -0
- package/types/btree/module.f.js +31 -0
- package/types/btree/remove/module.f.d.ts +4 -0
- package/types/btree/remove/module.f.js +174 -0
- package/types/btree/remove/test.f.d.ts +5 -0
- package/types/btree/remove/test.f.js +634 -0
- package/types/btree/set/module.f.d.ts +3 -0
- package/types/btree/set/module.f.js +103 -0
- package/types/btree/set/test.f.d.ts +2 -0
- package/types/btree/set/test.f.js +360 -0
- package/types/btree/test.f.d.ts +8 -0
- package/types/btree/test.f.js +75 -0
- package/types/btree/types/module.f.d.ts +11 -0
- package/types/btree/types/module.f.js +1 -0
- package/types/byte_set/module.f.d.ts +16 -0
- package/types/byte_set/module.f.js +28 -0
- package/types/byte_set/test.f.d.ts +12 -0
- package/types/byte_set/test.f.js +122 -0
- package/types/function/compare/module.f.d.ts +10 -0
- package/types/function/compare/module.f.js +7 -0
- package/types/function/compare/test.f.d.ts +2 -0
- package/types/function/compare/test.f.js +8 -0
- package/types/function/module.f.d.ts +28 -0
- package/types/function/module.f.js +19 -0
- package/types/function/operator/module.f.d.ts +20 -0
- package/types/function/operator/module.f.js +18 -0
- package/types/function/test.f.d.ts +2 -0
- package/types/function/test.f.js +12 -0
- package/types/list/module.f.d.ts +50 -0
- package/types/list/module.f.js +171 -0
- package/types/list/test.f.d.ts +22 -0
- package/types/list/test.f.js +395 -0
- package/types/map/module.f.d.ts +14 -0
- package/types/map/module.f.js +31 -0
- package/types/map/test.f.d.ts +5 -0
- package/types/map/test.f.js +114 -0
- package/types/nibble_set/module.f.d.ts +10 -0
- package/types/nibble_set/module.f.js +9 -0
- package/types/nibble_set/test.f.d.ts +12 -0
- package/types/nibble_set/test.f.js +90 -0
- package/types/nullable/module.f.d.ts +3 -0
- package/types/nullable/module.f.js +2 -0
- package/types/nullable/test.f.d.ts +2 -0
- package/types/nullable/test.f.js +12 -0
- package/types/number/module.f.d.ts +6 -0
- package/types/number/module.f.js +8 -0
- package/types/number/test.f.d.ts +11 -0
- package/types/number/test.f.js +124 -0
- package/types/object/module.f.d.ts +10 -0
- package/types/object/module.f.js +12 -0
- package/types/object/test.f.d.ts +5 -0
- package/types/object/test.f.js +17 -0
- package/types/range/module.f.d.ts +3 -0
- package/types/range/module.f.js +2 -0
- package/types/range/test.f.d.ts +2 -0
- package/types/range/test.f.js +18 -0
- package/types/range_map/module.f.d.ts +14 -0
- package/types/range_map/module.f.js +51 -0
- package/types/range_map/test.f.d.ts +6 -0
- package/types/range_map/test.f.js +176 -0
- package/types/result/module.f.d.ts +7 -0
- package/types/result/module.f.js +8 -0
- package/types/sorted_list/module.f.d.ts +16 -0
- package/types/sorted_list/module.f.js +56 -0
- package/types/sorted_list/test.f.d.ts +5 -0
- package/types/sorted_list/test.f.js +64 -0
- package/types/sorted_set/module.f.d.ts +7 -0
- package/types/sorted_set/module.f.js +14 -0
- package/types/sorted_set/test.f.d.ts +6 -0
- package/types/sorted_set/test.f.js +78 -0
- package/types/string/module.f.d.ts +6 -0
- package/types/string/module.f.js +11 -0
- package/types/string/test.f.d.ts +15 -0
- package/types/string/test.f.js +58 -0
- package/types/string_set/module.f.d.ts +9 -0
- package/types/string_set/module.f.js +22 -0
- package/types/string_set/test.f.d.ts +5 -0
- package/types/string_set/test.f.js +65 -0
- package/.github/FUNDING.yml +0 -12
- package/.github/dependabot.yml +0 -11
- package/.github/workflows/ci.yml +0 -88
- package/.github/workflows/npm-publish.yml +0 -53
- package/CHANGELOG.md +0 -29
- package/Cargo.lock +0 -18
- package/Cargo.toml +0 -7
- package/com/README.md +0 -3
- package/com/cpp/README.md +0 -80
- package/com/cpp/module.f.ts +0 -180
- package/com/cpp/nanocom.hpp +0 -195
- package/com/cpp/testlib.f.ts +0 -8
- package/com/cs/module.f.ts +0 -145
- package/com/cs/testlib.f.ts +0 -8
- package/com/proposals.md +0 -28
- package/com/rust/module.f.ts +0 -287
- package/com/rust/nanocom/Cargo.lock +0 -7
- package/com/rust/nanocom/Cargo.toml +0 -15
- package/com/rust/nanocom/README.md +0 -56
- package/com/rust/nanocom/src/class.rs +0 -6
- package/com/rust/nanocom/src/cobject.rs +0 -90
- package/com/rust/nanocom/src/guid.rs +0 -15
- package/com/rust/nanocom/src/hresult.rs +0 -7
- package/com/rust/nanocom/src/interface.rs +0 -9
- package/com/rust/nanocom/src/iunknown.rs +0 -13
- package/com/rust/nanocom/src/lib.rs +0 -20
- package/com/rust/nanocom/src/object.rs +0 -34
- package/com/rust/nanocom/src/ref.rs +0 -57
- package/com/rust/nanocom/src/vmt.rs +0 -7
- package/com/rust/nanocom/tests/it.rs +0 -186
- package/com/rust/nanocom/tests/itmod.rs +0 -195
- package/com/rust/testlib.f.ts +0 -8
- package/com/test/build.f.ts +0 -111
- package/com/test/build.ts +0 -45
- package/com/test/cpp/main.cpp +0 -74
- package/com/test/cs/Program.cs +0 -31
- package/com/test/cs/cs.csproj +0 -16
- package/com/test/rust/Cargo.toml +0 -12
- package/com/test/rust/src/lib.rs +0 -56
- package/com/types/module.f.ts +0 -62
- package/commonjs/README.md +0 -94
- package/commonjs/build/module.f.ts +0 -100
- package/commonjs/build/test.f.ts +0 -107
- package/commonjs/module/module.f.ts +0 -41
- package/commonjs/module.f.ts +0 -7
- package/commonjs/module.ts +0 -31
- package/commonjs/package/dependencies/module.f.ts +0 -22
- package/commonjs/package/dependencies/test.f.ts +0 -8
- package/commonjs/package/module.f.ts +0 -31
- package/commonjs/package/test.f.ts +0 -12
- package/commonjs/path/README.md +0 -17
- package/commonjs/path/module.f.ts +0 -171
- package/commonjs/test.ts +0 -64
- package/crypto/README.md +0 -3
- package/crypto/prime_field/module.f.ts +0 -114
- package/crypto/prime_field/test.f.ts +0 -95
- package/crypto/secp/module.f.ts +0 -182
- package/crypto/secp/test.f.ts +0 -68
- package/crypto/sha2/module.f.ts +0 -215
- package/crypto/sha2/test.f.ts +0 -83
- package/deno.json +0 -71
- package/dev/README.md +0 -8
- package/dev/index.ts +0 -3
- package/dev/module.f.ts +0 -1
- package/dev/module.ts +0 -195
- package/dev/test/module.f.ts +0 -135
- package/dev/test.ts +0 -53
- package/djs/README.md +0 -54
- package/djs/module.f.ts +0 -76
- package/djs/parser/module.f.ts +0 -509
- package/djs/parser/test.f.ts +0 -461
- package/djs/serializer/module.f.ts +0 -90
- package/djs/test.f.ts +0 -67
- package/djs/tokenizer/module.f.ts +0 -99
- package/djs/tokenizer/test.f.ts +0 -364
- package/doc/LANGUAGE.md +0 -255
- package/doc/README.md +0 -61
- package/doc/byte-code.md +0 -59
- package/doc/fa.md +0 -174
- package/doc/predefined.md +0 -143
- package/doc/proposals.md +0 -21
- package/doc/vm/README.md +0 -24
- package/doc/vm-rearchitecture.md +0 -129
- package/doc/vm.md +0 -150
- package/fsc/README.md +0 -111
- package/fsc/module.f.ts +0 -122
- package/fsc/test.f.ts +0 -21
- package/fsm/README.md +0 -113
- package/fsm/module.f.ts +0 -107
- package/fsm/test.f.ts +0 -139
- package/funding.json +0 -61
- package/html/README.md +0 -32
- package/html/module.f.ts +0 -109
- package/html/test.f.ts +0 -37
- package/issues/01-test-debug.md +0 -3
- package/issues/02-esm.md +0 -8
- package/issues/03-djs.md +0 -57
- package/issues/05-publish.md +0 -40
- package/issues/11-fs-load.md +0 -13
- package/issues/17-djs-extension.md +0 -6
- package/issues/README.md +0 -42
- package/issues/lang/1000-json.md +0 -50
- package/issues/lang/2110-default-export.md +0 -11
- package/issues/lang/2120-const.md +0 -14
- package/issues/lang/2130-default-import.md +0 -10
- package/issues/lang/2210-block-comment.md +0 -12
- package/issues/lang/2220-namespace-import.md +0 -25
- package/issues/lang/2310-undefined.md +0 -7
- package/issues/lang/2320-bigint.md +0 -7
- package/issues/lang/2330-property-accessor.md +0 -225
- package/issues/lang/2340-operators.md +0 -41
- package/issues/lang/2350-grouping.md +0 -11
- package/issues/lang/2360-built-in.md +0 -81
- package/issues/lang/2410-identifier-property.md +0 -9
- package/issues/lang/2420-line-comment.md +0 -10
- package/issues/lang/2430-trailing-comma.md +0 -13
- package/issues/lang/2440-shorthand.md +0 -8
- package/issues/lang/2450-destructuring.md +0 -12
- package/issues/lang/3110-function.md +0 -35
- package/issues/lang/3120-parameters.md +0 -9
- package/issues/lang/3130-body-const.md +0 -12
- package/issues/lang/3220-let.md +0 -11
- package/issues/lang/3240-export.md +0 -44
- package/issues/lang/3370-type-inference.md +0 -69
- package/issues/lang/3380-promise.md +0 -22
- package/issues/lang/3390-class.md +0 -3
- package/issues/lang/3410-expression.md +0 -12
- package/issues/lang/3420-one-parameter.md +0 -10
- package/issues/lang/3430-assignments.md +0 -23
- package/issues/lang/README.md +0 -193
- package/issues/test.f.ts +0 -58
- package/js/tokenizer/module.f.ts +0 -882
- package/js/tokenizer/test.f.ts +0 -617
- package/json/html/README.md +0 -49
- package/json/module.f.ts +0 -94
- package/json/parser/module.f.ts +0 -221
- package/json/parser/test.f.ts +0 -255
- package/json/serializer/module.f.ts +0 -74
- package/json/serializer/test.f.ts +0 -64
- package/json/test.f.ts +0 -48
- package/json/tokenizer/module.f.ts +0 -85
- package/json/tokenizer/test.f.ts +0 -290
- package/nanvm-lib/Cargo.toml +0 -6
- package/nanvm-lib/src/extension.rs +0 -130
- package/nanvm-lib/src/interface.rs +0 -133
- package/nanvm-lib/src/lib.rs +0 -7
- package/nanvm-lib/src/naive.rs +0 -236
- package/nanvm-lib/src/nanenum.rs +0 -236
- package/nanvm-lib/src/nullish.rs +0 -7
- package/nanvm-lib/src/sign.rs +0 -5
- package/nanvm-lib/src/simple.rs +0 -32
- package/nanvm-lib/tests/test.f.ts +0 -80
- package/nanvm-lib/tests/test.rs +0 -108
- package/nodejs/version/main.ts +0 -4
- package/nodejs/version/module.f.ts +0 -42
- package/text/README.md +0 -110
- package/text/ascii/module.f.ts +0 -219
- package/text/ascii/test.f.ts +0 -14
- package/text/module.f.ts +0 -30
- package/text/sgr/README.md +0 -3
- package/text/sgr/module.f.ts +0 -11
- package/text/test.f.ts +0 -19
- package/text/utf16/module.f.ts +0 -120
- package/text/utf16/test.f.ts +0 -107
- package/text/utf8/module.f.ts +0 -116
- package/text/utf8/test.f.ts +0 -125
- package/tsconfig.json +0 -104
- package/types/array/module.f.ts +0 -89
- package/types/array/test.f.ts +0 -88
- package/types/bigfloat/module.f.ts +0 -93
- package/types/bigfloat/test.f.ts +0 -218
- package/types/bigint/README.md +0 -35
- package/types/bigint/test.f.ts +0 -144
- package/types/bit_vec/README.md +0 -18
- package/types/bit_vec/test.f.ts +0 -129
- package/types/btree/README.md +0 -160
- package/types/btree/find/module.f.ts +0 -92
- package/types/btree/find/test.f.ts +0 -122
- package/types/btree/module.f.ts +0 -35
- package/types/btree/remove/module.f.ts +0 -151
- package/types/btree/remove/test.f.ts +0 -498
- package/types/btree/set/module.f.ts +0 -89
- package/types/btree/set/test.f.ts +0 -415
- package/types/btree/test.f.ts +0 -92
- package/types/btree/types/module.f.ts +0 -27
- package/types/byte_set/module.f.ts +0 -73
- package/types/byte_set/test.f.ts +0 -84
- package/types/function/compare/module.f.ts +0 -26
- package/types/function/compare/test.f.ts +0 -7
- package/types/function/module.f.ts +0 -43
- package/types/function/operator/module.f.ts +0 -65
- package/types/function/test.f.ts +0 -20
- package/types/list/module.f.ts +0 -350
- package/types/list/test.f.ts +0 -327
- package/types/map/module.f.ts +0 -65
- package/types/map/test.f.ts +0 -76
- package/types/nibble_set/module.f.ts +0 -34
- package/types/nibble_set/test.f.ts +0 -57
- package/types/nullable/module.f.ts +0 -9
- package/types/nullable/test.f.ts +0 -9
- package/types/number/module.f.ts +0 -20
- package/types/number/test.f.ts +0 -194
- package/types/object/module.f.ts +0 -30
- package/types/object/test.f.ts +0 -14
- package/types/range/module.f.ts +0 -10
- package/types/range/test.f.ts +0 -9
- package/types/range_map/module.f.ts +0 -70
- package/types/range_map/test.f.ts +0 -189
- package/types/result/module.f.ts +0 -20
- package/types/result/module.ts +0 -18
- package/types/sorted_list/module.f.ts +0 -83
- package/types/sorted_list/test.f.ts +0 -57
- package/types/sorted_set/module.f.ts +0 -36
- package/types/sorted_set/test.f.ts +0 -67
- package/types/string/module.f.ts +0 -26
- package/types/string/test.f.ts +0 -43
- package/types/string_set/module.f.ts +0 -37
- package/types/string_set/test.f.ts +0 -34
package/fsm/module.f.ts
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import * as list from '../types/list/module.f.ts'
|
|
2
|
-
const { equal, isEmpty, fold, toArray, scan, foldScan, empty: emptyList } = list
|
|
3
|
-
import * as byteSet from '../types/byte_set/module.f.ts'
|
|
4
|
-
const { toRangeMap, union: byteSetUnion, one, empty } = byteSet
|
|
5
|
-
import * as sortedSet from '../types/sorted_set/module.f.ts'
|
|
6
|
-
const { intersect, union: sortedSetUnion } = sortedSet
|
|
7
|
-
import * as rangeMap from '../types/range_map/module.f.ts'
|
|
8
|
-
const { merge } = rangeMap
|
|
9
|
-
import * as cmp from '../types/function/compare/module.f.ts'
|
|
10
|
-
const { unsafeCmp } = cmp
|
|
11
|
-
import * as operator from '../types/function/operator/module.f.ts'
|
|
12
|
-
const { strictEqual } = operator
|
|
13
|
-
import * as j from '../json/module.f.ts'
|
|
14
|
-
const { stringify } = j
|
|
15
|
-
import * as f from '../types/function/module.f.ts'
|
|
16
|
-
const { identity } = f
|
|
17
|
-
import * as utf16 from '../text/utf16/module.f.ts'
|
|
18
|
-
const { stringToList } = utf16
|
|
19
|
-
|
|
20
|
-
type Rule = readonly[string, byteSet.ByteSet, string]
|
|
21
|
-
|
|
22
|
-
export type Grammar = list.List<Rule>
|
|
23
|
-
|
|
24
|
-
type Dfa = {
|
|
25
|
-
readonly[state in string]: rangeMap.RangeMapArray<string>
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const stringifyIdentity = stringify(identity)
|
|
29
|
-
|
|
30
|
-
export const toRange
|
|
31
|
-
: (s: string) => byteSet.ByteSet
|
|
32
|
-
= s => {
|
|
33
|
-
const [b, e] = toArray(stringToList(s))
|
|
34
|
-
return byteSet.range([b, e])
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const toUnionOp
|
|
38
|
-
: operator.Fold<number, byteSet.ByteSet>
|
|
39
|
-
= i => bs => byteSetUnion(bs)(one(i))
|
|
40
|
-
|
|
41
|
-
export const toUnion
|
|
42
|
-
: (s: string) => byteSet.ByteSet
|
|
43
|
-
= s => {
|
|
44
|
-
const codePoints = stringToList(s)
|
|
45
|
-
return fold(toUnionOp)(empty)(codePoints)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const mergeOp
|
|
49
|
-
: rangeMap.Operators<sortedSet.SortedSet<string>>
|
|
50
|
-
= { union: sortedSetUnion(unsafeCmp), equal: equal(strictEqual) }
|
|
51
|
-
|
|
52
|
-
const hasState
|
|
53
|
-
: (s: string) => (set: sortedSet.SortedSet<string>) => boolean
|
|
54
|
-
= s => set => !isEmpty(intersect(unsafeCmp)([s])(set))
|
|
55
|
-
|
|
56
|
-
const foldOp
|
|
57
|
-
: (set: sortedSet.SortedSet<string>) => operator.Fold<Rule, rangeMap.RangeMap<sortedSet.SortedSet<string>>>
|
|
58
|
-
= set => ([ruleIn, bs, ruleOut]) => rm => {
|
|
59
|
-
if (hasState(ruleIn)(set)) { return merge(mergeOp)(rm)(toRangeMap(bs)(ruleOut)) }
|
|
60
|
-
return rm
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const stringifyOp
|
|
64
|
-
: operator.Scan<rangeMap.Entry<sortedSet.SortedSet<string>>, rangeMap.Entry<string>>
|
|
65
|
-
= ([sortedSet, max]) => [[stringifyIdentity(sortedSet), max], stringifyOp]
|
|
66
|
-
|
|
67
|
-
const scanStringify = scan(stringifyOp)
|
|
68
|
-
|
|
69
|
-
const fetchOp
|
|
70
|
-
: operator.Scan<rangeMap.Entry<sortedSet.SortedSet<string>>, sortedSet.SortedSet<string>>
|
|
71
|
-
= ([item, _]) => [item, fetchOp]
|
|
72
|
-
|
|
73
|
-
const scanFetch = scan(fetchOp)
|
|
74
|
-
|
|
75
|
-
const addEntry
|
|
76
|
-
: (grammar: Grammar) => operator.Fold<sortedSet.SortedSet<string>, Dfa>
|
|
77
|
-
= grammar => set => dfa => {
|
|
78
|
-
const s = stringifyIdentity(set)
|
|
79
|
-
if (s in dfa) { return dfa }
|
|
80
|
-
const setMap = fold(foldOp(set))(emptyList)(grammar)
|
|
81
|
-
const stringMap = toArray(scanStringify(setMap))
|
|
82
|
-
const newDfa = { ...dfa, [s]: stringMap }
|
|
83
|
-
const newStates = scanFetch(setMap)
|
|
84
|
-
return fold(addEntry(grammar))(newDfa)(newStates)
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const emptyState: string[] = []
|
|
88
|
-
|
|
89
|
-
const emptyStateStringify = stringifyIdentity(emptyState)
|
|
90
|
-
|
|
91
|
-
const initialState = ['']
|
|
92
|
-
|
|
93
|
-
const initialStateStringify = stringifyIdentity(initialState)
|
|
94
|
-
|
|
95
|
-
export const dfa
|
|
96
|
-
: (grammar: Grammar) => Dfa
|
|
97
|
-
= grammar => addEntry(grammar)(initialState)({})
|
|
98
|
-
|
|
99
|
-
const get = rangeMap.get(emptyStateStringify)
|
|
100
|
-
|
|
101
|
-
const runOp
|
|
102
|
-
: (dfa: Dfa) => operator.Fold<number, string>
|
|
103
|
-
= dfa => input => s => get(input)(dfa[s])
|
|
104
|
-
|
|
105
|
-
export const run
|
|
106
|
-
: (dfa: Dfa) => (input: list.List<number>) => list.List<string>
|
|
107
|
-
= dfa => input => foldScan(runOp(dfa))(initialStateStringify)(input)
|
package/fsm/test.f.ts
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import * as _ from './module.f.ts'
|
|
2
|
-
import * as byteSet from '../types/byte_set/module.f.ts'
|
|
3
|
-
import * as o from '../types/object/module.f.ts'
|
|
4
|
-
const { sort, fromEntries } = o
|
|
5
|
-
import * as json from '../json/module.f.ts'
|
|
6
|
-
import * as f from '../types/function/module.f.ts'
|
|
7
|
-
const { identity } = f
|
|
8
|
-
import * as list from '../types/list/module.f.ts'
|
|
9
|
-
const { toArray } = list
|
|
10
|
-
import * as utf16 from '../text/utf16/module.f.ts'
|
|
11
|
-
const { stringToList } = utf16
|
|
12
|
-
|
|
13
|
-
const stringifyIdentity = json.stringify(identity)
|
|
14
|
-
|
|
15
|
-
const buildDfa = () => {
|
|
16
|
-
const lowercaseAlpha = _.toRange('az')
|
|
17
|
-
const uppercaseAlpha = _.toRange('AZ')
|
|
18
|
-
const alpha = byteSet.union(lowercaseAlpha)(uppercaseAlpha)
|
|
19
|
-
const idSymbol = _.toUnion('_$')
|
|
20
|
-
const idBegin = byteSet.union(alpha)(idSymbol)
|
|
21
|
-
const digit = _.toRange('09')
|
|
22
|
-
const idNext = byteSet.union(idBegin)(digit)
|
|
23
|
-
const dot = _.toUnion('.')
|
|
24
|
-
|
|
25
|
-
const grammar
|
|
26
|
-
: _.Grammar
|
|
27
|
-
= [
|
|
28
|
-
['', digit, 'int'],
|
|
29
|
-
['int', digit, 'int'],
|
|
30
|
-
['', digit, 'floatBegin'],
|
|
31
|
-
['floatBegin', digit, 'floatBegin'],
|
|
32
|
-
['floatBegin', dot, 'floatDot'],
|
|
33
|
-
['floatDot', digit, 'float'],
|
|
34
|
-
['float', digit, 'float'],
|
|
35
|
-
['', idBegin, 'id'],
|
|
36
|
-
['id', idNext, 'id']
|
|
37
|
-
]
|
|
38
|
-
return _.dfa(grammar)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export default {
|
|
42
|
-
dfa: () => {
|
|
43
|
-
const dfa = buildDfa()
|
|
44
|
-
const entries = Object.entries(dfa)
|
|
45
|
-
const sortedEntries = sort(entries)
|
|
46
|
-
const obj = fromEntries(sortedEntries)
|
|
47
|
-
const result = stringifyIdentity(obj)
|
|
48
|
-
|
|
49
|
-
const expectedObj = {
|
|
50
|
-
'[""]': [
|
|
51
|
-
[ '[]', 35 ],
|
|
52
|
-
[ '["id"]', 36 ],
|
|
53
|
-
[ '[]', 47 ],
|
|
54
|
-
[ '["floatBegin","int"]', 57 ],
|
|
55
|
-
[ '[]', 64 ],
|
|
56
|
-
[ '["id"]', 90 ],
|
|
57
|
-
[ '[]', 94 ],
|
|
58
|
-
[ '["id"]', 95 ],
|
|
59
|
-
[ '[]', 96 ],
|
|
60
|
-
[ '["id"]', 122 ]
|
|
61
|
-
],
|
|
62
|
-
'["float"]': [ [ '[]', 47 ], [ '["float"]', 57 ] ],
|
|
63
|
-
'["floatBegin","int"]': [
|
|
64
|
-
[ '[]', 45 ],
|
|
65
|
-
[ '["floatDot"]', 46 ],
|
|
66
|
-
[ '[]', 47 ],
|
|
67
|
-
[ '["floatBegin","int"]', 57 ]
|
|
68
|
-
],
|
|
69
|
-
'["floatDot"]': [ [ '[]', 47 ], [ '["float"]', 57 ] ],
|
|
70
|
-
'["id"]': [
|
|
71
|
-
[ '[]', 35 ],
|
|
72
|
-
[ '["id"]', 36 ],
|
|
73
|
-
[ '[]', 47 ],
|
|
74
|
-
[ '["id"]', 57 ],
|
|
75
|
-
[ '[]', 64 ],
|
|
76
|
-
[ '["id"]', 90 ],
|
|
77
|
-
[ '[]', 94 ],
|
|
78
|
-
[ '["id"]', 95 ],
|
|
79
|
-
[ '[]', 96 ],
|
|
80
|
-
[ '["id"]', 122 ]
|
|
81
|
-
],
|
|
82
|
-
'[]': []
|
|
83
|
-
};
|
|
84
|
-
const expectedResult = stringifyIdentity(expectedObj)
|
|
85
|
-
|
|
86
|
-
if (result !== expectedResult) {throw result }
|
|
87
|
-
},
|
|
88
|
-
run: [
|
|
89
|
-
() => {
|
|
90
|
-
const dfa = buildDfa()
|
|
91
|
-
const input = stringToList('a1')
|
|
92
|
-
const result = stringifyIdentity(toArray(_.run(dfa)(input)))
|
|
93
|
-
|
|
94
|
-
const expectedOutput = [
|
|
95
|
-
'["id"]',
|
|
96
|
-
'["id"]'
|
|
97
|
-
]
|
|
98
|
-
const expectedResult = stringifyIdentity(expectedOutput)
|
|
99
|
-
if (result !== expectedResult) { throw result }
|
|
100
|
-
},
|
|
101
|
-
() => {
|
|
102
|
-
const dfa = buildDfa()
|
|
103
|
-
const input = stringToList('0.1')
|
|
104
|
-
const result = stringifyIdentity(toArray(_.run(dfa)(input)))
|
|
105
|
-
|
|
106
|
-
const expectedOutput = [
|
|
107
|
-
'["floatBegin","int"]',
|
|
108
|
-
'["floatDot"]',
|
|
109
|
-
'["float"]'
|
|
110
|
-
]
|
|
111
|
-
const expectedResult = stringifyIdentity(expectedOutput)
|
|
112
|
-
if (result !== expectedResult) { throw result }
|
|
113
|
-
},
|
|
114
|
-
() => {
|
|
115
|
-
const dfa = buildDfa()
|
|
116
|
-
const input = stringToList('//')
|
|
117
|
-
const result = stringifyIdentity(toArray(_.run(dfa)(input)))
|
|
118
|
-
|
|
119
|
-
const expectedOutput = [
|
|
120
|
-
'[]',
|
|
121
|
-
'[]'
|
|
122
|
-
]
|
|
123
|
-
const expectedResult = stringifyIdentity(expectedOutput)
|
|
124
|
-
if (result !== expectedResult) { throw result }
|
|
125
|
-
},
|
|
126
|
-
() => {
|
|
127
|
-
const dfa = buildDfa()
|
|
128
|
-
const input = stringToList('::')
|
|
129
|
-
const result = stringifyIdentity(toArray(_.run(dfa)(input)))
|
|
130
|
-
|
|
131
|
-
const expectedOutput = [
|
|
132
|
-
'[]',
|
|
133
|
-
'[]'
|
|
134
|
-
]
|
|
135
|
-
const expectedResult = stringifyIdentity(expectedOutput)
|
|
136
|
-
if (result !== expectedResult) { throw result }
|
|
137
|
-
}
|
|
138
|
-
]
|
|
139
|
-
}
|
package/funding.json
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": "v1.0.0",
|
|
3
|
-
"entity": {
|
|
4
|
-
"type": "individual",
|
|
5
|
-
"role": "owner",
|
|
6
|
-
"name": "Sergey Shandar",
|
|
7
|
-
"email": "sergey.oss@proton.me",
|
|
8
|
-
"description": "Sergey is the main author of FunctionalScript, and other OSS projects related to content-addressable infrastructure",
|
|
9
|
-
"webpageUrl": {
|
|
10
|
-
"url": "https://github.com/functionalscript/functionalscript"
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
|
-
"projects": [
|
|
14
|
-
{
|
|
15
|
-
"guid": "functionalscript",
|
|
16
|
-
"name": "FunctionalScript",
|
|
17
|
-
"description": "FunctionalScript is a purely functional safe subset of JavaScript",
|
|
18
|
-
"webpageUrl": {
|
|
19
|
-
"url": "https://github.com/functionalscript/functionalscript"
|
|
20
|
-
},
|
|
21
|
-
"repositoryUrl": {
|
|
22
|
-
"url": "https://github.com/functionalscript/functionalscript"
|
|
23
|
-
},
|
|
24
|
-
"licenses": [
|
|
25
|
-
"spdx:AGPL-3.0-only"
|
|
26
|
-
],
|
|
27
|
-
"tags": [
|
|
28
|
-
"programming",
|
|
29
|
-
"web-development",
|
|
30
|
-
"software-engineering",
|
|
31
|
-
"developer-tools",
|
|
32
|
-
"programming-language",
|
|
33
|
-
"cryptography",
|
|
34
|
-
"smart-contract"
|
|
35
|
-
]
|
|
36
|
-
}
|
|
37
|
-
],
|
|
38
|
-
"funding": {
|
|
39
|
-
"channels": [
|
|
40
|
-
{
|
|
41
|
-
"guid": "github",
|
|
42
|
-
"type": "other",
|
|
43
|
-
"address": "https://github.com/sponsors/sergey-shandar"
|
|
44
|
-
}
|
|
45
|
-
],
|
|
46
|
-
"plans": [
|
|
47
|
-
{
|
|
48
|
-
"guid": "nanvm",
|
|
49
|
-
"status": "active",
|
|
50
|
-
"name": "NaNVM",
|
|
51
|
-
"description": "NaNVM is a virtual machine for the FunctionalScript",
|
|
52
|
-
"amount": 0,
|
|
53
|
-
"currency": "USD",
|
|
54
|
-
"frequency": "one-time",
|
|
55
|
-
"channels": [
|
|
56
|
-
"github"
|
|
57
|
-
]
|
|
58
|
-
}
|
|
59
|
-
]
|
|
60
|
-
}
|
|
61
|
-
}
|
package/html/README.md
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# HTML
|
|
2
|
-
|
|
3
|
-
|HTML |FunctionalScript DSL |
|
|
4
|
-
|--------------------------------------------|-------------------------------------------------|
|
|
5
|
-
|`<br>` |`['br']` |
|
|
6
|
-
|`<img src="https://example.com/image.jpg">` |`['img',{src:'https://example.com/image.jpg'}]` |
|
|
7
|
-
|`<a href="https://example.com/">Example</a>`|`['a',{href:'https://example.com/'}, 'Example']` |
|
|
8
|
-
|`<ul><li>Apple</li><li>Tomato</li></ul>` |`['ul',['li','Apple'],['li','Tomato']]` |
|
|
9
|
-
|
|
10
|
-
## Example
|
|
11
|
-
|
|
12
|
-
```html
|
|
13
|
-
<html>
|
|
14
|
-
<head>
|
|
15
|
-
<title>Page</title>
|
|
16
|
-
</head>
|
|
17
|
-
<body>
|
|
18
|
-
<a href="https://example.com/">Example</a>
|
|
19
|
-
</body>
|
|
20
|
-
</html>
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
```js
|
|
24
|
-
['html',
|
|
25
|
-
['head',
|
|
26
|
-
['title', 'Page']
|
|
27
|
-
]
|
|
28
|
-
['body',
|
|
29
|
-
['a', { href: 'https://example.com/' }, 'Example']
|
|
30
|
-
]
|
|
31
|
-
]
|
|
32
|
-
```
|
package/html/module.f.ts
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { map, flatMap, flat, concat as listConcat, type List } from '../types/list/module.f.ts'
|
|
2
|
-
import { concat as stringConcat } from '../types/string/module.f.ts'
|
|
3
|
-
import * as O from '../types/object/module.f.ts'
|
|
4
|
-
import { compose } from '../types/function/module.f.ts'
|
|
5
|
-
import * as utf16 from '../text/utf16/module.f.ts'
|
|
6
|
-
const { stringToList } = utf16
|
|
7
|
-
const { fromCharCode } = String
|
|
8
|
-
const { entries } = Object
|
|
9
|
-
|
|
10
|
-
type Tag = string
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Void Elements
|
|
14
|
-
*
|
|
15
|
-
* https://developer.mozilla.org/en-US/docs/Glossary/Void_element
|
|
16
|
-
*/
|
|
17
|
-
const voidTagList = [
|
|
18
|
-
'area',
|
|
19
|
-
'base',
|
|
20
|
-
'br',
|
|
21
|
-
'col',
|
|
22
|
-
'embed',
|
|
23
|
-
'hr',
|
|
24
|
-
'img',
|
|
25
|
-
'input',
|
|
26
|
-
'link',
|
|
27
|
-
'meta',
|
|
28
|
-
'param',
|
|
29
|
-
'source',
|
|
30
|
-
'track',
|
|
31
|
-
'wbr',
|
|
32
|
-
] as const
|
|
33
|
-
|
|
34
|
-
type VoidTagList = typeof voidTagList
|
|
35
|
-
|
|
36
|
-
type VoidTag = keyof VoidTagList
|
|
37
|
-
|
|
38
|
-
const isVoid
|
|
39
|
-
: (tag: string) => boolean
|
|
40
|
-
= tag => (voidTagList as readonly string[]).includes(tag)
|
|
41
|
-
|
|
42
|
-
type Element1 = readonly[Tag, ...Node[]]
|
|
43
|
-
|
|
44
|
-
type Element2 = readonly[Tag, Attributes, ...Node[]]
|
|
45
|
-
|
|
46
|
-
export type Element = Element1 | Element2
|
|
47
|
-
|
|
48
|
-
type Attributes = {
|
|
49
|
-
readonly[k in string]: string
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
type Node = Element | string
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* https://stackoverflow.com/questions/7381974/which-characters-need-to-be-escaped-in-html
|
|
56
|
-
*/
|
|
57
|
-
const escapeCharCode
|
|
58
|
-
: (code: number) => string
|
|
59
|
-
= code => {
|
|
60
|
-
switch (code) {
|
|
61
|
-
case 0x22: return '"'
|
|
62
|
-
case 0x26: return '&'
|
|
63
|
-
case 0x3C: return '<'
|
|
64
|
-
case 0x3E: return '>'
|
|
65
|
-
default: return fromCharCode(code)
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const escape = compose(stringToList)(map(escapeCharCode))
|
|
70
|
-
|
|
71
|
-
const node
|
|
72
|
-
: (n: Node) => List<string>
|
|
73
|
-
= n => typeof n === 'string' ? escape(n) : element(n)
|
|
74
|
-
|
|
75
|
-
const nodes = flatMap(node)
|
|
76
|
-
|
|
77
|
-
const attribute
|
|
78
|
-
: (a: O.Entry<string>) => List<string>
|
|
79
|
-
= ([name, value]) => flat([[' ', name, '="'], escape(value), ['"']])
|
|
80
|
-
|
|
81
|
-
const attributes
|
|
82
|
-
: (a: Attributes) => List<string>
|
|
83
|
-
= compose(entries)(flatMap(attribute))
|
|
84
|
-
|
|
85
|
-
const open
|
|
86
|
-
: (t: string) => (a: Attributes) => List<string>
|
|
87
|
-
= t => a => flat([[`<`, t], attributes(a), [`>`]])
|
|
88
|
-
|
|
89
|
-
const element3
|
|
90
|
-
: (t: string) => (an: readonly[Attributes, readonly Node[]]) => List<string>
|
|
91
|
-
= t => ([a, n]) => {
|
|
92
|
-
const o = flat([[`<`, t], attributes(a), [`>`]])
|
|
93
|
-
return isVoid(t) ? o : flat([o, nodes(n), ['</', t, '>']])
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export const element
|
|
97
|
-
: (element: Element) => List<string>
|
|
98
|
-
= e => {
|
|
99
|
-
const [t, a, ...n] = e
|
|
100
|
-
return element3(t)(a === undefined ? [{}, []]: typeof a === 'object' && !(a instanceof Array) ? [a, n] : [{}, [a, ...n]])
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
export const html
|
|
104
|
-
: (_: Element) => List<string>
|
|
105
|
-
= compose(element)(listConcat(['<!DOCTYPE html>']))
|
|
106
|
-
|
|
107
|
-
export const htmlToString
|
|
108
|
-
: (_: Element) => string
|
|
109
|
-
= compose(html)(stringConcat)
|
package/html/test.f.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import * as _ from './module.f.ts'
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
empty: () => {
|
|
5
|
-
const r = _.htmlToString(['html'])
|
|
6
|
-
if (r !== '<!DOCTYPE html><html></html>') { throw `empty: ${r}` }
|
|
7
|
-
},
|
|
8
|
-
empty2: () => {
|
|
9
|
-
const r = _.htmlToString(['html'])
|
|
10
|
-
if (r !== '<!DOCTYPE html><html></html>') { throw r }
|
|
11
|
-
},
|
|
12
|
-
void: () => {
|
|
13
|
-
const r = _.htmlToString(['area'])
|
|
14
|
-
if (r !== '<!DOCTYPE html><area>') { throw r }
|
|
15
|
-
},
|
|
16
|
-
some: () => {
|
|
17
|
-
const x
|
|
18
|
-
: _.Element
|
|
19
|
-
= ['div', {}, '<div>&</div>', ['a', { href: 'hello"' }]]
|
|
20
|
-
const s = _.htmlToString(x)
|
|
21
|
-
if (s !== '<!DOCTYPE html><div><div>&amp;</div><a href="hello""></a></div>') { throw s }
|
|
22
|
-
},
|
|
23
|
-
some2: () => {
|
|
24
|
-
const x
|
|
25
|
-
: _.Element
|
|
26
|
-
= ['div', '<div>&</div>', ['a', { href: 'hello"' }]]
|
|
27
|
-
const s = _.htmlToString(x)
|
|
28
|
-
if (s !== '<!DOCTYPE html><div><div>&amp;</div><a href="hello""></a></div>') { throw s }
|
|
29
|
-
},
|
|
30
|
-
someVoid: () => {
|
|
31
|
-
const x
|
|
32
|
-
: _.Element
|
|
33
|
-
= ['div', ['br', {id: '5'}], '<div>&</div>', ['a', { href: 'hello"' }]]
|
|
34
|
-
const s = _.htmlToString(x)
|
|
35
|
-
if (s !== '<!DOCTYPE html><div><br id="5"><div>&amp;</div><a href="hello""></a></div>') { throw s }
|
|
36
|
-
}
|
|
37
|
-
}
|
package/issues/01-test-debug.md
DELETED
package/issues/02-esm.md
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# Switching to ESM
|
|
2
|
-
|
|
3
|
-
We need ESM for such systems like Deno, JSR and browsers.
|
|
4
|
-
|
|
5
|
-
Currently, the biggest obstacle to using ESM is that we cannot make bundles on ESM modules without an FS parser.
|
|
6
|
-
The solution is to deploy ESM modules to HTTPS.
|
|
7
|
-
|
|
8
|
-
This task depends on [test-debug](./test-debug.md).
|
package/issues/03-djs.md
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
# DJS
|
|
2
|
-
|
|
3
|
-
Parse this code
|
|
4
|
-
|
|
5
|
-
```js
|
|
6
|
-
import a from 'c.d.mjs'
|
|
7
|
-
const c = [12, 'x']
|
|
8
|
-
export default { a: a, b: a, c: c}
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
Into this structure:
|
|
12
|
-
|
|
13
|
-
```ts
|
|
14
|
-
type Module = {
|
|
15
|
-
modules: string[]
|
|
16
|
-
func: Func
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// the last constant from the array is a return
|
|
20
|
-
type Func = Const[]
|
|
21
|
-
|
|
22
|
-
type Const = Primitive | CObject | CArray |CRef | ARef
|
|
23
|
-
|
|
24
|
-
type Primitive = number|string|boolean|null|bigint
|
|
25
|
-
|
|
26
|
-
type CRef = ['cref', number]
|
|
27
|
-
|
|
28
|
-
type ARef = ['aref', number]
|
|
29
|
-
|
|
30
|
-
type CObject = ['object', {
|
|
31
|
-
[k in string]: Const
|
|
32
|
-
}]
|
|
33
|
-
|
|
34
|
-
type CArray = ['array', [Const]]
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Where `func` is a description of the function:
|
|
38
|
-
|
|
39
|
-
```js
|
|
40
|
-
(...args) => {
|
|
41
|
-
const const0 = [12, 'x']
|
|
42
|
-
return { a: args[0], b: args[0], c: const0}
|
|
43
|
-
}
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
## Parsed Example
|
|
47
|
-
|
|
48
|
-
```js
|
|
49
|
-
export default
|
|
50
|
-
// array of constants
|
|
51
|
-
[
|
|
52
|
-
// const const0
|
|
53
|
-
['array', [12, 'x']],
|
|
54
|
-
// return
|
|
55
|
-
['object', { 'a': ['aref', 0], 'b': ['aref', 0], c: ['cref', 0] }]
|
|
56
|
-
]
|
|
57
|
-
```
|
package/issues/05-publish.md
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# Publishing Packages
|
|
2
|
-
|
|
3
|
-
We are targeting the following systems:
|
|
4
|
-
|
|
5
|
-
- JS:
|
|
6
|
-
- [X] NPM
|
|
7
|
-
- [X] JSR
|
|
8
|
-
- [ ] https://esm.sh/ optional
|
|
9
|
-
- Rust:
|
|
10
|
-
- [ ] https://crates.io/
|
|
11
|
-
|
|
12
|
-
The main principle is that we should be able to install FunctionalScript from Git/GitHub. Currently,
|
|
13
|
-
|
|
14
|
-
- `NPM` works with Git links and `.mjs` files.
|
|
15
|
-
- `JSR`. Unfortunately, JSR doesn't support JSDoc type information, see [jsr-io/jsr/issues/494](https://github.com/jsr-io/jsr/issues/494).
|
|
16
|
-
- Browsers. `import * from 'https://...'`.
|
|
17
|
-
|
|
18
|
-
We have two options:
|
|
19
|
-
|
|
20
|
-
- Continue to use JavaScript source files and generate JSR package before publishing,
|
|
21
|
-
- Switch to TypeScript source files and write [prepack](https://docs.npmjs.com/cli/v7/using-npm/scripts) script. TS files could be a problem for our parser because it doesn't strip type annotations yet.
|
|
22
|
-
|
|
23
|
-
This problem will go away as soon as ECMAScript supports for [Type Annotations](https://github.com/tc39/proposal-type-annotations).
|
|
24
|
-
|
|
25
|
-
## Updating Packages
|
|
26
|
-
|
|
27
|
-
Currently, we regenerate `exports` in [./jsr.json](./index.f.mjs) using `npm run index` during CD (publishing) and `version` using `npm run version`. We should combine it into `update` script.
|
|
28
|
-
|
|
29
|
-
We don't check in CI if it was regenerated. The idea is that CI should check if all generated files in Git are updated:
|
|
30
|
-
|
|
31
|
-
- [package.json](./package.json) `version` property
|
|
32
|
-
- [jsr.json](./jsr.json), `version` and `exports` property.
|
|
33
|
-
|
|
34
|
-
`version` property should be the same in `package.json` and `jsr.json`.
|
|
35
|
-
|
|
36
|
-
We abandoned the idea to publish on every commit on `main`. Instead, we publish only when there is an new version in the `main`. This strategy can also work for Rust packages.
|
|
37
|
-
|
|
38
|
-
## CI Publishing (merge to `main`)
|
|
39
|
-
|
|
40
|
-
Check if the version is new, then publish.
|
package/issues/11-fs-load.md
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# FS VM load/save
|
|
2
|
-
|
|
3
|
-
sketch / mention future documentation on errors / exceptions and execution scheme in general, for example:
|
|
4
|
-
|
|
5
|
-
The host environment has well defined operations like 'Load' (takes a "root" module path, optional extra parameters), 'Execute' (takes the successful result of 'Load', optional extra parameters), 'Save' (takes the successful result of 'Load', optional extra parameters).
|
|
6
|
-
|
|
7
|
-
'Load' time errors are communicated to the host environment (e.g. to output error diagnostics on the console). In presence of load time errors there is no successful result of 'Load', so there is nothing to pass to Execute, Save. However, it makes sense to have results of a partially successful 'Load' even though they cannot be used in 'Execute', 'Save' - for example, in language server protocol scenarios.
|
|
8
|
-
|
|
9
|
-
'Save' corresponds to code / data transformations other than 'Execute', e.g. bundling. 'Save' time errors are communicated to the host environment. It might make sense to have results of a partially successful 'Save' (similarly to abovementioned scenarios for partially successful 'Load' results).
|
|
10
|
-
|
|
11
|
-
'Execute' corresponds to calling the function that is the default export of the "root" module and that takes produces side effects on the environment. Execution ends with a halt caused either by the inner logic of the code (e.g. the root function successfully completes, or an unhandled error happens), or by external causes (e.g. the user stops the execution).
|
|
12
|
-
|
|
13
|
-
Now, does a proper FS system provide user code means to handle errors, e.g. an exception handling mechanism similar to JS's exception handling?
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
# `.d.js` extension conflict
|
|
2
|
-
|
|
3
|
-
We use an extension `.d.js` for data JS files, but if we can't use it for TypeScript files, like `.d.ts` because it means declaration TypeScript files. There are several solutions to the problem:
|
|
4
|
-
|
|
5
|
-
1. Use only `.f.js` extension but make sure that `export default` has no functions at the end. In this case we can reference `.f.js` files as well to use functions to transform data (preferred).
|
|
6
|
-
2. Don't use it for TypeScript until we have type annotations in JavaScript.
|
package/issues/README.md
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
# Issues
|
|
2
|
-
|
|
3
|
-
1. [X] [test-debug](./01-test-debug.md).
|
|
4
|
-
2. [X] [esm](./02-esm.md)
|
|
5
|
-
3. [ ] [djs](./03-djs.md)
|
|
6
|
-
4. [ ] VM Rust project
|
|
7
|
-
5. [ ] [publish](./05-publish.md)
|
|
8
|
-
6. [ ] fix index generation by including sub modules `{ ...m, add: mAdd, remove: mRemove}`.
|
|
9
|
-
7. [ ] Conventions:
|
|
10
|
-
|
|
11
|
-
```js
|
|
12
|
-
import list, * as List from 'list.mjs'
|
|
13
|
-
// list is for objects.
|
|
14
|
-
// List is for types and should be ignored by FJS or errored if used in code.
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
8. Move logic from `.mjs` files to `.f.mjs` files.
|
|
18
|
-
9. [ ] Generating a Website.
|
|
19
|
-
10. [ ] Short URL table.
|
|
20
|
-
11. [ ] [fs-load](./11-fs-load.md)
|
|
21
|
-
12. [ ] Replace file extensions from `.mjs` to `.js`. Make sure `package.json/type` is equal to `module`. May be later: https://v8.dev/features/modules#mjs
|
|
22
|
-
13. [ ] Docs for JSR. See https://jsr.io/@functionalscript/functionalscript/score
|
|
23
|
-
14. [ ] Combine `npm run index` and `npm run version`
|
|
24
|
-
15. [ ] Generate `package.json/exports` instead of `index.f.mjs`.
|
|
25
|
-
16. [ ] License in JSR file?
|
|
26
|
-
17. [ ] [djs-extension](./17-djs-extension.md).
|
|
27
|
-
18. [ ] Formatter for `.f.js` and `.f.ts` files.
|
|
28
|
-
19. [ ] Convert FunctionalScript code using non-default `export`.
|
|
29
|
-
20. [ ] Test framework should be able to run a subset of tests.
|
|
30
|
-
21. [ ] Test Framework silent mode. Show progress and failed tests only.
|
|
31
|
-
22. [x] bit sequences based on bigint
|
|
32
|
-
23. [ ] a console program similar to one that we have in the NaNVM repo.
|
|
33
|
-
24. [ ] create `./module.mjs` that supports the same behavior like current NaNVM Rust implementation:
|
|
34
|
-
- [ ] run `node ./module.mjs input.f.mjs output.f.mjs`
|
|
35
|
-
- [ ] run `deno ./module.mjs input.f.mjs output.f.mjs`
|
|
36
|
-
25. [ ] Switch to Deno an `.ts`?
|
|
37
|
-
1. Deno TypeScript and Microsoft TypeScript are different https://bsky.app/profile/macwright.com/post/3lbrwioa5zs27
|
|
38
|
-
2. One day we may switch back to `.js` extension if [Type Annotation Proposal](https://github.com/tc39/proposal-type-annotations) is included into ECMAScript. BTW, we should only use JS with type annotations instead of full TypeScript.
|
|
39
|
-
|
|
40
|
-
## Language Specification
|
|
41
|
-
|
|
42
|
-
See [lang/README.md](./lang/README.md).
|