functionalscript 0.1.593 → 0.1.596
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/npm-publish.yml +2 -1
- package/README.md +1 -0
- package/com/cpp/module.f.d.mts +8 -0
- package/com/cpp/test.f.d.mts +2 -0
- package/com/cpp/testlib.f.d.mts +2 -0
- package/com/cs/module.f.d.mts +8 -0
- package/com/cs/test.f.d.mts +2 -0
- package/com/cs/testlib.f.d.mts +2 -0
- package/com/rust/module.f.d.mts +28 -0
- package/com/rust/test.f.d.mts +2 -0
- package/com/rust/testlib.f.d.mts +2 -0
- package/com/test/build.d.mts +1 -0
- package/com/test/build.f.d.mts +26 -0
- package/com/types/module.f.d.mts +28 -0
- package/com/types/testlib.f.d.mts +44 -0
- package/commonjs/build/module.f.d.mts +24 -0
- package/commonjs/build/test.f.d.mts +3 -0
- package/commonjs/module/function/module.f.d.mts +7 -0
- package/commonjs/module/module.f.d.mts +57 -0
- package/commonjs/module.d.mts +7 -0
- package/commonjs/module.f.d.mts +4 -0
- package/commonjs/package/dependencies/module.f.d.mts +10 -0
- package/commonjs/package/dependencies/test.f.d.mts +2 -0
- package/commonjs/package/module.f.d.mts +27 -0
- package/commonjs/package/test.f.d.mts +2 -0
- package/commonjs/path/module.f.d.mts +67 -0
- package/commonjs/path/test.f.d.mts +25 -0
- package/commonjs/test.d.mts +8 -0
- package/dev/index.d.mts +1 -0
- package/dev/module.d.mts +26 -0
- package/dev/module.f.d.mts +4 -0
- package/dev/test/module.f.d.mts +26 -0
- package/dev/test.d.mts +3 -0
- package/dev/test.f.d.mts +9 -0
- package/djs/module.f.d.mts +25 -0
- package/djs/parser/module.f.d.mts +40 -0
- package/djs/parser/test.f.d.mts +8 -0
- package/djs/test.f.d.mts +12 -0
- package/djs/tokenizer/module.f.d.mts +17 -0
- package/djs/tokenizer/test.f.d.mts +6 -0
- package/fsc/module.f.d.mts +12 -0
- package/fsc/test.f.d.mts +4 -0
- package/fsm/module.f.d.mts +21 -0
- package/fsm/test.f.d.mts +5 -0
- package/html/module.f.d.mts +20 -0
- package/html/test.f.d.mts +10 -0
- package/index.f.d.mts +83 -0
- package/js/tokenizer/module.f.d.mts +150 -0
- package/js/tokenizer/test.f.d.mts +8 -0
- package/json/module.f.d.mts +41 -0
- package/json/parser/module.f.d.mts +36 -0
- package/json/parser/test.f.d.mts +5 -0
- package/json/serializer/module.f.d.mts +45 -0
- package/json/serializer/test.f.d.mts +8 -0
- package/json/test.f.d.mts +8 -0
- package/json/tokenizer/module.f.d.mts +17 -0
- package/json/tokenizer/test.f.d.mts +6 -0
- package/jsr.json +1 -1
- package/nodejs/version/main.d.mts +1 -0
- package/nodejs/version/module.f.d.mts +18 -0
- package/nodejs/version/test.f.d.mts +2 -0
- package/package.json +2 -1
- package/prime_field/module.f.d.mts +44 -0
- package/prime_field/test.f.d.mts +12 -0
- package/secp/module.f.d.mts +49 -0
- package/secp/test.f.d.mts +4 -0
- package/sha2/module.f.d.mts +23 -0
- package/sha2/test.f.d.mts +10 -0
- package/text/ascii/module.f.d.mts +73 -0
- package/text/ascii/test.f.d.mts +4 -0
- package/text/module.f.d.mts +18 -0
- package/text/sgr/module.f.d.mts +14 -0
- package/text/test.f.d.mts +2 -0
- package/text/utf16/module.f.d.mts +19 -0
- package/text/utf16/test.f.d.mts +6 -0
- package/text/utf8/module.f.d.mts +15 -0
- package/text/utf8/test.f.d.mts +6 -0
- package/types/array/module.f.d.mts +41 -0
- package/types/array/test.f.d.mts +10 -0
- package/types/bigfloat/module.f.d.mts +11 -0
- package/types/bigfloat/test.f.d.mts +6 -0
- package/types/bigint/module.f.d.mts +77 -0
- package/types/bigint/test.f.d.mts +16 -0
- package/types/btree/find/module.f.d.mts +42 -0
- package/types/btree/find/test.f.d.mts +2 -0
- package/types/btree/module.f.d.mts +9 -0
- package/types/btree/remove/module.f.d.mts +19 -0
- package/types/btree/remove/test.f.d.mts +7 -0
- package/types/btree/set/module.f.d.mts +9 -0
- package/types/btree/set/test.f.d.mts +2 -0
- package/types/btree/test.f.d.mts +13 -0
- package/types/btree/types/module.f.d.mts +16 -0
- package/types/byte_set/module.f.d.mts +38 -0
- package/types/byte_set/test.f.d.mts +13 -0
- package/types/function/compare/module.f.d.mts +29 -0
- package/types/function/compare/test.f.d.mts +2 -0
- package/types/function/module.f.d.mts +36 -0
- package/types/function/operator/module.f.d.mts +75 -0
- package/types/function/test.f.d.mts +2 -0
- package/types/list/module.f.d.mts +117 -0
- package/types/list/test.f.d.mts +38 -0
- package/types/map/module.f.d.mts +30 -0
- package/types/map/test.f.d.mts +5 -0
- package/types/nibble_set/module.f.d.mts +26 -0
- package/types/nibble_set/test.f.d.mts +13 -0
- package/types/nullable/module.f.d.mts +14 -0
- package/types/nullable/test.f.d.mts +2 -0
- package/types/number/module.f.d.mts +13 -0
- package/types/number/test.f.d.mts +11 -0
- package/types/object/module.f.d.mts +29 -0
- package/types/object/test.f.d.mts +5 -0
- package/types/range/module.f.d.mts +11 -0
- package/types/range/test.f.d.mts +2 -0
- package/types/range_map/module.f.d.mts +25 -0
- package/types/range_map/test.f.d.mts +6 -0
- package/types/result/module.d.mts +7 -0
- package/types/result/module.f.d.mts +28 -0
- package/types/sorted_list/module.f.d.mts +59 -0
- package/types/sorted_list/test.f.d.mts +5 -0
- package/types/sorted_set/module.f.d.mts +25 -0
- package/types/sorted_set/test.f.d.mts +6 -0
- package/types/string/module.f.d.mts +15 -0
- package/types/string/test.f.d.mts +15 -0
- package/types/string_set/module.f.d.mts +21 -0
- package/types/string_set/test.f.d.mts +5 -0
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# FunctionalScript
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/functionalscript)
|
|
4
|
+
[](https://jsr.io/@functionalscript/functionalscript)
|
|
4
5
|
|
|
5
6
|
FunctionalScript is a purely functional programming language and a strict subset of
|
|
6
7
|
[ECMAScript](https://en.wikipedia.org/wiki/ECMAScript)/[JavaScript](https://en.wikipedia.org/wiki/JavaScript). It's inspired by
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export { cpp };
|
|
3
|
+
}
|
|
4
|
+
export default _default;
|
|
5
|
+
/** @type {(name: string) => (lib: typesT.Library) => textT.Block} */
|
|
6
|
+
declare const cpp: (name: string) => (lib: typesT.Library) => textT.Block;
|
|
7
|
+
import * as typesT from '../types/module.f.mjs';
|
|
8
|
+
import * as textT from '../../text/module.f.mjs';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export { cs };
|
|
3
|
+
}
|
|
4
|
+
export default _default;
|
|
5
|
+
/** @type {(name: string) => (library: typesT.Library) => textT.Block} */
|
|
6
|
+
declare const cs: (name: string) => (library: typesT.Library) => textT.Block;
|
|
7
|
+
import * as typesT from '../types/module.f.mjs';
|
|
8
|
+
import * as textT from '../../text/module.f.mjs';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export { rust };
|
|
3
|
+
}
|
|
4
|
+
export default _default;
|
|
5
|
+
export type OptionalProperty<T> = T | {};
|
|
6
|
+
export type Where = {
|
|
7
|
+
readonly where: readonly string[];
|
|
8
|
+
};
|
|
9
|
+
export type WhereContent = OptionalProperty<Where> & {
|
|
10
|
+
readonly content: textT.Block;
|
|
11
|
+
};
|
|
12
|
+
export type Impl = {
|
|
13
|
+
readonly param?: string;
|
|
14
|
+
readonly trait: string;
|
|
15
|
+
readonly type: string;
|
|
16
|
+
readonly where?: readonly string[];
|
|
17
|
+
readonly content: textT.Block;
|
|
18
|
+
};
|
|
19
|
+
export type Trait = {
|
|
20
|
+
readonly pub?: true;
|
|
21
|
+
readonly type: string;
|
|
22
|
+
readonly where?: readonly string[];
|
|
23
|
+
readonly content: textT.Block;
|
|
24
|
+
};
|
|
25
|
+
/** @type {(library: typesT.Library) => textT.Block} */
|
|
26
|
+
declare const rust: (library: typesT.Library) => textT.Block;
|
|
27
|
+
import * as textT from '../../text/module.f.mjs';
|
|
28
|
+
import * as typesT from '../types/module.f.mjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export { cpp };
|
|
3
|
+
export { cs };
|
|
4
|
+
export { rust };
|
|
5
|
+
}
|
|
6
|
+
export default _default;
|
|
7
|
+
export type Platform = "aix" | "android" | "darwin" | "freebsd" | "haiku" | "linux" | "openbsd" | "sunos" | "win32" | "cygwin" | "netbsd";
|
|
8
|
+
export type NodeJs = {
|
|
9
|
+
readonly dirname: string;
|
|
10
|
+
readonly platform: Platform;
|
|
11
|
+
};
|
|
12
|
+
export type Output = {
|
|
13
|
+
readonly file: {
|
|
14
|
+
readonly name: string;
|
|
15
|
+
readonly content: string;
|
|
16
|
+
};
|
|
17
|
+
readonly line: List.List<List.List<string>>;
|
|
18
|
+
};
|
|
19
|
+
export type Func = (nodejs: NodeJs) => Output;
|
|
20
|
+
/** @type {Func} */
|
|
21
|
+
declare const cpp: Func;
|
|
22
|
+
/** @type {Func} */
|
|
23
|
+
declare const cs: Func;
|
|
24
|
+
/** @type {Func} */
|
|
25
|
+
declare const rust: Func;
|
|
26
|
+
import * as List from '../../types/list/module.f.mjs';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export { paramList };
|
|
3
|
+
export { result };
|
|
4
|
+
}
|
|
5
|
+
export default _default;
|
|
6
|
+
export type Library = { readonly [k in string]: Definition; };
|
|
7
|
+
export type Definition = Struct | Interface;
|
|
8
|
+
export type Struct = {
|
|
9
|
+
readonly struct: FieldArray;
|
|
10
|
+
};
|
|
11
|
+
export type FieldArray = { readonly [k in string]: Type; };
|
|
12
|
+
export type Field = O.Entry<Type>;
|
|
13
|
+
export type Interface = {
|
|
14
|
+
readonly interface: MethodArray;
|
|
15
|
+
readonly guid: string;
|
|
16
|
+
};
|
|
17
|
+
export type MethodArray = { readonly [k in string]: FieldArray; };
|
|
18
|
+
export type Method = O.Entry<FieldArray>;
|
|
19
|
+
export type Type = BaseType | Id | Pointer;
|
|
20
|
+
export type Id = readonly [string];
|
|
21
|
+
export type BaseType = "u8" | "i8" | "u16" | "i16" | "u32" | "i32" | "u64" | "i64" | "usize" | "isize" | "f32" | "f64" | "bool";
|
|
22
|
+
export type Pointer = readonly ["*", Type];
|
|
23
|
+
/** @type {(fa: FieldArray) => List.List<Field> } */
|
|
24
|
+
declare const paramList: (fa: FieldArray) => List.List<Field>;
|
|
25
|
+
/** @type {<T>(v: T) => (f: (type: Type) => T) => (fa: FieldArray) => T} */
|
|
26
|
+
declare const result: <T>(v: T) => (f: (type: Type) => T) => (fa: FieldArray) => T;
|
|
27
|
+
import * as O from '../../types/object/module.f.mjs';
|
|
28
|
+
import * as List from '../../types/list/module.f.mjs';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
Slice: {
|
|
3
|
+
struct: {
|
|
4
|
+
Start: ["*", "u8"];
|
|
5
|
+
Size: "usize";
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
ManagedStruct: {
|
|
9
|
+
struct: {
|
|
10
|
+
M: ["IMy"];
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
IMy: {
|
|
14
|
+
guid: string;
|
|
15
|
+
interface: {
|
|
16
|
+
GetSlice: {
|
|
17
|
+
_: ["Slice"];
|
|
18
|
+
};
|
|
19
|
+
SetSlice: {
|
|
20
|
+
slice: ["Slice"];
|
|
21
|
+
};
|
|
22
|
+
GetUnsafe: {
|
|
23
|
+
_: ["*", "bool"];
|
|
24
|
+
};
|
|
25
|
+
SetUnsafe: {
|
|
26
|
+
p: ["*", ["Slice"]];
|
|
27
|
+
size: "u32";
|
|
28
|
+
};
|
|
29
|
+
Some: {
|
|
30
|
+
p: ["IMy"];
|
|
31
|
+
_: "bool";
|
|
32
|
+
};
|
|
33
|
+
GetIMy: {
|
|
34
|
+
a: "u16";
|
|
35
|
+
b: "i16";
|
|
36
|
+
_: ["IMy"];
|
|
37
|
+
};
|
|
38
|
+
SetManagedStruct: {
|
|
39
|
+
a: ["ManagedStruct"];
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export default _default;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export { getOrBuild };
|
|
3
|
+
}
|
|
4
|
+
export default _default;
|
|
5
|
+
export type Config<M> = {
|
|
6
|
+
readonly packageGet: packageT.Get;
|
|
7
|
+
readonly moduleMapInterface: moduleT.MapInterface<M>;
|
|
8
|
+
readonly moduleId: moduleT.Id;
|
|
9
|
+
readonly moduleMap: M;
|
|
10
|
+
};
|
|
11
|
+
export type Result<M> = readonly [moduleT.State, M];
|
|
12
|
+
/**
|
|
13
|
+
* @type {(compile: function_.Compile) =>
|
|
14
|
+
* (packageGet: packageT.Get) =>
|
|
15
|
+
* <M>(moduleMapInterface: moduleT.MapInterface<M>) =>
|
|
16
|
+
* (moduleId: moduleT.Id) =>
|
|
17
|
+
* (moduleMap: M) =>
|
|
18
|
+
* Result<M>
|
|
19
|
+
* }
|
|
20
|
+
*/
|
|
21
|
+
declare const getOrBuild: (compile: function_.Compile) => (packageGet: packageT.Get) => <M>(moduleMapInterface: moduleT.MapInterface<M>) => (moduleId: moduleT.Id) => (moduleMap: M) => Result<M>;
|
|
22
|
+
import * as packageT from '../package/module.f.mjs';
|
|
23
|
+
import * as moduleT from '../module/module.f.mjs';
|
|
24
|
+
import * as function_ from '../module/function/module.f.mjs';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare const _default: {};
|
|
2
|
+
export default _default;
|
|
3
|
+
export type Function_ = <M>(require: Require<M>) => (prior: M) => Result<M>;
|
|
4
|
+
export type Result<M> = readonly [Result.Result<unknown, unknown>, M];
|
|
5
|
+
export type Require<M> = (path: string) => (prior: M) => Result<M>;
|
|
6
|
+
export type Compile = (source: string) => Result.Result<Function_, unknown>;
|
|
7
|
+
import * as Result from '../../../types/result/module.f.mjs';
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export { dir };
|
|
3
|
+
export { idToString };
|
|
4
|
+
}
|
|
5
|
+
export default _default;
|
|
6
|
+
export type MapInterface<M> = {
|
|
7
|
+
readonly at: (moduleId: string) => (moduleMap: M) => State | null;
|
|
8
|
+
readonly setReplace: (moduleId: string) => (moduleState: State) => (moduleMap: M) => M;
|
|
9
|
+
};
|
|
10
|
+
export type State = readonly ["ok", Module] | readonly ["error", Error];
|
|
11
|
+
export type Module = {
|
|
12
|
+
readonly exports: unknown;
|
|
13
|
+
readonly requireMap: O.Map<string>;
|
|
14
|
+
};
|
|
15
|
+
export type Error = ["file not found"] | ["compilation error", unknown] | ["runtime error", unknown] | ["circular reference"];
|
|
16
|
+
export type Id = {
|
|
17
|
+
readonly package: string;
|
|
18
|
+
readonly path: readonly string[];
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* @template M
|
|
22
|
+
* @typedef {{
|
|
23
|
+
* readonly at: (moduleId: string) => (moduleMap: M) => State | null
|
|
24
|
+
* readonly setReplace: (moduleId: string) => (moduleState: State) => (moduleMap: M) => M
|
|
25
|
+
* }} MapInterface
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* @typedef {|
|
|
29
|
+
* readonly['ok', Module] |
|
|
30
|
+
* readonly['error', Error]
|
|
31
|
+
* } State
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* @typedef {{
|
|
35
|
+
* readonly exports: unknown
|
|
36
|
+
* readonly requireMap: O.Map<string>
|
|
37
|
+
* }} Module
|
|
38
|
+
*/
|
|
39
|
+
/**
|
|
40
|
+
* @typedef {|
|
|
41
|
+
* ['file not found'] |
|
|
42
|
+
* ['compilation error', unknown] |
|
|
43
|
+
* ['runtime error', unknown] |
|
|
44
|
+
* ['circular reference']
|
|
45
|
+
* } Error
|
|
46
|
+
*/
|
|
47
|
+
/**
|
|
48
|
+
* @typedef {{
|
|
49
|
+
* readonly package: string
|
|
50
|
+
* readonly path: readonly string[]
|
|
51
|
+
* }} Id
|
|
52
|
+
*/
|
|
53
|
+
/** @type {(id: Id) => Id | null} */
|
|
54
|
+
declare const dir: (id: Id) => Id | null;
|
|
55
|
+
/** @type {(id: Id) => string} */
|
|
56
|
+
declare const idToString: (id: Id) => string;
|
|
57
|
+
import * as O from '../../types/object/module.f.mjs';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export { isDependenciesJson };
|
|
3
|
+
}
|
|
4
|
+
export default _default;
|
|
5
|
+
export type DependencyJson = readonly [string, string];
|
|
6
|
+
export type DependencyMapJson = { readonly [k in string]: string; };
|
|
7
|
+
export type DependenciesJson = DependencyMapJson | null;
|
|
8
|
+
/** @type {(j: jsonT.Unknown) => j is DependenciesJson} */
|
|
9
|
+
declare const isDependenciesJson: (j: jsonT.Unknown) => j is DependenciesJson;
|
|
10
|
+
import * as jsonT from '../../../json/module.f.mjs';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export { dependencies };
|
|
3
|
+
export { isPackageJson };
|
|
4
|
+
}
|
|
5
|
+
export default _default;
|
|
6
|
+
export type PackageJson = {
|
|
7
|
+
readonly name: string;
|
|
8
|
+
readonly version: string;
|
|
9
|
+
readonly dependencies?: dependenciesT.DependenciesJson;
|
|
10
|
+
};
|
|
11
|
+
export type Package = {
|
|
12
|
+
readonly dependency: (localPackageId: string) => string | null;
|
|
13
|
+
readonly file: (localFileId: string) => string | null;
|
|
14
|
+
};
|
|
15
|
+
export type Get = (packageId: string) => Package | null;
|
|
16
|
+
import dependencies from './dependencies/module.f.mjs';
|
|
17
|
+
/**
|
|
18
|
+
* @typedef {{
|
|
19
|
+
* readonly name: string
|
|
20
|
+
* readonly version: string
|
|
21
|
+
* readonly dependencies?: dependenciesT.DependenciesJson
|
|
22
|
+
* }} PackageJson
|
|
23
|
+
*/
|
|
24
|
+
/** @type {(j: jsonT.Unknown) => j is PackageJson} */
|
|
25
|
+
declare const isPackageJson: (j: jsonT.Unknown) => j is PackageJson;
|
|
26
|
+
import * as dependenciesT from './dependencies/module.f.mjs';
|
|
27
|
+
import * as jsonT from '../../json/module.f.mjs';
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export { parseLocal };
|
|
3
|
+
export { parseGlobal };
|
|
4
|
+
export { parse };
|
|
5
|
+
export { parseAndFind };
|
|
6
|
+
}
|
|
7
|
+
export default _default;
|
|
8
|
+
export type Items = readonly string[];
|
|
9
|
+
export type LocalPath = {
|
|
10
|
+
readonly external: boolean;
|
|
11
|
+
readonly dir: boolean;
|
|
12
|
+
readonly items: Items;
|
|
13
|
+
};
|
|
14
|
+
export type OptionList = readonly [List.List<string>] | null;
|
|
15
|
+
export type IdPath = readonly [string, List.List<string>];
|
|
16
|
+
export type Path = {
|
|
17
|
+
readonly package: string;
|
|
18
|
+
readonly items: Items;
|
|
19
|
+
readonly dir: boolean;
|
|
20
|
+
};
|
|
21
|
+
export type FoundResult = {
|
|
22
|
+
readonly id: moduleT.Id;
|
|
23
|
+
readonly source: string;
|
|
24
|
+
};
|
|
25
|
+
export type Result = FoundResult | null;
|
|
26
|
+
/** @type {(local: string) => (path: string) => LocalPath|null} */
|
|
27
|
+
declare const parseLocal: (local: string) => (path: string) => LocalPath | null;
|
|
28
|
+
/**
|
|
29
|
+
* @typedef {{
|
|
30
|
+
* readonly package: string,
|
|
31
|
+
* readonly items: Items,
|
|
32
|
+
* readonly dir: boolean,
|
|
33
|
+
* }} Path
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* @type {(d: (local: string) => string|null) =>
|
|
37
|
+
* (dir: boolean) =>
|
|
38
|
+
* (items: List.List<string>) =>
|
|
39
|
+
* Path|null}
|
|
40
|
+
*/
|
|
41
|
+
declare const parseGlobal: (d: (local: string) => string | null) => (dir: boolean) => (items: List.List<string>) => Path | null;
|
|
42
|
+
/**
|
|
43
|
+
* @type {(packageId: string) =>
|
|
44
|
+
* (dependencies: (local: string) => string|null) =>
|
|
45
|
+
* (local: string) =>
|
|
46
|
+
* (path: string) =>
|
|
47
|
+
* Path|null }
|
|
48
|
+
*/
|
|
49
|
+
declare const parse: (packageId: string) => (dependencies: (local: string) => string | null) => (local: string) => (path: string) => Path | null;
|
|
50
|
+
/**
|
|
51
|
+
* @typedef {{
|
|
52
|
+
* readonly id: moduleT.Id
|
|
53
|
+
* readonly source: string
|
|
54
|
+
* }} FoundResult
|
|
55
|
+
*/
|
|
56
|
+
/** @typedef {FoundResult| null} Result */
|
|
57
|
+
/**
|
|
58
|
+
* @type {(packageGet: packageT.Get) =>
|
|
59
|
+
* (moduleId: moduleT.Id) =>
|
|
60
|
+
* (path: string) =>
|
|
61
|
+
* Result
|
|
62
|
+
* }
|
|
63
|
+
*/
|
|
64
|
+
declare const parseAndFind: (packageGet: packageT.Get) => (moduleId: moduleT.Id) => (path: string) => Result;
|
|
65
|
+
import * as List from '../../types/list/module.f.mjs';
|
|
66
|
+
import * as moduleT from '../module/module.f.mjs';
|
|
67
|
+
import * as packageT from '../package/module.f.mjs';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
0: () => void;
|
|
3
|
+
1: () => void;
|
|
4
|
+
2: () => void;
|
|
5
|
+
3: () => void;
|
|
6
|
+
4: () => void;
|
|
7
|
+
5: () => void;
|
|
8
|
+
6: () => void;
|
|
9
|
+
7: () => void;
|
|
10
|
+
8: {
|
|
11
|
+
0: () => void;
|
|
12
|
+
1: () => void;
|
|
13
|
+
2: () => void;
|
|
14
|
+
3: () => void;
|
|
15
|
+
4: () => void;
|
|
16
|
+
5: () => void;
|
|
17
|
+
6: () => void;
|
|
18
|
+
7: () => void;
|
|
19
|
+
};
|
|
20
|
+
9: () => void;
|
|
21
|
+
10: () => void;
|
|
22
|
+
11: () => void;
|
|
23
|
+
12: () => void;
|
|
24
|
+
};
|
|
25
|
+
export default _default;
|
package/dev/index.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dev/module.d.mts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** @type {(code: number) => never} */
|
|
2
|
+
export const exit: (code: number) => never;
|
|
3
|
+
/** @type {(v: string) => string|undefined} */
|
|
4
|
+
export const env: (v: string) => string | undefined;
|
|
5
|
+
export function loadModuleMap(): Promise<ModuleMap>;
|
|
6
|
+
export function index(): Promise<void>;
|
|
7
|
+
export type Options = {
|
|
8
|
+
readonly withFileTypes: true;
|
|
9
|
+
};
|
|
10
|
+
export type Dirent = {
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly isDirectory: () => boolean;
|
|
13
|
+
};
|
|
14
|
+
export type FsPromises = {
|
|
15
|
+
readonly readdir: (path: string, options: Options) => Promise<readonly Dirent[]>;
|
|
16
|
+
readonly readFile: (path: string, options: "utf8") => Promise<string>;
|
|
17
|
+
};
|
|
18
|
+
export type Module = {
|
|
19
|
+
readonly default?: unknown;
|
|
20
|
+
};
|
|
21
|
+
export type Require = (name: string) => unknown;
|
|
22
|
+
export type UnknownMap = { readonly [k in string]: unknown; };
|
|
23
|
+
export type Entry<T> = readonly [string, T];
|
|
24
|
+
export type MutableModuleMap = { [k in string]: Module; };
|
|
25
|
+
export type ModuleMap = { readonly [k in string]: Module; };
|
|
26
|
+
export type FolderMap = { readonly [k in string]: string | FolderMap; };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default main;
|
|
2
|
+
export type DependencyMap = { readonly [k in string]?: Module; };
|
|
3
|
+
export type Module = {
|
|
4
|
+
readonly default?: unknown;
|
|
5
|
+
};
|
|
6
|
+
export type ModuleMap = { readonly [k in string]: Module; };
|
|
7
|
+
export type Log<T> = (v: string) => (state: T) => T;
|
|
8
|
+
export type Measure<T> = <R>(f: () => R) => (state: T) => readonly [R, number, T];
|
|
9
|
+
export type Input<T> = {
|
|
10
|
+
readonly moduleMap: ModuleMap;
|
|
11
|
+
readonly log: Log<T>;
|
|
12
|
+
readonly error: Log<T>;
|
|
13
|
+
readonly measure: Measure<T>;
|
|
14
|
+
readonly state: T;
|
|
15
|
+
readonly tryCatch: <R>(f: () => R) => Result.Result<R, unknown>;
|
|
16
|
+
readonly env: (n: string) => string | undefined;
|
|
17
|
+
};
|
|
18
|
+
export type TestState = {
|
|
19
|
+
readonly time: number;
|
|
20
|
+
readonly pass: number;
|
|
21
|
+
readonly fail: number;
|
|
22
|
+
};
|
|
23
|
+
export type FullState<T> = readonly [TestState, T];
|
|
24
|
+
/** @type {<T>(input: Input<T>) => readonly[number, T]} */
|
|
25
|
+
declare const main: <T>(input: Input<T>) => readonly [number, T];
|
|
26
|
+
import * as Result from '../../types/result/module.f.mjs';
|
package/dev/test.d.mts
ADDED
package/dev/test.f.d.mts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export { stringify };
|
|
3
|
+
export { serialize };
|
|
4
|
+
}
|
|
5
|
+
export default _default;
|
|
6
|
+
export type Object = { readonly [k in string]: Unknown; };
|
|
7
|
+
export type Array = readonly Unknown[];
|
|
8
|
+
export type Unknown = Object | boolean | string | number | null | Array | bigint;
|
|
9
|
+
export type Entry = O.Entry<Unknown>;
|
|
10
|
+
export type Entries = (List.List<Entry>);
|
|
11
|
+
export type MapEntries = (entries: Entries) => Entries;
|
|
12
|
+
/**
|
|
13
|
+
* The standard `JSON.stringify` rules determined by
|
|
14
|
+
* https://262.ecma-international.org/6.0/#sec-ordinary-object-internal-methods-and-internal-slots-ownpropertykeys
|
|
15
|
+
*
|
|
16
|
+
* @type {(mapEntries: MapEntries) => (value: Unknown) => string}
|
|
17
|
+
*/
|
|
18
|
+
declare const stringify: (mapEntries: MapEntries) => (value: Unknown) => string;
|
|
19
|
+
/** @typedef {O.Entry<Unknown>} Entry*/
|
|
20
|
+
/** @typedef {(List.List<Entry>)} Entries */
|
|
21
|
+
/** @typedef {(entries: Entries) => Entries} MapEntries */
|
|
22
|
+
/** @type {(mapEntries: MapEntries) => (value: Unknown) => List.List<string>} */
|
|
23
|
+
declare const serialize: (mapEntries: MapEntries) => (value: Unknown) => List.List<string>;
|
|
24
|
+
import * as O from '../types/object/module.f.mjs';
|
|
25
|
+
import * as List from '../types/list/module.f.mjs';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export { parse };
|
|
3
|
+
}
|
|
4
|
+
export default _default;
|
|
5
|
+
export type JsonObject = {
|
|
6
|
+
readonly kind: "object";
|
|
7
|
+
readonly values: Map.Map<Djs.Unknown>;
|
|
8
|
+
readonly key: string;
|
|
9
|
+
};
|
|
10
|
+
export type JsonArray = {
|
|
11
|
+
readonly kind: "array";
|
|
12
|
+
readonly values: List.List<Djs.Unknown>;
|
|
13
|
+
};
|
|
14
|
+
export type JsonStackElement = JsonObject | JsonArray;
|
|
15
|
+
export type JsonStack = List.List<JsonStackElement>;
|
|
16
|
+
export type StateModule = {
|
|
17
|
+
readonly status: "module";
|
|
18
|
+
readonly stage: "module" | "." | "exports" | "=";
|
|
19
|
+
};
|
|
20
|
+
export type StateParse = {
|
|
21
|
+
readonly status: "" | "[" | "[v" | "[," | "{" | "{k" | "{:" | "{v" | "{,";
|
|
22
|
+
readonly top: JsonStackElement | null;
|
|
23
|
+
readonly stack: JsonStack;
|
|
24
|
+
};
|
|
25
|
+
export type StateResult = {
|
|
26
|
+
readonly status: "result";
|
|
27
|
+
readonly value: Djs.Unknown;
|
|
28
|
+
};
|
|
29
|
+
export type StateError = {
|
|
30
|
+
readonly status: "error";
|
|
31
|
+
readonly message: string;
|
|
32
|
+
};
|
|
33
|
+
export type DjsState = StateModule | StateParse | StateResult | StateError;
|
|
34
|
+
/** @type {(tokenList: List.List<tokenizerT.DjsToken>) => Result.Result<Djs.Unknown, string>} */
|
|
35
|
+
declare const parse: (tokenList: List.List<tokenizerT.DjsToken>) => Result.Result<Djs.Unknown, string>;
|
|
36
|
+
import * as Map from '../../types/map/module.f.mjs';
|
|
37
|
+
import * as Djs from '../module.f.mjs';
|
|
38
|
+
import * as List from '../../types/list/module.f.mjs';
|
|
39
|
+
import * as tokenizerT from '../tokenizer/module.f.mjs';
|
|
40
|
+
import * as Result from '../../types/result/module.f.mjs';
|
package/djs/test.f.d.mts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export { tokenize };
|
|
3
|
+
}
|
|
4
|
+
export default _default;
|
|
5
|
+
export type DjsToken = {
|
|
6
|
+
readonly kind: "true" | "false" | "null";
|
|
7
|
+
} | {
|
|
8
|
+
readonly kind: "{" | "}" | ":" | "," | "[" | "]" | "." | "=";
|
|
9
|
+
} | jsTokenizerT.StringToken | jsTokenizerT.NumberToken | jsTokenizerT.ErrorToken | jsTokenizerT.IdToken | jsTokenizerT.BigIntToken | jsTokenizerT.WhitespaceToken;
|
|
10
|
+
export type ScanState = {
|
|
11
|
+
readonly kind: "def" | "-";
|
|
12
|
+
};
|
|
13
|
+
export type ScanInput = jsTokenizerT.JsToken | null;
|
|
14
|
+
/** @type {(input: List.List<number>) => List.List<DjsToken>} */
|
|
15
|
+
declare const tokenize: (input: List.List<number>) => List.List<DjsToken>;
|
|
16
|
+
import * as jsTokenizerT from '../../js/tokenizer/module.f.mjs';
|
|
17
|
+
import * as List from '../../types/list/module.f.mjs';
|