diff --git a/build-tools/package.json b/build-tools/package.json index 3ae25010e2e2..cd8ee1f493d8 100644 --- a/build-tools/package.json +++ b/build-tools/package.json @@ -69,9 +69,9 @@ "@commitlint/cli": "^17.6.6", "@commitlint/config-conventional": "^17.6.6", "@commitlint/cz-commitlint": "^17.5.0", - "@fluid-tools/build-cli": "~0.29.0", + "@fluid-tools/build-cli": "~0.38.0", "@fluidframework/build-common": "^2.0.3", - "@fluidframework/build-tools": "~0.29.0", + "@fluidframework/build-tools": "~0.38.0", "@microsoft/api-documenter": "^7.22.24", "@microsoft/api-extractor": "^7.43.1", "c8": "^7.14.0", @@ -91,7 +91,7 @@ }, "packageManager": "pnpm@8.15.8+sha512.d1a029e1a447ad90bc96cd58b0fad486d2993d531856396f7babf2d83eb1823bb83c5a3d0fc18f675b2d10321d49eb161fece36fe8134aa5823ecd215feed392", "engines": { - "node": ">=14.17.0" + "node": ">=18.17.1" }, "dependenciesComments": { "@fluidframework/build-tools": "Provides fluid-build which is used by the `build:fast` script. To allow this to work when the workspace version of build-tools has not been built yet, a prepackaged version is depended on. If this self-dependency becomes problematic, the `build` script can be used which does not require it." @@ -113,6 +113,9 @@ "qs": "^6.11.0", "sharp": "^0.33.2" }, + "patchedDependencies": { + "jssm@5.98.2": "patches/jssm@5.98.2.patch" + }, "updateConfig": { "ignoreDependencies": [ "latest-version", diff --git a/build-tools/packages/build-cli/.eslintrc.cjs b/build-tools/packages/build-cli/.eslintrc.cjs index a841c3c49882..b154bc3f8d5e 100644 --- a/build-tools/packages/build-cli/.eslintrc.cjs +++ b/build-tools/packages/build-cli/.eslintrc.cjs @@ -22,12 +22,26 @@ module.exports = { // oclif uses default exports for commands "import/no-default-export": "off", - // This package uses interfaces and types that are not exposed directly by npm-check-updates. - // We also call commands' run method directly in some cases, so these are all excluded. "import/no-internal-modules": [ "error", { - allow: ["npm-check-updates/build/src/types/**", "**/commands/**"], + allow: [ + // fs-extra's ./esm export is needed for ESM support. + "fs-extra/esm", + + // This package uses interfaces and types that are not exposed directly by npm-check-updates. + "npm-check-updates/build/src/types/**", + + // We call oclif commands' run method directly in some cases, so these are all excluded. + "**/commands/**", + + // These are all excluded because they're "submodules" used for organization. + // AB#8118 tracks removing the barrel files and importing directly from the submodules. + "**/library/index.js", + "**/handlers/index.js", + "**/machines/index.js", + "**/repoPolicyCheck/index.js", + ], }, ], @@ -50,9 +64,6 @@ module.exports = { // In commands, destructuring is useful in some places but makes others less legible, so consistency isn't preferred. "unicorn/consistent-destructuring": "off", - // This package is currently CJS-only. - "unicorn/prefer-module": "off", - // Deprecated in 2018: https://eslint.org/blog/2018/11/jsdoc-end-of-life/ "valid-jsdoc": "off", diff --git a/build-tools/packages/build-cli/.mocharc.json b/build-tools/packages/build-cli/.mocharc.json index 5e9671fd78c2..db957bf4f674 100644 --- a/build-tools/packages/build-cli/.mocharc.json +++ b/build-tools/packages/build-cli/.mocharc.json @@ -1,7 +1,8 @@ { "require": ["ts-node/register"], - "watch-extensions": ["ts"], + "watch-extensions": ["ts", "cts", "mts"], "recursive": true, "reporter": "spec", - "timeout": 60000 + "timeout": 60000, + "node-option": ["loader=ts-node/esm"] } diff --git a/build-tools/packages/build-cli/bin/dev.js b/build-tools/packages/build-cli/bin/dev.js index fdef63f3c94e..e99fc8600c93 100755 --- a/build-tools/packages/build-cli/bin/dev.js +++ b/build-tools/packages/build-cli/bin/dev.js @@ -1,11 +1,9 @@ -#!/usr/bin/env ts-node +#!/usr/bin/env -S node --loader ts-node/esm --no-warnings=ExperimentalWarning /*! * Copyright (c) Microsoft Corporation and contributors. All rights reserved. * Licensed under the MIT License. */ -// eslint-disable-next-line node/shebang, unicorn/prefer-top-level-await -(async () => { - const oclif = await import("@oclif/core"); - await oclif.execute({ development: true, dir: __dirname }); -})(); +import { execute } from "@oclif/core"; + +await execute({ development: true, dir: import.meta.url }); diff --git a/build-tools/packages/build-cli/bin/flub b/build-tools/packages/build-cli/bin/flub deleted file mode 100755 index a7635de86ed1..000000000000 --- a/build-tools/packages/build-cli/bin/flub +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env node - -const oclif = require('@oclif/core') - -oclif.run().then(require('@oclif/core/flush')).catch(require('@oclif/core/handle')) diff --git a/build-tools/packages/build-cli/bin/run.js b/build-tools/packages/build-cli/bin/run.js index ce6b8bf94702..040698684305 100755 --- a/build-tools/packages/build-cli/bin/run.js +++ b/build-tools/packages/build-cli/bin/run.js @@ -4,8 +4,6 @@ * Licensed under the MIT License. */ -// eslint-disable-next-line unicorn/prefer-top-level-await -(async () => { - const oclif = await import("@oclif/core"); - await oclif.execute({ development: false, dir: __dirname }); -})(); +import { execute } from "@oclif/core"; + +await execute({ dir: import.meta.url }); diff --git a/build-tools/packages/build-cli/package.json b/build-tools/packages/build-cli/package.json index 469ccd54be4c..d59b7e4295fc 100644 --- a/build-tools/packages/build-cli/package.json +++ b/build-tools/packages/build-cli/package.json @@ -11,7 +11,7 @@ "license": "MIT", "author": "Microsoft and contributors", "sideEffects": false, - "type": "commonjs", + "type": "module", "exports": { ".": { "default": { @@ -76,22 +76,22 @@ "@octokit/core": "^4.2.4", "@rushstack/node-core-library": "^3.59.5", "async": "^3.2.4", - "chalk": "^2.4.2", + "chalk": "^5.3.0", "change-case": "^3.1.0", "danger": "^11.3.0", "date-fns": "^2.30.0", "debug": "^4.3.4", "execa": "^5.1.1", - "fs-extra": "^9.1.0", + "fs-extra": "^11.2.0", "globby": "^11.1.0", "gray-matter": "^4.0.3", "human-id": "^4.0.0", "inquirer": "^8.2.5", "json5": "^2.2.3", - "jssm": "^5.89.2", + "jssm": "5.98.2", "latest-version": "^5.1.0", "minimatch": "^7.4.6", - "node-fetch": "^2.6.9", + "node-fetch": "^3.3.2", "npm-check-updates": "^16.14.20", "oclif": "^4.10.1", "prettier": "~3.2.4", @@ -112,13 +112,13 @@ "devDependencies": { "@fluid-private/readme-command": "workspace:~", "@fluidframework/build-common": "^2.0.3", - "@fluidframework/eslint-config-fluid": "^5.2.0", + "@fluidframework/eslint-config-fluid": "^5.3.0", "@oclif/test": "^3.2.12", "@types/async": "^3.2.20", "@types/chai": "^4.3.5", "@types/chai-arrays": "^2.0.0", "@types/debug": "^4.1.7", - "@types/fs-extra": "^8.1.2", + "@types/fs-extra": "^11.0.4", "@types/inquirer": "^8.2.6", "@types/mocha": "^9.1.1", "@types/node": "^18.18.6", @@ -137,7 +137,7 @@ "eslint-config-oclif": "^5.2.0", "eslint-config-oclif-typescript": "^3.1.7", "eslint-config-prettier": "~9.1.0", - "jssm-viz-cli": "^5.89.2", + "jssm-viz-cli": "5.97.1", "mocha": "^10.2.0", "mocha-json-output-reporter": "^2.1.0", "mocha-multi-reporters": "^1.5.1", @@ -148,7 +148,7 @@ "typescript": "~5.1.6" }, "engines": { - "node": ">=14.17.0" + "node": ">=18.17.1" }, "fluidBuild": { "tasks": { diff --git a/build-tools/packages/build-cli/packlist.txt b/build-tools/packages/build-cli/packlist.txt index 82aa589ea030..747b7d01409e 100644 --- a/build-tools/packages/build-cli/packlist.txt +++ b/build-tools/packages/build-cli/packlist.txt @@ -4,7 +4,6 @@ oclif.manifest.json package.json bin/dev.cmd bin/dev.js -bin/flub bin/run.cmd bin/run.js lib/BasePackageCommand.d.ts @@ -15,10 +14,6 @@ lib/args.d.ts lib/args.d.ts.map lib/args.js lib/args.js.map -lib/base.d.ts -lib/base.d.ts.map -lib/base.js -lib/base.js.map lib/commands/bump.d.ts lib/commands/bump.d.ts.map lib/commands/bump.js @@ -75,6 +70,10 @@ lib/commands/generate/packlist.d.ts lib/commands/generate/packlist.d.ts.map lib/commands/generate/packlist.js lib/commands/generate/packlist.js.map +lib/commands/generate/typetests.d.ts +lib/commands/generate/typetests.d.ts.map +lib/commands/generate/typetests.js +lib/commands/generate/typetests.js.map lib/commands/generate/upcoming.d.ts lib/commands/generate/upcoming.d.ts.map lib/commands/generate/upcoming.js @@ -99,6 +98,10 @@ lib/commands/modify/fluid-imports.d.ts lib/commands/modify/fluid-imports.d.ts.map lib/commands/modify/fluid-imports.js lib/commands/modify/fluid-imports.js.map +lib/commands/modify/lockfile.d.ts +lib/commands/modify/lockfile.d.ts.map +lib/commands/modify/lockfile.js +lib/commands/modify/lockfile.js.map lib/commands/release.d.ts lib/commands/release.d.ts.map lib/commands/release.js @@ -211,14 +214,30 @@ lib/library/collections.d.ts lib/library/collections.d.ts.map lib/library/collections.js lib/library/collections.js.map +lib/library/commands/base.d.ts +lib/library/commands/base.d.ts.map +lib/library/commands/base.js +lib/library/commands/base.js.map +lib/library/commands/constants.d.ts +lib/library/commands/constants.d.ts.map +lib/library/commands/constants.js +lib/library/commands/constants.js.map +lib/library/commands/generateEntrypoints.d.ts +lib/library/commands/generateEntrypoints.d.ts.map +lib/library/commands/generateEntrypoints.js +lib/library/commands/generateEntrypoints.js.map +lib/library/commands/index.d.ts +lib/library/commands/index.d.ts.map +lib/library/commands/index.js +lib/library/commands/index.js.map lib/library/context.d.ts lib/library/context.d.ts.map lib/library/context.js lib/library/context.js.map -lib/library/dangerfile.d.ts -lib/library/dangerfile.d.ts.map -lib/library/dangerfile.js -lib/library/dangerfile.js.map +lib/library/dangerfile.cjs +lib/library/dangerfile.cjs.map +lib/library/dangerfile.d.cts +lib/library/dangerfile.d.cts.map lib/library/dates.d.ts lib/library/dates.d.ts.map lib/library/dates.js @@ -243,6 +262,10 @@ lib/library/package.d.ts lib/library/package.d.ts.map lib/library/package.js lib/library/package.js.map +lib/library/packageExports.d.ts +lib/library/packageExports.d.ts.map +lib/library/packageExports.js +lib/library/packageExports.js.map lib/library/release.d.ts lib/library/release.d.ts.map lib/library/release.js @@ -263,6 +286,10 @@ lib/library/repoPolicyCheck/dockerfilePackages.d.ts lib/library/repoPolicyCheck/dockerfilePackages.d.ts.map lib/library/repoPolicyCheck/dockerfilePackages.js lib/library/repoPolicyCheck/dockerfilePackages.js.map +lib/library/repoPolicyCheck/fluidBuildDatabase.d.ts +lib/library/repoPolicyCheck/fluidBuildDatabase.d.ts.map +lib/library/repoPolicyCheck/fluidBuildDatabase.js +lib/library/repoPolicyCheck/fluidBuildDatabase.js.map lib/library/repoPolicyCheck/fluidBuildTasks.d.ts lib/library/repoPolicyCheck/fluidBuildTasks.d.ts.map lib/library/repoPolicyCheck/fluidBuildTasks.js diff --git a/build-tools/packages/build-cli/src/BasePackageCommand.ts b/build-tools/packages/build-cli/src/BasePackageCommand.ts index 20266cd70cd4..c8a5e32313c6 100644 --- a/build-tools/packages/build-cli/src/BasePackageCommand.ts +++ b/build-tools/packages/build-cli/src/BasePackageCommand.ts @@ -15,9 +15,9 @@ import { parsePackageFilterFlags, parsePackageSelectionFlags, selectAndFilterPackages, -} from "./filter"; -import { type PackageSelectionDefault, filterFlags, selectionFlags } from "./flags"; -import { BaseCommand } from "./library"; +} from "./filter.js"; +import { type PackageSelectionDefault, filterFlags, selectionFlags } from "./flags.js"; +import { BaseCommand } from "./library/index.js"; /** * Commands that run operations per project. diff --git a/build-tools/packages/build-cli/src/args.ts b/build-tools/packages/build-cli/src/args.ts index 97d3792a0407..6d7807c37eb6 100644 --- a/build-tools/packages/build-cli/src/args.ts +++ b/build-tools/packages/build-cli/src/args.ts @@ -6,7 +6,7 @@ import { MonoRepo, Package } from "@fluidframework/build-tools"; import { Args } from "@oclif/core"; // eslint-disable-next-line import/no-deprecated -import { Context, isMonoRepoKind } from "./library"; +import { Context, isMonoRepoKind } from "./library/index.js"; /** * A re-usable CLI argument for package or release group names. diff --git a/build-tools/packages/build-cli/src/commands/bump.ts b/build-tools/packages/build-cli/src/commands/bump.ts index 7ea48519f40e..19efa09b56f2 100644 --- a/build-tools/packages/build-cli/src/commands/bump.ts +++ b/build-tools/packages/build-cli/src/commands/bump.ts @@ -23,14 +23,14 @@ import { isInterdependencyRange, } from "@fluid-tools/version-tools"; -import { findPackageOrReleaseGroup, packageOrReleaseGroupArg } from "../args"; -import { bumpTypeFlag, checkFlags, skipCheckFlag, versionSchemeFlag } from "../flags"; +import { findPackageOrReleaseGroup, packageOrReleaseGroupArg } from "../args.js"; +import { bumpTypeFlag, checkFlags, skipCheckFlag, versionSchemeFlag } from "../flags.js"; import { BaseCommand, generateBumpVersionBranchName, generateBumpVersionCommitMessage, setVersion, -} from "../library"; +} from "../library/index.js"; export default class BumpCommand extends BaseCommand { static readonly summary = diff --git a/build-tools/packages/build-cli/src/commands/bump/deps.ts b/build-tools/packages/build-cli/src/commands/bump/deps.ts index 46443a5d8812..9dbcd4468ebc 100644 --- a/build-tools/packages/build-cli/src/commands/bump/deps.ts +++ b/build-tools/packages/build-cli/src/commands/bump/deps.ts @@ -10,7 +10,7 @@ import stripAnsi from "strip-ansi"; import { FluidRepo, MonoRepo } from "@fluidframework/build-tools"; -import { findPackageOrReleaseGroup, packageOrReleaseGroupArg } from "../../args"; +import { findPackageOrReleaseGroup, packageOrReleaseGroupArg } from "../../args.js"; import { checkFlags, dependencyUpdateTypeFlag, @@ -18,7 +18,7 @@ import { releaseGroupFlag, skipCheckFlag, testModeFlag, -} from "../../flags"; +} from "../../flags.js"; import { BaseCommand, // eslint-disable-next-line import/no-deprecated @@ -28,10 +28,10 @@ import { indentString, isDependencyUpdateType, npmCheckUpdates, -} from "../../library"; +} from "../../library/index.js"; // eslint-disable-next-line import/no-internal-modules -import { npmCheckUpdatesHomegrown } from "../../library/package"; -import { ReleaseGroup } from "../../releaseGroups"; +import { npmCheckUpdatesHomegrown } from "../../library/package.js"; +import { ReleaseGroup } from "../../releaseGroups.js"; /** * Update the dependency version of a specified package or release group. That is, if one or more packages in the repo diff --git a/build-tools/packages/build-cli/src/commands/check/buildVersion.ts b/build-tools/packages/build-cli/src/commands/check/buildVersion.ts index 3e10bc127525..bdb7dda7f732 100644 --- a/build-tools/packages/build-cli/src/commands/check/buildVersion.ts +++ b/build-tools/packages/build-cli/src/commands/check/buildVersion.ts @@ -7,7 +7,7 @@ import path from "node:path"; import { Package } from "@fluidframework/build-tools"; import { Flags } from "@oclif/core"; -import { PackageCommand } from "../../BasePackageCommand"; +import { PackageCommand } from "../../BasePackageCommand.js"; export default class CheckBuildVersionCommand extends PackageCommand< typeof CheckBuildVersionCommand diff --git a/build-tools/packages/build-cli/src/commands/check/changeset.ts b/build-tools/packages/build-cli/src/commands/check/changeset.ts index 91e3d5c15a73..805ff3a653c7 100644 --- a/build-tools/packages/build-cli/src/commands/check/changeset.ts +++ b/build-tools/packages/build-cli/src/commands/check/changeset.ts @@ -7,7 +7,7 @@ import { Flags } from "@oclif/core"; import chalk from "chalk"; import { sortPackageJson as sortJson } from "sort-package-json"; -import { BaseCommand, Repository } from "../../library"; +import { BaseCommand, Repository } from "../../library/index.js"; export default class CheckChangesetCommand extends BaseCommand { static readonly summary = diff --git a/build-tools/packages/build-cli/src/commands/check/layers.ts b/build-tools/packages/build-cli/src/commands/check/layers.ts index ae3591463614..de75675b948a 100644 --- a/build-tools/packages/build-cli/src/commands/check/layers.ts +++ b/build-tools/packages/build-cli/src/commands/check/layers.ts @@ -9,7 +9,7 @@ import path from "node:path"; import { Timer } from "@fluidframework/build-tools"; import { Flags } from "@oclif/core"; -import { BaseCommand, LayerGraph } from "../../library"; +import { BaseCommand, LayerGraph } from "../../library/index.js"; const packagesMdFileName = "PACKAGES.md"; diff --git a/build-tools/packages/build-cli/src/commands/check/policy.ts b/build-tools/packages/build-cli/src/commands/check/policy.ts index 2a018a4ee0bc..34027d3ac175 100644 --- a/build-tools/packages/build-cli/src/commands/check/policy.ts +++ b/build-tools/packages/build-cli/src/commands/check/policy.ts @@ -7,11 +7,17 @@ import * as fs from "node:fs"; import { EOL as newline } from "node:os"; import * as path from "node:path"; import { Flags } from "@oclif/core"; -import { readJson } from "fs-extra"; +import { readJson } from "fs-extra/esm"; import { loadFluidBuildConfig } from "@fluidframework/build-tools"; -import { BaseCommand, Context, Handler, Repository, policyHandlers } from "../../library"; +import { + BaseCommand, + Context, + Handler, + Repository, + policyHandlers, +} from "../../library/index.js"; type policyAction = "handle" | "resolve" | "final"; diff --git a/build-tools/packages/build-cli/src/commands/exec.ts b/build-tools/packages/build-cli/src/commands/exec.ts index af910e38c13a..f0ccf14059d0 100644 --- a/build-tools/packages/build-cli/src/commands/exec.ts +++ b/build-tools/packages/build-cli/src/commands/exec.ts @@ -7,8 +7,8 @@ import { Package } from "@fluidframework/build-tools"; import { Args } from "@oclif/core"; import execa from "execa"; -import { PackageCommand } from "../BasePackageCommand"; -import type { PackageSelectionDefault } from "../flags"; +import { PackageCommand } from "../BasePackageCommand.js"; +import type { PackageSelectionDefault } from "../flags.js"; export default class ExecCommand extends PackageCommand { static readonly description = diff --git a/build-tools/packages/build-cli/src/commands/generate/assertTags.ts b/build-tools/packages/build-cli/src/commands/generate/assertTags.ts index 8ef0860ec4c5..e9eb8b27c4f3 100644 --- a/build-tools/packages/build-cli/src/commands/generate/assertTags.ts +++ b/build-tools/packages/build-cli/src/commands/generate/assertTags.ts @@ -7,8 +7,8 @@ import { strict as assert } from "node:assert"; import fs from "node:fs"; import path from "node:path"; import { Package, loadFluidBuildConfig } from "@fluidframework/build-tools"; -import { PackageCommand } from "../../BasePackageCommand"; -import { PackageKind } from "../../filter"; +import { PackageCommand } from "../../BasePackageCommand.js"; +import { PackageKind } from "../../filter.js"; import { Flags } from "@oclif/core"; import { diff --git a/build-tools/packages/build-cli/src/commands/generate/buildVersion.ts b/build-tools/packages/build-cli/src/commands/generate/buildVersion.ts index 454baeac4156..a69bce5080ea 100644 --- a/build-tools/packages/build-cli/src/commands/generate/buildVersion.ts +++ b/build-tools/packages/build-cli/src/commands/generate/buildVersion.ts @@ -9,7 +9,7 @@ import { Flags } from "@oclif/core"; import { getIsLatest, getSimpleVersion } from "@fluid-tools/version-tools"; -import { BaseCommand } from "../../library"; +import { BaseCommand } from "../../library/index.js"; /** * This command class is used to compute the version number of Fluid packages. The release version number is based on diff --git a/build-tools/packages/build-cli/src/commands/generate/bundleStats.ts b/build-tools/packages/build-cli/src/commands/generate/bundleStats.ts index 130817a0b152..7e120d272426 100644 --- a/build-tools/packages/build-cli/src/commands/generate/bundleStats.ts +++ b/build-tools/packages/build-cli/src/commands/generate/bundleStats.ts @@ -3,12 +3,13 @@ * Licensed under the MIT License. */ +import { existsSync } from "node:fs"; import path from "node:path"; import { Flags } from "@oclif/core"; -import { copySync, existsSync, readJson } from "fs-extra"; +import { copySync, readJson } from "fs-extra/esm"; -import { BaseCommand } from "../../library"; -import { PnpmListEntry, pnpmList } from "../../pnpm"; +import { BaseCommand } from "../../library/index.js"; +import { PnpmListEntry, pnpmList } from "../../pnpm.js"; export default class GenerateBundlestats extends BaseCommand { static readonly description = @@ -79,9 +80,7 @@ export default class GenerateBundlestats extends BaseCommand { const content = await readFile(path, "utf8"); diff --git a/build-tools/packages/build-cli/src/commands/generate/changeset.ts b/build-tools/packages/build-cli/src/commands/generate/changeset.ts index 21e9bff6d093..3fe01123ae2a 100644 --- a/build-tools/packages/build-cli/src/commands/generate/changeset.ts +++ b/build-tools/packages/build-cli/src/commands/generate/changeset.ts @@ -9,12 +9,12 @@ import { VersionBumpType } from "@fluid-tools/version-tools"; import { Package } from "@fluidframework/build-tools"; import { Flags } from "@oclif/core"; import chalk from "chalk"; -import humanId from "human-id"; +import { humanId } from "human-id"; import { format as prettier } from "prettier"; import prompts from "prompts"; -import { releaseGroupFlag } from "../../flags"; -import { BaseCommand, Repository, getDefaultBumpTypeForBranch } from "../../library"; +import { releaseGroupFlag } from "../../flags.js"; +import { BaseCommand, Repository, getDefaultBumpTypeForBranch } from "../../library/index.js"; /** * If more than this number of packages are changed relative to the selected branch, the user will be prompted to select diff --git a/build-tools/packages/build-cli/src/commands/generate/entrypoints.ts b/build-tools/packages/build-cli/src/commands/generate/entrypoints.ts index 7af864c75179..5b155f249018 100644 --- a/build-tools/packages/build-cli/src/commands/generate/entrypoints.ts +++ b/build-tools/packages/build-cli/src/commands/generate/entrypoints.ts @@ -3,6 +3,6 @@ * Licensed under the MIT License. */ -import { GenerateEntrypointsCommand } from "../../library"; +import { GenerateEntrypointsCommand } from "../../library/index.js"; export default class GenerateEntrypointsCommand_ extends GenerateEntrypointsCommand {} diff --git a/build-tools/packages/build-cli/src/commands/generate/packlist.ts b/build-tools/packages/build-cli/src/commands/generate/packlist.ts index 0f3a7141627f..93e2a93a0821 100644 --- a/build-tools/packages/build-cli/src/commands/generate/packlist.ts +++ b/build-tools/packages/build-cli/src/commands/generate/packlist.ts @@ -3,12 +3,12 @@ * Licensed under the MIT License. */ +import { writeFile } from "node:fs/promises"; import path from "node:path"; import type { Package } from "@fluidframework/build-tools"; import { Flags } from "@oclif/core"; import execa from "execa"; -import { writeFile } from "fs-extra"; -import { PackageCommand } from "../../BasePackageCommand"; +import { PackageCommand } from "../../BasePackageCommand.js"; /** * JSON results from running npm pack --json. diff --git a/build-tools/packages/build-cli/src/commands/generate/typetests.ts b/build-tools/packages/build-cli/src/commands/generate/typetests.ts index 1a3f94a90670..0307f4592a10 100644 --- a/build-tools/packages/build-cli/src/commands/generate/typetests.ts +++ b/build-tools/packages/build-cli/src/commands/generate/typetests.ts @@ -3,6 +3,7 @@ * Licensed under the MIT License. */ +import { mkdirSync, rmSync, writeFileSync } from "node:fs"; import path from "node:path"; import { type BrokenCompatTypes, @@ -20,17 +21,17 @@ import { import { Flags } from "@oclif/core"; import { PackageName } from "@rushstack/node-core-library"; import * as changeCase from "change-case"; -import { mkdirSync, readJson, rmSync, writeFileSync } from "fs-extra"; +import { readJson } from "fs-extra/esm"; import * as resolve from "resolve.exports"; import { ModuleKind, Project, type SourceFile } from "ts-morph"; -import { PackageCommand } from "../../BasePackageCommand"; -import type { PackageSelectionDefault } from "../../flags"; +import { PackageCommand } from "../../BasePackageCommand.js"; +import type { PackageSelectionDefault } from "../../flags.js"; import { ApiLevel, ensureDevDependencyExists, knownApiLevels, unscopedPackageNameString, -} from "../../library"; +} from "../../library/index.js"; export default class GenerateTypetestsCommand extends PackageCommand< typeof GenerateTypetestsCommand diff --git a/build-tools/packages/build-cli/src/commands/generate/upcoming.ts b/build-tools/packages/build-cli/src/commands/generate/upcoming.ts index a0961ddd386a..161c273573af 100644 --- a/build-tools/packages/build-cli/src/commands/generate/upcoming.ts +++ b/build-tools/packages/build-cli/src/commands/generate/upcoming.ts @@ -9,8 +9,8 @@ import path from "node:path"; import { Flags } from "@oclif/core"; import { format as prettier } from "prettier"; -import { releaseGroupFlag } from "../../flags"; -import { BaseCommand, DEFAULT_CHANGESET_PATH, loadChangesets } from "../../library"; +import { releaseGroupFlag } from "../../flags.js"; +import { BaseCommand, DEFAULT_CHANGESET_PATH, loadChangesets } from "../../library/index.js"; const DEFAULT_FILE = "UPCOMING.md"; diff --git a/build-tools/packages/build-cli/src/commands/info.ts b/build-tools/packages/build-cli/src/commands/info.ts index 79afa58e6775..4e9a63427785 100644 --- a/build-tools/packages/build-cli/src/commands/info.ts +++ b/build-tools/packages/build-cli/src/commands/info.ts @@ -8,9 +8,9 @@ import { type ColumnUserConfig, table } from "table"; import type { Package } from "@fluidframework/build-tools"; import * as changeCase from "change-case"; -import { releaseGroupFlag } from "../flags"; +import { releaseGroupFlag } from "../flags.js"; // eslint-disable-next-line import/no-deprecated -import { BaseCommand, isMonoRepoKind } from "../library"; +import { BaseCommand, isMonoRepoKind } from "../library/index.js"; /** * Each displayed column in the report is generated by a corresponding diff --git a/build-tools/packages/build-cli/src/commands/list.ts b/build-tools/packages/build-cli/src/commands/list.ts index 2d4aceb60db5..a6306f66a6cb 100644 --- a/build-tools/packages/build-cli/src/commands/list.ts +++ b/build-tools/packages/build-cli/src/commands/list.ts @@ -3,22 +3,23 @@ * Licensed under the MIT License. */ +import { writeFileSync } from "node:fs"; import path from "node:path"; import { MonoRepo, Package, PackageNamePolicyConfig } from "@fluidframework/build-tools"; import { Flags } from "@oclif/core"; -import { mkdirpSync, writeFileSync } from "fs-extra"; -import { findPackageOrReleaseGroup, packageOrReleaseGroupArg } from "../args"; -import { filterPackages, parsePackageFilterFlags } from "../filter"; -import { filterFlags, releaseGroupFlag } from "../flags"; -import { BaseCommand, getTarballName } from "../library"; +import { mkdirpSync } from "fs-extra"; +import { findPackageOrReleaseGroup, packageOrReleaseGroupArg } from "../args.js"; +import { filterPackages, parsePackageFilterFlags } from "../filter.js"; +import { filterFlags, releaseGroupFlag } from "../flags.js"; +import { BaseCommand, getTarballName } from "../library/index.js"; import { type Feed, feeds, isFeed, packagePublishesToFeed, // eslint-disable-next-line import/no-internal-modules -- the policy-related stuff will eventually be moved into this package -} from "../library/repoPolicyCheck/npmPackages"; -import { PnpmListEntry, pnpmList } from "../pnpm"; +} from "../library/repoPolicyCheck/npmPackages.js"; +import { PnpmListEntry, pnpmList } from "../pnpm.js"; interface ListItem extends PnpmListEntry { tarball?: string; diff --git a/build-tools/packages/build-cli/src/commands/merge/branches.ts b/build-tools/packages/build-cli/src/commands/merge/branches.ts index 1ca3b35b1446..f3cf18b44684 100644 --- a/build-tools/packages/build-cli/src/commands/merge/branches.ts +++ b/build-tools/packages/build-cli/src/commands/merge/branches.ts @@ -14,7 +14,7 @@ import { createPullRequest, getCommitInfo, pullRequestExists, -} from "../../library"; +} from "../../library/index.js"; interface CleanupBranch { branch: string; diff --git a/build-tools/packages/build-cli/src/commands/merge/info.ts b/build-tools/packages/build-cli/src/commands/merge/info.ts index 3bf64f6535bb..2f19b1ea8017 100644 --- a/build-tools/packages/build-cli/src/commands/merge/info.ts +++ b/build-tools/packages/build-cli/src/commands/merge/info.ts @@ -6,7 +6,7 @@ import { Flags } from "@oclif/core"; import chalk from "chalk"; -import { BaseCommand, Repository } from "../../library"; +import { BaseCommand, Repository } from "../../library/index.js"; /** * An object containing merge status between two branches. diff --git a/build-tools/packages/build-cli/src/commands/modify/fluid-imports.ts b/build-tools/packages/build-cli/src/commands/modify/fluid-imports.ts index 79abe9a1f319..4479532da0ab 100644 --- a/build-tools/packages/build-cli/src/commands/modify/fluid-imports.ts +++ b/build-tools/packages/build-cli/src/commands/modify/fluid-imports.ts @@ -5,8 +5,9 @@ /* eslint-disable unicorn/no-array-callback-reference */ +import { existsSync } from "node:fs"; +import { readFile } from "node:fs/promises"; import { Flags } from "@oclif/core"; -import { existsSync, readFile } from "fs-extra"; import * as JSON5 from "json5"; import { type ImportDeclaration, ModuleKind, Project, SourceFile } from "ts-morph"; import { @@ -15,8 +16,8 @@ import { getApiExports, isKnownApiLevel, knownApiLevels, -} from "../../library"; -import type { CommandLogger } from "../../logging"; +} from "../../library/index.js"; +import type { CommandLogger } from "../../logging.js"; const maxConcurrency = 4; diff --git a/build-tools/packages/build-cli/src/commands/modify/lockfile.ts b/build-tools/packages/build-cli/src/commands/modify/lockfile.ts index b41f28492eff..75f16fe219e0 100644 --- a/build-tools/packages/build-cli/src/commands/modify/lockfile.ts +++ b/build-tools/packages/build-cli/src/commands/modify/lockfile.ts @@ -7,8 +7,8 @@ import { updatePackageJsonFile } from "@fluidframework/build-tools"; import { Flags } from "@oclif/core"; import execa from "execa"; -import { releaseGroupFlag } from "../../flags"; -import { BaseCommand } from "../../library"; +import { releaseGroupFlag } from "../../flags.js"; +import { BaseCommand } from "../../library/index.js"; /** * Updates the version of a dependency in the lockfile. diff --git a/build-tools/packages/build-cli/src/commands/release.ts b/build-tools/packages/build-cli/src/commands/release.ts index c523f7d1f228..27b1a77bc372 100644 --- a/build-tools/packages/build-cli/src/commands/release.ts +++ b/build-tools/packages/build-cli/src/commands/release.ts @@ -8,25 +8,25 @@ import { VersionBumpType, detectVersionScheme } from "@fluid-tools/version-tools import { Config } from "@oclif/core"; import chalk from "chalk"; -import { findPackageOrReleaseGroup } from "../args"; +import { findPackageOrReleaseGroup } from "../args.js"; import { bumpTypeFlag, checkFlags, packageSelectorFlag, releaseGroupFlag, skipCheckFlag, -} from "../flags"; +} from "../flags.js"; import { FluidReleaseStateHandler, FluidReleaseStateHandlerData, StateHandler, -} from "../handlers"; -import { PromptWriter } from "../instructionalPromptWriter"; +} from "../handlers/index.js"; +import { PromptWriter } from "../instructionalPromptWriter.js"; // eslint-disable-next-line import/no-deprecated -import { MonoRepoKind } from "../library"; -import { FluidReleaseMachine } from "../machines"; -import { getRunPolicyCheckDefault } from "../repoConfig"; -import { StateMachineCommand } from "../stateMachineCommand"; +import { MonoRepoKind } from "../library/index.js"; +import { FluidReleaseMachine } from "../machines/index.js"; +import { getRunPolicyCheckDefault } from "../repoConfig.js"; +import { StateMachineCommand } from "../stateMachineCommand.js"; /** * Releases a package or release group. This command is mostly scaffolding and setting up the state machine, handlers, diff --git a/build-tools/packages/build-cli/src/commands/release/fromTag.ts b/build-tools/packages/build-cli/src/commands/release/fromTag.ts index 151815b40a83..8aa6d210c964 100644 --- a/build-tools/packages/build-cli/src/commands/release/fromTag.ts +++ b/build-tools/packages/build-cli/src/commands/release/fromTag.ts @@ -9,11 +9,11 @@ import { Args } from "@oclif/core"; import semver from "semver"; import { sortPackageJson as sortJson } from "sort-package-json"; -import { findPackageOrReleaseGroup } from "../../args"; +import { findPackageOrReleaseGroup } from "../../args.js"; // eslint-disable-next-line import/no-deprecated -import { MonoRepoKind, sortVersions } from "../../library"; -import { ReleaseGroup, ReleasePackage } from "../../releaseGroups"; -import { ReleaseReportBaseCommand, ReleaseSelectionMode } from "./report"; +import { MonoRepoKind, sortVersions } from "../../library/index.js"; +import { ReleaseGroup, ReleasePackage } from "../../releaseGroups.js"; +import { ReleaseReportBaseCommand, ReleaseSelectionMode } from "./report.js"; const tagRefPrefix = "refs/tags/"; diff --git a/build-tools/packages/build-cli/src/commands/release/history.ts b/build-tools/packages/build-cli/src/commands/release/history.ts index c3c8d7eb075a..15d9d80ff19f 100644 --- a/build-tools/packages/build-cli/src/commands/release/history.ts +++ b/build-tools/packages/build-cli/src/commands/release/history.ts @@ -13,14 +13,14 @@ import { getDisplayDate, getDisplayDateRelative, sortVersions, -} from "../../library"; +} from "../../library/index.js"; import { detectBumpType } from "@fluid-tools/version-tools"; -import { findPackageOrReleaseGroup } from "../../args"; -import { packageSelectorFlag, releaseGroupFlag } from "../../flags"; -import { ReleaseGroup, ReleasePackage } from "../../releaseGroups"; -import { ReleaseReportBaseCommand, ReleaseSelectionMode } from "./report"; +import { findPackageOrReleaseGroup } from "../../args.js"; +import { packageSelectorFlag, releaseGroupFlag } from "../../flags.js"; +import { ReleaseGroup, ReleasePackage } from "../../releaseGroups.js"; +import { ReleaseReportBaseCommand, ReleaseSelectionMode } from "./report.js"; const DEFAULT_MIN_VERSION = "0.0.0"; diff --git a/build-tools/packages/build-cli/src/commands/release/report-unreleased.ts b/build-tools/packages/build-cli/src/commands/release/report-unreleased.ts index 97e0eeb0ac27..c0b718000686 100644 --- a/build-tools/packages/build-cli/src/commands/release/report-unreleased.ts +++ b/build-tools/packages/build-cli/src/commands/release/report-unreleased.ts @@ -9,7 +9,7 @@ import { isInternalVersionRange, isInternalVersionScheme } from "@fluid-tools/ve import type { Logger } from "@fluidframework/build-tools"; import { Flags } from "@oclif/core"; import { formatISO } from "date-fns"; -import { BaseCommand, type ReleaseReport, toReportKind } from "../../library"; +import { BaseCommand, type ReleaseReport, toReportKind } from "../../library/index.js"; export class UnreleasedReportCommand extends BaseCommand { static readonly summary = diff --git a/build-tools/packages/build-cli/src/commands/release/report.ts b/build-tools/packages/build-cli/src/commands/release/report.ts index fabfb5294acb..1adf49e19f02 100644 --- a/build-tools/packages/build-cli/src/commands/release/report.ts +++ b/build-tools/packages/build-cli/src/commands/release/report.ts @@ -8,7 +8,7 @@ import path from "node:path"; import { Command, Flags, ux } from "@oclif/core"; import chalk from "chalk"; import { differenceInBusinessDays, formatDistanceToNow } from "date-fns"; -import { writeJson } from "fs-extra"; +import { writeJson } from "fs-extra/esm"; import inquirer from "inquirer"; import sortJson from "sort-json"; import { table } from "table"; @@ -27,7 +27,7 @@ import { getRanges, sortVersions, toReportKind, -} from "../../library"; +} from "../../library/index.js"; import { ReleaseVersion, @@ -38,9 +38,9 @@ import { isVersionBumpType, } from "@fluid-tools/version-tools"; -import { releaseGroupFlag } from "../../flags"; -import { CommandLogger } from "../../logging"; -import { ReleaseGroup, ReleasePackage, isReleaseGroup } from "../../releaseGroups"; +import { releaseGroupFlag } from "../../flags.js"; +import { CommandLogger } from "../../logging.js"; +import { ReleaseGroup, ReleasePackage, isReleaseGroup } from "../../releaseGroups.js"; /** * Controls behavior when there is a list of releases and one needs to be selected. diff --git a/build-tools/packages/build-cli/src/commands/release/setPackageTypesField.ts b/build-tools/packages/build-cli/src/commands/release/setPackageTypesField.ts index 28c25affdee3..3a196e50036a 100644 --- a/build-tools/packages/build-cli/src/commands/release/setPackageTypesField.ts +++ b/build-tools/packages/build-cli/src/commands/release/setPackageTypesField.ts @@ -8,9 +8,9 @@ import path from "node:path"; import { Package, PackageJson, updatePackageJsonFile } from "@fluidframework/build-tools"; import { ExtractorConfig } from "@microsoft/api-extractor"; import { Flags } from "@oclif/core"; -import { PackageCommand } from "../../BasePackageCommand"; -import type { PackageSelectionDefault } from "../../flags"; -import { CommandLogger } from "../../logging"; +import { PackageCommand } from "../../BasePackageCommand.js"; +import type { PackageSelectionDefault } from "../../flags.js"; +import { CommandLogger } from "../../logging.js"; /** * Represents a list of package categorized into two arrays diff --git a/build-tools/packages/build-cli/src/commands/rename-types.ts b/build-tools/packages/build-cli/src/commands/rename-types.ts index fe08c7fb8cb8..717b4edea7ba 100644 --- a/build-tools/packages/build-cli/src/commands/rename-types.ts +++ b/build-tools/packages/build-cli/src/commands/rename-types.ts @@ -5,7 +5,7 @@ import * as fs from "node:fs"; import * as path from "node:path"; -import { BaseCommand } from "../library"; +import { BaseCommand } from "../library/index.js"; function renameFilesInDir(dir: string, extension: string, newExtension: string): void { const files = fs.readdirSync(dir); diff --git a/build-tools/packages/build-cli/src/commands/run/bundleStats.ts b/build-tools/packages/build-cli/src/commands/run/bundleStats.ts index 31b0e23ba599..3fd07b7fdfd5 100644 --- a/build-tools/packages/build-cli/src/commands/run/bundleStats.ts +++ b/build-tools/packages/build-cli/src/commands/run/bundleStats.ts @@ -5,9 +5,12 @@ import { execSync } from "node:child_process"; import path from "node:path"; +import { fileURLToPath } from "node:url"; import { Flags } from "@oclif/core"; -import { BaseCommand } from "../../library"; +import { BaseCommand } from "../../library/index.js"; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); export default class RunBundlestats extends BaseCommand { static readonly description = @@ -23,8 +26,7 @@ export default class RunBundlestats extends BaseCommand { public async run(): Promise { const dangerfile = - // eslint-disable-next-line unicorn/prefer-module - this.flags.dangerfile ?? path.join(__dirname, "../../lib/dangerfile.js"); + this.flags.dangerfile ?? path.join(__dirname, "../../library/dangerfile.cjs"); // ADO:3710 This needs to change in order to remove the 'danger' dependency in the root package.json execSync(`npx danger ci -d ${dangerfile}`, { stdio: "inherit" }); diff --git a/build-tools/packages/build-cli/src/commands/test-only-filter.ts b/build-tools/packages/build-cli/src/commands/test-only-filter.ts index 58c1e58b645a..ce085f2dd59a 100644 --- a/build-tools/packages/build-cli/src/commands/test-only-filter.ts +++ b/build-tools/packages/build-cli/src/commands/test-only-filter.ts @@ -5,9 +5,9 @@ import { strict as assert } from "node:assert"; import { Package } from "@fluidframework/build-tools"; -import { PackageCommand } from "../BasePackageCommand"; -import { PackageWithKind } from "../filter"; -import type { PackageSelectionDefault } from "../flags"; +import { PackageCommand } from "../BasePackageCommand.js"; +import { PackageWithKind } from "../filter.js"; +import type { PackageSelectionDefault } from "../flags.js"; interface FilterCommandResult { selected: Pick[]; diff --git a/build-tools/packages/build-cli/src/commands/typetests.ts b/build-tools/packages/build-cli/src/commands/typetests.ts index 6e5b7d582fc6..558927e8e10f 100644 --- a/build-tools/packages/build-cli/src/commands/typetests.ts +++ b/build-tools/packages/build-cli/src/commands/typetests.ts @@ -11,8 +11,8 @@ import { } from "@fluidframework/build-tools"; import { Flags } from "@oclif/core"; -import { PackageCommand } from "../BasePackageCommand"; -import type { PackageSelectionDefault } from "../flags"; +import { PackageCommand } from "../BasePackageCommand.js"; +import type { PackageSelectionDefault } from "../flags.js"; export default class PrepareTypeTestsCommand extends PackageCommand< typeof PrepareTypeTestsCommand diff --git a/build-tools/packages/build-cli/src/filter.ts b/build-tools/packages/build-cli/src/filter.ts index 5f21ff0413d5..d84c551fc075 100644 --- a/build-tools/packages/build-cli/src/filter.ts +++ b/build-tools/packages/build-cli/src/filter.ts @@ -5,9 +5,9 @@ import path from "node:path"; import { Package } from "@fluidframework/build-tools"; -import { type PackageSelectionDefault, filterFlags, selectionFlags } from "./flags"; -import { Context } from "./library"; -import { ReleaseGroup, knownReleaseGroups } from "./releaseGroups"; +import { type PackageSelectionDefault, filterFlags, selectionFlags } from "./flags.js"; +import { Context } from "./library/index.js"; +import { ReleaseGroup, knownReleaseGroups } from "./releaseGroups.js"; /** * The criteria that should be used for selecting package-like objects from a collection. diff --git a/build-tools/packages/build-cli/src/flags.ts b/build-tools/packages/build-cli/src/flags.ts index a010f5a93370..e350e3828859 100644 --- a/build-tools/packages/build-cli/src/flags.ts +++ b/build-tools/packages/build-cli/src/flags.ts @@ -7,7 +7,7 @@ import { Flags } from "@oclif/core"; import * as semver from "semver"; // eslint-disable-next-line import/no-deprecated -import { MonoRepoKind } from "./library"; +import { MonoRepoKind } from "./library/index.js"; /** * An iterator that returns only the Enum values of MonoRepoKind. @@ -29,8 +29,8 @@ import { isVersionScheme, } from "@fluid-tools/version-tools"; -import type { DependencyUpdateType } from "./library"; -import { ReleaseGroup, isReleaseGroup } from "./releaseGroups"; +import type { DependencyUpdateType } from "./library/index.js"; +import { ReleaseGroup, isReleaseGroup } from "./releaseGroups.js"; /** * A re-usable CLI flag to parse release groups. diff --git a/build-tools/packages/build-cli/src/handlers/askFunctions.ts b/build-tools/packages/build-cli/src/handlers/askFunctions.ts index 99b2dc0fc97f..f78c6b5c7004 100644 --- a/build-tools/packages/build-cli/src/handlers/askFunctions.ts +++ b/build-tools/packages/build-cli/src/handlers/askFunctions.ts @@ -8,11 +8,11 @@ import { Machine } from "jssm"; import { bumpVersionScheme } from "@fluid-tools/version-tools"; -import { getDefaultBumpTypeForBranch } from "../library"; -import { CommandLogger } from "../logging"; -import { MachineState } from "../machines"; -import { FluidReleaseStateHandlerData } from "./fluidReleaseStateHandler"; -import { StateHandlerFunction } from "./stateHandlers"; +import { getDefaultBumpTypeForBranch } from "../library/index.js"; +import { CommandLogger } from "../logging.js"; +import { MachineState } from "../machines/index.js"; +import { FluidReleaseStateHandlerData } from "./fluidReleaseStateHandler.js"; +import { StateHandlerFunction } from "./stateHandlers.js"; /** * Determines the release type based on context, or by asking the user if needed. diff --git a/build-tools/packages/build-cli/src/handlers/checkFunctions.ts b/build-tools/packages/build-cli/src/handlers/checkFunctions.ts index 660050115c0c..0b8a9fa2bb10 100644 --- a/build-tools/packages/build-cli/src/handlers/checkFunctions.ts +++ b/build-tools/packages/build-cli/src/handlers/checkFunctions.ts @@ -20,13 +20,13 @@ import { getPreReleaseDependencies, getReleaseSourceForReleaseGroup, isReleased, -} from "../library"; -import { CommandLogger } from "../logging"; -import { MachineState } from "../machines"; -import { ReleaseSource, isReleaseGroup } from "../releaseGroups"; -import { getRunPolicyCheckDefault } from "../repoConfig"; -import { FluidReleaseStateHandlerData } from "./fluidReleaseStateHandler"; -import { BaseStateHandler, StateHandlerFunction } from "./stateHandlers"; +} from "../library/index.js"; +import { CommandLogger } from "../logging.js"; +import { MachineState } from "../machines/index.js"; +import { ReleaseSource, isReleaseGroup } from "../releaseGroups.js"; +import { getRunPolicyCheckDefault } from "../repoConfig.js"; +import { FluidReleaseStateHandlerData } from "./fluidReleaseStateHandler.js"; +import { BaseStateHandler, StateHandlerFunction } from "./stateHandlers.js"; /** * Checks that the current branch matches the expected branch for a release. diff --git a/build-tools/packages/build-cli/src/handlers/doFunctions.ts b/build-tools/packages/build-cli/src/handlers/doFunctions.ts index 21d202da9274..988da26810d9 100644 --- a/build-tools/packages/build-cli/src/handlers/doFunctions.ts +++ b/build-tools/packages/build-cli/src/handlers/doFunctions.ts @@ -16,12 +16,12 @@ import { getPreReleaseDependencies, npmCheckUpdates, setVersion, -} from "../library"; -import { CommandLogger } from "../logging"; -import { MachineState } from "../machines"; -import { ReleaseGroup, ReleasePackage, isReleaseGroup } from "../releaseGroups"; -import { FluidReleaseStateHandlerData } from "./fluidReleaseStateHandler"; -import { BaseStateHandler, StateHandlerFunction } from "./stateHandlers"; +} from "../library/index.js"; +import { CommandLogger } from "../logging.js"; +import { MachineState } from "../machines/index.js"; +import { ReleaseGroup, ReleasePackage, isReleaseGroup } from "../releaseGroups.js"; +import { FluidReleaseStateHandlerData } from "./fluidReleaseStateHandler.js"; +import { BaseStateHandler, StateHandlerFunction } from "./stateHandlers.js"; /** * Bumps any pre-release dependencies that have been released. diff --git a/build-tools/packages/build-cli/src/handlers/fluidReleaseStateHandler.ts b/build-tools/packages/build-cli/src/handlers/fluidReleaseStateHandler.ts index 6ff7369628b5..0480dd0ef415 100644 --- a/build-tools/packages/build-cli/src/handlers/fluidReleaseStateHandler.ts +++ b/build-tools/packages/build-cli/src/handlers/fluidReleaseStateHandler.ts @@ -7,15 +7,15 @@ import { Command } from "@oclif/core"; import chalk from "chalk"; import { Machine } from "jssm"; -import { Context } from "../library"; +import { Context } from "../library/index.js"; import { ReleaseVersion, VersionBumpType, VersionScheme } from "@fluid-tools/version-tools"; -import { InstructionalPromptWriter } from "../instructionalPromptWriter"; -import { CommandLogger } from "../logging"; -import { MachineState } from "../machines"; -import { ReleaseGroup, ReleasePackage } from "../releaseGroups"; -import { askForReleaseType } from "./askFunctions"; +import { InstructionalPromptWriter } from "../instructionalPromptWriter.js"; +import { CommandLogger } from "../logging.js"; +import { MachineState } from "../machines/index.js"; +import { ReleaseGroup, ReleasePackage } from "../releaseGroups.js"; +import { askForReleaseType } from "./askFunctions.js"; import { checkAssertTagging, checkBranchName, @@ -36,9 +36,9 @@ import { checkTypeTestGenerate, checkTypeTestPrepare, checkValidReleaseGroup, -} from "./checkFunctions"; -import { doBumpReleasedDependencies, doReleaseGroupBump } from "./doFunctions"; -import { InitFailedStateHandler } from "./initFailedStateHandler"; +} from "./checkFunctions.js"; +import { doBumpReleasedDependencies, doReleaseGroupBump } from "./doFunctions.js"; +import { InitFailedStateHandler } from "./initFailedStateHandler.js"; import { promptToCommitChanges, promptToCreateReleaseBranch, @@ -49,8 +49,8 @@ import { promptToReleaseDeps, promptToRunMinorReleaseCommand, promptToRunTypeTests, -} from "./promptFunctions"; -import { BaseStateHandler } from "./stateHandlers"; +} from "./promptFunctions.js"; +import { BaseStateHandler } from "./stateHandlers.js"; /** * Data that is passed to all the handling functions for the {@link FluidReleaseMachine}. This data is intended to be diff --git a/build-tools/packages/build-cli/src/handlers/index.ts b/build-tools/packages/build-cli/src/handlers/index.ts index 0e55b90aa1ba..acf1171c2541 100644 --- a/build-tools/packages/build-cli/src/handlers/index.ts +++ b/build-tools/packages/build-cli/src/handlers/index.ts @@ -3,9 +3,9 @@ * Licensed under the MIT License. */ -export { InitFailedStateHandler } from "./initFailedStateHandler"; -export { BaseStateHandler, type StateHandler } from "./stateHandlers"; +export { InitFailedStateHandler } from "./initFailedStateHandler.js"; +export { BaseStateHandler, type StateHandler } from "./stateHandlers.js"; export { type FluidReleaseStateHandlerData, FluidReleaseStateHandler, -} from "./fluidReleaseStateHandler"; +} from "./fluidReleaseStateHandler.js"; diff --git a/build-tools/packages/build-cli/src/handlers/initFailedStateHandler.ts b/build-tools/packages/build-cli/src/handlers/initFailedStateHandler.ts index cfacb3d9a8a3..cf31c00bb43e 100644 --- a/build-tools/packages/build-cli/src/handlers/initFailedStateHandler.ts +++ b/build-tools/packages/build-cli/src/handlers/initFailedStateHandler.ts @@ -5,9 +5,9 @@ import { Machine } from "jssm"; -import { CommandLogger } from "../logging"; -import { MachineState } from "../machines"; -import { BaseStateHandler } from "./stateHandlers"; +import { CommandLogger } from "../logging.js"; +import { MachineState } from "../machines/index.js"; +import { BaseStateHandler } from "./stateHandlers.js"; /** * A base class that handles the "Init" and "Failed" states in a state machine. These states are commonly used in state diff --git a/build-tools/packages/build-cli/src/handlers/promptFunctions.ts b/build-tools/packages/build-cli/src/handlers/promptFunctions.ts index 6c7d429433e2..98cf148024a2 100644 --- a/build-tools/packages/build-cli/src/handlers/promptFunctions.ts +++ b/build-tools/packages/build-cli/src/handlers/promptFunctions.ts @@ -6,13 +6,17 @@ import chalk from "chalk"; import { Machine } from "jssm"; -import { type InstructionalPrompt, mapADOLinks } from "../instructionalPromptWriter"; -import { difference, generateReleaseBranchName, getPreReleaseDependencies } from "../library"; -import { CommandLogger } from "../logging"; -import { MachineState } from "../machines"; -import { isReleaseGroup } from "../releaseGroups"; -import { FluidReleaseStateHandlerData } from "./fluidReleaseStateHandler"; -import { StateHandlerFunction } from "./stateHandlers"; +import { type InstructionalPrompt, mapADOLinks } from "../instructionalPromptWriter.js"; +import { + difference, + generateReleaseBranchName, + getPreReleaseDependencies, +} from "../library/index.js"; +import { CommandLogger } from "../logging.js"; +import { MachineState } from "../machines/index.js"; +import { isReleaseGroup } from "../releaseGroups.js"; +import { FluidReleaseStateHandlerData } from "./fluidReleaseStateHandler.js"; +import { StateHandlerFunction } from "./stateHandlers.js"; /** * Prompt the user to queue a release build. diff --git a/build-tools/packages/build-cli/src/handlers/stateHandlers.ts b/build-tools/packages/build-cli/src/handlers/stateHandlers.ts index 9714abe333e8..0514baccd358 100644 --- a/build-tools/packages/build-cli/src/handlers/stateHandlers.ts +++ b/build-tools/packages/build-cli/src/handlers/stateHandlers.ts @@ -5,8 +5,8 @@ import type { Machine } from "jssm"; -import { CommandLogger } from "../logging"; -import { MachineState } from "../machines"; +import { CommandLogger } from "../logging.js"; +import { MachineState } from "../machines/index.js"; /** * An async function that handles state. Typically this type is used via the {@link BaseStateHandler} class and its diff --git a/build-tools/packages/build-cli/src/index.ts b/build-tools/packages/build-cli/src/index.ts index 0531eac6225a..6ccf37ab8082 100644 --- a/build-tools/packages/build-cli/src/index.ts +++ b/build-tools/packages/build-cli/src/index.ts @@ -4,4 +4,4 @@ */ export { run } from "@oclif/core"; -export type { knownReleaseGroups, ReleaseGroup, ReleasePackage } from "./releaseGroups"; +export type { knownReleaseGroups, ReleaseGroup, ReleasePackage } from "./releaseGroups.js"; diff --git a/build-tools/packages/build-cli/src/instructionalPromptWriter.ts b/build-tools/packages/build-cli/src/instructionalPromptWriter.ts index f4ebfb6eea1b..ce0eb8135923 100644 --- a/build-tools/packages/build-cli/src/instructionalPromptWriter.ts +++ b/build-tools/packages/build-cli/src/instructionalPromptWriter.ts @@ -7,9 +7,9 @@ import { StringBuilder } from "@rushstack/node-core-library"; import chalk from "chalk"; // eslint-disable-next-line import/no-deprecated -import { MonoRepoKind, indentString } from "./library"; -import { CommandLogger } from "./logging"; -import { ReleaseGroup, ReleasePackage } from "./releaseGroups"; +import { MonoRepoKind, indentString } from "./library/index.js"; +import { CommandLogger } from "./logging.js"; +import { ReleaseGroup, ReleasePackage } from "./releaseGroups.js"; /** * An instructional prompt to display to a user in a terminal. A prompt can have any number of sections, and each diff --git a/build-tools/packages/build-cli/src/library/branches.ts b/build-tools/packages/build-cli/src/library/branches.ts index 6c6092819e65..b559d4762937 100644 --- a/build-tools/packages/build-cli/src/library/branches.ts +++ b/build-tools/packages/build-cli/src/library/branches.ts @@ -6,7 +6,7 @@ import { PackageName } from "@rushstack/node-core-library"; import * as semver from "semver"; -import { Context } from "./context"; +import { Context } from "./context.js"; import { DEFAULT_PRERELEASE_IDENTIFIER, @@ -22,8 +22,13 @@ import { toVirtualPatchScheme, } from "@fluid-tools/version-tools"; -import { ReleaseGroup, ReleasePackage, ReleaseSource, isReleaseGroup } from "../releaseGroups"; -import { DependencyUpdateType } from "./bump"; +import { + ReleaseGroup, + ReleasePackage, + ReleaseSource, + isReleaseGroup, +} from "../releaseGroups.js"; +import { DependencyUpdateType } from "./bump.js"; /** * Creates an appropriate branch for a release group and bump type. Does not commit! diff --git a/build-tools/packages/build-cli/src/library/bump.ts b/build-tools/packages/build-cli/src/library/bump.ts index ef444ea7242d..68960069401a 100644 --- a/build-tools/packages/build-cli/src/library/bump.ts +++ b/build-tools/packages/build-cli/src/library/bump.ts @@ -12,9 +12,9 @@ import { isVersionBumpType, } from "@fluid-tools/version-tools"; import { Logger, MonoRepo, Package } from "@fluidframework/build-tools"; -import { Context } from "./context"; +import { Context } from "./context.js"; -import { setVersion } from "./package"; +import { setVersion } from "./package.js"; /** * A type representing the types of dependency updates that can be done. This type is intended to match the type diff --git a/build-tools/packages/build-cli/src/library/changesets.ts b/build-tools/packages/build-cli/src/library/changesets.ts index f018925b0131..4f29d66c97b8 100644 --- a/build-tools/packages/build-cli/src/library/changesets.ts +++ b/build-tools/packages/build-cli/src/library/changesets.ts @@ -10,8 +10,8 @@ import { compareAsc, formatISO, parseISO } from "date-fns"; import globby from "globby"; import matter from "gray-matter"; -import { ReleasePackage } from "../releaseGroups"; -import { Repository } from "./git"; +import { ReleasePackage } from "../releaseGroups.js"; +import { Repository } from "./git.js"; export const DEFAULT_CHANGESET_PATH = ".changeset"; diff --git a/build-tools/packages/build-cli/src/library/commands/base.ts b/build-tools/packages/build-cli/src/library/commands/base.ts index f80de9138ca6..ce514a5100ef 100644 --- a/build-tools/packages/build-cli/src/library/commands/base.ts +++ b/build-tools/packages/build-cli/src/library/commands/base.ts @@ -9,9 +9,9 @@ import type { PrettyPrintableError } from "@oclif/core/lib/interfaces"; import chalk from "chalk"; import { GitRepo, getResolvedFluidRoot } from "@fluidframework/build-tools"; -import { CommandLogger } from "../../logging"; -import { Context } from "../context"; -import { indentString } from "../text"; +import { CommandLogger } from "../../logging.js"; +import { Context } from "../context.js"; +import { indentString } from "../text.js"; /** * A type representing all the flags of the base commands and subclasses. diff --git a/build-tools/packages/build-cli/src/library/commands/generateEntrypoints.ts b/build-tools/packages/build-cli/src/library/commands/generateEntrypoints.ts index c28d7876f98e..45dc42a2a7f2 100644 --- a/build-tools/packages/build-cli/src/library/commands/generateEntrypoints.ts +++ b/build-tools/packages/build-cli/src/library/commands/generateEntrypoints.ts @@ -11,16 +11,16 @@ import { Flags } from "@oclif/core"; import type { ExportSpecifierStructure, Node } from "ts-morph"; import { ModuleKind, Project, ScriptKind } from "ts-morph"; -import type { CommandLogger } from "../../logging"; -import { BaseCommand } from "./base"; +import type { CommandLogger } from "../../logging.js"; +import { BaseCommand } from "./base.js"; -import { ApiLevel } from "../apiLevel"; -import { ApiTag } from "../apiTag"; -import type { ExportData, Node10CompatExportData } from "../packageExports"; -import { queryTypesResolutionPathsFromPackageExports } from "../packageExports"; -import { getApiExports } from "../typescriptApi"; +import { ApiLevel } from "../apiLevel.js"; +import { ApiTag } from "../apiTag.js"; +import type { ExportData, Node10CompatExportData } from "../packageExports.js"; +import { queryTypesResolutionPathsFromPackageExports } from "../packageExports.js"; +import { getApiExports } from "../typescriptApi.js"; -import { unscopedPackageNameString } from "./constants"; +import { unscopedPackageNameString } from "./constants.js"; const optionDefaults = { mainEntrypoint: "./src/index.ts", diff --git a/build-tools/packages/build-cli/src/library/commands/index.ts b/build-tools/packages/build-cli/src/library/commands/index.ts index dc3f19858d22..4aad95205d76 100644 --- a/build-tools/packages/build-cli/src/library/commands/index.ts +++ b/build-tools/packages/build-cli/src/library/commands/index.ts @@ -3,9 +3,9 @@ * Licensed under the MIT License. */ -export { BaseCommand } from "./base"; -export { unscopedPackageNameString } from "./constants"; +export { BaseCommand } from "./base.js"; +export { unscopedPackageNameString } from "./constants.js"; export { GenerateEntrypointsCommand, getGenerateEntrypointsOutput, -} from "./generateEntrypoints"; +} from "./generateEntrypoints.js"; diff --git a/build-tools/packages/build-cli/src/library/dangerfile.ts b/build-tools/packages/build-cli/src/library/dangerfile.cts similarity index 100% rename from build-tools/packages/build-cli/src/library/dangerfile.ts rename to build-tools/packages/build-cli/src/library/dangerfile.cts diff --git a/build-tools/packages/build-cli/src/library/git.ts b/build-tools/packages/build-cli/src/library/git.ts index ae84862af937..bd089b4263a4 100644 --- a/build-tools/packages/build-cli/src/library/git.ts +++ b/build-tools/packages/build-cli/src/library/git.ts @@ -9,9 +9,9 @@ import readPkgUp from "read-pkg-up"; import { SimpleGit, SimpleGitOptions, simpleGit } from "simple-git"; import type { SetRequired } from "type-fest"; -import { CommandLogger } from "../logging"; -import { ReleaseGroup } from "../releaseGroups"; -import { Context } from "./context"; +import { CommandLogger } from "../logging.js"; +import { ReleaseGroup } from "../releaseGroups.js"; +import { Context } from "./context.js"; /** * Default options passed to the git client. */ diff --git a/build-tools/packages/build-cli/src/library/github.ts b/build-tools/packages/build-cli/src/library/github.ts index e51c38c64bca..eaa6e3bda91f 100644 --- a/build-tools/packages/build-cli/src/library/github.ts +++ b/build-tools/packages/build-cli/src/library/github.ts @@ -4,7 +4,7 @@ */ import { Octokit } from "@octokit/core"; -import { CommandLogger } from "../logging"; +import { CommandLogger } from "../logging.js"; const PULL_REQUEST_EXISTS = "GET /repos/{owner}/{repo}/pulls"; const COMMIT_INFO = "GET /repos/{owner}/{repo}/commits/{ref}"; diff --git a/build-tools/packages/build-cli/src/library/index.ts b/build-tools/packages/build-cli/src/library/index.ts index 04f15cae8341..e709bb28c439 100644 --- a/build-tools/packages/build-cli/src/library/index.ts +++ b/build-tools/packages/build-cli/src/library/index.ts @@ -3,8 +3,8 @@ * Licensed under the MIT License. */ -export { ApiLevel, knownApiLevels, isKnownApiLevel } from "./apiLevel"; -export { ApiTag } from "./apiTag"; +export { ApiLevel, knownApiLevels, isKnownApiLevel } from "./apiLevel.js"; +export { ApiTag } from "./apiTag.js"; export { generateBumpVersionBranchName, generateBumpVersionCommitMessage, @@ -14,17 +14,17 @@ export { getDefaultBumpTypeForBranch, getReleaseSourceForReleaseGroup, generateReleaseBranchName, -} from "./branches"; -export { getDisplayDate, getDisplayDateRelative } from "./dates"; -export { bumpReleaseGroup, DependencyUpdateType, isDependencyUpdateType } from "./bump"; -export { DEFAULT_CHANGESET_PATH, loadChangesets } from "./changesets"; +} from "./branches.js"; +export { getDisplayDate, getDisplayDateRelative } from "./dates.js"; +export { bumpReleaseGroup, DependencyUpdateType, isDependencyUpdateType } from "./bump.js"; +export { DEFAULT_CHANGESET_PATH, loadChangesets } from "./changesets.js"; export { unscopedPackageNameString, BaseCommand, GenerateEntrypointsCommand, -} from "./commands"; -export { Context, VersionDetails, isMonoRepoKind, MonoRepoKind } from "./context"; -export { Repository } from "./git"; +} from "./commands/index.js"; +export { Context, VersionDetails, isMonoRepoKind, MonoRepoKind } from "./context.js"; +export { Repository } from "./git.js"; export { ensureDevDependencyExists, filterVersionsOlderThan, @@ -38,11 +38,11 @@ export { PreReleaseDependencies, setVersion, sortVersions, -} from "./package"; -export { difference } from "./sets"; -export { getIndent, indentString } from "./text"; -export { getApiExports } from "./typescriptApi"; -export { createPullRequest, getCommitInfo, pullRequestExists } from "./github"; +} from "./package.js"; +export { difference } from "./sets.js"; +export { getIndent, indentString } from "./text.js"; +export { getApiExports } from "./typescriptApi.js"; +export { createPullRequest, getCommitInfo, pullRequestExists } from "./github.js"; export { getRanges, PackageVersionList, @@ -50,6 +50,6 @@ export { ReleaseReport, ReportKind, toReportKind, -} from "./release"; -export { LayerGraph } from "./layerGraph"; -export { type Handler, policyHandlers } from "./repoPolicyCheck"; +} from "./release.js"; +export { LayerGraph } from "./layerGraph.js"; +export { type Handler, policyHandlers } from "./repoPolicyCheck/index.js"; diff --git a/build-tools/packages/build-cli/src/library/layerGraph.ts b/build-tools/packages/build-cli/src/library/layerGraph.ts index 6655400563cb..3fb4640626ad 100644 --- a/build-tools/packages/build-cli/src/library/layerGraph.ts +++ b/build-tools/packages/build-cli/src/library/layerGraph.ts @@ -6,12 +6,15 @@ import assert from "node:assert"; import { EOL as newline } from "node:os"; import * as path from "node:path"; +import { fileURLToPath } from "node:url"; import { Package } from "@fluidframework/build-tools"; -import { readJsonSync } from "fs-extra"; +import { readJsonSync } from "fs-extra/esm"; import registerDebug from "debug"; const traceLayerCheck = registerDebug("layer-check"); +const __dirname = path.dirname(fileURLToPath(import.meta.url)); + interface ILayerInfo { deps?: string[]; packages?: string[]; @@ -591,7 +594,6 @@ ${lines.join(newline)} } public static load(root: string, packages: Package[], info?: string): LayerGraph { - // eslint-disable-next-line unicorn/prefer-module const layerInfoFile = info ?? path.join(__dirname, "..", "..", "data", "layerInfo.json"); const layerData = readJsonSync(layerInfoFile) as ILayerInfoFile; return new LayerGraph(root, layerData, packages); diff --git a/build-tools/packages/build-cli/src/library/package.ts b/build-tools/packages/build-cli/src/library/package.ts index d77da7dbfb91..578b02e29030 100644 --- a/build-tools/packages/build-cli/src/library/package.ts +++ b/build-tools/packages/build-cli/src/library/package.ts @@ -4,6 +4,7 @@ */ import { strict as assert } from "node:assert"; +import { writeFile } from "node:fs/promises"; import path from "node:path"; import { InterdependencyRange, @@ -26,11 +27,11 @@ import { import { PackageName } from "@rushstack/node-core-library"; import { compareDesc, differenceInBusinessDays } from "date-fns"; import execa from "execa"; -import { readJson, readJsonSync, writeFile } from "fs-extra"; +import { readJson, readJsonSync } from "fs-extra/esm"; import latestVersion from "latest-version"; import ncu from "npm-check-updates"; -import type { Index } from "npm-check-updates/build/src/types/IndexType"; -import { VersionSpec } from "npm-check-updates/build/src/types/VersionSpec"; +import type { Index } from "npm-check-updates/build/src/types/IndexType.js"; +import type { VersionSpec } from "npm-check-updates/build/src/types/VersionSpec.js"; import * as semver from "semver"; import { @@ -38,12 +39,12 @@ import { PackageSelectionCriteria, PackageWithKind, selectAndFilterPackages, -} from "../filter"; -import { ReleaseGroup, ReleasePackage, isReleaseGroup } from "../releaseGroups"; -import { DependencyUpdateType } from "./bump"; -import { zip } from "./collections"; -import { Context, VersionDetails } from "./context"; -import { indentString } from "./text"; +} from "../filter.js"; +import { ReleaseGroup, ReleasePackage, isReleaseGroup } from "../releaseGroups.js"; +import { DependencyUpdateType } from "./bump.js"; +import { zip } from "./collections.js"; +import { Context, VersionDetails } from "./context.js"; +import { indentString } from "./text.js"; /** * An object that maps package names to version strings or range strings. @@ -149,7 +150,7 @@ export async function npmCheckUpdates( log?.verbose(`Checking packages in ${path.join(repoPath, glob)}`); // eslint-disable-next-line no-await-in-loop - const result = (await ncu({ + const result = (await ncu.run({ filter: depsToUpdate, cwd: repoPath, packageFile: glob === "" ? "package.json" : `${glob}/package.json`, diff --git a/build-tools/packages/build-cli/src/library/release.ts b/build-tools/packages/build-cli/src/library/release.ts index d641d9574b5f..780072d746fc 100644 --- a/build-tools/packages/build-cli/src/library/release.ts +++ b/build-tools/packages/build-cli/src/library/release.ts @@ -11,7 +11,7 @@ import { getVersionRange, } from "@fluid-tools/version-tools"; -import { ReleaseGroup } from "../releaseGroups"; +import { ReleaseGroup } from "../releaseGroups.js"; /** * A map of package names to their versions. This is the format of the "simple" release report. diff --git a/build-tools/packages/build-cli/src/library/repoPolicyCheck/assertShortCode.ts b/build-tools/packages/build-cli/src/library/repoPolicyCheck/assertShortCode.ts index b5c50ac22c54..d3da607a7652 100644 --- a/build-tools/packages/build-cli/src/library/repoPolicyCheck/assertShortCode.ts +++ b/build-tools/packages/build-cli/src/library/repoPolicyCheck/assertShortCode.ts @@ -15,7 +15,7 @@ import { SyntaxKind, } from "ts-morph"; -import { Handler } from "./common"; +import { Handler } from "./common.js"; const shortCodes = new Map(); const newAssetFiles = new Set(); diff --git a/build-tools/packages/build-cli/src/library/repoPolicyCheck/copyrightFileHeader.ts b/build-tools/packages/build-cli/src/library/repoPolicyCheck/copyrightFileHeader.ts index 803ae0dd4489..57cfe5ea346b 100644 --- a/build-tools/packages/build-cli/src/library/repoPolicyCheck/copyrightFileHeader.ts +++ b/build-tools/packages/build-cli/src/library/repoPolicyCheck/copyrightFileHeader.ts @@ -4,7 +4,7 @@ */ import { EOL as newline } from "node:os"; -import { Handler, readFile, writeFile } from "./common"; +import { Handler, readFile, writeFile } from "./common.js"; const copyrightText = `Copyright (c) Microsoft Corporation and contributors. All rights reserved.${newline}Licensed under the MIT License.`; const autoGenText = `${newline}THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY`; diff --git a/build-tools/packages/build-cli/src/library/repoPolicyCheck/dockerfilePackages.ts b/build-tools/packages/build-cli/src/library/repoPolicyCheck/dockerfilePackages.ts index 4d502b4d4c12..a2d30514e287 100644 --- a/build-tools/packages/build-cli/src/library/repoPolicyCheck/dockerfilePackages.ts +++ b/build-tools/packages/build-cli/src/library/repoPolicyCheck/dockerfilePackages.ts @@ -4,7 +4,7 @@ */ import fs from "node:fs"; -import { Handler, readFile, writeFile } from "./common"; +import { Handler, readFile, writeFile } from "./common.js"; const serverPath = "server/routerlicious/"; const serverDockerfilePath = `${serverPath}Dockerfile`; diff --git a/build-tools/packages/build-cli/src/library/repoPolicyCheck/fluidBuildDatabase.ts b/build-tools/packages/build-cli/src/library/repoPolicyCheck/fluidBuildDatabase.ts index f7f1c634bdb7..0c12dad8393b 100644 --- a/build-tools/packages/build-cli/src/library/repoPolicyCheck/fluidBuildDatabase.ts +++ b/build-tools/packages/build-cli/src/library/repoPolicyCheck/fluidBuildDatabase.ts @@ -12,7 +12,7 @@ import path from "node:path"; import { type Package, TscUtils } from "@fluidframework/build-tools"; import type { TsConfigJson } from "type-fest"; -import { getGenerateEntrypointsOutput } from "../commands"; +import { getGenerateEntrypointsOutput } from "../commands/index.js"; type PackageName = string; type Script = string; diff --git a/build-tools/packages/build-cli/src/library/repoPolicyCheck/fluidBuildTasks.ts b/build-tools/packages/build-cli/src/library/repoPolicyCheck/fluidBuildTasks.ts index b2cf4b89b427..7863aa518d75 100644 --- a/build-tools/packages/build-cli/src/library/repoPolicyCheck/fluidBuildTasks.ts +++ b/build-tools/packages/build-cli/src/library/repoPolicyCheck/fluidBuildTasks.ts @@ -19,8 +19,8 @@ import { import * as JSON5 from "json5"; import * as semver from "semver"; import { TsConfigJson } from "type-fest"; -import { Handler, readFile } from "./common"; -import { FluidBuildDatabase } from "./fluidBuildDatabase"; +import { Handler, readFile } from "./common.js"; +import { FluidBuildDatabase } from "./fluidBuildDatabase.js"; /** * Get and cache the tsc check ignore setting @@ -226,7 +226,10 @@ function eslintGetScriptDependencies( const configFile = fs.readFileSync(eslintConfig, "utf8"); config = JSON5.parse(configFile); } else { - // eslint-disable-next-line @typescript-eslint/no-require-imports, unicorn/prefer-module, @typescript-eslint/no-var-requires + // TODO: Ideally loading the eslint config should use import() instead of require() but right now policy resolvers + // are synchronous. If they are made async in the future, then this code should be updated to use dynamic import. + + // eslint-disable-next-line @typescript-eslint/no-require-imports, unicorn/prefer-module, @typescript-eslint/no-var-requires config = require(path.resolve(eslintConfig)) as EslintConfig; if (config === undefined) { throw new Error(`Exports not found in ${eslintConfig}`); diff --git a/build-tools/packages/build-cli/src/library/repoPolicyCheck/fluidCase.ts b/build-tools/packages/build-cli/src/library/repoPolicyCheck/fluidCase.ts index 5d6fd2561c65..97618566fa97 100644 --- a/build-tools/packages/build-cli/src/library/repoPolicyCheck/fluidCase.ts +++ b/build-tools/packages/build-cli/src/library/repoPolicyCheck/fluidCase.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. */ -import { Handler, readFile, writeFile } from "./common"; +import { Handler, readFile, writeFile } from "./common.js"; export const handler: Handler = { name: "fluid-case", diff --git a/build-tools/packages/build-cli/src/library/repoPolicyCheck/index.ts b/build-tools/packages/build-cli/src/library/repoPolicyCheck/index.ts index 63241bd7a39f..7d955178c18f 100644 --- a/build-tools/packages/build-cli/src/library/repoPolicyCheck/index.ts +++ b/build-tools/packages/build-cli/src/library/repoPolicyCheck/index.ts @@ -3,16 +3,16 @@ * Licensed under the MIT License. */ -import { handler as assertShortCodeHandler } from "./assertShortCode"; -import { type Handler } from "./common"; -import { handlers as copyrightFileHeaderHandlers } from "./copyrightFileHeader"; -import { handler as dockerfilePackageHandler } from "./dockerfilePackages"; -import { handlers as fluidBuildTasks } from "./fluidBuildTasks"; -import { handler as fluidCaseHandler } from "./fluidCase"; -import { handlers as lockfileHandlers } from "./lockfiles"; -import { handler as noJsFileHandler } from "./noJsFiles"; -import { handlers as npmPackageContentsHandlers } from "./npmPackages"; -import { handlers as pnpmHandlers } from "./pnpm"; +import { handler as assertShortCodeHandler } from "./assertShortCode.js"; +import { type Handler } from "./common.js"; +import { handlers as copyrightFileHeaderHandlers } from "./copyrightFileHeader.js"; +import { handler as dockerfilePackageHandler } from "./dockerfilePackages.js"; +import { handlers as fluidBuildTasks } from "./fluidBuildTasks.js"; +import { handler as fluidCaseHandler } from "./fluidCase.js"; +import { handlers as lockfileHandlers } from "./lockfiles.js"; +import { handler as noJsFileHandler } from "./noJsFiles.js"; +import { handlers as npmPackageContentsHandlers } from "./npmPackages.js"; +import { handlers as pnpmHandlers } from "./pnpm.js"; /** * declared file handlers @@ -29,4 +29,4 @@ export const policyHandlers: Handler[] = [ noJsFileHandler, ]; -export { type Handler } from "./common"; +export { type Handler } from "./common.js"; diff --git a/build-tools/packages/build-cli/src/library/repoPolicyCheck/lockfiles.ts b/build-tools/packages/build-cli/src/library/repoPolicyCheck/lockfiles.ts index 0c572b3e79bd..47c96156a9a2 100644 --- a/build-tools/packages/build-cli/src/library/repoPolicyCheck/lockfiles.ts +++ b/build-tools/packages/build-cli/src/library/repoPolicyCheck/lockfiles.ts @@ -6,7 +6,7 @@ import { unlinkSync } from "node:fs"; import path from "node:path"; import { IFluidBuildConfig, loadFluidBuildConfig } from "@fluidframework/build-tools"; -import { Handler } from "./common"; +import { Handler } from "./common.js"; const lockFilePattern = /.*?package-lock\.json$/i; let _knownPaths: string[] | undefined; diff --git a/build-tools/packages/build-cli/src/library/repoPolicyCheck/noJsFiles.ts b/build-tools/packages/build-cli/src/library/repoPolicyCheck/noJsFiles.ts index 378e84be4c63..75d54bedb361 100644 --- a/build-tools/packages/build-cli/src/library/repoPolicyCheck/noJsFiles.ts +++ b/build-tools/packages/build-cli/src/library/repoPolicyCheck/noJsFiles.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. */ -import { Handler } from "./common"; +import { Handler } from "./common.js"; /** * A policy handler that checks for JavaScript source files that just use the .js file extension. Such files may be diff --git a/build-tools/packages/build-cli/src/library/repoPolicyCheck/npmPackages.ts b/build-tools/packages/build-cli/src/library/repoPolicyCheck/npmPackages.ts index 7399c44557af..23eca8239756 100644 --- a/build-tools/packages/build-cli/src/library/repoPolicyCheck/npmPackages.ts +++ b/build-tools/packages/build-cli/src/library/repoPolicyCheck/npmPackages.ts @@ -20,7 +20,7 @@ import { loadFluidBuildConfig, updatePackageJsonFile, } from "@fluidframework/build-tools"; -import { Handler, readFile, writeFile } from "./common"; +import { Handler, readFile, writeFile } from "./common.js"; const licenseId = "MIT"; const author = "Microsoft and contributors"; @@ -1178,8 +1178,7 @@ export const handlers: Handler[] = [ } const jestConfigFile = path.join(packageDir, jestFileName); - // eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports, unicorn/prefer-module - const config = require(path.resolve(jestConfigFile)) as { reporters?: unknown }; + const config = (await import(path.resolve(jestConfigFile))) as { reporters?: unknown }; if (config.reporters === undefined) { return `Missing reporters in '${jestConfigFile}'`; } diff --git a/build-tools/packages/build-cli/src/library/repoPolicyCheck/pnpm.ts b/build-tools/packages/build-cli/src/library/repoPolicyCheck/pnpm.ts index ea36c8bb9d1a..bc74ebe01857 100644 --- a/build-tools/packages/build-cli/src/library/repoPolicyCheck/pnpm.ts +++ b/build-tools/packages/build-cli/src/library/repoPolicyCheck/pnpm.ts @@ -6,7 +6,7 @@ import fs from "node:fs"; import path from "node:path"; import { PackageJson, loadFluidBuildConfig } from "@fluidframework/build-tools"; -import { Handler, readFile } from "./common"; +import { Handler, readFile } from "./common.js"; const match = /(?:^|\/)pnpm-lock\.yaml$/i; export const handlers: Handler[] = [ diff --git a/build-tools/packages/build-cli/src/library/typescriptApi.ts b/build-tools/packages/build-cli/src/library/typescriptApi.ts index 93fdff8c2a32..dd4396c4fe38 100644 --- a/build-tools/packages/build-cli/src/library/typescriptApi.ts +++ b/build-tools/packages/build-cli/src/library/typescriptApi.ts @@ -6,8 +6,8 @@ import type { ExportDeclaration, ExportedDeclarations, JSDoc, SourceFile } from "ts-morph"; import { Node, SyntaxKind } from "ts-morph"; -import type { ApiTag } from "./apiTag"; -import { isKnownApiTag } from "./apiTag"; +import type { ApiTag } from "./apiTag.js"; +import { isKnownApiTag } from "./apiTag.js"; interface ExportRecord { name: string; diff --git a/build-tools/packages/build-cli/src/machines/fluidReleaseMachine.ts b/build-tools/packages/build-cli/src/machines/fluidReleaseMachine.ts index 7a2fc77ca652..c33ed3ac2be9 100644 --- a/build-tools/packages/build-cli/src/machines/fluidReleaseMachine.ts +++ b/build-tools/packages/build-cli/src/machines/fluidReleaseMachine.ts @@ -4,10 +4,12 @@ */ import path from "node:path"; +import { fileURLToPath } from "node:url"; import { FileSystem as fs } from "@rushstack/node-core-library"; import { from as createStateMachine } from "jssm"; -// eslint-disable-next-line unicorn/prefer-module +const __dirname = path.dirname(fileURLToPath(import.meta.url)); + const machineDefinitionFile = path.join(__dirname, "FluidRelease.fsl"); const fsl = fs.readFile(machineDefinitionFile).toString(); diff --git a/build-tools/packages/build-cli/src/machines/index.ts b/build-tools/packages/build-cli/src/machines/index.ts index d649c1463653..bcacd1c60bb7 100644 --- a/build-tools/packages/build-cli/src/machines/index.ts +++ b/build-tools/packages/build-cli/src/machines/index.ts @@ -3,5 +3,5 @@ * Licensed under the MIT License. */ -export { FluidReleaseMachine } from "./fluidReleaseMachine"; -export type { MachineState } from "./types"; +export { FluidReleaseMachine } from "./fluidReleaseMachine.js"; +export type { MachineState } from "./types.js"; diff --git a/build-tools/packages/build-cli/src/repoConfig.ts b/build-tools/packages/build-cli/src/repoConfig.ts index 2686e7347204..898e5db44f76 100644 --- a/build-tools/packages/build-cli/src/repoConfig.ts +++ b/build-tools/packages/build-cli/src/repoConfig.ts @@ -4,7 +4,7 @@ */ import { minimatch } from "minimatch"; -import { ReleaseGroup, ReleasePackage } from "./releaseGroups"; +import { ReleaseGroup, ReleasePackage } from "./releaseGroups.js"; // Mapping of branch to a list of release groups/packages that should run policy by default. // TODO: This should be configured in the fluid-build config, like type test defaults are. diff --git a/build-tools/packages/build-cli/src/stateMachineCommand.ts b/build-tools/packages/build-cli/src/stateMachineCommand.ts index 1e3daa53fa04..0fd5e2c41135 100644 --- a/build-tools/packages/build-cli/src/stateMachineCommand.ts +++ b/build-tools/packages/build-cli/src/stateMachineCommand.ts @@ -7,9 +7,9 @@ import { Command, Flags } from "@oclif/core"; import chalk from "chalk"; import { Machine } from "jssm"; -import { testModeFlag } from "./flags"; -import { StateHandler } from "./handlers"; -import { BaseCommand } from "./library"; +import { testModeFlag } from "./flags.js"; +import { StateHandler } from "./handlers/index.js"; +import { BaseCommand } from "./library/index.js"; /** * A base CLI command that uses an internal state machine to govern its behavior. Subclasses must provide a state diff --git a/build-tools/packages/build-cli/test/commands/generate/buildVersion.test.ts b/build-tools/packages/build-cli/test/commands/generate/buildVersion.test.ts index 41203d25d9f2..6b05e993ffab 100644 --- a/build-tools/packages/build-cli/test/commands/generate/buildVersion.test.ts +++ b/build-tools/packages/build-cli/test/commands/generate/buildVersion.test.ts @@ -3,7 +3,10 @@ * Licensed under the MIT License. */ -import { expect, test } from "@oclif/test"; +import { expect } from "@oclif/test"; + +import { initializeCommandTestFunction } from "../../init.js"; +const test = initializeCommandTestFunction(import.meta.url); /** * This list of git tags is deliberately unordered since often the list provided to commands is unordered. diff --git a/build-tools/packages/build-cli/test/commands/list.test.ts b/build-tools/packages/build-cli/test/commands/list.test.ts index 779ab6f671ad..8ad8d4b9d13e 100644 --- a/build-tools/packages/build-cli/test/commands/list.test.ts +++ b/build-tools/packages/build-cli/test/commands/list.test.ts @@ -5,8 +5,9 @@ import { GitRepo, getResolvedFluidRoot } from "@fluidframework/build-tools"; import { expect } from "chai"; -import { FeedsForPackages } from "../../src/commands/list"; -import { Context } from "../../src/library"; + +import { FeedsForPackages } from "../../src/commands/list.js"; +import { Context } from "../../src/library/index.js"; describe("feeds", async () => { const resolvedRoot = await getResolvedFluidRoot(); diff --git a/build-tools/packages/build-cli/test/commands/release.test.ts b/build-tools/packages/build-cli/test/commands/release.test.ts index bc1f7bb90419..08df989de88f 100644 --- a/build-tools/packages/build-cli/test/commands/release.test.ts +++ b/build-tools/packages/build-cli/test/commands/release.test.ts @@ -3,10 +3,10 @@ * Licensed under the MIT License. */ -import { test } from "@oclif/test"; - -import { FluidReleaseMachine } from "../../src/machines"; +import { FluidReleaseMachine } from "../../src/machines/index.js"; +import { initializeCommandTestFunction } from "../init.js"; +const test = initializeCommandTestFunction(import.meta.url); const knownUnhandledStates: string[] = [ // Known unhandled states can be added here temporarily during development. ]; diff --git a/build-tools/packages/build-cli/test/commands/release/fromTag.test.ts b/build-tools/packages/build-cli/test/commands/release/fromTag.test.ts index b14a2528d5a3..6dab3ecd6cc6 100644 --- a/build-tools/packages/build-cli/test/commands/release/fromTag.test.ts +++ b/build-tools/packages/build-cli/test/commands/release/fromTag.test.ts @@ -4,11 +4,13 @@ */ import { ReleaseVersion, VersionBumpType } from "@fluid-tools/version-tools"; -import { test } from "@oclif/test"; import chai, { expect } from "chai"; import assertArrays from "chai-arrays"; -import { ReleaseGroup, ReleasePackage } from "../../../src/releaseGroups"; +import { ReleaseGroup, ReleasePackage } from "../../../src/releaseGroups.js"; +import { initializeCommandTestFunction } from "../../init.js"; + +const test = initializeCommandTestFunction(import.meta.url); chai.use(assertArrays); interface jsonOutput { diff --git a/build-tools/packages/build-cli/test/commands/test-only-filter.test.ts b/build-tools/packages/build-cli/test/commands/test-only-filter.test.ts index cb46d643bc8c..0062219e7e87 100644 --- a/build-tools/packages/build-cli/test/commands/test-only-filter.test.ts +++ b/build-tools/packages/build-cli/test/commands/test-only-filter.test.ts @@ -4,10 +4,12 @@ */ import { Package } from "@fluidframework/build-tools"; -import { test } from "@oclif/test"; import chai, { expect } from "chai"; import assertArrays from "chai-arrays"; +import { initializeCommandTestFunction } from "../init.js"; + +const test = initializeCommandTestFunction(import.meta.url); chai.use(assertArrays); interface jsonOutput { diff --git a/build-tools/packages/build-cli/test/commands/typetests.test.ts b/build-tools/packages/build-cli/test/commands/typetests.test.ts index ebb319c750d6..e131ca54792a 100644 --- a/build-tools/packages/build-cli/test/commands/typetests.test.ts +++ b/build-tools/packages/build-cli/test/commands/typetests.test.ts @@ -11,7 +11,7 @@ import { previousVersion, resetBrokenTests, updateTypeTestDependency, -} from "../../src/commands/typetests"; +} from "../../src/commands/typetests.js"; /** * A minimal test package.json. It defines only the required fields according to the type definition. diff --git a/build-tools/packages/build-cli/test/filter.test.ts b/build-tools/packages/build-cli/test/filter.test.ts index 99d19ce0bd1b..00ca3d9cee8c 100644 --- a/build-tools/packages/build-cli/test/filter.test.ts +++ b/build-tools/packages/build-cli/test/filter.test.ts @@ -3,20 +3,21 @@ * Licensed under the MIT License. */ -import chai, { assert, expect } from "chai"; - +import path from "node:path"; +import { fileURLToPath } from "node:url"; import { GitRepo, getResolvedFluidRoot } from "@fluidframework/build-tools"; +import chai, { assert, expect } from "chai"; import assertArrays from "chai-arrays"; - -import path from "path"; import { AllPackagesSelectionCriteria, PackageFilterOptions, PackageSelectionCriteria, filterPackages, selectAndFilterPackages, -} from "../src/filter"; -import { Context } from "../src/library"; +} from "../src/filter.js"; +import { Context } from "../src/library/index.js"; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); chai.use(assertArrays); diff --git a/build-tools/packages/build-cli/test/helpers/init.js b/build-tools/packages/build-cli/test/helpers/init.js deleted file mode 100644 index 4eef9f05ea13..000000000000 --- a/build-tools/packages/build-cli/test/helpers/init.js +++ /dev/null @@ -1,11 +0,0 @@ -/*! - * Copyright (c) Microsoft Corporation and contributors. All rights reserved. - * Licensed under the MIT License. - */ - -const path = require("path"); -process.env.TS_NODE_PROJECT = path.resolve("test/tsconfig.json"); -process.env.NODE_ENV = "development"; - -global.oclif = global.oclif || {}; -global.oclif.columns = 80; diff --git a/build-tools/packages/build-cli/test/init.ts b/build-tools/packages/build-cli/test/init.ts new file mode 100644 index 000000000000..74ccf13d035e --- /dev/null +++ b/build-tools/packages/build-cli/test/init.ts @@ -0,0 +1,20 @@ +/*! + * Copyright (c) Microsoft Corporation and contributors. All rights reserved. + * Licensed under the MIT License. + */ + +import { test as oclifTest } from "@oclif/test"; + +/** + * Initializes the oclif command test environment. @oclif/test cannot find the path to the project in some + * circumstances, so as a workaround we configure it explicitly by passing in the URL to the test module itself. + * + * @param moduleUrl - The URL to the test module. In most cases you should pass the `import.meta.url` value for the test + * module when calling this function. + * + * @returns A test function that can be used to tst oclif commands. + */ +export function initializeCommandTestFunction(moduleUrl: string) { + // @oclif/test cannot find the path to the project, so as a workaround we configure it explicitly + return oclifTest.loadConfig({ root: moduleUrl }); +} diff --git a/build-tools/packages/build-cli/test/library/branches.test.ts b/build-tools/packages/build-cli/test/library/branches.test.ts index ebac85398b4e..8f09ca428984 100644 --- a/build-tools/packages/build-cli/test/library/branches.test.ts +++ b/build-tools/packages/build-cli/test/library/branches.test.ts @@ -5,14 +5,14 @@ import { assert } from "chai"; -import { MonoRepoKind } from "../../src/library"; +import { MonoRepoKind } from "../../src/library/index.js"; import { generateBumpDepsBranchName, generateBumpVersionBranchName, generateReleaseBranchName, getDefaultBumpTypeForBranch, -} from "../../src/library/branches"; +} from "../../src/library/branches.js"; describe("generateBumpVersionBranchName", () => { it("semver versions", () => { diff --git a/build-tools/packages/build-cli/test/library/changesets.test.ts b/build-tools/packages/build-cli/test/library/changesets.test.ts index 98fec9f3f0c0..28cd07f72c73 100644 --- a/build-tools/packages/build-cli/test/library/changesets.test.ts +++ b/build-tools/packages/build-cli/test/library/changesets.test.ts @@ -3,18 +3,21 @@ * Licensed under the MIT License. */ +import { existsSync } from "node:fs"; import path from "node:path"; +import { fileURLToPath } from "node:url"; import { assert, expect } from "chai"; -import { pathExistsSync } from "fs-extra"; import { flattenChangesets, groupByPackage, loadChangesets, -} from "../../src/library/changesets"; +} from "../../src/library/changesets.js"; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); const changesetsPath = path.resolve(__dirname, "../data"); -assert.isTrue(pathExistsSync(changesetsPath)); +assert.isTrue(existsSync(changesetsPath)); describe("changesets", async () => { it("loadChangesets", async () => { diff --git a/build-tools/packages/build-cli/test/library/package.test.ts b/build-tools/packages/build-cli/test/library/package.test.ts index cc70ff2bb4b7..217a541841be 100644 --- a/build-tools/packages/build-cli/test/library/package.test.ts +++ b/build-tools/packages/build-cli/test/library/package.test.ts @@ -7,14 +7,14 @@ import { PackageName } from "@rushstack/node-core-library"; import { assert } from "chai"; import { parseJSON } from "date-fns"; -import { VersionDetails } from "../../src/library"; +import { VersionDetails } from "../../src/library/index.js"; import type { PackageJson } from "@fluidframework/build-tools"; import { ensureDevDependencyExists, generateReleaseGitTagName, sortVersions, -} from "../../src/library/package"; +} from "../../src/library/package.js"; describe("VersionDetails sorting", async () => { const versions: VersionDetails[] = [ diff --git a/build-tools/packages/build-cli/test/library/packageExports.test.ts b/build-tools/packages/build-cli/test/library/packageExports.test.ts index 7a47d8376cf5..74b301766d76 100644 --- a/build-tools/packages/build-cli/test/library/packageExports.test.ts +++ b/build-tools/packages/build-cli/test/library/packageExports.test.ts @@ -5,8 +5,8 @@ import { assert } from "chai"; -import type { ExportData, Node10CompatExportData } from "../../src/library/packageExports"; -import { queryTypesResolutionPathsFromPackageExports } from "../../src/library/packageExports"; +import type { ExportData, Node10CompatExportData } from "../../src/library/packageExports.js"; +import { queryTypesResolutionPathsFromPackageExports } from "../../src/library/packageExports.js"; import type { Logger, PackageJson } from "@fluidframework/build-tools"; diff --git a/build-tools/packages/build-cli/test/machines/fluidReleaseMachine.test.ts b/build-tools/packages/build-cli/test/machines/fluidReleaseMachine.test.ts index 7190a1952096..e3786d181a87 100644 --- a/build-tools/packages/build-cli/test/machines/fluidReleaseMachine.test.ts +++ b/build-tools/packages/build-cli/test/machines/fluidReleaseMachine.test.ts @@ -6,7 +6,7 @@ import chai, { expect } from "chai"; import assertArrays from "chai-arrays"; -import { FluidReleaseMachine as machine } from "../../src/machines/fluidReleaseMachine"; +import { FluidReleaseMachine as machine } from "../../src/machines/fluidReleaseMachine.js"; chai.use(assertArrays); diff --git a/build-tools/packages/build-cli/test/tsconfig.json b/build-tools/packages/build-cli/test/tsconfig.json index 726cea76212c..1cd513901ccf 100644 --- a/build-tools/packages/build-cli/test/tsconfig.json +++ b/build-tools/packages/build-cli/test/tsconfig.json @@ -1,15 +1,13 @@ { - "extends": "@fluidframework/build-common/ts-common-config.json", + "extends": "../tsconfig.json", + "include": ["test/**/*"], "compilerOptions": { - "declaration": true, "importHelpers": true, "declarationMap": false, - "noUnusedLocals": false, "rootDir": "./", "outDir": "../lib/test", "types": ["node", "mocha", "chai"], "skipLibCheck": true, - "target": "ES2015", }, "references": [ { diff --git a/build-tools/packages/build-cli/tsconfig.json b/build-tools/packages/build-cli/tsconfig.json index d91952bce4cb..6453f8af1c66 100644 --- a/build-tools/packages/build-cli/tsconfig.json +++ b/build-tools/packages/build-cli/tsconfig.json @@ -1,13 +1,12 @@ { - "extends": "@fluidframework/build-common/ts-common-config.json", + "extends": "../../../common/build/build-common/tsconfig.node16.json", + "include": ["src/**/*"], "compilerOptions": { - "composite": true, "rootDir": "./src", "outDir": "./lib", "types": ["node"], "noImplicitAny": true, - "noUnusedLocals": true, + "noUnusedLocals": false, + "target": "ES2022", }, - "include": ["src/**/*"], - "exclude": ["src/test/**/*"], } diff --git a/build-tools/packages/build-tools/package.json b/build-tools/packages/build-tools/package.json index 7479529347b8..7ccdfb245330 100644 --- a/build-tools/packages/build-tools/package.json +++ b/build-tools/packages/build-tools/package.json @@ -52,7 +52,7 @@ "debug": "^4.3.4", "detect-indent": "^6.1.0", "find-up": "^7.0.0", - "fs-extra": "^9.1.0", + "fs-extra": "^11.2.0", "glob": "^7.2.3", "ignore": "^5.2.4", "json5": "^2.2.3", @@ -69,9 +69,9 @@ }, "devDependencies": { "@fluidframework/build-common": "^2.0.3", - "@fluidframework/eslint-config-fluid": "^5.2.0", + "@fluidframework/eslint-config-fluid": "^5.3.0", "@types/async": "^3.2.20", - "@types/fs-extra": "^8.1.2", + "@types/fs-extra": "^11.0.4", "@types/glob": "^7.2.0", "@types/lodash": "^4.14.195", "@types/lodash.isequal": "^4.5.6", @@ -85,6 +85,6 @@ "mocha": "^10.2.0" }, "engines": { - "node": ">=14.17.0" + "node": ">=18.17.1" } } diff --git a/build-tools/packages/build-tools/packlist.txt b/build-tools/packages/build-tools/packlist.txt index a82f7d9cc72b..c9c20547ba39 100644 --- a/build-tools/packages/build-tools/packlist.txt +++ b/build-tools/packages/build-tools/packlist.txt @@ -182,10 +182,6 @@ dist/index.d.ts dist/index.d.ts.map dist/index.js dist/index.js.map -dist/type-test-generator/compatibility.d.ts -dist/type-test-generator/compatibility.d.ts.map -dist/type-test-generator/compatibility.js -dist/type-test-generator/compatibility.js.map dist/type-test-generator/main.d.ts dist/type-test-generator/main.d.ts.map dist/type-test-generator/main.js @@ -194,6 +190,10 @@ dist/typeValidator/changeToNamedExports.d.ts dist/typeValidator/changeToNamedExports.d.ts.map dist/typeValidator/changeToNamedExports.js dist/typeValidator/changeToNamedExports.js.map +dist/typeValidator/compatibility.d.ts +dist/typeValidator/compatibility.d.ts.map +dist/typeValidator/compatibility.js +dist/typeValidator/compatibility.js.map dist/typeValidator/testGeneration.d.ts dist/typeValidator/testGeneration.d.ts.map dist/typeValidator/testGeneration.js diff --git a/build-tools/packages/bundle-size-tools/package.json b/build-tools/packages/bundle-size-tools/package.json index 073cbb28ae0d..0c5341568c7c 100644 --- a/build-tools/packages/bundle-size-tools/package.json +++ b/build-tools/packages/bundle-size-tools/package.json @@ -49,7 +49,7 @@ }, "devDependencies": { "@fluidframework/build-common": "^2.0.3", - "@fluidframework/eslint-config-fluid": "^5.2.0", + "@fluidframework/eslint-config-fluid": "^5.3.0", "@microsoft/api-extractor": "^7.43.1", "@types/msgpack-lite": "^0.1.8", "@types/node": "^18.18.6", diff --git a/build-tools/packages/readme-command/package.json b/build-tools/packages/readme-command/package.json index aa608b9cc1a3..5efbed74855a 100644 --- a/build-tools/packages/readme-command/package.json +++ b/build-tools/packages/readme-command/package.json @@ -45,7 +45,7 @@ }, "devDependencies": { "@fluidframework/build-common": "^2.0.3", - "@fluidframework/eslint-config-fluid": "^5.2.0", + "@fluidframework/eslint-config-fluid": "^5.3.0", "@oclif/test": "^3.2.12", "@types/chai": "^4.3.5", "@types/chai-arrays": "^2.0.0", @@ -64,7 +64,7 @@ "typescript": "~5.1.6" }, "engines": { - "node": ">=14.17.0" + "node": ">=18.17.1" }, "oclif": { "bin": "fluid-readme", diff --git a/build-tools/packages/version-tools/package.json b/build-tools/packages/version-tools/package.json index e1c5520aed97..314594cba2ce 100644 --- a/build-tools/packages/version-tools/package.json +++ b/build-tools/packages/version-tools/package.json @@ -74,7 +74,7 @@ "devDependencies": { "@fluid-private/readme-command": "workspace:~", "@fluidframework/build-common": "^2.0.3", - "@fluidframework/eslint-config-fluid": "^5.2.0", + "@fluidframework/eslint-config-fluid": "^5.3.0", "@microsoft/api-extractor": "^7.43.1", "@oclif/test": "^3.2.12", "@types/chai": "^4.3.5", @@ -99,7 +99,7 @@ "typescript": "~5.1.6" }, "engines": { - "node": ">=14.17.0" + "node": ">=18.17.1" }, "oclif": { "bin": "fluv", diff --git a/build-tools/packages/version-tools/src/internalVersionScheme.ts b/build-tools/packages/version-tools/src/internalVersionScheme.ts index f91c0d1e85ec..c0a3336c0169 100644 --- a/build-tools/packages/version-tools/src/internalVersionScheme.ts +++ b/build-tools/packages/version-tools/src/internalVersionScheme.ts @@ -4,6 +4,7 @@ */ import { strict as assert } from "node:assert"; + import * as semver from "semver"; import { VersionBumpTypeExtended } from "./bumpTypes"; diff --git a/build-tools/packages/version-tools/src/schemes.ts b/build-tools/packages/version-tools/src/schemes.ts index 19eeb251016e..12b8ea4829b6 100644 --- a/build-tools/packages/version-tools/src/schemes.ts +++ b/build-tools/packages/version-tools/src/schemes.ts @@ -4,6 +4,7 @@ */ import { strict as assert } from "node:assert"; + import * as semver from "semver"; import { VersionBumpTypeExtended, isVersionBumpType } from "./bumpTypes"; diff --git a/build-tools/packages/version-tools/src/versions.ts b/build-tools/packages/version-tools/src/versions.ts index 962d807d3ac1..58a8bf22f919 100644 --- a/build-tools/packages/version-tools/src/versions.ts +++ b/build-tools/packages/version-tools/src/versions.ts @@ -4,6 +4,7 @@ */ import child_process from "node:child_process"; + import * as semver from "semver"; import { diff --git a/build-tools/packages/version-tools/src/virtualPatchScheme.ts b/build-tools/packages/version-tools/src/virtualPatchScheme.ts index f588a1058024..084eecaa0184 100644 --- a/build-tools/packages/version-tools/src/virtualPatchScheme.ts +++ b/build-tools/packages/version-tools/src/virtualPatchScheme.ts @@ -4,6 +4,7 @@ */ import { strict as assert } from "node:assert"; + import * as semver from "semver"; import { VersionBumpType } from "./bumpTypes"; diff --git a/build-tools/patches/jssm@5.98.2.patch b/build-tools/patches/jssm@5.98.2.patch new file mode 100644 index 000000000000..00fe1694de7c --- /dev/null +++ b/build-tools/patches/jssm@5.98.2.patch @@ -0,0 +1,3655 @@ +diff --git a/jssm.es5.d.cts b/jssm.es5.d.cts +new file mode 100644 +index 0000000000000000000000000000000000000000..4b3029395beb581aa74e8e8450432acb0f3aa0e4 +--- /dev/null ++++ b/jssm.es5.d.cts +@@ -0,0 +1,1758 @@ ++import { circular_buffer } from 'circular_buffer_js'; ++ ++declare type StateType$1 = string; /** Composite type composing whether or not a result was successful */ ++declare type JssmColor = string; ++declare type JssmPermittedOpt = 'required' | 'disallowed' | 'optional'; ++declare type JssmArrow = '->' | '<-' | '<->' | '<=->' | '<~->' | '=>' | '<=' | '<=>' | '<-=>' | '<~=>' | '~>' | '<~' | '<~>' | '<-~>' | '<=~>'; ++/** ++ * A type teaching Typescript the various supported shapes for nodes, mostly inherited from GraphViz ++ */ ++declare type JssmShape = "box" | "polygon" | "ellipse" | "oval" | "circle" | "point" | "egg" | "triangle" | "plaintext" | "plain" | "diamond" | "trapezium" | "parallelogram" | "house" | "pentagon" | "hexagon" | "septagon" | "octagon" | "doublecircle" | "doubleoctagon" | "tripleoctagon" | "invtriangle" | "invtrapezium" | "invhouse" | "Mdiamond" | "Msquare" | "Mcircle" | "rect" | "rectangle" | "square" | "star" | "none" | "underline" | "cylinder" | "note" | "tab" | "folder" | "box3d" | "component" | "promoter" | "cds" | "terminator" | "utr" | "primersite" | "restrictionsite" | "fivepoverhang" | "threepoverhang" | "noverhang" | "assembly" | "signature" | "insulator" | "ribosite" | "rnastab" | "proteasesite" | "proteinstab" | "rpromoter" | "rarrow" | "larrow" | "lpromoter" | "record"; ++declare type JssmArrowDirection = 'left' | 'right' | 'both'; ++declare type JssmArrowKind = 'none' | 'legal' | 'main' | 'forced'; ++declare type JssmLayout = 'dot' | 'circo' | 'twopi' | 'fdp'; ++declare type JssmCorner = 'regular' | 'rounded' | 'lined'; ++declare type JssmLineStyle = 'solid' | 'dashed' | 'dotted'; ++declare type JssmAllowsOverride = true | false | undefined; ++declare const FslDirections: readonly ["up", "right", "down", "left"]; ++declare type FslDirection = typeof FslDirections[number]; ++declare const FslThemes: readonly ["default", "ocean", "modern", "plain", "bold"]; ++declare type FslTheme = typeof FslThemes[number]; ++declare type JssmSerialization = { ++ jssm_version: string; ++ timestamp: number; ++ comment?: string | undefined; ++ state: StateType$1; ++ history: [string, DataType][]; ++ history_capacity: number; ++ data: DataType; ++}; ++declare type JssmPropertyDefinition = { ++ name: string; ++ default_value?: any; ++ required?: boolean; ++}; ++declare type JssmTransitionPermitter = (OldState: StateType$1, NewState: StateType$1, OldData: DataType, NewData: DataType) => boolean; ++declare type JssmTransitionPermitterMaybeArray = JssmTransitionPermitter | Array>; ++declare type JssmTransition = { ++ from: StateType; ++ to: StateType; ++ after_time?: number; ++ se?: JssmCompileSe; ++ name?: StateType; ++ action?: StateType; ++ check?: JssmTransitionPermitterMaybeArray; ++ probability?: number; ++ kind: JssmArrowKind; ++ forced_only: boolean; ++ main_path: boolean; ++}; ++declare type JssmTransitions = JssmTransition[]; ++declare type JssmTransitionList = { ++ entrances: Array; ++ exits: Array; ++}; ++declare type JssmGenericState = { ++ from: Array; ++ name: StateType$1; ++ to: Array; ++ complete: boolean; ++}; ++declare type JssmMachineInternalState = { ++ internal_state_impl_version: 1; ++ state: StateType$1; ++ states: Map; ++ named_transitions: Map; ++ edge_map: Map>; ++ actions: Map>; ++ reverse_actions: Map>; ++ edges: Array>; ++}; ++declare type JssmStatePermitter = (OldState: StateType$1, NewState: StateType$1, OldData: DataType, NewData: DataType) => boolean; ++declare type JssmStatePermitterMaybeArray = JssmStatePermitter | Array>; ++declare type JssmStateDeclarationRule = { ++ key: string; ++ value: any; ++ name?: string; ++}; ++declare type JssmStateDeclaration = { ++ declarations: Array; ++ shape?: JssmShape; ++ color?: JssmColor; ++ corners?: JssmCorner; ++ lineStyle?: JssmLineStyle; ++ stateLabel?: string; ++ textColor?: JssmColor; ++ backgroundColor?: JssmColor; ++ borderColor?: JssmColor; ++ state: StateType$1; ++ property?: { ++ name: string; ++ value: unknown; ++ }; ++}; ++declare type JssmStateConfig = Partial; ++declare type JssmStateStyleShape = { ++ key: 'shape'; ++ value: JssmShape; ++}; ++declare type JssmStateStyleColor = { ++ key: 'color'; ++ value: JssmColor; ++}; ++declare type JssmStateStyleTextColor = { ++ key: 'text-color'; ++ value: JssmColor; ++}; ++declare type JssmStateStyleCorners = { ++ key: 'corners'; ++ value: JssmCorner; ++}; ++declare type JssmStateStyleLineStyle = { ++ key: 'line-style'; ++ value: JssmLineStyle; ++}; ++declare type JssmStateStyleStateLabel = { ++ key: 'state-label'; ++ value: string; ++}; ++declare type JssmStateStyleBackgroundColor = { ++ key: 'background-color'; ++ value: JssmColor; ++}; ++declare type JssmStateStyleBorderColor = { ++ key: 'border-color'; ++ value: JssmColor; ++}; ++declare type JssmStateStyleKey = JssmStateStyleShape | JssmStateStyleColor | JssmStateStyleTextColor | JssmStateStyleCorners | JssmStateStyleLineStyle | JssmStateStyleBackgroundColor | JssmStateStyleStateLabel | JssmStateStyleBorderColor; ++declare type JssmStateStyleKeyList = JssmStateStyleKey[]; ++declare type JssmGenericConfig = { ++ graph_layout?: JssmLayout; ++ complete?: Array; ++ transitions: JssmTransitions; ++ theme?: FslTheme[]; ++ flow?: FslDirection; ++ name?: string; ++ data?: DataType; ++ nodes?: Array; ++ check?: JssmStatePermitterMaybeArray; ++ history?: number; ++ min_exits?: number; ++ max_exits?: number; ++ allow_islands?: false; ++ allow_force?: false; ++ actions?: JssmPermittedOpt; ++ simplify_bidi?: boolean; ++ allows_override?: JssmAllowsOverride; ++ config_allows_override?: JssmAllowsOverride; ++ dot_preamble?: string; ++ start_states: Array; ++ end_states?: Array; ++ initial_state?: StateType; ++ start_states_no_enforce?: boolean; ++ state_declaration?: Object[]; ++ property_definition?: JssmPropertyDefinition[]; ++ state_property?: JssmPropertyDefinition[]; ++ arrange_declaration?: Array>; ++ arrange_start_declaration?: Array>; ++ arrange_end_declaration?: Array>; ++ machine_author?: string | Array; ++ machine_comment?: string; ++ machine_contributor?: string | Array; ++ machine_definition?: string; ++ machine_language?: string; ++ machine_license?: string; ++ machine_name?: string; ++ machine_version?: string; ++ fsl_version?: string; ++ auto_api?: boolean | string; ++ instance_name?: string | undefined; ++ default_state_config?: JssmStateStyleKeyList; ++ default_start_state_config?: JssmStateStyleKeyList; ++ default_end_state_config?: JssmStateStyleKeyList; ++ default_hooked_state_config?: JssmStateStyleKeyList; ++ default_terminal_state_config?: JssmStateStyleKeyList; ++ default_active_state_config?: JssmStateStyleKeyList; ++ rng_seed?: number | undefined; ++ time_source?: () => number; ++ timeout_source?: (Function: any, number: any) => number; ++ clear_timeout_source?: (number: any) => void; ++}; ++declare type JssmCompileSe = { ++ to: StateType; ++ se?: JssmCompileSe; ++ kind: JssmArrow; ++ l_action?: StateType; ++ r_action?: StateType; ++ l_probability: number; ++ r_probability: number; ++ l_after?: number; ++ r_after?: number; ++}; ++declare type JssmCompileSeStart = { ++ from: StateType; ++ se: JssmCompileSe; ++ key: string; ++ value?: string | number; ++ name?: string; ++ state?: string; ++ default_value?: any; ++ required?: boolean; ++}; ++declare type JssmParseTree = Array>; ++declare type BasicHookDescription = { ++ kind: 'hook'; ++ from: string; ++ to: string; ++ handler: HookHandler; ++}; ++declare type HookDescriptionWithAction = { ++ kind: 'named'; ++ from: string; ++ to: string; ++ action: string; ++ handler: HookHandler; ++}; ++declare type StandardTransitionHook = { ++ kind: 'standard transition'; ++ handler: HookHandler; ++}; ++declare type MainTransitionHook = { ++ kind: 'main transition'; ++ handler: HookHandler; ++}; ++declare type ForcedTransitionHook = { ++ kind: 'forced transition'; ++ handler: HookHandler; ++}; ++declare type AnyTransitionHook = { ++ kind: 'any transition'; ++ handler: HookHandler; ++}; ++declare type GlobalActionHook = { ++ kind: 'global action'; ++ action: string; ++ handler: HookHandler; ++}; ++declare type AnyActionHook = { ++ kind: 'any action'; ++ handler: HookHandler; ++}; ++declare type EntryHook = { ++ kind: 'entry'; ++ to: string; ++ handler: HookHandler; ++}; ++declare type ExitHook = { ++ kind: 'exit'; ++ from: string; ++ handler: HookHandler; ++}; ++declare type PostBasicHookDescription = { ++ kind: 'post hook'; ++ from: string; ++ to: string; ++ handler: PostHookHandler; ++}; ++declare type PostHookDescriptionWithAction = { ++ kind: 'post named'; ++ from: string; ++ to: string; ++ action: string; ++ handler: PostHookHandler; ++}; ++declare type PostStandardTransitionHook = { ++ kind: 'post standard transition'; ++ handler: PostHookHandler; ++}; ++declare type PostMainTransitionHook = { ++ kind: 'post main transition'; ++ handler: PostHookHandler; ++}; ++declare type PostForcedTransitionHook = { ++ kind: 'post forced transition'; ++ handler: PostHookHandler; ++}; ++declare type PostAnyTransitionHook = { ++ kind: 'post any transition'; ++ handler: PostHookHandler; ++}; ++declare type PostGlobalActionHook = { ++ kind: 'post global action'; ++ action: string; ++ handler: PostHookHandler; ++}; ++declare type PostAnyActionHook = { ++ kind: 'post any action'; ++ handler: PostHookHandler; ++}; ++declare type PostEntryHook = { ++ kind: 'post entry'; ++ to: string; ++ handler: PostHookHandler; ++}; ++declare type PostExitHook = { ++ kind: 'post exit'; ++ from: string; ++ handler: PostHookHandler; ++}; ++declare type HookDescription = BasicHookDescription | HookDescriptionWithAction | GlobalActionHook | AnyActionHook | StandardTransitionHook | MainTransitionHook | ForcedTransitionHook | AnyTransitionHook | EntryHook | ExitHook | PostBasicHookDescription | PostHookDescriptionWithAction | PostGlobalActionHook | PostAnyActionHook | PostStandardTransitionHook | PostMainTransitionHook | PostForcedTransitionHook | PostAnyTransitionHook | PostEntryHook | PostExitHook; ++declare type HookComplexResult = { ++ pass: boolean; ++ state?: StateType$1; ++ data?: mDT; ++ next_data?: mDT; ++}; ++declare type HookResult = true | false | undefined | void | HookComplexResult; /** Documents whether a hook succeeded, either with a primitive or a reference to the hook complex object */ ++declare type HookContext = { ++ data: mDT; ++ next_data: mDT; ++}; ++declare type HookHandler = (hook_context: HookContext) => HookResult; ++declare type PostHookHandler = (hook_context: HookContext) => void; ++declare type JssmHistory = circular_buffer<[StateType$1, mDT]>; ++declare type JssmRng = () => number; ++ ++/********* ++ * ++ * Return the direction of an arrow - `right`, `left`, or `both`. ++ * ++ * ```typescript ++ * import { arrow_direction } from 'jssm'; ++ * ++ * arrow_direction('->'); // 'right' ++ * arrow_direction('<~=>'); // 'both' ++ * ``` ++ * ++ * @param arrow The arrow to be evaluated ++ * ++ */ ++declare function arrow_direction(arrow: JssmArrow): JssmArrowDirection; ++/********* ++ * ++ * Return the direction of an arrow - `right`, `left`, or `both`. ++ * ++ * ```typescript ++ * import { arrow_left_kind } from 'jssm'; ++ * ++ * arrow_left_kind('<-'); // 'legal' ++ * arrow_left_kind('<='); // 'main' ++ * arrow_left_kind('<~'); // 'forced' ++ * arrow_left_kind('<->'); // 'legal' ++ * arrow_left_kind('->'); // 'none' ++ * ``` ++ * ++ * @param arrow The arrow to be evaluated ++ * ++ */ ++declare function arrow_left_kind(arrow: JssmArrow): JssmArrowKind; ++/********* ++ * ++ * Return the direction of an arrow - `right`, `left`, or `both`. ++ * ++ * ```typescript ++ * import { arrow_left_kind } from 'jssm'; ++ * ++ * arrow_left_kind('->'); // 'legal' ++ * arrow_left_kind('=>'); // 'main' ++ * arrow_left_kind('~>'); // 'forced' ++ * arrow_left_kind('<->'); // 'legal' ++ * arrow_left_kind('<-'); // 'none' ++ * ``` ++ * ++ * @param arrow The arrow to be evaluated ++ * ++ */ ++declare function arrow_right_kind(arrow: JssmArrow): JssmArrowKind; ++ ++/********* ++ * ++ * This method wraps the parser call that comes from the peg grammar, ++ * {@link parse}. Generally neither this nor that should be used directly ++ * unless you mean to develop plugins or extensions for the machine. ++ * ++ * Parses the intermediate representation of a compiled string down to a ++ * machine configuration object. If you're using this (probably don't,) you're ++ * probably also using {@link compile} and {@link Machine.constructor}. ++ * ++ * ```typescript ++ * import { parse, compile, Machine } from 'jssm'; ++ * ++ * const intermediate = wrap_parse('a -> b;', {}); ++ * // [ {key:'transition', from:'a', se:{kind:'->',to:'b'}} ] ++ * ++ * const cfg = compile(intermediate); ++ * // { start_states:['a'], transitions: [{ from:'a', to:'b', kind:'legal', forced_only:false, main_path:false }] } ++ * ++ * const machine = new Machine(cfg); ++ * // Machine { _instance_name: undefined, _state: 'a', ... ++ * ``` ++ * ++ * This method is mostly for plugin and intermediate tool authors, or people ++ * who need to work with the machine's intermediate representation. ++ * ++ * # Hey! ++ * ++ * Most people looking at this want either the `sm` operator or method `from`, ++ * which perform all the steps in the chain. The library's author mostly uses ++ * operator `sm`, and mostly falls back to `.from` when needing to parse ++ * strings dynamically instead of from template literals. ++ * ++ * Operator {@link sm}: ++ * ++ * ```typescript ++ * import { sm } from 'jssm'; ++ * ++ * const lswitch = sm`on <=> off;`; ++ * ``` ++ * ++ * Method {@link from}: ++ * ++ * ```typescript ++ * import * as jssm from 'jssm'; ++ * ++ * const toggle = jssm.from('up <=> down;'); ++ * ``` ++ * ++ * `wrap_parse` itself is an internal convenience method for alting out an ++ * object as the options call. Not generally meant for external use. ++ * ++ * @param input The FSL code to be evaluated ++ * ++ * @param options Things to control about the instance ++ * ++ */ ++declare function wrap_parse(input: string, options?: Object): any; ++/********* ++ * ++ * Compile a machine's JSON intermediate representation to a config object. If ++ * you're using this (probably don't,) you're probably also using ++ * {@link parse} to get the IR, and the object constructor ++ * {@link Machine.construct} to turn the config object into a workable machine. ++ * ++ * ```typescript ++ * import { parse, compile, Machine } from 'jssm'; ++ * ++ * const intermediate = parse('a -> b;'); ++ * // [ {key:'transition', from:'a', se:{kind:'->',to:'b'}} ] ++ * ++ * const cfg = compile(intermediate); ++ * // { start_states:['a'], transitions: [{ from:'a', to:'b', kind:'legal', forced_only:false, main_path:false }] } ++ * ++ * const machine = new Machine(cfg); ++ * // Machine { _instance_name: undefined, _state: 'a', ... ++ * ``` ++ * ++ * This method is mostly for plugin and intermediate tool authors, or people ++ * who need to work with the machine's intermediate representation. ++ * ++ * # Hey! ++ * ++ * Most people looking at this want either the `sm` operator or method `from`, ++ * which perform all the steps in the chain. The library's author mostly uses ++ * operator `sm`, and mostly falls back to `.from` when needing to parse ++ * strings dynamically instead of from template literals. ++ * ++ * Operator {@link sm}: ++ * ++ * ```typescript ++ * import { sm } from 'jssm'; ++ * ++ * const lswitch = sm`on <=> off;`; ++ * ``` ++ * ++ * Method {@link from}: ++ * ++ * ```typescript ++ * import * as jssm from 'jssm'; ++ * ++ * const toggle = jssm.from('up <=> down;'); ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ * @param tree The parse tree to be boiled down into a machine config ++ * ++ */ ++declare function compile(tree: JssmParseTree): JssmGenericConfig; ++/********* ++ * ++ * An internal convenience wrapper for parsing then compiling a machine string. ++ * Not generally meant for external use. Please see {@link compile} or ++ * {@link sm}. ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ * @param plan The FSL code to be evaluated and built into a machine config ++ * ++ */ ++declare function make(plan: string): JssmGenericConfig; ++ ++declare const weighted_rand_select: Function; ++/******* ++ * ++ * Returns, for a non-negative integer argument `n`, the series `[0 .. n]`. ++ * ++ * ```typescript ++ * import { seq } from './jssm'; ++ * ++ * seq(5); // [0, 1, 2, 3, 4] ++ * seq(0); // [] ++ * ``` ++ * ++ */ ++declare function seq(n: number): number[]; ++/******* ++ * ++ * Returns the histograph of an array as a `Map`. Makes no attempt to cope ++ * with deep equality; will fail for complex contents, as such. ++ * ++ * ```typescript ++ * import { histograph } from './jssm'; ++ * ++ * histograph( [0, 0, 1, 1, 2, 2, 1] ); // Map() ++ * ``` ++ * ++ */ ++declare const histograph: Function; ++declare const weighted_sample_select: Function; ++declare const weighted_histo_key: Function; ++/******* ++ * ++ * Reduces an array to its unique contents. Compares with `===` and makes no ++ * effort to deep-compare contents; two matching arrays or objects contained ++ * will be treated as distinct, according to javascript rules. This also means ++ * that `NaNs` will be ***dropped***, because they do not self-compare. ++ * ++ * ```typescript ++ * unique( [] ); // [] ++ * unique( [0,0] ); // [0] ++ * unique( [0,1,2, 0,1,2, 0,1,2] ); // [0,1,2] ++ * unique( [ [1], [1] ] ); // [ [1], [1] ] because arrays don't match ++ * unique( [0,NaN,2] ); // [0,2] ++ * ``` ++ * ++ */ ++declare const unique: (arr?: T[]) => T[]; ++/******* ++ * ++ * Lists all repeated items in an array along with their counts. Subject to ++ * matching rules of Map. `NaN` is manually removed because of conflict rules ++ * around {@link unique}. Because these are compared with `===` and because ++ * arrays and objects never match that way unless they're the same object, ++ * arrays and objects are never considered repeats. ++ * ++ * ```typescript ++ * find_repeated([ ]); // [] ++ * find_repeated([ "one" ]); // [] ++ * find_repeated([ "one", "two" ]); // [] ++ * find_repeated([ "one", "one" ]); // [ ["one", 2] ] ++ * find_repeated([ "one", "two", "one" ]); // [ ["one", 2] ] ++ * find_repeated([ 0, NaN, 0, NaN ]); // [ [0, 2] ] ++ * ``` ++ * ++ */ ++declare function find_repeated(arr: T[]): [T, number][]; ++ ++declare const NegInfinity: number; ++declare const PosInfinity: number; ++declare const Epsilon: number; ++declare const Pi: number; ++declare const E: number; ++declare const Root2: number; ++declare const RootHalf: number; ++declare const Ln2: number; ++declare const Ln10: number; ++declare const Log2E: number; ++declare const Log10E: number; ++declare const MaxSafeInt: number; ++declare const MinSafeInt: number; ++declare const MaxPosNum: number; ++declare const MinPosNum: number; ++declare const Phi = 1.618033988749895; ++declare const EulerC = 0.5772156649015329; ++declare const gviz_shapes$1: string[]; ++declare const shapes$1: string[]; ++declare const named_colors$1: string[]; ++ ++declare const jssm_constants_d_NegInfinity: typeof NegInfinity; ++declare const jssm_constants_d_PosInfinity: typeof PosInfinity; ++declare const jssm_constants_d_Epsilon: typeof Epsilon; ++declare const jssm_constants_d_Pi: typeof Pi; ++declare const jssm_constants_d_E: typeof E; ++declare const jssm_constants_d_Root2: typeof Root2; ++declare const jssm_constants_d_RootHalf: typeof RootHalf; ++declare const jssm_constants_d_Ln2: typeof Ln2; ++declare const jssm_constants_d_Ln10: typeof Ln10; ++declare const jssm_constants_d_Log2E: typeof Log2E; ++declare const jssm_constants_d_Log10E: typeof Log10E; ++declare const jssm_constants_d_MaxSafeInt: typeof MaxSafeInt; ++declare const jssm_constants_d_MinSafeInt: typeof MinSafeInt; ++declare const jssm_constants_d_MaxPosNum: typeof MaxPosNum; ++declare const jssm_constants_d_MinPosNum: typeof MinPosNum; ++declare const jssm_constants_d_Phi: typeof Phi; ++declare const jssm_constants_d_EulerC: typeof EulerC; ++declare namespace jssm_constants_d { ++ export { ++ gviz_shapes$1 as gviz_shapes, ++ shapes$1 as shapes, ++ named_colors$1 as named_colors, ++ jssm_constants_d_NegInfinity as NegInfinity, ++ jssm_constants_d_PosInfinity as PosInfinity, ++ jssm_constants_d_Epsilon as Epsilon, ++ jssm_constants_d_Pi as Pi, ++ jssm_constants_d_E as E, ++ jssm_constants_d_Root2 as Root2, ++ jssm_constants_d_RootHalf as RootHalf, ++ jssm_constants_d_Ln2 as Ln2, ++ jssm_constants_d_Ln10 as Ln10, ++ jssm_constants_d_Log2E as Log2E, ++ jssm_constants_d_Log10E as Log10E, ++ jssm_constants_d_MaxSafeInt as MaxSafeInt, ++ jssm_constants_d_MinSafeInt as MinSafeInt, ++ jssm_constants_d_MaxPosNum as MaxPosNum, ++ jssm_constants_d_MinPosNum as MinPosNum, ++ jssm_constants_d_Phi as Phi, ++ jssm_constants_d_EulerC as EulerC, ++ }; ++} ++ ++declare const version: string; ++declare const build_time: number; ++ ++declare type StateType = string; ++ ++declare const shapes: string[]; ++declare const gviz_shapes: string[]; ++declare const named_colors: string[]; ++ ++/********* ++ * ++ * An internal method meant to take a series of declarations and fold them into ++ * a single multi-faceted declaration, in the process of building a state. Not ++ * generally meant for external use. ++ * ++ * @internal ++ * ++ */ ++declare function transfer_state_properties(state_decl: JssmStateDeclaration): JssmStateDeclaration; ++declare function state_style_condense(jssk: JssmStateStyleKeyList): JssmStateConfig; ++declare class Machine { ++ _state: StateType; ++ _states: Map; ++ _edges: Array>; ++ _edge_map: Map>; ++ _named_transitions: Map; ++ _actions: Map>; ++ _reverse_actions: Map>; ++ _reverse_action_targets: Map>; ++ _start_states: Set; ++ _end_states: Set; ++ _machine_author?: Array; ++ _machine_comment?: string; ++ _machine_contributor?: Array; ++ _machine_definition?: string; ++ _machine_language?: string; ++ _machine_license?: string; ++ _machine_name?: string; ++ _machine_version?: string; ++ _fsl_version?: string; ++ _raw_state_declaration?: Array; ++ _state_declarations: Map; ++ _data?: mDT; ++ _instance_name: string; ++ _rng_seed: number; ++ _rng: JssmRng; ++ _graph_layout: JssmLayout; ++ _dot_preamble: string; ++ _arrange_declaration: Array>; ++ _arrange_start_declaration: Array>; ++ _arrange_end_declaration: Array>; ++ _themes: FslTheme[]; ++ _flow: FslDirection; ++ _has_hooks: boolean; ++ _has_basic_hooks: boolean; ++ _has_named_hooks: boolean; ++ _has_entry_hooks: boolean; ++ _has_exit_hooks: boolean; ++ _has_global_action_hooks: boolean; ++ _has_transition_hooks: boolean; ++ _has_forced_transitions: boolean; ++ _hooks: Map>; ++ _named_hooks: Map>; ++ _entry_hooks: Map>; ++ _exit_hooks: Map>; ++ _global_action_hooks: Map>; ++ _any_action_hook: HookHandler | undefined; ++ _standard_transition_hook: HookHandler | undefined; ++ _main_transition_hook: HookHandler | undefined; ++ _forced_transition_hook: HookHandler | undefined; ++ _any_transition_hook: HookHandler | undefined; ++ _has_post_hooks: boolean; ++ _has_post_basic_hooks: boolean; ++ _has_post_named_hooks: boolean; ++ _has_post_entry_hooks: boolean; ++ _has_post_exit_hooks: boolean; ++ _has_post_global_action_hooks: boolean; ++ _has_post_transition_hooks: boolean; ++ _code_allows_override: JssmAllowsOverride; ++ _config_allows_override: JssmAllowsOverride; ++ _post_hooks: Map>; ++ _post_named_hooks: Map>; ++ _post_entry_hooks: Map>; ++ _post_exit_hooks: Map>; ++ _post_global_action_hooks: Map>; ++ _post_any_action_hook: HookHandler | undefined; ++ _post_standard_transition_hook: HookHandler | undefined; ++ _post_main_transition_hook: HookHandler | undefined; ++ _post_forced_transition_hook: HookHandler | undefined; ++ _post_any_transition_hook: HookHandler | undefined; ++ _property_keys: Set; ++ _default_properties: Map; ++ _state_properties: Map; ++ _required_properties: Set; ++ _history: JssmHistory; ++ _history_length: number; ++ _state_style: JssmStateConfig; ++ _active_state_style: JssmStateConfig; ++ _hooked_state_style: JssmStateConfig; ++ _terminal_state_style: JssmStateConfig; ++ _start_state_style: JssmStateConfig; ++ _end_state_style: JssmStateConfig; ++ _state_labels: Map; ++ _time_source: () => number; ++ _create_started: number; ++ _created: number; ++ _after_mapping: Map; ++ _timeout_source: (Function: any, number: any) => number; ++ _clear_timeout_source: (h: any) => void; ++ _timeout_handle: number | undefined; ++ _timeout_target: string | undefined; ++ _timeout_target_time: number | undefined; ++ constructor({ start_states, end_states, initial_state, start_states_no_enforce, complete, transitions, machine_author, machine_comment, machine_contributor, machine_definition, machine_language, machine_license, machine_name, machine_version, state_declaration, property_definition, state_property, fsl_version, dot_preamble, arrange_declaration, arrange_start_declaration, arrange_end_declaration, theme, flow, graph_layout, instance_name, history, data, default_state_config, default_active_state_config, default_hooked_state_config, default_terminal_state_config, default_start_state_config, default_end_state_config, allows_override, config_allows_override, rng_seed, time_source, timeout_source, clear_timeout_source }: JssmGenericConfig); ++ /******** ++ * ++ * Internal method for fabricating states. Not meant for external use. ++ * ++ * @internal ++ * ++ */ ++ _new_state(state_config: JssmGenericState): StateType; ++ /********* ++ * ++ * Get the current state of a machine. ++ * ++ * ```typescript ++ * import * as jssm from 'jssm'; ++ * ++ * const lswitch = jssm.from('on <=> off;'); ++ * console.log( lswitch.state() ); // 'on' ++ * ++ * lswitch.transition('off'); ++ * console.log( lswitch.state() ); // 'off' ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ */ ++ state(): StateType; ++ /********* ++ * ++ * Get the label for a given state, if any; return `undefined` otherwise. ++ * ++ * ```typescript ++ * import * as jssm from 'jssm'; ++ * ++ * const lswitch = jssm.from('a -> b; state a: { label: "Foo!"; };'); ++ * console.log( lswitch.label_for('a') ); // 'Foo!' ++ * console.log( lswitch.label_for('b') ); // undefined ++ * ``` ++ * ++ * See also {@link display_text}. ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ */ ++ label_for(state: StateType): string; ++ /********* ++ * ++ * Get whatever the node should show as text. ++ * ++ * Currently, this means to get the label for a given state, if any; ++ * otherwise to return the node's name. However, this definition is expected ++ * to grow with time, and it is currently considered ill-advised to manually ++ * parse this text. ++ * ++ * See also {@link label_for}. ++ * ++ * ```typescript ++ * import * as jssm from 'jssm'; ++ * ++ * const lswitch = jssm.from('a -> b; state a: { label: "Foo!"; };'); ++ * console.log( lswitch.display_text('a') ); // 'Foo!' ++ * console.log( lswitch.display_text('b') ); // 'b' ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ */ ++ display_text(state: StateType): string; ++ /********* ++ * ++ * Get the current data of a machine. ++ * ++ * ```typescript ++ * import * as jssm from 'jssm'; ++ * ++ * const lswitch = jssm.from('on <=> off;', {data: 1}); ++ * console.log( lswitch.data() ); // 1 ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ */ ++ data(): mDT; ++ /********* ++ * ++ * Get the current value of a given property name. ++ * ++ * ```typescript ++ * ++ * ``` ++ * ++ * @param name The relevant property name to look up ++ * ++ * @returns The value behind the prop name. Because functional props are ++ * evaluated as getters, this can be anything. ++ * ++ */ ++ prop(name: string): any; ++ /********* ++ * ++ * Get the current value of a given property name. If missing on the state ++ * and without a global default, throw, unlike {@link prop}, which would ++ * return `undefined` instead. ++ * ++ * ```typescript ++ * ++ * ``` ++ * ++ * @param name The relevant property name to look up ++ * ++ * @returns The value behind the prop name. Because functional props are ++ * evaluated as getters, this can be anything. ++ * ++ */ ++ strict_prop(name: string): any; ++ /********* ++ * ++ * Get the current value of every prop, as an object. If no current definition ++ * exists for a prop - that is, if the prop was defined without a default and ++ * the current state also doesn't define the prop - then that prop will be listed ++ * in the returned object with a value of `undefined`. ++ * ++ * ```typescript ++ * const traffic_light = sm` ++ * ++ * property can_go default true; ++ * property hesitate default true; ++ * property stop_first default false; ++ * ++ * Off -> Red => Green => Yellow => Red; ++ * [Red Yellow Green] ~> [Off FlashingRed]; ++ * FlashingRed -> Red; ++ * ++ * state Red: { property stop_first true; property can_go false; }; ++ * state Off: { property stop_first true; }; ++ * state FlashingRed: { property stop_first true; }; ++ * state Green: { property hesitate false; }; ++ * ++ * `; ++ * ++ * traffic_light.state(); // Off ++ * traffic_light.props(); // { can_go: true, hesitate: true, stop_first: true; } ++ * ++ * traffic_light.go('Red'); ++ * traffic_light.props(); // { can_go: false, hesitate: true, stop_first: true; } ++ * ++ * traffic_light.go('Green'); ++ * traffic_light.props(); // { can_go: true, hesitate: false, stop_first: false; } ++ * ``` ++ * ++ */ ++ props(): object; ++ /********* ++ * ++ * Get the current value of every prop, as an object. Compare ++ * {@link prop_map}, which returns a `Map`. ++ * ++ * ```typescript ++ * ++ * ``` ++ * ++ */ ++ /********* ++ * ++ * Get the current value of every prop, as an object. Compare ++ * {@link prop_map}, which returns a `Map`. Akin to {@link strict_prop}, ++ * this throws if a required prop is missing. ++ * ++ * ```typescript ++ * ++ * ``` ++ * ++ */ ++ /********* ++ * ++ * Check whether a given string is a known property's name. ++ * ++ * ```typescript ++ * const example = sm`property foo default 1; a->b;`; ++ * ++ * example.known_prop('foo'); // true ++ * example.known_prop('bar'); // false ++ * ``` ++ * ++ * @param prop_name The relevant property name to look up ++ * ++ */ ++ known_prop(prop_name: string): boolean; ++ /********* ++ * ++ * List all known property names. If you'd also like values, use ++ * {@link props} instead. The order of the properties is not defined, and ++ * the properties generally will not be sorted. ++ * ++ * ```typescript ++ * ``` ++ * ++ */ ++ known_props(): string[]; ++ /******** ++ * ++ * Check whether a given state is a valid start state (either because it was ++ * explicitly named as such, or because it was the first mentioned state.) ++ * ++ * ```typescript ++ * import { sm, is_start_state } from 'jssm'; ++ * ++ * const example = sm`a -> b;`; ++ * ++ * console.log( final_test.is_start_state('a') ); // true ++ * console.log( final_test.is_start_state('b') ); // false ++ * ++ * const example = sm`start_states: [a b]; a -> b;`; ++ * ++ * console.log( final_test.is_start_state('a') ); // true ++ * console.log( final_test.is_start_state('b') ); // true ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ * @param whichState The name of the state to check ++ * ++ */ ++ is_start_state(whichState: StateType): boolean; ++ /******** ++ * ++ * Check whether a given state is a valid start state (either because it was ++ * explicitly named as such, or because it was the first mentioned state.) ++ * ++ * ```typescript ++ * import { sm, is_end_state } from 'jssm'; ++ * ++ * const example = sm`a -> b;`; ++ * ++ * console.log( final_test.is_start_state('a') ); // false ++ * console.log( final_test.is_start_state('b') ); // true ++ * ++ * const example = sm`end_states: [a b]; a -> b;`; ++ * ++ * console.log( final_test.is_start_state('a') ); // true ++ * console.log( final_test.is_start_state('b') ); // true ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ * @param whichState The name of the state to check ++ * ++ */ ++ is_end_state(whichState: StateType): boolean; ++ /******** ++ * ++ * Check whether a given state is final (either has no exits or is marked ++ * `complete`.) ++ * ++ * ```typescript ++ * import { sm, state_is_final } from 'jssm'; ++ * ++ * const final_test = sm`first -> second;`; ++ * ++ * console.log( final_test.state_is_final('first') ); // false ++ * console.log( final_test.state_is_final('second') ); // true ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ * @param whichState The name of the state to check for finality ++ * ++ */ ++ state_is_final(whichState: StateType): boolean; ++ /******** ++ * ++ * Check whether the current state is final (either has no exits or is marked ++ * `complete`.) ++ * ++ * ```typescript ++ * import { sm, is_final } from 'jssm'; ++ * ++ * const final_test = sm`first -> second;`; ++ * ++ * console.log( final_test.is_final() ); // false ++ * state.transition('second'); ++ * console.log( final_test.is_final() ); // true ++ * ``` ++ * ++ */ ++ is_final(): boolean; ++ /******** ++ * ++ * Serialize the current machine, including all defining state but not the ++ * machine string, to a structure. This means you will need the machine ++ * string to recreate (to not waste repeated space;) if you want the machine ++ * string embedded, call {@link serialize_with_string} instead. ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ */ ++ serialize(comment?: string | undefined): JssmSerialization; ++ graph_layout(): string; ++ dot_preamble(): string; ++ machine_author(): Array; ++ machine_comment(): string; ++ machine_contributor(): Array; ++ machine_definition(): string; ++ machine_language(): string; ++ machine_license(): string; ++ machine_name(): string; ++ machine_version(): string; ++ raw_state_declarations(): Array; ++ state_declaration(which: StateType): JssmStateDeclaration; ++ state_declarations(): Map; ++ fsl_version(): string; ++ machine_state(): JssmMachineInternalState; ++ /********* ++ * ++ * List all the states known by the machine. Please note that the order of ++ * these states is not guaranteed. ++ * ++ * ```typescript ++ * import * as jssm from 'jssm'; ++ * ++ * const lswitch = jssm.from('on <=> off;'); ++ * console.log( lswitch.states() ); // ['on', 'off'] ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ */ ++ states(): Array; ++ state_for(whichState: StateType): JssmGenericState; ++ /********* ++ * ++ * Check whether the machine knows a given state. ++ * ++ * ```typescript ++ * import * as jssm from 'jssm'; ++ * ++ * const lswitch = jssm.from('on <=> off;'); ++ * ++ * console.log( lswitch.has_state('off') ); // true ++ * console.log( lswitch.has_state('dance') ); // false ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ * @param whichState The state to be checked for extance ++ * ++ */ ++ has_state(whichState: StateType): boolean; ++ /********* ++ * ++ * Lists all edges of a machine. ++ * ++ * ```typescript ++ * import { sm } from 'jssm'; ++ * ++ * const lswitch = sm`on 'toggle' <=> 'toggle' off;`; ++ * ++ * lswitch.list_edges(); ++ * [ ++ * { ++ * from: 'on', ++ * to: 'off', ++ * kind: 'main', ++ * forced_only: false, ++ * main_path: true, ++ * action: 'toggle' ++ * }, ++ * { ++ * from: 'off', ++ * to: 'on', ++ * kind: 'main', ++ * forced_only: false, ++ * main_path: true, ++ * action: 'toggle' ++ * } ++ * ] ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ */ ++ list_edges(): Array>; ++ list_named_transitions(): Map; ++ list_actions(): Array; ++ get uses_actions(): boolean; ++ get uses_forced_transitions(): boolean; ++ /********* ++ * ++ * Check if the code that built the machine allows overriding state and data. ++ * ++ */ ++ get code_allows_override(): JssmAllowsOverride; ++ /********* ++ * ++ * Check if the machine config allows overriding state and data. ++ * ++ */ ++ get config_allows_override(): JssmAllowsOverride; ++ /********* ++ * ++ * Check if a machine allows overriding state and data. ++ * ++ */ ++ get allows_override(): JssmAllowsOverride; ++ all_themes(): FslTheme[]; ++ get themes(): FslTheme | FslTheme[]; ++ set themes(to: FslTheme | FslTheme[]); ++ flow(): FslDirection; ++ get_transition_by_state_names(from: StateType, to: StateType): number; ++ lookup_transition_for(from: StateType, to: StateType): JssmTransition; ++ /******** ++ * ++ * List all transitions attached to the current state, sorted by entrance and ++ * exit. The order of each sublist is not defined. A node could appear in ++ * both lists. ++ * ++ * ```typescript ++ * import { sm } from 'jssm'; ++ * ++ * const light = sm`red 'next' -> green 'next' -> yellow 'next' -> red; [red yellow green] 'shutdown' ~> off 'start' -> red;`; ++ * ++ * light.state(); // 'red' ++ * light.list_transitions(); // { entrances: [ 'yellow', 'off' ], exits: [ 'green', 'off' ] } ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ * @param whichState The state whose transitions to have listed ++ * ++ */ ++ list_transitions(whichState?: StateType): JssmTransitionList; ++ /******** ++ * ++ * List all entrances attached to the current state. Please note that the ++ * order of the list is not defined. This list includes both unforced and ++ * forced entrances; if this isn't desired, consider ++ * {@link list_unforced_entrances} or {@link list_forced_entrances} as ++ * appropriate. ++ * ++ * ```typescript ++ * import { sm } from 'jssm'; ++ * ++ * const light = sm`red 'next' -> green 'next' -> yellow 'next' -> red; [red yellow green] 'shutdown' ~> off 'start' -> red;`; ++ * ++ * light.state(); // 'red' ++ * light.list_entrances(); // [ 'yellow', 'off' ] ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ * @param whichState The state whose entrances to have listed ++ * ++ */ ++ list_entrances(whichState?: StateType): Array; ++ /******** ++ * ++ * List all exits attached to the current state. Please note that the order ++ * of the list is not defined. This list includes both unforced and forced ++ * exits; if this isn't desired, consider {@link list_unforced_exits} or ++ * {@link list_forced_exits} as appropriate. ++ * ++ * ```typescript ++ * import { sm } from 'jssm'; ++ * ++ * const light = sm`red 'next' -> green 'next' -> yellow 'next' -> red; [red yellow green] 'shutdown' ~> off 'start' -> red;`; ++ * ++ * light.state(); // 'red' ++ * light.list_exits(); // [ 'green', 'off' ] ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ * @param whichState The state whose exits to have listed ++ * ++ */ ++ list_exits(whichState?: StateType): Array; ++ probable_exits_for(whichState: StateType): Array>; ++ probabilistic_transition(): boolean; ++ probabilistic_walk(n: number): Array; ++ probabilistic_histo_walk(n: number): Map; ++ /******** ++ * ++ * List all actions available from this state. Please note that the order of ++ * the actions is not guaranteed. ++ * ++ * ```typescript ++ * import { sm } from 'jssm'; ++ * ++ * const machine = sm` ++ * red 'next' -> green 'next' -> yellow 'next' -> red; ++ * [red yellow green] 'shutdown' ~> off 'start' -> red; ++ * `; ++ * ++ * console.log( machine.state() ); // logs 'red' ++ * console.log( machine.actions() ); // logs ['next', 'shutdown'] ++ * ++ * machine.action('next'); // true ++ * console.log( machine.state() ); // logs 'green' ++ * console.log( machine.actions() ); // logs ['next', 'shutdown'] ++ * ++ * machine.action('shutdown'); // true ++ * console.log( machine.state() ); // logs 'off' ++ * console.log( machine.actions() ); // logs ['start'] ++ * ++ * machine.action('start'); // true ++ * console.log( machine.state() ); // logs 'red' ++ * console.log( machine.actions() ); // logs ['next', 'shutdown'] ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ * @param whichState The state whose actions to have listed ++ * ++ */ ++ actions(whichState?: StateType): Array; ++ /******** ++ * ++ * List all states that have a specific action attached. Please note that ++ * the order of the states is not guaranteed. ++ * ++ * ```typescript ++ * import { sm } from 'jssm'; ++ * ++ * const machine = sm` ++ * red 'next' -> green 'next' -> yellow 'next' -> red; ++ * [red yellow green] 'shutdown' ~> off 'start' -> red; ++ * `; ++ * ++ * console.log( machine.list_states_having_action('next') ); // ['red', 'green', 'yellow'] ++ * console.log( machine.list_states_having_action('start') ); // ['off'] ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ * @param whichState The action to be checked for associated states ++ * ++ */ ++ list_states_having_action(whichState: StateType): Array; ++ list_exit_actions(whichState?: StateType): Array; ++ probable_action_exits(whichState?: StateType): Array; ++ is_unenterable(whichState: StateType): boolean; ++ has_unenterables(): boolean; ++ is_terminal(): boolean; ++ state_is_terminal(whichState: StateType): boolean; ++ has_terminals(): boolean; ++ is_complete(): boolean; ++ state_is_complete(whichState: StateType): boolean; ++ has_completes(): boolean; ++ set_hook(HookDesc: HookDescription): void; ++ hook(from: string, to: string, handler: HookHandler): Machine; ++ hook_action(from: string, to: string, action: string, handler: HookHandler): Machine; ++ hook_global_action(action: string, handler: HookHandler): Machine; ++ hook_any_action(handler: HookHandler): Machine; ++ hook_standard_transition(handler: HookHandler): Machine; ++ hook_main_transition(handler: HookHandler): Machine; ++ hook_forced_transition(handler: HookHandler): Machine; ++ hook_any_transition(handler: HookHandler): Machine; ++ hook_entry(to: string, handler: HookHandler): Machine; ++ hook_exit(from: string, handler: HookHandler): Machine; ++ post_hook(from: string, to: string, handler: HookHandler): Machine; ++ post_hook_action(from: string, to: string, action: string, handler: HookHandler): Machine; ++ post_hook_global_action(action: string, handler: HookHandler): Machine; ++ post_hook_any_action(handler: HookHandler): Machine; ++ post_hook_standard_transition(handler: HookHandler): Machine; ++ post_hook_main_transition(handler: HookHandler): Machine; ++ post_hook_forced_transition(handler: HookHandler): Machine; ++ post_hook_any_transition(handler: HookHandler): Machine; ++ post_hook_entry(to: string, handler: HookHandler): Machine; ++ post_hook_exit(from: string, handler: HookHandler): Machine; ++ get rng_seed(): number; ++ set rng_seed(to: number | undefined); ++ edges_between(from: string, to: string): JssmTransition[]; ++ /********* ++ * ++ * Replace the current state and data with no regard to the graph. ++ * ++ * ```typescript ++ * import { sm } from 'jssm'; ++ * ++ * const machine = sm`a -> b -> c;`; ++ * console.log( machine.state() ); // 'a' ++ * ++ * machine.go('b'); ++ * machine.go('c'); ++ * console.log( machine.state() ); // 'c' ++ * ++ * machine.override('a'); ++ * console.log( machine.state() ); // 'a' ++ * ``` ++ * ++ */ ++ override(newState: StateType, newData?: mDT | undefined): void; ++ transition_impl(newStateOrAction: StateType, newData: mDT | undefined, wasForced: boolean, wasAction: boolean): boolean; ++ auto_set_state_timeout(): void; ++ /********* ++ * ++ * Get a truncated history of the recent states and data of the machine. ++ * Turned off by default; configure with `.from('...', {data: 5})` by length, ++ * or set `.history_length` at runtime. ++ * ++ * History *does not contain the current state*. If you want that, call ++ * `.history_inclusive` instead. ++ * ++ * ```typescript ++ * const foo = jssm.from( ++ * "a 'next' -> b 'next' -> c 'next' -> d 'next' -> e;", ++ * { history: 3 } ++ * ); ++ * ++ * foo.action('next'); ++ * foo.action('next'); ++ * foo.action('next'); ++ * foo.action('next'); ++ * ++ * foo.history; // [ ['b',undefined], ['c',undefined], ['d',undefined] ] ++ * ``` ++ * ++ * Notice that the machine's current state, `e`, is not in the returned list. ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ */ ++ get history(): [string, mDT][]; ++ /********* ++ * ++ * Get a truncated history of the recent states and data of the machine, ++ * including the current state. Turned off by default; configure with ++ * `.from('...', {data: 5})` by length, or set `.history_length` at runtime. ++ * ++ * History inclusive contains the current state. If you only want past ++ * states, call `.history` instead. ++ * ++ * The list returned will be one longer than the history buffer kept, as the ++ * history buffer kept gets the current state added to it to produce this ++ * list. ++ * ++ * ```typescript ++ * const foo = jssm.from( ++ * "a 'next' -> b 'next' -> c 'next' -> d 'next' -> e;", ++ * { history: 3 } ++ * ); ++ * ++ * foo.action('next'); ++ * foo.action('next'); ++ * foo.action('next'); ++ * foo.action('next'); ++ * ++ * foo.history_inclusive; // [ ['b',undefined], ['c',undefined], ['d',undefined], ['e',undefined] ] ++ * ``` ++ * ++ * Notice that the machine's current state, `e`, is in the returned list. ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ */ ++ get history_inclusive(): [string, mDT][]; ++ /********* ++ * ++ * Find out how long a history this machine is keeping. Defaults to zero. ++ * Settable directly. ++ * ++ * ```typescript ++ * const foo = jssm.from("a -> b;"); ++ * foo.history_length; // 0 ++ * ++ * const bar = jssm.from("a -> b;", { history: 3 }); ++ * foo.history_length; // 3 ++ * foo.history_length = 5; ++ * foo.history_length; // 5 ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ */ ++ get history_length(): number; ++ set history_length(to: number); ++ /******** ++ * ++ * Instruct the machine to complete an action. Synonym for {@link do}. ++ * ++ * ```typescript ++ * const light = sm`red 'next' -> green 'next' -> yellow 'next' -> red; [red yellow green] 'shutdown' ~> off 'start' -> red;`; ++ * ++ * light.state(); // 'red' ++ * light.action('next'); // true ++ * light.state(); // 'green' ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ * @param actionName The action to engage ++ * ++ * @param newData The data change to insert during the action ++ * ++ */ ++ action(actionName: StateType, newData?: mDT): boolean; ++ /******** ++ * ++ * Get the standard style for a single state. ***Does not*** include ++ * composition from an applied theme, or things from the underlying base ++ * stylesheet; only the modifications applied by this machine. ++ * ++ * ```typescript ++ * const light = sm`a -> b;`; ++ * console.log(light.standard_state_style); ++ * // {} ++ * ++ * const light = sm`a -> b; state: { shape: circle; };`; ++ * console.log(light.standard_state_style); ++ * // { shape: 'circle' } ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ */ ++ get standard_state_style(): JssmStateConfig; ++ /******** ++ * ++ * Get the hooked state style. ***Does not*** include ++ * composition from an applied theme, or things from the underlying base ++ * stylesheet; only the modifications applied by this machine. ++ * ++ * The hooked style is only applied to nodes which have a named hook in the ++ * graph. Open hooks set through the external API aren't graphed, because ++ * that would be literally every node. ++ * ++ * ```typescript ++ * const light = sm`a -> b;`; ++ * console.log(light.hooked_state_style); ++ * // {} ++ * ++ * const light = sm`a -> b; hooked_state: { shape: circle; };`; ++ * console.log(light.hooked_state_style); ++ * // { shape: 'circle' } ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ */ ++ get hooked_state_style(): JssmStateConfig; ++ /******** ++ * ++ * Get the start state style. ***Does not*** include composition from an ++ * applied theme, or things from the underlying base stylesheet; only the ++ * modifications applied by this machine. ++ * ++ * Start states are defined by the directive `start_states`, or in absentia, ++ * are the first mentioned state. ++ * ++ * ```typescript ++ * const light = sm`a -> b;`; ++ * console.log(light.start_state_style); ++ * // {} ++ * ++ * const light = sm`a -> b; start_state: { shape: circle; };`; ++ * console.log(light.start_state_style); ++ * // { shape: 'circle' } ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ */ ++ get start_state_style(): JssmStateConfig; ++ /******** ++ * ++ * Get the end state style. ***Does not*** include ++ * composition from an applied theme, or things from the underlying base ++ * stylesheet; only the modifications applied by this machine. ++ * ++ * End states are defined in the directive `end_states`, and are distinct ++ * from terminal states. End states are voluntary successful endpoints for a ++ * process. Terminal states are states that cannot be exited. By example, ++ * most error states are terminal states, but not end states. Also, since ++ * some end states can be exited and are determined by hooks, such as ++ * recursive or iterative nodes, there is such a thing as an end state that ++ * is not a terminal state. ++ * ++ * ```typescript ++ * const light = sm`a -> b;`; ++ * console.log(light.standard_state_style); ++ * // {} ++ * ++ * const light = sm`a -> b; end_state: { shape: circle; };`; ++ * console.log(light.standard_state_style); ++ * // { shape: 'circle' } ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ */ ++ get end_state_style(): JssmStateConfig; ++ /******** ++ * ++ * Get the terminal state style. ***Does not*** include ++ * composition from an applied theme, or things from the underlying base ++ * stylesheet; only the modifications applied by this machine. ++ * ++ * Terminal state styles are automatically determined by the machine. Any ++ * state without a valid exit transition is terminal. ++ * ++ * ```typescript ++ * const light = sm`a -> b;`; ++ * console.log(light.terminal_state_style); ++ * // {} ++ * ++ * const light = sm`a -> b; terminal_state: { shape: circle; };`; ++ * console.log(light.terminal_state_style); ++ * // { shape: 'circle' } ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ */ ++ get terminal_state_style(): JssmStateConfig; ++ /******** ++ * ++ * Get the style for the active state. ***Does not*** include ++ * composition from an applied theme, or things from the underlying base ++ * stylesheet; only the modifications applied by this machine. ++ * ++ * ```typescript ++ * const light = sm`a -> b;`; ++ * console.log(light.active_state_style); ++ * // {} ++ * ++ * const light = sm`a -> b; active_state: { shape: circle; };`; ++ * console.log(light.active_state_style); ++ * // { shape: 'circle' } ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ */ ++ get active_state_style(): JssmStateConfig; ++ /******** ++ * ++ * Gets the composite style for a specific node by individually imposing the ++ * style layers on a given object, after determining which layers are ++ * appropriate. ++ * ++ * The order of composition is base, then theme, then user content. Each ++ * item in the stack will be composited independently. First, the base state ++ * style, then the theme state style, then the user state style. ++ * ++ * After the three state styles, we'll composite the hooked styles; then the ++ * terminal styles; then the start styles; then the end styles; finally, the ++ * active styles. Remember, last wins. ++ * ++ * The base state style must exist. All other styles are optional. ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ */ ++ style_for(state: StateType): JssmStateConfig; ++ /******** ++ * ++ * Instruct the machine to complete an action. Synonym for {@link action}. ++ * ++ * ```typescript ++ * const light = sm` ++ * off 'start' -> red; ++ * red 'next' -> green 'next' -> yellow 'next' -> red; ++ * [red yellow green] 'shutdown' ~> off; ++ * `; ++ * ++ * light.state(); // 'off' ++ * light.do('start'); // true ++ * light.state(); // 'red' ++ * light.do('next'); // true ++ * light.state(); // 'green' ++ * light.do('next'); // true ++ * light.state(); // 'yellow' ++ * light.do('dance'); // !! false - no such action ++ * light.state(); // 'yellow' ++ * light.do('start'); // !! false - yellow does not have the action start ++ * light.state(); // 'yellow' ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ * @param actionName The action to engage ++ * ++ * @param newData The data change to insert during the action ++ * ++ */ ++ do(actionName: StateType, newData?: mDT): boolean; ++ /******** ++ * ++ * Instruct the machine to complete a transition. Synonym for {@link go}. ++ * ++ * ```typescript ++ * const light = sm` ++ * off 'start' -> red; ++ * red 'next' -> green 'next' -> yellow 'next' -> red; ++ * [red yellow green] 'shutdown' ~> off; ++ * `; ++ * ++ * light.state(); // 'off' ++ * light.go('red'); // true ++ * light.state(); // 'red' ++ * light.go('green'); // true ++ * light.state(); // 'green' ++ * light.go('blue'); // !! false - no such state ++ * light.state(); // 'green' ++ * light.go('red'); // !! false - green may not go directly to red, only to yellow ++ * light.state(); // 'green' ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ * @param newState The state to switch to ++ * ++ * @param newData The data change to insert during the transition ++ * ++ */ ++ transition(newState: StateType, newData?: mDT): boolean; ++ /******** ++ * ++ * Instruct the machine to complete a transition. Synonym for {@link transition}. ++ * ++ * ```typescript ++ * const light = sm`red -> green -> yellow -> red; [red yellow green] 'shutdown' ~> off 'start' -> red;`; ++ * ++ * light.state(); // 'red' ++ * light.go('green'); // true ++ * light.state(); // 'green' ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ * @param newState The state to switch to ++ * ++ * @param newData The data change to insert during the transition ++ * ++ */ ++ go(newState: StateType, newData?: mDT): boolean; ++ /******** ++ * ++ * Instruct the machine to complete a forced transition (which will reject if ++ * called with a normal {@link transition} call.) ++ * ++ * ```typescript ++ * const light = sm`red -> green -> yellow -> red; [red yellow green] 'shutdown' ~> off 'start' -> red;`; ++ * ++ * light.state(); // 'red' ++ * light.transition('off'); // false ++ * light.state(); // 'red' ++ * light.force_transition('off'); // true ++ * light.state(); // 'off' ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ * @param newState The state to switch to ++ * ++ * @param newData The data change to insert during the transition ++ * ++ */ ++ force_transition(newState: StateType, newData?: mDT): boolean; ++ current_action_for(action: StateType): number; ++ current_action_edge_for(action: StateType): JssmTransition; ++ valid_action(action: StateType, _newData?: mDT): boolean; ++ valid_transition(newState: StateType, _newData?: mDT): boolean; ++ valid_force_transition(newState: StateType, _newData?: mDT): boolean; ++ instance_name(): string | undefined; ++ get creation_date(): Date; ++ get creation_timestamp(): number; ++ get create_start_time(): number; ++ set_state_timeout(next_state: StateType, after_time: number): void; ++ clear_state_timeout(): void; ++ state_timeout_for(which_state: StateType): [StateType, number] | undefined; ++ current_state_timeout(): [StateType, number] | undefined; ++ sm(template_strings: TemplateStringsArray, ...remainder: any[]): Machine; ++} ++/********* ++ * ++ * Create a state machine from a template string. This is one of the two main ++ * paths for working with JSSM, alongside {@link from}. ++ * ++ * Use this method when you want to work directly and conveniently with a ++ * constant template expression. Use `.from` when you want to pull from ++ * dynamic strings. ++ * ++ * ++ * ```typescript ++ * import * as jssm from 'jssm'; ++ * ++ * const lswitch = jssm.from('on <=> off;'); ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ * @param template_strings The assembled code ++ * ++ * @param remainder The mechanic for template argument insertion ++ * ++ */ ++declare function sm(template_strings: TemplateStringsArray, ...remainder: any[]): Machine; ++/********* ++ * ++ * Create a state machine from an implementation string. This is one of the ++ * two main paths for working with JSSM, alongside {@link sm}. ++ * ++ * Use this method when you want to conveniently pull a state machine from a ++ * string dynamically. Use operator `sm` when you just want to work with a ++ * template expression. ++ * ++ * ```typescript ++ * import * as jssm from 'jssm'; ++ * ++ * const lswitch = jssm.from('on <=> off;'); ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ * @param MachineAsString The FSL code to evaluate ++ * ++ * @param ExtraConstructorFields Extra non-code configuration to pass at creation time ++ * ++ */ ++declare function from(MachineAsString: string, ExtraConstructorFields?: Partial> | undefined): Machine; ++declare function is_hook_complex_result(hr: unknown): hr is HookComplexResult; ++declare function is_hook_rejection(hr: HookResult): boolean; ++declare function abstract_hook_step(maybe_hook: HookHandler | undefined, hook_args: HookContext): HookComplexResult; ++declare function deserialize(machine_string: string, ser: JssmSerialization): Machine; ++ ++export { FslDirections, Machine, abstract_hook_step, arrow_direction, arrow_left_kind, arrow_right_kind, build_time, compile, jssm_constants_d as constants, deserialize, find_repeated, from, gviz_shapes, histograph, is_hook_complex_result, is_hook_rejection, make, named_colors, wrap_parse as parse, seq, shapes, sm, state_style_condense, transfer_state_properties, unique, version, weighted_histo_key, weighted_rand_select, weighted_sample_select }; +diff --git a/jssm.es6.d.ts b/jssm.es6.d.ts +new file mode 100644 +index 0000000000000000000000000000000000000000..4b3029395beb581aa74e8e8450432acb0f3aa0e4 +--- /dev/null ++++ b/jssm.es6.d.ts +@@ -0,0 +1,1758 @@ ++import { circular_buffer } from 'circular_buffer_js'; ++ ++declare type StateType$1 = string; /** Composite type composing whether or not a result was successful */ ++declare type JssmColor = string; ++declare type JssmPermittedOpt = 'required' | 'disallowed' | 'optional'; ++declare type JssmArrow = '->' | '<-' | '<->' | '<=->' | '<~->' | '=>' | '<=' | '<=>' | '<-=>' | '<~=>' | '~>' | '<~' | '<~>' | '<-~>' | '<=~>'; ++/** ++ * A type teaching Typescript the various supported shapes for nodes, mostly inherited from GraphViz ++ */ ++declare type JssmShape = "box" | "polygon" | "ellipse" | "oval" | "circle" | "point" | "egg" | "triangle" | "plaintext" | "plain" | "diamond" | "trapezium" | "parallelogram" | "house" | "pentagon" | "hexagon" | "septagon" | "octagon" | "doublecircle" | "doubleoctagon" | "tripleoctagon" | "invtriangle" | "invtrapezium" | "invhouse" | "Mdiamond" | "Msquare" | "Mcircle" | "rect" | "rectangle" | "square" | "star" | "none" | "underline" | "cylinder" | "note" | "tab" | "folder" | "box3d" | "component" | "promoter" | "cds" | "terminator" | "utr" | "primersite" | "restrictionsite" | "fivepoverhang" | "threepoverhang" | "noverhang" | "assembly" | "signature" | "insulator" | "ribosite" | "rnastab" | "proteasesite" | "proteinstab" | "rpromoter" | "rarrow" | "larrow" | "lpromoter" | "record"; ++declare type JssmArrowDirection = 'left' | 'right' | 'both'; ++declare type JssmArrowKind = 'none' | 'legal' | 'main' | 'forced'; ++declare type JssmLayout = 'dot' | 'circo' | 'twopi' | 'fdp'; ++declare type JssmCorner = 'regular' | 'rounded' | 'lined'; ++declare type JssmLineStyle = 'solid' | 'dashed' | 'dotted'; ++declare type JssmAllowsOverride = true | false | undefined; ++declare const FslDirections: readonly ["up", "right", "down", "left"]; ++declare type FslDirection = typeof FslDirections[number]; ++declare const FslThemes: readonly ["default", "ocean", "modern", "plain", "bold"]; ++declare type FslTheme = typeof FslThemes[number]; ++declare type JssmSerialization = { ++ jssm_version: string; ++ timestamp: number; ++ comment?: string | undefined; ++ state: StateType$1; ++ history: [string, DataType][]; ++ history_capacity: number; ++ data: DataType; ++}; ++declare type JssmPropertyDefinition = { ++ name: string; ++ default_value?: any; ++ required?: boolean; ++}; ++declare type JssmTransitionPermitter = (OldState: StateType$1, NewState: StateType$1, OldData: DataType, NewData: DataType) => boolean; ++declare type JssmTransitionPermitterMaybeArray = JssmTransitionPermitter | Array>; ++declare type JssmTransition = { ++ from: StateType; ++ to: StateType; ++ after_time?: number; ++ se?: JssmCompileSe; ++ name?: StateType; ++ action?: StateType; ++ check?: JssmTransitionPermitterMaybeArray; ++ probability?: number; ++ kind: JssmArrowKind; ++ forced_only: boolean; ++ main_path: boolean; ++}; ++declare type JssmTransitions = JssmTransition[]; ++declare type JssmTransitionList = { ++ entrances: Array; ++ exits: Array; ++}; ++declare type JssmGenericState = { ++ from: Array; ++ name: StateType$1; ++ to: Array; ++ complete: boolean; ++}; ++declare type JssmMachineInternalState = { ++ internal_state_impl_version: 1; ++ state: StateType$1; ++ states: Map; ++ named_transitions: Map; ++ edge_map: Map>; ++ actions: Map>; ++ reverse_actions: Map>; ++ edges: Array>; ++}; ++declare type JssmStatePermitter = (OldState: StateType$1, NewState: StateType$1, OldData: DataType, NewData: DataType) => boolean; ++declare type JssmStatePermitterMaybeArray = JssmStatePermitter | Array>; ++declare type JssmStateDeclarationRule = { ++ key: string; ++ value: any; ++ name?: string; ++}; ++declare type JssmStateDeclaration = { ++ declarations: Array; ++ shape?: JssmShape; ++ color?: JssmColor; ++ corners?: JssmCorner; ++ lineStyle?: JssmLineStyle; ++ stateLabel?: string; ++ textColor?: JssmColor; ++ backgroundColor?: JssmColor; ++ borderColor?: JssmColor; ++ state: StateType$1; ++ property?: { ++ name: string; ++ value: unknown; ++ }; ++}; ++declare type JssmStateConfig = Partial; ++declare type JssmStateStyleShape = { ++ key: 'shape'; ++ value: JssmShape; ++}; ++declare type JssmStateStyleColor = { ++ key: 'color'; ++ value: JssmColor; ++}; ++declare type JssmStateStyleTextColor = { ++ key: 'text-color'; ++ value: JssmColor; ++}; ++declare type JssmStateStyleCorners = { ++ key: 'corners'; ++ value: JssmCorner; ++}; ++declare type JssmStateStyleLineStyle = { ++ key: 'line-style'; ++ value: JssmLineStyle; ++}; ++declare type JssmStateStyleStateLabel = { ++ key: 'state-label'; ++ value: string; ++}; ++declare type JssmStateStyleBackgroundColor = { ++ key: 'background-color'; ++ value: JssmColor; ++}; ++declare type JssmStateStyleBorderColor = { ++ key: 'border-color'; ++ value: JssmColor; ++}; ++declare type JssmStateStyleKey = JssmStateStyleShape | JssmStateStyleColor | JssmStateStyleTextColor | JssmStateStyleCorners | JssmStateStyleLineStyle | JssmStateStyleBackgroundColor | JssmStateStyleStateLabel | JssmStateStyleBorderColor; ++declare type JssmStateStyleKeyList = JssmStateStyleKey[]; ++declare type JssmGenericConfig = { ++ graph_layout?: JssmLayout; ++ complete?: Array; ++ transitions: JssmTransitions; ++ theme?: FslTheme[]; ++ flow?: FslDirection; ++ name?: string; ++ data?: DataType; ++ nodes?: Array; ++ check?: JssmStatePermitterMaybeArray; ++ history?: number; ++ min_exits?: number; ++ max_exits?: number; ++ allow_islands?: false; ++ allow_force?: false; ++ actions?: JssmPermittedOpt; ++ simplify_bidi?: boolean; ++ allows_override?: JssmAllowsOverride; ++ config_allows_override?: JssmAllowsOverride; ++ dot_preamble?: string; ++ start_states: Array; ++ end_states?: Array; ++ initial_state?: StateType; ++ start_states_no_enforce?: boolean; ++ state_declaration?: Object[]; ++ property_definition?: JssmPropertyDefinition[]; ++ state_property?: JssmPropertyDefinition[]; ++ arrange_declaration?: Array>; ++ arrange_start_declaration?: Array>; ++ arrange_end_declaration?: Array>; ++ machine_author?: string | Array; ++ machine_comment?: string; ++ machine_contributor?: string | Array; ++ machine_definition?: string; ++ machine_language?: string; ++ machine_license?: string; ++ machine_name?: string; ++ machine_version?: string; ++ fsl_version?: string; ++ auto_api?: boolean | string; ++ instance_name?: string | undefined; ++ default_state_config?: JssmStateStyleKeyList; ++ default_start_state_config?: JssmStateStyleKeyList; ++ default_end_state_config?: JssmStateStyleKeyList; ++ default_hooked_state_config?: JssmStateStyleKeyList; ++ default_terminal_state_config?: JssmStateStyleKeyList; ++ default_active_state_config?: JssmStateStyleKeyList; ++ rng_seed?: number | undefined; ++ time_source?: () => number; ++ timeout_source?: (Function: any, number: any) => number; ++ clear_timeout_source?: (number: any) => void; ++}; ++declare type JssmCompileSe = { ++ to: StateType; ++ se?: JssmCompileSe; ++ kind: JssmArrow; ++ l_action?: StateType; ++ r_action?: StateType; ++ l_probability: number; ++ r_probability: number; ++ l_after?: number; ++ r_after?: number; ++}; ++declare type JssmCompileSeStart = { ++ from: StateType; ++ se: JssmCompileSe; ++ key: string; ++ value?: string | number; ++ name?: string; ++ state?: string; ++ default_value?: any; ++ required?: boolean; ++}; ++declare type JssmParseTree = Array>; ++declare type BasicHookDescription = { ++ kind: 'hook'; ++ from: string; ++ to: string; ++ handler: HookHandler; ++}; ++declare type HookDescriptionWithAction = { ++ kind: 'named'; ++ from: string; ++ to: string; ++ action: string; ++ handler: HookHandler; ++}; ++declare type StandardTransitionHook = { ++ kind: 'standard transition'; ++ handler: HookHandler; ++}; ++declare type MainTransitionHook = { ++ kind: 'main transition'; ++ handler: HookHandler; ++}; ++declare type ForcedTransitionHook = { ++ kind: 'forced transition'; ++ handler: HookHandler; ++}; ++declare type AnyTransitionHook = { ++ kind: 'any transition'; ++ handler: HookHandler; ++}; ++declare type GlobalActionHook = { ++ kind: 'global action'; ++ action: string; ++ handler: HookHandler; ++}; ++declare type AnyActionHook = { ++ kind: 'any action'; ++ handler: HookHandler; ++}; ++declare type EntryHook = { ++ kind: 'entry'; ++ to: string; ++ handler: HookHandler; ++}; ++declare type ExitHook = { ++ kind: 'exit'; ++ from: string; ++ handler: HookHandler; ++}; ++declare type PostBasicHookDescription = { ++ kind: 'post hook'; ++ from: string; ++ to: string; ++ handler: PostHookHandler; ++}; ++declare type PostHookDescriptionWithAction = { ++ kind: 'post named'; ++ from: string; ++ to: string; ++ action: string; ++ handler: PostHookHandler; ++}; ++declare type PostStandardTransitionHook = { ++ kind: 'post standard transition'; ++ handler: PostHookHandler; ++}; ++declare type PostMainTransitionHook = { ++ kind: 'post main transition'; ++ handler: PostHookHandler; ++}; ++declare type PostForcedTransitionHook = { ++ kind: 'post forced transition'; ++ handler: PostHookHandler; ++}; ++declare type PostAnyTransitionHook = { ++ kind: 'post any transition'; ++ handler: PostHookHandler; ++}; ++declare type PostGlobalActionHook = { ++ kind: 'post global action'; ++ action: string; ++ handler: PostHookHandler; ++}; ++declare type PostAnyActionHook = { ++ kind: 'post any action'; ++ handler: PostHookHandler; ++}; ++declare type PostEntryHook = { ++ kind: 'post entry'; ++ to: string; ++ handler: PostHookHandler; ++}; ++declare type PostExitHook = { ++ kind: 'post exit'; ++ from: string; ++ handler: PostHookHandler; ++}; ++declare type HookDescription = BasicHookDescription | HookDescriptionWithAction | GlobalActionHook | AnyActionHook | StandardTransitionHook | MainTransitionHook | ForcedTransitionHook | AnyTransitionHook | EntryHook | ExitHook | PostBasicHookDescription | PostHookDescriptionWithAction | PostGlobalActionHook | PostAnyActionHook | PostStandardTransitionHook | PostMainTransitionHook | PostForcedTransitionHook | PostAnyTransitionHook | PostEntryHook | PostExitHook; ++declare type HookComplexResult = { ++ pass: boolean; ++ state?: StateType$1; ++ data?: mDT; ++ next_data?: mDT; ++}; ++declare type HookResult = true | false | undefined | void | HookComplexResult; /** Documents whether a hook succeeded, either with a primitive or a reference to the hook complex object */ ++declare type HookContext = { ++ data: mDT; ++ next_data: mDT; ++}; ++declare type HookHandler = (hook_context: HookContext) => HookResult; ++declare type PostHookHandler = (hook_context: HookContext) => void; ++declare type JssmHistory = circular_buffer<[StateType$1, mDT]>; ++declare type JssmRng = () => number; ++ ++/********* ++ * ++ * Return the direction of an arrow - `right`, `left`, or `both`. ++ * ++ * ```typescript ++ * import { arrow_direction } from 'jssm'; ++ * ++ * arrow_direction('->'); // 'right' ++ * arrow_direction('<~=>'); // 'both' ++ * ``` ++ * ++ * @param arrow The arrow to be evaluated ++ * ++ */ ++declare function arrow_direction(arrow: JssmArrow): JssmArrowDirection; ++/********* ++ * ++ * Return the direction of an arrow - `right`, `left`, or `both`. ++ * ++ * ```typescript ++ * import { arrow_left_kind } from 'jssm'; ++ * ++ * arrow_left_kind('<-'); // 'legal' ++ * arrow_left_kind('<='); // 'main' ++ * arrow_left_kind('<~'); // 'forced' ++ * arrow_left_kind('<->'); // 'legal' ++ * arrow_left_kind('->'); // 'none' ++ * ``` ++ * ++ * @param arrow The arrow to be evaluated ++ * ++ */ ++declare function arrow_left_kind(arrow: JssmArrow): JssmArrowKind; ++/********* ++ * ++ * Return the direction of an arrow - `right`, `left`, or `both`. ++ * ++ * ```typescript ++ * import { arrow_left_kind } from 'jssm'; ++ * ++ * arrow_left_kind('->'); // 'legal' ++ * arrow_left_kind('=>'); // 'main' ++ * arrow_left_kind('~>'); // 'forced' ++ * arrow_left_kind('<->'); // 'legal' ++ * arrow_left_kind('<-'); // 'none' ++ * ``` ++ * ++ * @param arrow The arrow to be evaluated ++ * ++ */ ++declare function arrow_right_kind(arrow: JssmArrow): JssmArrowKind; ++ ++/********* ++ * ++ * This method wraps the parser call that comes from the peg grammar, ++ * {@link parse}. Generally neither this nor that should be used directly ++ * unless you mean to develop plugins or extensions for the machine. ++ * ++ * Parses the intermediate representation of a compiled string down to a ++ * machine configuration object. If you're using this (probably don't,) you're ++ * probably also using {@link compile} and {@link Machine.constructor}. ++ * ++ * ```typescript ++ * import { parse, compile, Machine } from 'jssm'; ++ * ++ * const intermediate = wrap_parse('a -> b;', {}); ++ * // [ {key:'transition', from:'a', se:{kind:'->',to:'b'}} ] ++ * ++ * const cfg = compile(intermediate); ++ * // { start_states:['a'], transitions: [{ from:'a', to:'b', kind:'legal', forced_only:false, main_path:false }] } ++ * ++ * const machine = new Machine(cfg); ++ * // Machine { _instance_name: undefined, _state: 'a', ... ++ * ``` ++ * ++ * This method is mostly for plugin and intermediate tool authors, or people ++ * who need to work with the machine's intermediate representation. ++ * ++ * # Hey! ++ * ++ * Most people looking at this want either the `sm` operator or method `from`, ++ * which perform all the steps in the chain. The library's author mostly uses ++ * operator `sm`, and mostly falls back to `.from` when needing to parse ++ * strings dynamically instead of from template literals. ++ * ++ * Operator {@link sm}: ++ * ++ * ```typescript ++ * import { sm } from 'jssm'; ++ * ++ * const lswitch = sm`on <=> off;`; ++ * ``` ++ * ++ * Method {@link from}: ++ * ++ * ```typescript ++ * import * as jssm from 'jssm'; ++ * ++ * const toggle = jssm.from('up <=> down;'); ++ * ``` ++ * ++ * `wrap_parse` itself is an internal convenience method for alting out an ++ * object as the options call. Not generally meant for external use. ++ * ++ * @param input The FSL code to be evaluated ++ * ++ * @param options Things to control about the instance ++ * ++ */ ++declare function wrap_parse(input: string, options?: Object): any; ++/********* ++ * ++ * Compile a machine's JSON intermediate representation to a config object. If ++ * you're using this (probably don't,) you're probably also using ++ * {@link parse} to get the IR, and the object constructor ++ * {@link Machine.construct} to turn the config object into a workable machine. ++ * ++ * ```typescript ++ * import { parse, compile, Machine } from 'jssm'; ++ * ++ * const intermediate = parse('a -> b;'); ++ * // [ {key:'transition', from:'a', se:{kind:'->',to:'b'}} ] ++ * ++ * const cfg = compile(intermediate); ++ * // { start_states:['a'], transitions: [{ from:'a', to:'b', kind:'legal', forced_only:false, main_path:false }] } ++ * ++ * const machine = new Machine(cfg); ++ * // Machine { _instance_name: undefined, _state: 'a', ... ++ * ``` ++ * ++ * This method is mostly for plugin and intermediate tool authors, or people ++ * who need to work with the machine's intermediate representation. ++ * ++ * # Hey! ++ * ++ * Most people looking at this want either the `sm` operator or method `from`, ++ * which perform all the steps in the chain. The library's author mostly uses ++ * operator `sm`, and mostly falls back to `.from` when needing to parse ++ * strings dynamically instead of from template literals. ++ * ++ * Operator {@link sm}: ++ * ++ * ```typescript ++ * import { sm } from 'jssm'; ++ * ++ * const lswitch = sm`on <=> off;`; ++ * ``` ++ * ++ * Method {@link from}: ++ * ++ * ```typescript ++ * import * as jssm from 'jssm'; ++ * ++ * const toggle = jssm.from('up <=> down;'); ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ * @param tree The parse tree to be boiled down into a machine config ++ * ++ */ ++declare function compile(tree: JssmParseTree): JssmGenericConfig; ++/********* ++ * ++ * An internal convenience wrapper for parsing then compiling a machine string. ++ * Not generally meant for external use. Please see {@link compile} or ++ * {@link sm}. ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ * @param plan The FSL code to be evaluated and built into a machine config ++ * ++ */ ++declare function make(plan: string): JssmGenericConfig; ++ ++declare const weighted_rand_select: Function; ++/******* ++ * ++ * Returns, for a non-negative integer argument `n`, the series `[0 .. n]`. ++ * ++ * ```typescript ++ * import { seq } from './jssm'; ++ * ++ * seq(5); // [0, 1, 2, 3, 4] ++ * seq(0); // [] ++ * ``` ++ * ++ */ ++declare function seq(n: number): number[]; ++/******* ++ * ++ * Returns the histograph of an array as a `Map`. Makes no attempt to cope ++ * with deep equality; will fail for complex contents, as such. ++ * ++ * ```typescript ++ * import { histograph } from './jssm'; ++ * ++ * histograph( [0, 0, 1, 1, 2, 2, 1] ); // Map() ++ * ``` ++ * ++ */ ++declare const histograph: Function; ++declare const weighted_sample_select: Function; ++declare const weighted_histo_key: Function; ++/******* ++ * ++ * Reduces an array to its unique contents. Compares with `===` and makes no ++ * effort to deep-compare contents; two matching arrays or objects contained ++ * will be treated as distinct, according to javascript rules. This also means ++ * that `NaNs` will be ***dropped***, because they do not self-compare. ++ * ++ * ```typescript ++ * unique( [] ); // [] ++ * unique( [0,0] ); // [0] ++ * unique( [0,1,2, 0,1,2, 0,1,2] ); // [0,1,2] ++ * unique( [ [1], [1] ] ); // [ [1], [1] ] because arrays don't match ++ * unique( [0,NaN,2] ); // [0,2] ++ * ``` ++ * ++ */ ++declare const unique: (arr?: T[]) => T[]; ++/******* ++ * ++ * Lists all repeated items in an array along with their counts. Subject to ++ * matching rules of Map. `NaN` is manually removed because of conflict rules ++ * around {@link unique}. Because these are compared with `===` and because ++ * arrays and objects never match that way unless they're the same object, ++ * arrays and objects are never considered repeats. ++ * ++ * ```typescript ++ * find_repeated([ ]); // [] ++ * find_repeated([ "one" ]); // [] ++ * find_repeated([ "one", "two" ]); // [] ++ * find_repeated([ "one", "one" ]); // [ ["one", 2] ] ++ * find_repeated([ "one", "two", "one" ]); // [ ["one", 2] ] ++ * find_repeated([ 0, NaN, 0, NaN ]); // [ [0, 2] ] ++ * ``` ++ * ++ */ ++declare function find_repeated(arr: T[]): [T, number][]; ++ ++declare const NegInfinity: number; ++declare const PosInfinity: number; ++declare const Epsilon: number; ++declare const Pi: number; ++declare const E: number; ++declare const Root2: number; ++declare const RootHalf: number; ++declare const Ln2: number; ++declare const Ln10: number; ++declare const Log2E: number; ++declare const Log10E: number; ++declare const MaxSafeInt: number; ++declare const MinSafeInt: number; ++declare const MaxPosNum: number; ++declare const MinPosNum: number; ++declare const Phi = 1.618033988749895; ++declare const EulerC = 0.5772156649015329; ++declare const gviz_shapes$1: string[]; ++declare const shapes$1: string[]; ++declare const named_colors$1: string[]; ++ ++declare const jssm_constants_d_NegInfinity: typeof NegInfinity; ++declare const jssm_constants_d_PosInfinity: typeof PosInfinity; ++declare const jssm_constants_d_Epsilon: typeof Epsilon; ++declare const jssm_constants_d_Pi: typeof Pi; ++declare const jssm_constants_d_E: typeof E; ++declare const jssm_constants_d_Root2: typeof Root2; ++declare const jssm_constants_d_RootHalf: typeof RootHalf; ++declare const jssm_constants_d_Ln2: typeof Ln2; ++declare const jssm_constants_d_Ln10: typeof Ln10; ++declare const jssm_constants_d_Log2E: typeof Log2E; ++declare const jssm_constants_d_Log10E: typeof Log10E; ++declare const jssm_constants_d_MaxSafeInt: typeof MaxSafeInt; ++declare const jssm_constants_d_MinSafeInt: typeof MinSafeInt; ++declare const jssm_constants_d_MaxPosNum: typeof MaxPosNum; ++declare const jssm_constants_d_MinPosNum: typeof MinPosNum; ++declare const jssm_constants_d_Phi: typeof Phi; ++declare const jssm_constants_d_EulerC: typeof EulerC; ++declare namespace jssm_constants_d { ++ export { ++ gviz_shapes$1 as gviz_shapes, ++ shapes$1 as shapes, ++ named_colors$1 as named_colors, ++ jssm_constants_d_NegInfinity as NegInfinity, ++ jssm_constants_d_PosInfinity as PosInfinity, ++ jssm_constants_d_Epsilon as Epsilon, ++ jssm_constants_d_Pi as Pi, ++ jssm_constants_d_E as E, ++ jssm_constants_d_Root2 as Root2, ++ jssm_constants_d_RootHalf as RootHalf, ++ jssm_constants_d_Ln2 as Ln2, ++ jssm_constants_d_Ln10 as Ln10, ++ jssm_constants_d_Log2E as Log2E, ++ jssm_constants_d_Log10E as Log10E, ++ jssm_constants_d_MaxSafeInt as MaxSafeInt, ++ jssm_constants_d_MinSafeInt as MinSafeInt, ++ jssm_constants_d_MaxPosNum as MaxPosNum, ++ jssm_constants_d_MinPosNum as MinPosNum, ++ jssm_constants_d_Phi as Phi, ++ jssm_constants_d_EulerC as EulerC, ++ }; ++} ++ ++declare const version: string; ++declare const build_time: number; ++ ++declare type StateType = string; ++ ++declare const shapes: string[]; ++declare const gviz_shapes: string[]; ++declare const named_colors: string[]; ++ ++/********* ++ * ++ * An internal method meant to take a series of declarations and fold them into ++ * a single multi-faceted declaration, in the process of building a state. Not ++ * generally meant for external use. ++ * ++ * @internal ++ * ++ */ ++declare function transfer_state_properties(state_decl: JssmStateDeclaration): JssmStateDeclaration; ++declare function state_style_condense(jssk: JssmStateStyleKeyList): JssmStateConfig; ++declare class Machine { ++ _state: StateType; ++ _states: Map; ++ _edges: Array>; ++ _edge_map: Map>; ++ _named_transitions: Map; ++ _actions: Map>; ++ _reverse_actions: Map>; ++ _reverse_action_targets: Map>; ++ _start_states: Set; ++ _end_states: Set; ++ _machine_author?: Array; ++ _machine_comment?: string; ++ _machine_contributor?: Array; ++ _machine_definition?: string; ++ _machine_language?: string; ++ _machine_license?: string; ++ _machine_name?: string; ++ _machine_version?: string; ++ _fsl_version?: string; ++ _raw_state_declaration?: Array; ++ _state_declarations: Map; ++ _data?: mDT; ++ _instance_name: string; ++ _rng_seed: number; ++ _rng: JssmRng; ++ _graph_layout: JssmLayout; ++ _dot_preamble: string; ++ _arrange_declaration: Array>; ++ _arrange_start_declaration: Array>; ++ _arrange_end_declaration: Array>; ++ _themes: FslTheme[]; ++ _flow: FslDirection; ++ _has_hooks: boolean; ++ _has_basic_hooks: boolean; ++ _has_named_hooks: boolean; ++ _has_entry_hooks: boolean; ++ _has_exit_hooks: boolean; ++ _has_global_action_hooks: boolean; ++ _has_transition_hooks: boolean; ++ _has_forced_transitions: boolean; ++ _hooks: Map>; ++ _named_hooks: Map>; ++ _entry_hooks: Map>; ++ _exit_hooks: Map>; ++ _global_action_hooks: Map>; ++ _any_action_hook: HookHandler | undefined; ++ _standard_transition_hook: HookHandler | undefined; ++ _main_transition_hook: HookHandler | undefined; ++ _forced_transition_hook: HookHandler | undefined; ++ _any_transition_hook: HookHandler | undefined; ++ _has_post_hooks: boolean; ++ _has_post_basic_hooks: boolean; ++ _has_post_named_hooks: boolean; ++ _has_post_entry_hooks: boolean; ++ _has_post_exit_hooks: boolean; ++ _has_post_global_action_hooks: boolean; ++ _has_post_transition_hooks: boolean; ++ _code_allows_override: JssmAllowsOverride; ++ _config_allows_override: JssmAllowsOverride; ++ _post_hooks: Map>; ++ _post_named_hooks: Map>; ++ _post_entry_hooks: Map>; ++ _post_exit_hooks: Map>; ++ _post_global_action_hooks: Map>; ++ _post_any_action_hook: HookHandler | undefined; ++ _post_standard_transition_hook: HookHandler | undefined; ++ _post_main_transition_hook: HookHandler | undefined; ++ _post_forced_transition_hook: HookHandler | undefined; ++ _post_any_transition_hook: HookHandler | undefined; ++ _property_keys: Set; ++ _default_properties: Map; ++ _state_properties: Map; ++ _required_properties: Set; ++ _history: JssmHistory; ++ _history_length: number; ++ _state_style: JssmStateConfig; ++ _active_state_style: JssmStateConfig; ++ _hooked_state_style: JssmStateConfig; ++ _terminal_state_style: JssmStateConfig; ++ _start_state_style: JssmStateConfig; ++ _end_state_style: JssmStateConfig; ++ _state_labels: Map; ++ _time_source: () => number; ++ _create_started: number; ++ _created: number; ++ _after_mapping: Map; ++ _timeout_source: (Function: any, number: any) => number; ++ _clear_timeout_source: (h: any) => void; ++ _timeout_handle: number | undefined; ++ _timeout_target: string | undefined; ++ _timeout_target_time: number | undefined; ++ constructor({ start_states, end_states, initial_state, start_states_no_enforce, complete, transitions, machine_author, machine_comment, machine_contributor, machine_definition, machine_language, machine_license, machine_name, machine_version, state_declaration, property_definition, state_property, fsl_version, dot_preamble, arrange_declaration, arrange_start_declaration, arrange_end_declaration, theme, flow, graph_layout, instance_name, history, data, default_state_config, default_active_state_config, default_hooked_state_config, default_terminal_state_config, default_start_state_config, default_end_state_config, allows_override, config_allows_override, rng_seed, time_source, timeout_source, clear_timeout_source }: JssmGenericConfig); ++ /******** ++ * ++ * Internal method for fabricating states. Not meant for external use. ++ * ++ * @internal ++ * ++ */ ++ _new_state(state_config: JssmGenericState): StateType; ++ /********* ++ * ++ * Get the current state of a machine. ++ * ++ * ```typescript ++ * import * as jssm from 'jssm'; ++ * ++ * const lswitch = jssm.from('on <=> off;'); ++ * console.log( lswitch.state() ); // 'on' ++ * ++ * lswitch.transition('off'); ++ * console.log( lswitch.state() ); // 'off' ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ */ ++ state(): StateType; ++ /********* ++ * ++ * Get the label for a given state, if any; return `undefined` otherwise. ++ * ++ * ```typescript ++ * import * as jssm from 'jssm'; ++ * ++ * const lswitch = jssm.from('a -> b; state a: { label: "Foo!"; };'); ++ * console.log( lswitch.label_for('a') ); // 'Foo!' ++ * console.log( lswitch.label_for('b') ); // undefined ++ * ``` ++ * ++ * See also {@link display_text}. ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ */ ++ label_for(state: StateType): string; ++ /********* ++ * ++ * Get whatever the node should show as text. ++ * ++ * Currently, this means to get the label for a given state, if any; ++ * otherwise to return the node's name. However, this definition is expected ++ * to grow with time, and it is currently considered ill-advised to manually ++ * parse this text. ++ * ++ * See also {@link label_for}. ++ * ++ * ```typescript ++ * import * as jssm from 'jssm'; ++ * ++ * const lswitch = jssm.from('a -> b; state a: { label: "Foo!"; };'); ++ * console.log( lswitch.display_text('a') ); // 'Foo!' ++ * console.log( lswitch.display_text('b') ); // 'b' ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ */ ++ display_text(state: StateType): string; ++ /********* ++ * ++ * Get the current data of a machine. ++ * ++ * ```typescript ++ * import * as jssm from 'jssm'; ++ * ++ * const lswitch = jssm.from('on <=> off;', {data: 1}); ++ * console.log( lswitch.data() ); // 1 ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ */ ++ data(): mDT; ++ /********* ++ * ++ * Get the current value of a given property name. ++ * ++ * ```typescript ++ * ++ * ``` ++ * ++ * @param name The relevant property name to look up ++ * ++ * @returns The value behind the prop name. Because functional props are ++ * evaluated as getters, this can be anything. ++ * ++ */ ++ prop(name: string): any; ++ /********* ++ * ++ * Get the current value of a given property name. If missing on the state ++ * and without a global default, throw, unlike {@link prop}, which would ++ * return `undefined` instead. ++ * ++ * ```typescript ++ * ++ * ``` ++ * ++ * @param name The relevant property name to look up ++ * ++ * @returns The value behind the prop name. Because functional props are ++ * evaluated as getters, this can be anything. ++ * ++ */ ++ strict_prop(name: string): any; ++ /********* ++ * ++ * Get the current value of every prop, as an object. If no current definition ++ * exists for a prop - that is, if the prop was defined without a default and ++ * the current state also doesn't define the prop - then that prop will be listed ++ * in the returned object with a value of `undefined`. ++ * ++ * ```typescript ++ * const traffic_light = sm` ++ * ++ * property can_go default true; ++ * property hesitate default true; ++ * property stop_first default false; ++ * ++ * Off -> Red => Green => Yellow => Red; ++ * [Red Yellow Green] ~> [Off FlashingRed]; ++ * FlashingRed -> Red; ++ * ++ * state Red: { property stop_first true; property can_go false; }; ++ * state Off: { property stop_first true; }; ++ * state FlashingRed: { property stop_first true; }; ++ * state Green: { property hesitate false; }; ++ * ++ * `; ++ * ++ * traffic_light.state(); // Off ++ * traffic_light.props(); // { can_go: true, hesitate: true, stop_first: true; } ++ * ++ * traffic_light.go('Red'); ++ * traffic_light.props(); // { can_go: false, hesitate: true, stop_first: true; } ++ * ++ * traffic_light.go('Green'); ++ * traffic_light.props(); // { can_go: true, hesitate: false, stop_first: false; } ++ * ``` ++ * ++ */ ++ props(): object; ++ /********* ++ * ++ * Get the current value of every prop, as an object. Compare ++ * {@link prop_map}, which returns a `Map`. ++ * ++ * ```typescript ++ * ++ * ``` ++ * ++ */ ++ /********* ++ * ++ * Get the current value of every prop, as an object. Compare ++ * {@link prop_map}, which returns a `Map`. Akin to {@link strict_prop}, ++ * this throws if a required prop is missing. ++ * ++ * ```typescript ++ * ++ * ``` ++ * ++ */ ++ /********* ++ * ++ * Check whether a given string is a known property's name. ++ * ++ * ```typescript ++ * const example = sm`property foo default 1; a->b;`; ++ * ++ * example.known_prop('foo'); // true ++ * example.known_prop('bar'); // false ++ * ``` ++ * ++ * @param prop_name The relevant property name to look up ++ * ++ */ ++ known_prop(prop_name: string): boolean; ++ /********* ++ * ++ * List all known property names. If you'd also like values, use ++ * {@link props} instead. The order of the properties is not defined, and ++ * the properties generally will not be sorted. ++ * ++ * ```typescript ++ * ``` ++ * ++ */ ++ known_props(): string[]; ++ /******** ++ * ++ * Check whether a given state is a valid start state (either because it was ++ * explicitly named as such, or because it was the first mentioned state.) ++ * ++ * ```typescript ++ * import { sm, is_start_state } from 'jssm'; ++ * ++ * const example = sm`a -> b;`; ++ * ++ * console.log( final_test.is_start_state('a') ); // true ++ * console.log( final_test.is_start_state('b') ); // false ++ * ++ * const example = sm`start_states: [a b]; a -> b;`; ++ * ++ * console.log( final_test.is_start_state('a') ); // true ++ * console.log( final_test.is_start_state('b') ); // true ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ * @param whichState The name of the state to check ++ * ++ */ ++ is_start_state(whichState: StateType): boolean; ++ /******** ++ * ++ * Check whether a given state is a valid start state (either because it was ++ * explicitly named as such, or because it was the first mentioned state.) ++ * ++ * ```typescript ++ * import { sm, is_end_state } from 'jssm'; ++ * ++ * const example = sm`a -> b;`; ++ * ++ * console.log( final_test.is_start_state('a') ); // false ++ * console.log( final_test.is_start_state('b') ); // true ++ * ++ * const example = sm`end_states: [a b]; a -> b;`; ++ * ++ * console.log( final_test.is_start_state('a') ); // true ++ * console.log( final_test.is_start_state('b') ); // true ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ * @param whichState The name of the state to check ++ * ++ */ ++ is_end_state(whichState: StateType): boolean; ++ /******** ++ * ++ * Check whether a given state is final (either has no exits or is marked ++ * `complete`.) ++ * ++ * ```typescript ++ * import { sm, state_is_final } from 'jssm'; ++ * ++ * const final_test = sm`first -> second;`; ++ * ++ * console.log( final_test.state_is_final('first') ); // false ++ * console.log( final_test.state_is_final('second') ); // true ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ * @param whichState The name of the state to check for finality ++ * ++ */ ++ state_is_final(whichState: StateType): boolean; ++ /******** ++ * ++ * Check whether the current state is final (either has no exits or is marked ++ * `complete`.) ++ * ++ * ```typescript ++ * import { sm, is_final } from 'jssm'; ++ * ++ * const final_test = sm`first -> second;`; ++ * ++ * console.log( final_test.is_final() ); // false ++ * state.transition('second'); ++ * console.log( final_test.is_final() ); // true ++ * ``` ++ * ++ */ ++ is_final(): boolean; ++ /******** ++ * ++ * Serialize the current machine, including all defining state but not the ++ * machine string, to a structure. This means you will need the machine ++ * string to recreate (to not waste repeated space;) if you want the machine ++ * string embedded, call {@link serialize_with_string} instead. ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ */ ++ serialize(comment?: string | undefined): JssmSerialization; ++ graph_layout(): string; ++ dot_preamble(): string; ++ machine_author(): Array; ++ machine_comment(): string; ++ machine_contributor(): Array; ++ machine_definition(): string; ++ machine_language(): string; ++ machine_license(): string; ++ machine_name(): string; ++ machine_version(): string; ++ raw_state_declarations(): Array; ++ state_declaration(which: StateType): JssmStateDeclaration; ++ state_declarations(): Map; ++ fsl_version(): string; ++ machine_state(): JssmMachineInternalState; ++ /********* ++ * ++ * List all the states known by the machine. Please note that the order of ++ * these states is not guaranteed. ++ * ++ * ```typescript ++ * import * as jssm from 'jssm'; ++ * ++ * const lswitch = jssm.from('on <=> off;'); ++ * console.log( lswitch.states() ); // ['on', 'off'] ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ */ ++ states(): Array; ++ state_for(whichState: StateType): JssmGenericState; ++ /********* ++ * ++ * Check whether the machine knows a given state. ++ * ++ * ```typescript ++ * import * as jssm from 'jssm'; ++ * ++ * const lswitch = jssm.from('on <=> off;'); ++ * ++ * console.log( lswitch.has_state('off') ); // true ++ * console.log( lswitch.has_state('dance') ); // false ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ * @param whichState The state to be checked for extance ++ * ++ */ ++ has_state(whichState: StateType): boolean; ++ /********* ++ * ++ * Lists all edges of a machine. ++ * ++ * ```typescript ++ * import { sm } from 'jssm'; ++ * ++ * const lswitch = sm`on 'toggle' <=> 'toggle' off;`; ++ * ++ * lswitch.list_edges(); ++ * [ ++ * { ++ * from: 'on', ++ * to: 'off', ++ * kind: 'main', ++ * forced_only: false, ++ * main_path: true, ++ * action: 'toggle' ++ * }, ++ * { ++ * from: 'off', ++ * to: 'on', ++ * kind: 'main', ++ * forced_only: false, ++ * main_path: true, ++ * action: 'toggle' ++ * } ++ * ] ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ */ ++ list_edges(): Array>; ++ list_named_transitions(): Map; ++ list_actions(): Array; ++ get uses_actions(): boolean; ++ get uses_forced_transitions(): boolean; ++ /********* ++ * ++ * Check if the code that built the machine allows overriding state and data. ++ * ++ */ ++ get code_allows_override(): JssmAllowsOverride; ++ /********* ++ * ++ * Check if the machine config allows overriding state and data. ++ * ++ */ ++ get config_allows_override(): JssmAllowsOverride; ++ /********* ++ * ++ * Check if a machine allows overriding state and data. ++ * ++ */ ++ get allows_override(): JssmAllowsOverride; ++ all_themes(): FslTheme[]; ++ get themes(): FslTheme | FslTheme[]; ++ set themes(to: FslTheme | FslTheme[]); ++ flow(): FslDirection; ++ get_transition_by_state_names(from: StateType, to: StateType): number; ++ lookup_transition_for(from: StateType, to: StateType): JssmTransition; ++ /******** ++ * ++ * List all transitions attached to the current state, sorted by entrance and ++ * exit. The order of each sublist is not defined. A node could appear in ++ * both lists. ++ * ++ * ```typescript ++ * import { sm } from 'jssm'; ++ * ++ * const light = sm`red 'next' -> green 'next' -> yellow 'next' -> red; [red yellow green] 'shutdown' ~> off 'start' -> red;`; ++ * ++ * light.state(); // 'red' ++ * light.list_transitions(); // { entrances: [ 'yellow', 'off' ], exits: [ 'green', 'off' ] } ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ * @param whichState The state whose transitions to have listed ++ * ++ */ ++ list_transitions(whichState?: StateType): JssmTransitionList; ++ /******** ++ * ++ * List all entrances attached to the current state. Please note that the ++ * order of the list is not defined. This list includes both unforced and ++ * forced entrances; if this isn't desired, consider ++ * {@link list_unforced_entrances} or {@link list_forced_entrances} as ++ * appropriate. ++ * ++ * ```typescript ++ * import { sm } from 'jssm'; ++ * ++ * const light = sm`red 'next' -> green 'next' -> yellow 'next' -> red; [red yellow green] 'shutdown' ~> off 'start' -> red;`; ++ * ++ * light.state(); // 'red' ++ * light.list_entrances(); // [ 'yellow', 'off' ] ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ * @param whichState The state whose entrances to have listed ++ * ++ */ ++ list_entrances(whichState?: StateType): Array; ++ /******** ++ * ++ * List all exits attached to the current state. Please note that the order ++ * of the list is not defined. This list includes both unforced and forced ++ * exits; if this isn't desired, consider {@link list_unforced_exits} or ++ * {@link list_forced_exits} as appropriate. ++ * ++ * ```typescript ++ * import { sm } from 'jssm'; ++ * ++ * const light = sm`red 'next' -> green 'next' -> yellow 'next' -> red; [red yellow green] 'shutdown' ~> off 'start' -> red;`; ++ * ++ * light.state(); // 'red' ++ * light.list_exits(); // [ 'green', 'off' ] ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ * @param whichState The state whose exits to have listed ++ * ++ */ ++ list_exits(whichState?: StateType): Array; ++ probable_exits_for(whichState: StateType): Array>; ++ probabilistic_transition(): boolean; ++ probabilistic_walk(n: number): Array; ++ probabilistic_histo_walk(n: number): Map; ++ /******** ++ * ++ * List all actions available from this state. Please note that the order of ++ * the actions is not guaranteed. ++ * ++ * ```typescript ++ * import { sm } from 'jssm'; ++ * ++ * const machine = sm` ++ * red 'next' -> green 'next' -> yellow 'next' -> red; ++ * [red yellow green] 'shutdown' ~> off 'start' -> red; ++ * `; ++ * ++ * console.log( machine.state() ); // logs 'red' ++ * console.log( machine.actions() ); // logs ['next', 'shutdown'] ++ * ++ * machine.action('next'); // true ++ * console.log( machine.state() ); // logs 'green' ++ * console.log( machine.actions() ); // logs ['next', 'shutdown'] ++ * ++ * machine.action('shutdown'); // true ++ * console.log( machine.state() ); // logs 'off' ++ * console.log( machine.actions() ); // logs ['start'] ++ * ++ * machine.action('start'); // true ++ * console.log( machine.state() ); // logs 'red' ++ * console.log( machine.actions() ); // logs ['next', 'shutdown'] ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ * @param whichState The state whose actions to have listed ++ * ++ */ ++ actions(whichState?: StateType): Array; ++ /******** ++ * ++ * List all states that have a specific action attached. Please note that ++ * the order of the states is not guaranteed. ++ * ++ * ```typescript ++ * import { sm } from 'jssm'; ++ * ++ * const machine = sm` ++ * red 'next' -> green 'next' -> yellow 'next' -> red; ++ * [red yellow green] 'shutdown' ~> off 'start' -> red; ++ * `; ++ * ++ * console.log( machine.list_states_having_action('next') ); // ['red', 'green', 'yellow'] ++ * console.log( machine.list_states_having_action('start') ); // ['off'] ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ * @param whichState The action to be checked for associated states ++ * ++ */ ++ list_states_having_action(whichState: StateType): Array; ++ list_exit_actions(whichState?: StateType): Array; ++ probable_action_exits(whichState?: StateType): Array; ++ is_unenterable(whichState: StateType): boolean; ++ has_unenterables(): boolean; ++ is_terminal(): boolean; ++ state_is_terminal(whichState: StateType): boolean; ++ has_terminals(): boolean; ++ is_complete(): boolean; ++ state_is_complete(whichState: StateType): boolean; ++ has_completes(): boolean; ++ set_hook(HookDesc: HookDescription): void; ++ hook(from: string, to: string, handler: HookHandler): Machine; ++ hook_action(from: string, to: string, action: string, handler: HookHandler): Machine; ++ hook_global_action(action: string, handler: HookHandler): Machine; ++ hook_any_action(handler: HookHandler): Machine; ++ hook_standard_transition(handler: HookHandler): Machine; ++ hook_main_transition(handler: HookHandler): Machine; ++ hook_forced_transition(handler: HookHandler): Machine; ++ hook_any_transition(handler: HookHandler): Machine; ++ hook_entry(to: string, handler: HookHandler): Machine; ++ hook_exit(from: string, handler: HookHandler): Machine; ++ post_hook(from: string, to: string, handler: HookHandler): Machine; ++ post_hook_action(from: string, to: string, action: string, handler: HookHandler): Machine; ++ post_hook_global_action(action: string, handler: HookHandler): Machine; ++ post_hook_any_action(handler: HookHandler): Machine; ++ post_hook_standard_transition(handler: HookHandler): Machine; ++ post_hook_main_transition(handler: HookHandler): Machine; ++ post_hook_forced_transition(handler: HookHandler): Machine; ++ post_hook_any_transition(handler: HookHandler): Machine; ++ post_hook_entry(to: string, handler: HookHandler): Machine; ++ post_hook_exit(from: string, handler: HookHandler): Machine; ++ get rng_seed(): number; ++ set rng_seed(to: number | undefined); ++ edges_between(from: string, to: string): JssmTransition[]; ++ /********* ++ * ++ * Replace the current state and data with no regard to the graph. ++ * ++ * ```typescript ++ * import { sm } from 'jssm'; ++ * ++ * const machine = sm`a -> b -> c;`; ++ * console.log( machine.state() ); // 'a' ++ * ++ * machine.go('b'); ++ * machine.go('c'); ++ * console.log( machine.state() ); // 'c' ++ * ++ * machine.override('a'); ++ * console.log( machine.state() ); // 'a' ++ * ``` ++ * ++ */ ++ override(newState: StateType, newData?: mDT | undefined): void; ++ transition_impl(newStateOrAction: StateType, newData: mDT | undefined, wasForced: boolean, wasAction: boolean): boolean; ++ auto_set_state_timeout(): void; ++ /********* ++ * ++ * Get a truncated history of the recent states and data of the machine. ++ * Turned off by default; configure with `.from('...', {data: 5})` by length, ++ * or set `.history_length` at runtime. ++ * ++ * History *does not contain the current state*. If you want that, call ++ * `.history_inclusive` instead. ++ * ++ * ```typescript ++ * const foo = jssm.from( ++ * "a 'next' -> b 'next' -> c 'next' -> d 'next' -> e;", ++ * { history: 3 } ++ * ); ++ * ++ * foo.action('next'); ++ * foo.action('next'); ++ * foo.action('next'); ++ * foo.action('next'); ++ * ++ * foo.history; // [ ['b',undefined], ['c',undefined], ['d',undefined] ] ++ * ``` ++ * ++ * Notice that the machine's current state, `e`, is not in the returned list. ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ */ ++ get history(): [string, mDT][]; ++ /********* ++ * ++ * Get a truncated history of the recent states and data of the machine, ++ * including the current state. Turned off by default; configure with ++ * `.from('...', {data: 5})` by length, or set `.history_length` at runtime. ++ * ++ * History inclusive contains the current state. If you only want past ++ * states, call `.history` instead. ++ * ++ * The list returned will be one longer than the history buffer kept, as the ++ * history buffer kept gets the current state added to it to produce this ++ * list. ++ * ++ * ```typescript ++ * const foo = jssm.from( ++ * "a 'next' -> b 'next' -> c 'next' -> d 'next' -> e;", ++ * { history: 3 } ++ * ); ++ * ++ * foo.action('next'); ++ * foo.action('next'); ++ * foo.action('next'); ++ * foo.action('next'); ++ * ++ * foo.history_inclusive; // [ ['b',undefined], ['c',undefined], ['d',undefined], ['e',undefined] ] ++ * ``` ++ * ++ * Notice that the machine's current state, `e`, is in the returned list. ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ */ ++ get history_inclusive(): [string, mDT][]; ++ /********* ++ * ++ * Find out how long a history this machine is keeping. Defaults to zero. ++ * Settable directly. ++ * ++ * ```typescript ++ * const foo = jssm.from("a -> b;"); ++ * foo.history_length; // 0 ++ * ++ * const bar = jssm.from("a -> b;", { history: 3 }); ++ * foo.history_length; // 3 ++ * foo.history_length = 5; ++ * foo.history_length; // 5 ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ */ ++ get history_length(): number; ++ set history_length(to: number); ++ /******** ++ * ++ * Instruct the machine to complete an action. Synonym for {@link do}. ++ * ++ * ```typescript ++ * const light = sm`red 'next' -> green 'next' -> yellow 'next' -> red; [red yellow green] 'shutdown' ~> off 'start' -> red;`; ++ * ++ * light.state(); // 'red' ++ * light.action('next'); // true ++ * light.state(); // 'green' ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ * @param actionName The action to engage ++ * ++ * @param newData The data change to insert during the action ++ * ++ */ ++ action(actionName: StateType, newData?: mDT): boolean; ++ /******** ++ * ++ * Get the standard style for a single state. ***Does not*** include ++ * composition from an applied theme, or things from the underlying base ++ * stylesheet; only the modifications applied by this machine. ++ * ++ * ```typescript ++ * const light = sm`a -> b;`; ++ * console.log(light.standard_state_style); ++ * // {} ++ * ++ * const light = sm`a -> b; state: { shape: circle; };`; ++ * console.log(light.standard_state_style); ++ * // { shape: 'circle' } ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ */ ++ get standard_state_style(): JssmStateConfig; ++ /******** ++ * ++ * Get the hooked state style. ***Does not*** include ++ * composition from an applied theme, or things from the underlying base ++ * stylesheet; only the modifications applied by this machine. ++ * ++ * The hooked style is only applied to nodes which have a named hook in the ++ * graph. Open hooks set through the external API aren't graphed, because ++ * that would be literally every node. ++ * ++ * ```typescript ++ * const light = sm`a -> b;`; ++ * console.log(light.hooked_state_style); ++ * // {} ++ * ++ * const light = sm`a -> b; hooked_state: { shape: circle; };`; ++ * console.log(light.hooked_state_style); ++ * // { shape: 'circle' } ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ */ ++ get hooked_state_style(): JssmStateConfig; ++ /******** ++ * ++ * Get the start state style. ***Does not*** include composition from an ++ * applied theme, or things from the underlying base stylesheet; only the ++ * modifications applied by this machine. ++ * ++ * Start states are defined by the directive `start_states`, or in absentia, ++ * are the first mentioned state. ++ * ++ * ```typescript ++ * const light = sm`a -> b;`; ++ * console.log(light.start_state_style); ++ * // {} ++ * ++ * const light = sm`a -> b; start_state: { shape: circle; };`; ++ * console.log(light.start_state_style); ++ * // { shape: 'circle' } ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ */ ++ get start_state_style(): JssmStateConfig; ++ /******** ++ * ++ * Get the end state style. ***Does not*** include ++ * composition from an applied theme, or things from the underlying base ++ * stylesheet; only the modifications applied by this machine. ++ * ++ * End states are defined in the directive `end_states`, and are distinct ++ * from terminal states. End states are voluntary successful endpoints for a ++ * process. Terminal states are states that cannot be exited. By example, ++ * most error states are terminal states, but not end states. Also, since ++ * some end states can be exited and are determined by hooks, such as ++ * recursive or iterative nodes, there is such a thing as an end state that ++ * is not a terminal state. ++ * ++ * ```typescript ++ * const light = sm`a -> b;`; ++ * console.log(light.standard_state_style); ++ * // {} ++ * ++ * const light = sm`a -> b; end_state: { shape: circle; };`; ++ * console.log(light.standard_state_style); ++ * // { shape: 'circle' } ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ */ ++ get end_state_style(): JssmStateConfig; ++ /******** ++ * ++ * Get the terminal state style. ***Does not*** include ++ * composition from an applied theme, or things from the underlying base ++ * stylesheet; only the modifications applied by this machine. ++ * ++ * Terminal state styles are automatically determined by the machine. Any ++ * state without a valid exit transition is terminal. ++ * ++ * ```typescript ++ * const light = sm`a -> b;`; ++ * console.log(light.terminal_state_style); ++ * // {} ++ * ++ * const light = sm`a -> b; terminal_state: { shape: circle; };`; ++ * console.log(light.terminal_state_style); ++ * // { shape: 'circle' } ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ */ ++ get terminal_state_style(): JssmStateConfig; ++ /******** ++ * ++ * Get the style for the active state. ***Does not*** include ++ * composition from an applied theme, or things from the underlying base ++ * stylesheet; only the modifications applied by this machine. ++ * ++ * ```typescript ++ * const light = sm`a -> b;`; ++ * console.log(light.active_state_style); ++ * // {} ++ * ++ * const light = sm`a -> b; active_state: { shape: circle; };`; ++ * console.log(light.active_state_style); ++ * // { shape: 'circle' } ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ */ ++ get active_state_style(): JssmStateConfig; ++ /******** ++ * ++ * Gets the composite style for a specific node by individually imposing the ++ * style layers on a given object, after determining which layers are ++ * appropriate. ++ * ++ * The order of composition is base, then theme, then user content. Each ++ * item in the stack will be composited independently. First, the base state ++ * style, then the theme state style, then the user state style. ++ * ++ * After the three state styles, we'll composite the hooked styles; then the ++ * terminal styles; then the start styles; then the end styles; finally, the ++ * active styles. Remember, last wins. ++ * ++ * The base state style must exist. All other styles are optional. ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ */ ++ style_for(state: StateType): JssmStateConfig; ++ /******** ++ * ++ * Instruct the machine to complete an action. Synonym for {@link action}. ++ * ++ * ```typescript ++ * const light = sm` ++ * off 'start' -> red; ++ * red 'next' -> green 'next' -> yellow 'next' -> red; ++ * [red yellow green] 'shutdown' ~> off; ++ * `; ++ * ++ * light.state(); // 'off' ++ * light.do('start'); // true ++ * light.state(); // 'red' ++ * light.do('next'); // true ++ * light.state(); // 'green' ++ * light.do('next'); // true ++ * light.state(); // 'yellow' ++ * light.do('dance'); // !! false - no such action ++ * light.state(); // 'yellow' ++ * light.do('start'); // !! false - yellow does not have the action start ++ * light.state(); // 'yellow' ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ * @param actionName The action to engage ++ * ++ * @param newData The data change to insert during the action ++ * ++ */ ++ do(actionName: StateType, newData?: mDT): boolean; ++ /******** ++ * ++ * Instruct the machine to complete a transition. Synonym for {@link go}. ++ * ++ * ```typescript ++ * const light = sm` ++ * off 'start' -> red; ++ * red 'next' -> green 'next' -> yellow 'next' -> red; ++ * [red yellow green] 'shutdown' ~> off; ++ * `; ++ * ++ * light.state(); // 'off' ++ * light.go('red'); // true ++ * light.state(); // 'red' ++ * light.go('green'); // true ++ * light.state(); // 'green' ++ * light.go('blue'); // !! false - no such state ++ * light.state(); // 'green' ++ * light.go('red'); // !! false - green may not go directly to red, only to yellow ++ * light.state(); // 'green' ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ * @param newState The state to switch to ++ * ++ * @param newData The data change to insert during the transition ++ * ++ */ ++ transition(newState: StateType, newData?: mDT): boolean; ++ /******** ++ * ++ * Instruct the machine to complete a transition. Synonym for {@link transition}. ++ * ++ * ```typescript ++ * const light = sm`red -> green -> yellow -> red; [red yellow green] 'shutdown' ~> off 'start' -> red;`; ++ * ++ * light.state(); // 'red' ++ * light.go('green'); // true ++ * light.state(); // 'green' ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ * @param newState The state to switch to ++ * ++ * @param newData The data change to insert during the transition ++ * ++ */ ++ go(newState: StateType, newData?: mDT): boolean; ++ /******** ++ * ++ * Instruct the machine to complete a forced transition (which will reject if ++ * called with a normal {@link transition} call.) ++ * ++ * ```typescript ++ * const light = sm`red -> green -> yellow -> red; [red yellow green] 'shutdown' ~> off 'start' -> red;`; ++ * ++ * light.state(); // 'red' ++ * light.transition('off'); // false ++ * light.state(); // 'red' ++ * light.force_transition('off'); // true ++ * light.state(); // 'off' ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ * @param newState The state to switch to ++ * ++ * @param newData The data change to insert during the transition ++ * ++ */ ++ force_transition(newState: StateType, newData?: mDT): boolean; ++ current_action_for(action: StateType): number; ++ current_action_edge_for(action: StateType): JssmTransition; ++ valid_action(action: StateType, _newData?: mDT): boolean; ++ valid_transition(newState: StateType, _newData?: mDT): boolean; ++ valid_force_transition(newState: StateType, _newData?: mDT): boolean; ++ instance_name(): string | undefined; ++ get creation_date(): Date; ++ get creation_timestamp(): number; ++ get create_start_time(): number; ++ set_state_timeout(next_state: StateType, after_time: number): void; ++ clear_state_timeout(): void; ++ state_timeout_for(which_state: StateType): [StateType, number] | undefined; ++ current_state_timeout(): [StateType, number] | undefined; ++ sm(template_strings: TemplateStringsArray, ...remainder: any[]): Machine; ++} ++/********* ++ * ++ * Create a state machine from a template string. This is one of the two main ++ * paths for working with JSSM, alongside {@link from}. ++ * ++ * Use this method when you want to work directly and conveniently with a ++ * constant template expression. Use `.from` when you want to pull from ++ * dynamic strings. ++ * ++ * ++ * ```typescript ++ * import * as jssm from 'jssm'; ++ * ++ * const lswitch = jssm.from('on <=> off;'); ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ * @param template_strings The assembled code ++ * ++ * @param remainder The mechanic for template argument insertion ++ * ++ */ ++declare function sm(template_strings: TemplateStringsArray, ...remainder: any[]): Machine; ++/********* ++ * ++ * Create a state machine from an implementation string. This is one of the ++ * two main paths for working with JSSM, alongside {@link sm}. ++ * ++ * Use this method when you want to conveniently pull a state machine from a ++ * string dynamically. Use operator `sm` when you just want to work with a ++ * template expression. ++ * ++ * ```typescript ++ * import * as jssm from 'jssm'; ++ * ++ * const lswitch = jssm.from('on <=> off;'); ++ * ``` ++ * ++ * @typeparam mDT The type of the machine data member; usually omitted ++ * ++ * @param MachineAsString The FSL code to evaluate ++ * ++ * @param ExtraConstructorFields Extra non-code configuration to pass at creation time ++ * ++ */ ++declare function from(MachineAsString: string, ExtraConstructorFields?: Partial> | undefined): Machine; ++declare function is_hook_complex_result(hr: unknown): hr is HookComplexResult; ++declare function is_hook_rejection(hr: HookResult): boolean; ++declare function abstract_hook_step(maybe_hook: HookHandler | undefined, hook_args: HookContext): HookComplexResult; ++declare function deserialize(machine_string: string, ser: JssmSerialization): Machine; ++ ++export { FslDirections, Machine, abstract_hook_step, arrow_direction, arrow_left_kind, arrow_right_kind, build_time, compile, jssm_constants_d as constants, deserialize, find_repeated, from, gviz_shapes, histograph, is_hook_complex_result, is_hook_rejection, make, named_colors, wrap_parse as parse, seq, shapes, sm, state_style_condense, transfer_state_properties, unique, version, weighted_histo_key, weighted_rand_select, weighted_sample_select }; +diff --git a/package.json b/package.json +index f78c6fe4daef0a7f3979d6d7071192f57f929fb0..9d1b1911d971d1a8a20cda073dd93d26d131322d 100644 +--- a/package.json ++++ b/package.json +@@ -5,9 +5,18 @@ + "node": ">=10.0.0" + }, + "exports": { +- "require": "./dist/jssm.es5.cjs", +- "import": "./dist/jssm.es6.mjs", +- "default": "./dist/jssm.es5.cjs", ++ "require": { ++ "types": "./jssm.es5.d.cts", ++ "default": "./dist/jssm.es5.cjs" ++ }, ++ "import": { ++ "types": "./jssm.es6.d.ts", ++ "default": "./dist/jssm.es6.mjs" ++ }, ++ "default": { ++ "types": "./jssm.es5.d.cts", ++ "default": "./dist/jssm.es5.cjs" ++ }, + "browser": "dist/jssm.es5.iife.cjs" + }, + "autoupdate": { +@@ -134,6 +143,7 @@ + "pegjs": "^0.10.0", + "picocolors": "^1.0.0", + "rollup": "^2.72.1", ++ "rollup-plugin-dts": "^4.2.3", + "semver": "^7.5.4", + "terser": "^5.14.2", + "text_audit": "^0.9.3", +diff --git a/rollup.config.es5.js b/rollup.config.es5.js +index 98a83289205a6a16ad6bc51adab1a78e40643721..f1e327878862bebb8f1f7b7846cfd5289ea9f3b4 100644 +--- a/rollup.config.es5.js ++++ b/rollup.config.es5.js +@@ -2,13 +2,11 @@ + import nodeResolve from '@rollup/plugin-node-resolve'; + import commonjs from '@rollup/plugin-commonjs'; + import replace from '@rollup/plugin-replace'; ++import dts from "rollup-plugin-dts"; + + const pkg = require('./package.json'); + +- +- +- +-const config = { ++const config = [{ + + input: 'dist/es6/jssm.js', + +@@ -32,14 +30,21 @@ const config = { + replace({ + preventAssignment : true, + 'process.env.NODE_ENV' : JSON.stringify( 'production' ) +- }) +- +- ] ++ }), + +-}; ++ ]}, { + ++ input: 'dist/es6/jssm.d.ts', + ++ output: { ++ file : './jssm.es5.d.cts', ++ format : 'cjs' ++ }, + ++ plugins : [ + ++ dts() ++ ]} ++]; + + export default config; +diff --git a/rollup.config.es6.js b/rollup.config.es6.js +index 8a976930b3118bc8255c4fdf226523820873e873..6a9dfa422e4dcc335e60284dbca3b3a93ef7518d 100644 +--- a/rollup.config.es6.js ++++ b/rollup.config.es6.js +@@ -2,13 +2,11 @@ + import nodeResolve from '@rollup/plugin-node-resolve'; + import commonjs from '@rollup/plugin-commonjs'; + import replace from '@rollup/plugin-replace'; ++import dts from "rollup-plugin-dts"; + + const pkg = require('./package.json'); + +- +- +- +-const config = { ++const config = [{ + + input: 'dist/es6/jssm.js', + +@@ -32,13 +30,23 @@ const config = { + replace({ + preventAssignment : true, + 'process.env.NODE_ENV' : JSON.stringify( 'production' ) +- }) ++ }), + +- ] ++ ]}, { + +-}; ++ input: 'dist/es6/jssm.d.ts', + ++ output: { ++ file : './jssm.es6.d.ts', ++ format : 'es' ++ }, ++ ++ plugins : [ + ++ dts() ++ ]} ++]; ++ + + + diff --git a/build-tools/pnpm-lock.yaml b/build-tools/pnpm-lock.yaml index abc4db951746..8883f5659ff6 100644 --- a/build-tools/pnpm-lock.yaml +++ b/build-tools/pnpm-lock.yaml @@ -10,6 +10,11 @@ overrides: qs: ^6.11.0 sharp: ^0.33.2 +patchedDependencies: + jssm@5.98.2: + hash: jvxmn6yyt5s6cxokjpzzkp2gqy + path: patches/jssm@5.98.2.patch + importers: .: @@ -27,14 +32,14 @@ importers: specifier: ^17.5.0 version: 17.5.0(commitizen@4.3.0)(inquirer@8.2.5) '@fluid-tools/build-cli': - specifier: ~0.29.0 - version: 0.29.0(typescript@5.1.6) + specifier: ~0.38.0 + version: 0.38.0 '@fluidframework/build-common': specifier: ^2.0.3 version: 2.0.3 '@fluidframework/build-tools': - specifier: ~0.29.0 - version: 0.29.0 + specifier: ~0.38.0 + version: 0.38.0 '@microsoft/api-documenter': specifier: ^7.22.24 version: 7.22.24 @@ -123,8 +128,8 @@ importers: specifier: ^3.2.4 version: 3.2.4 chalk: - specifier: ^2.4.2 - version: 2.4.2 + specifier: ^5.3.0 + version: 5.3.0 change-case: specifier: ^3.1.0 version: 3.1.0 @@ -141,8 +146,8 @@ importers: specifier: ^5.1.1 version: 5.1.1 fs-extra: - specifier: ^9.1.0 - version: 9.1.0 + specifier: ^11.2.0 + version: 11.2.0 globby: specifier: ^11.1.0 version: 11.1.0 @@ -159,8 +164,8 @@ importers: specifier: ^2.2.3 version: 2.2.3 jssm: - specifier: ^5.89.2 - version: 5.89.2 + specifier: 5.98.2 + version: 5.98.2(patch_hash=jvxmn6yyt5s6cxokjpzzkp2gqy) latest-version: specifier: ^5.1.0 version: 5.1.0 @@ -168,8 +173,8 @@ importers: specifier: ^7.4.6 version: 7.4.6 node-fetch: - specifier: ^2.6.9 - version: 2.6.9 + specifier: ^3.3.2 + version: 3.3.2 npm-check-updates: specifier: ^16.14.20 version: 16.14.20 @@ -226,8 +231,8 @@ importers: specifier: ^2.0.3 version: 2.0.3 '@fluidframework/eslint-config-fluid': - specifier: ^5.2.0 - version: 5.2.0(eslint@8.57.0)(typescript@5.1.6) + specifier: ^5.3.0 + version: 5.3.0(eslint@8.57.0)(typescript@5.1.6) '@oclif/test': specifier: ^3.2.12 version: 3.2.12 @@ -244,8 +249,8 @@ importers: specifier: ^4.1.7 version: 4.1.12 '@types/fs-extra': - specifier: ^8.1.2 - version: 8.1.2 + specifier: ^11.0.4 + version: 11.0.4 '@types/inquirer': specifier: ^8.2.6 version: 8.2.6 @@ -301,8 +306,8 @@ importers: specifier: ~9.1.0 version: 9.1.0(eslint@8.57.0) jssm-viz-cli: - specifier: ^5.89.2 - version: 5.89.2 + specifier: 5.97.1 + version: 5.97.1 mocha: specifier: ^10.2.0 version: 10.2.0 @@ -370,8 +375,8 @@ importers: specifier: ^7.0.0 version: 7.0.0 fs-extra: - specifier: ^9.1.0 - version: 9.1.0 + specifier: ^11.2.0 + version: 11.2.0 glob: specifier: ^7.2.3 version: 7.2.3 @@ -416,14 +421,14 @@ importers: specifier: ^2.0.3 version: 2.0.3 '@fluidframework/eslint-config-fluid': - specifier: ^5.2.0 - version: 5.2.0(eslint@8.57.0)(typescript@5.1.6) + specifier: ^5.3.0 + version: 5.3.0(eslint@8.57.0)(typescript@5.1.6) '@types/async': specifier: ^3.2.20 version: 3.2.20 '@types/fs-extra': - specifier: ^8.1.2 - version: 8.1.2 + specifier: ^11.0.4 + version: 11.0.4 '@types/glob': specifier: ^7.2.0 version: 7.2.0 @@ -483,8 +488,8 @@ importers: specifier: ^2.0.3 version: 2.0.3 '@fluidframework/eslint-config-fluid': - specifier: ^5.2.0 - version: 5.2.0(eslint@8.57.0)(typescript@5.1.6) + specifier: ^5.3.0 + version: 5.3.0(eslint@8.57.0)(typescript@5.1.6) '@microsoft/api-extractor': specifier: ^7.43.1 version: 7.43.1(@types/node@18.18.6) @@ -529,8 +534,8 @@ importers: specifier: ^2.0.3 version: 2.0.3 '@fluidframework/eslint-config-fluid': - specifier: ^5.2.0 - version: 5.2.0(eslint@8.57.0)(typescript@5.1.6) + specifier: ^5.3.0 + version: 5.3.0(eslint@8.57.0)(typescript@5.1.6) '@oclif/test': specifier: ^3.2.12 version: 3.2.12 @@ -614,8 +619,8 @@ importers: specifier: ^2.0.3 version: 2.0.3 '@fluidframework/eslint-config-fluid': - specifier: ^5.2.0 - version: 5.2.0(eslint@8.57.0)(typescript@5.1.6) + specifier: ^5.3.0 + version: 5.3.0(eslint@8.57.0)(typescript@5.1.6) '@microsoft/api-extractor': specifier: ^7.43.1 version: 7.43.1(@types/node@18.18.6) @@ -1907,7 +1912,7 @@ packages: dependencies: '@commitlint/top-level': 17.4.0 '@commitlint/types': 17.4.4 - fs-extra: 11.1.1 + fs-extra: 11.2.0 git-raw-commits: 2.0.11 minimist: 1.2.8 dev: true @@ -2050,89 +2055,84 @@ packages: - typescript dev: true - /@fluid-tools/build-cli@0.29.0(typescript@5.1.6): - resolution: {integrity: sha512-gQyW8SfBtP9bdn+6KzaCCVv5Qo0K2gYaIuULSe8VGYWJLtv65ftPnIyZw9T8GZPhXhhmKHDPsCQrGH7Tr1Pucw==} + /@fluid-tools/build-cli@0.38.0: + resolution: {integrity: sha512-QvfpjBidx9+bCsSIeqsZiRLg/dDmYrMZeJvAq6zRxhUynnA74koIIt2hbp0cP4MWbDWxMCMUvgLpzJHKuVVslA==} engines: {node: '>=14.17.0'} hasBin: true dependencies: - '@fluid-tools/version-tools': 0.29.0(typescript@5.1.6) - '@fluidframework/build-tools': 0.29.0 - '@fluidframework/bundle-size-tools': 0.29.0 + '@fluid-tools/version-tools': 0.38.0 + '@fluidframework/build-tools': 0.38.0 + '@fluidframework/bundle-size-tools': 0.38.0 '@microsoft/api-extractor': 7.43.1(@types/node@18.18.6) - '@oclif/core': 3.26.5 - '@oclif/plugin-autocomplete': 2.3.10(typescript@5.1.6) + '@oclif/core': 3.26.6 + '@oclif/plugin-autocomplete': 3.0.16 '@oclif/plugin-commands': 3.3.1 '@oclif/plugin-help': 6.0.21 '@oclif/plugin-not-found': 3.1.7 - '@oclif/plugin-plugins': 3.9.4(typescript@5.1.6) - '@oclif/test': 2.3.33(typescript@5.1.6) '@octokit/core': 4.2.4 '@rushstack/node-core-library': 3.59.5(@types/node@18.18.6) async: 3.2.4 chalk: 2.4.2 + change-case: 3.1.0 danger: 11.3.0 date-fns: 2.30.0 + debug: 4.3.4(supports-color@8.1.1) execa: 5.1.1 fs-extra: 9.1.0 globby: 11.1.0 gray-matter: 4.0.3 human-id: 4.0.0 inquirer: 8.2.5 - jssm: 5.89.2 - jssm-viz-cli: 5.89.2 + json5: 2.2.3 + jssm: 5.98.2(patch_hash=jvxmn6yyt5s6cxokjpzzkp2gqy) latest-version: 5.1.0 minimatch: 7.4.6 node-fetch: 2.6.9 npm-check-updates: 16.14.20 oclif: 4.10.1 - prettier: 3.0.3 + prettier: 3.2.5 prompts: 2.4.2 read-pkg-up: 7.0.1 - semver: 7.5.4 + replace-in-file: 7.1.0 + resolve.exports: 2.0.2 + semver: 7.6.2 semver-utils: 1.1.4 simple-git: 3.19.1 sort-json: 2.0.1 sort-package-json: 1.57.0 strip-ansi: 6.0.1 table: 6.8.1 - ts-morph: 17.0.1 + ts-morph: 22.0.0 type-fest: 2.19.0 transitivePeerDependencies: - '@aws-sdk/client-sso-oidc' - '@aws-sdk/client-sts' - '@swc/core' - - '@swc/wasm' - '@types/node' - aws-crt - bluebird - encoding - esbuild - supports-color - - typescript - uglify-js - webpack-cli dev: true - /@fluid-tools/version-tools@0.29.0(typescript@5.1.6): - resolution: {integrity: sha512-VwVe/3c9W+3P5IfhbAZH/M8h36DiDh9pOsPexjnCCWaFTXZs5kBggxN57/PStYkDTG3MiYGxg8OcM52fWCy+Vg==} + /@fluid-tools/version-tools@0.38.0: + resolution: {integrity: sha512-sPGkM+2BMv0/QSSXwGEl8y+/cprookyS7mKQFdk3UiBlLBPr8uQcNxG1xPxpmM9JwZH63Q55dy56u4TnjuNoNQ==} engines: {node: '>=14.17.0'} hasBin: true dependencies: - '@oclif/core': 3.26.5 - '@oclif/plugin-autocomplete': 2.3.10(typescript@5.1.6) + '@oclif/core': 3.26.6 + '@oclif/plugin-autocomplete': 3.0.16 '@oclif/plugin-commands': 3.3.1 '@oclif/plugin-help': 6.0.21 '@oclif/plugin-not-found': 3.1.7 - '@oclif/plugin-plugins': 3.9.4(typescript@5.1.6) chalk: 2.4.2 - semver: 7.6.0 + semver: 7.6.2 table: 6.8.1 transitivePeerDependencies: - - '@swc/core' - - '@swc/wasm' - - '@types/node' - supports-color - - typescript dev: true /@fluidframework/build-common@2.0.3: @@ -2140,13 +2140,13 @@ packages: hasBin: true dev: true - /@fluidframework/build-tools@0.29.0: - resolution: {integrity: sha512-OJCaj/fzeBjfQeXVeoo4IsbVVj8zsXg+BRmkO3C0DfujIhc2XXsqG2Pd164DNH5rjMBmFzj9R50p0ZHVWXpUuQ==} + /@fluidframework/build-tools@0.38.0: + resolution: {integrity: sha512-ZEUnUmaPDGhKRHQBjFwDW1YEHk1twDMqcB7Bj5fSfDheQyxbBGAOyKDIST7zTn/NB3zpARC3rE3R5/3NFnCCcA==} engines: {node: '>=14.17.0'} hasBin: true dependencies: - '@fluid-tools/version-tools': 0.29.0(typescript@5.1.6) - '@fluidframework/bundle-size-tools': 0.29.0 + '@fluid-tools/version-tools': 0.38.0 + '@fluidframework/bundle-size-tools': 0.38.0 '@manypkg/get-packages': 2.2.0 '@octokit/core': 4.2.4 '@rushstack/node-core-library': 3.59.5(@types/node@18.18.6) @@ -2157,7 +2157,7 @@ packages: date-fns: 2.30.0 debug: 4.3.4(supports-color@8.1.1) detect-indent: 6.1.0 - find-up: 5.0.0 + find-up: 7.0.0 fs-extra: 9.1.0 glob: 7.2.3 ignore: 5.2.4 @@ -2165,17 +2165,15 @@ packages: lodash: 4.17.21 lodash.isequal: 4.5.0 picomatch: 2.3.1 - replace-in-file: 6.3.5 rimraf: 4.4.1 - semver: 7.5.4 + semver: 7.6.2 sort-package-json: 1.57.0 - ts-morph: 17.0.1 + ts-morph: 22.0.0 type-fest: 2.19.0 typescript: 5.1.6 yaml: 2.3.1 transitivePeerDependencies: - '@swc/core' - - '@swc/wasm' - '@types/node' - encoding - esbuild @@ -2184,8 +2182,8 @@ packages: - webpack-cli dev: true - /@fluidframework/bundle-size-tools@0.29.0: - resolution: {integrity: sha512-+FM0oaL1uEnkUVxpuiSXCTSG0Rd/VgGtYFuc449xwUhxJS9rbRhbjYQhyAwx6BDstMAKicTq7i5xLF4srrug7w==} + /@fluidframework/bundle-size-tools@0.38.0: + resolution: {integrity: sha512-OaevKCCZKwnSI1iF3wnSgKR52xwtI74AVJsO1o9rjVyZMd78cdBK2KIZjqv7rIDINaqVlsZnulvrEx+AbBrg/g==} dependencies: azure-devops-node-api: 11.2.0 jszip: 3.10.1 @@ -2200,8 +2198,8 @@ packages: - webpack-cli dev: true - /@fluidframework/eslint-config-fluid@5.2.0(eslint@8.57.0)(typescript@5.1.6): - resolution: {integrity: sha512-FGAt7QIm//36j+ZiiIAj1+LZ6NYP2UJLwE5NT70ztgjl90jaCEWZUgoGUgPUWB9CpTmVZYo1+dGWOSsMLHidJA==} + /@fluidframework/eslint-config-fluid@5.3.0(eslint@8.57.0)(typescript@5.1.6): + resolution: {integrity: sha512-sc8M6ZKnzBxshYZZodMbNgLSn36YdSJfafqAMtDVm2KnHoUP46JM9oLWYbo7xRBXrxEfaojO9q+VIZB0DAn2eg==} dependencies: '@fluid-internal/eslint-plugin-fluid': 0.1.1(eslint@8.57.0)(typescript@5.1.6) '@microsoft/tsdoc': 0.14.2 @@ -2724,13 +2722,13 @@ packages: engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} dependencies: '@gar/promisify': 1.1.3 - semver: 7.6.0 + semver: 7.6.2 /@npmcli/fs@3.1.0: resolution: {integrity: sha512-7kZUAaLscfgbwBQRbvdMYaZOWyMEcPTH/tJjnyAWJ/dvvs9Ef+CERx/qJb9GExJpl1qipaDGn7KqHnFGGixd0w==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} dependencies: - semver: 7.6.0 + semver: 7.6.2 /@npmcli/git@4.1.0: resolution: {integrity: sha512-9hwoB3gStVfa0N31ymBmrX+GuDGdVA/QWShZVqE0HK2Af+7QGGrCTbZia/SW0ImUTjTne7SP91qxDmtXvDHRPQ==} @@ -2786,9 +2784,9 @@ packages: - bluebird - supports-color - /@oclif/core@2.15.0(typescript@5.1.6): - resolution: {integrity: sha512-fNEMG5DzJHhYmI3MgpByTvltBOMyFcnRIUMxbiz2ai8rhaYgaTHMG3Q38HcosfIvtw9nCjxpcQtC8MN8QtVCcA==} - engines: {node: '>=14.0.0'} + /@oclif/core@3.26.5: + resolution: {integrity: sha512-uRmAujGJjLhhgpLylbiuHuPt9Ec7u6aJ72utuSPNTRw47+W5vbQSGnLGPiil1Mt5YDL+zFOyTVH6Uv3NSP2SaQ==} + engines: {node: '>=18.0.0'} dependencies: '@types/cli-progress': 3.11.5 ansi-escapes: 4.3.2 @@ -2797,14 +2795,16 @@ packages: chalk: 4.1.2 clean-stack: 3.0.1 cli-progress: 3.12.0 + color: 4.2.3 debug: 4.3.4(supports-color@8.1.1) - ejs: 3.1.9 + ejs: 3.1.10 get-package-type: 0.1.0 globby: 11.1.0 hyperlinker: 1.0.0 indent-string: 4.0.0 is-wsl: 2.2.0 js-yaml: 3.14.1 + minimatch: 9.0.4 natural-orderby: 2.0.3 object-treeify: 1.1.33 password-prompt: 1.1.3 @@ -2813,20 +2813,12 @@ packages: strip-ansi: 6.0.1 supports-color: 8.1.1 supports-hyperlinks: 2.3.0 - ts-node: 10.9.1(@types/node@18.18.7)(typescript@5.1.6) - tslib: 2.6.2 widest-line: 3.1.0 wordwrap: 1.0.0 wrap-ansi: 7.0.0 - transitivePeerDependencies: - - '@swc/core' - - '@swc/wasm' - - '@types/node' - - typescript - dev: true - /@oclif/core@3.26.5: - resolution: {integrity: sha512-uRmAujGJjLhhgpLylbiuHuPt9Ec7u6aJ72utuSPNTRw47+W5vbQSGnLGPiil1Mt5YDL+zFOyTVH6Uv3NSP2SaQ==} + /@oclif/core@3.26.6: + resolution: {integrity: sha512-+FiTw1IPuJTF9tSAlTsY8bGK4sgthehjz7c2SvYdgQncTkxI2xvUch/8QpjNYGLEmUneNygvYMRBax2KJcLccA==} engines: {node: '>=18.0.0'} dependencies: '@types/cli-progress': 3.11.5 @@ -2857,20 +2849,6 @@ packages: widest-line: 3.1.0 wordwrap: 1.0.0 wrap-ansi: 7.0.0 - - /@oclif/plugin-autocomplete@2.3.10(typescript@5.1.6): - resolution: {integrity: sha512-Ow1AR8WtjzlyCtiWWPgzMyT8SbcDJFr47009riLioHa+MHX2BCDtVn2DVnN/E6b9JlPV5ptQpjefoRSNWBesmg==} - engines: {node: '>=12.0.0'} - dependencies: - '@oclif/core': 2.15.0(typescript@5.1.6) - chalk: 4.1.2 - debug: 4.3.4(supports-color@8.1.1) - transitivePeerDependencies: - - '@swc/core' - - '@swc/wasm' - - '@types/node' - - supports-color - - typescript dev: true /@oclif/plugin-autocomplete@3.0.16: @@ -2883,7 +2861,6 @@ packages: ejs: 3.1.10 transitivePeerDependencies: - supports-color - dev: false /@oclif/plugin-commands@3.3.1: resolution: {integrity: sha512-SikJBlXaVsbCX3A8YBdpU70VvU58P75+4vMt0AtJFEPYS1n+5srrLJgTrEFJkCfFvlqj1SNI9yMFr1TG+LKN9w==} @@ -2910,30 +2887,6 @@ packages: chalk: 5.3.0 fast-levenshtein: 3.0.0 - /@oclif/plugin-plugins@3.9.4(typescript@5.1.6): - resolution: {integrity: sha512-JtumjspRdzJgHk1S10wu68tdlqSnyYRmSgCsmsc6AEvU+Orb0DQfrAgJEO77rPKPNo5MfnVAj0WyCDTi0JT/vw==} - engines: {node: '>=16'} - dependencies: - '@oclif/core': 2.15.0(typescript@5.1.6) - chalk: 4.1.2 - debug: 4.3.4(supports-color@8.1.1) - http-call: 5.3.0 - load-json-file: 5.3.0 - npm: 9.8.1 - npm-run-path: 4.0.1 - semver: 7.6.0 - shelljs: 0.8.5 - tslib: 2.6.2 - validate-npm-package-name: 5.0.0 - yarn: 1.22.19 - transitivePeerDependencies: - - '@swc/core' - - '@swc/wasm' - - '@types/node' - - supports-color - - typescript - dev: true - /@oclif/plugin-warn-if-update-available@3.0.15: resolution: {integrity: sha512-JtPTJFjL6izMCe5dDS2ix2PyWAD2DeJ5Atzd2HHRifbPcmOxaUE62FKTnarIwfPHLMF/nN33liwo9InAdirozg==} engines: {node: '>=18.0.0'} @@ -2946,20 +2899,6 @@ packages: transitivePeerDependencies: - supports-color - /@oclif/test@2.3.33(typescript@5.1.6): - resolution: {integrity: sha512-AmhsxZRDDqJHTk1mDQ+Rl3mNUvb7GIXNcNdP7G7r5l3fRYBUsbzflSy3M760WZfAW4r85rnB+SNG5OBvmajWow==} - engines: {node: '>=12.0.0'} - dependencies: - '@oclif/core': 2.15.0(typescript@5.1.6) - fancy-test: 2.0.42 - transitivePeerDependencies: - - '@swc/core' - - '@swc/wasm' - - '@types/node' - - supports-color - - typescript - dev: true - /@oclif/test@3.2.12: resolution: {integrity: sha512-6DqfPVnCuUaH4VqwAChTWlNla4uPVx3XP5EaxYLjQrSdAzgPn8TMftURDmcfDobU6qQr97Cywec4szfYg4pS7Q==} engines: {node: '>=18.0.0'} @@ -3835,15 +3774,6 @@ packages: resolution: {integrity: sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==} engines: {node: '>= 10'} - /@ts-morph/common@0.18.1: - resolution: {integrity: sha512-RVE+zSRICWRsfrkAw5qCAK+4ZH9kwEFv5h0+/YeHTLieWP7F4wWq4JsKFuNWG+fYh/KF+8rAtgdj5zb2mm+DVA==} - dependencies: - fast-glob: 3.3.2 - minimatch: 5.1.6 - mkdirp: 1.0.4 - path-browserify: 1.0.1 - dev: true - /@ts-morph/common@0.21.0: resolution: {integrity: sha512-ES110Mmne5Vi4ypUKrtVQfXFDtCsDXiUiGxF6ILVlE90dDD4fdpC1LSjydl/ml7xJWKSDZwUYD2zkOePMSrPBA==} dependencies: @@ -3860,7 +3790,6 @@ packages: minimatch: 9.0.4 mkdirp: 3.0.1 path-browserify: 1.0.1 - dev: false /@tsconfig/node10@1.0.9: resolution: {integrity: sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==} @@ -3940,10 +3869,11 @@ packages: /@types/estree@1.0.1: resolution: {integrity: sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA==} - /@types/fs-extra@8.1.2: - resolution: {integrity: sha512-SvSrYXfWSc7R4eqnOzbQF4TZmfpNSM9FrSWLU3EUnWBuyZqNBOrv1B1JA3byUDPUl9z4Ab3jeZG2eDdySlgNMg==} + /@types/fs-extra@11.0.4: + resolution: {integrity: sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ==} dependencies: - '@types/node': 18.18.6 + '@types/jsonfile': 6.1.4 + '@types/node': 18.18.7 dev: true /@types/glob@7.2.0: @@ -3973,6 +3903,12 @@ packages: resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==} dev: true + /@types/jsonfile@6.1.4: + resolution: {integrity: sha512-D5qGUYwjvnNNextdU59/+fI+spnwtTFmyQP0h+PfIOSkNfpU6AOICUOkm4i0OnSk+NyjdPJrxCDro0sJsWlRpQ==} + dependencies: + '@types/node': 18.18.7 + dev: true + /@types/keyv@3.1.4: resolution: {integrity: sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==} dependencies: @@ -4160,7 +4096,7 @@ packages: graphemer: 1.4.0 ignore: 5.2.4 natural-compare: 1.4.0 - semver: 7.6.0 + semver: 7.6.2 ts-api-utils: 1.0.3(typescript@5.1.6) typescript: 5.1.6 transitivePeerDependencies: @@ -4315,7 +4251,7 @@ packages: debug: 4.3.4(supports-color@8.1.1) globby: 11.1.0 is-glob: 4.0.3 - semver: 7.6.0 + semver: 7.6.2 tsutils: 3.21.0(typescript@5.1.6) typescript: 5.1.6 transitivePeerDependencies: @@ -4358,7 +4294,7 @@ packages: debug: 4.3.4(supports-color@8.1.1) globby: 11.1.0 is-glob: 4.0.3 - semver: 7.6.0 + semver: 7.6.2 ts-api-utils: 1.0.3(typescript@5.1.6) typescript: 5.1.6 transitivePeerDependencies: @@ -4379,7 +4315,7 @@ packages: '@typescript-eslint/typescript-estree': 5.59.11(typescript@5.1.6) eslint: 8.57.0 eslint-scope: 5.1.1 - semver: 7.6.0 + semver: 7.6.2 transitivePeerDependencies: - supports-color - typescript @@ -4417,7 +4353,7 @@ packages: '@typescript-eslint/types': 6.7.5 '@typescript-eslint/typescript-estree': 6.7.5(typescript@5.1.6) eslint: 8.57.0 - semver: 7.6.0 + semver: 7.6.2 transitivePeerDependencies: - supports-color - typescript @@ -4875,6 +4811,7 @@ packages: /at-least-node@1.0.0: resolution: {integrity: sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==} engines: {node: '>= 4.0.0'} + dev: true /available-typed-arrays@1.0.5: resolution: {integrity: sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==} @@ -5035,7 +4972,7 @@ packages: dependencies: '@npmcli/fs': 3.1.0 fs-minipass: 3.0.2 - glob: 10.2.7 + glob: 10.3.12 lru-cache: 7.18.3 minipass: 5.0.0 minipass-collect: 1.0.2 @@ -5110,7 +5047,6 @@ packages: dependencies: no-case: 2.3.2 upper-case: 1.1.3 - dev: false /camel-case@4.1.2: resolution: {integrity: sha512-gxGWBrTT1JuMx6R+o5PTXMmUnhnVzLQ9SNutD4YqKtI6ap897t3tKECYla6gCWEkplXnlNybEkZg9GEGxKFCgw==} @@ -5229,7 +5165,6 @@ packages: title-case: 2.1.1 upper-case: 1.1.3 upper-case-first: 1.1.2 - dev: false /change-case@4.1.2: resolution: {integrity: sha512-bSxY2ws9OtviILG1EiY5K7NNxkqg/JnRnFxLtKQ96JaviiIxi7djMrSd0ECT9AC+lttClmYwKw53BWpOMblo7A==} @@ -5390,17 +5325,12 @@ packages: resolution: {integrity: sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==} engines: {node: '>=0.8'} - /code-block-writer@11.0.3: - resolution: {integrity: sha512-NiujjUFB4SwScJq2bwbYUtXbZhBSlY6vYzm++3Q6oC+U+injTqfPYFK8wS9COOmb2lueqp0ZRB4nK1VYeHgNyw==} - dev: true - /code-block-writer@12.0.0: resolution: {integrity: sha512-q4dMFMlXtKR3XNBHyMHt/3pwYNA69EDk00lloMOaaUMKPUXBw6lpXtbu3MMVG6/uOihGnRDOlkyqsONEUj60+w==} dev: true /code-block-writer@13.0.1: resolution: {integrity: sha512-c5or4P6erEA69TxaxTNcHUNcIn+oyxSRTOWV+pSYF+z4epXqNvwvJ70XPGjPNgue83oAFAPBRQYwpAJ/Hpe/Sg==} - dev: false /color-convert@1.9.3: resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==} @@ -5557,7 +5487,6 @@ packages: dependencies: snake-case: 2.1.0 upper-case: 1.1.3 - dev: false /constant-case@3.0.4: resolution: {integrity: sha512-I2hSBi7Vvs7BEuJDr5dDHfzb/Ruj3FyvFyh7KLilAjNQw3Be+xgqUBA2W6scVEcL0hL1dwPRtIqEPVUCKkSsyQ==} @@ -5928,6 +5857,11 @@ packages: engines: {node: '>=8'} dev: true + /data-uri-to-buffer@4.0.1: + resolution: {integrity: sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==} + engines: {node: '>= 12'} + dev: false + /date-fns@2.30.0: resolution: {integrity: sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==} engines: {node: '>=0.11'} @@ -6135,7 +6069,6 @@ packages: resolution: {integrity: sha512-HnM6ZlFqcajLsyudHq7LeeLDr2rFAVYtDv/hV5qchQEidSck8j9OPUsXY9KwJv/lHMtYlX4DjRQqwFYa+0r8Ug==} dependencies: no-case: 2.3.2 - dev: false /dot-case@3.0.4: resolution: {integrity: sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==} @@ -6178,14 +6111,6 @@ packages: dependencies: jake: 10.8.5 - /ejs@3.1.9: - resolution: {integrity: sha512-rC+QVNMJWv+MtPgkt0y+0rVEIdbtxVADApW9JXrUVlzHetgcyczP/E7DJmWJ4fJCZF2cPcBk0laWO9ZHMG3DmQ==} - engines: {node: '>=0.10.0'} - hasBin: true - dependencies: - jake: 10.8.5 - dev: true - /electron-to-chromium@1.4.271: resolution: {integrity: sha512-BCPBtK07xR1/uY2HFDtl3wK2De66AW4MSiPlLrnPNxKC/Qhccxd59W73654S3y6Rb/k3hmuGJOBnhjfoutetXA==} @@ -6594,7 +6519,7 @@ packages: is-glob: 4.0.3 minimatch: 3.1.2 resolve: 1.22.8 - semver: 7.6.0 + semver: 7.6.2 transitivePeerDependencies: - '@typescript-eslint/parser' - eslint-import-resolver-typescript @@ -6651,7 +6576,7 @@ packages: eslint: 8.57.0 esquery: 1.5.0 is-builtin-module: 3.2.1 - semver: 7.6.0 + semver: 7.6.2 spdx-expression-parse: 3.0.1 transitivePeerDependencies: - supports-color @@ -6783,7 +6708,7 @@ packages: read-pkg-up: 7.0.1 regexp-tree: 0.1.27 regjsparser: 0.10.0 - semver: 7.6.0 + semver: 7.6.2 strip-indent: 3.0.0 dev: true @@ -6995,22 +6920,6 @@ packages: iconv-lite: 0.4.24 tmp: 0.0.33 - /fancy-test@2.0.42: - resolution: {integrity: sha512-TX8YTALYAmExny+f+G24MFxWry3Pk09+9uykwRjfwjibRxJ9ZjJzrnHYVBZK46XQdyli7d+rQc5U/KK7V6uLsw==} - engines: {node: '>=12.0.0'} - dependencies: - '@types/chai': 4.3.5 - '@types/lodash': 4.14.195 - '@types/node': 18.18.7 - '@types/sinon': 10.0.13 - lodash: 4.17.21 - mock-stdin: 1.0.0 - nock: 13.3.4 - stdout-stderr: 0.1.13 - transitivePeerDependencies: - - supports-color - dev: true - /fancy-test@3.0.14: resolution: {integrity: sha512-FkiDltQA8PBZzw5tUnMrP1QtwIdNQWxxbZK5C22M9wu6HfFNciwkG3D9siT4l4s1fBTDaEG+Fdkbpi9FDTxtrg==} engines: {node: '>=18.0.0'} @@ -7084,6 +6993,14 @@ packages: dependencies: reusify: 1.0.4 + /fetch-blob@3.2.0: + resolution: {integrity: sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==} + engines: {node: ^12.20 || >= 14.13} + dependencies: + node-domexception: 1.0.0 + web-streams-polyfill: 3.3.3 + dev: false + /figures@2.0.0: resolution: {integrity: sha512-Oa2M9atig69ZkfwiApY8F2Yy+tzMbazyvqv21R0NsSC8floSOC09BbT1ITWAdoMGQvJ/aZnR1KMwdx9tvHnTNA==} engines: {node: '>=4'} @@ -7173,7 +7090,6 @@ packages: locate-path: 7.2.0 path-exists: 5.0.0 unicorn-magic: 0.1.0 - dev: false /find-yarn-workspace-root@2.0.0: resolution: {integrity: sha512-1IMnbjt4KzsQfnhnzNd8wUEgXZ44IzZaZmnLYx7D5FZlaHt2gW20Cri8Q+E/t5tIj4+epTBub+2Zxu/vNILzqQ==} @@ -7249,6 +7165,13 @@ packages: combined-stream: 1.0.8 mime-types: 2.1.35 + /formdata-polyfill@4.0.10: + resolution: {integrity: sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==} + engines: {node: '>=12.20.0'} + dependencies: + fetch-blob: 3.2.0 + dev: false + /fp-and-or@0.1.4: resolution: {integrity: sha512-+yRYRhpnFPWXSly/6V4Lw9IfOV26uu30kynGJ03PW+MnjOEQe45RZ141QcS0aJehYBYA50GfCDnsRbFJdhssRw==} engines: {node: '>=10'} @@ -7266,6 +7189,14 @@ packages: universalify: 2.0.0 dev: true + /fs-extra@11.2.0: + resolution: {integrity: sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==} + engines: {node: '>=14.14'} + dependencies: + graceful-fs: 4.2.11 + jsonfile: 6.1.0 + universalify: 2.0.0 + /fs-extra@7.0.1: resolution: {integrity: sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==} engines: {node: '>=6 <7 || >=8'} @@ -7290,6 +7221,7 @@ packages: graceful-fs: 4.2.11 jsonfile: 6.1.0 universalify: 2.0.0 + dev: true /fs-minipass@2.1.0: resolution: {integrity: sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==} @@ -7489,17 +7421,6 @@ packages: /glob-to-regexp@0.4.1: resolution: {integrity: sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==} - /glob@10.2.7: - resolution: {integrity: sha512-jTKehsravOJo8IJxUGfZILnkvVJM/MOfHRs8QcXolVef2zNI9Tqyy5+SeuOAZd3upViEZQLyFpQhYiHLrMUNmA==} - engines: {node: '>=16 || 14 >=14.17'} - hasBin: true - dependencies: - foreground-child: 3.1.1 - jackspeak: 2.2.1 - minimatch: 9.0.4 - minipass: 6.0.2 - path-scurry: 1.9.2 - /glob@10.3.12: resolution: {integrity: sha512-TCNv8vJ+xz4QiqTpfOJA7HvYv+tNIRHKfUWw/q+v2jdgN4ebz+KY9tGx5J4rHP0o84mNP+ApH66HRX8us3Khqg==} engines: {node: '>=16 || 14 >=14.17'} @@ -7807,7 +7728,6 @@ packages: dependencies: no-case: 2.3.2 upper-case: 1.1.3 - dev: false /header-case@2.0.4: resolution: {integrity: sha512-H/vuk5TEEVZwrR0lp2zed9OCo1uAILMlx0JEMgC26rzyJJ3N1v6XkwHHXJQdR2doSjcGPM6OKPYoJgf0plJ11Q==} @@ -8034,11 +7954,6 @@ packages: side-channel: 1.0.4 dev: true - /interpret@1.4.0: - resolution: {integrity: sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==} - engines: {node: '>= 0.10'} - dev: true - /ip@2.0.1: resolution: {integrity: sha512-lJUL9imLTNi1ZfXT+DU6rBBdbiKGBuay9B6xGSPVjUeQwaH1RIGqef8RZkUtHioLmSNpPR5M4HVKJGm1j8FWVQ==} @@ -8173,7 +8088,6 @@ packages: resolution: {integrity: sha512-+5A1e/WJpLLXZEDlgz4G//WYSHyQBD32qa4Jd3Lw06qQlv3fJHnp3YIHjTQSGzHMgzmVKz2ZP3rBxTHkPw/lxA==} dependencies: lower-case: 1.1.4 - dev: false /is-map@2.0.2: resolution: {integrity: sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg==} @@ -8293,7 +8207,6 @@ packages: resolution: {integrity: sha512-GQYSJMgfeAmVwh9ixyk888l7OIhNAGKtY6QA+IrWlu9MDTCaXmeozOZ2S9Knj7bQwBO/H6J2kb+pbyTUiMNbsw==} dependencies: upper-case: 1.1.3 - dev: false /is-utf8@0.2.1: resolution: {integrity: sha512-rMYPYvCzsXywIsldgLaSoPlw5PfoB/ssr7hY4pLfcodrA5M/eArza1a9VmTiNIBNMjOGr1Ow9mTyU2o69U6U9Q==} @@ -8377,14 +8290,6 @@ packages: set-function-name: 2.0.1 dev: true - /jackspeak@2.2.1: - resolution: {integrity: sha512-MXbxovZ/Pm42f6cDIDkl3xpwv1AGwObKwfmjs2nQePiy85tP3fatofl3FC1aBsOtP/6fq5SbtgHwWcMsLP+bDw==} - engines: {node: '>=14'} - dependencies: - '@isaacs/cliui': 8.0.2 - optionalDependencies: - '@pkgjs/parseargs': 0.11.0 - /jackspeak@2.3.6: resolution: {integrity: sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==} engines: {node: '>=14'} @@ -8546,39 +8451,40 @@ packages: ms: 2.1.3 semver: 7.6.0 - /jssm-viz-cli@5.89.2: - resolution: {integrity: sha512-LMUh0iqc8vXK1IzbarXgmWyeNEAHoYOIS0qt6NeC4slIhY+l3Pz7t1Qh+FLLbtECXWJJcBdlUMeLVB2E4re5Bg==} + /jssm-viz-cli@5.97.1: + resolution: {integrity: sha512-QuPQm4ZyKkUl9wZuVqBGlBSGHwnkGK2ZDc2ycGGbORkZ3cecntuLk39mcxtkriaBySc8bJMT9IEXTF8ifUDxQw==} hasBin: true dependencies: ansi-256-colors: 1.1.0 better_git_changelog: 1.6.2 commander: 4.1.1 glob: 7.2.3 - jssm-viz: 5.89.2 + jssm-viz: 5.98.2 sharp: 0.33.2 transitivePeerDependencies: - supports-color dev: true - /jssm-viz@5.89.2: - resolution: {integrity: sha512-2kKqnTsgJ+ncSX3IsrpclVIcZH6UGyTLGRfc7axTKhViTWoftJF2WxBA02Smc5ZkmXOov2t3jsuBBJ+IJ3lZ7Q==} + /jssm-viz@5.98.2: + resolution: {integrity: sha512-OzcmYT2urCfo+qnwoD/TCYtwUG9r+XYHweKhDQoy6BfhCd5/G0Ir50BLea8bvKinmYjnShmc3Per/sR+WcYPlQ==} dependencies: better_git_changelog: 1.6.2 eslint: 8.57.0 - jssm: 5.89.2 + jssm: 5.98.2(patch_hash=jvxmn6yyt5s6cxokjpzzkp2gqy) reduce-to-639-1: 1.1.0 text_audit: 0.9.3 transitivePeerDependencies: - supports-color dev: true - /jssm@5.89.2: - resolution: {integrity: sha512-I70+UdH7KZs542loBlsh1xKDsT5Lx5RZWf6hKmujzgvSJj9DRymEe46HUCTd6+hzouIebuNwQo5I2ftMzfrhnQ==} + /jssm@5.98.2(patch_hash=jvxmn6yyt5s6cxokjpzzkp2gqy): + resolution: {integrity: sha512-O2xBFBzZjLIN+wA5IA85XIaEan7wjvM2qegwVrVQPClbH/IEhI1GLkLEEfk+TPeHeW8pGOlrd84MnmTcDyxSIQ==} engines: {node: '>=10.0.0'} dependencies: better_git_changelog: 1.6.2 circular_buffer_js: 1.10.0 reduce-to-639-1: 1.1.0 + patched: true /jsx-ast-utils@3.3.3: resolution: {integrity: sha512-fYQHZTZ8jSfmWZ0iyzfwiU4WDX4HpHbMCZ3gPlWYiCl3BoeOTsqKBqnTVfH2rYT7eP5c3sVbeSPHnnJOaTrWiw==} @@ -8676,17 +8582,6 @@ packages: strip-bom: 3.0.0 dev: true - /load-json-file@5.3.0: - resolution: {integrity: sha512-cJGP40Jc/VXUsp8/OrnyKyTZ1y6v/dphm3bioS+RrKXjK2BB6wHUd6JptZEFDGgGahMT+InnZO5i1Ei9mpC8Bw==} - engines: {node: '>=6'} - dependencies: - graceful-fs: 4.2.11 - parse-json: 4.0.0 - pify: 4.0.1 - strip-bom: 3.0.0 - type-fest: 0.3.1 - dev: true - /loader-runner@4.3.0: resolution: {integrity: sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==} engines: {node: '>=6.11.5'} @@ -8716,7 +8611,6 @@ packages: engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} dependencies: p-locate: 6.0.0 - dev: false /lodash._reinterpolate@3.0.0: resolution: {integrity: sha512-xYHt68QRoYGjeeM/XOE1uJtvXQAgvszfBhjV4yvsQH0u2i9I6cI6c6/eG4Hh3UAOVn0y/xAXwmTzEay49Q//HA==} @@ -8868,11 +8762,9 @@ packages: resolution: {integrity: sha512-UuxaYakO7XeONbKrZf5FEgkantPf5DUqDayzP5VXZrtRPdH86s4kN47I8B3TW10S4QKiE3ziHNf3kRN//okHjA==} dependencies: lower-case: 1.1.4 - dev: false /lower-case@1.1.4: resolution: {integrity: sha512-2Fgx1Ycm599x+WGpIYwJOvsjmXFzTSc34IwDWALRA/8AopUKAVPwfJ+h5+f85BCp0PWmmJcWzEpxOpoXycMpdA==} - dev: false /lower-case@2.0.2: resolution: {integrity: sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==} @@ -9243,7 +9135,6 @@ packages: resolution: {integrity: sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==} engines: {node: '>=10'} hasBin: true - dev: false /mocha-json-output-reporter@2.1.0(mocha@10.2.0)(moment@2.29.4): resolution: {integrity: sha512-FF2BItlMo8nK9+SgN/WAD01ue7G+qI1Po0U3JCZXQiiyTJ5OV3KcT1mSoZKirjYP73JFZznaaPC6Mp052PF3Vw==} @@ -9377,7 +9268,6 @@ packages: resolution: {integrity: sha512-rmTZ9kz+f3rCvK2TD1Ue/oZlns7OGoIWP4fc3llxxRXlOkHKoWPPWJOfFYpITabSow43QJbRIoHQXtt10VldyQ==} dependencies: lower-case: 1.1.4 - dev: false /no-case@3.0.4: resolution: {integrity: sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==} @@ -9385,18 +9275,6 @@ packages: lower-case: 2.0.2 tslib: 2.6.2 - /nock@13.3.4: - resolution: {integrity: sha512-DDpmn5oLEdCTclEqweOT4U7bEpuoifBMFUXem9sA4turDAZ5tlbrEoWqCorwXey8CaAw44mst5JOQeVNiwtkhw==} - engines: {node: '>= 10.13'} - dependencies: - debug: 4.3.4(supports-color@8.1.1) - json-stringify-safe: 5.0.1 - lodash: 4.17.21 - propagate: 2.0.1 - transitivePeerDependencies: - - supports-color - dev: true - /nock@13.5.4: resolution: {integrity: sha512-yAyTfdeNJGGBFxWdzSKCBYxs5FxLbCg5X5Q4ets974hcQzG1+qCxvIyOo4j2Ry6MUlhWVMX4OoYDefAIIwupjw==} engines: {node: '>= 10.13'} @@ -9411,6 +9289,11 @@ packages: /node-cleanup@2.1.2: resolution: {integrity: sha512-qN8v/s2PAJwGUtr1/hYTpNKlD6Y9rc4p8KSmJXyGdYGZsDGKXrGThikLFP9OCHFeLeEpQzPwiAtdIvBLqm//Hw==} + /node-domexception@1.0.0: + resolution: {integrity: sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==} + engines: {node: '>=10.5.0'} + dev: false + /node-fetch@2.6.9: resolution: {integrity: sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==} engines: {node: 4.x || >=6.0.0} @@ -9422,6 +9305,15 @@ packages: dependencies: whatwg-url: 5.0.0 + /node-fetch@3.3.2: + resolution: {integrity: sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + data-uri-to-buffer: 4.0.1 + fetch-blob: 3.2.0 + formdata-polyfill: 4.0.10 + dev: false + /node-gyp@9.3.1: resolution: {integrity: sha512-4Q16ZCqq3g8awk6UplT7AuxQ35XN4R/yf/+wSAwcBUAjg7l58RTactWaP8fIDTi0FzI7YcVLujwExakZlfWkXg==} engines: {node: ^12.13 || ^14.13 || >=16} @@ -9434,7 +9326,7 @@ packages: nopt: 6.0.0 npmlog: 6.0.2 rimraf: 3.0.2 - semver: 7.6.0 + semver: 7.6.2 tar: 6.2.1 which: 2.0.2 transitivePeerDependencies: @@ -9481,7 +9373,7 @@ packages: dependencies: hosted-git-info: 6.1.1 is-core-module: 2.13.1 - semver: 7.6.0 + semver: 7.6.2 validate-npm-package-license: 3.0.4 /normalize-path@3.0.0: @@ -9553,7 +9445,7 @@ packages: resolution: {integrity: sha512-dH3GmQL4vsPtld59cOn8uY0iOqRmqKvV+DLGwNXV/Q7MDgD2QfOADWd/mFXcIE5LVhYYGjA3baz6W9JneqnuCw==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} dependencies: - semver: 7.6.0 + semver: 7.6.2 /npm-normalize-package-bin@3.0.1: resolution: {integrity: sha512-dMxCf+zZ+3zeQZXKxmyuCKlIDPGuv8EF940xbkC4kQVDTtqoh6rJFO+JTKSA6/Rwi0getWmtuy4Itup0AMcaDQ==} @@ -9603,81 +9495,6 @@ packages: dependencies: path-key: 3.1.1 - /npm@9.8.1: - resolution: {integrity: sha512-AfDvThQzsIXhYgk9zhbk5R+lh811lKkLAeQMMhSypf1BM7zUafeIIBzMzespeuVEJ0+LvY36oRQYf7IKLzU3rw==} - engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} - hasBin: true - dev: true - bundledDependencies: - - '@isaacs/string-locale-compare' - - '@npmcli/arborist' - - '@npmcli/config' - - '@npmcli/fs' - - '@npmcli/map-workspaces' - - '@npmcli/package-json' - - '@npmcli/promise-spawn' - - '@npmcli/run-script' - - abbrev - - archy - - cacache - - chalk - - ci-info - - cli-columns - - cli-table3 - - columnify - - fastest-levenshtein - - fs-minipass - - glob - - graceful-fs - - hosted-git-info - - ini - - init-package-json - - is-cidr - - json-parse-even-better-errors - - libnpmaccess - - libnpmdiff - - libnpmexec - - libnpmfund - - libnpmhook - - libnpmorg - - libnpmpack - - libnpmpublish - - libnpmsearch - - libnpmteam - - libnpmversion - - make-fetch-happen - - minimatch - - minipass - - minipass-pipeline - - ms - - node-gyp - - nopt - - npm-audit-report - - npm-install-checks - - npm-package-arg - - npm-pick-manifest - - npm-profile - - npm-registry-fetch - - npm-user-validate - - npmlog - - p-map - - pacote - - parse-conflict-json - - proc-log - - qrcode-terminal - - read - - semver - - sigstore - - ssri - - supports-color - - tar - - text-table - - tiny-relative-date - - treeverse - - validate-npm-package-name - - which - - write-file-atomic - /npmlog@6.0.2: resolution: {integrity: sha512-/vBvz5Jfr9dT/aFWd0FIRf+T/Q2WBsLENygUaFUqstqsycmZAP/t5BvFJTK0viFmSUxiUKTUplWy5vt+rvKIxg==} engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} @@ -9883,7 +9700,6 @@ packages: engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} dependencies: yocto-queue: 1.0.0 - dev: false /p-locate@2.0.0: resolution: {integrity: sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg==} @@ -9909,7 +9725,6 @@ packages: engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} dependencies: p-limit: 4.0.0 - dev: false /p-map@4.0.0: resolution: {integrity: sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==} @@ -9942,7 +9757,7 @@ packages: got: 12.5.3 registry-auth-token: 5.0.2 registry-url: 6.0.1 - semver: 7.6.0 + semver: 7.6.2 /pacote@15.2.0: resolution: {integrity: sha512-rJVZeIwHTUta23sIZgEIM62WYwbmGbThdbnkt81ravBplQv+HjyroqnLRNH2+sLJHcGZmLRmhPwACqhfTcOmnA==} @@ -9981,7 +9796,6 @@ packages: resolution: {integrity: sha512-eQE845L6ot89sk2N8liD8HAuH4ca6Vvr7VWAWwt7+kvvG5aBcPmmphQ68JsEG2qa9n1TykS2DLeMt363AAH8/w==} dependencies: no-case: 2.3.2 - dev: false /param-case@3.0.4: resolution: {integrity: sha512-RXlj7zCYokReqWpOPH9oYivUzLYZ5vAPIfEmCTNViosC78F8F0H9y7T7gG2M39ymgutxF5gcFEsyZQSph9Bp3A==} @@ -10041,7 +9855,6 @@ packages: dependencies: camel-case: 3.0.0 upper-case-first: 1.1.2 - dev: false /pascal-case@3.1.2: resolution: {integrity: sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g==} @@ -10062,7 +9875,6 @@ packages: resolution: {integrity: sha512-Ou0N05MioItesaLr9q8TtHVWmJ6fxWdqKB2RohFmNWVyJ+2zeKIeDNWAN6B/Pe7wpzWChhZX6nONYmOnMeJQ/Q==} dependencies: no-case: 2.3.2 - dev: false /path-case@3.0.4: resolution: {integrity: sha512-qO4qCFjXqVTrcbPt/hQfhTQ+VhFsqNKOPtytgNKkKxSoEp3XPUQ8ObFuePylOIok5gjn69ry8XiULxCwot3Wfg==} @@ -10082,7 +9894,6 @@ packages: /path-exists@5.0.0: resolution: {integrity: sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dev: false /path-is-absolute@1.0.1: resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} @@ -10166,17 +9977,10 @@ packages: resolution: {integrity: sha512-ravE6m9Atw9Z/jjttRUZ+clIXogdghyZAuWJ3qEzjT+jI/dL1ifAqhZeC5VHzQp1MSt1+jxKkFNemj/iO7tVUA==} engines: {node: '>=4'} - /prettier@3.0.3: - resolution: {integrity: sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==} - engines: {node: '>=14'} - hasBin: true - dev: true - /prettier@3.2.5: resolution: {integrity: sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==} engines: {node: '>=14'} hasBin: true - dev: false /prettyjson@1.2.5: resolution: {integrity: sha512-rksPWtoZb2ZpT5OVgtmy0KHVM+Dca3iVwWY9ifwhcexfjebtgjg3wmrUt9PvJ59XIYBcknQeYHD8IAnVlh9lAw==} @@ -10332,7 +10136,7 @@ packages: resolution: {integrity: sha512-AEtWXYfopBj2z5N5PbkAOeNHRPUg5q+Nen7QLxV8M2zJq1ym6/lCz3fYNTCXe19puu2d06jfHhrP7v/S2PtMMw==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} dependencies: - glob: 10.2.7 + glob: 10.3.12 json-parse-even-better-errors: 3.0.0 normalize-package-data: 5.0.0 npm-normalize-package-bin: 3.0.1 @@ -10427,13 +10231,6 @@ packages: resolution: {integrity: sha512-gNva8/6UAe8QYepIQH/jQ2qn91Qj0B9sYjMBBs3QOB8F2CXcKgLxQaJRP76sWVRQt+QU+8fAkCbCvjjMFu7Ycw==} engines: {node: '>= 0.8.0'} - /rechoir@0.6.2: - resolution: {integrity: sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==} - engines: {node: '>= 0.10'} - dependencies: - resolve: 1.22.8 - dev: true - /redent@3.0.0: resolution: {integrity: sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==} engines: {node: '>=8'} @@ -10519,16 +10316,6 @@ packages: resolution: {integrity: sha512-C9hAO4eoEsX+OXA4rla66pXZQ+TLQ8T9dttgQj18yuKlPMTVkIkdYXvlMC55IuUsIkV6DpmQYi10JKFLaU+l7w==} engines: {node: '>=8'} - /replace-in-file@6.3.5: - resolution: {integrity: sha512-arB9d3ENdKva2fxRnSjwBEXfK1npgyci7ZZuwysgAp7ORjHSyxz6oqIjTEv8R0Ydl4Ll7uOAZXL4vbkhGIizCg==} - engines: {node: '>=10'} - hasBin: true - dependencies: - chalk: 4.1.2 - glob: 7.2.3 - yargs: 17.7.2 - dev: true - /replace-in-file@7.1.0: resolution: {integrity: sha512-1uZmJ78WtqNYCSuPC9IWbweXkGxPOtk2rKuar8diTw7naVIQZiE3Tm8ACx2PCMXDtVH6N+XxwaRY2qZ2xHPqXw==} engines: {node: '>=10'} @@ -10537,7 +10324,6 @@ packages: chalk: 4.1.2 glob: 8.1.0 yargs: 17.7.2 - dev: false /require-directory@2.1.1: resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} @@ -10581,7 +10367,6 @@ packages: /resolve.exports@2.0.2: resolution: {integrity: sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==} engines: {node: '>=10'} - dev: false /resolve@1.19.0: resolution: {integrity: sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==} @@ -10812,12 +10597,16 @@ packages: dependencies: lru-cache: 6.0.0 + /semver@7.6.2: + resolution: {integrity: sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==} + engines: {node: '>=10'} + hasBin: true + /sentence-case@2.1.1: resolution: {integrity: sha512-ENl7cYHaK/Ktwk5OTD+aDbQ3uC8IByu/6Bkg+HDv8Mm+XnBnppVNalcfJTNsp1ibstKh030/JKQQWglDvtKwEQ==} dependencies: no-case: 2.3.2 upper-case-first: 1.1.2 - dev: false /sentence-case@3.0.4: resolution: {integrity: sha512-8LS0JInaQMCRoQ7YUytAo/xUu5W2XnQxV2HI/6uM6U7CITS1RqPElr30V6uIqyMKM9lJGRVFy5/4CuzcixNYSg==} @@ -10896,16 +10685,6 @@ packages: resolution: {integrity: sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==} dev: true - /shelljs@0.8.5: - resolution: {integrity: sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==} - engines: {node: '>=4'} - hasBin: true - dependencies: - glob: 7.2.3 - interpret: 1.4.0 - rechoir: 0.6.2 - dev: true - /side-channel@1.0.4: resolution: {integrity: sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==} dependencies: @@ -10984,7 +10763,6 @@ packages: resolution: {integrity: sha512-FMR5YoPFwOLuh4rRz92dywJjyKYZNLpMn1R5ujVpIYkbA9p01fq8RMg0FkO4M+Yobt4MjHeLTJVm5xFFBHSV2Q==} dependencies: no-case: 2.3.2 - dev: false /snake-case@3.0.4: resolution: {integrity: sha512-LAOh4z89bGQvl9pFfNF8V146i7o7/CqFPbqzYgP+yYzDIDeS9HaNFtXABamRW+AQzEVODcvE79ljJ+8a9YSdMg==} @@ -11314,7 +11092,6 @@ packages: dependencies: lower-case: 1.1.4 upper-case: 1.1.3 - dev: false /syncpack@9.8.6: resolution: {integrity: sha512-4S4cUoKK9WenA/Wdk9GvlekzPR9PxC7sqcsUIsK4ypsa/pIYv8Ju1vxGNvp6Y1yI2S9EdCk0QJsB3/wRB8XYVw==} @@ -11481,7 +11258,6 @@ packages: dependencies: no-case: 2.3.2 upper-case: 1.1.3 - dev: false /tmp@0.0.33: resolution: {integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==} @@ -11521,13 +11297,6 @@ packages: typescript: 5.1.6 dev: true - /ts-morph@17.0.1: - resolution: {integrity: sha512-10PkHyXmrtsTvZSL+cqtJLTgFXkU43Gd0JCc0Rw6GchWbqKe0Rwgt1v3ouobTZwQzF1mGhDeAlWYBMGRV7y+3g==} - dependencies: - '@ts-morph/common': 0.18.1 - code-block-writer: 11.0.3 - dev: true - /ts-morph@20.0.0: resolution: {integrity: sha512-JVmEJy2Wow5n/84I3igthL9sudQ8qzjh/6i4tmYCm6IqYyKFlNbJZi7oBdjyqcWSWYRu3CtL0xbT6fS03ESZIg==} dependencies: @@ -11540,7 +11309,6 @@ packages: dependencies: '@ts-morph/common': 0.23.0 code-block-writer: 13.0.1 - dev: false /ts-node@10.9.1(@types/node@18.18.6)(typescript@5.1.6): resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} @@ -11686,11 +11454,6 @@ packages: resolution: {integrity: sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==} engines: {node: '>=10'} - /type-fest@0.3.1: - resolution: {integrity: sha512-cUGJnCdr4STbePCgqNFbpVNCepa+kAVohJs1sLhxzdH+gnEoOd8VhbYa7pD3zZYGiURWM2xzEII3fQcRizDkYQ==} - engines: {node: '>=6'} - dev: true - /type-fest@0.6.0: resolution: {integrity: sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==} engines: {node: '>=8'} @@ -11805,7 +11568,6 @@ packages: /unicorn-magic@0.1.0: resolution: {integrity: sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==} engines: {node: '>=18'} - dev: false /unique-filename@2.0.1: resolution: {integrity: sha512-ODWHtkkdx3IAR+veKxFV+VBkUMcN+FaqzUUd7IZzt+0zhDZFPFxhlqwPF3YQvMHx1TD0tdgYl+kuPnJ8E6ql7A==} @@ -11885,7 +11647,6 @@ packages: resolution: {integrity: sha512-wINKYvI3Db8dtjikdAqoBbZoP6Q+PZUyfMR7pmwHzjC2quzSkUq5DmPrTtPEqHaz8AGtmsB4TqwapMTM1QAQOQ==} dependencies: upper-case: 1.1.3 - dev: false /upper-case-first@2.0.2: resolution: {integrity: sha512-514ppYHBaKwfJRK/pNC6c/OxfGa0obSnAl106u97Ed0I625Nin96KAjttZF6ZL3e1XLtphxnqrOi9iWgm+u+bg==} @@ -11894,7 +11655,6 @@ packages: /upper-case@1.1.3: resolution: {integrity: sha512-WRbjgmYzgXkCV7zNVpy5YgrHgbBv126rMALQQMrmzOVC4GM2waQ9x7xtm8VU+1yF2kWyPzI9zbZ48n4vSxwfSA==} - dev: false /upper-case@2.0.2: resolution: {integrity: sha512-KgdgDGJt2TpuwBUIjgG6lzw2GWFRCW9Qkfkiv0DxqHHLYJHmtmdUIKcZd8rHgFSjopVTlw6ggzCm1b8MFQwikg==} @@ -11977,6 +11737,11 @@ packages: dependencies: defaults: 1.0.3 + /web-streams-polyfill@3.3.3: + resolution: {integrity: sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==} + engines: {node: '>= 8'} + dev: false + /webidl-conversions@3.0.1: resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} @@ -12246,13 +12011,6 @@ packages: y18n: 5.0.8 yargs-parser: 21.1.1 - /yarn@1.22.19: - resolution: {integrity: sha512-/0V5q0WbslqnwP91tirOvldvYISzaqhClxzyUKXYxs07yUILIs5jx/k6CFe8bvKSkds5w+eiOqta39Wk3WxdcQ==} - engines: {node: '>=4.0.0'} - hasBin: true - requiresBuild: true - dev: true - /yn@3.1.1: resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==} engines: {node: '>=6'} @@ -12265,7 +12023,6 @@ packages: /yocto-queue@1.0.0: resolution: {integrity: sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==} engines: {node: '>=12.20'} - dev: false /z-schema@5.0.5: resolution: {integrity: sha512-D7eujBWkLa3p2sIpJA0d1pr7es+a7m0vFAnZLlCEKq/Ij2k0MLi9Br2UPxoxdYystm5K1yeBGzub0FlYUEWj2Q==} diff --git a/build-tools/syncpack.config.cjs b/build-tools/syncpack.config.cjs index 1a5293b30496..9d5ddcdc3931 100644 --- a/build-tools/syncpack.config.cjs +++ b/build-tools/syncpack.config.cjs @@ -72,7 +72,7 @@ module.exports = { { label: "Must use exact dependency ranges", - dependencies: ["sort-package-json"], + dependencies: ["jssm", "jssm-viz-cli", "sort-package-json"], packages: ["**"], range: "", }, @@ -126,6 +126,12 @@ module.exports = { * `syncpack list-mismatches`, the output is grouped by label. */ versionGroups: [ + { + label: "chalk >2 is ESM only but build-tools and version-tools are still CJS only.", + dependencies: ["chalk"], + packages: ["@fluidframework/build-tools", "@fluid-tools/version-tools"], + }, + { label: "Versions of common Fluid packages should all match", dependencies: [ diff --git a/common/build/build-common/tsconfig.node16.json b/common/build/build-common/tsconfig.node16.json index 340e7f5b614a..343a0f394133 100644 --- a/common/build/build-common/tsconfig.node16.json +++ b/common/build/build-common/tsconfig.node16.json @@ -1,5 +1,5 @@ { - "extends": ["./tsconfig.base.json"], + "extends": "./tsconfig.base.json", "compilerOptions": { "module": "Node16", "moduleResolution": "Node16", diff --git a/fluidBuild.config.cjs b/fluidBuild.config.cjs index b85f0db65770..ad2af802598d 100644 --- a/fluidBuild.config.cjs +++ b/fluidBuild.config.cjs @@ -206,6 +206,11 @@ module.exports = { // TODO: AB#7630 uses lint only ts projects for coverage which don't have representative tsc scripts "^packages/tools/fluid-runner/package.json", ], + "fluid-build-tasks-tsc": [ + // This can be removed once the client release group is using build-tools 0.39.0+. + // See https://github.com/microsoft/FluidFramework/pull/21238 + "^packages/test/test-end-to-end-tests/package.json", + ], "html-copyright-file-header": [ // Tests generate HTML "snapshot" artifacts "tools/api-markdown-documenter/src/test/snapshots/.*", diff --git a/package.json b/package.json index a3221a30fcfc..ee2be978cc21 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "build:gendocs:server:routerlicious": "copyfiles \"server/routerlicious/**/*.api.json\" ./_api-extractor-temp/doc-models/ -e \"**/node_modules/**\" -f -V", "build:readme": "markdown-magic --files \"**/*.md\" !docs", "bundle-analysis:collect": "npm run webpack:profile && flub generate bundleStats", - "bundle-analysis:run": "flub run bundleStats --dangerfile build-tools/packages/build-cli/lib/library/dangerfile.js", + "bundle-analysis:run": "flub run bundleStats --dangerfile build-tools/packages/build-cli/lib/library/dangerfile.cjs", "changeset": "flub changeset add --releaseGroup client", "check:are-the-types-wrong": "fluid-build --task check:are-the-types-wrong", "check:versions": "flub check buildVersion -g client --path .", diff --git a/tools/pipelines/build-build-tools.yml b/tools/pipelines/build-build-tools.yml index ad5b65fb56c5..f23a6cf76003 100644 --- a/tools/pipelines/build-build-tools.yml +++ b/tools/pipelines/build-build-tools.yml @@ -50,6 +50,7 @@ trigger: - biome.json - biome.jsonc - build-tools + - common/build/build-common - tools/pipelines/build-build-tools.yml - tools/pipelines/templates/build-npm-package.yml - tools/pipelines/templates/include-set-package-version.yml @@ -74,6 +75,7 @@ pr: include: - .prettierignore - build-tools + - common/build/build-common - tools/pipelines/build-build-tools.yml - tools/pipelines/templates/build-npm-package.yml - tools/pipelines/templates/include-set-package-version.yml diff --git a/tools/pipelines/templates/include-set-package-version.yml b/tools/pipelines/templates/include-set-package-version.yml index f47d1d8e2a4b..335d9a87b998 100644 --- a/tools/pipelines/templates/include-set-package-version.yml +++ b/tools/pipelines/templates/include-set-package-version.yml @@ -42,19 +42,10 @@ parameters: # Set version steps: -- ${{ if eq(parameters.buildToolsVersionToInstall, 'repo') }}: - - task: Bash@3 - name: PrependPath - displayName: Prepend build-tools CLI to path - inputs: - targetType: 'inline' - workingDirectory: ${{ parameters.buildDirectory }} - script: | - # Prepend the cli bin dir to the path. See - # - # more information. - echo "##vso[task.prependpath]$(Build.SourcesDirectory)/build-tools/packages/build-cli/bin" +# These steps should ONLY run if we're using the repo version of the build tools. These steps are mutually exclusive +# with the next group of steps. +- ${{ if eq(parameters.buildToolsVersionToInstall, 'repo') }}: - template: include-install-pnpm.yml parameters: buildDirectory: $(Build.SourcesDirectory)/build-tools @@ -70,7 +61,13 @@ steps: script: | pnpm i --frozen-lockfile pnpm build:compile + cd packages/build-cli + # Use npm link instead of pnpm link because it handles bins better + npm link + echo "which flub: $(which flub)" +# These steps install a version of build-tools from the npm registry. As noted above, these steps are mutually exclusive +# with the previous group of steps. - ${{ if ne(parameters.buildToolsVersionToInstall, 'repo') }}: - task: Bash@3 name: InstallBuildTools @@ -90,7 +87,7 @@ steps: workingDirectory: ${{ parameters.buildDirectory }} script: | # Output the help and full command list for debugging purposes - which flub + echo "which flub: $(which flub)" flub --help flub commands