functionalscript 0.46.1 → 0.47.0
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/fjs/basen/cbase32/module.f.mjs +18 -10
- package/fjs/basen/cbase32/proof.f.d.mts +3 -0
- package/fjs/basen/cbase32/proof.f.mjs +24 -2
- package/fjs/basen/proof.f.mjs +8 -16
- package/fjs/bnf/ll1/proof.f.d.mts +2 -0
- package/fjs/bnf/ll1/proof.f.mjs +33 -18
- package/fjs/bnf/module.f.d.mts +2 -2
- package/fjs/bnf/module.f.mjs +2 -2
- package/fjs/cas/proof.f.mjs +4 -26
- package/fjs/ci/common/module.f.mjs +6 -0
- package/fjs/ci/config/module.f.d.mts +7 -7
- package/fjs/ci/config/module.f.mjs +7 -7
- package/fjs/cli/module.f.mjs +14 -10
- package/fjs/crypto/vdf/module.f.d.mts +0 -1
- package/fjs/crypto/vdf/module.f.mjs +3 -14
- package/fjs/dev/module.f.mjs +10 -20
- package/fjs/djs/parser/module.f.d.mts +101 -53
- package/fjs/djs/parser/module.f.mjs +732 -525
- package/fjs/djs/parser/proof.f.d.mts +6 -0
- package/fjs/djs/parser/proof.f.mjs +315 -11
- package/fjs/djs/parser/types.d.ts +29 -2
- package/fjs/djs/tokenizer/module.f.mjs +122 -105
- package/fjs/djs/tokenizer/proof.f.mjs +17 -0
- package/fjs/djs/transpiler/module.f.mjs +4 -5
- package/fjs/djs/transpiler/proof.f.d.mts +2 -0
- package/fjs/djs/transpiler/proof.f.mjs +25 -0
- package/fjs/edag/amnesia/module.f.d.mts +20 -0
- package/fjs/edag/amnesia/module.f.mjs +303 -0
- package/fjs/edag/amnesia/proof.f.d.mts +79 -0
- package/fjs/edag/amnesia/proof.f.mjs +573 -0
- package/fjs/edag/amnesia/types.d.ts +15 -0
- package/fjs/edag/module.f.d.mts +410 -0
- package/fjs/edag/module.f.mjs +559 -0
- package/fjs/edag/proof.f.d.mts +116 -0
- package/fjs/edag/proof.f.mjs +686 -0
- package/fjs/edag/types.d.ts +55 -0
- package/fjs/effects/node/memory/module.d.mts +37 -3
- package/fjs/effects/node/memory/module.mjs +38 -4
- package/fjs/effects/node/memory/proof.d.mts +5 -2
- package/fjs/effects/node/memory/proof.mjs +36 -6
- package/fjs/effects/node/module.d.mts +9 -1
- package/fjs/effects/node/module.f.d.mts +39 -0
- package/fjs/effects/node/module.f.mjs +46 -0
- package/fjs/effects/node/module.mjs +234 -32
- package/fjs/effects/node/types.d.ts +28 -2
- package/fjs/effects/node/virtual/module.f.d.mts +19 -10
- package/fjs/effects/node/virtual/module.f.mjs +246 -32
- package/fjs/effects/node/virtual/proof.f.d.mts +17 -2
- package/fjs/effects/node/virtual/proof.f.mjs +232 -8
- package/fjs/effects/node/virtual/types.d.ts +57 -1
- package/fjs/emergent_testing/browser/proof.d.mts +55 -0
- package/fjs/emergent_testing/browser/proof.mjs +352 -0
- package/fjs/emergent_testing/browser/species.proof.d.mts +4 -0
- package/fjs/emergent_testing/browser/species.proof.mjs +45 -0
- package/fjs/emergent_testing/browser.d.mts +79 -0
- package/fjs/emergent_testing/browser.mjs +432 -0
- package/fjs/emergent_testing/proof.f.d.mts +1 -1
- package/fjs/emergent_testing/proof.f.mjs +2 -2
- package/fjs/js/string_escape/module.f.d.mts +47 -0
- package/fjs/js/string_escape/module.f.mjs +95 -0
- package/fjs/js/string_escape/proof.f.d.mts +8 -0
- package/fjs/js/string_escape/proof.f.mjs +68 -0
- package/fjs/js/tokenizer/module.f.mjs +14 -12
- package/fjs/mcp/cas/module.f.d.mts +1 -7
- package/fjs/mcp/cas/module.f.mjs +24 -15
- package/fjs/mcp/evo/module.f.mjs +9 -24
- package/fjs/mcp/module.f.d.mts +3 -1
- package/fjs/mcp/module.f.mjs +4 -2
- package/fjs/media/json/rtti/module.f.d.mts +2 -2
- package/fjs/media/json/rtti/module.f.mjs +1 -1
- package/fjs/media/json/schema/module.f.d.mts +15 -5
- package/fjs/media/json/schema/module.f.mjs +42 -15
- package/fjs/media/json/schema/proof.f.d.mts +10 -1
- package/fjs/media/json/schema/proof.f.mjs +88 -16
- package/fjs/media/json/serializer/module.f.mjs +14 -26
- package/fjs/media/json/types.d.ts +1 -1
- package/fjs/media/lock/module.f.d.mts +8 -3
- package/fjs/media/lock/module.f.mjs +9 -3
- package/fjs/media/lock/proof.f.d.mts +1 -1
- package/fjs/media/lock/proof.f.mjs +2 -2
- package/fjs/media/lock/types.d.ts +1 -3
- package/fjs/media/module.f.d.mts +20 -13
- package/fjs/media/module.f.mjs +29 -16
- package/fjs/media/note/module.f.d.mts +14 -7
- package/fjs/media/note/module.f.mjs +14 -7
- package/fjs/media/note/proof.f.mjs +1 -1
- package/fjs/media/proof.f.mjs +5 -5
- package/fjs/media/revision/module.f.d.mts +8 -2
- package/fjs/media/revision/module.f.mjs +9 -3
- package/fjs/media/revision/proof.f.mjs +1 -1
- package/fjs/media/revision/types.d.ts +1 -1
- package/fjs/media/type/module.f.d.mts +20 -0
- package/fjs/media/type/module.f.mjs +74 -0
- package/fjs/media/type/proof.f.d.mts +5 -0
- package/fjs/media/type/proof.f.mjs +24 -1
- package/fjs/module.f.mjs +6 -0
- package/fjs/path/module.f.d.mts +60 -3
- package/fjs/path/module.f.mjs +138 -14
- package/fjs/path/proof.f.d.mts +3 -0
- package/fjs/path/proof.f.mjs +298 -2
- package/fjs/protocol/json_rpc/module.f.d.mts +65 -28
- package/fjs/protocol/json_rpc/module.f.mjs +49 -13
- package/fjs/protocol/json_rpc/proof.f.d.mts +4 -0
- package/fjs/protocol/json_rpc/proof.f.mjs +29 -0
- package/fjs/protocol/json_rpc/types.d.ts +12 -2
- package/fjs/protocol/mcp/module.f.d.mts +89 -54
- package/fjs/protocol/mcp/module.f.mjs +110 -56
- package/fjs/protocol/mcp/proof.f.d.mts +13 -0
- package/fjs/protocol/mcp/proof.f.mjs +107 -7
- package/fjs/protocol/mcp/stdio/module.f.mjs +3 -4
- package/fjs/protocol/mcp/stdio/proof.f.mjs +2 -2
- package/fjs/protocol/mcp/types.d.ts +14 -2
- package/fjs/text/utf8/module.f.mjs +27 -1
- package/fjs/text/utf8/proof.f.mjs +37 -0
- package/fjs/types/array/module.f.mjs +18 -11
- package/fjs/types/array/proof.f.mjs +27 -1
- package/fjs/types/bigfloat/module.f.d.mts +48 -9
- package/fjs/types/bigfloat/module.f.mjs +147 -59
- package/fjs/types/bigfloat/proof.f.d.mts +2 -0
- package/fjs/types/bigfloat/proof.f.mjs +136 -4
- package/fjs/types/bigfloat/types.d.ts +17 -0
- package/fjs/types/function/module.f.d.mts +11 -2
- package/fjs/types/function/module.f.mjs +20 -2
- package/fjs/types/function/proof.f.mjs +5 -1
- package/fjs/types/phantom/types.d.ts +21 -0
- package/fjs/types/result/module.f.d.mts +4 -4
- package/fjs/types/result/module.f.mjs +2 -2
- package/fjs/types/result/proof.f.d.mts +6 -2
- package/fjs/types/result/proof.f.mjs +17 -1
- package/fjs/types/rtti/common/module.f.d.mts +78 -5
- package/fjs/types/rtti/common/module.f.mjs +168 -3
- package/fjs/types/rtti/common/proof.f.d.mts +14 -0
- package/fjs/types/rtti/common/proof.f.mjs +61 -2
- package/fjs/types/rtti/common/types.d.ts +23 -1
- package/fjs/types/rtti/data/module.f.d.mts +57 -1
- package/fjs/types/rtti/data/module.f.mjs +241 -47
- package/fjs/types/rtti/data/proof.f.d.mts +10 -0
- package/fjs/types/rtti/data/proof.f.mjs +272 -39
- package/fjs/types/rtti/data/types.d.ts +14 -7
- package/fjs/types/rtti/host.proof.d.mts +33 -0
- package/fjs/types/rtti/host.proof.mjs +170 -0
- package/fjs/types/rtti/module.f.d.mts +51 -6
- package/fjs/types/rtti/module.f.mjs +50 -3
- package/fjs/types/rtti/parse/module.f.d.mts +31 -24
- package/fjs/types/rtti/parse/module.f.mjs +197 -59
- package/fjs/types/rtti/parse/proof.f.d.mts +37 -2
- package/fjs/types/rtti/parse/proof.f.mjs +171 -47
- package/fjs/types/rtti/proof.f.d.mts +6 -0
- package/fjs/types/rtti/proof.f.mjs +42 -1
- package/fjs/types/rtti/ts/module.f.d.mts +9 -3
- package/fjs/types/rtti/ts/module.f.mjs +68 -15
- package/fjs/types/rtti/ts/proof.f.d.mts +42 -2
- package/fjs/types/rtti/ts/proof.f.mjs +139 -6
- package/fjs/types/rtti/ts/types.d.ts +164 -16
- package/fjs/types/rtti/types.d.ts +31 -3
- package/fjs/types/rtti/validate/module.f.d.mts +42 -25
- package/fjs/types/rtti/validate/module.f.mjs +187 -53
- package/fjs/types/rtti/validate/proof.f.d.mts +28 -2
- package/fjs/types/rtti/validate/proof.f.mjs +430 -75
- package/fjs/types/ts/types.d.ts +4 -0
- package/fjs/web/module.f.d.mts +115 -0
- package/fjs/web/module.f.mjs +581 -0
- package/fjs/web/proof.f.d.mts +39 -0
- package/fjs/web/proof.f.mjs +413 -0
- package/fjs/web/types.d.ts +39 -0
- package/fjs/website/browser-prepare.d.mts +5 -0
- package/fjs/website/browser-prepare.mjs +115 -0
- package/fjs/website/browser-source.d.mts +37 -0
- package/fjs/website/browser-source.mjs +202 -0
- package/fjs/website/browser-source.proof.d.mts +31 -0
- package/fjs/website/browser-source.proof.mjs +162 -0
- package/fjs/website/browser.d.mts +5 -0
- package/fjs/website/browser.mjs +8 -0
- package/fjs/website/module.f.d.mts +3 -3
- package/fjs/website/module.f.mjs +62 -9
- package/fjs/website/proof.f.d.mts +4 -0
- package/fjs/website/proof.f.mjs +18 -3
- package/package.json +2 -3
|
@@ -8,61 +8,94 @@
|
|
|
8
8
|
* @import { Fold } from '../../types/function/operator/types.ts'
|
|
9
9
|
* @import { DjsToken, DjsTokenWithMetadata } from '../tokenizer/types.ts'
|
|
10
10
|
* @import { OrderedMap } from '../../types/ordered_map/types.ts'
|
|
11
|
-
* @import { AstArray, AstConst, AstModule, AstModuleRef } from '../ast/types.ts'
|
|
11
|
+
* @import { AstArray, AstConst, AstModule, AstModuleRef, AstObject } from '../ast/types.ts'
|
|
12
12
|
* @import { TokenMetadata } from '../../js/tokenizer/types.ts'
|
|
13
|
-
* @import { ParseError, _ValueToken } from './types.ts'
|
|
13
|
+
* @import { ParseError, _FramingKeyword, _OrdinaryTokenName, _ValueToken } from './types.ts'
|
|
14
|
+
* @import { Assert } from '../../asserts/types.ts'
|
|
15
|
+
* @import { Equal } from '../../types/ts/types.ts'
|
|
16
|
+
* @import { CodePointMeta } from '../../bnf/descent/types.ts'
|
|
17
|
+
* @import { Ast, AstSequence } from '../../bnf/matcher/types.ts'
|
|
18
|
+
* @import { Rule, TerminalRange } from '../../bnf/types.ts'
|
|
19
|
+
* @import { DescentMatch } from '../../bnf/descent/types.ts'
|
|
14
20
|
*/
|
|
15
21
|
import type { Result } from '../../types/result/types.ts';
|
|
16
22
|
import type { List } from '../../types/list/types.ts';
|
|
17
|
-
import type { DjsTokenWithMetadata } from '../tokenizer/types.ts';
|
|
23
|
+
import type { DjsToken, DjsTokenWithMetadata } from '../tokenizer/types.ts';
|
|
18
24
|
import type { OrderedMap } from '../../types/ordered_map/types.ts';
|
|
19
25
|
import type { AstConst, AstModule, AstModuleRef } from '../ast/types.ts';
|
|
20
|
-
import type {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export type
|
|
27
|
-
readonly
|
|
28
|
-
readonly
|
|
29
|
-
readonly consts: List<AstConst>;
|
|
30
|
-
};
|
|
31
|
-
export type _InitialState = {
|
|
32
|
-
readonly state: '';
|
|
33
|
-
readonly module: _ModuleState;
|
|
34
|
-
};
|
|
35
|
-
export type _NewLineRequiredState = {
|
|
36
|
-
readonly state: 'nl';
|
|
37
|
-
readonly module: _ModuleState;
|
|
38
|
-
};
|
|
39
|
-
export type _ImportState = {
|
|
40
|
-
readonly state: 'import' | 'import+name' | 'import+from';
|
|
41
|
-
readonly module: _ModuleState;
|
|
42
|
-
};
|
|
43
|
-
export type _ConstState = {
|
|
44
|
-
readonly state: 'const' | 'const+name';
|
|
45
|
-
readonly module: _ModuleState;
|
|
46
|
-
};
|
|
47
|
-
export type _ExportState = {
|
|
48
|
-
readonly state: 'export';
|
|
49
|
-
readonly module: _ModuleState;
|
|
26
|
+
import type { TokenMetadata } from '../../js/tokenizer/types.ts';
|
|
27
|
+
import type { ParseError, _FramingKeyword, _OrdinaryTokenName } from './types.ts';
|
|
28
|
+
import type { Assert } from '../../asserts/types.ts';
|
|
29
|
+
import type { Equal } from '../../types/ts/types.ts';
|
|
30
|
+
import type { CodePointMeta } from '../../bnf/descent/types.ts';
|
|
31
|
+
import type { Ast } from '../../bnf/matcher/types.ts';
|
|
32
|
+
export type _TokenStream = {
|
|
33
|
+
readonly tokens: readonly DjsTokenWithMetadata[];
|
|
34
|
+
readonly eofMetadata: TokenMetadata;
|
|
50
35
|
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
36
|
+
/**
|
|
37
|
+
* The parser layer's complete finite alphabet: every token name its grammar may
|
|
38
|
+
* name as a terminal, and the exact set a token-name-to-symbol mapping has to be
|
|
39
|
+
* validated over before parsing.
|
|
40
|
+
*
|
|
41
|
+
* `eof` is not a member — {@link splitEof} removes the tokenizer's physical
|
|
42
|
+
* end-of-input token before any name is mapped, and the backend synthesizes its
|
|
43
|
+
* own logical one.
|
|
44
|
+
*
|
|
45
|
+
* The names are the *token* vocabulary, not the tokenizer grammar's tag
|
|
46
|
+
* vocabulary: only eight punctuators survive into `DjsToken`, so the JS operator
|
|
47
|
+
* set the tokenizer recognizes is far larger than what reaches this layer.
|
|
48
|
+
*
|
|
49
|
+
* A name is not always a kind. The framing keywords arrive as `id` tokens and
|
|
50
|
+
* need terminals of their own, or the grammar could not tell `export default`
|
|
51
|
+
* from two arbitrary identifiers — see {@link framingKeywords}.
|
|
52
|
+
*
|
|
53
|
+
* The `_…AreComplete` assertions below check both halves against `DjsToken` and
|
|
54
|
+
* `_FramingKeyword` at compile time, so a kind or keyword added there breaks the
|
|
55
|
+
* build rather than going unrepresented.
|
|
56
|
+
*/
|
|
57
|
+
declare const tokenKindNames: readonly ['true', 'false', 'null', 'undefined', '{', '}', ':', ',', '[', ']', '.', '=', 'string', 'number', 'error', 'id', 'bigint', 'ws', 'nl', '//', '/*'];
|
|
58
|
+
/**
|
|
59
|
+
* The framing keywords, which the tokenizer emits as `id` tokens carrying the
|
|
60
|
+
* word in `value`. Kept as its own list because the mapping has to recognize
|
|
61
|
+
* exactly these values, not merely encode them.
|
|
62
|
+
*
|
|
63
|
+
* **A grammar over this alphabet owes them an identifier rule.** None of the
|
|
64
|
+
* five is reserved: outside the framing positions the parser accepts them as
|
|
65
|
+
* ordinary identifiers, so `const export = 1`, `export default export`, and
|
|
66
|
+
* `{ from: 2, default: 3 }` all parse today. Once each carries its own symbol, a
|
|
67
|
+
* rule whose identifier terminal is the bare `id` symbol rejects every one of
|
|
68
|
+
* them. Wherever an identifier is accepted — binding names, references, object
|
|
69
|
+
* keys, import names — the terminal has to be the union of `id` and these five.
|
|
70
|
+
*
|
|
71
|
+
* Giving a word its own symbol narrows where it is *required*, never where it is
|
|
72
|
+
* *allowed*.
|
|
73
|
+
*/
|
|
74
|
+
declare const framingKeywords: readonly ['import', 'const', 'export', 'default', 'from'];
|
|
75
|
+
/**
|
|
76
|
+
* The complete alphabet: one name per `DjsToken` kind except `eof`, plus one per
|
|
77
|
+
* framing keyword. No keyword collides with a kind, so the two lists concatenate
|
|
78
|
+
* without a name being registered twice — which `encoding` would reject anyway.
|
|
79
|
+
*/
|
|
80
|
+
declare const ordinaryTokenNames: ("," | "." | "/*" | "//" | ":" | "=" | "[" | "]" | "bigint" | "const" | "default" | "error" | "export" | "false" | "from" | "id" | "import" | "nl" | "null" | "number" | "string" | "true" | "undefined" | "ws" | "{" | "}")[];
|
|
81
|
+
export type _KindsAreComplete = Assert<Equal<(typeof tokenKindNames)[number], Exclude<DjsToken['kind'], 'eof'>>>;
|
|
82
|
+
export type _KeywordsAreComplete = Assert<Equal<(typeof framingKeywords)[number], _FramingKeyword>>;
|
|
83
|
+
export type _AlphabetIsComplete = Assert<Equal<(typeof ordinaryTokenNames)[number], _OrdinaryTokenName>>;
|
|
84
|
+
export type _EofIsNotAName = Assert<Equal<Extract<_OrdinaryTokenName, 'eof'>, never>>;
|
|
85
|
+
export type _Node = Ast<CodePointMeta<DjsTokenWithMetadata>>;
|
|
86
|
+
export type _FoldState = {
|
|
87
|
+
readonly refs: OrderedMap<AstModuleRef>;
|
|
88
|
+
readonly modules: readonly string[];
|
|
89
|
+
readonly consts: readonly AstConst[];
|
|
90
|
+
readonly error: ParseError | null;
|
|
62
91
|
};
|
|
63
|
-
export type
|
|
64
|
-
readonly
|
|
65
|
-
readonly
|
|
92
|
+
export type _FoldFrame = {
|
|
93
|
+
readonly items: readonly _Node[];
|
|
94
|
+
readonly index: number;
|
|
95
|
+
readonly array: List<AstConst>;
|
|
96
|
+
readonly object: OrderedMap<AstConst>;
|
|
97
|
+
readonly keys: readonly (readonly [string, boolean])[];
|
|
98
|
+
readonly isArray: boolean;
|
|
66
99
|
};
|
|
67
100
|
/**
|
|
68
101
|
* Reads the token list as a FunctionalScript module: `import` statements, then
|
|
@@ -72,17 +105,32 @@ export type _ErrorState = {
|
|
|
72
105
|
* module, and `fjs/media/json` is its reader
|
|
73
106
|
* ([spec: JSON input](../../../spec/README.md#json-input)).
|
|
74
107
|
*
|
|
108
|
+
* The grammar it accepts is written down, in the rules above, rather than
|
|
109
|
+
* implied by the control flow of a state machine — which is what this replaced.
|
|
110
|
+
*
|
|
75
111
|
* @type {(tokenList: List<DjsTokenWithMetadata>) => Result<AstModule, ParseError>}
|
|
76
112
|
*/
|
|
77
113
|
export declare const parseFromTokens: (tokenList: List<DjsTokenWithMetadata>) => Result<AstModule, ParseError>;
|
|
78
114
|
export declare const proof: {
|
|
79
|
-
|
|
80
|
-
|
|
115
|
+
ordinaryTokenNames: {
|
|
116
|
+
noDuplicates: () => void;
|
|
81
117
|
};
|
|
82
|
-
|
|
83
|
-
|
|
118
|
+
tokenToSymbol: {
|
|
119
|
+
distinctAndAboveUnicode: () => void;
|
|
120
|
+
framingKeywordsAreNotIdentifiers: () => void;
|
|
121
|
+
carriesTheToken: () => void;
|
|
122
|
+
throw: {
|
|
123
|
+
eofRejected: () => CodePointMeta<DjsTokenWithMetadata>;
|
|
124
|
+
};
|
|
84
125
|
};
|
|
85
|
-
|
|
86
|
-
|
|
126
|
+
splitEof: {
|
|
127
|
+
final: () => void;
|
|
128
|
+
onlyEof: () => void;
|
|
129
|
+
missing: () => void;
|
|
130
|
+
empty: () => void;
|
|
131
|
+
lexicalError: () => void;
|
|
132
|
+
notFinal: () => void;
|
|
133
|
+
duplicate: () => void;
|
|
87
134
|
};
|
|
88
135
|
};
|
|
136
|
+
export {};
|