diff --git a/.depcheckrc.json b/.depcheckrc.json deleted file mode 100644 index 39d5c6ce4..000000000 --- a/.depcheckrc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "ignores": [ - "@lavamoat/allow-scripts", - "@lavamoat/preinstall-always-fail", - "@metamask/auto-changelog", - "@types/*", - "@yarnpkg/types", - "prettier-plugin-packagejson", - "ts-node", - "typedoc" - ] -} diff --git a/.depcheckrc.yml b/.depcheckrc.yml new file mode 100644 index 000000000..1cdc2b13a --- /dev/null +++ b/.depcheckrc.yml @@ -0,0 +1,15 @@ +--- +ignores: + - '@arethetypeswrong/cli' + - '@lavamoat/allow-scripts' + - '@lavamoat/preinstall-always-fail' + - '@metamask/auto-changelog' + - '@ts-bridge/cli' + - '@ts-bridge/shims' + - '@types/jest' + - '@types/node' + - '@yarnpkg/*' + - 'jest-silent-reporter' + - 'prettier-plugin-*' + - 'ts-jest' + - 'typedoc' diff --git a/.eslintrc.js b/.eslintrc.js index 634c81ef8..b008601f1 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,50 +1,116 @@ module.exports = { root: true, - extends: ['@metamask/eslint-config'], + extends: ['@metamask/eslint-config', '@metamask/eslint-config-nodejs'], + + parserOptions: { + tsconfigRootDir: __dirname, + }, + + env: { + 'shared-node-browser': true, + }, + + ignorePatterns: [ + '!.eslintrc.js', + '!jest.config.js', + 'node_modules', + '**/dist', + '**/docs', + '**/coverage', + ], + + rules: { + // This prevents importing Node.js builtins. We currently use them in + // our codebase, so this rule is disabled. This rule should be disabled + // in `@metamask/eslint-config-nodejs` in the future. + 'import/no-nodejs-modules': 'off', + + // This prevents using Node.js and/or browser specific globals. We + // currently use both in our codebase, so this rule is disabled. + 'no-restricted-globals': 'off', + }, overrides: [ + { + files: ['*.js'], + parserOptions: { + sourceType: 'script', + ecmaVersion: '2020', + }, + }, + { files: ['*.ts'], extends: ['@metamask/eslint-config-typescript'], + parserOptions: { + tsconfigRootDir: __dirname, + project: ['./tsconfig.packages.json'], + }, + rules: { + // Enable rules that are disabled in `@metamask/eslint-config-typescript` + '@typescript-eslint/no-explicit-any': 'error', + + // TODO: auto-fix breaks stuff + '@typescript-eslint/promise-function-async': 'off', + + // Without the `allowAny` option, this rule causes a lot of false + // positives. + '@typescript-eslint/restrict-template-expressions': [ + 'error', + { + allowAny: true, + allowBoolean: true, + allowNumber: true, + }, + ], + }, }, { - files: ['*.js'], - parserOptions: { - sourceType: 'script', + files: ['*.d.ts'], + rules: { + 'import/unambiguous': 'off', }, - extends: ['@metamask/eslint-config-nodejs'], }, { - files: ['yarn.config.cjs'], - parserOptions: { - sourceType: 'script', - ecmaVersion: 2020, + files: ['scripts/*.ts'], + rules: { + // All scripts will have shebangs. + 'n/shebang': 'off', }, - settings: { - jsdoc: { - mode: 'typescript', - }, + }, + + { + files: ['**/jest.environment.js'], + rules: { + // These files run under Node, and thus `require(...)` is expected. + 'n/global-require': 'off', }, - extends: ['@metamask/eslint-config-nodejs'], }, { - files: ['*.test.ts', '*.test.js'], - extends: [ - '@metamask/eslint-config-jest', - '@metamask/eslint-config-nodejs', - ], + files: ['*.test.{ts,js}', '**/tests/**/*.{ts,js}'], + extends: ['@metamask/eslint-config-jest'], + rules: { + '@typescript-eslint/no-shadow': [ + 'error', + { allow: ['describe', 'expect', 'it'] }, + ], + }, }, - ], - ignorePatterns: [ - '!.eslintrc.js', - '!.prettierrc.js', - 'dist/', - 'docs/', - '.yarn/', + { + // These files are test helpers, not tests. We still use the Jest ESLint + // config here to ensure that ESLint expects a test-like environment, but + // various rules meant just to apply to tests have been disabled. + files: ['**/tests/**/*.{ts,js}', '!*.test.{ts,js}'], + rules: { + 'jest/no-export': 'off', + 'jest/require-top-level-describe': 'off', + 'jest/no-if': 'off', + }, + }, ], }; diff --git a/.github/workflows/create-release-pr.yml b/.github/workflows/create-release-pr.yml deleted file mode 100644 index 344014af1..000000000 --- a/.github/workflows/create-release-pr.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Create Release Pull Request - -on: - workflow_dispatch: - inputs: - base-branch: - description: 'The base branch for git operations and the pull request.' - default: 'main' - required: true - release-type: - description: 'A SemVer version diff, i.e. major, minor, or patch. Mutually exclusive with "release-version".' - required: false - release-version: - description: 'A specific version to bump to. Mutually exclusive with "release-type".' - required: false - -jobs: - create-release-pr: - runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write - steps: - - uses: actions/checkout@v4 - with: - # This is to guarantee that the most recent tag is fetched. - # This can be configured to a more reasonable value by consumers. - fetch-depth: 0 - # We check out the specified branch, which will be used as the base - # branch for all git operations and the release PR. - ref: ${{ github.event.inputs.base-branch }} - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version-file: '.nvmrc' - - uses: MetaMask/action-create-release-pr@v3 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - release-type: ${{ github.event.inputs.release-type }} - release-version: ${{ github.event.inputs.release-version }} diff --git a/.github/workflows/build-lint-test.yml b/.github/workflows/lint-build-test.yml similarity index 56% rename from .github/workflows/build-lint-test.yml rename to .github/workflows/lint-build-test.yml index 0cf063594..319f02df1 100644 --- a/.github/workflows/build-lint-test.yml +++ b/.github/workflows/lint-build-test.yml @@ -1,4 +1,4 @@ -name: Build, Lint, and Test +name: Lint, Build, and Test on: workflow_call: @@ -7,42 +7,53 @@ jobs: prepare: name: Prepare runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18.x, 20.x] + outputs: + child-workspace-package-names: ${{ steps.workspace-package-names.outputs.child-workspace-package-names }} steps: - - name: Use Node.js + - uses: actions/checkout@v4 + - name: Install Node.js ${{ matrix.node-version }} uses: actions/setup-node@v4 with: - node-version: 'lts/*' + node-version: ${{ matrix.node-version }} - name: Install Yarn run: corepack enable - - uses: actions/checkout@v4 - - name: Use Node.js and install dependencies + - name: Restore Yarn cache uses: actions/setup-node@v4 with: - node-version: 'lts/*' - cache: 'yarn' - - name: Install Yarn dependencies - run: yarn --immutable + node-version: ${{ matrix.node-version }} + cache: yarn + - run: yarn --immutable + - name: Fetch workspace package names + id: workspace-package-names + run: | + echo "child-workspace-package-names=$(yarn workspaces list --json | jq --slurp --raw-output 'map(.name) | @json')" >> "$GITHUB_OUTPUT" + shell: bash - build: - name: Build + lint: + name: Lint runs-on: ubuntu-latest - needs: - - prepare + needs: prepare + strategy: + matrix: + node-version: [20.x] steps: - - name: Use Node.js + - uses: actions/checkout@v4 + - name: Install Node.js ${{ matrix.node-version }} uses: actions/setup-node@v4 with: - node-version: 'lts/*' + node-version: ${{ matrix.node-version }} - name: Install Yarn run: corepack enable - - uses: actions/checkout@v4 - - name: Use Node.js + - name: Restore Yarn cache uses: actions/setup-node@v4 with: - node-version: 'lts/*' - cache: 'yarn' - - run: yarn --immutable --immutable-cache - - run: yarn build + node-version: ${{ matrix.node-version }} + cache: yarn + - run: yarn --immutable + - run: yarn lint - name: Require clean working directory shell: bash run: | @@ -51,32 +62,28 @@ jobs: exit 1 fi - lint: - name: Lint + validate-changelog: + name: Validate changelog runs-on: ubuntu-latest - needs: - - prepare + needs: prepare + strategy: + matrix: + node-version: [20.x] steps: - - name: Use Node.js + - uses: actions/checkout@v4 + - name: Install Node.js ${{ matrix.node-version }} uses: actions/setup-node@v4 with: - node-version: 'lts/*' + node-version: ${{ matrix.node-version }} - name: Install Yarn run: corepack enable - - uses: actions/checkout@v4 - - name: Use Node.js + - name: Restore Yarn cache uses: actions/setup-node@v4 with: - node-version: 'lts/*' - cache: 'yarn' - - run: yarn --immutable --immutable-cache - - run: yarn lint - - name: Validate RC changelog - if: ${{ startsWith(github.head_ref, 'release/') }} - run: yarn lint:changelog --rc - - name: Validate changelog - if: ${{ !startsWith(github.head_ref, 'release/') }} - run: yarn lint:changelog + node-version: ${{ matrix.node-version }} + cache: yarn + - run: yarn --immutable + - run: yarn changelog:validate - name: Require clean working directory shell: bash run: | @@ -85,29 +92,28 @@ jobs: exit 1 fi - test: - name: Test + build: + name: Build runs-on: ubuntu-latest - needs: - - prepare + needs: prepare strategy: matrix: - node-version: [18.x, 20.x] + node-version: [20.x] steps: - - name: Use Node.js + - uses: actions/checkout@v4 + - name: Install Node.js ${{ matrix.node-version }} uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - name: Install Yarn run: corepack enable - - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} + - name: Restore Yarn cache uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - cache: 'yarn' - - run: yarn --immutable --immutable-cache - - run: yarn test + cache: yarn + - run: yarn --immutable + - run: yarn build - name: Require clean working directory shell: bash run: | @@ -116,33 +122,32 @@ jobs: exit 1 fi - compatibility-test: - name: Compatibility test + test: + name: Test runs-on: ubuntu-latest - needs: - - prepare + needs: prepare strategy: matrix: node-version: [18.x, 20.x] + package-name: ${{ fromJson(needs.prepare.outputs.child-workspace-package-names) }} steps: - - name: Use Node.js + - uses: actions/checkout@v4 + - name: Install Node.js ${{ matrix.node-version }} uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - name: Install Yarn run: corepack enable - - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} + - name: Restore Yarn cache uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - cache: 'yarn' - - run: rm yarn.lock && YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn - - run: yarn test + cache: yarn + - run: yarn --immutable + - run: yarn workspace ${{ matrix.package-name }} run test - name: Require clean working directory shell: bash run: | - git restore yarn.lock if ! git diff --exit-code; then echo "Working tree dirty at end of job" exit 1 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8382408dd..2cdf00de2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,65 +13,64 @@ jobs: - uses: actions/checkout@v4 - name: Download actionlint id: download-actionlint - run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/7fdc9630cc360ea1a469eed64ac6d78caeda1234/scripts/download-actionlint.bash) 1.6.23 + run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/7fdc9630cc360ea1a469eed64ac6d78caeda1234/scripts/download-actionlint.bash) 1.6.25 shell: bash - name: Check workflow files run: ${{ steps.download-actionlint.outputs.executable }} -color shell: bash - build-lint-test: - name: Build, lint, and test - uses: ./.github/workflows/build-lint-test.yml - - all-jobs-completed: - name: All jobs completed - runs-on: ubuntu-latest - needs: - - check-workflows - - build-lint-test - outputs: - PASSED: ${{ steps.set-output.outputs.PASSED }} - steps: - - name: Set PASSED output - id: set-output - run: echo "PASSED=true" >> "$GITHUB_OUTPUT" - - all-jobs-pass: - name: All jobs pass - if: ${{ always() }} - runs-on: ubuntu-latest - needs: all-jobs-completed - steps: - - name: Check that all jobs have passed - run: | - passed="${{ needs.all-jobs-completed.outputs.PASSED }}" - if [[ $passed != "true" ]]; then - exit 1 - fi + lint-build-test: + name: Lint, build, and test + needs: check-workflows + uses: ./.github/workflows/lint-build-test.yml is-release: + name: Determine whether this is a release merge commit + needs: lint-build-test + runs-on: ubuntu-latest # Filtering by `push` events ensures that we only release from the `main` branch, which is a # requirement for our npm publishing environment. # The commit author should always be 'github-actions' for releases created by the # 'create-release-pr' workflow, so we filter by that as well to prevent accidentally # triggering a release. if: github.event_name == 'push' && startsWith(github.event.head_commit.author.name, 'github-actions') - needs: all-jobs-pass outputs: IS_RELEASE: ${{ steps.is-release.outputs.IS_RELEASE }} - runs-on: ubuntu-latest steps: - - uses: MetaMask/action-is-release@v1 - id: is-release + - id: is-release + uses: MetaMask/action-is-release@v1 publish-release: + name: Publish release needs: is-release if: needs.is-release.outputs.IS_RELEASE == 'true' - name: Publish release permissions: contents: write uses: ./.github/workflows/publish-release.yml secrets: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - PUBLISH_DOCS_TOKEN: ${{ secrets.PUBLISH_DOCS_TOKEN }} SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + + all-jobs-complete: + name: All jobs complete + runs-on: ubuntu-latest + needs: lint-build-test + outputs: + passed: ${{ steps.set-output.outputs.passed }} + steps: + - name: Set passed output + id: set-output + run: echo "passed=true" >> "$GITHUB_OUTPUT" + + all-jobs-pass: + name: All jobs pass + if: ${{ always() }} + runs-on: ubuntu-latest + needs: all-jobs-complete + steps: + - name: Check that all jobs have passed + run: | + passed="${{ needs.all-jobs-complete.outputs.passed }}" + if [[ $passed != "true" ]]; then + exit 1 + fi diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml deleted file mode 100644 index dd1c3fa57..000000000 --- a/.github/workflows/publish-docs.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Publish docs to GitHub Pages - -on: - workflow_call: - inputs: - destination_dir: - required: true - type: string - secrets: - PUBLISH_DOCS_TOKEN: - required: true - -jobs: - publish-docs-to-gh-pages: - name: Publish docs to GitHub Pages - runs-on: ubuntu-latest - environment: github-pages - permissions: - contents: write - steps: - - name: Ensure `destination_dir` is not empty - if: ${{ inputs.destination_dir == '' }} - run: exit 1 - - name: Checkout the repository - uses: actions/checkout@v4 - - name: Use Node.js - uses: actions/setup-node@v4 - with: - node-version-file: '.nvmrc' - cache: 'yarn' - - name: Install npm dependencies - run: yarn --immutable - - name: Run build script - run: yarn build:docs - - name: Deploy to `${{ inputs.destination_dir }}` directory of `gh-pages` branch - uses: peaceiris/actions-gh-pages@de7ea6f8efb354206b205ef54722213d99067935 - with: - # This `PUBLISH_DOCS_TOKEN` needs to be manually set per-repository. - # Look in the repository settings under "Environments", and set this token in the `github-pages` environment. - personal_token: ${{ secrets.PUBLISH_DOCS_TOKEN }} - publish_dir: ./docs - destination_dir: ${{ inputs.destination_dir }} diff --git a/.github/workflows/publish-main-docs.yml b/.github/workflows/publish-main-docs.yml deleted file mode 100644 index b9bbbefc0..000000000 --- a/.github/workflows/publish-main-docs.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Publish main branch docs to GitHub Pages - -on: - push: - branches: main - -jobs: - publish-to-gh-pages: - name: Publish docs to `staging` directory of `gh-pages` branch - permissions: - contents: write - uses: ./.github/workflows/publish-docs.yml - with: - destination_dir: staging - secrets: - PUBLISH_DOCS_TOKEN: ${{ secrets.PUBLISH_DOCS_TOKEN }} diff --git a/.github/workflows/publish-preview.yml b/.github/workflows/publish-preview.yml new file mode 100644 index 000000000..3dcce39e9 --- /dev/null +++ b/.github/workflows/publish-preview.yml @@ -0,0 +1,66 @@ +name: Publish a preview build + +on: + issue_comment: + types: created + +jobs: + is-fork-pull-request: + name: Determine whether this issue comment was on a pull request from a fork + if: ${{ github.event.issue.pull_request && startsWith(github.event.comment.body, '@metamaskbot publish-preview') }} + runs-on: ubuntu-latest + outputs: + IS_FORK: ${{ steps.is-fork.outputs.IS_FORK }} + steps: + - uses: actions/checkout@v4 + - name: Determine whether this PR is from a fork + id: is-fork + run: echo "IS_FORK=$(gh pr view --json isCrossRepository --jq '.isCrossRepository' "${PR_NUMBER}" )" >> "$GITHUB_OUTPUT" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_NUMBER: ${{ github.event.issue.number }} + + publish-preview: + name: Publish build preview + needs: is-fork-pull-request + permissions: + pull-requests: write + # This ensures we don't publish on forks. We can't trust forks with this token. + if: ${{ needs.is-fork-pull-request.outputs.IS_FORK == 'false' }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Check out pull request + run: gh pr checkout "${PR_NUMBER}" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_NUMBER: ${{ github.event.issue.number }} + - name: Install Node + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + - name: Install Yarn + run: corepack enable + - name: Restore Yarn cache + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: yarn + - run: yarn --immutable + - name: Get commit SHA + id: commit-sha + run: echo "COMMIT_SHA=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" + - run: yarn prepare-preview-builds @metamask-previews ${{ steps.commit-sha.outputs.COMMIT_SHA }} + - run: yarn build + - name: Publish preview build + run: yarn publish-previews + env: + YARN_NPM_AUTH_TOKEN: ${{ secrets.PUBLISH_PREVIEW_NPM_TOKEN }} + - name: Generate preview build message + run: yarn ts-node scripts/generate-preview-build-message.ts + - name: Post build preview in comment + run: gh pr comment "${PR_NUMBER}" --body-file preview-build-message.txt + env: + COMMIT_SHA: ${{ steps.commit-sha.outputs.COMMIT_SHA }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_NUMBER: ${{ github.event.issue.number }} diff --git a/.github/workflows/publish-rc-docs.yml b/.github/workflows/publish-rc-docs.yml deleted file mode 100644 index 802cf6bca..000000000 --- a/.github/workflows/publish-rc-docs.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Publish release candidate docs to GitHub Pages - -on: - push: - branches: 'release/**' - -jobs: - get-release-version: - name: Get release version - runs-on: ubuntu-latest - outputs: - release-version: ${{ steps.release-name.outputs.RELEASE_VERSION }} - steps: - - name: Extract release version from branch name - id: release-name - run: | - BRANCH_NAME='${{ github.ref_name }}' - echo "RELEASE_VERSION=v${BRANCH_NAME#release/}" >> "$GITHUB_OUTPUT" - publish-to-gh-pages: - name: Publish docs to `rc-${{ needs.get-release-version.outputs.release-version }}` directory of `gh-pages` branch - permissions: - contents: write - uses: ./.github/workflows/publish-docs.yml - needs: get-release-version - with: - destination_dir: rc-${{ needs.get-release-version.outputs.release-version }} - secrets: - PUBLISH_DOCS_TOKEN: ${{ secrets.PUBLISH_DOCS_TOKEN }} diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 778b47cb9..452a9fc40 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -7,8 +7,6 @@ on: required: true SLACK_WEBHOOK_URL: required: true - PUBLISH_DOCS_TOKEN: - required: true jobs: publish-release: @@ -19,24 +17,28 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{ github.sha }} - - name: Setup Node.js + - name: Install Node uses: actions/setup-node@v4 with: node-version-file: '.nvmrc' - - uses: MetaMask/action-publish-release@v3 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Install - run: | - yarn install - yarn build - - uses: actions/cache@v3 - id: restore-build + - name: Install Yarn + run: corepack enable + - name: Restore Yarn cache + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: yarn + - uses: actions/cache@v4 with: path: | - ./dist + ./packages/**/dist ./node_modules/.yarn-state.yml key: ${{ github.sha }} + - uses: MetaMask/action-publish-release@v3 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - run: yarn --immutable + - run: yarn build publish-npm-dry-run: runs-on: ubuntu-latest @@ -45,16 +47,22 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{ github.sha }} - - uses: actions/cache@v3 - id: restore-build + - name: Install Node + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + - name: Install Yarn + run: corepack enable + - uses: actions/cache@v4 with: path: | - ./dist + ./packages/**/dist ./node_modules/.yarn-state.yml key: ${{ github.sha }} + fail-on-cache-miss: true - name: Dry Run Publish # omit npm-token token to perform dry run publish - uses: MetaMask/action-npm-publish@v4 + uses: MetaMask/action-npm-publish@v5 with: slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }} subteam: S042S7RE4AE # @metamask-npm-publishers @@ -69,53 +77,22 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{ github.sha }} - - uses: actions/cache@v3 - id: restore-build + - name: Install Node + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + - name: Install Yarn + run: corepack enable + - uses: actions/cache@v4 with: path: | - ./dist + ./packages/**/dist ./node_modules/.yarn-state.yml key: ${{ github.sha }} + fail-on-cache-miss: true - name: Publish - uses: MetaMask/action-npm-publish@v2 + uses: MetaMask/action-npm-publish@v5 with: - # This `NPM_TOKEN` needs to be manually set per-repository. - # Look in the repository settings under "Environments", and set this token in the `npm-publish` environment. npm-token: ${{ secrets.NPM_TOKEN }} env: SKIP_PREPACK: true - - get-release-version: - runs-on: ubuntu-latest - needs: publish-npm - outputs: - RELEASE_VERSION: ${{ steps.get-release-version.outputs.RELEASE_VERSION }} - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.sha }} - - id: get-release-version - shell: bash - run: ./scripts/get.sh ".version" "RELEASE_VERSION" - - publish-release-to-gh-pages: - needs: get-release-version - name: Publish docs to `${{ needs.get-release-version.outputs.RELEASE_VERSION }}` directory of `gh-pages` branch - permissions: - contents: write - uses: ./.github/workflows/publish-docs.yml - with: - destination_dir: ${{ needs.get-release-version.outputs.RELEASE_VERSION }} - secrets: - PUBLISH_DOCS_TOKEN: ${{ secrets.PUBLISH_DOCS_TOKEN }} - - publish-release-to-latest-gh-pages: - needs: publish-npm - name: Publish docs to `latest` directory of `gh-pages` branch - permissions: - contents: write - uses: ./.github/workflows/publish-docs.yml - with: - destination_dir: latest - secrets: - PUBLISH_DOCS_TOKEN: ${{ secrets.PUBLISH_DOCS_TOKEN }} diff --git a/.github/workflows/security-code-scanner.yml b/.github/workflows/security-code-scanner.yml deleted file mode 100644 index ced04497b..000000000 --- a/.github/workflows/security-code-scanner.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: 'MetaMask Security Code Scanner' - -on: - push: - branches: ['main'] - pull_request: - branches: ['main'] - -jobs: - run-security-scan: - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - steps: - - name: MetaMask Security Code Scanner - uses: MetaMask/Security-Code-Scanner@main - with: - repo: ${{ github.repository }} - paths_ignored: | - .storybook/ - '**/__snapshots__/' - '**/*.snap' - '**/*.stories.js' - '**/*.stories.tsx' - '**/*.test.browser.ts*' - '**/*.test.js*' - '**/*.test.ts*' - '**/fixtures/' - '**/jest.config.js' - '**/jest.environment.js' - '**/mocks/' - '**/test*/' - docs/ - e2e/ - merged-packages/ - node_modules - storybook/ - test*/ - rules_excluded: example - project_metrics_token: ${{ secrets.SECURITY_SCAN_METRICS_TOKEN }} - slack_webhook: ${{ secrets.APPSEC_BOT_SLACK_WEBHOOK }} diff --git a/.yarnrc.yml b/.yarnrc.yml index 6e38e4baf..738756b8f 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -4,7 +4,7 @@ enableGlobalCache: false enableScripts: false -enableTelemetry: 0 +enableTelemetry: false logFilters: - code: YN0004 diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index ffa0b6ac4..000000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,10 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## [Unreleased] - -[Unreleased]: https://github.com/MetaMask/metamask-module-template/ diff --git a/constraints.pro b/constraints.pro new file mode 100644 index 000000000..ae27a8921 --- /dev/null +++ b/constraints.pro @@ -0,0 +1,362 @@ +%=============================================================================== +% Utility predicates +%=============================================================================== + +% True if and only if VersionRange is a value that we would expect to see +% following a package in a "*dependencies" field within a `package.json`. +is_valid_version_range(VersionRange) :- + VersionRange = 'workspace:^'; + VersionRange = 'workspace:~'; + parse_version_range(VersionRange, _, _, _, _). + +% Succeeds if Number can be unified with Atom converted to a number; throws if +% not. +atom_to_number(Atom, Number) :- + atom_chars(Atom, Chars), + number_chars(Number, Chars). + +% True if and only if Atom can be converted to a number. +is_atom_number(Atom) :- + catch(atom_to_number(Atom, _), _, false). + +% True if and only if Modifier can be unified with the leading character of the +% version range ("^" or "~" if present, or "" if not present), Major can be +% unified with the major part of the version string, Minor with the minor, and +% Patch with the patch. +parse_version_range(VersionRange, Modifier, Major, Minor, Patch) :- + % Identify and extract the modifier (^ or ~) from the version string + atom_chars(VersionRange, Chars), + Chars = [PossibleModifier | CharsWithoutPossibleModifier], + ( + ( + PossibleModifier = '^'; + PossibleModifier = '~' + ) -> + ( + Modifier = PossibleModifier, + CharsWithoutModifier = CharsWithoutPossibleModifier + ) ; + ( + is_atom_number(PossibleModifier) -> + ( + Modifier = '', + CharsWithoutModifier = Chars + ) ; + false + ) + ), + atomic_list_concat(CharsWithoutModifier, '', VersionRangeWithoutModifier), + atomic_list_concat(VersionParts, '.', VersionRangeWithoutModifier), + % Validate version string while extracting each part + length(VersionParts, 3), + nth0(0, VersionParts, MajorAtom), + nth0(1, VersionParts, MinorAtom), + nth0(2, VersionParts, PatchAtom), + atom_to_number(MajorAtom, Major), + atom_to_number(MinorAtom, Minor), + atom_to_number(PatchAtom, Patch). + +% True if and only if the first SemVer version range is greater than the second +% SemVer version range. Such a range must match "^MAJOR.MINOR.PATCH", +% "~MAJOR.MINOR.PATCH", "MAJOR.MINOR.PATCH". If two ranges do not have the same +% modifier ("^" or "~"), then they cannot be compared and the first cannot be +% considered as less than the second. +% +% Borrowed from: +npm_version_range_out_of_sync(VersionRange1, VersionRange2) :- + parse_version_range(VersionRange1, VersionRange1Modifier, VersionRange1Major, VersionRange1Minor, VersionRange1Patch), + parse_version_range(VersionRange2, VersionRange2Modifier, VersionRange2Major, VersionRange2Minor, VersionRange2Patch), + VersionRange1Modifier == VersionRange2Modifier, + ( + % 2.0.0 > 1.0.0 + % 2.0.0 > 1.1.0 + % 2.0.0 > 1.0.1 + VersionRange1Major @> VersionRange2Major ; + ( + VersionRange1Major == VersionRange2Major , + ( + % 1.1.0 > 1.0.0 + % 1.1.0 > 1.0.1 + VersionRange1Minor @> VersionRange2Minor ; + ( + VersionRange1Minor == VersionRange2Minor , + % 1.0.1 > 1.0.0 + VersionRange1Patch @> VersionRange2Patch + ) + ) + ) + ). + +% True if and only if WorkspaceBasename can unify with the part of the given +% workspace directory name that results from removing all leading directories. +workspace_basename(WorkspaceCwd, WorkspaceBasename) :- + atomic_list_concat(Parts, '/', WorkspaceCwd), + last(Parts, WorkspaceBasename). + +% True if and only if WorkspacePackageName can unify with the name of the +% package which the workspace represents (which comes from the directory where +% the package is located). Assumes that the package is not in a sub-workspace +% and is not private. +workspace_package_name(WorkspaceCwd, WorkspacePackageName) :- + workspace_basename(WorkspaceCwd, WorkspaceBasename), + atom_concat('@metamask/', WorkspaceBasename, WorkspacePackageName). + +% True if RepoName can be unified with the repository name part of RepoUrl, a +% complete URL for a repository on GitHub. This URL must include the ".git" +% extension. +repo_name(RepoUrl, RepoName) :- + Prefix = 'https://github.com/MetaMask/', + atom_length(Prefix, PrefixLength), + Suffix = '.git', + atom_length(Suffix, SuffixLength), + atom_length(RepoUrl, RepoUrlLength), + sub_atom(RepoUrl, 0, PrefixLength, After, Prefix), + sub_atom(RepoUrl, Before, SuffixLength, 0, Suffix), + Start is RepoUrlLength - After + 1, + End is Before + 1, + RepoNameLength is End - Start, + sub_atom(RepoUrl, PrefixLength, RepoNameLength, SuffixLength, RepoName). + +%=============================================================================== +% Constraints +%=============================================================================== + +% All packages, published or otherwise, must have a name. +\+ gen_enforced_field(WorkspaceCwd, 'name', null). + +% The name of the root package can be anything, but the name of a non-root +% package must match its directory (e.g., a package located in "packages/foo" +% must be called "@metamask/foo"). +% +% NOTE: This assumes that the set of non-root workspaces is flat. Nested +% workspaces will be added in a future change. +gen_enforced_field(WorkspaceCwd, 'name', WorkspacePackageName) :- + WorkspaceCwd \= '.', + workspace_package_name(WorkspaceCwd, WorkspacePackageName). + +% All packages, published or otherwise, must have a description. +\+ gen_enforced_field(WorkspaceCwd, 'description', null). +% The description cannot end with a period. +gen_enforced_field(WorkspaceCwd, 'description', DescriptionWithoutTrailingPeriod) :- + workspace_field(WorkspaceCwd, 'description', Description), + atom_length(Description, Length), + LengthLessOne is Length - 1, + sub_atom(Description, LengthLessOne, 1, 0, LastCharacter), + sub_atom(Description, 0, LengthLessOne, 1, DescriptionWithoutPossibleTrailingPeriod), + ( + LastCharacter == '.' -> + DescriptionWithoutTrailingPeriod = DescriptionWithoutPossibleTrailingPeriod ; + DescriptionWithoutTrailingPeriod = Description + ). + +% All published packages must have the same set of NPM keywords. +gen_enforced_field(WorkspaceCwd, 'keywords', ['MetaMask', 'Ethereum']) :- + \+ workspace_field(WorkspaceCwd, 'private', true). +% Non-published packages do not have any NPM keywords. +gen_enforced_field(WorkspaceCwd, 'keywords', null) :- + workspace_field(WorkspaceCwd, 'private', true). + +% The homepage of a published package must match its name (which is in turn +% based on its workspace directory name). +gen_enforced_field(WorkspaceCwd, 'homepage', CorrectHomepageUrl) :- + \+ workspace_field(WorkspaceCwd, 'private', true), + workspace_basename(WorkspaceCwd, WorkspaceBasename), + workspace_field(WorkspaceCwd, 'repository.url', RepoUrl), + repo_name(RepoUrl, RepoName), + atomic_list_concat(['https://github.com/MetaMask/', RepoName, '/tree/main/packages/', WorkspaceBasename, '#readme'], CorrectHomepageUrl). +% Non-published packages do not have a homepage. +gen_enforced_field(WorkspaceCwd, 'homepage', null) :- + workspace_field(WorkspaceCwd, 'private', true). + +% The bugs URL of a published package must point to the Issues page for the +% repository. +gen_enforced_field(WorkspaceCwd, 'bugs.url', CorrectBugsUrl) :- + \+ workspace_field(WorkspaceCwd, 'private', true), + workspace_field(WorkspaceCwd, 'repository.url', RepoUrl), + repo_name(RepoUrl, RepoName), + atomic_list_concat(['https://github.com/MetaMask/', RepoName, '/issues'], CorrectBugsUrl). +% Non-published packages must not have a bugs section. +gen_enforced_field(WorkspaceCwd, 'bugs', null) :- + workspace_field(WorkspaceCwd, 'private', true). + +% All packages must specify Git as the repository type. +gen_enforced_field(WorkspaceCwd, 'repository.type', 'git'). + +% All packages must match the URL of a repo within the MetaMask organization. +gen_enforced_field(WorkspaceCwd, 'repository.url', 'https://github.com/MetaMask/.git') :- + workspace_field(WorkspaceCwd, 'repository.url', RepoUrl), + \+ repo_name(RepoUrl, _). +% The repository URL for non-root packages must match the same URL used for the +% root package. +gen_enforced_field(WorkspaceCwd, 'repository.url', RepoUrl) :- + workspace_field('.', 'repository.url', RepoUrl), + repo_name(RepoUrl, _). + WorkspaceCwd \= '.'. + +% The license for all published packages must be MIT unless otherwise specified. +gen_enforced_field(WorkspaceCwd, 'license', 'MIT') :- + \+ workspace_field(WorkspaceCwd, 'private', true). +% Non-published packages do not have a license. +gen_enforced_field(WorkspaceCwd, 'license', null) :- + workspace_field(WorkspaceCwd, 'private', true). + +% The entrypoint for all published packages must be the same. +gen_enforced_field(WorkspaceCwd, 'main', './dist/index.cjs') :- + \+ workspace_field(WorkspaceCwd, 'private', true). +gen_enforced_field(WorkspaceCwd, 'module', './dist/index.mjs') :- + \+ workspace_field(WorkspaceCwd, 'private', true). +% Non-published packages must not specify an entrypoint. +gen_enforced_field(WorkspaceCwd, 'main', null) :- + workspace_field(WorkspaceCwd, 'private', true). +gen_enforced_field(WorkspaceCwd, 'module', null) :- + workspace_field(WorkspaceCwd, 'private', true). + +% The type definitions entrypoint for all publishable packages must be the same. +gen_enforced_field(WorkspaceCwd, 'types', './dist/index.d.cts') :- + \+ workspace_field(WorkspaceCwd, 'private', true). +% Non-published packages must not specify a type definitions entrypoint. +gen_enforced_field(WorkspaceCwd, 'types', null) :- + workspace_field(WorkspaceCwd, 'private', true). + +% The exports for all published packages must be the same. +% CommonJS +gen_enforced_field(WorkspaceCwd, 'exports["."].require.default', './dist/index.cjs') :- + \+ workspace_field(WorkspaceCwd, 'private', true). +gen_enforced_field(WorkspaceCwd, 'exports["."].require.types', './dist/index.d.cts') :- + \+ workspace_field(WorkspaceCwd, 'private', true). +% ESM +gen_enforced_field(WorkspaceCwd, 'exports["."].import.default', './dist/index.mjs') :- + \+ workspace_field(WorkspaceCwd, 'private', true). +gen_enforced_field(WorkspaceCwd, 'exports["."].import.types', './dist/index.d.mts') :- + \+ workspace_field(WorkspaceCwd, 'private', true). +% package.json +gen_enforced_field(WorkspaceCwd, 'exports["./package.json"]', './package.json') :- + \+ workspace_field(WorkspaceCwd, 'private', true). +% Non-published packages must not specify exports. +gen_enforced_field(WorkspaceCwd, 'exports', null) :- + workspace_field(WorkspaceCwd, 'private', true). + +% Published packages must not have side effects. +gen_enforced_field(WorkspaceCwd, 'sideEffects', false) :- + \+ workspace_field(WorkspaceCwd, 'private', true). +% Non-published packages must not specify side effects. +gen_enforced_field(WorkspaceCwd, 'sideEffects', null) :- + workspace_field(WorkspaceCwd, 'private', true). + +% The list of files included in published packages must only include files +% generated during the build step. +gen_enforced_field(WorkspaceCwd, 'files', ['dist/']) :- + \+ workspace_field(WorkspaceCwd, 'private', true). +% The root package must specify an empty set of published files. (This is +% required in order to be able to import anything in development-only scripts, +% as otherwise the `node/no-unpublished-require` ESLint rule will disallow it.) +gen_enforced_field(WorkspaceCwd, 'files', []) :- + WorkspaceCwd = '.'. + +% All non-root packages must have the same "build" script. +gen_enforced_field(WorkspaceCwd, 'scripts.build', 'ts-bridge --project tsconfig.build.json --clean') :- + WorkspaceCwd \= '.'. + +% All non-root packages must have the same "build:docs" script. +gen_enforced_field(WorkspaceCwd, 'scripts.build:docs', 'typedoc') :- + WorkspaceCwd \= '.'. + +% All published packages must have the same "publish:preview" script. +gen_enforced_field(WorkspaceCwd, 'scripts.publish:preview', 'yarn npm publish --tag preview') :- + \+ workspace_field(WorkspaceCwd, 'private', true). + +% All published packages must not have a "prepack" script. +gen_enforced_field(WorkspaceCwd, 'scripts.prepack', null) :- + \+ workspace_field(WorkspaceCwd, 'private', true). + +% The "changelog:validate" script for each published package must run a common +% script with the name of the package as the first argument. +gen_enforced_field(WorkspaceCwd, 'scripts.changelog:validate', CorrectChangelogValidationCommand) :- + \+ workspace_field(WorkspaceCwd, 'private', true), + workspace_field(WorkspaceCwd, 'scripts.changelog:validate', ChangelogValidationCommand), + workspace_package_name(WorkspaceCwd, WorkspacePackageName), + atomic_list_concat(['../../scripts/validate-changelog.sh ', WorkspacePackageName, ' [...]'], CorrectChangelogValidationCommand), + atom_concat('../../scripts/validate-changelog.sh ', WorkspacePackageName, ExpectedPrefix), + \+ atom_concat(ExpectedPrefix, _, ChangelogValidationCommand). + +% The "changelog:update" script for each published package must run a common +% script with the name of the package as the first argument. +gen_enforced_field(WorkspaceCwd, 'scripts.changelog:update', CorrectChangelogUpdateCommand) :- + \+ workspace_field(WorkspaceCwd, 'private', true), + workspace_field(WorkspaceCwd, 'scripts.changelog:update', ChangelogUpdateCommand), + workspace_package_name(WorkspaceCwd, WorkspacePackageName), + atomic_list_concat(['../../scripts/update-changelog.sh ', WorkspacePackageName, ' [...]'], CorrectChangelogUpdateCommand), + atom_concat('../../scripts/update-changelog.sh ', WorkspacePackageName, ExpectedPrefix), + \+ atom_concat(ExpectedPrefix, _, ChangelogUpdateCommand). + +% All non-root packages must have the same "test" script. +gen_enforced_field(WorkspaceCwd, 'scripts.test', 'jest --reporters=jest-silent-reporter') :- + WorkspaceCwd \= '.'. + +% All non-root packages must have the same "test:clean" script. +gen_enforced_field(WorkspaceCwd, 'scripts.test:clean', 'jest --clearCache') :- + WorkspaceCwd \= '.'. + +% All non-root packages must have the same "test:verbose" script. +gen_enforced_field(WorkspaceCwd, 'scripts.test:verbose', 'jest --verbose') :- + WorkspaceCwd \= '.'. + +% All non-root packages must have the same "test:watch" script. +gen_enforced_field(WorkspaceCwd, 'scripts.test:watch', 'jest --watch') :- + WorkspaceCwd \= '.'. + +% All dependency ranges must be recognizable (this makes it possible to apply +% the next two rules effectively). +gen_enforced_dependency(WorkspaceCwd, DependencyIdent, 'a range optionally starting with ^ or ~', DependencyType) :- + workspace_has_dependency(WorkspaceCwd, DependencyIdent, DependencyRange, DependencyType), + \+ is_valid_version_range(DependencyRange). + +% All version ranges used to reference one workspace package in another +% workspace package's `dependencies` or `devDependencies` must be the same. +% Among all references to the same dependency across the monorepo, the one with +% the smallest version range will win. (We handle `peerDependencies` in another +% constraint, as it has slightly different logic.) +gen_enforced_dependency(WorkspaceCwd, DependencyIdent, OtherDependencyRange, DependencyType) :- + workspace_has_dependency(WorkspaceCwd, DependencyIdent, DependencyRange, DependencyType), + workspace_has_dependency(OtherWorkspaceCwd, DependencyIdent, OtherDependencyRange, OtherDependencyType), + WorkspaceCwd \= OtherWorkspaceCwd, + DependencyRange \= OtherDependencyRange, + npm_version_range_out_of_sync(DependencyRange, OtherDependencyRange), + DependencyType \= 'peerDependencies', + OtherDependencyType \= 'peerDependencies'. + +% All version ranges used to reference one workspace package in another +% workspace package's `dependencies` or `devDependencies` must match the current +% version of that package. (We handle `peerDependencies` in another rule.) +gen_enforced_dependency(WorkspaceCwd, DependencyIdent, CorrectDependencyRange, DependencyType) :- + DependencyType \= 'peerDependencies', + workspace_has_dependency(WorkspaceCwd, DependencyIdent, DependencyRange, DependencyType), + workspace_ident(OtherWorkspaceCwd, DependencyIdent), + workspace_version(OtherWorkspaceCwd, OtherWorkspaceVersion), + atomic_list_concat(['^', OtherWorkspaceVersion], CorrectDependencyRange). + +% If a workspace package is listed under another workspace package's +% `dependencies`, it should not also be listed under its `devDependencies`. +gen_enforced_dependency(WorkspaceCwd, DependencyIdent, null, 'devDependencies') :- + workspace_has_dependency(WorkspaceCwd, DependencyIdent, DependencyRange, 'dependencies'). + +% The root workspace (and only the root workspace) needs to specify the Yarn +% version required for development. +gen_enforced_field(WorkspaceCwd, 'packageManager', 'yarn@4.2.2') :- + WorkspaceCwd == '.'. +gen_enforced_field(WorkspaceCwd, 'packageManager', null) :- + WorkspaceCwd \= '.'. + +% All packages must specify a minimum Node version of 18. +gen_enforced_field(WorkspaceCwd, 'engines.node', '^18.18 || >=20'). + +% All published packages are public. +gen_enforced_field(WorkspaceCwd, 'publishConfig.access', 'public') :- + \+ workspace_field(WorkspaceCwd, 'private', true). +% All published packages are available on the NPM registry. +gen_enforced_field(WorkspaceCwd, 'publishConfig.registry', 'https://registry.npmjs.org/') :- + \+ workspace_field(WorkspaceCwd, 'private', true). +% Non-published packages do not need to specify any publishing settings +% whatsoever. +gen_enforced_field(WorkspaceCwd, 'publishConfig', null) :- + workspace_field(WorkspaceCwd, 'private', true). diff --git a/jest.config.js b/jest.config.packages.js similarity index 83% rename from jest.config.js rename to jest.config.packages.js index 83e15048b..3be8df86b 100644 --- a/jest.config.js +++ b/jest.config.packages.js @@ -22,21 +22,29 @@ module.exports = { collectCoverage: true, // An array of glob patterns indicating a set of files for which coverage information should be collected - collectCoverageFrom: ['./src/**/*.ts'], + collectCoverageFrom: [ + './src/**/*.ts', + '!./src/**/*.test.ts', + '!./src/**/*.test.browser.ts', + '!./src/test-utils/**/*.ts', + '!./src/**/*.d.ts', + '!./src/**/__test__/**', + '!./src/**/__mocks__/**', + '!./src/**/__snapshots__/**', + '!./src/**/__fixtures__/**', + ], // The directory where Jest should output its coverage files coverageDirectory: 'coverage', // An array of regexp pattern strings used to skip coverage collection - // coveragePathIgnorePatterns: [ - // "/node_modules/" - // ], + coveragePathIgnorePatterns: ['./src/index.ts'], // Indicates which provider should be used to instrument code for coverage coverageProvider: 'babel', // A list of reporter names that Jest uses when writing coverage reports - coverageReporters: ['html', 'json-summary', 'text'], + coverageReporters: ['html', 'json-summary', 'text', 'json'], // An object that configures minimum threshold enforcement for coverage results coverageThreshold: { @@ -85,7 +93,16 @@ module.exports = { // ], // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module - // moduleNameMapper: {}, + // Here we ensure that Jest resolves `@metamask/*` imports to the uncompiled source code for packages that live in this repo. + // NOTE: This must be synchronized with the `paths` option in `tsconfig.packages.json`. + moduleNameMapper: { + '^@metamask/(.+)$': [ + '/../$1/src', + // Some @metamask/* packages we are referencing aren't in this monorepo, + // so in that case use their published versions + '/../../node_modules/@metamask/$1', + ], + }, // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader // modulePathIgnorePatterns: [], @@ -100,7 +117,7 @@ module.exports = { preset: 'ts-jest', // Run tests from one or more projects - // projects: undefined, + // projects: undefined // Use this configuration option to add custom reporters to Jest // reporters: undefined, @@ -132,10 +149,10 @@ module.exports = { // runner: "jest-runner", // The paths to modules that run some code to configure or set up the testing environment before each test - // setupFiles: [], + // setupFiles: ['../../tests/setup.ts'], // A list of paths to modules that run some code to configure or set up the testing framework before each test - // setupFilesAfterEnv: [], + // setupFilesAfterEnv: ['../../tests/setupAfterEnv/index.ts'], // The number of seconds after which a test is considered as slow and reported as such in the results. // slowTestThreshold: 5, @@ -144,10 +161,12 @@ module.exports = { // snapshotSerializers: [], // The test environment that will be used for testing - // testEnvironment: "jest-environment-node", + testEnvironment: 'node', // Options that will be passed to the testEnvironment - // testEnvironmentOptions: {}, + testEnvironmentOptions: { + customExportConditions: ['node', 'node-addons'], + }, // Adds a location field to test results // testLocationInResults: false, @@ -172,8 +191,8 @@ module.exports = { // This option allows use of a custom test runner // testRunner: "jest-circus/runner", - // Reduce the default test timeout from 5s to 2.5s - testTimeout: 2500, + // Default timeout of a test in milliseconds. + testTimeout: 5000, // This option sets the URL for the jsdom environment. It is reflected in properties such as location.href // testURL: "http://localhost", @@ -185,10 +204,7 @@ module.exports = { // transform: undefined, // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation - // transformIgnorePatterns: [ - // "/node_modules/", - // "\\.pnp\\.[^\\/]+$" - // ], + // transformIgnorePatterns: undefined // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them // unmockedModulePathPatterns: undefined, diff --git a/package.json b/package.json index 35c4c4894..90bd16198 100644 --- a/package.json +++ b/package.json @@ -1,54 +1,41 @@ { - "name": "@metamask/metamask-module-template", + "name": "ocap-kernel-monorepo", "version": "0.0.0", - "description": "The MetaMask Node module template", - "homepage": "https://github.com/MetaMask/metamask-module-template#readme", - "bugs": { - "url": "https://github.com/MetaMask/metamask-module-template/issues" - }, + "private": true, "repository": { "type": "git", - "url": "https://github.com/MetaMask/metamask-module-template.git" - }, - "sideEffects": false, - "exports": { - ".": { - "import": { - "types": "./dist/index.d.mts", - "default": "./dist/index.mjs" - }, - "require": { - "types": "./dist/index.d.cts", - "default": "./dist/index.cjs" - } - }, - "./package.json": "./package.json" + "url": "https://github.com/MetaMask/ocap-kernel.git" }, - "main": "./dist/index.cjs", - "module": "./dist/index.mjs", - "types": "./dist/index.d.cts", - "files": [ - "dist" + "files": [], + "workspaces": [ + "packages/*" ], "scripts": { - "build": "ts-bridge --project tsconfig.build.json --clean", - "build:docs": "typedoc", - "lint": "yarn lint:eslint && yarn lint:constraints && yarn lint:misc --check && yarn lint:dependencies --check && yarn lint:changelog", - "lint:changelog": "auto-changelog validate --prettier", - "lint:constraints": "yarn constraints", - "lint:dependencies": "depcheck && yarn dedupe", + "build": "yarn run build:source && yarn run build:types", + "build:clean": "yarn clean && yarn build", + "build:docs": "yarn workspaces foreach --all --exclude ocap-kernel-monorepo --parallel --interlaced --verbose run build:docs", + "build:source": "yarn workspaces foreach --all --parallel --exclude ocap-kernel-monorepo --interlaced --verbose run build", + "build:types": "tsc --build tsconfig.build.json --verbose", + "build:watch": "yarn run build --watch", + "changelog:update": "yarn workspaces foreach --all --no-private --parallel --interlaced --verbose run changelog:update", + "changelog:validate": "yarn workspaces foreach --all --no-private --parallel --interlaced --verbose run changelog:validate", + "clean": "rimraf dist '**/*.tsbuildinfo'", + "lint": "yarn lint:eslint && yarn lint:misc --check && yarn constraints && yarn lint:dependencies", + "lint:dependencies": "depcheck && yarn dedupe --check", + "lint:dependencies:fix": "depcheck && yarn dedupe", "lint:eslint": "eslint . --cache --ext js,cjs,ts", - "lint:fix": "yarn lint:eslint --fix && yarn lint:constraints --fix && yarn lint:misc --write && yarn lint:dependencies && yarn lint:changelog", - "lint:misc": "prettier '**/*.json' '**/*.md' '**/*.yml' '!.yarnrc.yml' --ignore-path .gitignore --no-error-on-unmatched-pattern", + "lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write && yarn constraints --fix && yarn lint:dependencies:fix", + "lint:misc": "prettier '**/*.json' '**/*.md' '!**/CHANGELOG.old.md' '**/*.yml' '!.yarnrc.yml' '!merged-packages/**' --ignore-path .gitignore", "prepack": "./scripts/prepack.sh", - "test": "jest && jest-it-up && attw --pack", - "test:watch": "jest --watch" + "test": "yarn test:verbose --silent --collectCoverage=false --reporters=jest-silent-reporter", + "test:clean": "yarn workspaces foreach --all --parallel --verbose run test:clean && yarn test", + "test:verbose": "yarn workspaces foreach --all --parallel --verbose run test:verbose" }, "devDependencies": { "@arethetypeswrong/cli": "^0.15.3", "@lavamoat/allow-scripts": "^3.0.4", "@lavamoat/preinstall-always-fail": "^2.0.0", - "@metamask/auto-changelog": "^3.4.3", + "@metamask/auto-changelog": "^3.4.4", "@metamask/eslint-config": "^12.2.0", "@metamask/eslint-config-jest": "^12.1.0", "@metamask/eslint-config-nodejs": "^12.1.0", @@ -56,10 +43,10 @@ "@ts-bridge/cli": "^0.1.4", "@ts-bridge/shims": "^0.1.1", "@types/jest": "^28.1.6", - "@types/node": "^18.18", + "@types/node": "^18.18.14", "@typescript-eslint/eslint-plugin": "^5.43.0", "@typescript-eslint/parser": "^5.43.0", - "@yarnpkg/types": "^4.0.0-rc.52", + "@yarnpkg/types": "^4.0.0", "depcheck": "^1.4.3", "eslint": "^8.44.0", "eslint-config-prettier": "^8.8.0", @@ -70,22 +57,18 @@ "eslint-plugin-prettier": "^4.2.1", "eslint-plugin-promise": "^6.1.1", "jest": "^28.1.3", - "jest-it-up": "^2.0.2", + "jest-silent-reporter": "^0.6.0", "prettier": "^2.7.1", "prettier-plugin-packagejson": "^2.3.0", + "rimraf": "^6.0.0", "ts-jest": "^28.0.7", - "ts-node": "^10.7.0", - "typedoc": "^0.23.15", - "typescript": "~4.8.4" + "typedoc": "^0.24.8", + "typescript": "~4.9.5" }, - "packageManager": "yarn@4.1.1", + "packageManager": "yarn@4.2.2", "engines": { "node": "^18.18 || >=20" }, - "publishConfig": { - "access": "public", - "registry": "https://registry.npmjs.org/" - }, "lavamoat": { "allowScripts": { "@lavamoat/preinstall-always-fail": false diff --git a/packages/ocap-playground/README.md b/packages/ocap-playground/README.md new file mode 100644 index 000000000..d67d60bf3 --- /dev/null +++ b/packages/ocap-playground/README.md @@ -0,0 +1,15 @@ +# `@metamask/ocap-playground` + +An Ocap Kernel playground. + +## Installation + +`yarn add @metamask/ocap-playground` + +or + +`npm install @metamask/ocap-playground` + +## Contributing + +This package is part of a monorepo. Instructions for contributing can be found in the [monorepo README](https://github.com/MetaMask/ocap-kernel#readme). diff --git a/packages/ocap-playground/jest.config.js b/packages/ocap-playground/jest.config.js new file mode 100644 index 000000000..0eec2ce3a --- /dev/null +++ b/packages/ocap-playground/jest.config.js @@ -0,0 +1,16 @@ +/* + * For a detailed explanation regarding each configuration property and type check, visit: + * https://jestjs.io/docs/configuration + */ + +const merge = require('deepmerge'); +const path = require('path'); + +const baseConfig = require('../../jest.config.packages'); + +const displayName = path.basename(__dirname); + +module.exports = merge(baseConfig, { + // The display name when running multiple projects + displayName, +}); diff --git a/packages/ocap-playground/package.json b/packages/ocap-playground/package.json new file mode 100644 index 000000000..00ea9a73f --- /dev/null +++ b/packages/ocap-playground/package.json @@ -0,0 +1,41 @@ +{ + "name": "@metamask/ocap-playground", + "version": "0.0.0", + "private": true, + "description": "An Ocap Kernel playground", + "repository": { + "type": "git", + "url": "https://github.com/MetaMask/ocap-kernel.git" + }, + "files": [ + "dist/" + ], + "scripts": { + "build": "ts-bridge --project tsconfig.build.json --clean", + "build:docs": "typedoc", + "changelog:validate": "../../scripts/validate-changelog.sh @metamask/ocap-playground", + "publish:preview": "yarn npm publish --tag preview", + "test": "jest --reporters=jest-silent-reporter", + "posttest": "jest-it-up", + "test:clean": "jest --clearCache", + "test:verbose": "jest --verbose", + "test:watch": "jest --watch" + }, + "devDependencies": { + "@arethetypeswrong/cli": "^0.15.3", + "@metamask/auto-changelog": "^3.4.4", + "@ts-bridge/cli": "^0.1.4", + "@ts-bridge/shims": "^0.1.1", + "@types/jest": "^28.1.6", + "deepmerge": "^4.3.1", + "jest": "^28.1.3", + "jest-it-up": "^2.0.2", + "ts-jest": "^28.0.7", + "typedoc": "^0.24.8", + "typedoc-plugin-missing-exports": "^2.0.0", + "typescript": "~4.9.5" + }, + "engines": { + "node": "^18.18 || >=20" + } +} diff --git a/packages/ocap-playground/src/index.test.ts b/packages/ocap-playground/src/index.test.ts new file mode 100644 index 000000000..bc062d369 --- /dev/null +++ b/packages/ocap-playground/src/index.test.ts @@ -0,0 +1,9 @@ +import greeter from '.'; + +describe('Test', () => { + it('greets', () => { + const name = 'Huey'; + const result = greeter(name); + expect(result).toBe('Hello, Huey!'); + }); +}); diff --git a/packages/ocap-playground/src/index.ts b/packages/ocap-playground/src/index.ts new file mode 100644 index 000000000..6972c1172 --- /dev/null +++ b/packages/ocap-playground/src/index.ts @@ -0,0 +1,9 @@ +/** + * Example function that returns a greeting for the given name. + * + * @param name - The name to greet. + * @returns The greeting. + */ +export default function greeter(name: string): string { + return `Hello, ${name}!`; +} diff --git a/packages/ocap-playground/tsconfig.build.json b/packages/ocap-playground/tsconfig.build.json new file mode 100644 index 000000000..02a0eea03 --- /dev/null +++ b/packages/ocap-playground/tsconfig.build.json @@ -0,0 +1,10 @@ +{ + "extends": "../../tsconfig.packages.build.json", + "compilerOptions": { + "baseUrl": "./", + "outDir": "./dist", + "rootDir": "./src" + }, + "references": [], + "include": ["../../types", "./src"] +} diff --git a/packages/ocap-playground/tsconfig.json b/packages/ocap-playground/tsconfig.json new file mode 100644 index 000000000..6f1d89de4 --- /dev/null +++ b/packages/ocap-playground/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../../tsconfig.packages.json", + "compilerOptions": { + "baseUrl": "./" + }, + "references": [], + "include": ["./src"] +} diff --git a/packages/ocap-playground/typedoc.json b/packages/ocap-playground/typedoc.json new file mode 100644 index 000000000..c9da015db --- /dev/null +++ b/packages/ocap-playground/typedoc.json @@ -0,0 +1,7 @@ +{ + "entryPoints": ["./src/index.ts"], + "excludePrivate": true, + "hideGenerator": true, + "out": "docs", + "tsconfig": "./tsconfig.build.json" +} diff --git a/scripts/get.sh b/scripts/get.sh deleted file mode 100755 index 9c988bb8a..000000000 --- a/scripts/get.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -u -set -o pipefail - -if [[ ${RUNNER_DEBUG:-0} == 1 ]]; then - set -x -fi - -KEY="${1}" -OUTPUT="${2}" - -if [[ -z $KEY ]]; then - echo "Error: KEY not specified." - exit 1 -fi - -if [[ -z $OUTPUT ]]; then - echo "Error: OUTPUT not specified." - exit 1 -fi - -echo "$OUTPUT=$(jq --raw-output "$KEY" package.json)" >> "$GITHUB_OUTPUT" diff --git a/scripts/prepack.sh b/scripts/prepack.sh index ad99af58d..7f2ece375 100755 --- a/scripts/prepack.sh +++ b/scripts/prepack.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash +set -x set -e set -o pipefail diff --git a/scripts/update-changelog.sh b/scripts/update-changelog.sh new file mode 100755 index 000000000..7cd563901 --- /dev/null +++ b/scripts/update-changelog.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +set -euo pipefail + +# Get the current package name +if [[ $# -eq 0 ]]; then + echo "Missing package name." + exit 1 +fi + +package_name="$1" +shift # remove package name from arguments + +# Get the current git branch +branch=$(git rev-parse --abbrev-ref HEAD) + +if [[ $branch =~ ^release/ ]]; then + yarn auto-changelog update --prettier --tag-prefix "${package_name}@" --rc "$@" +else + yarn auto-changelog update --prettier --tag-prefix "${package_name}@" "$@" +fi diff --git a/scripts/validate-changelog.sh b/scripts/validate-changelog.sh new file mode 100755 index 000000000..19dabb362 --- /dev/null +++ b/scripts/validate-changelog.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +set -euo pipefail + +if [[ $# -eq 0 ]]; then + echo "Missing package name." + exit 1 +fi + +package_name="$1" +shift # remove package name from arguments + +if [[ "${GITHUB_REF:-}" =~ '^release/' ]]; then + yarn auto-changelog validate --prettier --tag-prefix "${package_name}@" --rc "$@" +else + yarn auto-changelog validate --prettier --tag-prefix "${package_name}@" "$@" +fi diff --git a/tsconfig.build.json b/tsconfig.build.json index 0160af457..44e5c2c8f 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -1,24 +1,5 @@ { - "extends": "./tsconfig.json", - "compilerOptions": { - "declaration": true, - "declarationMap": true, - "emitDeclarationOnly": true, - "inlineSources": true, - "noEmit": false, - "outDir": "dist", - "rootDir": "src", - "sourceMap": true - }, - "include": ["./src/**/*.ts"], - "exclude": [ - "./src/**/__fixtures__/**/*", - "./src/**/__mocks__/**/*", - "./src/**/__test__/**/*", - "./src/**/__tests__/**/*", - "./src/**/__snapshots__/**/*", - "./src/**/*.test.ts", - "./src/**/*.test-d.ts", - "./src/**/*.test.*.ts" - ] + "files": [], + "include": [], + "references": [{ "path": "./packages/ocap-playground/tsconfig.build.json" }] } diff --git a/tsconfig.json b/tsconfig.json index 56f653116..245e1f474 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,16 +1,10 @@ { "compilerOptions": { "esModuleInterop": true, - "exactOptionalPropertyTypes": true, - "forceConsistentCasingInFileNames": true, - "lib": ["ES2020"], - "module": "CommonJS", - "moduleResolution": "node", "noEmit": true, - "noErrorTruncation": true, - "noUncheckedIndexedAccess": true, - "strict": true, - "target": "es2020" + "resolveJsonModule": true }, - "exclude": ["./dist", "**/node_modules"] + "files": [], + "include": [], + "references": [{ "path": "./packages/ocap-playground" }] } diff --git a/tsconfig.packages.build.json b/tsconfig.packages.build.json new file mode 100644 index 000000000..e77c1d80b --- /dev/null +++ b/tsconfig.packages.build.json @@ -0,0 +1,11 @@ +{ + "extends": "./tsconfig.packages.json", + "compilerOptions": { + "declaration": true, + "declarationMap": true, + "emitDeclarationOnly": true, + "inlineSources": true, + "sourceMap": true + }, + "exclude": ["./jest.config.packages.ts", "**/*.test.ts", "**/jest.config.ts"] +} diff --git a/tsconfig.packages.json b/tsconfig.packages.json new file mode 100644 index 000000000..d7ee52ad2 --- /dev/null +++ b/tsconfig.packages.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "composite": true, + "exactOptionalPropertyTypes": true, + "forceConsistentCasingInFileNames": true, + "lib": ["ES2020"], + "module": "CommonJS", + "moduleResolution": "Node", + "noErrorTruncation": true, + "noUncheckedIndexedAccess": true, + /** + * Here we ensure that TypeScript resolves `@metamask/*` imports to the + * uncompiled source code for packages that live in this repo. + * + * NOTE: This must be synchronized with the `moduleNameMapper` option in + * `jest.config.packages.js`. + */ + "paths": { + "@metamask/*": ["../*/src"] + }, + "strict": true, + "target": "ES2020", + "useUnknownInCatchVariables": true + } +} diff --git a/yarn.config.cjs b/yarn.config.cjs deleted file mode 100644 index 1a50431ce..000000000 --- a/yarn.config.cjs +++ /dev/null @@ -1,286 +0,0 @@ -/** @type {import('@yarnpkg/types')} */ -const { defineConfig } = require('@yarnpkg/types'); -const { readFile } = require('fs/promises'); -const { basename, resolve } = require('path'); - -/** - * Aliases for the Yarn type definitions, to make the code more readable. - * - * @typedef {import('@yarnpkg/types').Yarn.Constraints.Workspace} Workspace - * @typedef {import('@yarnpkg/types').Yarn.Constraints.Dependency} Dependency - */ - -/** - * The base URL for the GitHub repository. - * - * @type {string} - */ -const BASE_URL = 'https://github.com/MetaMask/'; - -/** - * Get the name of the workspace. The workspace name is expected to be in the - * form `@metamask/workspace-name`, and this function will extract - * `workspace-name`. - * - * @param {Workspace} workspace - The workspace. - * @returns {string} The name of the workspace. - */ -function getWorkspaceName(workspace) { - return basename(workspace.ident); -} - -/** - * Get the absolute path to a file within the workspace. - * - * @param {Workspace} workspace - The workspace. - * @param {string} path - The path to the file, relative to the workspace root. - * @returns {string} The absolute path to the file. - */ -function getWorkspacePath(workspace, path) { - return resolve(__dirname, workspace.cwd, path); -} - -/** - * Get the contents of a file within the workspace. The file is expected to be - * encoded as UTF-8. - * - * @param {Workspace} workspace - The workspace. - * @param {string} path - The path to the file, relative to the workspace root. - * @returns {Promise} The contents of the file. - */ -async function getWorkspaceFile(workspace, path) { - return await readFile(getWorkspacePath(workspace, path), 'utf8'); -} - -/** - * Expect that the workspace has the given field, and that it is a non-null - * value. If the field is not present, or is null, this will log an error, and - * cause the constraint to fail. - * - * If a value is provided, this will also verify that the field is equal to the - * given value. - * - * @param {Workspace} workspace - The workspace to check. - * @param {string} field - The field to check. - * @param {any} [value] - The value to check. - */ -function expectWorkspaceField(workspace, field, value) { - const fieldValue = workspace.manifest[field]; - if (fieldValue === null) { - workspace.error(`Missing required field "${field}".`); - return; - } - - if (value) { - workspace.set(field, value); - } -} - -/** - * Expect that the workspace has a description, and that it is a non-null - * string. If the description is not present, or is null, this will log an - * error, and cause the constraint to fail. - * - * This will also verify that the description does not end with a period. - * - * @param {Workspace} workspace - The workspace to check. - */ -function expectWorkspaceDescription(workspace) { - expectWorkspaceField(workspace, 'description'); - - const { description } = workspace.manifest; - if (typeof description !== 'string') { - workspace.error( - `Expected description to be a string, but got ${typeof description}.`, - ); - return; - } - - if (description.endsWith('.')) { - workspace.set('description', description.slice(0, -1)); - } -} - -/** - * Expect that if a dependency is listed under "dependencies", it is not also - * listed under "devDependencies". If it is, this will log an error, and cause - * the constraint to fail. - * - * @param {Workspace} workspace - The workspace to check. - */ -function expectWorkspaceDependencies(workspace) { - workspace.pkg.dependencies.forEach((dependency) => { - // `workspace.pkg` does not have a `devDependencies` field, so we need to - // check the `manifest` instead. - const isDependency = Boolean( - workspace.manifest.dependencies?.[dependency.ident], - ); - const isDevDependency = Boolean( - workspace.manifest.devDependencies?.[dependency.ident], - ); - - if (isDependency && isDevDependency) { - workspace.unset(`devDependencies.${dependency.ident}`); - } - }); -} - -/** - * Expect that the workspace has a README.md file, and that it is a non-empty - * string. The README.md is expected to: - * - * - Not contain template instructions (unless the workspace is the module - * template itself). - * - Match the version of Node.js specified in the `.nvmrc` file. - * - * @param {Workspace} workspace - The workspace to check. - * @param {string} workspaceName - The name of the workspace. - * @returns {Promise} - */ -async function expectReadme(workspace, workspaceName) { - const readme = await getWorkspaceFile(workspace, 'README.md'); - if ( - workspaceName !== 'metamask-module-template' && - readme.includes('## Template Instructions') - ) { - workspace.error( - 'The README.md contains template instructions. These instructions should be removed.', - ); - } - - if (!readme.includes(`yarn add @metamask/${workspaceName}`)) { - workspace.error( - `The README.md does not contain an example of how to install the package using Yarn (\`yarn add @metamask/${workspaceName}\`). Please add an example.`, - ); - } - - if (!readme.includes(`npm install @metamask/${workspaceName}`)) { - workspace.error( - `The README.md does not contain an example of how to install the package using npm (\`npm install @metamask/${workspaceName}\`). Please add an example.`, - ); - } -} - -/** - * Expect that the workspace has a pull_request_template.md file, and that it - * is a non-empty string. The pull_request_template.md is expected to: - * - * - Not contain an examples section (unless the workspace is the module - * template itself). - * - * @param {Workspace} workspace - The workspace to check. - * @param {string} workspaceName - The name of the workspace. - * @returns {Promise} - */ -async function expectPullRequestTemplate(workspace, workspaceName) { - if (workspaceName === 'metamask-module-template') { - return; - } - - const pullRequestTemplate = await getWorkspaceFile( - workspace, - '.github/PULL_REQUEST_TEMPLATE.md', - ); - - if (!pullRequestTemplate) { - workspace.error( - 'The pull_request_template.md is missing. This should be added.', - ); - } - - if (pullRequestTemplate.includes('## Examples')) { - workspace.error( - 'The pull_request_template.md contains an examples section. This section should be removed.', - ); - } -} - -/** - * Expect that the workspace has a valid `exports` field. The `exports` field - * is expected to: - * - * - Export a `types` entrypoint as the first export, or not at all. - * - * This is required for proper TypeScript support when using `Node16` (or later) - * module resolution. - * - * @param {Workspace} workspace - The workspace to check. - * @returns {void} - */ -function expectExports(workspace) { - const { exports: manifestExports } = workspace.manifest; - Object.entries(manifestExports) - .filter(([, exportValue]) => typeof exportValue !== 'string') - .forEach(([exportName, exportObject]) => { - const keys = Object.keys(exportObject); - if (keys.includes('types') && keys[0] !== 'types') { - workspace.error( - `The "types" export must be the first export in the "exports" field for the export "${exportName}".`, - ); - } - }); -} - -module.exports = defineConfig({ - async constraints({ Yarn }) { - const workspace = Yarn.workspace(); - const workspaceName = getWorkspaceName(workspace); - const workspaceRepository = `${BASE_URL}${workspaceName}`; - - // The package must have a name, version, description, and license. - expectWorkspaceField(workspace, 'name', `@metamask/${workspaceName}`); - expectWorkspaceField(workspace, 'version'); - expectWorkspaceField(workspace, 'license'); - expectWorkspaceDescription(workspace); - - // The package must have a valid README.md file. - await expectReadme(workspace, workspaceName); - - // The package must have a valid pull request template. - await expectPullRequestTemplate(workspace, workspaceName); - - expectWorkspaceDependencies(workspace); - - // The homepage of the package must match its name. - workspace.set('homepage', `${workspaceRepository}#readme`); - - // The bugs URL of the package must point to the Issues page for the - // repository. - workspace.set('bugs.url', `${workspaceRepository}/issues`); - - // The package must specify Git as the repository type, and match the URL of - // a repository within the MetaMask organization. - workspace.set('repository.type', 'git'); - workspace.set('repository.url', `${workspaceRepository}.git`); - - // The package must specify a minimum Node.js version of 18.18. - workspace.set('engines.node', '^18.18 || >=20'); - - // The package must provide the location of the CommonJS-compatible - // entrypoint and its matching type declaration file. - workspace.set('main', './dist/index.cjs'); - workspace.set('exports["."].require.default', './dist/index.cjs'); - workspace.set('types', './dist/index.d.cts'); - workspace.set('exports["."].require.types', './dist/index.d.cts'); - - // The package must provide the location of the ESM-compatible JavaScript - // entrypoint and its matching type declaration file. - workspace.set('module', './dist/index.mjs'); - workspace.set('exports["."].import.default', './dist/index.mjs'); - workspace.set('exports["."].import.types', './dist/index.d.mts'); - - // The package must export a `package.json` file. - workspace.set('exports["./package.json"]', './package.json'); - - expectExports(workspace); - - // The list of files included in the package must only include files - // generated during the build process. - workspace.set('files', ['dist']); - - // The package is public, and should be published to the npm registry. - workspace.unset('private'); - workspace.set('publishConfig.access', 'public'); - workspace.set('publishConfig.registry', 'https://registry.npmjs.org/'); - }, -}); diff --git a/yarn.lock b/yarn.lock index 9666a56f8..c5189eb34 100644 --- a/yarn.lock +++ b/yarn.lock @@ -458,22 +458,6 @@ __metadata: languageName: node linkType: hard -"@cspotcode/source-map-consumer@npm:0.8.0": - version: 0.8.0 - resolution: "@cspotcode/source-map-consumer@npm:0.8.0" - checksum: 10/dfe1399712e4d54e1d53b0c7782f929647ff8675c37ae7637ce2ffdbcc8bad06fea969bcbec6147e7ea70a89257cfc86695a3702c1946a1c334454480937b966 - languageName: node - linkType: hard - -"@cspotcode/source-map-support@npm:0.7.0": - version: 0.7.0 - resolution: "@cspotcode/source-map-support@npm:0.7.0" - dependencies: - "@cspotcode/source-map-consumer": "npm:0.8.0" - checksum: 10/d58b31640c4b1438c0caf8ed7eb46647674c042a625919660d9fb2d76f3621875520082934bae88ef54a75d53e8f9cafb506160bb02403a19e7155aa5f4ac59b - languageName: node - linkType: hard - "@es-joy/jsdoccomment@npm:~0.36.1": version: 0.36.1 resolution: "@es-joy/jsdoccomment@npm:0.36.1" @@ -848,6 +832,19 @@ __metadata: languageName: node linkType: hard +"@jest/types@npm:^26.6.2": + version: 26.6.2 + resolution: "@jest/types@npm:26.6.2" + dependencies: + "@types/istanbul-lib-coverage": "npm:^2.0.0" + "@types/istanbul-reports": "npm:^3.0.0" + "@types/node": "npm:*" + "@types/yargs": "npm:^15.0.0" + chalk: "npm:^4.0.0" + checksum: 10/02d42749c8c6dc7e3184d0ff0293dd91c97233c2e6dc3708d61ef33d3162d4f07ad38d2d8a39abd94cf2fced69b92a87565c7099137c4529809242ca327254af + languageName: node + linkType: hard + "@jest/types@npm:^28.1.3": version: 28.1.3 resolution: "@jest/types@npm:28.1.3" @@ -937,7 +934,7 @@ __metadata: languageName: node linkType: hard -"@metamask/auto-changelog@npm:^3.4.3": +"@metamask/auto-changelog@npm:^3.4.4": version: 3.4.4 resolution: "@metamask/auto-changelog@npm:3.4.4" dependencies: @@ -1002,42 +999,22 @@ __metadata: languageName: node linkType: hard -"@metamask/metamask-module-template@workspace:.": +"@metamask/ocap-playground@workspace:packages/ocap-playground": version: 0.0.0-use.local - resolution: "@metamask/metamask-module-template@workspace:." + resolution: "@metamask/ocap-playground@workspace:packages/ocap-playground" dependencies: "@arethetypeswrong/cli": "npm:^0.15.3" - "@lavamoat/allow-scripts": "npm:^3.0.4" - "@lavamoat/preinstall-always-fail": "npm:^2.0.0" - "@metamask/auto-changelog": "npm:^3.4.3" - "@metamask/eslint-config": "npm:^12.2.0" - "@metamask/eslint-config-jest": "npm:^12.1.0" - "@metamask/eslint-config-nodejs": "npm:^12.1.0" - "@metamask/eslint-config-typescript": "npm:^12.1.0" + "@metamask/auto-changelog": "npm:^3.4.4" "@ts-bridge/cli": "npm:^0.1.4" "@ts-bridge/shims": "npm:^0.1.1" "@types/jest": "npm:^28.1.6" - "@types/node": "npm:^18.18" - "@typescript-eslint/eslint-plugin": "npm:^5.43.0" - "@typescript-eslint/parser": "npm:^5.43.0" - "@yarnpkg/types": "npm:^4.0.0-rc.52" - depcheck: "npm:^1.4.3" - eslint: "npm:^8.44.0" - eslint-config-prettier: "npm:^8.8.0" - eslint-plugin-import: "npm:~2.26.0" - eslint-plugin-jest: "npm:^27.2.2" - eslint-plugin-jsdoc: "npm:^39.9.1" - eslint-plugin-n: "npm:^15.7.0" - eslint-plugin-prettier: "npm:^4.2.1" - eslint-plugin-promise: "npm:^6.1.1" + deepmerge: "npm:^4.3.1" jest: "npm:^28.1.3" jest-it-up: "npm:^2.0.2" - prettier: "npm:^2.7.1" - prettier-plugin-packagejson: "npm:^2.3.0" ts-jest: "npm:^28.0.7" - ts-node: "npm:^10.7.0" - typedoc: "npm:^0.23.15" - typescript: "npm:~4.8.4" + typedoc: "npm:^0.24.8" + typedoc-plugin-missing-exports: "npm:^2.0.0" + typescript: "npm:~4.9.5" languageName: unknown linkType: soft @@ -1243,34 +1220,6 @@ __metadata: languageName: node linkType: hard -"@tsconfig/node10@npm:^1.0.7": - version: 1.0.8 - resolution: "@tsconfig/node10@npm:1.0.8" - checksum: 10/b8d5fffbc6b17ef64ef74f7fdbccee02a809a063ade785c3648dae59406bc207f70ea2c4296f92749b33019fa36a5ae716e42e49cc7f1bbf0fd147be0d6b970a - languageName: node - linkType: hard - -"@tsconfig/node12@npm:^1.0.7": - version: 1.0.9 - resolution: "@tsconfig/node12@npm:1.0.9" - checksum: 10/a01b2400ab3582b86b589c6d31dcd0c0656f333adecde85d6d7d4086adb059808b82692380bb169546d189bf771ae21d02544a75b57bd6da4a5dd95f8567bec9 - languageName: node - linkType: hard - -"@tsconfig/node14@npm:^1.0.0": - version: 1.0.1 - resolution: "@tsconfig/node14@npm:1.0.1" - checksum: 10/976345e896c0f059867f94f8d0f6ddb8b1844fb62bf36b727de8a9a68f024857e5db97ed51d3325e23e0616a5e48c034ff51a8d595b3fe7e955f3587540489be - languageName: node - linkType: hard - -"@tsconfig/node16@npm:^1.0.2": - version: 1.0.2 - resolution: "@tsconfig/node16@npm:1.0.2" - checksum: 10/ca94d3639714672bbfd55f03521d3f56bb6a25479bd425da81faf21f13e1e9d15f40f97377dedbbf477a5841c5b0c8f4cd1b391f33553d750b9202c54c2c07aa - languageName: node - linkType: hard - "@types/babel__core@npm:^7.1.14": version: 7.1.19 resolution: "@types/babel__core@npm:7.1.19" @@ -1394,12 +1343,12 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:*, @types/node@npm:^18.18": - version: 18.19.34 - resolution: "@types/node@npm:18.19.34" +"@types/node@npm:*, @types/node@npm:^18.18.14": + version: 18.19.39 + resolution: "@types/node@npm:18.19.39" dependencies: undici-types: "npm:~5.26.4" - checksum: 10/5c8daed0c672e824c36d31312377fc4dddf3e91006fadad719527bb2bd710d4207193c1c7034da9d2d6cbc03da89d3693c86207f751540c18a7d38802040fbd9 + checksum: 10/d2fe84adf087a4184217b666f675e99678060d15f84882a4a1c3e49c3dca521a7e99a201a3c073c2b60b00419f1f4c3b357d8f7397f65e400dc3b77b0145a1da languageName: node linkType: hard @@ -1438,6 +1387,15 @@ __metadata: languageName: node linkType: hard +"@types/yargs@npm:^15.0.0": + version: 15.0.19 + resolution: "@types/yargs@npm:15.0.19" + dependencies: + "@types/yargs-parser": "npm:*" + checksum: 10/c3abcd3472c32c02702f365dc1702a0728562deb8a8c61f3ce2161958d756cc033f7d78567565b4eba62f5869e9b5eac93d4c1dcb2c97af17aafda8f9f892b4b + languageName: node + linkType: hard + "@types/yargs@npm:^17.0.8": version: 17.0.11 resolution: "@types/yargs@npm:17.0.11" @@ -1637,12 +1595,12 @@ __metadata: languageName: node linkType: hard -"@yarnpkg/types@npm:^4.0.0-rc.52": - version: 4.0.0-rc.52 - resolution: "@yarnpkg/types@npm:4.0.0-rc.52" +"@yarnpkg/types@npm:^4.0.0": + version: 4.0.0 + resolution: "@yarnpkg/types@npm:4.0.0" dependencies: tslib: "npm:^2.4.0" - checksum: 10/858c2b2848a6449004e9cb7bf847b8aabdc6b4bd0c73e8aedae1a1ff8fab7cc8e4ee18a054076e9bb374c59435439715f7844d7993ca0b252f244ead06bcd87d + checksum: 10/f9670e120761a4d17461df2f01aa4b92213fbdd063501a36145d11ea01bd87ba01d44615cba3d6bc8f9bfc39a03a9a6452bf0436c7fb0c9c5311352b975349e6 languageName: node linkType: hard @@ -1669,14 +1627,7 @@ __metadata: languageName: node linkType: hard -"acorn-walk@npm:^8.1.1": - version: 8.2.0 - resolution: "acorn-walk@npm:8.2.0" - checksum: 10/e69f7234f2adfeb16db3671429a7c80894105bd7534cb2032acf01bb26e6a847952d11a062d071420b43f8d82e33d2e57f26fe87d9cce0853e8143d8910ff1de - languageName: node - linkType: hard - -"acorn@npm:^8.4.1, acorn@npm:^8.9.0": +"acorn@npm:^8.9.0": version: 8.10.0 resolution: "acorn@npm:8.10.0" bin: @@ -1773,6 +1724,13 @@ __metadata: languageName: node linkType: hard +"ansi-sequence-parser@npm:^1.1.0": + version: 1.1.1 + resolution: "ansi-sequence-parser@npm:1.1.1" + checksum: 10/9ce30f257badc2ef62cac8028a7e26c368d22bf26650427192e8ffd102da42e377e3affe90fae58062eecc963b0b055f510dde3b677c7e0c433c67069b5a8ee5 + languageName: node + linkType: hard + "ansi-styles@npm:^3.2.1": version: 3.2.1 resolution: "ansi-styles@npm:3.2.1" @@ -1840,13 +1798,6 @@ __metadata: languageName: node linkType: hard -"arg@npm:^4.1.0": - version: 4.1.3 - resolution: "arg@npm:4.1.3" - checksum: 10/969b491082f20cad166649fa4d2073ea9e974a4e5ac36247ca23d2e5a8b3cb12d60e9ff70a8acfe26d76566c71fd351ee5e6a9a6595157eb36f92b1fd64e1599 - languageName: node - linkType: hard - "argparse@npm:^1.0.7": version: 1.0.10 resolution: "argparse@npm:1.0.10" @@ -2062,12 +2013,12 @@ __metadata: languageName: node linkType: hard -"braces@npm:^3.0.1, braces@npm:~3.0.2": - version: 3.0.2 - resolution: "braces@npm:3.0.2" +"braces@npm:^3.0.3, braces@npm:~3.0.2": + version: 3.0.3 + resolution: "braces@npm:3.0.3" dependencies: - fill-range: "npm:^7.0.1" - checksum: 10/966b1fb48d193b9d155f810e5efd1790962f2c4e0829f8440b8ad236ba009222c501f70185ef732fef17a4c490bb33a03b90dab0631feafbdf447da91e8165b1 + fill-range: "npm:^7.1.1" + checksum: 10/fad11a0d4697a27162840b02b1fad249c1683cbc510cd5bf1a471f2f8085c046d41094308c577a50a03a579dd99d5a6b3724c4b5e8b14df2c4443844cfcda2c6 languageName: node linkType: hard @@ -2252,8 +2203,8 @@ __metadata: linkType: hard "chokidar@npm:>=3.0.0 <4.0.0": - version: 3.5.3 - resolution: "chokidar@npm:3.5.3" + version: 3.6.0 + resolution: "chokidar@npm:3.6.0" dependencies: anymatch: "npm:~3.1.2" braces: "npm:~3.0.2" @@ -2266,7 +2217,7 @@ __metadata: dependenciesMeta: fsevents: optional: true - checksum: 10/863e3ff78ee7a4a24513d2a416856e84c8e4f5e60efbe03e8ab791af1a183f569b62fc6f6b8044e2804966cb81277ddbbc1dc374fba3265bd609ea8efd62f5b3 + checksum: 10/c327fb07704443f8d15f7b4a7ce93b2f0bc0e6cea07ec28a7570aa22cd51fcf0379df589403976ea956c369f25aa82d84561947e227cd925902e1751371658df languageName: node linkType: hard @@ -2277,6 +2228,13 @@ __metadata: languageName: node linkType: hard +"ci-info@npm:^2.0.0": + version: 2.0.0 + resolution: "ci-info@npm:2.0.0" + checksum: 10/3b374666a85ea3ca43fa49aa3a048d21c9b475c96eb13c133505d2324e7ae5efd6a454f41efe46a152269e9b6a00c9edbe63ec7fa1921957165aae16625acd67 + languageName: node + linkType: hard + "ci-info@npm:^3.2.0": version: 3.3.0 resolution: "ci-info@npm:3.3.0" @@ -2473,13 +2431,6 @@ __metadata: languageName: node linkType: hard -"create-require@npm:^1.1.0": - version: 1.1.1 - resolution: "create-require@npm:1.1.1" - checksum: 10/a9a1503d4390d8b59ad86f4607de7870b39cad43d929813599a23714831e81c520bddf61bcdd1f8e30f05fd3a2b71ae8538e946eb2786dc65c2bbc520f692eff - languageName: node - linkType: hard - "cross-spawn@npm:^7.0.0, cross-spawn@npm:^7.0.2, cross-spawn@npm:^7.0.3": version: 7.0.3 resolution: "cross-spawn@npm:7.0.3" @@ -2492,14 +2443,14 @@ __metadata: linkType: hard "debug@npm:4, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.2.0, debug@npm:^4.3.2, debug@npm:^4.3.3, debug@npm:^4.3.4": - version: 4.3.4 - resolution: "debug@npm:4.3.4" + version: 4.3.5 + resolution: "debug@npm:4.3.5" dependencies: ms: "npm:2.1.2" peerDependenciesMeta: supports-color: optional: true - checksum: 10/0073c3bcbd9cb7d71dd5f6b55be8701af42df3e56e911186dfa46fac3a5b9eb7ce7f377dd1d3be6db8977221f8eb333d945216f645cf56f6b688cd484837d255 + checksum: 10/cb6eab424c410e07813ca1392888589972ce9a32b8829c6508f5e1f25f3c3e70a76731610ae55b4bbe58d1a2fffa1424b30e97fa8d394e49cd2656a9643aedd2 languageName: node linkType: hard @@ -2535,10 +2486,10 @@ __metadata: languageName: node linkType: hard -"deepmerge@npm:^4.2.2": - version: 4.2.2 - resolution: "deepmerge@npm:4.2.2" - checksum: 10/0e58ed14f530d08f9b996cfc3a41b0801691620235bc5e1883260e3ed1c1b4a1dfb59f865770e45d5dfb1d7ee108c4fc10c2f85e822989d4123490ea90be2545 +"deepmerge@npm:^4.2.2, deepmerge@npm:^4.3.1": + version: 4.3.1 + resolution: "deepmerge@npm:4.3.1" + checksum: 10/058d9e1b0ff1a154468bf3837aea436abcfea1ba1d165ddaaf48ca93765fdd01a30d33c36173da8fbbed951dd0a267602bc782fe288b0fc4b7e1e7091afc4529 languageName: node linkType: hard @@ -2639,13 +2590,6 @@ __metadata: languageName: node linkType: hard -"diff@npm:^4.0.1": - version: 4.0.2 - resolution: "diff@npm:4.0.2" - checksum: 10/ec09ec2101934ca5966355a229d77afcad5911c92e2a77413efda5455636c4cf2ce84057e2d7715227a2eeeda04255b849bd3ae3a4dd22eb22e86e76456df069 - languageName: node - linkType: hard - "diff@npm:^5.0.0": version: 5.0.0 resolution: "diff@npm:5.0.0" @@ -3302,12 +3246,12 @@ __metadata: languageName: node linkType: hard -"fill-range@npm:^7.0.1": - version: 7.0.1 - resolution: "fill-range@npm:7.0.1" +"fill-range@npm:^7.1.1": + version: 7.1.1 + resolution: "fill-range@npm:7.1.1" dependencies: to-regex-range: "npm:^5.0.1" - checksum: 10/e260f7592fd196b4421504d3597cc76f4a1ca7a9488260d533b611fc3cefd61e9a9be1417cb82d3b01ad9f9c0ff2dbf258e1026d2445e26b0cf5148ff4250429 + checksum: 10/a7095cb39e5bc32fada2aa7c7249d3f6b01bd1ce461a61b0adabacccabd9198500c6fb1f68a7c851a657e273fce2233ba869638897f3d7ed2e87a2d89b4436ea languageName: node linkType: hard @@ -3543,6 +3487,22 @@ __metadata: languageName: node linkType: hard +"glob@npm:^11.0.0": + version: 11.0.0 + resolution: "glob@npm:11.0.0" + dependencies: + foreground-child: "npm:^3.1.0" + jackspeak: "npm:^4.0.1" + minimatch: "npm:^10.0.0" + minipass: "npm:^7.1.2" + package-json-from-dist: "npm:^1.0.0" + path-scurry: "npm:^2.0.0" + bin: + glob: dist/esm/bin.mjs + checksum: 10/e66939201d11ae30fe97e3364ac2be5c59d6c9bfce18ac633edfad473eb6b46a7553f6f73658f67caaf6cccc1df1ae336298a45e9021fa5695fd78754cc1603e + languageName: node + linkType: hard + "glob@npm:^7.1.3, glob@npm:^7.1.4": version: 7.1.6 resolution: "glob@npm:7.1.6" @@ -3634,10 +3594,10 @@ __metadata: languageName: node linkType: hard -"graceful-fs@npm:^4.2.6, graceful-fs@npm:^4.2.9": - version: 4.2.10 - resolution: "graceful-fs@npm:4.2.10" - checksum: 10/0c83c52b62c68a944dcfb9d66b0f9f10f7d6e3d081e8067b9bfdc9e5f3a8896584d576036f82915773189eec1eba599397fc620e75c03c0610fb3d67c6713c1a +"graceful-fs@npm:^4.2.4, graceful-fs@npm:^4.2.6, graceful-fs@npm:^4.2.9": + version: 4.2.11 + resolution: "graceful-fs@npm:4.2.11" + checksum: 10/bf152d0ed1dc159239db1ba1f74fdbc40cb02f626770dcd5815c427ce0688c2635a06ed69af364396da4636d0408fcf7d4afdf7881724c3307e46aff30ca49e2 languageName: node linkType: hard @@ -3969,6 +3929,17 @@ __metadata: languageName: node linkType: hard +"is-ci@npm:^2.0.0": + version: 2.0.0 + resolution: "is-ci@npm:2.0.0" + dependencies: + ci-info: "npm:^2.0.0" + bin: + is-ci: bin.js + checksum: 10/77b869057510f3efa439bbb36e9be429d53b3f51abd4776eeea79ab3b221337fe1753d1e50058a9e2c650d38246108beffb15ccfd443929d77748d8c0cc90144 + languageName: node + linkType: hard + "is-core-module@npm:^2.11.0, is-core-module@npm:^2.13.0, is-core-module@npm:^2.4.0, is-core-module@npm:^2.8.1": version: 2.13.1 resolution: "is-core-module@npm:2.13.1" @@ -4205,6 +4176,19 @@ __metadata: languageName: node linkType: hard +"jackspeak@npm:^4.0.1": + version: 4.0.1 + resolution: "jackspeak@npm:4.0.1" + dependencies: + "@isaacs/cliui": "npm:^8.0.2" + "@pkgjs/parseargs": "npm:^0.11.0" + dependenciesMeta: + "@pkgjs/parseargs": + optional: true + checksum: 10/b20dc0df0dbb2903e4d540ae68308ec7d1dd60944b130e867e218c98b5d77481d65ea734b6c81c812d481500076e8b3fdfccfb38fc81cb1acf165e853da3e26c + languageName: node + linkType: hard + "jest-changed-files@npm:^28.1.3": version: 28.1.3 resolution: "jest-changed-files@npm:28.1.3" @@ -4552,6 +4536,16 @@ __metadata: languageName: node linkType: hard +"jest-silent-reporter@npm:^0.6.0": + version: 0.6.0 + resolution: "jest-silent-reporter@npm:0.6.0" + dependencies: + chalk: "npm:^4.0.0" + jest-util: "npm:^26.0.0" + checksum: 10/443e0abaf5a6dc8c17da1e8495b7a55f813224adc39b6d1954bf49ff7fe70533b1020571453180dbb8388ace87f8e1dfc79610a4554bb93334f6c4154231c292 + languageName: node + linkType: hard + "jest-snapshot@npm:^28.1.3": version: 28.1.3 resolution: "jest-snapshot@npm:28.1.3" @@ -4583,6 +4577,20 @@ __metadata: languageName: node linkType: hard +"jest-util@npm:^26.0.0": + version: 26.6.2 + resolution: "jest-util@npm:26.6.2" + dependencies: + "@jest/types": "npm:^26.6.2" + "@types/node": "npm:*" + chalk: "npm:^4.0.0" + graceful-fs: "npm:^4.2.4" + is-ci: "npm:^2.0.0" + micromatch: "npm:^4.0.2" + checksum: 10/4502bc699f147d2fa43274af18174b55fd5b956becd1347665217e35a5354e929206abaef580f967ed239587be926c835eb3ca9b5c361205df1988bc8d58a462 + languageName: node + linkType: hard + "jest-util@npm:^28.0.0, jest-util@npm:^28.1.3": version: 28.1.3 resolution: "jest-util@npm:28.1.3" @@ -4758,10 +4766,10 @@ __metadata: languageName: node linkType: hard -"jsonc-parser@npm:^3.0.0": - version: 3.2.0 - resolution: "jsonc-parser@npm:3.2.0" - checksum: 10/bd68b902e5f9394f01da97921f49c5084b2dc03a0c5b4fdb2a429f8d6f292686c1bf87badaeb0a8148d024192a88f5ad2e57b2918ba43fe25cf15f3371db64d4 +"jsonc-parser@npm:^3.2.0": + version: 3.3.1 + resolution: "jsonc-parser@npm:3.3.1" + checksum: 10/9b0dc391f20b47378f843ef1e877e73ec652a5bdc3c5fa1f36af0f119a55091d147a86c1ee86a232296f55c929bba174538c2bf0312610e0817a22de131cc3f4 languageName: node linkType: hard @@ -4853,6 +4861,13 @@ __metadata: languageName: node linkType: hard +"lru-cache@npm:^11.0.0": + version: 11.0.0 + resolution: "lru-cache@npm:11.0.0" + checksum: 10/41f36fbff8b6f199cce3e9cb2b625714f97a535dfd7f16d0988c2627f9ed4c38b6dc8f9ea7fdba19262a7c917ba41c89cad15ca3e3791fc9a2068af472b5bc8d + languageName: node + linkType: hard + "lru-cache@npm:^5.1.1": version: 5.1.1 resolution: "lru-cache@npm:5.1.1" @@ -4894,7 +4909,7 @@ __metadata: languageName: node linkType: hard -"make-error@npm:1.x, make-error@npm:^1.1.1": +"make-error@npm:1.x": version: 1.3.6 resolution: "make-error@npm:1.3.6" checksum: 10/b86e5e0e25f7f777b77fabd8e2cbf15737972869d852a22b7e73c17623928fccb826d8e46b9951501d3f20e51ad74ba8c59ed584f610526a48f8ccf88aaec402 @@ -4969,12 +4984,12 @@ __metadata: languageName: node linkType: hard -"marked@npm:^4.0.19": - version: 4.1.1 - resolution: "marked@npm:4.1.1" +"marked@npm:^4.3.0": + version: 4.3.0 + resolution: "marked@npm:4.3.0" bin: marked: bin/marked.js - checksum: 10/7cf479000a1ee3e51be81a542d5a6fd639394484f29942bb7bd25d045b5475c3a861106790a8e91c7ab1c071db66d20ea02174c5982ff1262026c54e98270637 + checksum: 10/c830bb4cb3705b754ca342b656e8a582d7428706b2678c898b856f6030c134ce2d1e19136efa3e6a1841f7330efbd24963d6bdeddc57d2938e906250f99895d0 languageName: node linkType: hard @@ -5001,13 +5016,13 @@ __metadata: languageName: node linkType: hard -"micromatch@npm:^4.0.4": - version: 4.0.4 - resolution: "micromatch@npm:4.0.4" +"micromatch@npm:^4.0.2, micromatch@npm:^4.0.4": + version: 4.0.7 + resolution: "micromatch@npm:4.0.7" dependencies: - braces: "npm:^3.0.1" - picomatch: "npm:^2.2.3" - checksum: 10/c499da5aad38f3ba1a32a73a81f3dd9b631e12492133c503c14ce59aa5c631159c08f2c43d3a7e0ea3955c7921d41b7b97e662360fe3b28b2cfb0923949c176d + braces: "npm:^3.0.3" + picomatch: "npm:^2.3.1" + checksum: 10/a11ed1cb67dcbbe9a5fc02c4062cf8bb0157d73bf86956003af8dcfdf9b287f9e15ec0f6d6925ff6b8b5b496202335e497b01de4d95ef6cf06411bc5e5c474a0 languageName: node linkType: hard @@ -5018,6 +5033,15 @@ __metadata: languageName: node linkType: hard +"minimatch@npm:^10.0.0": + version: 10.0.1 + resolution: "minimatch@npm:10.0.1" + dependencies: + brace-expansion: "npm:^2.0.1" + checksum: 10/082e7ccbc090d5f8c4e4e029255d5a1d1e3af37bda837da2b8b0085b1503a1210c91ac90d9ebfe741d8a5f286ece820a1abb4f61dc1f82ce602a055d461d93f3 + languageName: node + linkType: hard + "minimatch@npm:^3.0.4, minimatch@npm:^3.0.5, minimatch@npm:^3.1.2": version: 3.1.2 resolution: "minimatch@npm:3.1.2" @@ -5027,7 +5051,7 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:^5.0.1, minimatch@npm:^5.1.0": +"minimatch@npm:^5.0.1": version: 5.1.0 resolution: "minimatch@npm:5.1.0" dependencies: @@ -5036,12 +5060,12 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:^9.0.1": - version: 9.0.4 - resolution: "minimatch@npm:9.0.4" +"minimatch@npm:^9.0.0, minimatch@npm:^9.0.1": + version: 9.0.5 + resolution: "minimatch@npm:9.0.5" dependencies: brace-expansion: "npm:^2.0.1" - checksum: 10/4cdc18d112b164084513e890d6323370db14c22249d536ad1854539577a895e690a27513dc346392f61a4a50afbbd8abc88f3f25558bfbbbb862cd56508b20f5 + checksum: 10/dd6a8927b063aca6d910b119e1f2df6d2ce7d36eab91de83167dd136bb85e1ebff97b0d3de1cb08bd1f7e018ca170b4962479fefab5b2a69e2ae12cb2edc8348 languageName: node linkType: hard @@ -5136,10 +5160,10 @@ __metadata: languageName: node linkType: hard -"minipass@npm:^5.0.0 || ^6.0.2 || ^7.0.0, minipass@npm:^7.0.2, minipass@npm:^7.0.3, minipass@npm:^7.0.4": - version: 7.0.4 - resolution: "minipass@npm:7.0.4" - checksum: 10/e864bd02ceb5e0707696d58f7ce3a0b89233f0d686ef0d447a66db705c0846a8dc6f34865cd85256c1472ff623665f616b90b8ff58058b2ad996c5de747d2d18 +"minipass@npm:^5.0.0 || ^6.0.2 || ^7.0.0, minipass@npm:^7.0.2, minipass@npm:^7.0.3, minipass@npm:^7.0.4, minipass@npm:^7.1.2": + version: 7.1.2 + resolution: "minipass@npm:7.1.2" + checksum: 10/c25f0ee8196d8e6036661104bacd743785b2599a21de5c516b32b3fa2b83113ac89a2358465bc04956baab37ffb956ae43be679b2262bf7be15fce467ccd7950 languageName: node linkType: hard @@ -5438,6 +5462,45 @@ __metadata: languageName: node linkType: hard +"ocap-kernel-monorepo@workspace:.": + version: 0.0.0-use.local + resolution: "ocap-kernel-monorepo@workspace:." + dependencies: + "@arethetypeswrong/cli": "npm:^0.15.3" + "@lavamoat/allow-scripts": "npm:^3.0.4" + "@lavamoat/preinstall-always-fail": "npm:^2.0.0" + "@metamask/auto-changelog": "npm:^3.4.4" + "@metamask/eslint-config": "npm:^12.2.0" + "@metamask/eslint-config-jest": "npm:^12.1.0" + "@metamask/eslint-config-nodejs": "npm:^12.1.0" + "@metamask/eslint-config-typescript": "npm:^12.1.0" + "@ts-bridge/cli": "npm:^0.1.4" + "@ts-bridge/shims": "npm:^0.1.1" + "@types/jest": "npm:^28.1.6" + "@types/node": "npm:^18.18.14" + "@typescript-eslint/eslint-plugin": "npm:^5.43.0" + "@typescript-eslint/parser": "npm:^5.43.0" + "@yarnpkg/types": "npm:^4.0.0" + depcheck: "npm:^1.4.3" + eslint: "npm:^8.44.0" + eslint-config-prettier: "npm:^8.8.0" + eslint-plugin-import: "npm:~2.26.0" + eslint-plugin-jest: "npm:^27.2.2" + eslint-plugin-jsdoc: "npm:^39.9.1" + eslint-plugin-n: "npm:^15.7.0" + eslint-plugin-prettier: "npm:^4.2.1" + eslint-plugin-promise: "npm:^6.1.1" + jest: "npm:^28.1.3" + jest-silent-reporter: "npm:^0.6.0" + prettier: "npm:^2.7.1" + prettier-plugin-packagejson: "npm:^2.3.0" + rimraf: "npm:^6.0.0" + ts-jest: "npm:^28.0.7" + typedoc: "npm:^0.24.8" + typescript: "npm:~4.9.5" + languageName: unknown + linkType: soft + "once@npm:^1.3.0": version: 1.4.0 resolution: "once@npm:1.4.0" @@ -5522,6 +5585,13 @@ __metadata: languageName: node linkType: hard +"package-json-from-dist@npm:^1.0.0": + version: 1.0.0 + resolution: "package-json-from-dist@npm:1.0.0" + checksum: 10/ac706ec856a5a03f5261e4e48fa974f24feb044d51f84f8332e2af0af04fbdbdd5bbbfb9cbbe354190409bc8307c83a9e38c6672c3c8855f709afb0006a009ea + languageName: node + linkType: hard + "parent-module@npm:^1.0.0": version: 1.0.1 resolution: "parent-module@npm:1.0.1" @@ -5581,6 +5651,16 @@ __metadata: languageName: node linkType: hard +"path-scurry@npm:^2.0.0": + version: 2.0.0 + resolution: "path-scurry@npm:2.0.0" + dependencies: + lru-cache: "npm:^11.0.0" + minipass: "npm:^7.1.2" + checksum: 10/285ae0c2d6c34ae91dc1d5378ede21981c9a2f6de1ea9ca5a88b5a270ce9763b83dbadc7a324d512211d8d36b0c540427d3d0817030849d97a60fa840a2c59ec + languageName: node + linkType: hard + "path-type@npm:^4.0.0": version: 4.0.0 resolution: "path-type@npm:4.0.0" @@ -5595,7 +5675,7 @@ __metadata: languageName: node linkType: hard -"picomatch@npm:^2.0.4, picomatch@npm:^2.2.1, picomatch@npm:^2.2.3": +"picomatch@npm:^2.0.4, picomatch@npm:^2.2.1, picomatch@npm:^2.2.3, picomatch@npm:^2.3.1": version: 2.3.1 resolution: "picomatch@npm:2.3.1" checksum: 10/60c2595003b05e4535394d1da94850f5372c9427ca4413b71210f437f7b2ca091dbd611c45e8b37d10036fa8eade25c1b8951654f9d3973bfa66a2ff4d3b08bc @@ -5917,6 +5997,17 @@ __metadata: languageName: node linkType: hard +"rimraf@npm:^6.0.0": + version: 6.0.0 + resolution: "rimraf@npm:6.0.0" + dependencies: + glob: "npm:^11.0.0" + bin: + rimraf: dist/esm/bin.mjs + checksum: 10/8a2e161f89b4fb8d7f3cab9bdea5360e9ab2ddc13d8120508b56eb93ba0c6f4506b799598900db6558628194b09f89705d1b98a591d7f727508e427e247befea + languageName: node + linkType: hard + "run-async@npm:^2.3.0": version: 2.4.1 resolution: "run-async@npm:2.4.1" @@ -6071,14 +6162,15 @@ __metadata: languageName: node linkType: hard -"shiki@npm:^0.11.1": - version: 0.11.1 - resolution: "shiki@npm:0.11.1" +"shiki@npm:^0.14.1": + version: 0.14.7 + resolution: "shiki@npm:0.14.7" dependencies: - jsonc-parser: "npm:^3.0.0" - vscode-oniguruma: "npm:^1.6.1" - vscode-textmate: "npm:^6.0.0" - checksum: 10/44f3b28eb12b2f306304d909958c23b0eea596152d2137de5e65e55477fb9c45a127c0015200e67620a15bc49e22583f0da0da81fb9279a63c15fbf0e1a46b6b + ansi-sequence-parser: "npm:^1.1.0" + jsonc-parser: "npm:^3.2.0" + vscode-oniguruma: "npm:^1.7.0" + vscode-textmate: "npm:^8.0.0" + checksum: 10/be3f2444c65bd0c57802026f171cb42ad571d361ee885be0c292b60785f68c70f19b69310f5ffe7f7a93db4c5ef50211e0a0248794bc6bb48d242bc43fe72a62 languageName: node linkType: hard @@ -6577,44 +6669,6 @@ __metadata: languageName: node linkType: hard -"ts-node@npm:^10.7.0": - version: 10.7.0 - resolution: "ts-node@npm:10.7.0" - dependencies: - "@cspotcode/source-map-support": "npm:0.7.0" - "@tsconfig/node10": "npm:^1.0.7" - "@tsconfig/node12": "npm:^1.0.7" - "@tsconfig/node14": "npm:^1.0.0" - "@tsconfig/node16": "npm:^1.0.2" - acorn: "npm:^8.4.1" - acorn-walk: "npm:^8.1.1" - arg: "npm:^4.1.0" - create-require: "npm:^1.1.0" - diff: "npm:^4.0.1" - make-error: "npm:^1.1.1" - v8-compile-cache-lib: "npm:^3.0.0" - yn: "npm:3.1.1" - peerDependencies: - "@swc/core": ">=1.2.50" - "@swc/wasm": ">=1.2.50" - "@types/node": "*" - typescript: ">=2.7" - peerDependenciesMeta: - "@swc/core": - optional: true - "@swc/wasm": - optional: true - bin: - ts-node: dist/bin.js - ts-node-cwd: dist/bin-cwd.js - ts-node-esm: dist/bin-esm.js - ts-node-script: dist/bin-script.js - ts-node-transpile-only: dist/bin-transpile.js - ts-script: dist/bin-script-deprecated.js - checksum: 10/5c2b3a43ea3c4071a256f255c9b6ec42996108aa7ed7a52be6c25b117907b6035bf0896af63f7866e8ba9fa618937ff61a35d41f4c91fa02b85812705293fdff - languageName: node - linkType: hard - "tsconfig-paths@npm:^3.14.1": version: 3.14.1 resolution: "tsconfig-paths@npm:3.14.1" @@ -6729,19 +6783,28 @@ __metadata: languageName: node linkType: hard -"typedoc@npm:^0.23.15": - version: 0.23.15 - resolution: "typedoc@npm:0.23.15" +"typedoc-plugin-missing-exports@npm:^2.0.0": + version: 2.3.0 + resolution: "typedoc-plugin-missing-exports@npm:2.3.0" + peerDependencies: + typedoc: 0.24.x || 0.25.x + checksum: 10/83ff8affd82fa39a81931e825ef31b51b7470613c71601fde6ff413a5c7571e30734698092a38a437f12c5d3264010696ce9ca806d43485aa11e8208cb4cb323 + languageName: node + linkType: hard + +"typedoc@npm:^0.24.8": + version: 0.24.8 + resolution: "typedoc@npm:0.24.8" dependencies: lunr: "npm:^2.3.9" - marked: "npm:^4.0.19" - minimatch: "npm:^5.1.0" - shiki: "npm:^0.11.1" + marked: "npm:^4.3.0" + minimatch: "npm:^9.0.0" + shiki: "npm:^0.14.1" peerDependencies: - typescript: 4.6.x || 4.7.x || 4.8.x + typescript: 4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x bin: typedoc: bin/typedoc - checksum: 10/f9425e4dc424b4008dab783dcc9ce4b2428efc4b8d504e817b99aa9cb34230bde007fb57b5ae1767fe508a451706d784a216423f06602e1cdaf91db619fcc72e + checksum: 10/4f2f92ddde3f70a1a9666507f6bdf6620023599bd2c2a3ed3f8f909f9c28d92594c30ee6ee68f5a248ff70e09623acf1323bad633cb713b9f2e36bbd4fccf683 languageName: node linkType: hard @@ -6755,13 +6818,13 @@ __metadata: languageName: node linkType: hard -"typescript@npm:~4.8.4": - version: 4.8.4 - resolution: "typescript@npm:4.8.4" +"typescript@npm:~4.9.5": + version: 4.9.5 + resolution: "typescript@npm:4.9.5" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: 10/f985d8dd6ae815753d61cb81e434f3a4a5796ac52e423370fca6ad11bcd188df4013d82e3ba3b88c9746745b9341390ba68f862dc9d30bac6465e0699f2a795b + checksum: 10/458f7220ab11e0fc191514cc41be1707645ec9a8c2d609448a448e18c522cef9646f58728f6811185a4c35613dacdf6c98cf8965c88b3541d0288c47291e4300 languageName: node linkType: hard @@ -6775,13 +6838,13 @@ __metadata: languageName: node linkType: hard -"typescript@patch:typescript@npm%3A~4.8.4#optional!builtin": - version: 4.8.4 - resolution: "typescript@patch:typescript@npm%3A4.8.4#optional!builtin::version=4.8.4&hash=1a91c8" +"typescript@patch:typescript@npm%3A~4.9.5#optional!builtin": + version: 4.9.5 + resolution: "typescript@patch:typescript@npm%3A4.9.5#optional!builtin::version=4.9.5&hash=289587" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: 10/5d81fd8cf5152091a0c0b84ebc868de8433583072a340c4899e0fc7ad6a80314b880a1466868c9a6a1f640c3d1f2fe7f41f8c541b99d78c8b414263dfa27eba3 + checksum: 10/5659316360b5cc2d6f5931b346401fa534107b68b60179cf14970e27978f0936c1d5c46f4b5b8175f8cba0430f522b3ce355b4b724c0ea36ce6c0347fab25afd languageName: node linkType: hard @@ -6877,13 +6940,6 @@ __metadata: languageName: node linkType: hard -"v8-compile-cache-lib@npm:^3.0.0": - version: 3.0.0 - resolution: "v8-compile-cache-lib@npm:3.0.0" - checksum: 10/90cfbe591c47e0b69c3ddf6b224dd3cfd4e00e67aedd71c35896d5edf72312410cf223230048176a93d6621c78c00e38b9f62edbe125b2454484a84f3092f7e7 - languageName: node - linkType: hard - "v8-to-istanbul@npm:^9.0.1": version: 9.0.1 resolution: "v8-to-istanbul@npm:9.0.1" @@ -6914,17 +6970,17 @@ __metadata: languageName: node linkType: hard -"vscode-oniguruma@npm:^1.6.1": - version: 1.6.2 - resolution: "vscode-oniguruma@npm:1.6.2" - checksum: 10/2b9404ffe6e4ff4079844a3dc1cc6be459d74e475007355cfc09af8bdee09a8c8ac26787d372e08b6c2563f68b31f9b4ec1eb9ae0cc6991bdea2bfd3d38ade45 +"vscode-oniguruma@npm:^1.7.0": + version: 1.7.0 + resolution: "vscode-oniguruma@npm:1.7.0" + checksum: 10/7da9d21459f9788544b258a5fd1b9752df6edd8b406a19eea0209c6bf76507d5717277016799301c4da0d536095f9ca8c06afd1ab8f4001189090c804ca4814e languageName: node linkType: hard -"vscode-textmate@npm:^6.0.0": - version: 6.0.0 - resolution: "vscode-textmate@npm:6.0.0" - checksum: 10/5db7e2c9a4e4f5e9c3937f74d86dbaeb6f5a6325dc7d23b9087f9b37acdf640611b5b436c5977cd0d5f830631af42f12c48107b41e0aa80a55284ace0c685a6f +"vscode-textmate@npm:^8.0.0": + version: 8.0.0 + resolution: "vscode-textmate@npm:8.0.0" + checksum: 10/9fa7d66d6042cb090d116c2d8820d34c8870cfcbaed6e404da89f66b899970ed0ac47b59a2e30fc40a25af5414822bb3ea27974f714e9b91910d69c894be95f7 languageName: node linkType: hard @@ -7115,13 +7171,6 @@ __metadata: languageName: node linkType: hard -"yn@npm:3.1.1": - version: 3.1.1 - resolution: "yn@npm:3.1.1" - checksum: 10/2c487b0e149e746ef48cda9f8bad10fc83693cd69d7f9dcd8be4214e985de33a29c9e24f3c0d6bcf2288427040a8947406ab27f7af67ee9456e6b84854f02dd6 - languageName: node - linkType: hard - "yocto-queue@npm:^0.1.0": version: 0.1.0 resolution: "yocto-queue@npm:0.1.0"