Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ history.

## Unreleased

- **BREAKING CHANGES:** `fjs/media/json/parser` migrates from authored
TypeScript (`.f.ts`) to JSDoc-typed JavaScript (`.f.mjs`) under the
stage-1 TypeScript-to-mjs migration, splitting `_JsonObject`,
`_JsonArray`, `_JsonStack`, `_StateParse`, and `_JsonState` into a
sibling `types.ts` — importers must use the `.f.mjs` specifier for the
runtime value and the `types.ts` specifier for the types. `proof.f.ts`
stays TypeScript for now (it depends on `fjs/media/json/module.f.ts`,
still unmigrated)
[#1499](https://github.com/functionalscript/functionalscript/pull/1499)
- **BREAKING CHANGES:** the JSON rtti schemas `primitive`, `unknown`,
`object`, and `array` move from `fjs/media/json/module.f.ts` to a new
JSDoc-typed `fjs/media/json/rtti/module.f.mjs`, and the `Primitive`,
Expand Down
15 changes: 3 additions & 12 deletions fjs/asn.1/module.f.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
* helpers, length-prefixed payloads, and OID conversion via Base-128.
*
* @module
*
* @import { Unpacked, Vec } from '../types/bit_vec/types.ts'
* @import { ObjectIdentifier, Raw, Record, Sequence, SupportedRecord, _Tag } from './types.ts'
*/

import { bitLength, divUp8 } from '../types/bigint/module.f.mjs'

import {
empty,
isVec,
Expand All @@ -17,19 +19,8 @@ import {
vec,
vec8,
} from '../types/bit_vec/module.f.mjs'

/** @import { Unpacked, Vec } from '../types/bit_vec/types.ts' */

/**
* @import {
* ObjectIdentifier, Raw, Record, Sequence, SupportedRecord, _Tag,
* } from './types.ts'
*/

import { identity } from '../types/function/module.f.mjs'

import { max } from '../types/function/compare/module.f.mjs'

import { encode as b128encode, decode as b128decode } from '../basen/base128/module.f.mjs'

//
Expand Down
2 changes: 1 addition & 1 deletion fjs/asn.1/proof.f.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { empty, isVec, length, msb, uint, unpack, vec, vec8 } from '../types/bit_vec/module.f.mjs'
/** @import { Vec } from '../types/bit_vec/types.ts' */
import { empty, isVec, length, msb, uint, unpack, vec, vec8 } from '../types/bit_vec/module.f.mjs'

import { asBase } from '../types/nominal/module.f.mjs'

Expand Down
3 changes: 2 additions & 1 deletion fjs/basen/base128/module.f.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
* Base-128 encoding and decoding utilities over bit vectors.
*
* @module
*
* @import { Vec } from '../../types/bit_vec/types.ts'
*/

import { vec8, msb, empty } from '../../types/bit_vec/module.f.mjs'
/** @import { Vec } from '../../types/bit_vec/types.ts' */

const { concat, popFront } = msb

Expand Down
3 changes: 1 addition & 2 deletions fjs/basen/base128/proof.f.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { empty, vec, vec8 } from '../../types/bit_vec/module.f.mjs'
/** @import { Vec } from '../../types/bit_vec/types.ts' */

import { empty, vec, vec8 } from '../../types/bit_vec/module.f.mjs'
import { asBase } from '../../types/nominal/module.f.mjs'

import { encode, decode } from './module.f.mjs'

//
Expand Down
7 changes: 3 additions & 4 deletions fjs/basen/base64/module.f.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
* Standard Base64 encoding and decoding (RFC 4648).
*
* @module
*
* @import { Vec } from '../../types/bit_vec/types.ts'
* @import { Nullable } from '../../types/nullable/types.ts'
*/

import { msb, length, vec, maxLength } from '../../types/bit_vec/module.f.mjs'
/** @import { Vec } from '../../types/bit_vec/types.ts' */

/** @import { Nullable } from '../../types/nullable/types.ts' */

import { baseN } from "../module.f.mjs"

const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
Expand Down
5 changes: 2 additions & 3 deletions fjs/basen/base64/proof.f.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { assertEq } from '../../asserts/module.f.mjs'

import { empty, vec, repeat, vec8, maxLength } from '../../types/bit_vec/module.f.mjs'
/** @import { Vec } from '../../types/bit_vec/types.ts' */

import { assertEq } from '../../asserts/module.f.mjs'
import { empty, vec, repeat, vec8, maxLength } from '../../types/bit_vec/module.f.mjs'
import { encode, decode } from './module.f.mjs'

/**
Expand Down
7 changes: 3 additions & 4 deletions fjs/basen/cbase32/module.f.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
* Content-addressable Base32 encoding and decoding helpers.
*
* @module
*
* @import { Vec } from '../../types/bit_vec/types.ts'
* @import { Nullable } from '../../types/nullable/types.ts'
*/

import { msb, lsb, length, vec, empty } from '../../types/bit_vec/module.f.mjs'
/** @import { Vec } from '../../types/bit_vec/types.ts' */

/** @import { Nullable } from '../../types/nullable/types.ts' */

import { baseN } from '../module.f.mjs'

// 0123456789abcdef
Expand Down
3 changes: 1 addition & 2 deletions fjs/basen/cbase32/proof.f.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { empty, vec } from '../../types/bit_vec/module.f.mjs'
/** @import { Vec } from '../../types/bit_vec/types.ts' */

import { empty, vec } from '../../types/bit_vec/module.f.mjs'
import { cBase32ToVec, cBase32ToVec5x, vec5xToCBase32, vecToCBase32 } from './module.f.mjs'

import { assertEq } from '../../asserts/module.f.mjs'

//
Expand Down
10 changes: 4 additions & 6 deletions fjs/basen/module.f.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,16 @@
* `vecToString` / `stringToVec`.
*
* @module
*
* @import { Vec } from '../types/bit_vec/types.ts'
* @import { List } from '../types/list/types.ts'
* @import { BaseN } from './types.ts'
*/

import { msb, lsb, vec, chunkList, unpack } from '../types/bit_vec/module.f.mjs'
/** @import { Vec } from '../types/bit_vec/types.ts' */

import { fold } from '../types/list/module.f.mjs'
/** @import { List } from '../types/list/types.ts' */

import { compose } from '../types/function/module.f.mjs'

/** @import { BaseN } from './types.ts' */

const { unpackSplit } = msb

const { tryListToVec: reversedListToVec } = lsb
Expand Down
12 changes: 6 additions & 6 deletions fjs/bnf/data/module.f.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
* See `./types.ts` for the type-level API.
*
* @module
*
* @import { DataRule, Rule as FRule, Sequence as FSequence } from '../types.ts'
* @import { StringMap } from '../../types/object/types.ts'
* @import { EmptyTag, Rule, RuleSet, Sequence, Variant } from './types.ts'
*/

import { stringToCodePointList } from '../../text/utf16/module.f.mjs'
import { map, toArray } from '../../types/list/module.f.mjs'
import {
oneEncode,
} from '../module.f.mjs'
/** @import { DataRule, Rule as FRule, Sequence as FSequence } from '../types.ts' */
import { oneEncode } from '../module.f.mjs'
import { definedEntries } from '../../types/object/module.f.mjs'
/** @import { StringMap } from '../../types/object/types.ts' */
/** @import { EmptyTag, Rule, RuleSet, Sequence, Variant } from './types.ts' */

/** @typedef {StringMap<EmptyTag>} _EmptyTagMap */

Expand Down
8 changes: 5 additions & 3 deletions fjs/bnf/data/proof.f.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { stringify } from '../../media/json/module.f.ts'
import type { RuleSet } from './types.ts'

import { identity } from '../../types/function/module.f.mjs'
import { sort } from '../../types/object/module.f.mjs'
import { oneEncode, option, range, rangeDecode, repeat0Plus, set } from '../module.f.mjs'
import { classic, deterministic } from '../testlib.f.ts'
import { emptyTagMap, toData } from './module.f.mjs'
import type { RuleSet } from './types.ts'
import { assertEq } from '../../asserts/module.f.mjs'

import { stringify } from '../../media/json/module.f.ts'
import { classic, deterministic } from '../testlib.f.ts'

export const proof = {
rangeDecode: () => {
const decoded1 = stringify(sort)(rangeDecode(0x000079_000087))
Expand Down
10 changes: 6 additions & 4 deletions fjs/bnf/descent/module.f.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@
* See `./types.ts` for the type-level API.
*
* @module
*
* @import { TerminalRange } from '../types.ts'
* @import { Rule as DataRule, Sequence } from '../data/types.ts'
* @import { Rule as FRule } from '../types.ts'
* @import { AstTag, AstSequenceMeta, DescentFailure, DescentMatch, DescentMatchResult, DescentMatchRule } from './types.ts'
*/

import { rangeDecode } from '../module.f.mjs'
/** @import { TerminalRange } from '../types.ts' */
import { contains as rangeContains } from '../../types/range/module.f.mjs'
import { definedEntries } from '../../types/object/module.f.mjs'
import { emptyTagMap, toData } from '../data/module.f.mjs'
/** @import { Rule as DataRule, Sequence } from '../data/types.ts' */
/** @import { Rule as FRule } from '../types.ts' */
/** @import { AstTag, AstSequenceMeta, DescentFailure, DescentMatch, DescentMatchResult, DescentMatchRule } from './types.ts' */

/**
* Folds one rejected terminal into the furthest-failure record: further along
Expand Down
6 changes: 4 additions & 2 deletions fjs/bnf/descent/proof.f.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import type { CodePoint } from '../../text/utf16/types.ts'
import type { DescentMatch, CodePointMeta, DescentMatchResult } from './types.ts'

import { stringToCodePointList } from '../../text/utf16/module.f.mjs'
import { map, toArray } from '../../types/list/module.f.mjs'
import { commaJoin0Plus, option, range, repeat0Plus, set } from '../module.f.mjs'
import { deterministic } from '../testlib.f.ts'
import { emptyTagMap, toData } from '../data/module.f.mjs'
import { descentParser } from './module.f.mjs'
import type { DescentMatch, CodePointMeta, DescentMatchResult } from './types.ts'
import { assertEq, assertNotNullish } from '../../asserts/module.f.mjs'

import { deterministic } from '../testlib.f.ts'

const mapCodePoint = (cp: CodePoint): CodePointMeta<unknown> => [cp, undefined]

// The code point of a one-character string, for expectations that would
Expand Down
12 changes: 7 additions & 5 deletions fjs/bnf/ll1/module.f.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,21 @@
* See `./types.ts` for the type-level API.
*
* @module
*
* @import { Properties } from '../../types/range_map/types.ts'
* @import { StringSet } from '../../types/string_set/types.ts'
* @import { EmptyTag, RuleSet } from '../data/types.ts'
* @import { Rule as FRule } from '../types.ts'
* @import { AstSequence, AstTag, Match, MatchResult, MatchRule, Remainder, _Dispatch, _DispatchMap, _DispatchResult, _DispatchRule } from './types.ts'
*/

import { strictEqual } from '../../types/function/operator/module.f.mjs'
import { toArray } from '../../types/list/module.f.mjs'
import { rangeMap } from '../../types/range_map/module.f.mjs'
/** @import { Properties } from '../../types/range_map/types.ts' */
import { contains, set } from '../../types/string_set/module.f.mjs'
/** @import { StringSet } from '../../types/string_set/types.ts' */
import { rangeDecode } from '../module.f.mjs'
import { definedEntries } from '../../types/object/module.f.mjs'
import { emptyTagMap, toData } from '../data/module.f.mjs'
/** @import { EmptyTag, RuleSet } from '../data/types.ts' */
/** @import { Rule as FRule } from '../types.ts' */
/** @import { AstSequence, AstTag, Match, MatchResult, MatchRule, Remainder, _Dispatch, _DispatchMap, _DispatchResult, _DispatchRule } from './types.ts' */

/** @type {Properties<_DispatchResult>} */
const dispatchProps = {
Expand Down
8 changes: 5 additions & 3 deletions fjs/bnf/ll1/proof.f.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import type { RuleSet } from '../data/types.ts'
import type { MatchResult } from './types.ts'

import { stringToCodePointList } from '../../text/utf16/module.f.mjs'
import { toArray } from '../../types/list/module.f.mjs'
import { commaJoin0Plus, option, range, repeat0Plus, set } from '../module.f.mjs'
import { deterministic } from '../testlib.f.ts'
import { toData } from '../data/module.f.mjs'
import type { RuleSet } from '../data/types.ts'
import { dispatchMap, parser, parserRuleSet } from './module.f.mjs'
import type { MatchResult } from './types.ts'
import { assertEq } from '../../asserts/module.f.mjs'

import { deterministic } from '../testlib.f.ts'

export const proof = {
dispatch: [
() => {
Expand Down
6 changes: 3 additions & 3 deletions fjs/bnf/module.f.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
* See `./types.ts` for the type-level API.
*
* @module
*
* @import { Tuple } from '../types/array/types.ts'
* @import { TerminalRange, Sequence, Rule, RangeVariant, None, Option, Repeat0Plus, Repeat1Plus, Join1Plus, Repeat } from './types.ts'
*/

/** @import { Tuple } from '../types/array/types.ts' */

import { codePointListToString, stringToCodePointList } from '../text/utf16/module.f.mjs'
import { definedValues } from '../types/object/module.f.mjs'
import { isTuple } from '../types/array/module.f.mjs'
import { map, toArray, repeat as listRepeat } from '../types/list/module.f.mjs'
import { contains } from '../types/range/module.f.mjs'
import { assert } from '../asserts/module.f.mjs'
/** @import { TerminalRange, Sequence, Variant, DataRule, LazyRule, Rule, RangeVariant, None, Option, Repeat0Plus, Repeat1Plus, Join1Plus, Join0Plus, Repeat } from './types.ts' */

// Internals:

Expand Down
6 changes: 4 additions & 2 deletions fjs/bnf/proof.f.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Rule } from './types.ts'

import { assert, assertEq } from '../asserts/module.f.mjs'
import { classic, deterministic } from './testlib.f.ts'
import {
rangeEncode,
str,
Expand All @@ -10,7 +11,8 @@ import {
oneEncode,
repeat1Plus,
} from './module.f.mjs'
import type { Rule } from './types.ts'

import { classic, deterministic } from './testlib.f.ts'

export const proof = {
test: () => {
Expand Down
3 changes: 2 additions & 1 deletion fjs/bnf/testlib.f.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { Rule } from './types.ts'

import {
commaJoin0Plus,
none,
Expand All @@ -9,7 +11,6 @@ import {
set,
unicodeMax,
} from './module.f.mjs'
import type { Rule } from './types.ts'

export const classic = (): Rule => {

Expand Down
4 changes: 3 additions & 1 deletion fjs/bnf/token_symbol/module.f.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
* See `./types.ts` for the `Encoding<T>` type-level API.
*
* @module
*
* @import { Encoding } from './types.ts'
*/

import { assert } from '../../asserts/module.f.mjs'
import { fromUndefined } from '../../types/nullable/module.f.mjs'
import { eof, rangeDecode, unicodeRange } from '../module.f.mjs'
/** @import { Encoding } from './types.ts' */

const [, unicodeLast] = rangeDecode(unicodeRange)

Expand Down
1 change: 1 addition & 0 deletions fjs/bnf/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*
* @module
*/

import type { StringMap } from '../types/object/types.ts'

/**
Expand Down
9 changes: 5 additions & 4 deletions fjs/cas/cli/module.f.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@
* CAS CLI command handlers.
*
* @module
*
* @import { All, Read, Write, WriteFile } from '../../effects/node/types.ts'
* @import { Commands } from '../../cli/types.ts'
* @import { MemOp } from '../../effects/memory/types.ts'
* @import { FileCasOperation } from '../types.ts'
*/

import { sha256 } from '../../crypto/sha2/module.f.mjs'
import { cBase32ToVec, vecToCBase32 } from '../../basen/cbase32/module.f.mjs'
import { forEachStep, pure, step } from '../../effects/module.f.mjs'
import { errorExit, log, writeFromStream } from '../../effects/node/module.f.mjs'
/** @import { All, Read, Write, WriteFile } from '../../effects/node/types.ts' */
import { dispatch } from '../../cli/module.f.mjs'
/** @import { Commands } from '../../cli/types.ts' */
/** @import { MemOp } from '../../effects/memory/types.ts' */
import { casAddFile, fileCas } from '../module.f.mjs'
/** @import { FileCasOperation } from '../types.ts' */

/** @type {Commands<FileCasOperation | WriteFile | Write | All | MemOp | Read>} */
export const commands = [
Expand Down
3 changes: 2 additions & 1 deletion fjs/cas/cli/proof.f.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/** @import { NodeProgramOptions } from '../../effects/node/types.ts' */

import { commands } from './module.f.mjs'
import { computeSync, sha256 } from '../../crypto/sha2/module.f.mjs'
import { maxLength, vec, vec8 } from '../../types/bit_vec/module.f.mjs'
import { defaultNodeProgramOptions, emptyState, virtual } from '../../effects/node/virtual/module.f.mjs'
/** @import { NodeProgramOptions } from '../../effects/node/types.ts' */
import { dispatch } from '../../cli/module.f.mjs'
import { vecToCBase32 } from '../../basen/cbase32/module.f.mjs'
import { assert, assertEq } from '../../asserts/module.f.mjs'
Expand Down
Loading
Loading