diff --git a/.eslintrc.yaml b/.eslintrc.yaml deleted file mode 100644 index bb76a91a0d12..000000000000 --- a/.eslintrc.yaml +++ /dev/null @@ -1,34 +0,0 @@ -parser: "@typescript-eslint/parser" -env: - browser: true - es6: true # Map, etc. - mocha: true - node: true - -parserOptions: - ecmaVersion: 2018 - sourceType: module - -extends: - - eslint:recommended - - plugin:@typescript-eslint/recommended - - plugin:import/recommended - - plugin:import/typescript - - plugin:prettier/recommended - - prettier # Removes eslint rules that conflict with prettier. - - prettier/@typescript-eslint # Remove conflicts again. - -rules: - # For overloads. - no-dupe-class-members: off - "@typescript-eslint/no-use-before-define": off - "@typescript-eslint/no-non-null-assertion": off - eqeqeq: error - import/order: - [error, { alphabetize: { order: "asc" }, groups: [["builtin", "external", "internal"], "parent", "sibling"] }] - -settings: - # Does not work with CommonJS unfortunately. - import/ignore: - - env-paths - - xdg-basedir diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 000000000000..793a923d16eb --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,2 @@ +# Prettier 3.4.2 +9b0340a09276f93c054d705d1b9a5f24cc5dbc97 \ No newline at end of file diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000000..dc5caf936908 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.afdesign filter=lfs diff=lfs merge=lfs -text diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index c68d7da5eac9..04718d97bc09 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1,7 @@ -* @code-asher @nhooyr +* @coder/code-server + +ci/helm-chart/ @Matthew-Beckett @alexgorbatchev + +docs/install.md @GNUxeava + +src/node/i18n/locales/zh-cn.json @zhaozhiming diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md deleted file mode 100644 index a9d70644b214..000000000000 --- a/.github/ISSUE_TEMPLATE/bug-report.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -name: Bug report -about: Report a bug and help us improve -title: "" -labels: "" -assignees: "" ---- - - - -- Web Browser: -- Local OS: -- Remote OS: -- Remote Architecture: -- `code-server --version`: diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml new file mode 100644 index 000000000000..b8f169a4b1fa --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -0,0 +1,114 @@ +name: Bug report +description: File a bug report +labels: ["bug", "triage"] +body: + - type: checkboxes + attributes: + label: Is there an existing issue for this? + description: Please search to see if an issue already exists for the bug you encountered. + options: + - label: I have searched the existing issues + required: true + + - type: textarea + attributes: + label: OS/Web Information + description: | + examples: + - **Web Browser**: Chrome + - **Local OS**: macOS + - **Remote OS**: Ubuntu + - **Remote Architecture**: amd64 + - **`code-server --version`**: 4.0.1 + + Please do not just put "latest" for the version. + value: | + - Web Browser: + - Local OS: + - Remote OS: + - Remote Architecture: + - `code-server --version`: + validations: + required: true + + - type: textarea + attributes: + label: Steps to Reproduce + description: | + Please describe exactly how to reproduce the bug. For example: + 1. Open code-server in Firefox + 2. Install extension `foo.bar` from the extensions sidebar + 3. Run command `foo.bar.baz` + value: | + 1. + 2. + 3. + validations: + required: true + + - type: textarea + attributes: + label: Expected + description: What should happen? + validations: + required: true + + - type: textarea + attributes: + label: Actual + description: What actually happens? + validations: + required: true + + - type: textarea + id: logs + attributes: + label: Logs + description: Run code-server with the --verbose flag and then paste any relevant logs from the server, from the browser console and/or the browser network tab. For issues with installation, include installation logs (i.e. output of `npm install -g code-server`). + render: shell + + - type: textarea + attributes: + label: Screenshot/Video + description: Please include a screenshot, gif or screen recording of your issue. + validations: + required: false + + - type: dropdown + attributes: + label: Does this bug reproduce in native VS Code? + description: If the bug reproduces in native VS Code, submit the issue upstream instead (https://github.com/microsoft/vscode). + options: + - Yes, this is also broken in native VS Code + - No, this works as expected in native VS Code + - This cannot be tested in native VS Code + - I did not test native VS Code + validations: + required: true + + - type: dropdown + attributes: + label: Does this bug reproduce in GitHub Codespaces? + description: If the bug reproduces in GitHub Codespaces, submit the issue upstream instead (https://github.com/microsoft/vscode). + options: + - Yes, this is also broken in GitHub Codespaces + - No, this works as expected in GitHub Codespaces + - This cannot be tested in GitHub Codespaces + - I did not test GitHub Codespaces + validations: + required: true + + - type: checkboxes + attributes: + label: Are you accessing code-server over a secure context? + description: code-server relies on service workers (which only work in secure contexts) for many features. Double-check that you are using a secure context like HTTPS or localhost. + options: + - label: I am using a secure context. + required: false + + - type: textarea + attributes: + label: Notes + description: Please include any addition notes that will help us resolve this issue. + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 9dc409dd7d2d..e24498346339 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,5 +1,8 @@ blank_issues_enabled: false contact_links: - - name: Question - url: https://github.com/cdr/code-server/discussions/new?category_id=22503114 - about: Ask the community for help + - name: Question? + url: https://github.com/coder/code-server/discussions/new?category_id=22503114 + about: Ask the community for help on our GitHub Discussions board + - name: code-server Slack Community + about: Need immediate help or just want to talk? Hop in our Slack. Note - this Slack is not actively monitored by code-server maintainers. + url: https://cdr.co/join-community diff --git a/.github/ISSUE_TEMPLATE/doc.md b/.github/ISSUE_TEMPLATE/doc.md new file mode 100644 index 000000000000..75240e7f7631 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/doc.md @@ -0,0 +1,11 @@ +--- +name: Documentation improvement +about: Suggest a documentation improvement +labels: "docs" +--- + +## What is your suggestion? + +## How will this improve the docs? + +## Are you interested in submitting a PR for this? diff --git a/.github/ISSUE_TEMPLATE/extension-request.md b/.github/ISSUE_TEMPLATE/extension-request.md deleted file mode 100644 index 5ed3e159ce8f..000000000000 --- a/.github/ISSUE_TEMPLATE/extension-request.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: Extension request -about: Request an extension missing from the code-server marketplace -title: "" -labels: extension-request -assignees: cmoog ---- - - - -- [ ] Extension name: -- [ ] Extension GitHub or homepage: diff --git a/.github/ISSUE_TEMPLATE/feature-request.md b/.github/ISSUE_TEMPLATE/feature-request.md index 3f7411eefb6b..89837e3441e6 100644 --- a/.github/ISSUE_TEMPLATE/feature-request.md +++ b/.github/ISSUE_TEMPLATE/feature-request.md @@ -1,13 +1,13 @@ --- name: Feature request -about: Suggest an idea -title: "" -labels: feature -assignees: "" +about: Suggest an idea to improve code-server +labels: enhancement --- - +## Why do you want this feature? + +## Are there any workarounds to get this functionality today? + +## Are you interested in submitting a PR for this? diff --git a/.github/pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE.md similarity index 65% rename from .github/pull_request_template.md rename to .github/PULL_REQUEST_TEMPLATE.md index 6e29ad1b541c..e240a5f49c8d 100644 --- a/.github/pull_request_template.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,4 +1,8 @@ + +Fixes # diff --git a/.github/codecov.yml b/.github/codecov.yml new file mode 100644 index 000000000000..c2e23821411d --- /dev/null +++ b/.github/codecov.yml @@ -0,0 +1,31 @@ +codecov: + require_ci_to_pass: yes + allow_coverage_offsets: True + +coverage: + precision: 2 + round: down + range: "40...70" + status: + patch: off + notify: + slack: + default: + url: secret:v1::tXC7VwEIKYjNU8HRgRv2GdKOSCt5UzpykKZb+o1eCDqBgb2PEqwE3A26QUPYMLo4BO2qtrJhFIvwhUvlPwyzDCNGoNiuZfXr0UeZZ0y1TcZu672R/NBNMwEPO/e1Ye0pHxjzKHnuH7HqbjFucox/RBQLtiL3J56SWGE3JtbkC6o= + threshold: 1% + only_pulls: false + branches: + - "main" + +parsers: + gcov: + branch_detection: + conditional: yes + loop: yes + method: no + macro: no + +comment: + layout: "reach,diff,flags,files,footer" + behavior: default + require_changes: no diff --git a/.github/codeql-config.yml b/.github/codeql-config.yml new file mode 100644 index 000000000000..9f98cc2a62b1 --- /dev/null +++ b/.github/codeql-config.yml @@ -0,0 +1 @@ +name: "code-server CodeQL config" diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml new file mode 100644 index 000000000000..87513b7cee1d --- /dev/null +++ b/.github/dependabot.yaml @@ -0,0 +1,31 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" + time: "06:00" + timezone: "America/Chicago" + labels: [] + commit-message: + prefix: "chore" + + - package-ecosystem: "npm" + directory: "/" + schedule: + interval: "monthly" + time: "06:00" + timezone: "America/Chicago" + commit-message: + prefix: "chore" + labels: [] + ignore: + # Ignore patch updates for all dependencies + - dependency-name: "*" + update-types: + - version-update:semver-patch + # Ignore major updates to Node.js types, because they need to + # correspond to the Node.js engine version + - dependency-name: "@types/node" + update-types: + - version-update:semver-major diff --git a/.github/lock.yml b/.github/lock.yml deleted file mode 100644 index 2dfb6cf38862..000000000000 --- a/.github/lock.yml +++ /dev/null @@ -1,37 +0,0 @@ -# Configuration for Lock Threads - https://github.com/dessant/lock-threads-app - -# Number of days of inactivity before a closed issue or pull request is locked -daysUntilLock: 90 - -# Skip issues and pull requests created before a given timestamp. Timestamp must -# follow ISO 8601 (`YYYY-MM-DD`). Set to `false` to disable -skipCreatedBefore: false - -# Issues and pull requests with these labels will be ignored. Set to `[]` to disable -exemptLabels: [] - -# Label to add before locking, such as `outdated`. Set to `false` to disable -lockLabel: false - -# Comment to post before locking. Set to `false` to disable -lockComment: > - This thread has been automatically locked since there has not been - any recent activity after it was closed. Please open a new issue for - related bugs. - -# Assign `resolved` as the reason for locking. Set to `false` to disable -setLockReason: true -# Limit to only `issues` or `pulls` -# only: issues - -# Optionally, specify configuration settings just for `issues` or `pulls` -# issues: -# exemptLabels: -# - help-wanted -# lockLabel: outdated - -# pulls: -# daysUntilLock: 30 - -# Repository to extend settings from -# _extends: repo diff --git a/.github/semantic.yaml b/.github/semantic.yaml new file mode 100644 index 000000000000..55d345cc2ac9 --- /dev/null +++ b/.github/semantic.yaml @@ -0,0 +1,66 @@ +############################################################################### +# This file configures "Semantic Pull Requests", which is documented here: +# https://github.com/zeke/semantic-pull-requests +############################################################################### + +# Scopes are optionally supplied after a 'type'. For example, in +# +# feat(docs): autostart ui +# +# '(docs)' is the scope. Scopes are used to signify where the change occurred. +scopes: + # docs: changes to the code-server documentation. + - docs + + # vendor: changes to vendored dependencies. + - vendor + + # deps: changes to code-server's dependencies. + - deps + + # cs: changes to code specific to code-server. + - cs + + # cli: changes to the command-line interface. + - cli + +# We only check that the PR title is semantic. The PR title is automatically +# applied to the "Squash & Merge" flow as the suggested commit message, so this +# should suffice unless someone drastically alters the message in that flow. +titleOnly: true + +# Types are the 'tag' types in a commit or PR title. For example, in +# +# chore: fix thing +# +# 'chore' is the type. +types: + # A build of any kind. + - build + + # A user-facing change that corrects a defect in code-server. + - fix + + # Any code task that is ignored for changelog purposes. Examples include + # devbin scripts and internal-only configurations. + - chore + + # Any work performed on CI. + - ci + + # Work that directly implements or supports the implementation of a feature. + - feat + + # A refactor changes code structure without any behavioral change. + - refactor + + # A git revert for any style of commit. + - revert + + # Adding tests of any kind. Should be separate from feature or fix + # implementations. For example, if a commit adds a fix + test, it's a fix + # commit. If a commit is simply bumping coverage, it's a test commit. + - test + + # A new release. + - release diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 000000000000..945de5a3e12a --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,12 @@ +# Number of days of inactivity before an issue becomes stale +daysUntilStale: 180 +# Number of days of inactivity before a stale issue is closed +daysUntilClose: 5 +# Label to apply when stale. +staleLabel: stale +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed if no activity occurs in the next 5 days. +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: false diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 000000000000..beb2a43a31c0 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,311 @@ +name: Build + +on: + push: + branches: + - main + pull_request: + branches: + - main + +# Cancel in-progress runs for pull requests when developers push +# additional changes, and serialize builds in branches. +# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-concurrency-to-cancel-any-in-progress-job-or-run +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +# Note: if: success() is used in several jobs - +# this ensures that it only executes if all previous jobs succeeded. + +# if: steps.cache-node-modules.outputs.cache-hit != 'true' +# will skip running `npm install` if it successfully fetched from cache + +jobs: + changes: + runs-on: ubuntu-latest + outputs: + ci: ${{ steps.filter.outputs.ci }} + code: ${{ steps.filter.outputs.code }} + deps: ${{ steps.filter.outputs.deps }} + docs: ${{ steps.filter.outputs.docs }} + helm: ${{ steps.filter.outputs.helm }} + steps: + - name: Checkout repo + uses: actions/checkout@v5 + - name: Check changed files + uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + ci: + - ".github/**" + - "ci/**" + docs: + - "docs/**" + - "README.md" + - "CHANGELOG.md" + helm: + - "ci/helm-chart/**" + code: + - "src/**" + - "test/**" + deps: + - "lib/**" + - "patches/**" + - "package-lock.json" + - "test/package-lock.json" + - id: debug + run: | + echo "${{ toJSON(steps.filter )}}" + + prettier: + name: Run prettier check + runs-on: ubuntu-22.04 + timeout-minutes: 5 + steps: + - uses: actions/checkout@v5 + - uses: actions/setup-node@v4 + with: + node-version-file: .node-version + cache: npm + cache-dependency-path: | + package-lock.json + test/package-lock.json + - run: SKIP_SUBMODULE_DEPS=1 npm ci + - run: npx prettier --check . + + doctoc: + name: Doctoc markdown files + runs-on: ubuntu-22.04 + timeout-minutes: 5 + needs: changes + if: needs.changes.outputs.docs == 'true' + steps: + - uses: actions/checkout@v5 + - uses: actions/setup-node@v4 + with: + node-version-file: .node-version + cache: npm + cache-dependency-path: | + package-lock.json + test/package-lock.json + - run: SKIP_SUBMODULE_DEPS=1 npm ci + - run: npm run doctoc + + lint-helm: + name: Lint Helm chart + runs-on: ubuntu-22.04 + timeout-minutes: 5 + needs: changes + if: needs.changes.outputs.helm == 'true' + steps: + - uses: actions/checkout@v5 + - uses: azure/setup-helm@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + - run: helm plugin install https://github.com/instrumenta/helm-kubeval + - run: helm kubeval ci/helm-chart + + lint-ts: + name: Lint TypeScript files + runs-on: ubuntu-22.04 + timeout-minutes: 5 + needs: changes + if: needs.changes.outputs.code == 'true' + steps: + - uses: actions/checkout@v5 + - uses: actions/setup-node@v4 + with: + node-version-file: .node-version + cache: npm + cache-dependency-path: | + package-lock.json + test/package-lock.json + - run: SKIP_SUBMODULE_DEPS=1 npm ci + - run: npm run lint:ts + + lint-actions: + name: Lint GitHub Actions + runs-on: ubuntu-latest + needs: changes + if: needs.changes.outputs.ci == 'true' + steps: + - name: Checkout repo + uses: actions/checkout@v5 + - name: Check workflow files + run: | + bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) 1.7.1 + ./actionlint -color -shellcheck= -ignore "set-output" + shell: bash + + test-unit: + name: Run unit tests + runs-on: ubuntu-22.04 + timeout-minutes: 5 + needs: changes + if: needs.changes.outputs.code == 'true' + steps: + - uses: actions/checkout@v5 + - uses: actions/setup-node@v4 + with: + node-version-file: .node-version + cache: npm + cache-dependency-path: | + package-lock.json + test/package-lock.json + - run: SKIP_SUBMODULE_DEPS=1 npm ci + - run: npm run test:unit + - uses: codecov/codecov-action@v5 + if: success() + with: + token: ${{ secrets.CODECOV_TOKEN }} + + build: + name: Build code-server + runs-on: ubuntu-22.04 + timeout-minutes: 60 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + DISABLE_V8_COMPILE_CACHE: 1 + steps: + - uses: actions/checkout@v5 + with: + submodules: true + - run: sudo apt update && sudo apt install -y libkrb5-dev + - uses: awalsh128/cache-apt-pkgs-action@latest + with: + packages: quilt + version: 1.0 + - run: quilt push -a + - uses: actions/setup-node@v4 + with: + node-version-file: .node-version + cache: npm + cache-dependency-path: | + package-lock.json + test/package-lock.json + - run: SKIP_SUBMODULE_DEPS=1 npm ci + - run: npm run build + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Get Code's git hash. When this changes it means the content is + # different and we need to rebuild. + - name: Get latest lib/vscode rev + id: vscode-rev + run: echo "rev=$(git rev-parse HEAD:./lib/vscode)" >> $GITHUB_OUTPUT + # We need to rebuild when we have a new version of Code, when any of + # the patches changed, or when the code-server version changes (since + # it gets embedded into the code). Use VSCODE_CACHE_VERSION to + # force a rebuild. + - name: Fetch prebuilt Code package from cache + id: cache-vscode + uses: actions/cache@v4 + with: + path: lib/vscode-reh-web-* + key: vscode-reh-package-${{ secrets.VSCODE_CACHE_VERSION }}-${{ steps.vscode-rev.outputs.rev }}-${{ hashFiles('patches/*.diff', 'ci/build/build-vscode.sh') }} + - name: Build vscode + env: + VERSION: "0.0.0" + if: steps.cache-vscode.outputs.cache-hit != 'true' + run: | + pushd lib/vscode + npm ci + popd + npm run build:vscode + # The release package does not contain any native modules + # and is neutral to architecture/os/libc version. + - run: npm run release + if: success() + # https://github.com/actions/upload-artifact/issues/38 + - run: tar -czf package.tar.gz release + - uses: actions/upload-artifact@v4 + with: + name: npm-package + path: ./package.tar.gz + + test-e2e: + name: Run e2e tests + runs-on: ubuntu-22.04 + timeout-minutes: 25 + needs: [changes, build] + if: needs.changes.outputs.code == 'true' || needs.changes.outputs.deps == 'true' + steps: + - uses: actions/checkout@v5 + - run: sudo apt update && sudo apt install -y libkrb5-dev + - uses: actions/setup-node@v4 + with: + node-version-file: .node-version + cache: npm + cache-dependency-path: | + package-lock.json + test/package-lock.json + - run: SKIP_SUBMODULE_DEPS=1 npm ci + - uses: actions/download-artifact@v5 + with: + name: npm-package + - run: tar -xzf package.tar.gz + - run: cd release && npm install --unsafe-perm --omit=dev + - name: Install Playwright OS dependencies + run: | + ./test/node_modules/.bin/playwright install-deps + ./test/node_modules/.bin/playwright install + - run: CODE_SERVER_TEST_ENTRY=./release npm run test:e2e + - uses: actions/upload-artifact@v4 + if: always() + with: + name: failed-test-videos + path: ./test/test-results + - run: rm -rf ./release ./test/test-results + + test-e2e-proxy: + name: Run e2e tests behind proxy + runs-on: ubuntu-22.04 + timeout-minutes: 25 + needs: [changes, build] + if: needs.changes.outputs.code == 'true' || needs.changes.outputs.deps == 'true' + steps: + - uses: actions/checkout@v5 + - run: sudo apt update && sudo apt install -y libkrb5-dev + - uses: actions/setup-node@v4 + with: + node-version-file: .node-version + cache: npm + cache-dependency-path: | + package-lock.json + test/package-lock.json + - run: SKIP_SUBMODULE_DEPS=1 npm ci + - uses: actions/download-artifact@v5 + with: + name: npm-package + - run: tar -xzf package.tar.gz + - run: cd release && npm install --unsafe-perm --omit=dev + - name: Install Playwright OS dependencies + run: | + ./test/node_modules/.bin/playwright install-deps + ./test/node_modules/.bin/playwright install + - name: Cache Caddy + uses: actions/cache@v4 + id: caddy-cache + with: + path: | + ~/.cache/caddy + key: cache-caddy-2.5.2 + - name: Install Caddy + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + if: steps.caddy-cache.outputs.cache-hit != 'true' + run: | + gh release download v2.5.2 --repo caddyserver/caddy --pattern "caddy_2.5.2_linux_amd64.tar.gz" + mkdir -p ~/.cache/caddy + tar -xzf caddy_2.5.2_linux_amd64.tar.gz --directory ~/.cache/caddy + - run: ~/.cache/caddy/caddy start --config ./ci/Caddyfile + - run: CODE_SERVER_TEST_ENTRY=./release npm run test:e2e:proxy + - run: ~/.cache/caddy/caddy stop --config ./ci/Caddyfile + if: always() + + - uses: actions/upload-artifact@v4 + if: always() + with: + name: failed-test-videos-proxy + path: ./test/test-results diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml deleted file mode 100644 index dcf917841420..000000000000 --- a/.github/workflows/ci.yaml +++ /dev/null @@ -1,146 +0,0 @@ -name: ci - -on: [push] - -jobs: - fmt: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: Run ./ci/steps/fmt.sh - uses: ./ci/images/debian8 - with: - args: ./ci/steps/fmt.sh - - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: Run ./ci/steps/lint.sh - uses: ./ci/images/debian8 - with: - args: ./ci/steps/lint.sh - - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: Run ./ci/steps/test.sh - uses: ./ci/images/debian8 - with: - args: ./ci/steps/test.sh - - release: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: Run ./ci/steps/release.sh - uses: ./ci/images/debian8 - with: - args: ./ci/steps/release.sh - - name: Upload npm package artifact - uses: actions/upload-artifact@v2 - with: - name: npm-package - path: ./release-npm-package - - linux-amd64: - needs: release - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: Download npm package - uses: actions/download-artifact@v2 - with: - name: npm-package - path: ./release-npm-package - - name: Run ./ci/steps/release-packages.sh - uses: ./ci/images/centos7 - with: - args: ./ci/steps/release-packages.sh - - name: Upload release artifacts - uses: actions/upload-artifact@v2 - with: - name: release-packages - path: ./release-packages - - linux-arm64: - needs: release - runs-on: ubuntu-arm64-latest - steps: - - uses: actions/checkout@v1 - - name: Download npm package - uses: actions/download-artifact@v2 - with: - name: npm-package - path: ./release-npm-package - - name: Run ./ci/steps/release-packages.sh - uses: ./ci/images/centos7 - with: - args: ./ci/steps/release-packages.sh - - name: Upload release artifacts - uses: actions/upload-artifact@v2 - with: - name: release-packages - path: ./release-packages - - macos-amd64: - needs: release - runs-on: macos-latest - steps: - - uses: actions/checkout@v1 - - name: Download npm package - uses: actions/download-artifact@v2 - with: - name: npm-package - path: ./release-npm-package - - run: ./ci/steps/release-packages.sh - env: - # Otherwise we get rate limited when fetching the ripgrep binary. - # For whatever reason only MacOS needs it. - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Upload release artifacts - uses: actions/upload-artifact@v2 - with: - name: release-packages - path: ./release-packages - - docker-amd64: - runs-on: ubuntu-latest - needs: linux-amd64 - steps: - - uses: actions/checkout@v1 - - name: Download release package - uses: actions/download-artifact@v2 - with: - name: release-packages - path: ./release-packages - - name: Run ./ci/steps/build-docker-image.sh - uses: ./ci/images/debian8 - with: - args: ./ci/steps/build-docker-image.sh - - name: Upload release image - uses: actions/upload-artifact@v2 - with: - name: release-images - path: ./release-images - - docker-arm64: - runs-on: ubuntu-arm64-latest - needs: linux-arm64 - steps: - - uses: actions/checkout@v1 - - name: Download release package - uses: actions/download-artifact@v2 - with: - name: release-packages - path: ./release-packages - - name: Run ./ci/steps/build-docker-image.sh - uses: ./ci/images/centos7 - with: - args: ./ci/steps/build-docker-image.sh - - name: Upload release image - uses: actions/upload-artifact@v2 - with: - name: release-images - path: ./release-images diff --git a/.github/workflows/installer.yaml b/.github/workflows/installer.yaml new file mode 100644 index 000000000000..c33ee0070763 --- /dev/null +++ b/.github/workflows/installer.yaml @@ -0,0 +1,76 @@ +name: Installer integration + +on: + push: + branches: + - main + paths: + - "install.sh" + - ".github/workflows/installer.yaml" + pull_request: + branches: + - main + paths: + - "install.sh" + - ".github/workflows/installer.yaml" + +# Cancel in-progress runs for pull requests when developers push +# additional changes, and serialize builds in branches. +# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-concurrency-to-cancel-any-in-progress-job-or-run +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +permissions: + contents: read + +jobs: + ubuntu: + name: Test installer on Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v5 + + - name: Install code-server + run: ./install.sh + + - name: Test code-server was installed globally + run: code-server --help + + alpine: + name: Test installer on Alpine + runs-on: ubuntu-latest + container: "alpine:3.17" + steps: + - name: Checkout repo + uses: actions/checkout@v5 + + - name: Install curl + run: apk add curl + + - name: Add user + run: adduser coder --disabled-password + + # Standalone should work without root. + - name: Test standalone to a non-existent prefix + run: su coder -c "./install.sh --method standalone --prefix /tmp/does/not/yet/exist" + + # We do not actually have Alpine standalone builds so running code-server + # will not work. + - name: Test code-server was installed to prefix + run: test -f /tmp/does/not/yet/exist/bin/code-server + + macos: + name: Test installer on macOS + runs-on: macos-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v5 + + - name: Install code-server + run: ./install.sh + + - name: Test code-server was installed globally + run: code-server --help diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index c2fe429b9a7b..374c35876d41 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -1,31 +1,198 @@ -name: publish +name: Publish code-server on: + # Shows the manual trigger in GitHub UI + # helpful as a back-up in case the GitHub Actions Workflow fails + workflow_dispatch: + inputs: + version: + description: The version to publish (include "v", i.e. "v4.9.1"). + type: string + required: true + release: - types: [published] + types: [released] + +# Cancel in-progress runs for pull requests when developers push +# additional changes, and serialize builds in branches. +# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-concurrency-to-cancel-any-in-progress-job-or-run +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: npm: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - name: Run ./ci/steps/publish-npm.sh - uses: ./ci/images/debian8 + - name: Checkout code-server + uses: actions/checkout@v5 + + - name: Install Node.js + uses: actions/setup-node@v4 with: - args: ./ci/steps/publish-npm.sh + node-version-file: .node-version + + - name: Download npm package from release artifacts + uses: robinraju/release-downloader@v1.12 + with: + repository: "coder/code-server" + tag: ${{ github.event.inputs.version || github.ref_name }} + fileName: "package.tar.gz" + out-file-path: "release-npm-package" + + # Strip out the v (v4.9.1 -> 4.9.1). + - name: Get and set VERSION + run: | + TAG="${{ github.event.inputs.version || github.ref_name }}" + echo "VERSION=${TAG#v}" >> $GITHUB_ENV + + - run: npm run publish:npm env: + VERSION: ${{ env.VERSION }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + NPM_ENVIRONMENT: "production" + + homebrew: + needs: npm + runs-on: ubuntu-latest + steps: + # Ensure things are up to date + # Suggested by homebrew maintainers + # https://github.com/Homebrew/discussions/discussions/1532#discussioncomment-782633 + - name: Set up Homebrew + id: set-up-homebrew + uses: Homebrew/actions/setup-homebrew@master + + - name: Checkout code-server + uses: actions/checkout@v5 + + - name: Configure git + run: | + git config --global user.name cdrci + git config --global user.email opensource@coder.com + + # Strip out the v (v4.9.1 -> 4.9.1). + - name: Get and set VERSION + run: | + TAG="${{ github.event.inputs.version || github.ref_name }}" + echo "VERSION=${TAG#v}" >> $GITHUB_ENV + + - name: Bump code-server homebrew version + env: + VERSION: ${{ env.VERSION }} + HOMEBREW_GITHUB_API_TOKEN: ${{secrets.HOMEBREW_GITHUB_API_TOKEN}} + + run: ./ci/steps/brew-bump.sh + + aur: + runs-on: ubuntu-latest + timeout-minutes: 10 + env: + GH_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }} + + steps: + # We need to checkout code-server so we can get the version + - name: Checkout code-server + uses: actions/checkout@v5 + with: + fetch-depth: 0 + path: "./code-server" + + - name: Checkout code-server-aur repo + uses: actions/checkout@v5 + with: + repository: "cdrci/code-server-aur" + token: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }} + ref: "master" + + - name: Merge in master + run: | + git remote add upstream https://github.com/coder/code-server-aur.git + git fetch upstream + git merge upstream/master + + - name: Configure git + run: | + git config --global user.name cdrci + git config --global user.email opensource@coder.com + + # Strip out the v (v4.9.1 -> 4.9.1). + - name: Get and set VERSION + run: | + TAG="${{ github.event.inputs.version || github.ref_name }}" + echo "VERSION=${TAG#v}" >> $GITHUB_ENV + + - name: Validate package + uses: heyhusen/archlinux-package-action@v2.4.0 + env: + VERSION: ${{ env.VERSION }} + with: + pkgver: ${{ env.VERSION }} + updpkgsums: true + srcinfo: true + + - name: Open PR + # We need to git push -u otherwise gh will prompt + # asking where to push the branch. + env: + VERSION: ${{ env.VERSION }} + run: | + git checkout -b update-version-${{ env.VERSION }} + git add . + git commit -m "chore: updating version to ${{ env.VERSION }}" + git push -u origin $(git branch --show) + gh pr create --repo coder/code-server-aur --title "chore: bump version to ${{ env.VERSION }}" --body "PR opened by @$GITHUB_ACTOR" --assignee $GITHUB_ACTOR docker: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - name: Run ./ci/steps/push-docker-manifest.sh - uses: ./ci/images/debian8 + - name: Checkout code-server + uses: actions/checkout@v5 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Login to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Strip out the v (v4.9.1 -> 4.9.1). + - name: Get and set VERSION + run: | + TAG="${{ github.event.inputs.version || github.ref_name }}" + echo "VERSION=${TAG#v}" >> $GITHUB_ENV + + - name: Download deb artifacts + uses: robinraju/release-downloader@v1.12 + with: + repository: "coder/code-server" + tag: v${{ env.VERSION }} + fileName: "*.deb" + out-file-path: "release-packages" + + - name: Download rpm artifacts + uses: robinraju/release-downloader@v1.12 with: - args: ./ci/steps/push-docker-manifest.sh + repository: "coder/code-server" + tag: v${{ env.VERSION }} + fileName: "*.rpm" + out-file-path: "release-packages" + + - name: Publish to Docker + run: ./ci/steps/docker-buildx-push.sh env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} - DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} + VERSION: ${{ env.VERSION }} + GITHUB_TOKEN: ${{ github.token }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 000000000000..2536983d2b45 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,309 @@ +name: Draft release + +on: + workflow_dispatch: + inputs: + version: + description: The version to publish (include "v", i.e. "v4.9.1"). + type: string + required: true + +permissions: + contents: write # For creating releases. + discussions: write # For creating a discussion. + +# Cancel in-progress runs for pull requests when developers push +# additional changes +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +jobs: + package-linux-cross: + name: ${{ matrix.prefix }} + runs-on: ubuntu-latest + timeout-minutes: 15 + needs: npm-version + container: "python:3.8-slim-buster" + strategy: + matrix: + include: + - prefix: x86_64-linux-gnu + npm_arch: x64 + apt_arch: amd64 + package_arch: amd64 + - prefix: aarch64-linux-gnu + npm_arch: arm64 + apt_arch: arm64 + package_arch: arm64 + - prefix: arm-linux-gnueabihf + npm_arch: armv7l + apt_arch: armhf + package_arch: armv7l + + env: + AR: ${{ format('{0}-ar', matrix.prefix) }} + AS: ${{ format('{0}-as', matrix.prefix) }} + CC: ${{ format('{0}-gcc', matrix.prefix) }} + CPP: ${{ format('{0}-cpp', matrix.prefix) }} + CXX: ${{ format('{0}-g++', matrix.prefix) }} + FC: ${{ format('{0}-gfortran', matrix.prefix) }} + LD: ${{ format('{0}-ld', matrix.prefix) }} + STRIP: ${{ format('{0}-strip', matrix.prefix) }} + PKG_CONFIG_PATH: ${{ format('/usr/lib/{0}/pkgconfig', matrix.prefix) }} + TARGET_ARCH: ${{ matrix.apt_arch }} + npm_config_arch: ${{ matrix.npm_arch }} + PKG_ARCH: ${{ matrix.package_arch }} + # Not building from source results in an x86_64 argon2, as if + # npm_config_arch is being ignored. + npm_config_build_from_source: true + + steps: + - name: Checkout repo + uses: actions/checkout@v5 + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version-file: .node-version + cache: npm + cache-dependency-path: | + package-lock.json + test/package-lock.json + + - name: Install cross-compiler and system dependencies + run: | + sed -i 's/deb\.debian\.org/archive.debian.org/g' /etc/apt/sources.list + dpkg --add-architecture $TARGET_ARCH + apt update && apt install -y --no-install-recommends \ + crossbuild-essential-$TARGET_ARCH \ + libx11-dev:$TARGET_ARCH \ + libx11-xcb-dev:$TARGET_ARCH \ + libxkbfile-dev:$TARGET_ARCH \ + libsecret-1-dev:$TARGET_ARCH \ + libkrb5-dev:$TARGET_ARCH \ + ca-certificates \ + curl wget rsync gettext-base + + - run: SKIP_SUBMODULE_DEPS=1 npm ci + + - name: Install nfpm + run: | + mkdir -p ~/.local/bin + curl -sSfL https://github.com/goreleaser/nfpm/releases/download/v2.3.1/nfpm_2.3.1_`uname -s`_`uname -m`.tar.gz | tar -C ~/.local/bin -zxv nfpm + echo "$HOME/.local/bin" >> $GITHUB_PATH + + - name: Download npm package + uses: actions/download-artifact@v5 + with: + name: npm-release-package + + - run: tar -xzf package.tar.gz + - run: npm run release:standalone + + - name: Replace node with cross-compile equivalent + run: | + node_version=$(node --version) + wget https://nodejs.org/dist/${node_version}/node-${node_version}-linux-${npm_config_arch}.tar.xz + tar -xf node-${node_version}-linux-${npm_config_arch}.tar.xz node-${node_version}-linux-${npm_config_arch}/bin/node --strip-components=2 + mv ./node ./release-standalone/lib/node + + # Strip out the v (v4.9.1 -> 4.9.1). + - name: Get and set VERSION + run: | + TAG="${{ inputs.version || github.ref_name }}" + echo "VERSION=${TAG#v}" >> $GITHUB_ENV + + - env: + VERSION: ${{ env.VERSION }} + run: npm run package $PKG_ARCH + + - uses: softprops/action-gh-release@v1 + with: + draft: true + discussion_category_name: "📣 Announcements" + files: ./release-packages/* + + package-macos-amd64: + name: x86-64 macOS build + runs-on: macos-13 + timeout-minutes: 15 + needs: npm-version + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + steps: + - name: Checkout repo + uses: actions/checkout@v5 + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version-file: .node-version + cache: npm + cache-dependency-path: | + package-lock.json + test/package-lock.json + + - run: SKIP_SUBMODULE_DEPS=1 npm ci + + - name: Install nfpm + run: | + mkdir -p ~/.local/bin + curl -sSfL https://github.com/goreleaser/nfpm/releases/download/v2.3.1/nfpm_2.3.1_`uname -s`_`uname -m`.tar.gz | tar -C ~/.local/bin -zxv nfpm + echo "$HOME/.local/bin" >> $GITHUB_PATH + + # The version of node-gyp we use depends on distutils but it was removed + # in Python 3.12. It seems to be fixed in the latest node-gyp so when we + # next update Node we can probably remove this. For now, install + # setuptools since it contains distutils. + - run: brew install python-setuptools + + - name: Download npm package + uses: actions/download-artifact@v5 + with: + name: npm-release-package + + - run: tar -xzf package.tar.gz + - run: npm run release:standalone + - run: npm run test:native + + # Strip out the v (v4.9.1 -> 4.9.1). + - name: Get and set VERSION + run: | + TAG="${{ inputs.version || github.ref_name }}" + echo "VERSION=${TAG#v}" >> $GITHUB_ENV + + - name: Build packages with nfpm + env: + VERSION: ${{ env.VERSION }} + run: npm run package + + - uses: softprops/action-gh-release@v1 + with: + draft: true + discussion_category_name: "📣 Announcements" + files: ./release-packages/* + + package-macos-arm64: + name: arm64 macOS build + runs-on: macos-latest + timeout-minutes: 15 + needs: npm-version + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + steps: + - name: Checkout repo + uses: actions/checkout@v5 + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version-file: .node-version + cache: npm + cache-dependency-path: | + package-lock.json + test/package-lock.json + + - run: SKIP_SUBMODULE_DEPS=1 npm ci + + - name: Install nfpm + run: | + mkdir -p ~/.local/bin + curl -sSfL https://github.com/goreleaser/nfpm/releases/download/v2.3.1/nfpm_2.3.1_`uname -s`_`uname -m`.tar.gz | tar -C ~/.local/bin -zxv nfpm + echo "$HOME/.local/bin" >> $GITHUB_PATH + + # The version of node-gyp we use depends on distutils but it was removed + # in Python 3.12. It seems to be fixed in the latest node-gyp so when we + # next update Node we can probably remove this. For now, install + # setuptools since it contains distutils. + - run: brew install python-setuptools + + - name: Download npm package + uses: actions/download-artifact@v5 + with: + name: npm-release-package + + - run: tar -xzf package.tar.gz + - run: npm run release:standalone + - run: npm run test:native + + # Strip out the v (v4.9.1 -> 4.9.1). + - name: Get and set VERSION + run: | + TAG="${{ inputs.version || github.ref_name }}" + echo "VERSION=${TAG#v}" >> $GITHUB_ENV + + - name: Build packages with nfpm + env: + VERSION: ${{ env.VERSION }} + run: npm run package + + - uses: softprops/action-gh-release@v1 + with: + draft: true + discussion_category_name: "📣 Announcements" + files: ./release-packages/* + + npm-package: + name: Upload npm package + runs-on: ubuntu-latest + timeout-minutes: 15 + needs: npm-version + steps: + - name: Download npm package + uses: actions/download-artifact@v5 + with: + name: npm-release-package + + - uses: softprops/action-gh-release@v1 + with: + draft: true + discussion_category_name: "📣 Announcements" + files: ./package.tar.gz + + npm-version: + name: Modify package.json version + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - name: Download artifacts + uses: dawidd6/action-download-artifact@v11 + id: download + with: + branch: ${{ github.ref }} + workflow: build.yaml + workflow_conclusion: completed + name: npm-package + check_artifacts: false + if_no_artifact_found: fail + + - run: tar -xzf package.tar.gz + + # Strip out the v (v4.9.1 -> 4.9.1). + - name: Get and set VERSION + run: | + TAG="${{ inputs.version || github.ref_name }}" + echo "VERSION=${TAG#v}" >> $GITHUB_ENV + + - name: Modify version + env: + VERSION: ${{ env.VERSION }} + run: | + echo "Updating version in root package.json" + npm version --prefix release "$VERSION" + + echo "Updating version in lib/vscode/product.json" + tmp=$(mktemp) + jq ".codeServerVersion = \"$VERSION\"" release/lib/vscode/product.json > "$tmp" && mv "$tmp" release/lib/vscode/product.json + # Ensure it has the same permissions as before + chmod 644 release/lib/vscode/product.json + + - run: tar -czf package.tar.gz release + + - name: Upload npm package artifact + uses: actions/upload-artifact@v4 + with: + name: npm-release-package + path: ./package.tar.gz diff --git a/.github/workflows/scripts.yaml b/.github/workflows/scripts.yaml new file mode 100644 index 000000000000..a39d90ad4c96 --- /dev/null +++ b/.github/workflows/scripts.yaml @@ -0,0 +1,67 @@ +name: Script unit tests + +on: + push: + branches: + - main + paths: + - "**.sh" + - "**.bats" + pull_request: + branches: + - main + paths: + - "**.sh" + - "**.bats" + +permissions: + actions: none + checks: none + contents: read + deployments: none + issues: none + packages: none + pull-requests: none + repository-projects: none + security-events: none + statuses: none + +# Cancel in-progress runs for pull requests when developers push +# additional changes, and serialize builds in branches. +# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-concurrency-to-cancel-any-in-progress-job-or-run +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +jobs: + test: + name: Run script unit tests + runs-on: ubuntu-latest + # This runs on Alpine to make sure we're testing with actual sh. + container: "alpine:3.17" + steps: + - name: Checkout repo + uses: actions/checkout@v5 + + - name: Install test utilities + run: apk add bats checkbashisms + + - name: Check Bashisms + run: checkbashisms ./install.sh + + - name: Run script unit tests + run: ./ci/dev/test-scripts.sh + + lint: + name: Lint shell files + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - name: Checkout repo + uses: actions/checkout@v5 + + - name: Install lint utilities + run: sudo apt install shellcheck + + - name: Lint shell files + run: ./ci/dev/lint-scripts.sh diff --git a/.github/workflows/security.yaml b/.github/workflows/security.yaml new file mode 100644 index 000000000000..d8afcfce34d7 --- /dev/null +++ b/.github/workflows/security.yaml @@ -0,0 +1,92 @@ +name: Security + +on: + push: + branches: [main] + paths: + - "package.json" + pull_request: + paths: + - "package.json" + schedule: + # Runs every Monday morning PST + - cron: "17 15 * * 1" + +# Cancel in-progress runs for pull requests when developers push additional +# changes, and serialize builds in branches. +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +jobs: + audit: + name: Audit node modules + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - name: Checkout repo + uses: actions/checkout@v5 + with: + fetch-depth: 0 + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version-file: .node-version + + - name: Audit npm for vulnerabilities + run: npm audit + if: success() + + trivy-scan-repo: + name: Scan repo with Trivy + permissions: + contents: read # for actions/checkout to fetch code + security-events: write # for github/codeql-action/upload-sarif to upload SARIF results + runs-on: ubuntu-22.04 + steps: + - name: Checkout repo + uses: actions/checkout@v5 + with: + fetch-depth: 0 + + - name: Run Trivy vulnerability scanner in repo mode + uses: aquasecurity/trivy-action@b6643a29fecd7f34b3597bc6acb0a98b03d33ff8 + with: + scan-type: "fs" + scan-ref: "." + ignore-unfixed: true + format: "template" + template: "@/contrib/sarif.tpl" + output: "trivy-repo-results.sarif" + severity: "HIGH,CRITICAL" + + - name: Upload Trivy scan results to GitHub Security tab + uses: github/codeql-action/upload-sarif@v3 + with: + sarif_file: "trivy-repo-results.sarif" + + codeql-analyze: + permissions: + actions: read # for github/codeql-action/init to get workflow details + contents: read # for actions/checkout to fetch code + security-events: write # for github/codeql-action/autobuild to send a status report + name: Analyze with CodeQL + runs-on: ubuntu-22.04 + + steps: + - name: Checkout repository + uses: actions/checkout@v5 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + config-file: ./.github/codeql-config.yml + languages: javascript + + - name: Autobuild + uses: github/codeql-action/autobuild@v3 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/trivy-docker.yaml b/.github/workflows/trivy-docker.yaml new file mode 100644 index 000000000000..97769603da9e --- /dev/null +++ b/.github/workflows/trivy-docker.yaml @@ -0,0 +1,65 @@ +name: Trivy Nightly Docker Scan + +on: + # Run scans if the workflow is modified, in order to test the + # workflow itself. This results in some spurious notifications, + # but seems okay for testing. + pull_request: + branches: + - main + paths: + - .github/workflows/trivy-docker.yaml + + # Run scans against master whenever changes are merged. + push: + branches: + - main + paths: + - .github/workflows/trivy-docker.yaml + + schedule: + # Run at 10:15 am UTC (3:15am PT/5:15am CT) + # Run at 0 minutes 0 hours of every day. + - cron: "15 10 * * *" + + workflow_dispatch: + +permissions: + actions: none + checks: none + contents: read + deployments: none + issues: none + packages: none + pull-requests: none + repository-projects: none + security-events: write + statuses: none + +# Cancel in-progress runs for pull requests when developers push +# additional changes, and serialize builds in branches. +# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-concurrency-to-cancel-any-in-progress-job-or-run +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + +jobs: + trivy-scan-image: + runs-on: ubuntu-22.04 + + steps: + - name: Checkout code + uses: actions/checkout@v5 + + - name: Run Trivy vulnerability scanner in image mode + uses: aquasecurity/trivy-action@b6643a29fecd7f34b3597bc6acb0a98b03d33ff8 + with: + image-ref: "docker.io/codercom/code-server:latest" + ignore-unfixed: true + format: "sarif" + output: "trivy-image-results.sarif" + severity: "HIGH,CRITICAL" + + - name: Upload Trivy scan results to GitHub Security tab + uses: github/codeql-action/upload-sarif@v3 + with: + sarif_file: "trivy-image-results.sarif" diff --git a/.gitignore b/.gitignore index 616f9b01b1ea..d453ee2e969f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ .tsbuildinfo .cache -dist* -out* +/out*/ release/ release-npm-package/ release-standalone/ @@ -9,5 +8,18 @@ release-packages/ release-gcp/ release-images/ node_modules -node-* /plugins +/lib/coder-cloud-agent +.home +coverage +**/.DS_Store + +# Code packages itself here. +/lib/vscode-reh-web-* + +# Failed e2e test videos are saved here +test/test-results + +# Quilt's internal data. +/.pc +/patches/*.diff~ diff --git a/.ignore b/.ignore deleted file mode 100644 index a65b41774ad5..000000000000 --- a/.ignore +++ /dev/null @@ -1 +0,0 @@ -lib diff --git a/.node-version b/.node-version new file mode 100644 index 000000000000..e2228113dd09 --- /dev/null +++ b/.node-version @@ -0,0 +1 @@ +22.19.0 diff --git a/.nvmrc b/.nvmrc new file mode 120000 index 000000000000..070266a2687d --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +.node-version \ No newline at end of file diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000000..cd007ef32514 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,10 @@ +lib/vscode +lib/vscode-reh-web-linux-x64 +release-standalone +release-packages +release +helm-chart +test/scripts +test/e2e/extensions/test-extension +.pc +package-lock.json diff --git a/.prettierrc.yaml b/.prettierrc.yaml index a0634116d20d..b6114bf4613b 100644 --- a/.prettierrc.yaml +++ b/.prettierrc.yaml @@ -2,3 +2,5 @@ printWidth: 120 semi: false trailingComma: all arrowParens: always +singleQuote: false +useTabs: false diff --git a/.stylelintrc.yaml b/.stylelintrc.yaml deleted file mode 100644 index af5c94bc4f3e..000000000000 --- a/.stylelintrc.yaml +++ /dev/null @@ -1,2 +0,0 @@ -extends: - - stylelint-config-recommended diff --git a/.tours/contributing.tour b/.tours/contributing.tour new file mode 100644 index 000000000000..aaff2b500c99 --- /dev/null +++ b/.tours/contributing.tour @@ -0,0 +1,151 @@ +{ + "$schema": "https://aka.ms/codetour-schema", + "title": "Contributing", + "steps": [ + { + "directory": "src", + "line": 1, + "description": "Hello world! code-server's source code lives here in `src` (see the explorer). It's broadly arranged into browser code, Node code, and code shared between both." + }, + { + "file": "src/node/entry.ts", + "line": 157, + "description": "code-server begins execution here. CLI arguments are parsed, special flags like --help are handled, then the HTTP server is started." + }, + { + "file": "src/node/cli.ts", + "line": 28, + "description": "This describes all of the code-server CLI options and how they will be parsed." + }, + { + "file": "src/node/cli.ts", + "line": 233, + "description": "Here's the actual CLI parser." + }, + { + "file": "src/node/settings.ts", + "line": 1, + "description": "code-server maintains a settings file that is read and written here." + }, + { + "file": "src/node/app.ts", + "line": 11, + "description": "The core of code-server are HTTP and web socket servers which are created here. They provide authentication, file access, an API, and serve web-based applications like VS Code." + }, + { + "file": "src/node/wsRouter.ts", + "line": 38, + "description": "This is an analog to Express's Router that handles web socket routes." + }, + { + "file": "src/node/http.ts", + "line": 1, + "description": "This file provides various HTTP utility functions." + }, + { + "file": "src/node/coder_cloud.ts", + "line": 9, + "description": "The cloud agent spawned here provides the --link functionality." + }, + { + "file": "src/node/heart.ts", + "line": 7, + "description": "code-server's heart beats to indicate recent activity.\n\nAlso documented here: [https://github.com/coder/code-server/blob/main/docs/FAQ.md#heartbeat-file](https://github.com/coder/code-server/blob/main/docs/FAQ.md#heartbeat-file)" + }, + { + "file": "src/node/socket.ts", + "line": 13, + "description": "We pass sockets to child processes, however we can't pass TLS sockets so when code-server is handling TLS (via --cert) we use this to create a proxy that can be passed to the child." + }, + { + "directory": "src/node/routes", + "line": 1, + "description": "code-server's routes live here in `src/node/routes` (see the explorer)." + }, + { + "file": "src/node/routes/index.ts", + "line": 123, + "description": "The architecture of code-server allows it to be extended with applications via plugins. Each application is registered at its own route and handles requests at and below that route. Currently we have only VS Code (although it is not yet actually split out into a plugin)." + }, + { + "file": "src/node/plugin.ts", + "line": 103, + "description": "The previously mentioned plugins are loaded here." + }, + { + "file": "src/node/routes/apps.ts", + "line": 12, + "description": "This provides a list of the applications registered with code-server." + }, + { + "file": "src/node/routes/domainProxy.ts", + "line": 18, + "description": "code-server provides a built-in proxy to help in developing web-based applications. This is the code for the domain-based proxy.\n\nAlso documented here: [https://github.com/coder/code-server/blob/main/docs/FAQ.md#how-do-i-securely-access-web-services](https://github.com/coder/code-server/blob/main/docs/FAQ.md#how-do-i-securely-access-web-services)" + }, + { + "file": "src/node/routes/pathProxy.ts", + "line": 19, + "description": "Here is the path-based version of the proxy.\n\nAlso documented here: [https://github.com/coder/code-server/blob/main/docs/FAQ.md#how-do-i-securely-access-web-services](https://github.com/coder/code-server/blob/main/docs/FAQ.md#how-do-i-securely-access-web-services)" + }, + { + "file": "src/node/proxy.ts", + "line": 4, + "description": "Both the domain and path proxy use the single proxy instance created here." + }, + { + "file": "src/node/routes/health.ts", + "line": 5, + "description": "A simple endpoint that lets you see if code-server is up.\n\nAlso documented here: [https://github.com/coder/code-server/blob/main/docs/FAQ.md#healthz-endpoint](https://github.com/coder/code-server/blob/main/docs/FAQ.md#healthz-endpoint)" + }, + { + "file": "src/node/routes/login.ts", + "line": 46, + "description": "code-server supports a password-based login here." + }, + { + "file": "src/node/routes/static.ts", + "line": 16, + "description": "This serves static assets. Anything under the code-server directory can be fetched. Anything outside requires authentication." + }, + { + "file": "src/node/routes/update.ts", + "line": 10, + "description": "This endpoint lets you query for the latest code-server version. It's used to power the update popup you see in VS Code." + }, + { + "file": "src/node/routes/vscode.ts", + "line": 15, + "description": "This is the endpoint that serves VS Code's HTML, handles VS Code's websockets, and handles a few VS Code-specific endpoints for fetching static files." + }, + { + "file": "src/node/vscode.ts", + "line": 13, + "description": "The actual VS Code spawn and initialization is handled here. VS Code runs in a separate child process. We communicate via IPC and by passing it web sockets." + }, + { + "file": "src/browser/serviceWorker.ts", + "line": 1, + "description": "The service worker only exists to provide PWA functionality." + }, + { + "directory": "src/browser/pages", + "line": 1, + "description": "HTML, CSS, and JavaScript for each page lives in here `src/browser/pages` (see the explorer). Currently our HTML uses a simple search and replace template system with variables that {{LOOK_LIKE_THIS}}." + }, + { + "file": "src/browser/pages/vscode.html", + "line": 1, + "description": "The VS Code HTML is based off VS Code's own `workbench.html`." + }, + { + "directory": "src/browser/media", + "line": 1, + "description": "Static images and the manifest live here in `src/browser/media` (see the explorer)." + }, + { + "directory": "lib/vscode", + "line": 1, + "description": "code-server makes use of VS Code's frontend web/remote support. Most of the modifications implement the remote server since that portion of the code is closed source and not released with VS Code.\n\nWe also have a few bug fixes and have added some features (like client-side extensions). See [https://github.com/coder/code-server/blob/main/docs/CONTRIBUTING.md#modifications-to-vs-code](https://github.com/coder/code-server/blob/main/docs/CONTRIBUTING.md#modifications-to-vs-code) for a list.\n\nWe make an effort to keep the modifications as few as possible." + } + ] +} diff --git a/.tours/start-development.tour b/.tours/start-development.tour new file mode 100644 index 000000000000..999adba06125 --- /dev/null +++ b/.tours/start-development.tour @@ -0,0 +1,26 @@ +{ + "$schema": "https://aka.ms/codetour-schema", + "title": "Start Development", + "steps": [ + { + "file": "package.json", + "line": 31, + "description": "## Commands\n\nTo start developing, make sure you have Node 16+ and the [required dependencies](https://github.com/Microsoft/vscode/wiki/How-to-Contribute#prerequisites) installed. Then, run the following commands:\n\n1. Install dependencies:\n>> npm\n\n3. Start development mode (and watch for changes):\n>> npm run watch" + }, + { + "file": "src/node/app.ts", + "line": 68, + "description": "## Visit the web server\n\nIf all goes well, you should see something like this in your terminal. code-server should be live in development mode.\n\n---\n```bash\n[2020-12-09T21:03:37.156Z] info code-server 3.7.4 development\n[2020-12-09T21:03:37.157Z] info Using user-data-dir ~/.local/share/code-server\n[2020-12-09T21:03:37.165Z] info Using config file ~/.config/code-server/config.yaml\n[2020-12-09T21:03:37.165Z] info HTTP server listening on http://127.0.0.1:8080 \n[2020-12-09T21:03:37.165Z] info - Authentication is enabled\n[2020-12-09T21:03:37.165Z] info - Using password from ~/.config/code-server/config.yaml\n[2020-12-09T21:03:37.165Z] info - Not serving HTTPS\n```\n\n---\n\nIf you have the default configuration, you can access it at [http://localhost:8080](http://localhost:8080)." + }, + { + "file": "src/browser/pages/login.html", + "line": 26, + "description": "## Make a change\n\nThis is the login page, let's make a change and see it update on our web server! Perhaps change the text :)\n\n```html\n
Modifying the login page 👨🏼‍💻
\n```\n\nReminder, you can likely preview at [http://localhost:8080](http://localhost:8080)" + }, + { + "file": "src/node/app.ts", + "line": 62, + "description": "## That's it!\n\n\nThat's all there is to it! When this tour ends, your terminal session may stop, but just use `npm run watch` to start developing from here on out!\n\n\nIf you haven't already, be sure to check out these resources:\n- [Tour: Contributing](command:codetour.startTourByTitle?[\"Contributing\"])\n- [Docs: FAQ.md](https://github.com/coder/code-server/blob/main/docs/FAQ.md)\n- [Docs: CONTRIBUTING.md](https://github.com/coder/code-server/blob/main/docs/CONTRIBUTING.md)\n- [Community: GitHub Discussions](https://github.com/coder/code-server/discussions)\n- [Community: Slack](https://community.coder.com)" + } + ] +} diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000000..3ba0b42cb005 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,1189 @@ +# 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 + +## [4.104.2](https://github.com/coder/code-server/releases/tag/v4.104.2) - 2025-09-26 + +Code v1.104.2 + +### Changed + +- Update to Code 1.104.2. + +## [4.104.1](https://github.com/coder/code-server/releases/tag/v4.104.1) - 2025-09-19 + +Code v1.104.1 + +### Changed + +- Update to Code 1.104.1. + +## [4.104.0](https://github.com/coder/code-server/releases/tag/v4.104.0) - 2025-09-15 + +Code v1.104.0 + +### Fixed + +- Fix "extension not found" errors from Open VSX when trying to install the + latest version of an extension. + +### Changed + +- Update to Code 1.104.0. + +## [4.103.2](https://github.com/coder/code-server/releases/tag/v4.103.2) - 2025-08-25 + +Code v1.103.2 + +### Changed + +- Update to Code 1.103.2. + +## [4.103.1](https://github.com/coder/code-server/releases/tag/v4.103.1) - 2025-08-15 + +Code v1.103.1 + +### Changed + +- Update to Code 1.103.1. + +## [4.103.0](https://github.com/coder/code-server/releases/tag/v4.103.0) - 2025-08-12 + +Code v1.103.0 + +### Changed + +- Update to Code 1.103.0. + +## [4.102.2](https://github.com/coder/code-server/releases/tag/v4.102.2) - 2025-07-24 + +Code v1.102.2 + +### Changed + +- Update to Code 1.102.2. + +## [4.102.1](https://github.com/coder/code-server/releases/tag/v4.102.1) - 2025-07-17 + +Code v1.102.1 + +### Changed + +- Update to Code 1.102.1. + +## [4.102.0](https://github.com/coder/code-server/releases/tag/v4.102.0) - 2025-07-16 + +Code v1.102.0 + +### Changed + +- Update to Code 1.102.0. + +### Added + +- Custom strings can be configured using the `--i18n` flag set to a JSON + file. This can be used for either translation (and can be used alongside + `--locale`) or for customizing the strings. See + [./src/node/i18n/locales/en.json](./src/node/i18n/locales/en.json) for the + available keys. + +## [4.101.2](https://github.com/coder/code-server/releases/tag/v4.101.2) - 2025-06-25 + +Code v1.101.2 + +### Changed + +- Update to Code 1.101.2. + +### Fixed + +- Fix web views not loading due to 401 when requesting the service worker. + +## [4.101.1](https://github.com/coder/code-server/releases/tag/v4.101.1) - 2025-06-20 + +Code v1.101.1 + +### Changed + +- Update to Code 1.101.1. + +## [4.101.0](https://github.com/coder/code-server/releases/tag/v4.101.0) - 2025-06-20 + +Code v1.101.0 + +### Changed + +- Update to Code 1.101.0. + +## [4.100.3](https://github.com/coder/code-server/releases/tag/v4.100.3) - 2025-06-03 + +Code v1.100.3 + +### Changed + +- Update to Code 1.100.3. + +## [4.100.2](https://github.com/coder/code-server/releases/tag/v4.100.2) - 2025-05-15 + +Code v1.100.2 + +### Changed + +- Update to Code 1.100.2. + +## [4.100.1](https://github.com/coder/code-server/releases/tag/v4.100.1) - 2025-05-13 + +Code v1.100.1 + +### Changed + +- Update to Code 1.100.1. + +## [4.100.0](https://github.com/coder/code-server/releases/tag/v4.100.0) - 2025-05-12 + +Code v1.100.0 + +### Added + +- Trusted domains for links can now be set at run-time by configuring + `linkProtectionTrustedDomains` in the `lib/vscode/product.json` file or via + the `--link-protection-trusted-domains` flag. + +### Changed + +- Update to Code 1.100.0. +- Disable extension signature verification, which previously was skipped by + default (the package used for verification is not available to OSS builds of + VS Code) but now reportedly throws hard errors making it impossible to install + extensions. + +### Fixed + +- Flags with repeatable options now work via the config file. + +## [4.99.4](https://github.com/coder/code-server/releases/tag/v4.99.4) - 2025-05-02 + +Code v1.99.3 + +### Security + +- Validate that ports in the path proxy are numbers, to prevent proxying to + arbitrary domains. + +## [4.99.3](https://github.com/coder/code-server/releases/tag/v4.99.3) - 2025-04-17 + +Code v1.99.3 + +### Added + +- Added `--skip-auth-preflight` flag to let preflight requests through the + proxy. + +### Changed + +- Update to Code 1.99.3. + +## [4.99.2](https://github.com/coder/code-server/releases/tag/v4.99.2) - 2025-04-10 + +Code v1.99.2 + +### Changed + +- Update to Code 1.99.2. + +## [4.99.1](https://github.com/coder/code-server/releases/tag/v4.99.1) - 2025-04-08 + +Code v1.99.1 + +### Changed + +- Update to Code 1.99.1. + +## [4.99.0](https://github.com/coder/code-server/releases/tag/v4.99.0) - 2025-04-07 + +Code v1.99.0 + +### Changed + +- Update to Code 1.99.0. + +## [4.98.0](https://github.com/coder/code-server/releases/tag/v4.98.0) - 2025-03-07 + +Code v1.98.0 + +### Changed + +- Update to Code 1.98.0. + +## [4.97.2](https://github.com/coder/code-server/releases/tag/v4.96.4) - 2025-02-18 + +Code v1.97.2 + +### Added + +- Added back macOS amd64 builds. + +### Changed + +- Update to Code 1.97.2. +- Softened dark mode login page colors. + +## [4.96.4](https://github.com/coder/code-server/releases/tag/v4.96.4) - 2025-01-20 + +Code v1.96.4 + +### Changed + +- Update to Code 1.96.4. + +## [4.96.2](https://github.com/coder/code-server/releases/tag/v4.96.2) - 2024-12-20 + +Code v1.96.2 + +### Changed + +- Update to Code 1.96.2. + +## [4.96.1](https://github.com/coder/code-server/releases/tag/v4.96.1) - 2024-12-18 + +Code v1.96.1 + +### Added + +- Dark color scheme for login and error pages. + +### Changed + +- Update to Code 1.96.1. + +## [4.95.3](https://github.com/coder/code-server/releases/tag/v4.95.3) - 2024-11-18 + +Code v1.95.3 + +### Changed + +- Update to Code 1.95.3. + +## [4.95.2](https://github.com/coder/code-server/releases/tag/v4.95.2) - 2024-11-12 + +Code v1.95.2 + +### Changed + +- Update to Code 1.95.2. + +## [4.95.1](https://github.com/coder/code-server/releases/tag/v4.95.1) - 2024-11-06 + +Code v1.95.1 + +### Changed + +- Update to Code 1.95.1. + +## [4.93.1](https://github.com/coder/code-server/releases/tag/v4.93.1) - 2024-09-23 + +Code v1.93.1 + +### Changed + +- Updated to Code 1.93.1. + +### Added + +- Added `--abs-proxy-base-path` flag for when code-server is not at the root. + +## [4.92.2](https://github.com/coder/code-server/releases/tag/v4.92.2) - 2024-08-19 + +Code v1.92.2 + +### Breaking changes + +- Dropped a patch that changed the compile target from es2022 to es2020 because + it no longer works with the way VS Code uses static properties. This may break + older browsers, so those browsers will either have to be updated or use an + older version of code-server. + +### Changed + +- Updated to Code 1.92.2. + +## [4.91.0](https://github.com/coder/code-server/releases/tag/v4.91.0) - 2024-07-10 + +Code v1.91.0 + +### Changed + +- Updated to Code 1.91.0. + +## [4.90.3](https://github.com/coder/code-server/releases/tag/v4.90.3) - 2024-06-21 + +Code v1.90.2 + +### Changed + +- Updated to Code 1.90.2. + +### Fixed + +- When the log gets rotated it will no longer incorrectly be moved to a new + directory created in the current working directory named with a date. + Instead, the file itself is prepended with the date and kept in the same + directory, as originally intended. + +## [4.90.2](https://github.com/coder/code-server/releases/tag/v4.90.2) - 2024-06-14 + +Code v1.90.1 + +### Changed + +- Updated to Code 1.90.1. + +## [4.90.1](https://github.com/coder/code-server/releases/tag/v4.90.1) - 2024-06-12 + +Code v1.90.0 + +### Fixed + +- Cache a call to get CPU information used in telemetry that could result in a + lack responsiveness if it was particularly slow. + +## [4.90.0](https://github.com/coder/code-server/releases/tag/v4.90.0) - 2024-06-11 + +Code v1.90.0 + +### Changed + +- Updated to Code 1.90.0. +- Updated Node to 20.11.1. + +### Added + +- Send contents to the clipboard in the integrated terminal by piping to + `code-server --stdin-to-clipboard` or `code-server -c`. + + You may want to make this an alias: + + ``` + alias xclip="code-server --stdin-to-clipboard" + echo -n "hello world" | xclip + ``` + +## [4.89.1](https://github.com/coder/code-server/releases/tag/v4.89.1) - 2024-04-14 + +Code v1.89.1 + +### Changed + +- Updated to Code 1.89.1. + +## [4.89.0](https://github.com/coder/code-server/releases/tag/v4.89.0) - 2024-04-08 + +Code v1.89.0 + +### Changed + +- Updated to Code 1.89.0. + +## [4.23.1](https://github.com/coder/code-server/releases/tag/v4.23.1) - 2024-04-15 + +Code v1.88.1 + +### Changed + +- Updated to Code 1.88.1. + +## [4.23.0](https://github.com/coder/code-server/releases/tag/v4.23.0) - 2024-04-08 + +Code v1.88.0 + +### Changed + +- Updated to Code 1.88.0. +- Updated Node to 18.18.2. + +### Fixed + +- Fix masking the exit code when failing to install extensions on the command + line outside the integrated terminal. Installing extensions inside the + integrated terminal still masks the exit code and is an upstream bug. + +## [4.22.1](https://github.com/coder/code-server/releases/tag/v4.22.1) - 2024-03-14 + +Code v1.87.2 + +### Changed + +- Updated to Code 1.87.2. +- Enable keep-alive for proxy agent. + +## [4.22.0](https://github.com/coder/code-server/releases/tag/v4.22.0) - 2024-03-03 + +Code v1.87.0 + +### Changed + +- Updated to Code 1.87.0. + +## [4.21.2](https://github.com/coder/code-server/releases/tag/v4.21.2) - 2024-02-28 + +Code v1.86.2 + +### Changed + +- Updated to Code 1.86.2. + +## [4.21.1](https://github.com/coder/code-server/releases/tag/v4.21.1) - 2024-02-09 + +Code v1.86.1 + +### Changed + +- Updated to Code 1.86.1. +- Updated to Node 18.17.1. + +### Added + +- Docker images for Fedora and openSUSE. + +## [4.21.0](https://github.com/coder/code-server/releases/tag/v4.21.0) - 2024-02-05 + +Code v1.86.0 + +### Changed + +- Updated to Code 1.86.0. + +## [4.20.1](https://github.com/coder/code-server/releases/tag/v4.20.1) - 2024-01-22 + +Code v1.85.2 + +### Changed + +- Updated to Code 1.85.2. + +### Fixed + +- Query variables are no longer double-encoded when going over the path proxy. + +## [4.20.0](https://github.com/coder/code-server/releases/tag/v4.20.0) - 2023-12-21 + +Code v1.85.1 + +### Added + +- New flag `--disable-file-uploads` to disable uploading files to the remote by + drag and drop and to disable opening local files via the "show local" button + in the file open prompt. Note that you can still open local files by drag and + dropping the file onto the editor pane. +- Added `wget` to the release image. + +### Changed + +- Updated to Code 1.85.1. +- The `--disable-file-downloads` flag will now disable the "show local" button + in the file save prompt as well. +- Debian release image updated to use Bookworm. + +## [4.19.1](https://github.com/coder/code-server/releases/tag/v4.19.1) - 2023-11-29 + +Code v1.84.2 + +### Fixed + +- Fixed an issue where parts of the editor would not load (like the file + explorer, source control, etc) when using a workspace file. + +## [4.19.0](https://github.com/coder/code-server/releases/tag/v4.19.0) - 2023-11-18 + +Code v1.84.2 + +### Changed + +- Updated to Code 1.84.2. + +## [4.18.0](https://github.com/coder/code-server/releases/tag/v4.18.0) - 2023-10-20 + +Code v1.83.1 + +### Changed + +- Updated to Code 1.83.1. + +## [4.17.1](https://github.com/coder/code-server/releases/tag/v4.17.1) - 2023-09-29 + +Code v1.82.2 + +### Fixed + +- Make secret storage persistent. For example, logging in with GitHub should + persist between browser refreshes and code-server restarts. +- Issues with argon2 on arm builds should be fixed now. + +## [4.17.0](https://github.com/coder/code-server/releases/tag/v4.17.0) - 2023-09-22 + +Code v1.82.2 + +### Added + +- Japanese locale. +- `CODE_SERVER_HOST` environment variable. + +### Changed + +- Update to Code 1.82.2. This includes an update to Node 18, which also means + that the minimum glibc is now 2.28. If you need to maintain a lower glibc then + you can take a version of Node 18 that is compiled with a lower glibc and use + that to build code-server (or at a minimum rebuild the native modules). +- Display paths to config files in full rather than abbreviated. If you have + trouble with the password not working please update and make sure the + displayed config paths are what you expect. + +### Fixed + +- Fix some dependency issues for the standalone arm64 and armv7l releases. If + you had issues with missing or failing modules please try these new builds. + +## [4.16.1](https://github.com/coder/code-server/releases/tag/v4.16.1) - 2023-07-31 + +Code v1.80.2 + +### Changed + +- Updated to Code 1.80.2. + +## [4.16.0](https://github.com/coder/code-server/releases/tag/v4.16.0) - 2023-07-28 + +Code v1.80.1 + +### Added + +- `--disable-proxy` flag. This disables the domain and path proxies but it does + not disable the ports panel in Code. That can be disabled by using + `remote.autoForwardPorts=false` in your settings. + +## [4.15.0](https://github.com/coder/code-server/releases/tag/v4.15.0) - 2023-07-21 + +Code v1.80.1 + +### Changed + +- Updated to Code 1.80.1. + +### Added + +- `--trusted-origin` flag for specifying origins that you trust but do not + control (for example a reverse proxy). + +Code v1.79.2 + +## [4.14.1](https://github.com/coder/code-server/releases/tag/v4.14.1) - 2023-06-26 + +Code v1.79.2 + +### Security + +- Remove extra write permissions on the Node binary bundled with the linux-amd64 + tarball. If you extract the tar without a umask this could mean the Node + binary would be unexpectedly writable. + +### Fixed + +- Inability to launch multiple instances of code-server for different users. + +### Added + +- `--session-socket` CLI flag to configure the location of the session socket. + By default it will be placed in `/code-server-ipc.sock`. + +## [4.14.0](https://github.com/coder/code-server/releases/tag/v4.14.0) - 2023-06-16 + +Code v1.79.2 + +### Added + +- `--domain-proxy` now supports `{{port}}` and `{{host}}` template variables. + +### Changed + +- Updated to Code 1.79.2 +- Files opened from an external terminal will now open in the most closely + related window rather than in the last opened window. + +## [4.13.0](https://github.com/coder/code-server/releases/tag/v4.13.0) - 2023-05-19 + +Code v1.78.2 + +### Changed + +- Updated to Code 1.78.2. + +### Fixed + +- Proxying files that contain non-ASCII characters. +- Origin check when X-Forwarded-Host contains comma-separated hosts. + +## [4.12.0](https://github.com/coder/code-server/releases/tag/v4.12.0) - 2023-04-21 + +Code v1.77.3 + +### Changed + +- Updated to Code 1.77.3 +- Ports panel will use domain-based proxy (instead of the default path-based + proxy) when set via --proxy-domain. +- Apply --app-name to the PWA title. + +### Added + +- Thai translation for login page. +- Debug logs around the origin security check. If you are getting forbidden + errors on web sockets please run code-server with `--log debug` to see why the + requests are being blocked. + +## [4.11.0](https://github.com/coder/code-server/releases/tag/v4.11.0) - 2023-03-16 + +Code v1.76.1 + +### Changed + +- Updated to Code 1.76.1 + +## [4.10.1](https://github.com/coder/code-server/releases/tag/v4.10.1) - 2023-03-04 + +Code v1.75.1 + +### Security + +Added an origin check to web sockets to prevent cross-site hijacking attacks on +users using older or niche browser that do not support SameSite cookies and +attacks across sub-domains that share the same root domain. + +The check requires the host header to be set so if you use a reverse proxy +ensure it forwards that information otherwise web sockets will be blocked. + +## [4.10.0](https://github.com/coder/code-server/releases/tag/v4.10.0) - 2023-02-15 + +Code v1.75.1 + +### Changed + +- Updated to Code 1.75.1 + +### Removed + +- Removed `--link` (was deprecated over thirteen months ago in 4.0.1). + +## [4.9.1](https://github.com/coder/code-server/releases/tag/v4.9.1) - 2022-12-15 + +Code v1.73.1 + +### Changed + +- Updated a couple steps in the build and release process to ensure we're using + `npm` and `yarn` consistently depending on the step. + +### Fixed + +- Fixed an issue with code-server version not displaying in the Help > About window. +- Fixed terminal not loading on macOS clients. + +## [4.9.0](https://github.com/coder/code-server/releases/tag/v4.9.0) - 2022-12-06 + +Code v1.73.1 + +### Changed + +- Upgraded to Code 1.73.1 + +### Added + +- `/security.txt` added as a route with info on our security policy information thanks to @ghuntley + +### Fixed + +- Installing on majaro images should now work thanks to @MrPeacockNLB for + adding the `--noconfirm` flag in `install.sh` + +### Known Issues + +- `--cert` on Ubuntu 22.04: OpenSSL v3 is used which breaks `pem` meaning the + `--cert` feature will not work. [Reference](https://github.com/adobe/fetch/pull/318#issuecomment-1306070259) + +## [4.8.3](https://github.com/coder/code-server/releases/tag/v4.8.3) - 2022-11-07 + +Code v1.72.1 + +### Added + +- install script now supports arch-like (i.e. manjaro, endeavourous, etc.) + architectures + +### Changed + +- Updated text in the Getting Started page. + +## [4.8.2](https://github.com/coder/code-server/releases/tag/v4.8.2) - 2022-11-02 + +Code v1.72.1 + +### Added + +- New text in the Getting Started page with info about + `coder/coder`. This is enabled by default but can be disabled by passing the CLI + flag `--disable-getting-started-override` or setting + `CS_DISABLE_GETTING_STARTED_OVERRIDE=1` or + `CS_DISABLE_GETTING_STARTED_OVERRIDE=true`. + +## [4.8.1](https://github.com/coder/code-server/releases/tag/v4.8.1) - 2022-10-28 + +Code v1.72.1 + +### Fixed + +- Fixed CSP error introduced in 4.8.0 that caused issues with webviews and most + extensions. + +## [4.8.0](https://github.com/coder/code-server/releases/tag/v4.8.0) - 2022-10-24 + +Code v1.72.1 + +### Added + +- Support for the Ports panel which leverages code-server's built-in proxy. It + also uses `VSCODE_PROXY_URI` where `{{port}}` is replace when forwarding a port. + Example: `VSCODE_PROXY_URI=https://{{port}}.kyle.dev` would forward an + application running on localhost:3000 to https://3000.kyle.dev +- Support for `--disable-workspace-trust` CLI flag +- Support for `--goto` flag to open file @ line:column +- Added Ubuntu-based images for Docker releases. If you run into issues with + `PATH` being overwritten in Docker please try the Ubuntu image as this is a + problem in the Debian base image. + +### Changed + +- Updated Code to 1.72.1 + +### Fixed + +- Enabled `BROWSER` environment variable +- Patched `asExternalUri` to work so now extensions run inside code-server can use it + +## [4.7.1](https://github.com/coder/code-server/releases/tag/v4.7.1) - 2022-09-30 + +Code v1.71.2 + +### Changed + +- Updated Code to 1.71.2 + +### Fixed + +- Fixed install script not upgrading code-server when already installed on RPM-based machines +- Fixed install script failing to gain root permissions on FreeBSD + +## [4.7.0](https://github.com/coder/code-server/releases/tag/v4.7.0) - 2022-09-09 + +Code v1.71.0 + +### Changed + +- Updated Code to 1.71.0 + +### Removed + +- Dropped heartbeat patch because it was implemented upstream + +### Fixed + +- Add flags --unsafe-perm --legacy-peer-deps in `npm-postinstall.sh` which ensures installing with npm works correctly + +## [4.6.1](https://github.com/coder/code-server/releases/tag/v4.6.1) - 2022-09-31 + +Code v1.70.2 + +### Changed + +- Updated Code to 1.70.2 +- Updated `argon2` to 0.29.0 which should fix issues on FreeBSD +- Updated docs to suggest using `npm` instead of `yarn` + +### Removed + +- Dropped database migration patch affected to 4.0.2 versions and earlier. + +### Fixed + +- Fixed preservation of `process.execArgv` which means you can pass `--prof` to profile code-server + +## [4.6.0](https://github.com/coder/code-server/releases/tag/v4.6.0) - 2022-08-17 + +Code v1.70.1 + +### Changed + +- Updated Code to 1.70.1. + +### Added + +- Added a heartbeat to sockets. This should prevent them from getting closed by + reverse proxy timeouts when idle like NGINX's default 60-second timeout. + +### Fixed + +- Fixed logout option appearing even when authentication is disabled. + +## [4.5.2](https://github.com/coder/code-server/releases/tag/v4.5.2) - 2022-08-15 + +Code v1.68.1 + +### Security + +- Fixed the proxy route not performing authentication. For example if you were + to run a development HTTP server using `python -m http.server 8000` then it + would be accessible at `my.domain/proxy/8000/` without any authentication. + + If all of the following apply to you please update as soon as possible: + - You run code-server with the built-in password authentication. + - You run unprotected HTTP services on ports accessible by code-server. + +### Changed + +- Invoking `code-server` in the integrated terminal will now use the script that + comes with upstream Code. This means flags like `--wait` will be + automatically supported now. However the upstream script only has the ability + to interact with the running code-server and cannot spawn new instances. If + you need to spawn a new code-server from the integrated terminal please + specify the full path to code-server's usual script (for example + `/usr/bin/code-server`). + +### Fixed + +- Invoking `code-server` in the integrated terminal will now work instead of + erroring about not finding Node. + +## [4.5.1](https://github.com/coder/code-server/releases/tag/v4.5.1) - 2022-07-18 + +Code v1.68.1 + +### Changed + +- We now use `release/v<0.0.0>` for the release branch name so it doesn't + conflict with the tag name +- Added `.prettierignore` to ignore formatting files in `lib/vscode` + +### Added + +- Allow more comprehensive affinity config in Helm chart +- Added custom message in Homebrew PR to make sure code-server maintainers are + tagged +- Allow setting `priorityClassName` via Helm chart +- Added troubleshooting docs to `CONTRIBUTING.md` + +### Fixed + +- Removed default memory limit which was set via `NODE_OPTIONS` +- Changed output in pipe to make it easier to debug code-server when doing live + edits +- Fixed display-language patch to use correct path which broke in 4.5.0 +- Fixed multiple code-server windows opening when using the code-server CLI in + the Integrated Terminal +- Fixed Integrated Terminal not working when web base was not the root path + +### Security + +- Updated `glob-parent` version in dependencies + +## [4.5.0](https://github.com/coder/code-server/releases/tag/v4.5.0) - 2022-06-29 + +Code v1.68.1 + +### Changed + +- Updated codecov to use codecov uploader +- Moved integration tests to Jest +- Fixed docker release to only download .deb +- Upgraded to Code 1.68.1 +- Install `nfpm` from GitHub +- Upgraded to TypeScript 4.6 + +### Added + +- Added tests for `open`, `isWsl`, `handlePasswordValidation` +- Provided alternate image registry to dockerhub +- Allowed users to have scripts run on container with `ENTRYPOINTD` environment + variable + +### Fixed + +- Fixed open CLI command to work on macOS + +## [4.4.0](https://github.com/coder/code-server/releases/tag/v4.4.0) - 2022-05-06 + +Code v1.66.2 + +### Changed + +- Refactored methods in `Heart` class and made `Heart.beat()` async to make + testing easier. +- Upgraded to Code 1.66.2. + +### Added + +- Added back telemetry patch which was removed in the Code reachitecture. +- Added support to use `true` for `CS_DISABLE_FILE_DOWNLOADS` environment + variable. This means you can disable file downloads by setting + `CS_DISABLE_FILE_DOWNLOADS` to `true` or `1`. +- Added tests for `Heart` class. + +### Fixed + +- Fixed installation issue in AUR after LICENSE rename. +- Fixed issue with listening on IPv6 addresses. +- Fixed issue with Docker publish action not being able to find artifacts. Now + it downloads the release assets from the release. + +## [4.3.0](https://github.com/coder/code-server/releases/tag/v4.3.0) - 2022-04-14 + +Code v1.65.2 + +### Changed + +- Excluded .deb files from release Docker image which drops the compressed and + uncompressed size by 58% and 34%. +- Upgraded to Code 1.65.2. + +### Added + +- Added a new CLI flag called `--disable-file-downloads` which allows you to + disable the "Download..." option that shows in the UI when right-clicking on a + file. This can also set by running `CS_DISABLE_FILE_DOWNLOADS=1`. +- Aligned the dependencies for binary and npm release artifacts. + +### Fixed + +- Fixed the code-server version from not displaying in the Help > About dialog. +- Fixed issues with the TypeScript and JavaScript Language Features Extension + failing to activate. +- Fixed missing files in ipynb extension. +- Fixed the homebrew release workflow. +- Fixed the Docker release workflow from not always publishing version tags. + +## [4.2.0](https://github.com/coder/code-server/releases/tag/v4.2.0) - 2022-03-22 + +Code v1.64.2 + +### Added + +- Added tests for `handleArgsSocketCatchError`, `setDefaults` and + `optionDescriptions`. + +### Changed + +- We switched from using the fork `coder/vscode` to a submodule of + `microsoft/vscode` + patches managed by `quilt` for how Code sits inside the + code-server codebase. +- Upgraded to Code 1.64.2. + +### Fixed + +- Update popup notification through `--disable-update-check` is now fixed. +- Fixed PWA icons not loading on iPad +- Fixed the homebrew release process. Our `cdrci` bot should now automatically + update the version as part of the release pipeline. +- Fixed titleBar color setting being ignored in PWA. + +### Security + +- Updated to `minimist-list`. +- Updated `cloud-agent` to `v0.2.4` which uses `nhooyr.io/webscoket` `v1.8.7`. + +## [4.1.0](https://github.com/coder/code-server/releases/tag/v4.1.0) - 2022-03-03 + +Code v1.63.0 + +### Added + +- Support for injecting GitHub token into Code so extensions can make use of it. + This can be done with the `GITHUB_TOKEN` environment variable or `github-auth` + in the config file. +- New flag `--socket-mode` allows setting the mode (file permissions) of the + socket created when using `--socket`. +- The version of Code bundled with code-server now appears when using the + `--version` flag. For example: `4.0.2 5cdfe74686aa73e023f8354a9a6014eb30caa7dd with Code 1.63.0`. + If you have been parsing this flag for the version you might want to use + `--version --json` instead as doing that will be more stable. + +### Changed + +- The workspace or folder passed on the CLI will now use the same redirect + method that the last opened workspace or folder uses. This means if you use + something like `code-server /path/to/dir` you will now get a query parameter + added (like so: `my-domain.tld?folder=/path/to/dir`), making it easier to edit + by hand and making it consistent with the last opened and menu open behaviors. +- The folder/workspace query parameter no longer has encoded slashes, making + them more readable and editable by hand. This was only affecting the last + opened behavior, not opens from the menu. + +### Fixed + +- Fix web sockets not connecting when using `--cert`. +- Prevent workspace state collisions when opening a workspace that shares the + same file path with another workspace on a different machine that shares the + same domain. This was causing files opened in one workspace to be "re-"opened + in the other workspace when the other workspace is opened. +- Pin the Express version which should make installing from npm work again. +- Propagate signals to code-server in the Docker image which means it should + stop more quickly and gracefully. +- Fix missing argon binaries in the standalone releases on arm machines. + +## [4.0.2](https://github.com/coder/code-server/releases/tag/v4.0.2) - 2022-01-27 + +Code v1.63.0 + +### Fixed + +- Unset the `BROWSER` environment variable. This fixes applications that hard + exit when trying to spawn the helper script `BROWSER` points to because the + file is missing. While we do include the script now we are leaving the + variable omitted because the script does not work yet. + +## [4.0.1](https://github.com/coder/code-server/releases/tag/v4.0.1) - 2022-01-04 + +Code v1.63.0 + +code-server has been rebased on upstream's newly open-sourced server +implementation (#4414). + +### Changed + +- Web socket compression has been made the default (when supported). This means + the `--enable` flag will no longer take `permessage-deflate` as an option. +- The static endpoint can no longer reach outside code-server. However the + vscode-remote-resource endpoint still can. +- OpenVSX has been made the default marketplace. +- The last opened folder/workspace is no longer stored separately in the + settings file (we rely on the already-existing query object instead). +- The marketplace override environment variables `SERVICE_URL` and `ITEM_URL` + have been replaced with a single `EXTENSIONS_GALLERY` variable that + corresponds to `extensionsGallery` in Code's `product.json`. + +### Added + +- `VSCODE_PROXY_URI` env var for use in the terminal and extensions. + +### Removed + +- Extra extension directories have been removed. The `--extra-extensions-dir` + and `--extra-builtin-extensions-dir` flags will no longer be accepted. +- The `--install-source` flag has been removed. + +### Deprecated + +- `--link` is now deprecated (#4562). + +### Security + +- We fixed a XSS vulnerability by escaping HTML from messages in the error page (#4430). + +## [3.12.0](https://github.com/coder/code-server/releases/tag/v3.12.0) - 2021-09-15 + +Code v1.60.0 + +### Changed + +- Upgrade Code to 1.60.0. + +### Fixed + +- Fix logout when using a base path (#3608). + +## [3.11.1](https://github.com/coder/code-server/releases/tag/v3.11.1) - 2021-08-06 + +Undocumented (see releases page). + +## [3.11.0](https://github.com/coder/code-server/releases/tag/v3.11.0) - 2021-06-14 + +Undocumented (see releases page). + +## [3.10.2](https://github.com/coder/code-server/releases/tag/v3.10.2) - 2021-05-21 + +Code v1.56.1 + +### Added + +- Support `extraInitContainers` in helm chart values (#3393). + +### Changed + +- Change `extraContainers` to support templating in helm chart (#3393). + +### Fixed + +- Fix "Open Folder" on welcome page (#3437). + +## [3.10.1](https://github.com/coder/code-server/releases/tag/v3.10.1) - 2021-05-17 + +Code v1.56.1 + +### Fixed + +- Check the logged user instead of $USER (#3330). +- Fix broken node_modules.asar symlink in npm package (#3355). +- Update cloud agent to fix version issue (#3342). + +### Changed + +- Use xdgBasedir.runtime instead of tmp (#3304). + +## [3.10.0](https://github.com/coder/code-server/releases/tag/v3.10.0) - 2021-05-10 + +Code v1.56.0 + +### Changed + +- Update to Code 1.56.0 (#3269). +- Minor connections refactor (#3178). Improves connection stability. +- Use ptyHostService (#3308). This brings us closer to upstream Code. + +### Added + +- Add flag for toggling permessage-deflate (#3286). The default is off so + compression will no longer be used by default. Use the --enable flag to + toggle it back on. + +### Fixed + +- Make rate limiter not count against successful logins (#3141). +- Refactor logout (#3277). This fixes logging out in some scenarios. +- Make sure directories exist (#3309). This fixes some errors on startup. + +### Security + +- Update dependencies with CVEs (#3223). + +## Previous versions + +This was added with `3.10.0`, which means any previous versions are not +documented in the changelog. + +To see those, please visit the [Releases page](https://github.com/coder/code-server/releases). diff --git a/LICENSE.txt b/LICENSE similarity index 100% rename from LICENSE.txt rename to LICENSE diff --git a/README.md b/README.md deleted file mode 100644 index b3f023138ee4..000000000000 --- a/README.md +++ /dev/null @@ -1,65 +0,0 @@ -# code-server - -Run [VS Code](https://github.com/Microsoft/vscode) on any machine anywhere and access it in the browser. - -![Screenshot](./doc/assets/screenshot.png) - -## Highlights - -- **Code everywhere** - - Code on your Chromebook, tablet, and laptop with a consistent development environment. - - Develop on a Linux machine and pick up from any device with a web browser. -- **Server-powered** - - Take advantage of large cloud servers to speed up tests, compilations, downloads, and more. - - Preserve battery life when you're on the go as all intensive tasks runs on your server. - - Make use of a spare computer you have lying around and turn it into a full development environment. - -## Getting Started - -For a full setup and walkthrough, please see [./doc/guide.md](./doc/guide.md). - -### Quick Install - -We have a [script](./install.sh) to install code-server for Linux, macOS and FreeBSD. - -It tries to use the system package manager if possible. - -First run to print out the install process: - -```bash -curl -fsSL https://code-server.dev/install.sh | sh -s -- --dry-run -``` - -Now to actually install: - -```bash -curl -fsSL https://code-server.dev/install.sh | sh -``` - -The install script will print out how to run and start using code-server. - -### Manual Install - -Docs on the install script, manual installation and docker image are at [./doc/install.md](./doc/install.md). - -## FAQ - -See [./doc/FAQ.md](./doc/FAQ.md). - -## Contributing - -See [./doc/CONTRIBUTING.md](./doc/CONTRIBUTING.md). - -## Hiring - -We ([@cdr](https://github.com/cdr)) are looking for a engineers to help maintain -code-server, innovate on open source and streamline dev workflows. - -Our main office is in Austin, Texas. Remote is ok as long as -you're in North America or Europe. - -Please get in [touch](mailto:jobs@coder.com) with your resume/github if interested. - -## For Organizations - -Visit [our website](https://coder.com) for more information about remote development for your organization or enterprise. diff --git a/ci/Caddyfile b/ci/Caddyfile new file mode 100644 index 000000000000..52e4da6da281 --- /dev/null +++ b/ci/Caddyfile @@ -0,0 +1,15 @@ +{ + admin localhost:4444 +} +:8000 { + @portLocalhost path_regexp port ^/([0-9]+)\/ide + handle @portLocalhost { + uri strip_prefix {re.port.1}/ide + reverse_proxy localhost:{re.port.1} + } + + handle { + respond "Bad hostname" 400 + } + +} diff --git a/ci/README.md b/ci/README.md index b32cf2879a7e..3d569e45c932 100644 --- a/ci/README.md +++ b/ci/README.md @@ -10,84 +10,47 @@ Any file or directory in this subdirectory should be documented here. - [./ci/lib.sh](./lib.sh) - Contains code duplicated across these scripts. -## Publishing a release - -Make sure you have `$GITHUB_TOKEN` set and [hub](https://github.com/github/hub) installed. - -1. Update the version of code-server and make a PR. - 1. Update in `package.json` - 2. Update in [./doc/install.md](../doc/install.md) -2. GitHub actions will generate the `npm-package`, `release-packages` and `release-images` artifacts. -3. Run `yarn release:github-draft` to create a GitHub draft release from the template with - the updated version. - 1. Summarize the major changes in the release notes and link to the relevant issues. -4. Wait for the artifacts in step 2 to build. -5. Run `yarn release:github-assets` to download the `release-packages` artifact and - upload them to the draft release. -6. Run some basic sanity tests on one of the released packages. -7. Make sure the github release tag is the commit with the artifacts. This is a bug in - `hub` where uploading assets in step 5 will break the tag. -8. Publish the release and merge the PR. - 1. CI will automatically grab the artifacts and then: - 1. Publish the NPM package from `npm-package`. - 2. Publish the Docker Hub image from `release-images`. -9. Update the AUR package. - - Instructions on updating the AUR package are at [cdr/code-server-aur](https://github.com/cdr/code-server-aur). -10. Wait for the npm package to be published. -11. Update the homebrew package. - - Send a pull request to [homebrew-core](https://github.com/Homebrew/homebrew-core) with the URL in the [formula](https://github.com/Homebrew/homebrew-core/blob/master/Formula/code-server.rb) updated. -12. Make sure to add a release without the `v` prefix for autoupdate from `3.2.0`. - ## dev This directory contains scripts used for the development of code-server. - [./ci/dev/image](./dev/image) - - See [./doc/CONTRIBUTING.md](../doc/CONTRIBUTING.md) for docs on the development container. -- [./ci/dev/fmt.sh](./dev/fmt.sh) (`yarn fmt`) + - See [./docs/CONTRIBUTING.md](../docs/CONTRIBUTING.md) for docs on the development container. +- [./ci/dev/fmt.sh](./dev/fmt.sh) (`npm run fmt`) - Runs formatters. -- [./ci/dev/lint.sh](./dev/lint.sh) (`yarn lint`) +- [./ci/dev/lint.sh](./dev/lint.sh) (`npm run lint`) - Runs linters. -- [./ci/dev/test.sh](./dev/test.sh) (`yarn test`) - - Runs tests. -- [./ci/dev/ci.sh](./dev/ci.sh) (`yarn ci`) - - Runs `yarn fmt`, `yarn lint` and `yarn test`. -- [./ci/dev/vscode.sh](./dev/vscode.sh) (`yarn vscode`) - - Ensures [./lib/vscode](../lib/vscode) is cloned, patched and dependencies are installed. -- [./ci/dev/patch-vscode.sh](./dev/patch-vscode.sh) (`yarn vscode:patch`) - - Applies [./ci/dev/vscode.patch](./dev/vscode.patch) to [./lib/vscode](../lib/vscode). -- [./ci/dev/diff-vscode.sh](./dev/diff-vscode.sh) (`yarn vscode:diff`) - - Diffs [./lib/vscode](../lib/vscode) into [./ci/dev/vscode.patch](./dev/vscode.patch). -- [./ci/dev/vscode.patch](./dev/vscode.patch) - - Our patch of VS Code, see [./doc/CONTRIBUTING.md](../doc/CONTRIBUTING.md#vs-code-patch). - - Generate it with `yarn vscode:diff` and apply with `yarn vscode:patch`. -- [./ci/dev/watch.ts](./dev/watch.ts) (`yarn watch`) +- [./ci/dev/test-unit.sh](./dev/test-unit.sh) (`npm run test:unit`) + - Runs unit tests. +- [./ci/dev/test-e2e.sh](./dev/test-e2e.sh) (`npm run test:e2e`) + - Runs end-to-end tests. +- [./ci/dev/watch.ts](./dev/watch.ts) (`npm run watch`) - Starts a process to build and launch code-server and restart on any code changes. - - Example usage in [./doc/CONTRIBUTING.md](../doc/CONTRIBUTING.md). + - Example usage in [./docs/CONTRIBUTING.md](../docs/CONTRIBUTING.md). +- [./ci/dev/gen_icons.sh](./dev/gen_icons.sh) (`npm run icons`) + - Generates the various icons from a single `.svg` favicon in + `src/browser/media/favicon.svg`. + - Requires [imagemagick](https://imagemagick.org/index.php) ## build This directory contains the scripts used to build and release code-server. You can disable minification by setting `MINIFY=`. -- [./ci/build/build-code-server.sh](./build/build-code-server.sh) (`yarn build`) +- [./ci/build/build-code-server.sh](./build/build-code-server.sh) (`npm run build`) - Builds code-server into `./out` and bundles the frontend into `./dist`. -- [./ci/build/build-vscode.sh](./build/build-vscode.sh) (`yarn build:vscode`) +- [./ci/build/build-vscode.sh](./build/build-vscode.sh) (`npm run build:vscode`) - Builds vscode into `./lib/vscode/out-vscode`. -- [./ci/build/build-release.sh](./build/build-release.sh) (`yarn release`) +- [./ci/build/build-release.sh](./build/build-release.sh) (`npm run release`) - Bundles the output of the above two scripts into a single node module at `./release`. -- [./ci/build/build-standalone-release.sh](./build/build-standalone-release.sh) (`yarn release:standalone`) - - Requires a node module already built into `./release` with the above script. - - Will build a standalone release with node and node_modules bundled into `./release-standalone`. -- [./ci/build/clean.sh](./build/clean.sh) (`yarn clean`) +- [./ci/build/clean.sh](./build/clean.sh) (`npm run clean`) - Removes all build artifacts. - - Will also `git reset --hard lib/vscode`. - Useful to do a clean build. - [./ci/build/code-server.sh](./build/code-server.sh) - Copied into standalone releases to run code-server with the bundled node binary. -- [./ci/build/test-standalone-release.sh](./build/test-standalone-release.sh) (`yarn test:standalone-release`) +- [./ci/build/test-standalone-release.sh](./build/test-standalone-release.sh) (`npm run test:standalone-release`) - Ensures code-server in the `./release-standalone` directory works by installing an extension. -- [./ci/build/build-packages.sh](./build/build-packages.sh) (`yarn package`) +- [./ci/build/build-packages.sh](./build/build-packages.sh) (`npm run package`) - Packages `./release-standalone` into a `.tar.gz` archive in `./release-packages`. - If on linux, [nfpm](https://github.com/goreleaser/nfpm) is used to generate `.deb` and `.rpm`. - [./ci/build/nfpm.yaml](./build/nfpm.yaml) @@ -96,22 +59,22 @@ You can disable minification by setting `MINIFY=`. - Entrypoint script for code-server for `.deb` and `.rpm`. - [./ci/build/code-server.service](./build/code-server.service) - systemd user service packaged into the `.deb` and `.rpm`. -- [./ci/build/release-github-draft.sh](./build/release-github-draft.sh) (`yarn release:github-draft`) - - Uses [hub](https://github.com/github/hub) to create a draft release with a template description. -- [./ci/build/release-github-assets.sh](./build/release-github-assets.sh) (`yarn release:github-assets`) +- [./ci/build/release-github-draft.sh](./build/release-github-draft.sh) (`npm run release:github-draft`) + - Uses [gh](https://github.com/cli/cli) to create a draft release with a template description. +- [./ci/build/release-github-assets.sh](./build/release-github-assets.sh) (`npm run release:github-assets`) - Downloads the release-package artifacts for the current commit from CI. - - Uses [hub](https://github.com/github/hub) to upload the artifacts to the release + - Uses [gh](https://github.com/cli/cli) to upload the artifacts to the release specified in `package.json`. - [./ci/build/npm-postinstall.sh](./build/npm-postinstall.sh) - Post install script for the npm package. - - Bundled by`yarn release`. + - Bundled by`npm run release`. ## release-image This directory contains the release docker container image. -- [./release-image/build.sh](./release-image/build.sh) - - Builds the release container with the tag `codercom/code-server-$ARCH:$VERSION`. +- [./ci/steps/build-docker-buildx-push.sh](./steps/docker-buildx-push.sh) + - Builds the release containers with tags `codercom/code-server-$ARCH:$VERSION` for amd64 and arm64 with `docker buildx` and pushes them. - Assumes debian releases are ready in `./release-packages`. ## images @@ -124,11 +87,15 @@ This directory contains the scripts used in CI. Helps avoid clobbering the CI configuration. - [./steps/fmt.sh](./steps/fmt.sh) - - Runs `yarn fmt` after ensuring VS Code is patched. + - Runs `npm run fmt`. - [./steps/lint.sh](./steps/lint.sh) - - Runs `yarn lint` after ensuring VS Code is patched. -- [./steps/test.sh](./steps/test.sh) - - Runs `yarn test` after ensuring VS Code is patched. + - Runs `npm run lint`. +- [./steps/test-unit.sh](./steps/test-unit.sh) + - Runs `npm run test:unit`. +- [./steps/test-integration.sh](./steps/test-integration.sh) + - Runs `npm run test:integration`. +- [./steps/test-e2e.sh](./steps/test-e2e.sh) + - Runs `npm run test:e2e`. - [./steps/release.sh](./steps/release.sh) - Runs the release process. - Generates the npm package at `./release`. @@ -137,8 +104,8 @@ Helps avoid clobbering the CI configuration. release packages into `./release-packages`. - [./steps/publish-npm.sh](./steps/publish-npm.sh) - Grabs the `npm-package` release artifact for the current commit and publishes it on npm. -- [./steps/build-docker-image.sh](./steps/build-docker-image.sh) - - Builds the docker image and then saves it into `./release-images/code-server-$ARCH-$VERSION.tar`. +- [./steps/docker-buildx-push.sh](./steps/docker-buildx-push.sh) + - Builds the docker image and then pushes it. - [./steps/push-docker-manifest.sh](./steps/push-docker-manifest.sh) - Loads all images in `./release-images` and then builds and pushes a multi architecture docker manifest for the amd64 and arm64 images to `codercom/code-server:$VERSION` and diff --git a/ci/build/build-code-server.sh b/ci/build/build-code-server.sh index df0852804189..df86f2d97a18 100755 --- a/ci/build/build-code-server.sh +++ b/ci/build/build-code-server.sh @@ -3,9 +3,6 @@ set -euo pipefail # Builds code-server into out and the frontend into dist. -# MINIFY controls whether parcel minifies dist. -MINIFY=${MINIFY-true} - main() { cd "$(dirname "${0}")/../.." @@ -17,15 +14,6 @@ main() { sed -i.bak "1s;^;#!/usr/bin/env node\n;" out/node/entry.js && rm out/node/entry.js.bak chmod +x out/node/entry.js fi - - parcel build \ - --public-url "." \ - --out-dir dist \ - $([[ $MINIFY ]] || echo --no-minify) \ - src/browser/register.ts \ - src/browser/serviceWorker.ts \ - src/browser/pages/login.ts \ - src/browser/pages/vscode.ts } main "$@" diff --git a/ci/build/build-lib.sh b/ci/build/build-lib.sh new file mode 100755 index 000000000000..520276c1bfc3 --- /dev/null +++ b/ci/build/build-lib.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +# This is a library which contains functions used inside ci/build +# +# We separated it into it's own file so that we could easily unit test +# these functions and helpers. + +# On some CPU architectures (notably node/uname "armv7l", default on Raspberry Pis), +# different package managers have different labels for the same CPU (deb=armhf, rpm=armhfp). +# This function returns the overriden arch on platforms +# with alternate labels, or the same arch otherwise. +get_nfpm_arch() { + local PKG_FORMAT="${1:-}" + local ARCH="${2:-}" + + case "$ARCH" in + armv7l) + if [ "$PKG_FORMAT" = "deb" ]; then + echo armhf + elif [ "$PKG_FORMAT" = "rpm" ]; then + echo armhfp + fi + ;; + *) + echo "$ARCH" + ;; + esac +} diff --git a/ci/build/build-packages.sh b/ci/build/build-packages.sh index 058a54781ecc..1ad438473a9d 100755 --- a/ci/build/build-packages.sh +++ b/ci/build/build-packages.sh @@ -1,25 +1,25 @@ #!/usr/bin/env bash set -euo pipefail -# Packages code-server for the current OS and architecture into ./release-packages. -# This script assumes that a standalone release is built already into ./release-standalone +# Given a platform-specific release found in ./release-standalone, generate an +# compressed archives and bundles (as appropriate for the platform) named after +# the platform's architecture and OS and place them in ./release-packages and +# ./release-gcp. main() { cd "$(dirname "${0}")/../.." source ./ci/lib.sh + source ./ci/build/build-lib.sh + + # Allow us to override architecture + # we use this for our Linux ARM64 cross compile builds + if [ "$#" -eq 1 ] && [ "$1" ]; then + ARCH=$1 + fi mkdir -p release-packages release_archive - # Will stop the auto update issues and allow people to upgrade their scripts - # for the new release structure. - if [[ $ARCH == "amd64" ]]; then - if [[ $OS == "linux" ]]; then - ARCH=x86_64 release_archive - elif [[ $OS == "macos" ]]; then - OS=darwin ARCH=x86_64 release_archive - fi - fi if [[ $OS == "linux" ]]; then release_nfpm @@ -29,13 +29,7 @@ main() { release_archive() { local release_name="code-server-$VERSION-$OS-$ARCH" if [[ $OS == "linux" ]]; then - tar -czf "release-packages/$release_name.tar.gz" --transform "s/^\.\/release-standalone/$release_name/" ./release-standalone - elif [[ $OS == "darwin" && $ARCH == "x86_64" ]]; then - # Just exists to make autoupdating from 3.2.0 work again. - mv ./release-standalone "./$release_name" - zip -r "release-packages/$release_name.zip" "./$release_name" - mv "./$release_name" ./release-standalone - return + tar -czf "release-packages/$release_name.tar.gz" --owner=0 --group=0 --transform "s/^\.\/release-standalone/$release_name/" ./release-standalone else tar -czf "release-packages/$release_name.tar.gz" -s "/^release-standalone/$release_name/" release-standalone fi @@ -55,11 +49,22 @@ release_gcp() { # Generates deb and rpm packages. release_nfpm() { local nfpm_config + + export NFPM_ARCH + + PKG_FORMAT="deb" + NFPM_ARCH="$(get_nfpm_arch $PKG_FORMAT "$ARCH")" nfpm_config="$(envsubst < ./ci/build/nfpm.yaml)" + echo "Building deb" + echo "$nfpm_config" | head --lines=4 + nfpm pkg -f <(echo "$nfpm_config") --target "release-packages/code-server_${VERSION}_${NFPM_ARCH}.deb" - # The underscores are convention for .deb. - nfpm pkg -f <(echo "$nfpm_config") --target "release-packages/code-server_${VERSION}_$ARCH.deb" - nfpm pkg -f <(echo "$nfpm_config") --target "release-packages/code-server-$VERSION-$ARCH.rpm" + PKG_FORMAT="rpm" + NFPM_ARCH="$(get_nfpm_arch $PKG_FORMAT "$ARCH")" + nfpm_config="$(envsubst < ./ci/build/nfpm.yaml)" + echo "Building rpm" + echo "$nfpm_config" | head --lines=4 + nfpm pkg -f <(echo "$nfpm_config") --target "release-packages/code-server-$VERSION-$NFPM_ARCH.rpm" } main "$@" diff --git a/ci/build/build-release.sh b/ci/build/build-release.sh index 1cb00ad018ce..0d226fd83a25 100755 --- a/ci/build/build-release.sh +++ b/ci/build/build-release.sh @@ -1,86 +1,136 @@ #!/usr/bin/env bash set -euo pipefail -# This script requires vscode to be built with matching MINIFY. +# Once both code-server and VS Code have been built, use this script to copy +# them into a single directory (./release), prepare the package.json and +# product.json, and add shrinkwraps. This results in a generic NPM package that +# we published to NPM and also use to compile platform-specific packages. -# MINIFY controls whether minified vscode is bundled. +# MINIFY controls whether minified VS Code is bundled. It must match the value +# used when VS Code was built. MINIFY="${MINIFY-true}" +# node_modules are not copied by default. Set KEEP_MODULES=1 to copy them. +KEEP_MODULES="${KEEP_MODULES-0}" + main() { cd "$(dirname "${0}")/../.." + source ./ci/lib.sh VSCODE_SRC_PATH="lib/vscode" VSCODE_OUT_PATH="$RELEASE_PATH/lib/vscode" + create_shrinkwraps + mkdir -p "$RELEASE_PATH" bundle_code_server bundle_vscode - rsync README.md "$RELEASE_PATH" - rsync LICENSE.txt "$RELEASE_PATH" + rsync ./docs/README.md "$RELEASE_PATH" + rsync LICENSE "$RELEASE_PATH" rsync ./lib/vscode/ThirdPartyNotices.txt "$RELEASE_PATH" - - # code-server exports types which can be imported and used by plugins. Those - # types import ipc.d.ts but it isn't included in the final vscode build so - # we'll copy it ourselves here. - mkdir -p "$RELEASE_PATH/lib/vscode/src/vs/server" - rsync ./lib/vscode/src/vs/server/ipc.d.ts "$RELEASE_PATH/lib/vscode/src/vs/server" } bundle_code_server() { - rsync out dist "$RELEASE_PATH" + rsync out "$RELEASE_PATH" # For source maps and images. mkdir -p "$RELEASE_PATH/src/browser" rsync src/browser/media/ "$RELEASE_PATH/src/browser/media" mkdir -p "$RELEASE_PATH/src/browser/pages" rsync src/browser/pages/*.html "$RELEASE_PATH/src/browser/pages" + rsync src/browser/pages/*.css "$RELEASE_PATH/src/browser/pages" + rsync src/browser/robots.txt "$RELEASE_PATH/src/browser" # Adds the commit to package.json - jq --slurp '.[0] * .[1]' package.json <( + jq --slurp '(.[0] | del(.scripts,.jest,.devDependencies)) * .[1]' package.json <( cat << EOF { "commit": "$(git rev-parse HEAD)", "scripts": { - "postinstall": "./postinstall.sh" + "postinstall": "sh ./postinstall.sh" } } EOF ) > "$RELEASE_PATH/package.json" - rsync yarn.lock "$RELEASE_PATH" + mv npm-shrinkwrap.json "$RELEASE_PATH" + rsync ci/build/npm-postinstall.sh "$RELEASE_PATH/postinstall.sh" + + if [ "$KEEP_MODULES" = 1 ]; then + rsync node_modules/ "$RELEASE_PATH/node_modules" + fi } bundle_vscode() { mkdir -p "$VSCODE_OUT_PATH" - rsync "$VSCODE_SRC_PATH/yarn.lock" "$VSCODE_OUT_PATH" - rsync "$VSCODE_SRC_PATH/out-vscode${MINIFY+-min}/" "$VSCODE_OUT_PATH/out" - - rsync "$VSCODE_SRC_PATH/.build/extensions/" "$VSCODE_OUT_PATH/extensions" - rm -Rf "$VSCODE_OUT_PATH/extensions/node_modules" - rsync "$VSCODE_SRC_PATH/extensions/package.json" "$VSCODE_OUT_PATH/extensions" - rsync "$VSCODE_SRC_PATH/extensions/yarn.lock" "$VSCODE_OUT_PATH/extensions" - rsync "$VSCODE_SRC_PATH/extensions/postinstall.js" "$VSCODE_OUT_PATH/extensions" - mkdir -p "$VSCODE_OUT_PATH/resources/linux" - rsync "$VSCODE_SRC_PATH/resources/linux/code.png" "$VSCODE_OUT_PATH/resources/linux/code.png" - - # Adds the commit and date to product.json - jq --slurp '.[0] * .[1]' "$VSCODE_SRC_PATH/product.json" <( - cat << EOF - { - "commit": "$(git rev-parse HEAD)", - "date": $(jq -n 'now | todate') - } -EOF - ) > "$VSCODE_OUT_PATH/product.json" + local rsync_opts=() + if [[ ${DEBUG-} = 1 ]]; then + rsync_opts+=(-vh) + fi + + # Some extensions have a .gitignore which excludes their built source from the + # npm package so exclude any .gitignore files. + rsync_opts+=(--exclude .gitignore) + + # Exclude Node as we will add it ourselves for the standalone and will not + # need it for the npm package. + rsync_opts+=(--exclude /node) + + # Exclude Node modules. + if [[ $KEEP_MODULES = 0 ]]; then + rsync_opts+=(--exclude node_modules) + fi + + rsync "${rsync_opts[@]}" ./lib/vscode-reh-web-*/ "$VSCODE_OUT_PATH" + + # Merge the package.json for the web/remote server so we can include + # dependencies, since we want to ship this via NPM. + jq --slurp '.[0] * .[1]' \ + "$VSCODE_SRC_PATH/remote/package.json" \ + "$VSCODE_OUT_PATH/package.json" > "$VSCODE_OUT_PATH/package.json.merged" + mv "$VSCODE_OUT_PATH/package.json.merged" "$VSCODE_OUT_PATH/package.json" + cp "$VSCODE_SRC_PATH/remote/npm-shrinkwrap.json" "$VSCODE_OUT_PATH/npm-shrinkwrap.json" + + # Include global extension dependencies as well. + rsync "$VSCODE_SRC_PATH/extensions/package.json" "$VSCODE_OUT_PATH/extensions/package.json" + cp "$VSCODE_SRC_PATH/extensions/npm-shrinkwrap.json" "$VSCODE_OUT_PATH/extensions/npm-shrinkwrap.json" + rsync "$VSCODE_SRC_PATH/extensions/postinstall.mjs" "$VSCODE_OUT_PATH/extensions/postinstall.mjs" +} - # We remove the scripts field so that later on we can run - # yarn to fetch node_modules if necessary without build scripts running. - # We cannot use --no-scripts because we still want dependent package scripts to run. - jq 'del(.scripts)' < "$VSCODE_SRC_PATH/package.json" > "$VSCODE_OUT_PATH/package.json" +create_shrinkwraps() { + # package-lock.json files (used to ensure deterministic versions of + # dependencies) are not packaged when publishing to the NPM registry. + # + # To ensure deterministic dependency versions (even when code-server is + # installed with NPM), we create an npm-shrinkwrap.json file from the + # currently installed node_modules. This ensures the versions used from + # development (that the package-lock.json guarantees) are also the ones + # installed by end-users. These will include devDependencies, but those will + # be ignored when installing globally (for code-server), and because we use + # --omit=dev (for VS Code). + + # We first generate the shrinkwrap file for code-server itself - which is the + # current directory. + cp package-lock.json package-lock.json.temp + npm shrinkwrap + mv package-lock.json.temp package-lock.json + + # Then the shrinkwrap files for the bundled VS Code. + pushd "$VSCODE_SRC_PATH/remote/" + cp package-lock.json package-lock.json.temp + npm shrinkwrap + mv package-lock.json.temp package-lock.json + popd + + pushd "$VSCODE_SRC_PATH/extensions/" + cp package-lock.json package-lock.json.temp + npm shrinkwrap + mv package-lock.json.temp package-lock.json + popd } main "$@" diff --git a/ci/build/build-standalone-release.sh b/ci/build/build-standalone-release.sh index df6cdc56f198..b0833db810cb 100755 --- a/ci/build/build-standalone-release.sh +++ b/ci/build/build-standalone-release.sh @@ -1,28 +1,37 @@ #!/usr/bin/env bash set -euo pipefail +# Once we have an NPM package, use this script to copy it to a separate +# directory (./release-standalone) and install the dependencies. This new +# directory can then be packaged as a platform-specific release. + main() { cd "$(dirname "${0}")/../.." + source ./ci/lib.sh rsync "$RELEASE_PATH/" "$RELEASE_PATH-standalone" RELEASE_PATH+=-standalone - # We cannot find the path to node from $PATH because yarn shims a script to ensure - # we use the same version it's using so we instead run a script with yarn that - # will print the path to node. + # Package managers may shim their own "node" wrapper into the PATH, so run + # node and ask it for its true path. local node_path - node_path="$(yarn -s node <<< 'console.info(process.execPath)')" + node_path="$(node -p process.execPath)" mkdir -p "$RELEASE_PATH/bin" + mkdir -p "$RELEASE_PATH/lib" rsync ./ci/build/code-server.sh "$RELEASE_PATH/bin/code-server" rsync "$node_path" "$RELEASE_PATH/lib/node" - ln -s "./bin/code-server" "$RELEASE_PATH/code-server" - ln -s "./lib/node" "$RELEASE_PATH/node" + chmod 755 "$RELEASE_PATH/lib/node" - cd "$RELEASE_PATH" - yarn --production --frozen-lockfile + pushd "$RELEASE_PATH" + npm install --unsafe-perm --omit=dev + # Code deletes some files from the extension node_modules directory which + # leaves broken symlinks in the corresponding .bin directory. nfpm will fail + # on these broken symlinks so clean them up. + rm -fr "./lib/vscode/extensions/node_modules/.bin" + popd } main "$@" diff --git a/ci/build/build-vscode.sh b/ci/build/build-vscode.sh index a7368db3af84..f037fac3a4c1 100755 --- a/ci/build/build-vscode.sh +++ b/ci/build/build-vscode.sh @@ -6,16 +6,144 @@ set -euo pipefail # MINIFY controls whether a minified version of vscode is built. MINIFY=${MINIFY-true} +delete-bin-script() { + rm -f "lib/vscode-reh-web-linux-x64/bin/$1" +} + +copy-bin-script() { + local script="$1" + local dest="lib/vscode-reh-web-linux-x64/bin/$script" + cp "lib/vscode/resources/server/bin/$script" "$dest" + sed -i.bak "s/@@VERSION@@/$(vscode_version)/g" "$dest" + sed -i.bak "s/@@COMMIT@@/$BUILD_SOURCEVERSION/g" "$dest" + sed -i.bak "s/@@APPNAME@@/code-server/g" "$dest" + + # Fix Node path on Darwin and Linux. + # We do not want expansion here; this text should make it to the file as-is. + # shellcheck disable=SC2016 + sed -i.bak 's/^ROOT=\(.*\)$/VSROOT=\1\nROOT="$(dirname "$(dirname "$VSROOT")")"/g' "$dest" + sed -i.bak 's/ROOT\/out/VSROOT\/out/g' "$dest" + # We do not want expansion here; this text should make it to the file as-is. + # shellcheck disable=SC2016 + sed -i.bak 's/$ROOT\/node/${NODE_EXEC_PATH:-$ROOT\/lib\/node}/g' "$dest" + + # Fix Node path on Windows. + sed -i.bak 's/^set ROOT_DIR=\(.*\)$/set ROOT_DIR=%~dp0..\\..\\..\\..\r\nset VSROOT_DIR=\1/g' "$dest" + sed -i.bak 's/%ROOT_DIR%\\out/%VSROOT_DIR%\\out/g' "$dest" + + chmod +x "$dest" + rm "$dest.bak" +} + main() { cd "$(dirname "${0}")/../.." - cd lib/vscode - yarn gulp compile-build - yarn gulp compile-extensions-build - yarn gulp optimize --gulpfile ./coder.js - if [[ $MINIFY ]]; then - yarn gulp minify --gulpfile ./coder.js + source ./ci/lib.sh + + # Set the commit Code will embed into the product.json. We need to do this + # since Code tries to get the commit from the `.git` directory which will fail + # as it is a submodule. + # + # Also, we use code-server's commit rather than VS Code's otherwise it would + # not update when only our patch files change, and that will cause caching + # issues where the browser keeps using outdated code. + export BUILD_SOURCEVERSION + BUILD_SOURCEVERSION=$(git rev-parse HEAD) + + pushd lib/vscode + + if [[ ! ${VERSION-} ]]; then + echo "VERSION not set. Please set before running this script:" + echo "VERSION='0.0.0' npm run build:vscode" + exit 1 fi + + # Add the date, our name, links, enable telemetry (this just makes telemetry + # available; telemetry can still be disabled by flag or setting), and + # configure trusted extensions (since some, like github.copilot-chat, never + # ask to be trusted and this is the only way to get auth working). + # + # This needs to be done before building as Code will read this file and embed + # it into the client-side code. + git checkout product.json # Reset in case the script exited early. + cp product.json product.original.json # Since jq has no inline edit. + jq --slurp '.[0] * .[1]' product.original.json <( + cat << EOF + { + "enableTelemetry": true, + "quality": "stable", + "codeServerVersion": "$VERSION", + "nameShort": "code-server", + "nameLong": "code-server", + "applicationName": "code-server", + "dataFolderName": ".code-server", + "win32MutexName": "codeserver", + "licenseUrl": "https://github.com/coder/code-server/blob/main/LICENSE", + "win32DirName": "code-server", + "win32NameVersion": "code-server", + "win32AppUserModelId": "coder.code-server", + "win32ShellNameShort": "c&ode-server", + "darwinBundleIdentifier": "com.coder.code.server", + "linuxIconName": "com.coder.code.server", + "reportIssueUrl": "https://github.com/coder/code-server/issues/new", + "documentationUrl": "https://go.microsoft.com/fwlink/?LinkID=533484#vscode", + "keyboardShortcutsUrlMac": "https://go.microsoft.com/fwlink/?linkid=832143", + "keyboardShortcutsUrlLinux": "https://go.microsoft.com/fwlink/?linkid=832144", + "keyboardShortcutsUrlWin": "https://go.microsoft.com/fwlink/?linkid=832145", + "introductoryVideosUrl": "https://go.microsoft.com/fwlink/?linkid=832146", + "tipsAndTricksUrl": "https://go.microsoft.com/fwlink/?linkid=852118", + "newsletterSignupUrl": "https://www.research.net/r/vsc-newsletter", + "linkProtectionTrustedDomains": [ + "https://open-vsx.org/" + ], + "trustedExtensionAuthAccess": [ + "vscode.git", "vscode.github", + "github.vscode-pull-request-github", + "github.copilot", "github.copilot-chat" + ], + "aiConfig": { + "ariaKey": "code-server" + } + } +EOF + ) > product.json + + # Any platform here works since we will do our own packaging. We have to do + # this because we have an NPM package that could be installed on any platform. + # The correct platform dependencies and scripts will be installed as part of + # the post-install during `npm install` or when building a standalone release. + node --max-old-space-size=16384 --optimize-for-size \ + ./node_modules/gulp/bin/gulp.js \ + "vscode-reh-web-linux-x64${MINIFY:+-min}" + + # Reset so if you develop after building you will not be stuck with the wrong + # commit (the dev client will use `oss-dev` but the dev server will still use + # product.json which will have `stable-$commit`). + git checkout product.json + + popd + + pushd lib/vscode-reh-web-linux-x64 + # Make sure Code took the version we set in the environment variable. Not + # having a version will break display languages. + if ! jq -e .commit product.json; then + echo "'commit' is missing from product.json" + exit 1 + fi + popd + + # These provide a `code-server` command in the integrated terminal to open + # files in the current instance. + delete-bin-script remote-cli/code-server + copy-bin-script remote-cli/code-darwin.sh + copy-bin-script remote-cli/code-linux.sh + copy-bin-script remote-cli/code.cmd + + # These provide a way for terminal applications to open browser windows. + delete-bin-script helpers/browser.sh + copy-bin-script helpers/browser-darwin.sh + copy-bin-script helpers/browser-linux.sh + copy-bin-script helpers/browser.cmd } main "$@" diff --git a/ci/build/clean.sh b/ci/build/clean.sh index aa7ddadc1f79..9d90836a36f6 100755 --- a/ci/build/clean.sh +++ b/ci/build/clean.sh @@ -5,21 +5,7 @@ main() { cd "$(dirname "${0}")/../.." source ./ci/lib.sh - rm -Rf \ - out \ - release \ - release-standalone \ - release-packages \ - release-gcp \ - release-images/ \ - dist \ - .tsbuildinfo \ - .cache/out.tsbuildinfo - - pushd lib/vscode - git clean -xffd - git reset --hard - popd + git clean -Xffd } main "$@" diff --git a/ci/build/code-server.service b/ci/build/code-server-user.service similarity index 100% rename from ci/build/code-server.service rename to ci/build/code-server-user.service diff --git a/ci/build/code-server.sh b/ci/build/code-server.sh index deb36ac31c33..801835ea843b 100755 --- a/ci/build/code-server.sh +++ b/ci/build/code-server.sh @@ -5,20 +5,12 @@ set -eu # Runs code-server with the bundled node binary. _realpath() { - # See https://github.com/cdr/code-server/issues/1537 on why no realpath or readlink -f. + # See https://github.com/coder/code-server/issues/1537 on why no realpath or readlink -f. script="$1" cd "$(dirname "$script")" while [ -L "$(basename "$script")" ]; do - if [ -L "./node" ] && [ -L "./code-server" ] && - [ -f "package.json" ] && - cat package.json | grep -q '^ "name": "code-server",$'; then - echo "***** Please use the script in bin/code-server instead!" >&2 - echo "***** This script will soon be removed!" >&2 - echo "***** See the release notes at https://github.com/cdr/code-server/releases/tag/v3.4.0" >&2 - fi - script="$(readlink "$(basename "$script")")" cd "$(dirname "$script")" done diff --git a/ci/build/code-server@.service b/ci/build/code-server@.service new file mode 100644 index 000000000000..bfb62d78dea0 --- /dev/null +++ b/ci/build/code-server@.service @@ -0,0 +1,12 @@ +[Unit] +Description=code-server +After=network.target + +[Service] +Type=exec +ExecStart=/usr/bin/code-server +Restart=always +User=%i + +[Install] +WantedBy=default.target diff --git a/ci/build/nfpm.yaml b/ci/build/nfpm.yaml index ed8e1ea6d92a..4a44df900c9b 100644 --- a/ci/build/nfpm.yaml +++ b/ci/build/nfpm.yaml @@ -1,16 +1,25 @@ name: "code-server" -arch: "${ARCH}" +arch: "${NFPM_ARCH}" platform: "linux" version: "v${VERSION}" section: "devel" priority: "optional" -maintainer: "Anmol Sethi " +maintainer: "Joe Previte " description: | Run VS Code in the browser. vendor: "Coder" -homepage: "https://github.com/cdr/code-server" +homepage: "https://github.com/coder/code-server" license: "MIT" -files: - ./ci/build/code-server-nfpm.sh: /usr/bin/code-server - ./ci/build/code-server.service: /usr/lib/systemd/user/code-server.service - ./release-standalone/**/*: "/usr/lib/code-server/" + +contents: + - src: ./ci/build/code-server-nfpm.sh + dst: /usr/bin/code-server + + - src: ./ci/build/code-server@.service + dst: /usr/lib/systemd/system/code-server@.service + + - src: ./ci/build/code-server-user.service + dst: /usr/lib/systemd/user/code-server.service + + - src: ./release-standalone/* + dst: /usr/lib/code-server diff --git a/ci/build/npm-postinstall.sh b/ci/build/npm-postinstall.sh index 127d6408a0c6..ee4c92237023 100755 --- a/ci/build/npm-postinstall.sh +++ b/ci/build/npm-postinstall.sh @@ -1,41 +1,160 @@ #!/usr/bin/env sh set -eu +# Copied from ../lib.sh except we do not rename Darwin and we do not need to +# detect Alpine. +os() { + osname=$(uname | tr '[:upper:]' '[:lower:]') + case $osname in + cygwin* | mingw*) osname="windows" ;; + esac + echo "$osname" +} + +# Create a symlink at $2 pointing to $1 on any platform. Anything that +# currently exists at $2 will be deleted. +symlink() { + source="$1" + dest="$2" + rm -rf "$dest" + case $OS in + windows) mklink /J "$dest" "$source" ;; + *) ln -s "$source" "$dest" ;; + esac +} + +# VS Code bundles some modules into an asar which is an archive format that +# works like tar. It then seems to get unpacked into node_modules.asar. +# +# I don't know why they do this but all the dependencies they bundle already +# exist in node_modules so just symlink it. We have to do this since not only +# Code itself but also extensions will look specifically in this directory for +# files (like the ripgrep binary or the oniguruma wasm). +symlink_asar() { + symlink node_modules node_modules.asar +} + +# Make a symlink at bin/$1/$3 pointing to the platform-specific version of the +# script in $2. The extension of the link will be .cmd for Windows otherwise it +# will be whatever is in $4 (or no extension if $4 is not set). +symlink_bin_script() { + oldpwd="$(pwd)" + cd "bin/$1" + source="$2" + dest="$3" + ext="${4-}" + case $OS in + windows) symlink "$source.cmd" "$dest.cmd" ;; + darwin | macos) symlink "$source-darwin.sh" "$dest$ext" ;; + *) symlink "$source-linux.sh" "$dest$ext" ;; + esac + cd "$oldpwd" +} + +command_exists() { + if [ ! "$1" ]; then return 1; fi + command -v "$@" > /dev/null +} + +is_root() { + if command_exists id && [ "$(id -u)" = 0 ]; then + return 0 + fi + return 1 +} + +OS="$(os)" + main() { # Grabs the major version of node from $npm_config_user_agent which looks like # yarn/1.21.1 npm/? node/v14.2.0 darwin x64 major_node_version=$(echo "$npm_config_user_agent" | sed -n 's/.*node\/v\([^.]*\).*/\1/p') - if [ "$major_node_version" -lt 12 ]; then - echo "code-server currently requires at least node v12" + + if [ -n "${FORCE_NODE_VERSION:-}" ]; then + echo "WARNING: Overriding required Node.js version to v$FORCE_NODE_VERSION" + echo "This could lead to broken functionality, and is unsupported." + echo "USE AT YOUR OWN RISK!" + fi + + if [ "$major_node_version" -ne "${FORCE_NODE_VERSION:-22}" ]; then + echo "ERROR: code-server currently requires node v22." + if [ -n "$FORCE_NODE_VERSION" ]; then + echo "However, you have overrided the version check to use v$FORCE_NODE_VERSION." + fi echo "We have detected that you are on node v$major_node_version" - echo "See https://github.com/cdr/code-server/issues/1633" + echo "You can override this version check by setting \$FORCE_NODE_VERSION," + echo "but configurations that do not use the same node version are unsupported." exit 1 fi - case "${npm_config_user_agent-}" in npm*) - # We are running under npm. - if [ "${npm_config_unsafe_perm-}" != "true" ]; then - echo "Please pass --unsafe-perm to npm to install code-server" - echo "Otherwise the postinstall script does not have permissions to run" - echo "See https://docs.npmjs.com/misc/config#unsafe-perm" - echo "See https://stackoverflow.com/questions/49084929/npm-sudo-global-installation-unsafe-perm" - exit 1 - fi - ;; - esac + # Under npm, if we are running as root, we need --unsafe-perm otherwise + # post-install scripts will not have sufficient permissions to do their thing. + if is_root; then + case "${npm_config_user_agent-}" in npm*) + if [ "${npm_config_unsafe_perm-}" != "true" ]; then + echo "Please pass --unsafe-perm to npm to install code-server" + echo "Otherwise post-install scripts will not have permissions to run" + echo "See https://docs.npmjs.com/misc/config#unsafe-perm" + echo "See https://stackoverflow.com/questions/49084929/npm-sudo-global-installation-unsafe-perm" + exit 1 + fi + ;; + esac + fi - if ! vscode_yarn; then + if ! vscode_install; then echo "You may not have the required dependencies to build the native modules." - echo "Please see https://github.com/cdr/code-server/blob/master/doc/npm.md" + echo "Please see https://github.com/coder/code-server/blob/main/docs/npm.md" exit 1 fi + + if [ -n "${FORCE_NODE_VERSION:-}" ]; then + echo "WARNING: The required Node.js version was overriden to v$FORCE_NODE_VERSION" + echo "This could lead to broken functionality, and is unsupported." + echo "USE AT YOUR OWN RISK!" + fi } -vscode_yarn() { +install_with_yarn_or_npm() { + echo "User agent: ${npm_config_user_agent-none}" + # For development we enforce npm, but for installing the package as an + # end-user we want to keep using whatever package manager is in use. + case "${npm_config_user_agent-}" in + npm*) + if ! npm install --unsafe-perm --omit=dev; then + return 1 + fi + ;; + yarn*) + if ! yarn --production --frozen-lockfile --no-default-rc; then + return 1 + fi + ;; + *) + echo "Could not determine which package manager is being used to install code-server" + exit 1 + ;; + esac + return 0 +} + +vscode_install() { + echo 'Installing Code dependencies...' cd lib/vscode - yarn --production --frozen-lockfile + if ! install_with_yarn_or_npm; then + return 1 + fi + + symlink_asar + symlink_bin_script remote-cli code code-server + symlink_bin_script helpers browser browser .sh + cd extensions - yarn --production --frozen-lockfile + if ! install_with_yarn_or_npm; then + return 1 + fi + + return 0 } main "$@" diff --git a/ci/build/release-github-assets.sh b/ci/build/release-github-assets.sh deleted file mode 100755 index f2d9ff8c364e..000000000000 --- a/ci/build/release-github-assets.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -# Downloads the release artifacts from CI for the current -# commit and then uploads them to the release with the version -# in package.json. -# You will need $GITHUB_TOKEN set. - -main() { - cd "$(dirname "$0")/../.." - source ./ci/lib.sh - - download_artifact release-packages ./release-packages - local assets=(./release-packages/code-server*"$VERSION"*{.tar.gz,.zip,.deb,.rpm}) - for i in "${!assets[@]}"; do - assets[$i]="--attach=${assets[$i]}" - done - EDITOR=true hub release edit --draft "${assets[@]}" "v$VERSION" -} - -main "$@" diff --git a/ci/build/release-github-draft.sh b/ci/build/release-github-draft.sh deleted file mode 100755 index e345d04f6b56..000000000000 --- a/ci/build/release-github-draft.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -# Creates a draft release with the template for the version in package.json - -main() { - cd "$(dirname "$0")/../.." - source ./ci/lib.sh - - hub release create \ - --file - \ - -t "$(git rev-parse HEAD)" \ - --draft "${assets[@]}" "v$VERSION" << EOF -v$VERSION - -VS Code v$(vscode_version) - -- Summarize changes here with references to issues -EOF -} - -main "$@" diff --git a/ci/build/test-standalone-release.sh b/ci/build/test-standalone-release.sh deleted file mode 100755 index 92b58e8c06ce..000000000000 --- a/ci/build/test-standalone-release.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -# Makes sure the release works. -# This is to make sure we don't have Node version errors or any other -# compilation-related errors. -main() { - cd "$(dirname "${0}")/../.." - - local EXTENSIONS_DIR - EXTENSIONS_DIR="$(mktemp -d)" - - echo "Testing standalone release." - - ./release-standalone/bin/code-server --extensions-dir "$EXTENSIONS_DIR" --install-extension ms-python.python - local installed_extensions - installed_extensions="$(./release-standalone/bin/code-server --extensions-dir "$EXTENSIONS_DIR" --list-extensions 2>&1)" - if [[ $installed_extensions != *"info Using config file ~/.config/code-server/config.yaml -ms-python.python" ]]; then - echo "Unexpected output from listing extensions:" - echo "$installed_extensions" - exit 1 - fi - - echo "Standalone release works correctly." -} - -main "$@" diff --git a/ci/dev/diff-vscode.sh b/ci/dev/diff-vscode.sh deleted file mode 100755 index 98c955dff65f..000000000000 --- a/ci/dev/diff-vscode.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -main() { - cd "$(dirname "$0")/../.." - - cd ./lib/vscode - git add -A - git diff HEAD > ../../ci/dev/vscode.patch -} - -main "$@" diff --git a/ci/dev/doctoc.sh b/ci/dev/doctoc.sh new file mode 100755 index 000000000000..39930f21e0b5 --- /dev/null +++ b/ci/dev/doctoc.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +set -euo pipefail + +main() { + cd "$(dirname "$0")/../.." + + doctoc --title '# FAQ' docs/FAQ.md > /dev/null + doctoc --title '# Setup Guide' docs/guide.md > /dev/null + doctoc --title '# Install' docs/install.md > /dev/null + doctoc --title '# npm Install Requirements' docs/npm.md > /dev/null + doctoc --title '# Contributing' docs/CONTRIBUTING.md > /dev/null + doctoc --title '# Maintaining' docs/MAINTAINING.md > /dev/null + doctoc --title '# Contributor Covenant Code of Conduct' docs/CODE_OF_CONDUCT.md > /dev/null + doctoc --title '# iPad' docs/ipad.md > /dev/null + doctoc --title '# Termux' docs/termux.md > /dev/null + + if [[ ${CI-} && $(git ls-files --other --modified --exclude-standard) ]]; then + echo "Files need generation or are formatted incorrectly:" + git -c color.ui=always status | grep --color=no '\[31m' + echo "Please run the following locally:" + echo " npm run doctoc" + exit 1 + fi +} + +main "$@" diff --git a/ci/dev/fmt.sh b/ci/dev/fmt.sh deleted file mode 100755 index d3bd419159ed..000000000000 --- a/ci/dev/fmt.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -main() { - cd "$(dirname "$0")/../.." - - shfmt -i 2 -w -sr $(git ls-files "*.sh") - - local prettierExts - prettierExts=( - "*.js" - "*.ts" - "*.tsx" - "*.html" - "*.json" - "*.css" - "*.md" - "*.toml" - "*.yaml" - "*.yml" - ) - prettier --write --loglevel=warn $(git ls-files "${prettierExts[@]}") - - doctoc --title '# FAQ' doc/FAQ.md > /dev/null - doctoc --title '# Setup Guide' doc/guide.md > /dev/null - doctoc --title '# Install' doc/install.md > /dev/null - doctoc --title '# npm Install Requirements' doc/npm.md > /dev/null - doctoc --title '# Contributing' doc/CONTRIBUTING.md > /dev/null - - if [[ ${CI-} && $(git ls-files --other --modified --exclude-standard) ]]; then - echo "Files need generation or are formatted incorrectly:" - git -c color.ui=always status | grep --color=no '\[31m' - echo "Please run the following locally:" - echo " yarn fmt" - exit 1 - fi -} - -main "$@" diff --git a/ci/dev/gen_icons.sh b/ci/dev/gen_icons.sh new file mode 100755 index 000000000000..39d509bc4f4b --- /dev/null +++ b/ci/dev/gen_icons.sh @@ -0,0 +1,50 @@ +#!/bin/sh +set -eu + +# Generate icons from a single favicon.svg. favicon.svg should have no fill +# colors set. +main() { + cd src/browser/media + + # We need .ico for backwards compatibility. The other two are the only icon + # sizes required by Chrome and we use them for stuff like apple-touch-icon as + # well. https://web.dev/add-manifest/ + # + # This should be enough and we can always add more if there are problems. + # + # -quiet to avoid https://github.com/ImageMagick/ImageMagick/issues/884 + # -background defaults to white but we want it transparent. + # -density somehow makes the image both sharper and smaller in file size. + # + # https://imagemagick.org/script/command-line-options.php#background + convert -quiet -background transparent \ + -resize 256x256 -density 256x256 \ + favicon.svg favicon.ico + + # Generate PWA icons. There should be enough padding to support masking. + convert -quiet -border 60x60 -bordercolor white -background white \ + -resize 192x192 -density 192x192 \ + favicon.svg pwa-icon-maskable-192.png + convert -quiet -border 160x160 -bordercolor white -background white \ + -resize 512x512 -density 512x512 \ + favicon.svg pwa-icon-maskable-512.png + + # Generate non-maskable PWA icons. + magick pwa-icon-maskable-192.png \ + \( +clone -threshold 101% -fill white -draw "roundRectangle 0,0 %[fx:int(w)],%[fx:int(h)] 50,50" \) \ + -channel-fx "| gray=>alpha" \ + pwa-icon-192.png + magick pwa-icon-maskable-512.png \ + \( +clone -threshold 101% -fill white -draw "roundRectangle 0,0 %[fx:int(w)],%[fx:int(h)] 100,100" \) \ + -channel-fx "| gray=>alpha" \ + pwa-icon-512.png + + # The following adds dark mode support for the favicon as + # favicon-dark-support.svg There is no similar capability for pwas or .ico so + # we can only add support to the svg. + favicon_dark_style="" + cp favicon.svg favicon-dark-support.svg + sed "s% favicon-dark-support.svg +} + +main "$@" diff --git a/ci/dev/image/Dockerfile b/ci/dev/image/Dockerfile deleted file mode 100644 index 46f7c184b917..000000000000 --- a/ci/dev/image/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM node:12 - -RUN apt-get update && apt-get install -y \ - curl \ - iproute2 \ - vim \ - iptables \ - net-tools \ - libsecret-1-dev \ - libx11-dev \ - libxkbfile-dev - -CMD ["/bin/bash"] diff --git a/ci/dev/image/exec.sh b/ci/dev/image/exec.sh deleted file mode 100755 index ea208755842a..000000000000 --- a/ci/dev/image/exec.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -# Opens an interactive bash session inside of a docker container -# for improved isolation during development. -# If the container exists it is restarted if necessary, then reused. - -main() { - cd "$(dirname "${0}")/../../.." - - local container_name=code-server-dev - - if docker inspect $container_name &> /dev/null; then - echo "-- Starting container" - docker start "$container_name" > /dev/null - - enter - exit 0 - fi - - build - run - enter -} - -enter() { - echo "--- Entering $container_name" - docker exec -it "$container_name" /bin/bash -} - -run() { - echo "--- Spawning $container_name" - docker run \ - -it \ - --name $container_name \ - "-v=$PWD:/code-server" \ - "-w=/code-server" \ - "-p=127.0.0.1:8080:8080" \ - $(if [[ -t 0 ]]; then echo -it; fi) \ - "$container_name" -} - -build() { - echo "--- Building $container_name" - docker build -t $container_name ./ci/dev/image > /dev/null -} - -main "$@" diff --git a/ci/dev/lint-scripts.sh b/ci/dev/lint-scripts.sh new file mode 100755 index 000000000000..742030affc62 --- /dev/null +++ b/ci/dev/lint-scripts.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +set -euo pipefail + +main() { + cd "$(dirname "$0")/../.." + shellcheck -e SC2046,SC2164,SC2154,SC1091,SC1090,SC2002 $(git ls-files '*.sh' | grep -v 'lib/vscode') +} + +main "$@" diff --git a/ci/dev/lint.sh b/ci/dev/lint.sh deleted file mode 100755 index 219c3793b1e6..000000000000 --- a/ci/dev/lint.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -main() { - cd "$(dirname "$0")/../.." - - eslint --max-warnings=0 --fix $(git ls-files "*.ts" "*.tsx" "*.js") - stylelint $(git ls-files "*.css") - tsc --noEmit - # See comment in ./ci/image/debian8 - if [[ ! ${CI-} ]]; then - shellcheck -e SC2046,SC2164,SC2154,SC1091,SC1090,SC2002 $(git ls-files "*.sh") - fi -} - -main "$@" diff --git a/ci/dev/patch-vscode.sh b/ci/dev/patch-vscode.sh deleted file mode 100755 index cdc2691ad978..000000000000 --- a/ci/dev/patch-vscode.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -main() { - cd "$(dirname "$0")/../.." - - cd ./lib/vscode - git apply ../../ci/dev/vscode.patch -} - -main "$@" diff --git a/ci/dev/postinstall.sh b/ci/dev/postinstall.sh new file mode 100755 index 000000000000..63aad7bcf985 --- /dev/null +++ b/ci/dev/postinstall.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Install dependencies in $1. +install-deps() { + local args=() + if [[ ${CI-} ]]; then + args+=(ci) + else + args+=(install) + fi + # If there is no package.json then npm will look upward and end up installing + # from the root resulting in an infinite loop (this can happen if you have not + # checked out the submodule yet for example). + if [[ ! -f "$1/package.json" ]]; then + echo "$1/package.json is missing; did you run git submodule update --init?" + exit 1 + fi + pushd "$1" + echo "Installing dependencies for $PWD" + npm "${args[@]}" + popd +} + +main() { + cd "$(dirname "$0")/../.." + source ./ci/lib.sh + + install-deps test + install-deps test/e2e/extensions/test-extension + # We don't need these when running the integration tests + # so you can pass SKIP_SUBMODULE_DEPS + if [[ ! ${SKIP_SUBMODULE_DEPS-} ]]; then + install-deps lib/vscode + fi +} + +main "$@" diff --git a/ci/dev/preinstall.js b/ci/dev/preinstall.js new file mode 100644 index 000000000000..9c4240d89696 --- /dev/null +++ b/ci/dev/preinstall.js @@ -0,0 +1,3 @@ +if (process.env.npm_execpath.includes("yarn")) { + throw new Error("`yarn` is no longer supported; please use `npm install` instead") +} diff --git a/ci/dev/test-e2e.sh b/ci/dev/test-e2e.sh new file mode 100755 index 000000000000..fa748823974e --- /dev/null +++ b/ci/dev/test-e2e.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash +set -euo pipefail + +help() { + echo >&2 " You can build with 'npm run watch' or you can build a release" + echo >&2 " For example: 'npm run build && npm run build:vscode && KEEP_MODULES=1 npm run release'" + echo >&2 " Then 'CODE_SERVER_TEST_ENTRY=./release npm run test:e2e'" + echo >&2 " You can manually run that release with 'node ./release'" +} + +main() { + cd "$(dirname "$0")/../.." + + source ./ci/lib.sh + + pushd test/e2e/extensions/test-extension + echo "Building test extension" + npm run build + popd + + local dir="$PWD" + if [[ ! ${CODE_SERVER_TEST_ENTRY-} ]]; then + echo "Set CODE_SERVER_TEST_ENTRY to test another build of code-server" + else + pushd "$CODE_SERVER_TEST_ENTRY" + dir="$PWD" + popd + fi + + echo "Testing build in '$dir'" + + # Simple sanity checks to see that we've built. There could still be things + # wrong (native modules version issues, incomplete build, etc). + if [[ ! -d $dir/out ]]; then + echo >&2 "No code-server build detected" + help + exit 1 + fi + + if [[ ! -d $dir/lib/vscode/out ]]; then + echo >&2 "No VS Code build detected" + help + exit 1 + fi + + cd test + ./node_modules/.bin/playwright test "$@" +} + +main "$@" diff --git a/ci/dev/test-integration.sh b/ci/dev/test-integration.sh new file mode 100755 index 000000000000..380502c230ba --- /dev/null +++ b/ci/dev/test-integration.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +set -euo pipefail + +help() { + echo >&2 " You can build the standalone release with 'npm run release:standalone'" + echo >&2 " Or you can pass in a custom path." + echo >&2 " CODE_SERVER_PATH='/var/tmp/coder/code-server/bin/code-server' npm run test:integration" +} + +# Make sure a code-server release works. You can pass in the path otherwise it +# will look for release-standalone in the current directory. +# +# This is to make sure we don't have Node version errors or any other +# compilation-related errors. +main() { + cd "$(dirname "$0")/../.." + + source ./ci/lib.sh + + local path="$RELEASE_PATH-standalone/bin/code-server" + if [[ ! ${CODE_SERVER_PATH-} ]]; then + echo "Set CODE_SERVER_PATH to test another build of code-server" + else + path="$CODE_SERVER_PATH" + fi + + echo "Running tests with code-server binary: '$path'" + + if [[ ! -f $path ]]; then + echo >&2 "No code-server build detected" + echo >&2 "Looked in $path" + help + exit 1 + fi + + CODE_SERVER_PATH="$path" ./test/node_modules/.bin/jest "$@" --coverage=false --testRegex "./test/integration" --testPathIgnorePatterns "./test/integration/fixtures" +} + +main "$@" diff --git a/ci/dev/test-native.sh b/ci/dev/test-native.sh new file mode 100755 index 000000000000..4db221790231 --- /dev/null +++ b/ci/dev/test-native.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +set -euo pipefail + +help() { + echo >&2 " You can build the standalone release with 'npm run release:standalone'" + echo >&2 " Or you can pass in a custom path." + echo >&2 " CODE_SERVER_PATH='/var/tmp/coder/code-server/bin/code-server' npm run test:integration" +} + +# Make sure a code-server release works. You can pass in the path otherwise it +# will look for release-standalone in the current directory. +# +# This is to make sure we don't have Node version errors or any other +# compilation-related errors. +main() { + cd "$(dirname "$0")/../.." + + source ./ci/lib.sh + + local path="$RELEASE_PATH-standalone/bin/code-server" + if [[ ! ${CODE_SERVER_PATH-} ]]; then + echo "Set CODE_SERVER_PATH to test another build of code-server" + else + path="$CODE_SERVER_PATH" + fi + + echo "Running tests with code-server binary: '$path'" + + if [[ ! -f $path ]]; then + echo >&2 "No code-server build detected" + echo >&2 "Looked in $path" + help + exit 1 + fi + + CODE_SERVER_PATH="$path" ./test/node_modules/.bin/jest "$@" --coverage=false --testRegex "./test/integration/help.test.ts" +} + +main "$@" diff --git a/ci/dev/ci.sh b/ci/dev/test-scripts.sh similarity index 71% rename from ci/dev/ci.sh rename to ci/dev/test-scripts.sh index e92682864174..ebe1efa8ed22 100755 --- a/ci/dev/ci.sh +++ b/ci/dev/test-scripts.sh @@ -3,10 +3,7 @@ set -euo pipefail main() { cd "$(dirname "$0")/../.." - - yarn fmt - yarn lint - yarn test + bats ./test/scripts } main "$@" diff --git a/ci/dev/test-unit.sh b/ci/dev/test-unit.sh new file mode 100755 index 000000000000..15fd2030ea59 --- /dev/null +++ b/ci/dev/test-unit.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -euo pipefail + +main() { + cd "$(dirname "$0")/../.." + + source ./ci/lib.sh + + # We must keep jest in a sub-directory. See ../../test/package.json for more + # information. We must also run it from the root otherwise coverage will not + # include our source files. + ./test/node_modules/.bin/jest "$@" --testRegex "./test/unit/.*ts" +} + +main "$@" diff --git a/ci/dev/test.sh b/ci/dev/test.sh deleted file mode 100755 index 031bacf99aee..000000000000 --- a/ci/dev/test.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -main() { - cd "$(dirname "$0")/../.." - - mocha -r ts-node/register ./test/*.test.ts -} - -main "$@" diff --git a/ci/dev/vscode.patch b/ci/dev/vscode.patch deleted file mode 100644 index 293f68620254..000000000000 --- a/ci/dev/vscode.patch +++ /dev/null @@ -1,3354 +0,0 @@ -diff --git a/.gitignore b/.gitignore -index 0fe46b6ead..e545e004ce 100644 ---- a/.gitignore -+++ b/.gitignore -@@ -25,7 +25,6 @@ out-vscode-reh-web-pkg/ - out-vscode-web/ - out-vscode-web-min/ - out-vscode-web-pkg/ --src/vs/server - resources/server - build/node_modules - coverage/ -diff --git a/.yarnrc b/.yarnrc -deleted file mode 100644 -index 135e10442a..0000000000 ---- a/.yarnrc -+++ /dev/null -@@ -1,3 +0,0 @@ --disturl "https://atom.io/download/electron" --target "7.3.2" --runtime "electron" -diff --git a/build/gulpfile.reh.js b/build/gulpfile.reh.js -index f2ea1bd370..3f660f9981 100644 ---- a/build/gulpfile.reh.js -+++ b/build/gulpfile.reh.js -@@ -52,6 +52,7 @@ gulp.task('vscode-reh-web-linux-x64-min', noop); - gulp.task('vscode-reh-web-linux-alpine-min', noop); - - function getNodeVersion() { -+ return process.versions.node; - const yarnrc = fs.readFileSync(path.join(REPO_ROOT, 'remote', '.yarnrc'), 'utf8'); - const target = /^target "(.*)"$/m.exec(yarnrc)[1]; - return target; -diff --git a/build/lib/node.js b/build/lib/node.js -index 403ae3d965..738ee8cee0 100644 ---- a/build/lib/node.js -+++ b/build/lib/node.js -@@ -5,11 +5,8 @@ - *--------------------------------------------------------------------------------------------*/ - Object.defineProperty(exports, "__esModule", { value: true }); - const path = require("path"); --const fs = require("fs"); - const root = path.dirname(path.dirname(__dirname)); --const yarnrcPath = path.join(root, 'remote', '.yarnrc'); --const yarnrc = fs.readFileSync(yarnrcPath, 'utf8'); --const version = /^target\s+"([^"]+)"$/m.exec(yarnrc)[1]; -+const version = process.versions.node; - const node = process.platform === 'win32' ? 'node.exe' : 'node'; - const nodePath = path.join(root, '.build', 'node', `v${version}`, `${process.platform}-${process.arch}`, node); - console.log(nodePath); -diff --git a/build/lib/node.ts b/build/lib/node.ts -index 6439703446..c53dccf4dc 100644 ---- a/build/lib/node.ts -+++ b/build/lib/node.ts -@@ -4,13 +4,10 @@ - *--------------------------------------------------------------------------------------------*/ - - import * as path from 'path'; --import * as fs from 'fs'; - - const root = path.dirname(path.dirname(__dirname)); --const yarnrcPath = path.join(root, 'remote', '.yarnrc'); --const yarnrc = fs.readFileSync(yarnrcPath, 'utf8'); --const version = /^target\s+"([^"]+)"$/m.exec(yarnrc)![1]; -+const version = process.versions.node; - const node = process.platform === 'win32' ? 'node.exe' : 'node'; - const nodePath = path.join(root, '.build', 'node', `v${version}`, `${process.platform}-${process.arch}`, node); - --console.log(nodePath); -\ No newline at end of file -+console.log(nodePath); -diff --git a/build/lib/util.js b/build/lib/util.js -index e552a036f8..169e8614b9 100644 ---- a/build/lib/util.js -+++ b/build/lib/util.js -@@ -257,6 +257,7 @@ function streamToPromise(stream) { - } - exports.streamToPromise = streamToPromise; - function getElectronVersion() { -+ return process.versions.node; - const yarnrc = fs.readFileSync(path.join(root, '.yarnrc'), 'utf8'); - const target = /^target "(.*)"$/m.exec(yarnrc)[1]; - return target; -diff --git a/build/lib/util.ts b/build/lib/util.ts -index 035c7e95ea..4ff8dcfe6b 100644 ---- a/build/lib/util.ts -+++ b/build/lib/util.ts -@@ -322,6 +322,7 @@ export function streamToPromise(stream: NodeJS.ReadWriteStream): Promise { - } - - export function getElectronVersion(): string { -+ return process.versions.node; - const yarnrc = fs.readFileSync(path.join(root, '.yarnrc'), 'utf8'); - const target = /^target "(.*)"$/m.exec(yarnrc)![1]; - return target; -diff --git a/build/npm/postinstall.js b/build/npm/postinstall.js -index 8f8b0019a7..ea054c725b 100644 ---- a/build/npm/postinstall.js -+++ b/build/npm/postinstall.js -@@ -33,10 +33,11 @@ function yarnInstall(location, opts) { - - yarnInstall('extensions'); // node modules shared by all extensions - --if (!(process.platform === 'win32' && (process.arch === 'arm64' || process.env['npm_config_arch'] === 'arm64'))) { -- yarnInstall('remote'); // node modules used by vscode server -- yarnInstall('remote/web'); // node modules used by vscode web --} -+// NOTE@coder: Skip these dependencies since we don't use them. -+// if (!(process.platform === 'win32' && (process.arch === 'arm64' || process.env['npm_config_arch'] === 'arm64'))) { -+// yarnInstall('remote'); // node modules used by vscode server -+// yarnInstall('remote/web'); // node modules used by vscode web -+// } - - const allExtensionFolders = fs.readdirSync('extensions'); - const extensions = allExtensionFolders.filter(e => { -@@ -69,9 +70,9 @@ runtime "${runtime}"`; - } - - yarnInstall(`build`); // node modules required for build --yarnInstall('test/automation'); // node modules required for smoketest --yarnInstall('test/smoke'); // node modules required for smoketest --yarnInstall('test/integration/browser'); // node modules required for integration -+// yarnInstall('test/automation'); // node modules required for smoketest -+// yarnInstall('test/smoke'); // node modules required for smoketest -+// yarnInstall('test/integration/browser'); // node modules required for integration - yarnInstallBuildDependencies(); // node modules for watching, specific to host node version, not electron - - cp.execSync('git config pull.rebase true'); -diff --git a/build/npm/preinstall.js b/build/npm/preinstall.js -index cb88d37ade..6b3253af0a 100644 ---- a/build/npm/preinstall.js -+++ b/build/npm/preinstall.js -@@ -8,8 +8,9 @@ let err = false; - const majorNodeVersion = parseInt(/^(\d+)\./.exec(process.versions.node)[1]); - - if (majorNodeVersion < 10 || majorNodeVersion >= 13) { -- console.error('\033[1;31m*** Please use node >=10 and <=12.\033[0;0m'); -- err = true; -+ // We are ok building above Node 12. -+ // console.error('\033[1;31m*** Please use node >=10 and <=12.\033[0;0m'); -+ // err = true; - } - - const cp = require('child_process'); -diff --git a/coder.js b/coder.js -new file mode 100644 -index 0000000000..9cb693af63 ---- /dev/null -+++ b/coder.js -@@ -0,0 +1,63 @@ -+// This must be ran from VS Code's root. -+const gulp = require("gulp"); -+const path = require("path"); -+const _ = require("underscore"); -+const buildfile = require("./src/buildfile"); -+const common = require("./build/lib/optimize"); -+const util = require("./build/lib/util"); -+const deps = require("./build/dependencies"); -+ -+const vscodeEntryPoints = _.flatten([ -+ buildfile.entrypoint("vs/workbench/workbench.web.api"), -+ buildfile.entrypoint("vs/server/entry"), -+ buildfile.base, -+ buildfile.workbenchWeb, -+ buildfile.workerExtensionHost, -+ buildfile.keyboardMaps, -+ buildfile.entrypoint("vs/platform/files/node/watcher/unix/watcherApp", ["vs/css", "vs/nls"]), -+ buildfile.entrypoint("vs/platform/files/node/watcher/nsfw/watcherApp", ["vs/css", "vs/nls"]), -+ buildfile.entrypoint("vs/workbench/services/extensions/node/extensionHostProcess", ["vs/css", "vs/nls"]), -+]); -+ -+const vscodeResources = [ -+ "out-build/vs/server/fork.js", -+ "!out-build/vs/server/doc/**", -+ "out-build/vs/workbench/services/extensions/worker/extensionHostWorkerMain.js", -+ "out-build/bootstrap.js", -+ "out-build/bootstrap-fork.js", -+ "out-build/bootstrap-amd.js", -+ 'out-build/bootstrap-node.js', -+ "out-build/paths.js", -+ 'out-build/vs/**/*.{svg,png,html,ttf}', -+ "!out-build/vs/code/browser/workbench/*.html", -+ '!out-build/vs/code/electron-browser/**', -+ "out-build/vs/base/common/performance.js", -+ "out-build/vs/base/node/languagePacks.js", -+ 'out-build/vs/base/browser/ui/codicons/codicon/**', -+ "out-build/vs/workbench/browser/media/*-theme.css", -+ "out-build/vs/workbench/contrib/debug/**/*.json", -+ "out-build/vs/workbench/contrib/externalTerminal/**/*.scpt", -+ "out-build/vs/workbench/contrib/webview/browser/pre/*.js", -+ "out-build/vs/**/markdown.css", -+ "out-build/vs/workbench/contrib/tasks/**/*.json", -+ "out-build/vs/platform/files/**/*.md", -+ "!**/test/**" -+]; -+ -+gulp.task("optimize", gulp.series( -+ util.rimraf("out-vscode"), -+ common.optimizeTask({ -+ src: "out-build", -+ entryPoints: vscodeEntryPoints, -+ resources: vscodeResources, -+ loaderConfig: common.loaderConfig(), -+ out: "out-vscode", -+ inlineAmdImages: true, -+ bundleInfo: undefined -+ }), -+)); -+ -+gulp.task("minify", gulp.series( -+ util.rimraf("out-vscode-min"), -+ common.minifyTask("out-vscode") -+)); -diff --git a/extensions/postinstall.js b/extensions/postinstall.js -index da4fa3e9d0..50f3e1144f 100644 ---- a/extensions/postinstall.js -+++ b/extensions/postinstall.js -@@ -24,6 +24,9 @@ function processRoot() { - rimraf.sync(filePath); - } - } -+ -+ // Delete .bin so it doesn't contain broken symlinks that trip up nfpm. -+ rimraf.sync(path.join(__dirname, 'node_modules', '.bin')); - } - - function processLib() { -diff --git a/package.json b/package.json -index e52e3ff548..2f3b55398b 100644 ---- a/package.json -+++ b/package.json -@@ -45,7 +45,11 @@ - "watch-web": "gulp watch-web --max_old_space_size=4095", - "eslint": "eslint -c .eslintrc.json --rulesdir ./build/lib/eslint --ext .ts --ext .js ./src/vs ./extensions" - }, -+ "dependencies_comment": "Move rimraf to dependencies because it is used in the postinstall script.", - "dependencies": { -+ "@coder/logger": "^1.1.12", -+ "@coder/node-browser": "^1.0.8", -+ "@coder/requirefs": "^1.1.5", - "applicationinsights": "1.0.8", - "chokidar": "3.2.3", - "graceful-fs": "4.2.3", -@@ -59,6 +63,7 @@ - "native-keymap": "2.1.2", - "native-watchdog": "1.3.0", - "node-pty": "0.10.0-beta8", -+ "rimraf": "^2.2.8", - "semver-umd": "^5.5.7", - "spdlog": "^0.11.1", - "sudo-prompt": "9.1.1", -@@ -159,7 +164,6 @@ - "pump": "^1.0.1", - "queue": "3.0.6", - "rcedit": "^1.1.0", -- "rimraf": "^2.2.8", - "sinon": "^1.17.2", - "source-map": "^0.4.4", - "style-loader": "^1.0.0", -@@ -190,5 +194,8 @@ - "windows-foreground-love": "0.2.0", - "windows-mutex": "0.3.0", - "windows-process-tree": "0.2.4" -+ }, -+ "resolutions": { -+ "minimist": "^1.2.5" - } --} -\ No newline at end of file -+} -diff --git a/product.json b/product.json -index 2b884d18f3..518b935b83 100644 ---- a/product.json -+++ b/product.json -@@ -20,7 +20,7 @@ - "darwinBundleIdentifier": "com.visualstudio.code.oss", - "linuxIconName": "com.visualstudio.code.oss", - "licenseFileName": "LICENSE.txt", -- "reportIssueUrl": "https://github.com/Microsoft/vscode/issues/new", -+ "reportIssueUrl": "https://github.com/cdr/code-server/issues/new", - "urlProtocol": "code-oss", - "extensionAllowedProposedApi": [ - "ms-vscode.vscode-js-profile-flame", -diff --git a/remote/.yarnrc b/remote/.yarnrc -deleted file mode 100644 -index 1e16cde724..0000000000 ---- a/remote/.yarnrc -+++ /dev/null -@@ -1,3 +0,0 @@ --disturl "http://nodejs.org/dist" --target "12.4.0" --runtime "node" -diff --git a/src/vs/base/common/network.ts b/src/vs/base/common/network.ts -index 1286c5117a..e60dd11d03 100644 ---- a/src/vs/base/common/network.ts -+++ b/src/vs/base/common/network.ts -@@ -111,16 +111,17 @@ class RemoteAuthoritiesImpl { - if (host && host.indexOf(':') !== -1) { - host = `[${host}]`; - } -- const port = this._ports[authority]; -+ // const port = this._ports[authority]; - const connectionToken = this._connectionTokens[authority]; - let query = `path=${encodeURIComponent(uri.path)}`; - if (typeof connectionToken === 'string') { - query += `&tkn=${encodeURIComponent(connectionToken)}`; - } -+ // NOTE@coder: Changed this to work against the current path. - return URI.from({ - scheme: platform.isWeb ? this._preferredWebSchema : Schemas.vscodeRemoteResource, -- authority: `${host}:${port}`, -- path: `/vscode-remote-resource`, -+ authority: window.location.host, -+ path: `${window.location.pathname.replace(/\/+$/, '')}/vscode-remote-resource`, - query - }); - } -diff --git a/src/vs/base/common/platform.ts b/src/vs/base/common/platform.ts -index 0bbc5d6ef9..61f139b9c5 100644 ---- a/src/vs/base/common/platform.ts -+++ b/src/vs/base/common/platform.ts -@@ -59,6 +59,17 @@ if (typeof navigator === 'object' && !isElectronRenderer) { - _isWeb = true; - _locale = navigator.language; - _language = _locale; -+ // NOTE@coder: Make languages work. -+ const el = typeof document !== 'undefined' && document.getElementById('vscode-remote-nls-configuration'); -+ const rawNlsConfig = el && el.getAttribute('data-settings'); -+ if (rawNlsConfig) { -+ try { -+ const nlsConfig: NLSConfig = JSON.parse(rawNlsConfig); -+ _locale = nlsConfig.locale; -+ _translationsConfigFile = nlsConfig._translationsConfigFile; -+ _language = nlsConfig.availableLanguages['*'] || LANGUAGE_DEFAULT; -+ } catch (error) { /* Oh well. */ } -+ } - } else if (typeof process === 'object') { - _isWindows = (process.platform === 'win32'); - _isMacintosh = (process.platform === 'darwin'); -diff --git a/src/vs/base/common/processes.ts b/src/vs/base/common/processes.ts -index c52f7b3774..08a87fa970 100644 ---- a/src/vs/base/common/processes.ts -+++ b/src/vs/base/common/processes.ts -@@ -110,7 +110,8 @@ export function sanitizeProcessEnvironment(env: IProcessEnvironment, ...preserve - /^ELECTRON_.+$/, - /^GOOGLE_API_KEY$/, - /^VSCODE_.+$/, -- /^SNAP(|_.*)$/ -+ /^SNAP(|_.*)$/, -+ /^CODE_SERVER_.+$/, - ]; - const envKeys = Object.keys(env); - envKeys -diff --git a/src/vs/base/common/uriIpc.ts b/src/vs/base/common/uriIpc.ts -index ef2291d49b..29b2f9dfc2 100644 ---- a/src/vs/base/common/uriIpc.ts -+++ b/src/vs/base/common/uriIpc.ts -@@ -5,6 +5,7 @@ - - import { URI, UriComponents } from 'vs/base/common/uri'; - import { MarshalledObject } from 'vs/base/common/marshalling'; -+import { Schemas } from './network'; - - export interface IURITransformer { - transformIncoming(uri: UriComponents): UriComponents; -@@ -31,29 +32,35 @@ function toJSON(uri: URI): UriComponents { - - export class URITransformer implements IURITransformer { - -- private readonly _uriTransformer: IRawURITransformer; -- -- constructor(uriTransformer: IRawURITransformer) { -- this._uriTransformer = uriTransformer; -+ constructor(private readonly remoteAuthority: string) { - } - -+ // NOTE@coder: Coming in from the browser it'll be vscode-remote so it needs -+ // to be transformed into file. - public transformIncoming(uri: UriComponents): UriComponents { -- const result = this._uriTransformer.transformIncoming(uri); -- return (result === uri ? uri : toJSON(URI.from(result))); -+ return uri.scheme === Schemas.vscodeRemote -+ ? toJSON(URI.file(uri.path)) -+ : uri; - } - -+ // NOTE@coder: Going out to the browser it'll be file so it needs to be -+ // transformed into vscode-remote. - public transformOutgoing(uri: UriComponents): UriComponents { -- const result = this._uriTransformer.transformOutgoing(uri); -- return (result === uri ? uri : toJSON(URI.from(result))); -+ return uri.scheme === Schemas.file -+ ? toJSON(URI.from({ authority: this.remoteAuthority, scheme: Schemas.vscodeRemote, path: uri.path })) -+ : uri; - } - - public transformOutgoingURI(uri: URI): URI { -- const result = this._uriTransformer.transformOutgoing(uri); -- return (result === uri ? uri : URI.from(result)); -+ return uri.scheme === Schemas.file -+ ? URI.from({ authority: this.remoteAuthority, scheme: Schemas.vscodeRemote, path:uri.path }) -+ : uri; - } - - public transformOutgoingScheme(scheme: string): string { -- return this._uriTransformer.transformOutgoingScheme(scheme); -+ return scheme === Schemas.file -+ ? Schemas.vscodeRemote -+ : scheme; - } - } - -@@ -152,4 +159,4 @@ export function transformAndReviveIncomingURIs(obj: T, transformer: IURITrans - return obj; - } - return result; --} -\ No newline at end of file -+} -diff --git a/src/vs/base/node/languagePacks.js b/src/vs/base/node/languagePacks.js -index 2c64061da7..c0ef8faedd 100644 ---- a/src/vs/base/node/languagePacks.js -+++ b/src/vs/base/node/languagePacks.js -@@ -128,7 +128,10 @@ function factory(nodeRequire, path, fs, perf) { - function getLanguagePackConfigurations(userDataPath) { - const configFile = path.join(userDataPath, 'languagepacks.json'); - try { -- return nodeRequire(configFile); -+ // NOTE@coder: Swapped require with readFile since require is cached and -+ // we don't restart the server-side portion of code-server when the -+ // language changes. -+ return JSON.parse(fs.readFileSync(configFile, "utf8")); - } catch (err) { - // Do nothing. If we can't read the file we have no - // language pack config. -diff --git a/src/vs/code/browser/workbench/workbench.ts b/src/vs/code/browser/workbench/workbench.ts -index c629f7fffa..c266e1fb06 100644 ---- a/src/vs/code/browser/workbench/workbench.ts -+++ b/src/vs/code/browser/workbench/workbench.ts -@@ -13,6 +13,8 @@ import { isFolderToOpen, isWorkspaceToOpen } from 'vs/platform/windows/common/wi - import { isEqual } from 'vs/base/common/resources'; - import { isStandalone } from 'vs/base/browser/browser'; - import { localize } from 'vs/nls'; -+import { Schemas } from 'vs/base/common/network'; -+import { encodePath } from 'vs/server/node/util'; - - interface ICredential { - service: string; -@@ -243,12 +245,18 @@ class WorkspaceProvider implements IWorkspaceProvider { - - // Folder - else if (isFolderToOpen(workspace)) { -- targetHref = `${document.location.origin}${document.location.pathname}?${WorkspaceProvider.QUERY_PARAM_FOLDER}=${encodeURIComponent(workspace.folderUri.toString())}`; -+ const target = workspace.folderUri.scheme === Schemas.vscodeRemote -+ ? encodePath(workspace.folderUri.path) -+ : encodeURIComponent(workspace.folderUri.toString()); -+ targetHref = `${document.location.origin}${document.location.pathname}?${WorkspaceProvider.QUERY_PARAM_FOLDER}=${target}`; - } - - // Workspace - else if (isWorkspaceToOpen(workspace)) { -- targetHref = `${document.location.origin}${document.location.pathname}?${WorkspaceProvider.QUERY_PARAM_WORKSPACE}=${encodeURIComponent(workspace.workspaceUri.toString())}`; -+ const target = workspace.workspaceUri.scheme === Schemas.vscodeRemote -+ ? encodePath(workspace.workspaceUri.path) -+ : encodeURIComponent(workspace.workspaceUri.toString()); -+ targetHref = `${document.location.origin}${document.location.pathname}?${WorkspaceProvider.QUERY_PARAM_WORKSPACE}=${target}`; - } - - // Append payload if any -@@ -285,7 +293,22 @@ class WorkspaceProvider implements IWorkspaceProvider { - throw new Error('Missing web configuration element'); - } - -- const config: IWorkbenchConstructionOptions & { folderUri?: UriComponents, workspaceUri?: UriComponents } = JSON.parse(configElementAttribute); -+ const config: IWorkbenchConstructionOptions & { folderUri?: UriComponents, workspaceUri?: UriComponents } = { -+ webviewEndpoint: `${window.location.origin}${window.location.pathname.replace(/\/+$/, '')}/webview/`, -+ ...JSON.parse(configElementAttribute), -+ }; -+ -+ // Strip the protocol from the authority if it exists. -+ const normalizeAuthority = (authority: string): string => authority.replace(/^https?:\/\//, ""); -+ if (config.remoteAuthority) { -+ (config as any).remoteAuthority = normalizeAuthority(config.remoteAuthority); -+ } -+ if (config.workspaceUri && config.workspaceUri.authority) { -+ config.workspaceUri.authority = normalizeAuthority(config.workspaceUri.authority); -+ } -+ if (config.folderUri && config.folderUri.authority) { -+ config.folderUri.authority = normalizeAuthority(config.folderUri.authority); -+ } - - // Revive static extension locations - if (Array.isArray(config.staticExtensions)) { -@@ -297,40 +320,7 @@ class WorkspaceProvider implements IWorkspaceProvider { - // Find workspace to open and payload - let foundWorkspace = false; - let workspace: IWorkspace; -- let payload = Object.create(null); -- -- const query = new URL(document.location.href).searchParams; -- query.forEach((value, key) => { -- switch (key) { -- -- // Folder -- case WorkspaceProvider.QUERY_PARAM_FOLDER: -- workspace = { folderUri: URI.parse(value) }; -- foundWorkspace = true; -- break; -- -- // Workspace -- case WorkspaceProvider.QUERY_PARAM_WORKSPACE: -- workspace = { workspaceUri: URI.parse(value) }; -- foundWorkspace = true; -- break; -- -- // Empty -- case WorkspaceProvider.QUERY_PARAM_EMPTY_WINDOW: -- workspace = undefined; -- foundWorkspace = true; -- break; -- -- // Payload -- case WorkspaceProvider.QUERY_PARAM_PAYLOAD: -- try { -- payload = JSON.parse(value); -- } catch (error) { -- console.error(error); // possible invalid JSON -- } -- break; -- } -- }); -+ let payload = config.workspaceProvider?.payload || Object.create(null); - - // If no workspace is provided through the URL, check for config attribute from server - if (!foundWorkspace) { -diff --git a/src/vs/platform/environment/node/argv.ts b/src/vs/platform/environment/node/argv.ts -index 2379b626c8..28f8971cf3 100644 ---- a/src/vs/platform/environment/node/argv.ts -+++ b/src/vs/platform/environment/node/argv.ts -@@ -8,6 +8,8 @@ import { localize } from 'vs/nls'; - import { isWindows } from 'vs/base/common/platform'; - - export interface ParsedArgs { -+ 'extra-extensions-dir'?: string[]; -+ 'extra-builtin-extensions-dir'?: string[]; - _: string[]; - 'folder-uri'?: string[]; // undefined or array of 1 or more - 'file-uri'?: string[]; // undefined or array of 1 or more -@@ -141,6 +143,8 @@ export const OPTIONS: OptionDescriptions> = { - 'extensions-dir': { type: 'string', deprecates: 'extensionHomePath', cat: 'e', args: 'dir', description: localize('extensionHomePath', "Set the root path for extensions.") }, - 'extensions-download-dir': { type: 'string' }, - 'builtin-extensions-dir': { type: 'string' }, -+ 'extra-builtin-extensions-dir': { type: 'string[]', cat: 'o', description: 'Path to an extra builtin extension directory.' }, -+ 'extra-extensions-dir': { type: 'string[]', cat: 'o', description: 'Path to an extra user extension directory.' }, - 'list-extensions': { type: 'boolean', cat: 'e', description: localize('listExtensions', "List the installed extensions.") }, - 'show-versions': { type: 'boolean', cat: 'e', description: localize('showVersions', "Show versions of installed extensions, when using --list-extension.") }, - 'category': { type: 'string', cat: 'e', description: localize('category', "Filters installed extensions by provided category, when using --list-extension.") }, -@@ -403,4 +407,3 @@ export function buildHelpMessage(productName: string, executableName: string, ve - export function buildVersionMessage(version: string | undefined, commit: string | undefined): string { - return `${version || localize('unknownVersion', "Unknown version")}\n${commit || localize('unknownCommit', "Unknown commit")}\n${process.arch}`; - } -- -diff --git a/src/vs/platform/environment/node/environmentService.ts b/src/vs/platform/environment/node/environmentService.ts -index 5c0dc4ad4a..38b8c7573a 100644 ---- a/src/vs/platform/environment/node/environmentService.ts -+++ b/src/vs/platform/environment/node/environmentService.ts -@@ -38,6 +38,8 @@ export interface INativeEnvironmentService extends IEnvironmentService { - extensionsPath?: string; - extensionsDownloadPath: string; - builtinExtensionsPath: string; -+ extraExtensionPaths: string[]; -+ extraBuiltinExtensionPaths: string[]; - - driverHandle?: string; - driverVerbose: boolean; -@@ -180,6 +182,13 @@ export class EnvironmentService implements INativeEnvironmentService { - return resources.joinPath(this.userHome, product.dataFolderName, 'extensions').fsPath; - } - -+ @memoize get extraExtensionPaths(): string[] { -+ return (this._args['extra-extensions-dir'] || []).map((p) => parsePathArg(p, process)); -+ } -+ @memoize get extraBuiltinExtensionPaths(): string[] { -+ return (this._args['extra-builtin-extensions-dir'] || []).map((p) => parsePathArg(p, process)); -+ } -+ - @memoize - get extensionDevelopmentLocationURI(): URI[] | undefined { - const s = this._args.extensionDevelopmentPath; -diff --git a/src/vs/platform/extensionManagement/node/extensionsScanner.ts b/src/vs/platform/extensionManagement/node/extensionsScanner.ts -index 575b2aafc3..873181f967 100644 ---- a/src/vs/platform/extensionManagement/node/extensionsScanner.ts -+++ b/src/vs/platform/extensionManagement/node/extensionsScanner.ts -@@ -85,7 +85,7 @@ export class ExtensionsScanner extends Disposable { - } - - async scanAllUserExtensions(): Promise { -- return this.scanExtensionsInDir(this.extensionsPath, ExtensionType.User); -+ return this.scanExtensionsInDirs(this.extensionsPath, this.environmentService.extraExtensionPaths, ExtensionType.User); - } - - async extractUserExtension(identifierWithVersion: ExtensionIdentifierWithVersion, zipPath: string, token: CancellationToken): Promise { -@@ -211,7 +211,13 @@ export class ExtensionsScanner extends Disposable { - - private async scanExtensionsInDir(dir: string, type: ExtensionType): Promise { - const limiter = new Limiter(10); -- const extensionsFolders = await pfs.readdir(dir); -+ const extensionsFolders = await pfs.readdir(dir) -+ .catch((error) => { -+ if (error.code !== 'ENOENT') { -+ throw error; -+ } -+ return []; -+ }); - const extensions = await Promise.all(extensionsFolders.map(extensionFolder => limiter.queue(() => this.scanExtension(extensionFolder, dir, type)))); - return extensions.filter(e => e && e.identifier); - } -@@ -241,7 +247,7 @@ export class ExtensionsScanner extends Disposable { - } - - private async scanDefaultSystemExtensions(): Promise { -- const result = await this.scanExtensionsInDir(this.systemExtensionsPath, ExtensionType.System); -+ const result = await this.scanExtensionsInDirs(this.systemExtensionsPath, this.environmentService.extraBuiltinExtensionPaths, ExtensionType.System); - this.logService.trace('Scanned system extensions:', result.length); - return result; - } -@@ -345,4 +351,9 @@ export class ExtensionsScanner extends Disposable { - } - }); - } -+ -+ private async scanExtensionsInDirs(dir: string, dirs: string[], type: ExtensionType): Promise{ -+ const results = await Promise.all([dir, ...dirs].map((path) => this.scanExtensionsInDir(path, type))); -+ return results.reduce((flat, current) => flat.concat(current), []); -+ } - } -diff --git a/src/vs/platform/product/common/product.ts b/src/vs/platform/product/common/product.ts -index 3370a608b4..37b3592d39 100644 ---- a/src/vs/platform/product/common/product.ts -+++ b/src/vs/platform/product/common/product.ts -@@ -30,6 +30,12 @@ if (isWeb) { - ], - }); - } -+ // NOTE@coder: Add the ability to inject settings from the server. -+ const el = document.getElementById('vscode-remote-product-configuration'); -+ const rawProductConfiguration = el && el.getAttribute('data-settings'); -+ if (rawProductConfiguration) { -+ Object.assign(product, JSON.parse(rawProductConfiguration)); -+ } - } - - // Node: AMD loader -diff --git a/src/vs/platform/product/common/productService.ts b/src/vs/platform/product/common/productService.ts -index 040c869d94..bf16defcf7 100644 ---- a/src/vs/platform/product/common/productService.ts -+++ b/src/vs/platform/product/common/productService.ts -@@ -30,6 +30,8 @@ export type ConfigurationSyncStore = { - }; - - export interface IProductConfiguration { -+ readonly codeServerVersion?: string; -+ - readonly version: string; - readonly date?: string; - readonly quality?: string; -diff --git a/src/vs/platform/remote/browser/browserSocketFactory.ts b/src/vs/platform/remote/browser/browserSocketFactory.ts -index 3715cbb8e6..c65de8ad37 100644 ---- a/src/vs/platform/remote/browser/browserSocketFactory.ts -+++ b/src/vs/platform/remote/browser/browserSocketFactory.ts -@@ -208,7 +208,8 @@ export class BrowserSocketFactory implements ISocketFactory { - } - - connect(host: string, port: number, query: string, callback: IConnectCallback): void { -- const socket = this._webSocketFactory.create(`ws://${host}:${port}/?${query}&skipWebSocketFrames=false`); -+ // NOTE@coder: Modified to work against the current path. -+ const socket = this._webSocketFactory.create(`${window.location.protocol === 'https:' ? 'wss' : 'ws'}://${window.location.host}${window.location.pathname}?${query}&skipWebSocketFrames=false`); - const errorListener = socket.onError((err) => callback(err, undefined)); - socket.onOpen(() => { - errorListener.dispose(); -@@ -216,6 +217,3 @@ export class BrowserSocketFactory implements ISocketFactory { - }); - } - } -- -- -- -diff --git a/src/vs/platform/remote/common/remoteAgentConnection.ts b/src/vs/platform/remote/common/remoteAgentConnection.ts -index 2185bb5228..35463ca652 100644 ---- a/src/vs/platform/remote/common/remoteAgentConnection.ts -+++ b/src/vs/platform/remote/common/remoteAgentConnection.ts -@@ -89,7 +89,7 @@ async function connectToRemoteExtensionHostAgent(options: ISimpleConnectionOptio - options.socketFactory.connect( - options.host, - options.port, -- `reconnectionToken=${options.reconnectionToken}&reconnection=${options.reconnectionProtocol ? 'true' : 'false'}`, -+ `type=${connectionTypeToString(connectionType)}&reconnectionToken=${options.reconnectionToken}&reconnection=${options.reconnectionProtocol ? 'true' : 'false'}`, - (err: any, socket: ISocket | undefined) => { - if (err || !socket) { - options.logService.error(`${logPrefix} socketFactory.connect() failed. Error:`); -diff --git a/src/vs/server/browser/client.ts b/src/vs/server/browser/client.ts -new file mode 100644 -index 0000000000..3c0703b717 ---- /dev/null -+++ b/src/vs/server/browser/client.ts -@@ -0,0 +1,189 @@ -+import { Emitter } from 'vs/base/common/event'; -+import { URI } from 'vs/base/common/uri'; -+import { localize } from 'vs/nls'; -+import { Extensions, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry'; -+import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; -+import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; -+import { ILocalizationsService } from 'vs/platform/localizations/common/localizations'; -+import { INotificationService, Severity } from 'vs/platform/notification/common/notification'; -+import { Registry } from 'vs/platform/registry/common/platform'; -+import { PersistentConnectionEventType } from 'vs/platform/remote/common/remoteAgentConnection'; -+import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; -+import { INodeProxyService, NodeProxyChannelClient } from 'vs/server/common/nodeProxy'; -+import { TelemetryChannelClient } from 'vs/server/common/telemetry'; -+import 'vs/workbench/contrib/localizations/browser/localizations.contribution'; -+import { LocalizationsService } from 'vs/workbench/services/localizations/electron-browser/localizationsService'; -+import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService'; -+import { Options } from 'vs/server/ipc.d'; -+import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; -+ -+class TelemetryService extends TelemetryChannelClient { -+ public constructor( -+ @IRemoteAgentService remoteAgentService: IRemoteAgentService, -+ ) { -+ super(remoteAgentService.getConnection()!.getChannel('telemetry')); -+ } -+} -+ -+/** -+ * Remove extra slashes in a URL. -+ */ -+export const normalize = (url: string, keepTrailing = false): string => { -+ return url.replace(/\/\/+/g, "/").replace(/\/+$/, keepTrailing ? "/" : ""); -+}; -+ -+/** -+ * Get options embedded in the HTML. -+ */ -+export const getOptions = (): T => { -+ try { -+ return JSON.parse(document.getElementById("coder-options")!.getAttribute("data-settings")!); -+ } catch (error) { -+ return {} as T; -+ } -+}; -+ -+const options = getOptions(); -+ -+const TELEMETRY_SECTION_ID = 'telemetry'; -+Registry.as(Extensions.Configuration).registerConfiguration({ -+ 'id': TELEMETRY_SECTION_ID, -+ 'order': 110, -+ 'type': 'object', -+ 'title': localize('telemetryConfigurationTitle', 'Telemetry'), -+ 'properties': { -+ 'telemetry.enableTelemetry': { -+ 'type': 'boolean', -+ 'description': localize('telemetry.enableTelemetry', 'Enable usage data and errors to be sent to a Microsoft online service.'), -+ 'default': !options.disableTelemetry, -+ 'tags': ['usesOnlineServices'] -+ } -+ } -+}); -+ -+class NodeProxyService extends NodeProxyChannelClient implements INodeProxyService { -+ private readonly _onClose = new Emitter(); -+ public readonly onClose = this._onClose.event; -+ private readonly _onDown = new Emitter(); -+ public readonly onDown = this._onDown.event; -+ private readonly _onUp = new Emitter(); -+ public readonly onUp = this._onUp.event; -+ -+ public constructor( -+ @IRemoteAgentService remoteAgentService: IRemoteAgentService, -+ ) { -+ super(remoteAgentService.getConnection()!.getChannel('nodeProxy')); -+ remoteAgentService.getConnection()!.onDidStateChange((state) => { -+ switch (state.type) { -+ case PersistentConnectionEventType.ConnectionGain: -+ return this._onUp.fire(); -+ case PersistentConnectionEventType.ConnectionLost: -+ return this._onDown.fire(); -+ case PersistentConnectionEventType.ReconnectionPermanentFailure: -+ return this._onClose.fire(); -+ } -+ }); -+ } -+} -+ -+registerSingleton(ILocalizationsService, LocalizationsService); -+registerSingleton(INodeProxyService, NodeProxyService); -+registerSingleton(ITelemetryService, TelemetryService); -+ -+/** -+ * This is called by vs/workbench/browser/web.main.ts after the workbench has -+ * been initialized so we can initialize our own client-side code. -+ */ -+export const initialize = async (services: ServiceCollection): Promise => { -+ const event = new CustomEvent('ide-ready'); -+ window.dispatchEvent(event); -+ -+ if (parent) { -+ // Tell the parent loading has completed. -+ parent.postMessage({ event: 'loaded' }, window.location.origin); -+ -+ // Proxy or stop proxing events as requested by the parent. -+ const listeners = new Map void>(); -+ window.addEventListener('message', (parentEvent) => { -+ const eventName = parentEvent.data.bind || parentEvent.data.unbind; -+ if (eventName) { -+ const oldListener = listeners.get(eventName); -+ if (oldListener) { -+ document.removeEventListener(eventName, oldListener); -+ } -+ } -+ -+ if (parentEvent.data.bind && parentEvent.data.prop) { -+ const listener = (event: Event) => { -+ parent.postMessage({ -+ event: parentEvent.data.event, -+ [parentEvent.data.prop]: event[parentEvent.data.prop as keyof Event] -+ }, window.location.origin); -+ }; -+ listeners.set(parentEvent.data.bind, listener); -+ document.addEventListener(parentEvent.data.bind, listener); -+ } -+ }); -+ } -+ -+ if (!window.isSecureContext) { -+ (services.get(INotificationService) as INotificationService).notify({ -+ severity: Severity.Warning, -+ message: 'code-server is being accessed over an insecure domain. Web views, the clipboard, and other functionality will not work as expected.', -+ actions: { -+ primary: [{ -+ id: 'understand', -+ label: 'I understand', -+ tooltip: '', -+ class: undefined, -+ enabled: true, -+ checked: true, -+ dispose: () => undefined, -+ run: () => { -+ return Promise.resolve(); -+ } -+ }], -+ } -+ }); -+ } -+ -+ // This will be used to set the background color while VS Code loads. -+ const theme = (services.get(IStorageService) as IStorageService).get("colorThemeData", StorageScope.GLOBAL); -+ if (theme) { -+ localStorage.setItem("colorThemeData", theme); -+ } -+}; -+ -+export interface Query { -+ [key: string]: string | undefined; -+} -+ -+/** -+ * Split a string up to the delimiter. If the delimiter doesn't exist the first -+ * item will have all the text and the second item will be an empty string. -+ */ -+export const split = (str: string, delimiter: string): [string, string] => { -+ const index = str.indexOf(delimiter); -+ return index !== -1 ? [str.substring(0, index).trim(), str.substring(index + 1)] : [str, '']; -+}; -+ -+/** -+ * Return the URL modified with the specified query variables. It's pretty -+ * stupid so it probably doesn't cover any edge cases. Undefined values will -+ * unset existing values. Doesn't allow duplicates. -+ */ -+export const withQuery = (url: string, replace: Query): string => { -+ const uri = URI.parse(url); -+ const query = { ...replace }; -+ uri.query.split('&').forEach((kv) => { -+ const [key, value] = split(kv, '='); -+ if (!(key in query)) { -+ query[key] = value; -+ } -+ }); -+ return uri.with({ -+ query: Object.keys(query) -+ .filter((k) => typeof query[k] !== 'undefined') -+ .map((k) => `${k}=${query[k]}`).join('&'), -+ }).toString(true); -+}; -diff --git a/src/vs/server/browser/extHostNodeProxy.ts b/src/vs/server/browser/extHostNodeProxy.ts -new file mode 100644 -index 0000000000..ed7c078077 ---- /dev/null -+++ b/src/vs/server/browser/extHostNodeProxy.ts -@@ -0,0 +1,46 @@ -+import { Emitter } from 'vs/base/common/event'; -+import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; -+import { ExtHostNodeProxyShape, MainContext, MainThreadNodeProxyShape } from 'vs/workbench/api/common/extHost.protocol'; -+import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService'; -+ -+export class ExtHostNodeProxy implements ExtHostNodeProxyShape { -+ _serviceBrand: any; -+ -+ private readonly _onMessage = new Emitter(); -+ public readonly onMessage = this._onMessage.event; -+ private readonly _onClose = new Emitter(); -+ public readonly onClose = this._onClose.event; -+ private readonly _onDown = new Emitter(); -+ public readonly onDown = this._onDown.event; -+ private readonly _onUp = new Emitter(); -+ public readonly onUp = this._onUp.event; -+ -+ private readonly proxy: MainThreadNodeProxyShape; -+ -+ constructor(@IExtHostRpcService rpc: IExtHostRpcService) { -+ this.proxy = rpc.getProxy(MainContext.MainThreadNodeProxy); -+ } -+ -+ public $onMessage(message: string): void { -+ this._onMessage.fire(message); -+ } -+ -+ public $onClose(): void { -+ this._onClose.fire(); -+ } -+ -+ public $onUp(): void { -+ this._onUp.fire(); -+ } -+ -+ public $onDown(): void { -+ this._onDown.fire(); -+ } -+ -+ public send(message: string): void { -+ this.proxy.$send(message); -+ } -+} -+ -+export interface IExtHostNodeProxy extends ExtHostNodeProxy { } -+export const IExtHostNodeProxy = createDecorator('IExtHostNodeProxy'); -diff --git a/src/vs/server/browser/mainThreadNodeProxy.ts b/src/vs/server/browser/mainThreadNodeProxy.ts -new file mode 100644 -index 0000000000..0d2e93edae ---- /dev/null -+++ b/src/vs/server/browser/mainThreadNodeProxy.ts -@@ -0,0 +1,37 @@ -+import { IDisposable } from 'vs/base/common/lifecycle'; -+import { INodeProxyService } from 'vs/server/common/nodeProxy'; -+import { ExtHostContext, IExtHostContext, MainContext, MainThreadNodeProxyShape } from 'vs/workbench/api/common/extHost.protocol'; -+import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers'; -+ -+@extHostNamedCustomer(MainContext.MainThreadNodeProxy) -+export class MainThreadNodeProxy implements MainThreadNodeProxyShape { -+ private disposed = false; -+ private disposables = []; -+ -+ constructor( -+ extHostContext: IExtHostContext, -+ @INodeProxyService private readonly proxyService: INodeProxyService, -+ ) { -+ if (!extHostContext.remoteAuthority) { // HACK: A terrible way to detect if running in the worker. -+ const proxy = extHostContext.getProxy(ExtHostContext.ExtHostNodeProxy); -+ this.disposables = [ -+ this.proxyService.onMessage((message: string) => proxy.$onMessage(message)), -+ this.proxyService.onClose(() => proxy.$onClose()), -+ this.proxyService.onDown(() => proxy.$onDown()), -+ this.proxyService.onUp(() => proxy.$onUp()), -+ ]; -+ } -+ } -+ -+ $send(message: string): void { -+ if (!this.disposed) { -+ this.proxyService.send(message); -+ } -+ } -+ -+ dispose(): void { -+ this.disposables.forEach((d) => d.dispose()); -+ this.disposables = []; -+ this.disposed = true; -+ } -+} -diff --git a/src/vs/server/browser/worker.ts b/src/vs/server/browser/worker.ts -new file mode 100644 -index 0000000000..5ae44cdc85 ---- /dev/null -+++ b/src/vs/server/browser/worker.ts -@@ -0,0 +1,56 @@ -+import { Client } from '@coder/node-browser'; -+import { fromTar } from '@coder/requirefs'; -+import { URI } from 'vs/base/common/uri'; -+import { ILogService } from 'vs/platform/log/common/log'; -+import { ExtensionActivationTimesBuilder } from 'vs/workbench/api/common/extHostExtensionActivator'; -+import { IExtHostNodeProxy } from './extHostNodeProxy'; -+ -+export const loadCommonJSModule = async ( -+ module: URI, -+ activationTimesBuilder: ExtensionActivationTimesBuilder, -+ nodeProxy: IExtHostNodeProxy, -+ logService: ILogService, -+ vscode: any, -+): Promise => { -+ const fetchUri = URI.from({ -+ scheme: self.location.protocol.replace(':', ''), -+ authority: self.location.host, -+ path: self.location.pathname.replace(/\/static\/([^\/]+)\/.*$/, '/static/$1\/'), -+ query: `tar=${encodeURIComponent(module.path)}`, -+ }); -+ const response = await fetch(fetchUri.toString(true)); -+ if (response.status !== 200) { -+ throw new Error(`Failed to download extension "${module}"`); -+ } -+ const client = new Client(nodeProxy, { logger: logService }); -+ const init = await client.handshake(); -+ const buffer = new Uint8Array(await response.arrayBuffer()); -+ const rfs = fromTar(buffer); -+ (self).global = self; -+ rfs.provide('vscode', vscode); -+ Object.keys(client.modules).forEach((key) => { -+ const mod = (client.modules as any)[key]; -+ if (key === 'process') { -+ (self).process = mod; -+ (self).process.env = init.env; -+ return; -+ } -+ -+ rfs.provide(key, mod); -+ switch (key) { -+ case 'buffer': -+ (self).Buffer = mod.Buffer; -+ break; -+ case 'timers': -+ (self).setImmediate = mod.setImmediate; -+ break; -+ } -+ }); -+ -+ try { -+ activationTimesBuilder.codeLoadingStart(); -+ return rfs.require('.'); -+ } finally { -+ activationTimesBuilder.codeLoadingStop(); -+ } -+}; -diff --git a/src/vs/server/common/nodeProxy.ts b/src/vs/server/common/nodeProxy.ts -new file mode 100644 -index 0000000000..14b9de879c ---- /dev/null -+++ b/src/vs/server/common/nodeProxy.ts -@@ -0,0 +1,47 @@ -+import { ReadWriteConnection } from '@coder/node-browser'; -+import { Event } from 'vs/base/common/event'; -+import { IChannel, IServerChannel } from 'vs/base/parts/ipc/common/ipc'; -+import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; -+ -+export const INodeProxyService = createDecorator('nodeProxyService'); -+ -+export interface INodeProxyService extends ReadWriteConnection { -+ _serviceBrand: any; -+ send(message: string): void; -+ onMessage: Event; -+ onUp: Event; -+ onClose: Event; -+ onDown: Event; -+} -+ -+export class NodeProxyChannel implements IServerChannel { -+ constructor(private service: INodeProxyService) {} -+ -+ listen(_: unknown, event: string): Event { -+ switch (event) { -+ case 'onMessage': return this.service.onMessage; -+ } -+ throw new Error(`Invalid listen ${event}`); -+ } -+ -+ async call(_: unknown, command: string, args?: any): Promise { -+ switch (command) { -+ case 'send': return this.service.send(args[0]); -+ } -+ throw new Error(`Invalid call ${command}`); -+ } -+} -+ -+export class NodeProxyChannelClient { -+ _serviceBrand: any; -+ -+ public readonly onMessage: Event; -+ -+ constructor(private readonly channel: IChannel) { -+ this.onMessage = this.channel.listen('onMessage'); -+ } -+ -+ public send(data: string): void { -+ this.channel.call('send', [data]); -+ } -+} -diff --git a/src/vs/server/common/telemetry.ts b/src/vs/server/common/telemetry.ts -new file mode 100644 -index 0000000000..4ea6d95d36 ---- /dev/null -+++ b/src/vs/server/common/telemetry.ts -@@ -0,0 +1,65 @@ -+import { ITelemetryData } from 'vs/base/common/actions'; -+import { Event } from 'vs/base/common/event'; -+import { IChannel, IServerChannel } from 'vs/base/parts/ipc/common/ipc'; -+import { ClassifiedEvent, GDPRClassification, StrictPropertyCheck } from 'vs/platform/telemetry/common/gdprTypings'; -+import { ITelemetryInfo, ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; -+ -+export class TelemetryChannel implements IServerChannel { -+ constructor(private service: ITelemetryService) {} -+ -+ listen(_: unknown, event: string): Event { -+ throw new Error(`Invalid listen ${event}`); -+ } -+ -+ call(_: unknown, command: string, args?: any): Promise { -+ switch (command) { -+ case 'publicLog': return this.service.publicLog(args[0], args[1], args[2]); -+ case 'publicLog2': return this.service.publicLog2(args[0], args[1], args[2]); -+ case 'publicLogError': return this.service.publicLogError(args[0], args[1]); -+ case 'publicLogError2': return this.service.publicLogError2(args[0], args[1]); -+ case 'setEnabled': return Promise.resolve(this.service.setEnabled(args[0])); -+ case 'getTelemetryInfo': return this.service.getTelemetryInfo(); -+ case 'setExperimentProperty': return Promise.resolve(this.service.setExperimentProperty(args[0], args[1])); -+ } -+ throw new Error(`Invalid call ${command}`); -+ } -+} -+ -+export class TelemetryChannelClient implements ITelemetryService { -+ _serviceBrand: any; -+ -+ // These don't matter; telemetry is sent to the Node side which decides -+ // whether to send the telemetry event. -+ public isOptedIn = true; -+ public sendErrorTelemetry = true; -+ -+ constructor(private readonly channel: IChannel) {} -+ -+ public publicLog(eventName: string, data?: ITelemetryData, anonymizeFilePaths?: boolean): Promise { -+ return this.channel.call('publicLog', [eventName, data, anonymizeFilePaths]); -+ } -+ -+ public publicLog2 = never, T extends GDPRClassification = never>(eventName: string, data?: StrictPropertyCheck, anonymizeFilePaths?: boolean): Promise { -+ return this.channel.call('publicLog2', [eventName, data, anonymizeFilePaths]); -+ } -+ -+ public publicLogError(errorEventName: string, data?: ITelemetryData): Promise { -+ return this.channel.call('publicLogError', [errorEventName, data]); -+ } -+ -+ public publicLogError2 = never, T extends GDPRClassification = never>(eventName: string, data?: StrictPropertyCheck): Promise { -+ return this.channel.call('publicLogError2', [eventName, data]); -+ } -+ -+ public setEnabled(value: boolean): void { -+ this.channel.call('setEnable', [value]); -+ } -+ -+ public getTelemetryInfo(): Promise { -+ return this.channel.call('getTelemetryInfo'); -+ } -+ -+ public setExperimentProperty(name: string, value: string): void { -+ this.channel.call('setExperimentProperty', [name, value]); -+ } -+} -diff --git a/src/vs/server/entry.ts b/src/vs/server/entry.ts -new file mode 100644 -index 0000000000..ab020fbb4e ---- /dev/null -+++ b/src/vs/server/entry.ts -@@ -0,0 +1,78 @@ -+import { field } from '@coder/logger'; -+import { setUnexpectedErrorHandler } from 'vs/base/common/errors'; -+import { CodeServerMessage, VscodeMessage } from 'vs/server/ipc'; -+import { logger } from 'vs/server/node/logger'; -+import { enableCustomMarketplace } from 'vs/server/node/marketplace'; -+import { Vscode } from 'vs/server/node/server'; -+ -+setUnexpectedErrorHandler((error) => logger.warn(error instanceof Error ? error.message : error)); -+enableCustomMarketplace(); -+ -+/** -+ * Ensure we control when the process exits. -+ */ -+const exit = process.exit; -+process.exit = function(code?: number) { -+ logger.warn(`process.exit() was prevented: ${code || 'unknown code'}.`); -+} as (code?: number) => never; -+ -+// Kill VS Code if the parent process dies. -+if (typeof process.env.CODE_SERVER_PARENT_PID !== 'undefined') { -+ const parentPid = parseInt(process.env.CODE_SERVER_PARENT_PID, 10); -+ setInterval(() => { -+ try { -+ process.kill(parentPid, 0); // Throws an exception if the process doesn't exist anymore. -+ } catch (e) { -+ exit(); -+ } -+ }, 5000); -+} else { -+ logger.error('no parent process'); -+ exit(1); -+} -+ -+const vscode = new Vscode(); -+const send = (message: VscodeMessage): void => { -+ if (!process.send) { -+ throw new Error('not spawned with IPC'); -+ } -+ process.send(message); -+}; -+ -+// Wait for the init message then start up VS Code. Subsequent messages will -+// return new workbench options without starting a new instance. -+process.on('message', async (message: CodeServerMessage, socket) => { -+ logger.debug('got message from code-server', field('message', message)); -+ switch (message.type) { -+ case 'init': -+ try { -+ const options = await vscode.initialize(message.options); -+ send({ type: 'options', id: message.id, options }); -+ } catch (error) { -+ logger.error(error.message); -+ logger.error(error.stack); -+ exit(1); -+ } -+ break; -+ case 'cli': -+ try { -+ await vscode.cli(message.args); -+ exit(0); -+ } catch (error) { -+ logger.error(error.message); -+ logger.error(error.stack); -+ exit(1); -+ } -+ break; -+ case 'socket': -+ vscode.handleWebSocket(socket, message.query); -+ break; -+ } -+}); -+if (!process.send) { -+ logger.error('not spawned with IPC'); -+ exit(1); -+} else { -+ // This lets the parent know the child is ready to receive messages. -+ send({ type: 'ready' }); -+} -diff --git a/src/vs/server/fork.js b/src/vs/server/fork.js -new file mode 100644 -index 0000000000..56331ff1fc ---- /dev/null -+++ b/src/vs/server/fork.js -@@ -0,0 +1,3 @@ -+// This must be a JS file otherwise when it gets compiled it turns into AMD -+// syntax which will not work without the right loader. -+require('../../bootstrap-amd').load('vs/server/entry'); -diff --git a/src/vs/server/ipc.d.ts b/src/vs/server/ipc.d.ts -new file mode 100644 -index 0000000000..7e1cd270c8 ---- /dev/null -+++ b/src/vs/server/ipc.d.ts -@@ -0,0 +1,115 @@ -+/** -+ * External interfaces for integration into code-server over IPC. No vs imports -+ * should be made in this file. -+ */ -+export interface Options { -+ disableTelemetry: boolean -+} -+ -+export interface InitMessage { -+ type: 'init'; -+ id: string; -+ options: VscodeOptions; -+} -+ -+export type Query = { [key: string]: string | string[] | undefined }; -+ -+export interface SocketMessage { -+ type: 'socket'; -+ query: Query; -+} -+ -+export interface CliMessage { -+ type: 'cli'; -+ args: Args; -+} -+ -+export type CodeServerMessage = InitMessage | SocketMessage | CliMessage; -+ -+export interface ReadyMessage { -+ type: 'ready'; -+} -+ -+export interface OptionsMessage { -+ id: string; -+ type: 'options'; -+ options: WorkbenchOptions; -+} -+ -+export type VscodeMessage = ReadyMessage | OptionsMessage; -+ -+export interface StartPath { -+ url: string; -+ workspace: boolean; -+} -+ -+export interface Args { -+ 'user-data-dir'?: string; -+ -+ 'extensions-dir'?: string; -+ 'builtin-extensions-dir'?: string; -+ 'extra-extensions-dir'?: string[]; -+ 'extra-builtin-extensions-dir'?: string[]; -+ -+ locale?: string -+ -+ log?: string; -+ verbose?: boolean; -+ -+ _: string[]; -+} -+ -+export interface VscodeOptions { -+ readonly args: Args; -+ readonly remoteAuthority: string; -+ readonly startPath?: StartPath; -+} -+ -+export interface VscodeOptionsMessage extends VscodeOptions { -+ readonly id: string; -+} -+ -+export interface UriComponents { -+ readonly scheme: string; -+ readonly authority: string; -+ readonly path: string; -+ readonly query: string; -+ readonly fragment: string; -+} -+ -+export interface NLSConfiguration { -+ locale: string; -+ availableLanguages: { -+ [key: string]: string; -+ }; -+ pseudo?: boolean; -+ _languagePackSupport?: boolean; -+} -+ -+export interface WorkbenchOptions { -+ readonly workbenchWebConfiguration: { -+ readonly remoteAuthority?: string; -+ readonly folderUri?: UriComponents; -+ readonly workspaceUri?: UriComponents; -+ readonly logLevel?: number; -+ readonly workspaceProvider?: { -+ payload: [["userDataPath", string]]; -+ }; -+ }; -+ readonly remoteUserDataUri: UriComponents; -+ readonly productConfiguration: { -+ codeServerVersion?: string; -+ readonly extensionsGallery?: { -+ readonly serviceUrl: string; -+ readonly itemUrl: string; -+ readonly controlUrl: string; -+ readonly recommendationsUrl: string; -+ }; -+ }; -+ readonly nlsConfiguration: NLSConfiguration; -+ readonly commit: string; -+} -+ -+export interface WorkbenchOptionsMessage { -+ id: string; -+} -diff --git a/src/vs/server/node/channel.ts b/src/vs/server/node/channel.ts -new file mode 100644 -index 0000000000..e10cc9c218 ---- /dev/null -+++ b/src/vs/server/node/channel.ts -@@ -0,0 +1,360 @@ -+import { Server } from '@coder/node-browser'; -+import * as path from 'path'; -+import { VSBuffer } from 'vs/base/common/buffer'; -+import { CancellationTokenSource } from 'vs/base/common/cancellation'; -+import { Emitter, Event } from 'vs/base/common/event'; -+import { IDisposable } from 'vs/base/common/lifecycle'; -+import { OS } from 'vs/base/common/platform'; -+import { ReadableStreamEventPayload } from 'vs/base/common/stream'; -+import { URI, UriComponents } from 'vs/base/common/uri'; -+import { transformOutgoingURIs } from 'vs/base/common/uriIpc'; -+import { IServerChannel } from 'vs/base/parts/ipc/common/ipc'; -+import { IDiagnosticInfo } from 'vs/platform/diagnostics/common/diagnostics'; -+import { INativeEnvironmentService } from 'vs/platform/environment/node/environmentService'; -+import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensions/common/extensions'; -+import { FileDeleteOptions, FileOpenOptions, FileOverwriteOptions, FileReadStreamOptions, FileType, FileWriteOptions, IStat, IWatchOptions } from 'vs/platform/files/common/files'; -+import { DiskFileSystemProvider } from 'vs/platform/files/node/diskFileSystemProvider'; -+import { ILogService } from 'vs/platform/log/common/log'; -+import product from 'vs/platform/product/common/product'; -+import { IRemoteAgentEnvironment, RemoteAgentConnectionContext } from 'vs/platform/remote/common/remoteAgentEnvironment'; -+import { ITelemetryData, ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; -+import { INodeProxyService } from 'vs/server/common/nodeProxy'; -+import { getTranslations } from 'vs/server/node/nls'; -+import { getUriTransformer } from 'vs/server/node/util'; -+import { IFileChangeDto } from 'vs/workbench/api/common/extHost.protocol'; -+import { ExtensionScanner, ExtensionScannerInput } from 'vs/workbench/services/extensions/node/extensionPoints'; -+ -+/** -+ * Extend the file provider to allow unwatching. -+ */ -+class Watcher extends DiskFileSystemProvider { -+ public readonly watches = new Map(); -+ -+ public dispose(): void { -+ this.watches.forEach((w) => w.dispose()); -+ this.watches.clear(); -+ super.dispose(); -+ } -+ -+ public _watch(req: number, resource: URI, opts: IWatchOptions): void { -+ this.watches.set(req, this.watch(resource, opts)); -+ } -+ -+ public unwatch(req: number): void { -+ this.watches.get(req)!.dispose(); -+ this.watches.delete(req); -+ } -+} -+ -+export class FileProviderChannel implements IServerChannel, IDisposable { -+ private readonly provider: DiskFileSystemProvider; -+ private readonly watchers = new Map(); -+ -+ public constructor( -+ private readonly environmentService: INativeEnvironmentService, -+ private readonly logService: ILogService, -+ ) { -+ this.provider = new DiskFileSystemProvider(this.logService); -+ } -+ -+ public listen(context: RemoteAgentConnectionContext, event: string, args?: any): Event { -+ switch (event) { -+ case 'filechange': return this.filechange(context, args[0]); -+ case 'readFileStream': return this.readFileStream(args[0], args[1]); -+ } -+ -+ throw new Error(`Invalid listen '${event}'`); -+ } -+ -+ private filechange(context: RemoteAgentConnectionContext, session: string): Event { -+ const emitter = new Emitter({ -+ onFirstListenerAdd: () => { -+ const provider = new Watcher(this.logService); -+ this.watchers.set(session, provider); -+ const transformer = getUriTransformer(context.remoteAuthority); -+ provider.onDidChangeFile((events) => { -+ emitter.fire(events.map((event) => ({ -+ ...event, -+ resource: transformer.transformOutgoing(event.resource), -+ }))); -+ }); -+ provider.onDidErrorOccur((event) => this.logService.error(event)); -+ }, -+ onLastListenerRemove: () => { -+ this.watchers.get(session)!.dispose(); -+ this.watchers.delete(session); -+ }, -+ }); -+ -+ return emitter.event; -+ } -+ -+ private readFileStream(resource: UriComponents, opts: FileReadStreamOptions): Event> { -+ const cts = new CancellationTokenSource(); -+ const fileStream = this.provider.readFileStream(this.transform(resource), opts, cts.token); -+ const emitter = new Emitter>({ -+ onFirstListenerAdd: () => { -+ fileStream.on('data', (data) => emitter.fire(VSBuffer.wrap(data))); -+ fileStream.on('error', (error) => emitter.fire(error)); -+ fileStream.on('end', () => emitter.fire('end')); -+ }, -+ onLastListenerRemove: () => cts.cancel(), -+ }); -+ -+ return emitter.event; -+ } -+ -+ public call(_: unknown, command: string, args?: any): Promise { -+ switch (command) { -+ case 'stat': return this.stat(args[0]); -+ case 'open': return this.open(args[0], args[1]); -+ case 'close': return this.close(args[0]); -+ case 'read': return this.read(args[0], args[1], args[2]); -+ case 'readFile': return this.readFile(args[0]); -+ case 'write': return this.write(args[0], args[1], args[2], args[3], args[4]); -+ case 'writeFile': return this.writeFile(args[0], args[1], args[2]); -+ case 'delete': return this.delete(args[0], args[1]); -+ case 'mkdir': return this.mkdir(args[0]); -+ case 'readdir': return this.readdir(args[0]); -+ case 'rename': return this.rename(args[0], args[1], args[2]); -+ case 'copy': return this.copy(args[0], args[1], args[2]); -+ case 'watch': return this.watch(args[0], args[1], args[2], args[3]); -+ case 'unwatch': return this.unwatch(args[0], args[1]); -+ } -+ -+ throw new Error(`Invalid call '${command}'`); -+ } -+ -+ public dispose(): void { -+ this.watchers.forEach((w) => w.dispose()); -+ this.watchers.clear(); -+ } -+ -+ private async stat(resource: UriComponents): Promise { -+ return this.provider.stat(this.transform(resource)); -+ } -+ -+ private async open(resource: UriComponents, opts: FileOpenOptions): Promise { -+ return this.provider.open(this.transform(resource), opts); -+ } -+ -+ private async close(fd: number): Promise { -+ return this.provider.close(fd); -+ } -+ -+ private async read(fd: number, pos: number, length: number): Promise<[VSBuffer, number]> { -+ const buffer = VSBuffer.alloc(length); -+ const bytesRead = await this.provider.read(fd, pos, buffer.buffer, 0, length); -+ return [buffer, bytesRead]; -+ } -+ -+ private async readFile(resource: UriComponents): Promise { -+ return VSBuffer.wrap(await this.provider.readFile(this.transform(resource))); -+ } -+ -+ private write(fd: number, pos: number, buffer: VSBuffer, offset: number, length: number): Promise { -+ return this.provider.write(fd, pos, buffer.buffer, offset, length); -+ } -+ -+ private writeFile(resource: UriComponents, buffer: VSBuffer, opts: FileWriteOptions): Promise { -+ return this.provider.writeFile(this.transform(resource), buffer.buffer, opts); -+ } -+ -+ private async delete(resource: UriComponents, opts: FileDeleteOptions): Promise { -+ return this.provider.delete(this.transform(resource), opts); -+ } -+ -+ private async mkdir(resource: UriComponents): Promise { -+ return this.provider.mkdir(this.transform(resource)); -+ } -+ -+ private async readdir(resource: UriComponents): Promise<[string, FileType][]> { -+ return this.provider.readdir(this.transform(resource)); -+ } -+ -+ private async rename(resource: UriComponents, target: UriComponents, opts: FileOverwriteOptions): Promise { -+ return this.provider.rename(this.transform(resource), URI.from(target), opts); -+ } -+ -+ private copy(resource: UriComponents, target: UriComponents, opts: FileOverwriteOptions): Promise { -+ return this.provider.copy(this.transform(resource), URI.from(target), opts); -+ } -+ -+ private async watch(session: string, req: number, resource: UriComponents, opts: IWatchOptions): Promise { -+ this.watchers.get(session)!._watch(req, this.transform(resource), opts); -+ } -+ -+ private async unwatch(session: string, req: number): Promise { -+ this.watchers.get(session)!.unwatch(req); -+ } -+ -+ private transform(resource: UriComponents): URI { -+ // Used for walkthrough content. -+ if (/^\/static[^/]*\//.test(resource.path)) { -+ return URI.file(this.environmentService.appRoot + resource.path.replace(/^\/static[^/]*\//, '/')); -+ // Used by the webview service worker to load resources. -+ } else if (resource.path === '/vscode-resource' && resource.query) { -+ try { -+ const query = JSON.parse(resource.query); -+ if (query.requestResourcePath) { -+ return URI.file(query.requestResourcePath); -+ } -+ } catch (error) { /* Carry on. */ } -+ } -+ return URI.from(resource); -+ } -+} -+ -+// See ../../workbench/services/remote/common/remoteAgentEnvironmentChannel.ts -+export class ExtensionEnvironmentChannel implements IServerChannel { -+ public constructor( -+ private readonly environment: INativeEnvironmentService, -+ private readonly log: ILogService, -+ private readonly telemetry: ITelemetryService, -+ private readonly connectionToken: string, -+ ) {} -+ -+ public listen(_: unknown, event: string): Event { -+ throw new Error(`Invalid listen '${event}'`); -+ } -+ -+ public async call(context: any, command: string, args: any): Promise { -+ switch (command) { -+ case 'getEnvironmentData': -+ return transformOutgoingURIs( -+ await this.getEnvironmentData(), -+ getUriTransformer(context.remoteAuthority), -+ ); -+ case 'scanExtensions': -+ return transformOutgoingURIs( -+ await this.scanExtensions(args.language), -+ getUriTransformer(context.remoteAuthority), -+ ); -+ case 'getDiagnosticInfo': return this.getDiagnosticInfo(); -+ case 'disableTelemetry': return this.disableTelemetry(); -+ case 'logTelemetry': return this.logTelemetry(args[0], args[1]); -+ case 'flushTelemetry': return this.flushTelemetry(); -+ } -+ throw new Error(`Invalid call '${command}'`); -+ } -+ -+ private async getEnvironmentData(): Promise { -+ return { -+ pid: process.pid, -+ connectionToken: this.connectionToken, -+ appRoot: URI.file(this.environment.appRoot), -+ settingsPath: this.environment.settingsResource, -+ logsPath: URI.file(this.environment.logsPath), -+ extensionsPath: URI.file(this.environment.extensionsPath!), -+ extensionHostLogsPath: URI.file(path.join(this.environment.logsPath, 'extension-host')), -+ globalStorageHome: this.environment.globalStorageHome, -+ workspaceStorageHome: this.environment.workspaceStorageHome, -+ userHome: this.environment.userHome, -+ os: OS, -+ }; -+ } -+ -+ private async scanExtensions(language: string): Promise { -+ const translations = await getTranslations(language, this.environment.userDataPath); -+ -+ const scanMultiple = (isBuiltin: boolean, isUnderDevelopment: boolean, paths: string[]): Promise => { -+ return Promise.all(paths.map((path) => { -+ return ExtensionScanner.scanExtensions(new ExtensionScannerInput( -+ product.version, -+ product.commit, -+ language, -+ !!process.env.VSCODE_DEV, -+ path, -+ isBuiltin, -+ isUnderDevelopment, -+ translations, -+ ), this.log); -+ })); -+ }; -+ -+ const scanBuiltin = async (): Promise => { -+ return scanMultiple(true, false, [this.environment.builtinExtensionsPath, ...this.environment.extraBuiltinExtensionPaths]); -+ }; -+ -+ const scanInstalled = async (): Promise => { -+ return scanMultiple(false, true, [this.environment.extensionsPath!, ...this.environment.extraExtensionPaths]); -+ }; -+ -+ return Promise.all([scanBuiltin(), scanInstalled()]).then((allExtensions) => { -+ const uniqueExtensions = new Map(); -+ allExtensions.forEach((multipleExtensions) => { -+ multipleExtensions.forEach((extensions) => { -+ extensions.forEach((extension) => { -+ const id = ExtensionIdentifier.toKey(extension.identifier); -+ if (uniqueExtensions.has(id)) { -+ const oldPath = uniqueExtensions.get(id)!.extensionLocation.fsPath; -+ const newPath = extension.extensionLocation.fsPath; -+ this.log.warn(`${oldPath} has been overridden ${newPath}`); -+ } -+ uniqueExtensions.set(id, { -+ ...extension, -+ // Force extensions that should run on the client due to latency -+ // issues. -+ extensionKind: extension.identifier.value === 'vscodevim.vim' -+ ? [ 'web' ] -+ : extension.extensionKind, -+ }); -+ }); -+ }); -+ }); -+ return Array.from(uniqueExtensions.values()); -+ }); -+ } -+ -+ private getDiagnosticInfo(): Promise { -+ throw new Error('not implemented'); -+ } -+ -+ private async disableTelemetry(): Promise { -+ this.telemetry.setEnabled(false); -+ } -+ -+ private async logTelemetry(eventName: string, data: ITelemetryData): Promise { -+ this.telemetry.publicLog(eventName, data); -+ } -+ -+ private async flushTelemetry(): Promise { -+ // We always send immediately at the moment. -+ } -+} -+ -+export class NodeProxyService implements INodeProxyService { -+ public _serviceBrand = undefined; -+ -+ public readonly server: Server; -+ -+ private readonly _onMessage = new Emitter(); -+ public readonly onMessage = this._onMessage.event; -+ private readonly _$onMessage = new Emitter(); -+ public readonly $onMessage = this._$onMessage.event; -+ public readonly _onDown = new Emitter(); -+ public readonly onDown = this._onDown.event; -+ public readonly _onUp = new Emitter(); -+ public readonly onUp = this._onUp.event; -+ -+ // Unused because the server connection will never permanently close. -+ private readonly _onClose = new Emitter(); -+ public readonly onClose = this._onClose.event; -+ -+ public constructor() { -+ // TODO: down/up -+ this.server = new Server({ -+ onMessage: this.$onMessage, -+ onClose: this.onClose, -+ onDown: this.onDown, -+ onUp: this.onUp, -+ send: (message: string): void => { -+ this._onMessage.fire(message); -+ } -+ }); -+ } -+ -+ public send(message: string): void { -+ this._$onMessage.fire(message); -+ } -+} -diff --git a/src/vs/server/node/connection.ts b/src/vs/server/node/connection.ts -new file mode 100644 -index 0000000000..36e80fb696 ---- /dev/null -+++ b/src/vs/server/node/connection.ts -@@ -0,0 +1,157 @@ -+import * as cp from 'child_process'; -+import { getPathFromAmdModule } from 'vs/base/common/amd'; -+import { VSBuffer } from 'vs/base/common/buffer'; -+import { Emitter } from 'vs/base/common/event'; -+import { ISocket } from 'vs/base/parts/ipc/common/ipc.net'; -+import { NodeSocket } from 'vs/base/parts/ipc/node/ipc.net'; -+import { INativeEnvironmentService } from 'vs/platform/environment/node/environmentService'; -+import { ILogService } from 'vs/platform/log/common/log'; -+import { getNlsConfiguration } from 'vs/server/node/nls'; -+import { Protocol } from 'vs/server/node/protocol'; -+import { IExtHostReadyMessage } from 'vs/workbench/services/extensions/common/extensionHostProtocol'; -+ -+export abstract class Connection { -+ private readonly _onClose = new Emitter(); -+ public readonly onClose = this._onClose.event; -+ private disposed = false; -+ private _offline: number | undefined; -+ -+ public constructor(protected protocol: Protocol, public readonly token: string) {} -+ -+ public get offline(): number | undefined { -+ return this._offline; -+ } -+ -+ public reconnect(socket: ISocket, buffer: VSBuffer): void { -+ this._offline = undefined; -+ this.doReconnect(socket, buffer); -+ } -+ -+ public dispose(): void { -+ if (!this.disposed) { -+ this.disposed = true; -+ this.doDispose(); -+ this._onClose.fire(); -+ } -+ } -+ -+ protected setOffline(): void { -+ if (!this._offline) { -+ this._offline = Date.now(); -+ } -+ } -+ -+ /** -+ * Set up the connection on a new socket. -+ */ -+ protected abstract doReconnect(socket: ISocket, buffer: VSBuffer): void; -+ protected abstract doDispose(): void; -+} -+ -+/** -+ * Used for all the IPC channels. -+ */ -+export class ManagementConnection extends Connection { -+ public constructor(protected protocol: Protocol, token: string) { -+ super(protocol, token); -+ protocol.onClose(() => this.dispose()); // Explicit close. -+ protocol.onSocketClose(() => this.setOffline()); // Might reconnect. -+ } -+ -+ protected doDispose(): void { -+ this.protocol.sendDisconnect(); -+ this.protocol.dispose(); -+ this.protocol.getUnderlyingSocket().destroy(); -+ } -+ -+ protected doReconnect(socket: ISocket, buffer: VSBuffer): void { -+ this.protocol.beginAcceptReconnection(socket, buffer); -+ this.protocol.endAcceptReconnection(); -+ } -+} -+ -+export class ExtensionHostConnection extends Connection { -+ private process?: cp.ChildProcess; -+ -+ public constructor( -+ locale:string, protocol: Protocol, buffer: VSBuffer, token: string, -+ private readonly log: ILogService, -+ private readonly environment: INativeEnvironmentService, -+ ) { -+ super(protocol, token); -+ this.protocol.dispose(); -+ this.spawn(locale, buffer).then((p) => this.process = p); -+ this.protocol.getUnderlyingSocket().pause(); -+ } -+ -+ protected doDispose(): void { -+ if (this.process) { -+ this.process.kill(); -+ } -+ this.protocol.getUnderlyingSocket().destroy(); -+ } -+ -+ protected doReconnect(socket: ISocket, buffer: VSBuffer): void { -+ // This is just to set the new socket. -+ this.protocol.beginAcceptReconnection(socket, null); -+ this.protocol.dispose(); -+ this.sendInitMessage(buffer); -+ } -+ -+ private sendInitMessage(buffer: VSBuffer): void { -+ const socket = this.protocol.getUnderlyingSocket(); -+ socket.pause(); -+ this.process!.send({ // Process must be set at this point. -+ type: 'VSCODE_EXTHOST_IPC_SOCKET', -+ initialDataChunk: (buffer.buffer as Buffer).toString('base64'), -+ skipWebSocketFrames: this.protocol.getSocket() instanceof NodeSocket, -+ }, socket); -+ } -+ -+ private async spawn(locale: string, buffer: VSBuffer): Promise { -+ const config = await getNlsConfiguration(locale, this.environment.userDataPath); -+ const proc = cp.fork( -+ getPathFromAmdModule(require, 'bootstrap-fork'), -+ [ '--type=extensionHost' ], -+ { -+ env: { -+ ...process.env, -+ AMD_ENTRYPOINT: 'vs/workbench/services/extensions/node/extensionHostProcess', -+ PIPE_LOGGING: 'true', -+ VERBOSE_LOGGING: 'true', -+ VSCODE_EXTHOST_WILL_SEND_SOCKET: 'true', -+ VSCODE_HANDLES_UNCAUGHT_ERRORS: 'true', -+ VSCODE_LOG_STACK: 'false', -+ VSCODE_LOG_LEVEL: process.env.LOG_LEVEL, -+ VSCODE_NLS_CONFIG: JSON.stringify(config), -+ }, -+ silent: true, -+ }, -+ ); -+ -+ proc.on('error', () => this.dispose()); -+ proc.on('exit', () => this.dispose()); -+ if (proc.stdout && proc.stderr) { -+ proc.stdout.setEncoding('utf8').on('data', (d) => this.log.info('Extension host stdout', d)); -+ proc.stderr.setEncoding('utf8').on('data', (d) => this.log.error('Extension host stderr', d)); -+ } -+ proc.on('message', (event) => { -+ if (event && event.type === '__$console') { -+ const severity = (this.log)[event.severity] ? event.severity : 'info'; -+ (this.log)[severity]('Extension host', event.arguments); -+ } -+ if (event && event.type === 'VSCODE_EXTHOST_DISCONNECTED') { -+ this.setOffline(); -+ } -+ }); -+ -+ const listen = (message: IExtHostReadyMessage) => { -+ if (message.type === 'VSCODE_EXTHOST_IPC_READY') { -+ proc.removeListener('message', listen); -+ this.sendInitMessage(buffer); -+ } -+ }; -+ -+ return proc.on('message', listen); -+ } -+} -diff --git a/src/vs/server/node/insights.ts b/src/vs/server/node/insights.ts -new file mode 100644 -index 0000000000..a0ece345f2 ---- /dev/null -+++ b/src/vs/server/node/insights.ts -@@ -0,0 +1,124 @@ -+import * as appInsights from 'applicationinsights'; -+import * as https from 'https'; -+import * as http from 'http'; -+import * as os from 'os'; -+ -+class Channel { -+ public get _sender() { -+ throw new Error('unimplemented'); -+ } -+ public get _buffer() { -+ throw new Error('unimplemented'); -+ } -+ -+ public setUseDiskRetryCaching(): void { -+ throw new Error('unimplemented'); -+ } -+ public send(): void { -+ throw new Error('unimplemented'); -+ } -+ public triggerSend(): void { -+ throw new Error('unimplemented'); -+ } -+} -+ -+export class TelemetryClient { -+ public context: any = undefined; -+ public commonProperties: any = undefined; -+ public config: any = {}; -+ -+ public channel: any = new Channel(); -+ -+ public addTelemetryProcessor(): void { -+ throw new Error('unimplemented'); -+ } -+ -+ public clearTelemetryProcessors(): void { -+ throw new Error('unimplemented'); -+ } -+ -+ public runTelemetryProcessors(): void { -+ throw new Error('unimplemented'); -+ } -+ -+ public trackTrace(): void { -+ throw new Error('unimplemented'); -+ } -+ -+ public trackMetric(): void { -+ throw new Error('unimplemented'); -+ } -+ -+ public trackException(): void { -+ throw new Error('unimplemented'); -+ } -+ -+ public trackRequest(): void { -+ throw new Error('unimplemented'); -+ } -+ -+ public trackDependency(): void { -+ throw new Error('unimplemented'); -+ } -+ -+ public track(): void { -+ throw new Error('unimplemented'); -+ } -+ -+ public trackNodeHttpRequestSync(): void { -+ throw new Error('unimplemented'); -+ } -+ -+ public trackNodeHttpRequest(): void { -+ throw new Error('unimplemented'); -+ } -+ -+ public trackNodeHttpDependency(): void { -+ throw new Error('unimplemented'); -+ } -+ -+ public trackEvent(options: appInsights.Contracts.EventTelemetry): void { -+ if (!options.properties) { -+ options.properties = {}; -+ } -+ if (!options.measurements) { -+ options.measurements = {}; -+ } -+ -+ try { -+ const cpus = os.cpus(); -+ options.measurements.cores = cpus.length; -+ options.properties['common.cpuModel'] = cpus[0].model; -+ } catch (error) {} -+ -+ try { -+ options.measurements.memoryFree = os.freemem(); -+ options.measurements.memoryTotal = os.totalmem(); -+ } catch (error) {} -+ -+ try { -+ options.properties['common.shell'] = os.userInfo().shell; -+ options.properties['common.release'] = os.release(); -+ options.properties['common.arch'] = os.arch(); -+ } catch (error) {} -+ -+ try { -+ const url = process.env.TELEMETRY_URL || 'https://v1.telemetry.coder.com/track'; -+ const request = (/^http:/.test(url) ? http : https).request(url, { -+ method: 'POST', -+ headers: { -+ 'Content-Type': 'application/json', -+ }, -+ }); -+ request.on('error', () => { /* We don't care. */ }); -+ request.write(JSON.stringify(options)); -+ request.end(); -+ } catch (error) {} -+ } -+ -+ public flush(options: { callback: (v: string) => void }): void { -+ if (options.callback) { -+ options.callback(''); -+ } -+ } -+} -diff --git a/src/vs/server/node/ipc.ts b/src/vs/server/node/ipc.ts -new file mode 100644 -index 0000000000..5e560eb46e ---- /dev/null -+++ b/src/vs/server/node/ipc.ts -@@ -0,0 +1,61 @@ -+import * as cp from 'child_process'; -+import { Emitter } from 'vs/base/common/event'; -+ -+enum ControlMessage { -+ okToChild = 'ok>', -+ okFromChild = 'ok<', -+} -+ -+interface RelaunchMessage { -+ type: 'relaunch'; -+ version: string; -+} -+ -+export type Message = RelaunchMessage; -+ -+class IpcMain { -+ protected readonly _onMessage = new Emitter(); -+ public readonly onMessage = this._onMessage.event; -+ -+ public handshake(child?: cp.ChildProcess): Promise { -+ return new Promise((resolve, reject) => { -+ const target = child || process; -+ if (!target.send) { -+ throw new Error('Not spawned with IPC enabled'); -+ } -+ target.on('message', (message) => { -+ if (message === child ? ControlMessage.okFromChild : ControlMessage.okToChild) { -+ target.removeAllListeners(); -+ target.on('message', (msg) => this._onMessage.fire(msg)); -+ if (child) { -+ target.send!(ControlMessage.okToChild); -+ } -+ resolve(); -+ } -+ }); -+ if (child) { -+ child.once('error', reject); -+ child.once('exit', (code) => { -+ const error = new Error(`Unexpected exit with code ${code}`); -+ (error as any).code = code; -+ reject(error); -+ }); -+ } else { -+ target.send(ControlMessage.okFromChild); -+ } -+ }); -+ } -+ -+ public relaunch(version: string): void { -+ this.send({ type: 'relaunch', version }); -+ } -+ -+ private send(message: Message): void { -+ if (!process.send) { -+ throw new Error('Not a child process with IPC enabled'); -+ } -+ process.send(message); -+ } -+} -+ -+export const ipcMain = new IpcMain(); -diff --git a/src/vs/server/node/logger.ts b/src/vs/server/node/logger.ts -new file mode 100644 -index 0000000000..2a39c524aa ---- /dev/null -+++ b/src/vs/server/node/logger.ts -@@ -0,0 +1,2 @@ -+import { logger as baseLogger } from '@coder/logger'; -+export const logger = baseLogger.named('vscode'); -diff --git a/src/vs/server/node/marketplace.ts b/src/vs/server/node/marketplace.ts -new file mode 100644 -index 0000000000..8956fc40d4 ---- /dev/null -+++ b/src/vs/server/node/marketplace.ts -@@ -0,0 +1,174 @@ -+import * as fs from 'fs'; -+import * as path from 'path'; -+import * as tarStream from 'tar-stream'; -+import * as util from 'util'; -+import { CancellationToken } from 'vs/base/common/cancellation'; -+import { mkdirp } from 'vs/base/node/pfs'; -+import * as vszip from 'vs/base/node/zip'; -+import * as nls from 'vs/nls'; -+import product from 'vs/platform/product/common/product'; -+ -+// We will be overriding these, so keep a reference to the original. -+const vszipExtract = vszip.extract; -+const vszipBuffer = vszip.buffer; -+ -+export interface IExtractOptions { -+ overwrite?: boolean; -+ /** -+ * Source path within the TAR/ZIP archive. Only the files -+ * contained in this path will be extracted. -+ */ -+ sourcePath?: string; -+} -+ -+export interface IFile { -+ path: string; -+ contents?: Buffer | string; -+ localPath?: string; -+} -+ -+export const tar = async (tarPath: string, files: IFile[]): Promise => { -+ const pack = tarStream.pack(); -+ const chunks: Buffer[] = []; -+ const ended = new Promise((resolve) => { -+ pack.on('end', () => resolve(Buffer.concat(chunks))); -+ }); -+ pack.on('data', (chunk: Buffer) => chunks.push(chunk)); -+ for (let i = 0; i < files.length; i++) { -+ const file = files[i]; -+ pack.entry({ name: file.path }, file.contents); -+ } -+ pack.finalize(); -+ await util.promisify(fs.writeFile)(tarPath, await ended); -+ return tarPath; -+}; -+ -+export const extract = async (archivePath: string, extractPath: string, options: IExtractOptions = {}, token: CancellationToken): Promise => { -+ try { -+ await extractTar(archivePath, extractPath, options, token); -+ } catch (error) { -+ if (error.toString().includes('Invalid tar header')) { -+ await vszipExtract(archivePath, extractPath, options, token); -+ } -+ } -+}; -+ -+export const buffer = (targetPath: string, filePath: string): Promise => { -+ return new Promise(async (resolve, reject) => { -+ try { -+ let done: boolean = false; -+ await extractAssets(targetPath, new RegExp(filePath), (assetPath: string, data: Buffer) => { -+ if (path.normalize(assetPath) === path.normalize(filePath)) { -+ done = true; -+ resolve(data); -+ } -+ }); -+ if (!done) { -+ throw new Error('couldn\'t find asset ' + filePath); -+ } -+ } catch (error) { -+ if (error.toString().includes('Invalid tar header')) { -+ vszipBuffer(targetPath, filePath).then(resolve).catch(reject); -+ } else { -+ reject(error); -+ } -+ } -+ }); -+}; -+ -+const extractAssets = async (tarPath: string, match: RegExp, callback: (path: string, data: Buffer) => void): Promise => { -+ return new Promise((resolve, reject): void => { -+ const extractor = tarStream.extract(); -+ const fail = (error: Error) => { -+ extractor.destroy(); -+ reject(error); -+ }; -+ extractor.once('error', fail); -+ extractor.on('entry', async (header, stream, next) => { -+ const name = header.name; -+ if (match.test(name)) { -+ extractData(stream).then((data) => { -+ callback(name, data); -+ next(); -+ }).catch(fail); -+ } else { -+ stream.on('end', () => next()); -+ stream.resume(); // Just drain it. -+ } -+ }); -+ extractor.on('finish', resolve); -+ fs.createReadStream(tarPath).pipe(extractor); -+ }); -+}; -+ -+const extractData = (stream: NodeJS.ReadableStream): Promise => { -+ return new Promise((resolve, reject): void => { -+ const fileData: Buffer[] = []; -+ stream.on('error', reject); -+ stream.on('end', () => resolve(Buffer.concat(fileData))); -+ stream.on('data', (data) => fileData.push(data)); -+ }); -+}; -+ -+const extractTar = async (tarPath: string, targetPath: string, options: IExtractOptions = {}, token: CancellationToken): Promise => { -+ return new Promise((resolve, reject): void => { -+ const sourcePathRegex = new RegExp(options.sourcePath ? `^${options.sourcePath}` : ''); -+ const extractor = tarStream.extract(); -+ const fail = (error: Error) => { -+ extractor.destroy(); -+ reject(error); -+ }; -+ extractor.once('error', fail); -+ extractor.on('entry', async (header, stream, next) => { -+ const nextEntry = (): void => { -+ stream.on('end', () => next()); -+ stream.resume(); -+ }; -+ -+ const rawName = path.normalize(header.name); -+ if (token.isCancellationRequested || !sourcePathRegex.test(rawName)) { -+ return nextEntry(); -+ } -+ -+ const fileName = rawName.replace(sourcePathRegex, ''); -+ const targetFileName = path.join(targetPath, fileName); -+ if (/\/$/.test(fileName)) { -+ return mkdirp(targetFileName).then(nextEntry); -+ } -+ -+ const dirName = path.dirname(fileName); -+ const targetDirName = path.join(targetPath, dirName); -+ if (targetDirName.indexOf(targetPath) !== 0) { -+ return fail(new Error(nls.localize('invalid file', 'Error extracting {0}. Invalid file.', fileName))); -+ } -+ -+ await mkdirp(targetDirName, undefined); -+ -+ const fstream = fs.createWriteStream(targetFileName, { mode: header.mode }); -+ fstream.once('close', () => next()); -+ fstream.once('error', fail); -+ stream.pipe(fstream); -+ }); -+ extractor.once('finish', resolve); -+ fs.createReadStream(tarPath).pipe(extractor); -+ }); -+}; -+ -+/** -+ * Override original functionality so we can use a custom marketplace with -+ * either tars or zips. -+ */ -+export const enableCustomMarketplace = (): void => { -+ (product).extensionsGallery = { // Use `any` to override readonly. -+ serviceUrl: process.env.SERVICE_URL || 'https://extensions.coder.com/api', -+ itemUrl: process.env.ITEM_URL || '', -+ controlUrl: '', -+ recommendationsUrl: '', -+ ...(product.extensionsGallery || {}), -+ }; -+ -+ const target = vszip as typeof vszip; -+ target.zip = tar; -+ target.extract = extract; -+ target.buffer = buffer; -+}; -diff --git a/src/vs/server/node/nls.ts b/src/vs/server/node/nls.ts -new file mode 100644 -index 0000000000..3d428a57d3 ---- /dev/null -+++ b/src/vs/server/node/nls.ts -@@ -0,0 +1,88 @@ -+import * as fs from 'fs'; -+import * as path from 'path'; -+import * as util from 'util'; -+import { getPathFromAmdModule } from 'vs/base/common/amd'; -+import * as lp from 'vs/base/node/languagePacks'; -+import product from 'vs/platform/product/common/product'; -+import { Translations } from 'vs/workbench/services/extensions/common/extensionPoints'; -+ -+const configurations = new Map>(); -+const metadataPath = path.join(getPathFromAmdModule(require, ''), 'nls.metadata.json'); -+ -+export const isInternalConfiguration = (config: lp.NLSConfiguration): config is lp.InternalNLSConfiguration => { -+ return config && !!(config)._languagePackId; -+}; -+ -+const DefaultConfiguration = { -+ locale: 'en', -+ availableLanguages: {}, -+}; -+ -+export const getNlsConfiguration = async (locale: string, userDataPath: string): Promise => { -+ const id = `${locale}: ${userDataPath}`; -+ if (!configurations.has(id)) { -+ configurations.set(id, new Promise(async (resolve) => { -+ const config = product.commit && await util.promisify(fs.exists)(metadataPath) -+ ? await lp.getNLSConfiguration(product.commit, userDataPath, metadataPath, locale) -+ : DefaultConfiguration; -+ if (isInternalConfiguration(config)) { -+ config._languagePackSupport = true; -+ } -+ // If the configuration has no results keep trying since code-server -+ // doesn't restart when a language is installed so this result would -+ // persist (the plugin might not be installed yet or something). -+ if (config.locale !== 'en' && config.locale !== 'en-us' && Object.keys(config.availableLanguages).length === 0) { -+ configurations.delete(id); -+ } -+ resolve(config); -+ })); -+ } -+ return configurations.get(id)!; -+}; -+ -+export const getTranslations = async (locale: string, userDataPath: string): Promise => { -+ const config = await getNlsConfiguration(locale, userDataPath); -+ if (isInternalConfiguration(config)) { -+ try { -+ return JSON.parse(await util.promisify(fs.readFile)(config._translationsConfigFile, 'utf8')); -+ } catch (error) { /* Nothing yet. */} -+ } -+ return {}; -+}; -+ -+export const getLocaleFromConfig = async (userDataPath: string): Promise => { -+ const files = ['locale.json', 'argv.json']; -+ for (let i = 0; i < files.length; ++i) { -+ try { -+ const localeConfigUri = path.join(userDataPath, 'User', files[i]); -+ const content = stripComments(await util.promisify(fs.readFile)(localeConfigUri, 'utf8')); -+ return JSON.parse(content).locale; -+ } catch (error) { /* Ignore. */ } -+ } -+ return 'en'; -+}; -+ -+// Taken from src/main.js in the main VS Code source. -+const stripComments = (content: string): string => { -+ const regexp = /('(?:[^\\']*(?:\\.)?)*')|('(?:[^\\']*(?:\\.)?)*')|(\/\*(?:\r?\n|.)*?\*\/)|(\/{2,}.*?(?:(?:\r?\n)|$))/g; -+ -+ return content.replace(regexp, (match, _m1, _m2, m3, m4) => { -+ // Only one of m1, m2, m3, m4 matches -+ if (m3) { -+ // A block comment. Replace with nothing -+ return ''; -+ } else if (m4) { -+ // A line comment. If it ends in \r?\n then keep it. -+ const length_1 = m4.length; -+ if (length_1 > 2 && m4[length_1 - 1] === '\n') { -+ return m4[length_1 - 2] === '\r' ? '\r\n' : '\n'; -+ } -+ else { -+ return ''; -+ } -+ } else { -+ // We match a string -+ return match; -+ } -+ }); -+}; -diff --git a/src/vs/server/node/protocol.ts b/src/vs/server/node/protocol.ts -new file mode 100644 -index 0000000000..3c74512192 ---- /dev/null -+++ b/src/vs/server/node/protocol.ts -@@ -0,0 +1,73 @@ -+import * as net from 'net'; -+import { VSBuffer } from 'vs/base/common/buffer'; -+import { PersistentProtocol } from 'vs/base/parts/ipc/common/ipc.net'; -+import { NodeSocket, WebSocketNodeSocket } from 'vs/base/parts/ipc/node/ipc.net'; -+import { AuthRequest, ConnectionTypeRequest, HandshakeMessage } from 'vs/platform/remote/common/remoteAgentConnection'; -+ -+export interface SocketOptions { -+ readonly reconnectionToken: string; -+ readonly reconnection: boolean; -+ readonly skipWebSocketFrames: boolean; -+} -+ -+export class Protocol extends PersistentProtocol { -+ public constructor(socket: net.Socket, public readonly options: SocketOptions) { -+ super( -+ options.skipWebSocketFrames -+ ? new NodeSocket(socket) -+ : new WebSocketNodeSocket(new NodeSocket(socket)), -+ ); -+ } -+ -+ public getUnderlyingSocket(): net.Socket { -+ const socket = this.getSocket(); -+ return socket instanceof NodeSocket -+ ? socket.socket -+ : (socket as WebSocketNodeSocket).socket.socket; -+ } -+ -+ /** -+ * Perform a handshake to get a connection request. -+ */ -+ public handshake(): Promise { -+ return new Promise((resolve, reject) => { -+ const handler = this.onControlMessage((rawMessage) => { -+ try { -+ const message = JSON.parse(rawMessage.toString()); -+ switch (message.type) { -+ case 'auth': return this.authenticate(message); -+ case 'connectionType': -+ handler.dispose(); -+ return resolve(message); -+ default: throw new Error('Unrecognized message type'); -+ } -+ } catch (error) { -+ handler.dispose(); -+ reject(error); -+ } -+ }); -+ }); -+ } -+ -+ /** -+ * TODO: This ignores the authentication process entirely for now. -+ */ -+ private authenticate(_message: AuthRequest): void { -+ this.sendMessage({ type: 'sign', data: '' }); -+ } -+ -+ /** -+ * TODO: implement. -+ */ -+ public tunnel(): void { -+ throw new Error('Tunnel is not implemented yet'); -+ } -+ -+ /** -+ * Send a handshake message. In the case of the extension host, it just sends -+ * back a debug port. -+ */ -+ public sendMessage(message: HandshakeMessage | { debugPort?: number } ): void { -+ this.sendControl(VSBuffer.fromString(JSON.stringify(message))); -+ } -+} -diff --git a/src/vs/server/node/server.ts b/src/vs/server/node/server.ts -new file mode 100644 -index 0000000000..f2c16b9f81 ---- /dev/null -+++ b/src/vs/server/node/server.ts -@@ -0,0 +1,282 @@ -+import * as fs from 'fs'; -+import * as net from 'net'; -+import * as path from 'path'; -+import { Emitter } from 'vs/base/common/event'; -+import { Schemas } from 'vs/base/common/network'; -+import { URI } from 'vs/base/common/uri'; -+import { getMachineId } from 'vs/base/node/id'; -+import { ClientConnectionEvent, createChannelReceiver, IPCServer, IServerChannel } from 'vs/base/parts/ipc/common/ipc'; -+import { LogsDataCleaner } from 'vs/code/electron-browser/sharedProcess/contrib/logsDataCleaner'; -+import { main } from "vs/code/node/cliProcessMain"; -+import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; -+import { ConfigurationService } from 'vs/platform/configuration/common/configurationService'; -+import { ExtensionHostDebugBroadcastChannel } from 'vs/platform/debug/common/extensionHostDebugIpc'; -+import { IEnvironmentService } from 'vs/platform/environment/common/environment'; -+import { ParsedArgs } from 'vs/platform/environment/node/argv'; -+import { EnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/node/environmentService'; -+import { ExtensionGalleryService } from 'vs/platform/extensionManagement/common/extensionGalleryService'; -+import { IExtensionGalleryService, IExtensionManagementService } from 'vs/platform/extensionManagement/common/extensionManagement'; -+import { ExtensionManagementChannel } from 'vs/platform/extensionManagement/common/extensionManagementIpc'; -+import { ExtensionManagementService } from 'vs/platform/extensionManagement/node/extensionManagementService'; -+import { IFileService } from 'vs/platform/files/common/files'; -+import { FileService } from 'vs/platform/files/common/fileService'; -+import { DiskFileSystemProvider } from 'vs/platform/files/node/diskFileSystemProvider'; -+import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'; -+import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService'; -+import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; -+import { ILocalizationsService } from 'vs/platform/localizations/common/localizations'; -+import { LocalizationsService } from 'vs/platform/localizations/node/localizations'; -+import { getLogLevel, ILogService } from 'vs/platform/log/common/log'; -+import { LoggerChannel } from 'vs/platform/log/common/logIpc'; -+import { SpdLogService } from 'vs/platform/log/node/spdlogService'; -+import product from 'vs/platform/product/common/product'; -+import { IProductService } from 'vs/platform/product/common/productService'; -+import { ConnectionType, ConnectionTypeRequest } from 'vs/platform/remote/common/remoteAgentConnection'; -+import { RemoteAgentConnectionContext } from 'vs/platform/remote/common/remoteAgentEnvironment'; -+import { IRequestService } from 'vs/platform/request/common/request'; -+import { RequestChannel } from 'vs/platform/request/common/requestIpc'; -+import { RequestService } from 'vs/platform/request/node/requestService'; -+import ErrorTelemetry from 'vs/platform/telemetry/browser/errorTelemetry'; -+import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; -+import { TelemetryService } from 'vs/platform/telemetry/common/telemetryService'; -+import { combinedAppender, LogAppender, NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils'; -+import { AppInsightsAppender } from 'vs/platform/telemetry/node/appInsightsAppender'; -+import { resolveCommonProperties } from 'vs/platform/telemetry/node/commonProperties'; -+import { INodeProxyService, NodeProxyChannel } from 'vs/server/common/nodeProxy'; -+import { TelemetryChannel } from 'vs/server/common/telemetry'; -+import { Query, VscodeOptions, WorkbenchOptions } from 'vs/server/ipc'; -+import { ExtensionEnvironmentChannel, FileProviderChannel, NodeProxyService } from 'vs/server/node/channel'; -+import { Connection, ExtensionHostConnection, ManagementConnection } from 'vs/server/node/connection'; -+import { TelemetryClient } from 'vs/server/node/insights'; -+import { logger } from 'vs/server/node/logger'; -+import { getLocaleFromConfig, getNlsConfiguration } from 'vs/server/node/nls'; -+import { Protocol } from 'vs/server/node/protocol'; -+import { getUriTransformer } from 'vs/server/node/util'; -+import { REMOTE_FILE_SYSTEM_CHANNEL_NAME } from "vs/workbench/services/remote/common/remoteAgentFileSystemChannel"; -+import { RemoteExtensionLogFileName } from 'vs/workbench/services/remote/common/remoteAgentService'; -+ -+export class Vscode { -+ public readonly _onDidClientConnect = new Emitter(); -+ public readonly onDidClientConnect = this._onDidClientConnect.event; -+ private readonly ipc = new IPCServer(this.onDidClientConnect); -+ -+ private readonly maxExtraOfflineConnections = 0; -+ private readonly connections = new Map>(); -+ -+ private readonly services = new ServiceCollection(); -+ private servicesPromise?: Promise; -+ -+ public async cli(args: ParsedArgs): Promise { -+ return main(args); -+ } -+ -+ public async initialize(options: VscodeOptions): Promise { -+ const transformer = getUriTransformer(options.remoteAuthority); -+ if (!this.servicesPromise) { -+ this.servicesPromise = this.initializeServices(options.args); -+ } -+ await this.servicesPromise; -+ const environment = this.services.get(IEnvironmentService) as INativeEnvironmentService; -+ const startPath = options.startPath; -+ const parseUrl = (url: string): URI => { -+ // This might be a fully-specified URL or just a path. -+ try { -+ return URI.parse(url, true); -+ } catch (error) { -+ return URI.from({ -+ scheme: Schemas.vscodeRemote, -+ authority: options.remoteAuthority, -+ path: url, -+ }); -+ } -+ }; -+ return { -+ workbenchWebConfiguration: { -+ workspaceUri: startPath && startPath.workspace ? parseUrl(startPath.url) : undefined, -+ folderUri: startPath && !startPath.workspace ? parseUrl(startPath.url) : undefined, -+ remoteAuthority: options.remoteAuthority, -+ logLevel: getLogLevel(environment), -+ workspaceProvider: { -+ payload: [["userDataPath", environment.userDataPath]], -+ }, -+ }, -+ remoteUserDataUri: transformer.transformOutgoing(URI.file(environment.userDataPath)), -+ productConfiguration: product, -+ nlsConfiguration: await getNlsConfiguration(environment.args.locale || await getLocaleFromConfig(environment.userDataPath), environment.userDataPath), -+ commit: product.commit || 'development', -+ }; -+ } -+ -+ public async handleWebSocket(socket: net.Socket, query: Query): Promise { -+ if (!query.reconnectionToken) { -+ throw new Error('Reconnection token is missing from query parameters'); -+ } -+ const protocol = new Protocol(socket, { -+ reconnectionToken: query.reconnectionToken, -+ reconnection: query.reconnection === 'true', -+ skipWebSocketFrames: query.skipWebSocketFrames === 'true', -+ }); -+ try { -+ await this.connect(await protocol.handshake(), protocol); -+ } catch (error) { -+ protocol.sendMessage({ type: 'error', reason: error.message }); -+ protocol.dispose(); -+ protocol.getSocket().dispose(); -+ } -+ return true; -+ } -+ -+ private async connect(message: ConnectionTypeRequest, protocol: Protocol): Promise { -+ if (product.commit && message.commit !== product.commit) { -+ logger.warn(`Version mismatch (${message.commit} instead of ${product.commit})`); -+ } -+ -+ switch (message.desiredConnectionType) { -+ case ConnectionType.ExtensionHost: -+ case ConnectionType.Management: -+ if (!this.connections.has(message.desiredConnectionType)) { -+ this.connections.set(message.desiredConnectionType, new Map()); -+ } -+ const connections = this.connections.get(message.desiredConnectionType)!; -+ -+ const ok = async () => { -+ return message.desiredConnectionType === ConnectionType.ExtensionHost -+ ? { debugPort: await this.getDebugPort() } -+ : { type: 'ok' }; -+ }; -+ -+ const token = protocol.options.reconnectionToken; -+ if (protocol.options.reconnection && connections.has(token)) { -+ protocol.sendMessage(await ok()); -+ const buffer = protocol.readEntireBuffer(); -+ protocol.dispose(); -+ return connections.get(token)!.reconnect(protocol.getSocket(), buffer); -+ } else if (protocol.options.reconnection || connections.has(token)) { -+ throw new Error(protocol.options.reconnection -+ ? 'Unrecognized reconnection token' -+ : 'Duplicate reconnection token' -+ ); -+ } -+ -+ protocol.sendMessage(await ok()); -+ -+ let connection: Connection; -+ if (message.desiredConnectionType === ConnectionType.Management) { -+ connection = new ManagementConnection(protocol, token); -+ this._onDidClientConnect.fire({ -+ protocol, onDidClientDisconnect: connection.onClose, -+ }); -+ // TODO: Need a way to match clients with a connection. For now -+ // dispose everything which only works because no extensions currently -+ // utilize long-running proxies. -+ (this.services.get(INodeProxyService) as NodeProxyService)._onUp.fire(); -+ connection.onClose(() => (this.services.get(INodeProxyService) as NodeProxyService)._onDown.fire()); -+ } else { -+ const buffer = protocol.readEntireBuffer(); -+ connection = new ExtensionHostConnection( -+ message.args ? message.args.language : 'en', -+ protocol, buffer, token, -+ this.services.get(ILogService) as ILogService, -+ this.services.get(IEnvironmentService) as INativeEnvironmentService, -+ ); -+ } -+ connections.set(token, connection); -+ connection.onClose(() => connections.delete(token)); -+ this.disposeOldOfflineConnections(connections); -+ break; -+ case ConnectionType.Tunnel: return protocol.tunnel(); -+ default: throw new Error('Unrecognized connection type'); -+ } -+ } -+ -+ private disposeOldOfflineConnections(connections: Map): void { -+ const offline = Array.from(connections.values()) -+ .filter((connection) => typeof connection.offline !== 'undefined'); -+ for (let i = 0, max = offline.length - this.maxExtraOfflineConnections; i < max; ++i) { -+ offline[i].dispose(); -+ } -+ } -+ -+ private async initializeServices(args: ParsedArgs): Promise { -+ const environmentService = new EnvironmentService(args, process.execPath); -+ // https://github.com/cdr/code-server/issues/1693 -+ fs.mkdirSync(environmentService.globalStorageHome.fsPath, { recursive: true }); -+ -+ const logService = new SpdLogService(RemoteExtensionLogFileName, environmentService.logsPath, getLogLevel(environmentService)); -+ const fileService = new FileService(logService); -+ fileService.registerProvider(Schemas.file, new DiskFileSystemProvider(logService)); -+ -+ const piiPaths = [ -+ path.join(environmentService.userDataPath, 'clp'), // Language packs. -+ environmentService.appRoot, -+ environmentService.extensionsPath, -+ environmentService.builtinExtensionsPath, -+ ...environmentService.extraExtensionPaths, -+ ...environmentService.extraBuiltinExtensionPaths, -+ ]; -+ -+ this.ipc.registerChannel('logger', new LoggerChannel(logService)); -+ this.ipc.registerChannel(ExtensionHostDebugBroadcastChannel.ChannelName, new ExtensionHostDebugBroadcastChannel()); -+ -+ this.services.set(ILogService, logService); -+ this.services.set(IEnvironmentService, environmentService); -+ -+ const configurationService = new ConfigurationService(environmentService.settingsResource, fileService); -+ await configurationService.initialize(); -+ this.services.set(IConfigurationService, configurationService); -+ -+ this.services.set(IRequestService, new SyncDescriptor(RequestService)); -+ this.services.set(IFileService, fileService); -+ this.services.set(IProductService, { _serviceBrand: undefined, ...product }); -+ this.services.set(IExtensionGalleryService, new SyncDescriptor(ExtensionGalleryService)); -+ this.services.set(IExtensionManagementService, new SyncDescriptor(ExtensionManagementService)); -+ -+ if (!environmentService.disableTelemetry) { -+ this.services.set(ITelemetryService, new TelemetryService({ -+ appender: combinedAppender( -+ new AppInsightsAppender('code-server', null, () => new TelemetryClient() as any, logService), -+ new LogAppender(logService), -+ ), -+ sendErrorTelemetry: true, -+ commonProperties: resolveCommonProperties( -+ product.commit, product.version, await getMachineId(), -+ [], environmentService.installSourcePath, 'code-server', -+ ), -+ piiPaths, -+ }, configurationService)); -+ } else { -+ this.services.set(ITelemetryService, NullTelemetryService); -+ } -+ -+ await new Promise((resolve) => { -+ const instantiationService = new InstantiationService(this.services); -+ this.services.set(ILocalizationsService, instantiationService.createInstance(LocalizationsService)); -+ this.services.set(INodeProxyService, instantiationService.createInstance(NodeProxyService)); -+ -+ instantiationService.invokeFunction(() => { -+ instantiationService.createInstance(LogsDataCleaner); -+ const telemetryService = this.services.get(ITelemetryService) as ITelemetryService; -+ this.ipc.registerChannel('extensions', new ExtensionManagementChannel( -+ this.services.get(IExtensionManagementService) as IExtensionManagementService, -+ (context) => getUriTransformer(context.remoteAuthority), -+ )); -+ this.ipc.registerChannel('remoteextensionsenvironment', new ExtensionEnvironmentChannel( -+ environmentService, logService, telemetryService, '', -+ )); -+ this.ipc.registerChannel('request', new RequestChannel(this.services.get(IRequestService) as IRequestService)); -+ this.ipc.registerChannel('telemetry', new TelemetryChannel(telemetryService)); -+ this.ipc.registerChannel('nodeProxy', new NodeProxyChannel(this.services.get(INodeProxyService) as INodeProxyService)); -+ this.ipc.registerChannel('localizations', >createChannelReceiver(this.services.get(ILocalizationsService) as ILocalizationsService)); -+ this.ipc.registerChannel(REMOTE_FILE_SYSTEM_CHANNEL_NAME, new FileProviderChannel(environmentService, logService)); -+ resolve(new ErrorTelemetry(telemetryService)); -+ }); -+ }); -+ } -+ -+ /** -+ * TODO: implement. -+ */ -+ private async getDebugPort(): Promise { -+ return undefined; -+ } -+} -diff --git a/src/vs/server/node/util.ts b/src/vs/server/node/util.ts -new file mode 100644 -index 0000000000..fa47e993b4 ---- /dev/null -+++ b/src/vs/server/node/util.ts -@@ -0,0 +1,13 @@ -+import { URITransformer } from 'vs/base/common/uriIpc'; -+ -+export const getUriTransformer = (remoteAuthority: string): URITransformer => { -+ return new URITransformer(remoteAuthority); -+}; -+ -+/** -+ * Encode a path for opening via the folder or workspace query parameter. This -+ * preserves slashes so it can be edited by hand more easily. -+ */ -+export const encodePath = (path: string): string => { -+ return path.split("/").map((p) => encodeURIComponent(p)).join("/"); -+}; -diff --git a/src/vs/workbench/api/browser/extensionHost.contribution.ts b/src/vs/workbench/api/browser/extensionHost.contribution.ts -index 3d77009b90..11deb1b99a 100644 ---- a/src/vs/workbench/api/browser/extensionHost.contribution.ts -+++ b/src/vs/workbench/api/browser/extensionHost.contribution.ts -@@ -60,6 +60,7 @@ import './mainThreadComments'; - import './mainThreadNotebook'; - import './mainThreadTask'; - import './mainThreadLabelService'; -+import 'vs/server/browser/mainThreadNodeProxy'; - import './mainThreadTunnelService'; - import './mainThreadAuthentication'; - import './mainThreadTimeline'; -diff --git a/src/vs/workbench/api/common/extHost.api.impl.ts b/src/vs/workbench/api/common/extHost.api.impl.ts -index 97793666ad..13cd137db1 100644 ---- a/src/vs/workbench/api/common/extHost.api.impl.ts -+++ b/src/vs/workbench/api/common/extHost.api.impl.ts -@@ -68,6 +68,7 @@ import { IURITransformerService } from 'vs/workbench/api/common/extHostUriTransf - import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService'; - import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitDataService'; - import { ExtHostNotebookController } from 'vs/workbench/api/common/extHostNotebook'; -+import { IExtHostNodeProxy } from 'vs/server/browser/extHostNodeProxy'; - import { ExtHostTheming } from 'vs/workbench/api/common/extHostTheming'; - import { IExtHostTunnelService } from 'vs/workbench/api/common/extHostTunnelService'; - import { IExtHostApiDeprecationService } from 'vs/workbench/api/common/extHostApiDeprecationService'; -@@ -97,6 +98,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I - const extHostStorage = accessor.get(IExtHostStorage); - const extensionStoragePaths = accessor.get(IExtensionStoragePaths); - const extHostLogService = accessor.get(ILogService); -+ const extHostNodeProxy = accessor.get(IExtHostNodeProxy); - const extHostTunnelService = accessor.get(IExtHostTunnelService); - const extHostApiDeprecation = accessor.get(IExtHostApiDeprecationService); - const extHostWindow = accessor.get(IExtHostWindow); -@@ -107,6 +109,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I - rpcProtocol.set(ExtHostContext.ExtHostConfiguration, extHostConfiguration); - rpcProtocol.set(ExtHostContext.ExtHostExtensionService, extensionService); - rpcProtocol.set(ExtHostContext.ExtHostStorage, extHostStorage); -+ rpcProtocol.set(ExtHostContext.ExtHostNodeProxy, extHostNodeProxy); - rpcProtocol.set(ExtHostContext.ExtHostTunnelService, extHostTunnelService); - rpcProtocol.set(ExtHostContext.ExtHostWindow, extHostWindow); - -diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts -index eb5d8ea845..da9eb521ca 100644 ---- a/src/vs/workbench/api/common/extHost.protocol.ts -+++ b/src/vs/workbench/api/common/extHost.protocol.ts -@@ -769,6 +769,16 @@ export interface MainThreadLabelServiceShape extends IDisposable { - $unregisterResourceLabelFormatter(handle: number): void; - } - -+export interface MainThreadNodeProxyShape extends IDisposable { -+ $send(message: string): void; -+} -+export interface ExtHostNodeProxyShape { -+ $onMessage(message: string): void; -+ $onClose(): void; -+ $onDown(): void; -+ $onUp(): void; -+} -+ - export interface MainThreadSearchShape extends IDisposable { - $registerFileSearchProvider(handle: number, scheme: string): void; - $registerTextSearchProvider(handle: number, scheme: string): void; -@@ -1707,6 +1717,7 @@ export const MainContext = { - MainThreadWindow: createMainId('MainThreadWindow'), - MainThreadLabelService: createMainId('MainThreadLabelService'), - MainThreadNotebook: createMainId('MainThreadNotebook'), -+ MainThreadNodeProxy: createMainId('MainThreadNodeProxy'), - MainThreadTheming: createMainId('MainThreadTheming'), - MainThreadTunnelService: createMainId('MainThreadTunnelService'), - MainThreadTimeline: createMainId('MainThreadTimeline') -@@ -1745,6 +1756,7 @@ export const ExtHostContext = { - ExtHostOutputService: createMainId('ExtHostOutputService'), - ExtHosLabelService: createMainId('ExtHostLabelService'), - ExtHostNotebook: createMainId('ExtHostNotebook'), -+ ExtHostNodeProxy: createMainId('ExtHostNodeProxy'), - ExtHostTheming: createMainId('ExtHostTheming'), - ExtHostTunnelService: createMainId('ExtHostTunnelService'), - ExtHostAuthentication: createMainId('ExtHostAuthentication'), -diff --git a/src/vs/workbench/api/common/extHostExtensionService.ts b/src/vs/workbench/api/common/extHostExtensionService.ts -index 34639e18b6..9c22fe6f09 100644 ---- a/src/vs/workbench/api/common/extHostExtensionService.ts -+++ b/src/vs/workbench/api/common/extHostExtensionService.ts -@@ -32,6 +32,7 @@ import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitData - import { IExtensionStoragePaths } from 'vs/workbench/api/common/extHostStoragePaths'; - import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService'; - import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; -+import { IExtHostNodeProxy } from 'vs/server/browser/extHostNodeProxy'; - import { IExtHostTunnelService } from 'vs/workbench/api/common/extHostTunnelService'; - import { IExtHostTerminalService } from 'vs/workbench/api/common/extHostTerminalService'; - import { Emitter, Event } from 'vs/base/common/event'; -@@ -82,6 +83,7 @@ export abstract class AbstractExtHostExtensionService extends Disposable impleme - protected readonly _extHostWorkspace: ExtHostWorkspace; - protected readonly _extHostConfiguration: ExtHostConfiguration; - protected readonly _logService: ILogService; -+ protected readonly _nodeProxy: IExtHostNodeProxy; - protected readonly _extHostTunnelService: IExtHostTunnelService; - protected readonly _extHostTerminalService: IExtHostTerminalService; - -@@ -114,6 +116,7 @@ export abstract class AbstractExtHostExtensionService extends Disposable impleme - @ILogService logService: ILogService, - @IExtHostInitDataService initData: IExtHostInitDataService, - @IExtensionStoragePaths storagePath: IExtensionStoragePaths, -+ @IExtHostNodeProxy nodeProxy: IExtHostNodeProxy, - @IExtHostTunnelService extHostTunnelService: IExtHostTunnelService, - @IExtHostTerminalService extHostTerminalService: IExtHostTerminalService - ) { -@@ -125,6 +128,7 @@ export abstract class AbstractExtHostExtensionService extends Disposable impleme - this._extHostWorkspace = extHostWorkspace; - this._extHostConfiguration = extHostConfiguration; - this._logService = logService; -+ this._nodeProxy = nodeProxy; - this._extHostTunnelService = extHostTunnelService; - this._extHostTerminalService = extHostTerminalService; - this._disposables = new DisposableStore(); -@@ -355,7 +359,7 @@ export abstract class AbstractExtHostExtensionService extends Disposable impleme - - const activationTimesBuilder = new ExtensionActivationTimesBuilder(reason.startup); - return Promise.all([ -- this._loadCommonJSModule(joinPath(extensionDescription.extensionLocation, entryPoint), activationTimesBuilder), -+ this._loadCommonJSModule(joinPath(extensionDescription.extensionLocation, entryPoint), activationTimesBuilder, !extensionDescription.browser), - this._loadExtensionContext(extensionDescription) - ]).then(values => { - return AbstractExtHostExtensionService._callActivate(this._logService, extensionDescription.identifier, values[0], values[1], activationTimesBuilder); -@@ -754,7 +758,7 @@ export abstract class AbstractExtHostExtensionService extends Disposable impleme - - protected abstract _beforeAlmostReadyToRunExtensions(): Promise; - protected abstract _getEntryPoint(extensionDescription: IExtensionDescription): string | undefined; -- protected abstract _loadCommonJSModule(module: URI, activationTimesBuilder: ExtensionActivationTimesBuilder): Promise; -+ protected abstract _loadCommonJSModule(module: URI, activationTimesBuilder: ExtensionActivationTimesBuilder, isRemote?: boolean): Promise; - public abstract async $setRemoteEnvironment(env: { [key: string]: string | null }): Promise; - } - -diff --git a/src/vs/workbench/api/node/extHost.node.services.ts b/src/vs/workbench/api/node/extHost.node.services.ts -index b3c89e51cf..e21abe4e13 100644 ---- a/src/vs/workbench/api/node/extHost.node.services.ts -+++ b/src/vs/workbench/api/node/extHost.node.services.ts -@@ -3,6 +3,8 @@ - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -+import { IExtHostNodeProxy } from 'vs/server/browser/extHostNodeProxy'; -+import { NotImplementedProxy } from 'vs/base/common/types'; - import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; - import { ExtHostOutputService2 } from 'vs/workbench/api/node/extHostOutputService'; - import { ExtHostTerminalService } from 'vs/workbench/api/node/extHostTerminalService'; -@@ -36,3 +38,4 @@ registerSingleton(IExtHostSearch, NativeExtHostSearch); - registerSingleton(IExtHostTask, ExtHostTask); - registerSingleton(IExtHostTerminalService, ExtHostTerminalService); - registerSingleton(IExtHostTunnelService, ExtHostTunnelService); -+registerSingleton(IExtHostNodeProxy, class extends NotImplementedProxy(String(IExtHostNodeProxy)) { whenReady = Promise.resolve(); }); -diff --git a/src/vs/workbench/api/worker/extHost.worker.services.ts b/src/vs/workbench/api/worker/extHost.worker.services.ts -index 3843fdec38..8aac4df527 100644 ---- a/src/vs/workbench/api/worker/extHost.worker.services.ts -+++ b/src/vs/workbench/api/worker/extHost.worker.services.ts -@@ -8,6 +8,7 @@ import { ILogService } from 'vs/platform/log/common/log'; - import { IExtHostExtensionService } from 'vs/workbench/api/common/extHostExtensionService'; - import { ExtHostExtensionService } from 'vs/workbench/api/worker/extHostExtensionService'; - import { ExtHostLogService } from 'vs/workbench/api/worker/extHostLogService'; -+import { ExtHostNodeProxy, IExtHostNodeProxy } from 'vs/server/browser/extHostNodeProxy'; - - // ######################################################################### - // ### ### -@@ -17,3 +18,4 @@ import { ExtHostLogService } from 'vs/workbench/api/worker/extHostLogService'; - - registerSingleton(IExtHostExtensionService, ExtHostExtensionService); - registerSingleton(ILogService, ExtHostLogService); -+registerSingleton(IExtHostNodeProxy, ExtHostNodeProxy); -diff --git a/src/vs/workbench/api/worker/extHostExtensionService.ts b/src/vs/workbench/api/worker/extHostExtensionService.ts -index c71ab1c7da..572b07ff25 100644 ---- a/src/vs/workbench/api/worker/extHostExtensionService.ts -+++ b/src/vs/workbench/api/worker/extHostExtensionService.ts -@@ -9,6 +9,7 @@ import { AbstractExtHostExtensionService } from 'vs/workbench/api/common/extHost - import { URI } from 'vs/base/common/uri'; - import { RequireInterceptor } from 'vs/workbench/api/common/extHostRequireInterceptor'; - import { IExtensionDescription } from 'vs/platform/extensions/common/extensions'; -+import { loadCommonJSModule } from 'vs/server/browser/worker'; - - class WorkerRequireInterceptor extends RequireInterceptor { - -@@ -42,10 +43,15 @@ export class ExtHostExtensionService extends AbstractExtHostExtensionService { - } - - protected _getEntryPoint(extensionDescription: IExtensionDescription): string | undefined { -- return extensionDescription.browser; -+ // NOTE@coder: We can support regular Node modules as well. These will just -+ // require the root of the extension. -+ return extensionDescription.browser || "."; - } - -- protected async _loadCommonJSModule(module: URI, activationTimesBuilder: ExtensionActivationTimesBuilder): Promise { -+ protected async _loadCommonJSModule(module: URI, activationTimesBuilder: ExtensionActivationTimesBuilder, isRemote?: boolean): Promise { -+ if (isRemote) { -+ return loadCommonJSModule(module, activationTimesBuilder, this._nodeProxy, this._logService, this._fakeModules!.getModule('vscode', module)); -+ } - - module = module.with({ path: ensureSuffix(module.path, '.js') }); - const response = await fetch(module.toString(true)); -diff --git a/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css b/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css -index ced2d81583..dfcae73e8a 100644 ---- a/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css -+++ b/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css -@@ -55,6 +55,10 @@ - align-items: center; - justify-content: center; - order: -1; -+ -+ /* NOTE@coder: Hide since it doesn't seem to do anything when used with -+ code-server except open the VS Code repository. */ -+ display: none !important; - } - - .monaco-workbench .activitybar > .content > .home-bar > .home-bar-icon-badge { -diff --git a/src/vs/workbench/browser/web.main.ts b/src/vs/workbench/browser/web.main.ts -index 0462617196..11434d27af 100644 ---- a/src/vs/workbench/browser/web.main.ts -+++ b/src/vs/workbench/browser/web.main.ts -@@ -45,6 +45,7 @@ import { FileLogService } from 'vs/platform/log/common/fileLogService'; - import { toLocalISOString } from 'vs/base/common/date'; - import { isWorkspaceToOpen, isFolderToOpen } from 'vs/platform/windows/common/windows'; - import { getWorkspaceIdentifier } from 'vs/workbench/services/workspaces/browser/workspaces'; -+import { initialize } from 'vs/server/browser/client'; - import { coalesce } from 'vs/base/common/arrays'; - import { InMemoryFileSystemProvider } from 'vs/platform/files/common/inMemoryFilesystemProvider'; - import { WebResourceIdentityService, IResourceIdentityService } from 'vs/platform/resource/common/resourceIdentityService'; -@@ -84,6 +85,8 @@ class BrowserMain extends Disposable { - // Startup - const instantiationService = workbench.startup(); - -+ await initialize(services.serviceCollection); -+ - // Return API Facade - return instantiationService.invokeFunction(accessor => { - const commandService = accessor.get(ICommandService); -diff --git a/src/vs/workbench/common/resources.ts b/src/vs/workbench/common/resources.ts -index 18ea0bfedb..d59a17c17f 100644 ---- a/src/vs/workbench/common/resources.ts -+++ b/src/vs/workbench/common/resources.ts -@@ -15,6 +15,7 @@ import { ParsedExpression, IExpression, parse } from 'vs/base/common/glob'; - import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; - import { IConfigurationService, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration'; - import { withNullAsUndefined } from 'vs/base/common/types'; -+import { Schemas } from 'vs/base/common/network'; - - export class ResourceContextKey extends Disposable implements IContextKey { - -@@ -68,7 +69,8 @@ export class ResourceContextKey extends Disposable implements IContextKey { - if (!ResourceContextKey._uriEquals(this._resourceKey.get(), value)) { - this._contextKeyService.bufferChangeEvents(() => { - this._resourceKey.set(value); -- this._schemeKey.set(value ? value.scheme : null); -+ // NOTE@coder: Fixes source control context menus (#1104). -+ this._schemeKey.set(value ? (value.scheme === Schemas.vscodeRemote ? Schemas.file : value.scheme) : null); - this._filenameKey.set(value ? basename(value) : null); - this._langIdKey.set(value ? this._modeService.getModeIdByFilepathOrFirstLine(value) : null); - this._extensionKey.set(value ? extname(value) : null); -diff --git a/src/vs/workbench/contrib/scm/browser/media/scm.css b/src/vs/workbench/contrib/scm/browser/media/scm.css -index 9947f240bf..bdba0a2fc6 100644 ---- a/src/vs/workbench/contrib/scm/browser/media/scm.css -+++ b/src/vs/workbench/contrib/scm/browser/media/scm.css -@@ -138,9 +138,11 @@ - margin-right: 8px; - } - --.scm-view .monaco-list .monaco-list-row .resource > .name > .monaco-icon-label > .actions { -- flex-grow: 100; --} -+/* NOTE@coder: Causes the label to shrink to zero width in Firefox due to -+ * overflow:hidden. This isn't right anyway, as far as I can tell. */ -+/* .scm-view .monaco-list .monaco-list-row .resource > .name > .monaco-icon-label > .actions { */ -+/* flex-grow: 100; */ -+/* } */ - - .scm-view .monaco-list .monaco-list-row .resource-group > .actions, - .scm-view .monaco-list .monaco-list-row .resource > .name > .monaco-icon-label > .actions { -diff --git a/src/vs/workbench/services/dialogs/browser/dialogService.ts b/src/vs/workbench/services/dialogs/browser/dialogService.ts -index 6e3182a696..7df85da165 100644 ---- a/src/vs/workbench/services/dialogs/browser/dialogService.ts -+++ b/src/vs/workbench/services/dialogs/browser/dialogService.ts -@@ -124,11 +124,12 @@ export class DialogService implements IDialogService { - async about(): Promise { - const detailString = (useAgo: boolean): string => { - return nls.localize('aboutDetail', -- "Version: {0}\nCommit: {1}\nDate: {2}\nBrowser: {3}", -+ "code-server: v{4}\n VS Code: v{0}\nCommit: {1}\nDate: {2}\nBrowser: {3}", - this.productService.version || 'Unknown', - this.productService.commit || 'Unknown', - this.productService.date ? `${this.productService.date}${useAgo ? ' (' + fromNow(new Date(this.productService.date), true) + ')' : ''}` : 'Unknown', -- navigator.userAgent -+ navigator.userAgent, -+ this.productService.codeServerVersion || 'Unknown', - ); - }; - -diff --git a/src/vs/workbench/services/environment/browser/environmentService.ts b/src/vs/workbench/services/environment/browser/environmentService.ts -index ba2701ec54..efea3bd5bc 100644 ---- a/src/vs/workbench/services/environment/browser/environmentService.ts -+++ b/src/vs/workbench/services/environment/browser/environmentService.ts -@@ -121,8 +121,18 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment - @memoize - get logFile(): URI { return joinPath(this.options.logsPath, 'window.log'); } - -+ // NOTE@coder: Use the regular path for extensions that write directly to disk -+ // instead of using the VS Code API. - @memoize -- get userRoamingDataHome(): URI { return URI.file('/User').with({ scheme: Schemas.userData }); } -+ get userRoamingDataHome(): URI { return URI.file(this.userDataPath).with({ scheme: Schemas.userData }); } -+ @memoize -+ get userDataPath(): string { -+ const dataPath = this.payload?.get("userDataPath"); -+ if (!dataPath) { -+ throw new Error("userDataPath was not provided to environment service"); -+ } -+ return dataPath; -+ } - - @memoize - get settingsResource(): URI { return joinPath(this.userRoamingDataHome, 'settings.json'); } -diff --git a/src/vs/workbench/services/extensionManagement/common/extensionEnablementService.ts b/src/vs/workbench/services/extensionManagement/common/extensionEnablementService.ts -index c28b147740..6090200d9c 100644 ---- a/src/vs/workbench/services/extensionManagement/common/extensionEnablementService.ts -+++ b/src/vs/workbench/services/extensionManagement/common/extensionEnablementService.ts -@@ -163,7 +163,7 @@ export class ExtensionEnablementService extends Disposable implements IWorkbench - } - } - } -- return true; -+ return false; // NOTE@coder: Don't disable anything by extensionKind. - } - return false; - } -diff --git a/src/vs/workbench/services/extensionManagement/common/extensionManagementService.ts b/src/vs/workbench/services/extensionManagement/common/extensionManagementService.ts -index 33eb56db3c..e5167794c3 100644 ---- a/src/vs/workbench/services/extensionManagement/common/extensionManagementService.ts -+++ b/src/vs/workbench/services/extensionManagement/common/extensionManagementService.ts -@@ -236,6 +236,11 @@ export class ExtensionManagementService extends Disposable implements IExtension - return this.extensionManagementServerService.webExtensionManagementServer.extensionManagementService.installFromGallery(gallery); - } - -+ // NOTE@coder: Fall back to installing on the remote server. -+ if (this.extensionManagementServerService.remoteExtensionManagementServer) { -+ return this.extensionManagementServerService.remoteExtensionManagementServer.extensionManagementService.installFromGallery(gallery); -+ } -+ - if (this.extensionManagementServerService.remoteExtensionManagementServer) { - const error = new Error(localize('cannot be installed', "Cannot install '{0}' because this extension has defined that it cannot run on the remote server.", gallery.displayName || gallery.name)); - error.name = INSTALL_ERROR_NOT_SUPPORTED; -diff --git a/src/vs/workbench/services/extensions/browser/extensionService.ts b/src/vs/workbench/services/extensions/browser/extensionService.ts -index d0710e77fa..ceb27174ae 100644 ---- a/src/vs/workbench/services/extensions/browser/extensionService.ts -+++ b/src/vs/workbench/services/extensions/browser/extensionService.ts -@@ -116,8 +116,10 @@ export class ExtensionService extends AbstractExtensionService implements IExten - this._remoteAgentService.getEnvironment(), - this._remoteAgentService.scanExtensions() - ]); -- localExtensions = this._checkEnabledAndProposedAPI(localExtensions); - remoteExtensions = this._checkEnabledAndProposedAPI(remoteExtensions); -+ // NOTE@coder: Include remotely hosted extensions that should run locally. -+ localExtensions = this._checkEnabledAndProposedAPI(localExtensions) -+ .concat(remoteExtensions.filter(ext => ext.extensionKind && (ext.extensionKind === "web" || ext.extensionKind.includes("web")))); - - const remoteAgentConnection = this._remoteAgentService.getConnection(); - this._runningLocation = _determineRunningLocation(this._productService, this._configService, localExtensions, remoteExtensions, Boolean(remoteEnv && remoteAgentConnection)); -diff --git a/src/vs/workbench/services/extensions/common/extensionsUtil.ts b/src/vs/workbench/services/extensions/common/extensionsUtil.ts -index 65e532ee58..0b6282fde7 100644 ---- a/src/vs/workbench/services/extensions/common/extensionsUtil.ts -+++ b/src/vs/workbench/services/extensions/common/extensionsUtil.ts -@@ -37,7 +37,8 @@ export function canExecuteOnWorkspace(manifest: IExtensionManifest, productServi - - export function canExecuteOnWeb(manifest: IExtensionManifest, productService: IProductService, configurationService: IConfigurationService): boolean { - const extensionKind = getExtensionKind(manifest, productService, configurationService); -- return extensionKind.some(kind => kind === 'web'); -+ // NOTE@coder: Hardcode vim for now. -+ return extensionKind.some(kind => kind === 'web') || manifest.name === 'vim'; - } - - export function getExtensionKind(manifest: IExtensionManifest, productService: IProductService, configurationService: IConfigurationService): ExtensionKind[] { -diff --git a/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts b/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts -index 49542eda74..de0e2da0a4 100644 ---- a/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts -+++ b/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts -@@ -16,7 +16,7 @@ import { IInitData } from 'vs/workbench/api/common/extHost.protocol'; - import { MessageType, createMessageOfType, isMessageOfType, IExtHostSocketMessage, IExtHostReadyMessage, IExtHostReduceGraceTimeMessage } from 'vs/workbench/services/extensions/common/extensionHostProtocol'; - import { ExtensionHostMain, IExitFn } from 'vs/workbench/services/extensions/common/extensionHostMain'; - import { VSBuffer } from 'vs/base/common/buffer'; --import { IURITransformer, URITransformer, IRawURITransformer } from 'vs/base/common/uriIpc'; -+import { IURITransformer, URITransformer } from 'vs/base/common/uriIpc'; - import { exists } from 'vs/base/node/pfs'; - import { realpath } from 'vs/base/node/extpath'; - import { IHostUtils } from 'vs/workbench/api/common/extHostExtensionService'; -@@ -57,12 +57,13 @@ const args = minimist(process.argv.slice(2), { - const Module = require.__$__nodeRequire('module') as any; - const originalLoad = Module._load; - -- Module._load = function (request: string) { -+ Module._load = function (request: string, parent: object, isMain: boolean) { - if (request === 'natives') { - throw new Error('Either the extension or a NPM dependency is using the "natives" node module which is unsupported as it can cause a crash of the extension host. Click [here](https://go.microsoft.com/fwlink/?linkid=871887) to find out more'); - } - -- return originalLoad.apply(this, arguments); -+ // NOTE@coder: Map node_module.asar requests to regular node_modules. -+ return originalLoad.apply(this, [request.replace(/node_modules\.asar(\.unpacked)?/, 'node_modules'), parent, isMain]); - }; - })(); - -@@ -135,8 +136,11 @@ function _createExtHostProtocol(): Promise { - - // Wait for rich client to reconnect - protocol.onSocketClose(() => { -- // The socket has closed, let's give the renderer a certain amount of time to reconnect -- disconnectRunner1.schedule(); -+ // NOTE@coder: Inform the server so we can manage offline -+ // connections there instead. Our goal is to persist connections -+ // forever (to a reasonable point) to account for things like -+ // hibernating overnight. -+ process.send!({ type: 'VSCODE_EXTHOST_DISCONNECTED' }); - }); - } - } -@@ -313,11 +317,9 @@ export async function startExtensionHostProcess(): Promise { - - // Attempt to load uri transformer - let uriTransformer: IURITransformer | null = null; -- if (initData.remote.authority && args.uriTransformerPath) { -+ if (initData.remote.authority) { - try { -- const rawURITransformerFactory = require.__$__nodeRequire(args.uriTransformerPath); -- const rawURITransformer = rawURITransformerFactory(initData.remote.authority); -- uriTransformer = new URITransformer(rawURITransformer); -+ uriTransformer = new URITransformer(initData.remote.authority); - } catch (e) { - console.error(e); - } -diff --git a/src/vs/workbench/services/extensions/worker/extensionHostWorkerMain.ts b/src/vs/workbench/services/extensions/worker/extensionHostWorkerMain.ts -index 79455414c0..a407593b4d 100644 ---- a/src/vs/workbench/services/extensions/worker/extensionHostWorkerMain.ts -+++ b/src/vs/workbench/services/extensions/worker/extensionHostWorkerMain.ts -@@ -14,7 +14,11 @@ - - require.config({ - baseUrl: monacoBaseUrl, -- catchError: true -+ catchError: true, -+ paths: { -+ '@coder/node-browser': `../node_modules/@coder/node-browser/out/client/client.js`, -+ '@coder/requirefs': `../node_modules/@coder/requirefs/out/requirefs.js`, -+ } - }); - - require(['vs/workbench/services/extensions/worker/extensionHostWorker'], () => { }, err => console.error(err)); -diff --git a/src/vs/workbench/services/localizations/electron-browser/localizationsService.ts b/src/vs/workbench/services/localizations/electron-browser/localizationsService.ts -index 44999bd842..601b1c5408 100644 ---- a/src/vs/workbench/services/localizations/electron-browser/localizationsService.ts -+++ b/src/vs/workbench/services/localizations/electron-browser/localizationsService.ts -@@ -5,17 +5,17 @@ - - import { createChannelSender } from 'vs/base/parts/ipc/common/ipc'; - import { ILocalizationsService } from 'vs/platform/localizations/common/localizations'; --import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService'; - import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; -+import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService'; - - export class LocalizationsService { - - declare readonly _serviceBrand: undefined; - - constructor( -- @ISharedProcessService sharedProcessService: ISharedProcessService, -+ @IRemoteAgentService remoteAgentService: IRemoteAgentService, - ) { -- return createChannelSender(sharedProcessService.getChannel('localizations')); -+ return createChannelSender(remoteAgentService.getConnection()!.getChannel('localizations')); - } - } - -diff --git a/src/vs/workbench/workbench.web.main.ts b/src/vs/workbench/workbench.web.main.ts -index 0669178db4..28fafeb2de 100644 ---- a/src/vs/workbench/workbench.web.main.ts -+++ b/src/vs/workbench/workbench.web.main.ts -@@ -35,7 +35,8 @@ import 'vs/workbench/services/textfile/browser/browserTextFileService'; - import 'vs/workbench/services/keybinding/browser/keymapService'; - import 'vs/workbench/services/extensions/browser/extensionService'; - import 'vs/workbench/services/extensionManagement/common/extensionManagementServerService'; --import 'vs/workbench/services/telemetry/browser/telemetryService'; -+// NOTE@coder: We send it all to the server side to be processed there instead. -+// import 'vs/workbench/services/telemetry/browser/telemetryService'; - import 'vs/workbench/services/configurationResolver/browser/configurationResolverService'; - import 'vs/workbench/services/credentials/browser/credentialsService'; - import 'vs/workbench/services/url/browser/urlService'; -diff --git a/yarn.lock b/yarn.lock -index b2fbf543af..f10dddd659 100644 ---- a/yarn.lock -+++ b/yarn.lock -@@ -140,6 +140,23 @@ - lodash "^4.17.13" - to-fast-properties "^2.0.0" - -+"@coder/logger@^1.1.12": -+ version "1.1.12" -+ resolved "https://registry.yarnpkg.com/@coder/logger/-/logger-1.1.12.tgz#def113b7183abc35a8da2b57f0929f7e9626f4e0" -+ integrity sha512-oM0j3lTVPqApUm3e0bKKcXpfAiJEys31fgEfQlHmvEA13ujsC4zDuXnt0uzDtph48eMoNRLOF/EE4mNShVJKVw== -+ -+"@coder/node-browser@^1.0.8": -+ version "1.0.8" -+ resolved "https://registry.yarnpkg.com/@coder/node-browser/-/node-browser-1.0.8.tgz#c22f581b089ad7d95ad1362fd351c57b7fbc6e70" -+ integrity sha512-NLF9sYMRCN9WK1C224pHax1Cay3qKypg25BhVg7VfNbo3Cpa3daata8RF/rT8JK3lPsu8PmFgDRQjzGC9X1Lrw== -+ -+"@coder/requirefs@^1.1.5": -+ version "1.1.5" -+ resolved "https://registry.yarnpkg.com/@coder/requirefs/-/requirefs-1.1.5.tgz#259db370d563a79a96fb150bc9d69c7db6edc9fb" -+ integrity sha512-3jB47OFCql9+9FI6Vc4YX0cfFnG5rxBfrZUH45S4XYtYGOz+/Xl4h4d2iMk50b7veHkeSWGlB4VHC3UZ16zuYQ== -+ optionalDependencies: -+ jszip "2.6.0" -+ - "@electron/get@^1.0.1": - version "1.7.2" - resolved "https://registry.yarnpkg.com/@electron/get/-/get-1.7.2.tgz#286436a9fb56ff1a1fcdf0e80131fd65f4d1e0fd" -@@ -5421,6 +5438,13 @@ jsprim@^1.2.2: - json-schema "0.2.3" - verror "1.10.0" - -+jszip@2.6.0: -+ version "2.6.0" -+ resolved "https://registry.yarnpkg.com/jszip/-/jszip-2.6.0.tgz#7fb3e9c2f11c8a9840612db5dabbc8cf3a7534b7" -+ integrity sha1-f7PpwvEciphAYS212rvIzzp1NLc= -+ dependencies: -+ pako "~1.0.0" -+ - just-debounce@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/just-debounce/-/just-debounce-1.0.0.tgz#87fccfaeffc0b68cd19d55f6722943f929ea35ea" -@@ -6008,26 +6032,11 @@ minimatch@0.3: - dependencies: - brace-expansion "^1.1.7" - --minimist@0.0.8: -- version "0.0.8" -- resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" -- integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= -- --minimist@^1.2.0: -- version "1.2.0" -- resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" -- integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= -- --minimist@^1.2.5: -+minimist@0.0.8, minimist@^1.2.0, minimist@^1.2.5, minimist@~0.0.1: - version "1.2.5" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" - integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== - --minimist@~0.0.1: -- version "0.0.10" -- resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" -- integrity sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8= -- - minipass@^2.2.1, minipass@^2.3.3: - version "2.3.3" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.3.3.tgz#a7dcc8b7b833f5d368759cce544dccb55f50f233" -@@ -6797,6 +6806,11 @@ p-try@^2.0.0: - resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.0.0.tgz#85080bb87c64688fa47996fe8f7dfbe8211760b1" - integrity sha512-hMp0onDKIajHfIkdRk3P4CdCmErkYAxxDtP3Wx/4nZ3aGlau2VKh3mZpcuFkH27WQkL/3WBCPOktzA9ZOAnMQQ== - -+pako@~1.0.0: -+ version "1.0.11" -+ resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.11.tgz#6c9599d340d54dfd3946380252a35705a6b992bf" -+ integrity sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw== -+ - pako@~1.0.5: - version "1.0.6" - resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.6.tgz#0101211baa70c4bca4a0f63f2206e97b7dfaf258" diff --git a/ci/dev/vscode.sh b/ci/dev/vscode.sh deleted file mode 100755 index 6c508747aa6f..000000000000 --- a/ci/dev/vscode.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -# 1. Ensures VS Code is cloned. -# 2. Patches it. -# 3. Installs it. -main() { - cd "$(dirname "$0")/../.." - - git submodule update --init - - # If the patch fails to apply, then it's likely already applied - yarn vscode:patch &> /dev/null || true - - ( - cd lib/vscode - # Install VS Code dependencies. - yarn ${CI+--frozen-lockfile} - ) -} - -main "$@" diff --git a/ci/dev/watch.ts b/ci/dev/watch.ts index 646da328b3f8..e48489ce69dc 100644 --- a/ci/dev/watch.ts +++ b/ci/dev/watch.ts @@ -1,193 +1,142 @@ -import * as cp from "child_process" -import Bundler from "parcel-bundler" +import { spawn, ChildProcess } from "child_process" import * as path from "path" - -async function main(): Promise { - try { - const watcher = new Watcher() - await watcher.watch() - } catch (error) { - console.error(error.message) - process.exit(1) - } +import { onLine, OnLineCallback } from "../../src/node/util" + +interface DevelopmentCompilers { + [key: string]: ChildProcess | undefined + vscode: ChildProcess + vscodeWebExtensions: ChildProcess + codeServer: ChildProcess + plugins: ChildProcess | undefined } class Watcher { - private readonly rootPath = path.resolve(__dirname, "../..") - private readonly vscodeSourcePath = path.join(this.rootPath, "lib/vscode") + private rootPath = path.resolve(process.cwd()) + private readonly paths = { + /** Path to uncompiled VS Code source. */ + vscodeDir: path.join(this.rootPath, "lib/vscode"), + pluginDir: process.env.PLUGIN_DIR, + } + + //#region Web Server + + /** Development web server. */ + private webServer: ChildProcess | undefined - private static log(message: string, skipNewline = false): void { - process.stdout.write(message) - if (!skipNewline) { - process.stdout.write("\n") + private reloadWebServer = (): void => { + if (this.webServer) { + this.webServer.kill() } + + // Pass CLI args, save for `node` and the initial script name. + const args = process.argv.slice(2) + this.webServer = spawn("node", [path.join(this.rootPath, "out/node/entry.js"), ...args]) + onLine(this.webServer, (line) => console.log("[code-server]", line)) + const { pid } = this.webServer + + this.webServer.on("exit", () => console.log("[code-server]", `Web process ${pid} exited`)) + + console.log("\n[code-server]", `Spawned web server process ${pid}`) } - public async watch(): Promise { - let server: cp.ChildProcess | undefined - const restartServer = (): void => { - if (server) { - server.kill() - } - const s = cp.fork(path.join(this.rootPath, "out/node/entry.js"), process.argv.slice(2)) - console.log(`[server] spawned process ${s.pid}`) - s.on("exit", () => console.log(`[server] process ${s.pid} exited`)) - server = s + //#endregion + + //#region Compilers + + private readonly compilers: DevelopmentCompilers = { + codeServer: spawn("tsc", ["--watch", "--pretty", "--preserveWatchOutput"], { cwd: this.rootPath }), + vscode: spawn("npm", ["run", "watch"], { cwd: this.paths.vscodeDir }), + vscodeWebExtensions: spawn("npm", ["run", "watch-web"], { cwd: this.paths.vscodeDir }), + plugins: this.paths.pluginDir + ? spawn("npm", ["run", "build", "--watch"], { cwd: this.paths.pluginDir }) + : undefined, + } + + public async initialize(): Promise { + for (const event of ["SIGINT", "SIGTERM"]) { + process.on(event, () => this.dispose(0)) } - const vscode = cp.spawn("yarn", ["watch"], { cwd: this.vscodeSourcePath }) - const tsc = cp.spawn("tsc", ["--watch", "--pretty", "--preserveWatchOutput"], { cwd: this.rootPath }) - const plugin = process.env.PLUGIN_DIR - ? cp.spawn("yarn", ["build", "--watch"], { cwd: process.env.PLUGIN_DIR }) - : undefined - const bundler = this.createBundler() - - const cleanup = (code?: number | null): void => { - Watcher.log("killing vs code watcher") - vscode.removeAllListeners() - vscode.kill() - - Watcher.log("killing tsc") - tsc.removeAllListeners() - tsc.kill() - - if (plugin) { - Watcher.log("killing plugin") - plugin.removeAllListeners() - plugin.kill() - } + for (const [processName, devProcess] of Object.entries(this.compilers)) { + if (!devProcess) continue - if (server) { - Watcher.log("killing server") - server.removeAllListeners() - server.kill() + devProcess.on("exit", (code) => { + console.log(`[${processName}]`, "Terminated unexpectedly") + this.dispose(code) + }) + + if (devProcess.stderr) { + devProcess.stderr.on("data", (d: string | Uint8Array) => process.stderr.write(d)) } + } + + onLine(this.compilers.vscode, this.parseVSCodeLine) + onLine(this.compilers.codeServer, this.parseCodeServerLine) - Watcher.log("killing bundler") - process.exit(code || 0) + if (this.compilers.plugins) { + onLine(this.compilers.plugins, this.parsePluginLine) } + } - process.on("SIGINT", () => cleanup()) - process.on("SIGTERM", () => cleanup()) - - vscode.on("exit", (code) => { - Watcher.log("vs code watcher terminated unexpectedly") - cleanup(code) - }) - tsc.on("exit", (code) => { - Watcher.log("tsc terminated unexpectedly") - cleanup(code) - }) - if (plugin) { - plugin.on("exit", (code) => { - Watcher.log("plugin terminated unexpectedly") - cleanup(code) - }) + //#endregion + + //#region Line Parsers + + private parseVSCodeLine: OnLineCallback = (strippedLine, originalLine) => { + if (!strippedLine.length) return + + console.log("[Code OSS]", originalLine) + + if (strippedLine.includes("Finished compilation with")) { + console.log("[Code OSS] ✨ Finished compiling! ✨", "(Refresh your web browser ♻️)") + this.reloadWebServer() } - const bundle = bundler.bundle().catch(() => { - Watcher.log("parcel watcher terminated unexpectedly") - cleanup(1) - }) - bundler.on("buildEnd", () => { - console.log("[parcel] bundled") - }) - bundler.on("buildError", (error) => { - console.error("[parcel]", error) - }) - - vscode.stderr.on("data", (d) => process.stderr.write(d)) - tsc.stderr.on("data", (d) => process.stderr.write(d)) - if (plugin) { - plugin.stderr.on("data", (d) => process.stderr.write(d)) + } + + private parseCodeServerLine: OnLineCallback = (strippedLine, originalLine) => { + if (!strippedLine.length) return + + console.log("[Compiler][code-server]", originalLine) + + if (strippedLine.includes("Watching for file changes")) { + console.log("[Compiler][code-server]", "Finished compiling!", "(Refresh your web browser ♻️)") + this.reloadWebServer() } + } - // From https://github.com/chalk/ansi-regex - const pattern = [ - "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", - "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))", - ].join("|") - const re = new RegExp(pattern, "g") - - /** - * Split stdout on newlines and strip ANSI codes. - */ - const onLine = (proc: cp.ChildProcess, callback: (strippedLine: string, originalLine: string) => void): void => { - let buffer = "" - if (!proc.stdout) { - throw new Error("no stdout") - } - proc.stdout.setEncoding("utf8") - proc.stdout.on("data", (d) => { - const data = buffer + d - const split = data.split("\n") - const last = split.length - 1 - - for (let i = 0; i < last; ++i) { - callback(split[i].replace(re, ""), split[i]) - } - - // The last item will either be an empty string (the data ended with a - // newline) or a partial line (did not end with a newline) and we must - // wait to parse it until we get a full line. - buffer = split[last] - }) + private parsePluginLine: OnLineCallback = (strippedLine, originalLine) => { + if (!strippedLine.length) return + + console.log("[Compiler][Plugin]", originalLine) + + if (strippedLine.includes("Watching for file changes...")) { + this.reloadWebServer() } + } - let startingVscode = false - let startedVscode = false - onLine(vscode, (line, original) => { - console.log("[vscode]", original) - // Wait for watch-client since "Finished compilation" will appear multiple - // times before the client starts building. - if (!startingVscode && line.includes("Starting watch-client")) { - startingVscode = true - } else if (startingVscode && line.includes("Finished compilation")) { - if (startedVscode) { - bundle.then(restartServer) - } - startedVscode = true - } - }) + //#endregion - onLine(tsc, (line, original) => { - // tsc outputs blank lines; skip them. - if (line !== "") { - console.log("[tsc]", original) - } - if (line.includes("Watching for file changes")) { - bundle.then(restartServer) - } - }) - - if (plugin) { - onLine(plugin, (line, original) => { - // tsc outputs blank lines; skip them. - if (line !== "") { - console.log("[plugin]", original) - } - if (line.includes("Watching for file changes")) { - bundle.then(restartServer) - } - }) + //#region Utilities + + private dispose(code: number | null): void { + for (const [processName, devProcess] of Object.entries(this.compilers)) { + console.log(`[${processName}]`, "Killing...\n") + devProcess?.removeAllListeners() + devProcess?.kill() } + process.exit(typeof code === "number" ? code : 0) } - private createBundler(out = "dist"): Bundler { - return new Bundler( - [ - path.join(this.rootPath, "src/browser/register.ts"), - path.join(this.rootPath, "src/browser/serviceWorker.ts"), - path.join(this.rootPath, "src/browser/pages/login.ts"), - path.join(this.rootPath, "src/browser/pages/vscode.ts"), - ], - { - outDir: path.join(this.rootPath, out), - cacheDir: path.join(this.rootPath, ".cache"), - minify: !!process.env.MINIFY, - logLevel: 1, - publicUrl: ".", - }, - ) + //#endregion +} + +async function main(): Promise { + try { + const watcher = new Watcher() + await watcher.initialize() + } catch (error: any) { + console.error(error.message) + process.exit(1) } } diff --git a/ci/helm-chart/.helmignore b/ci/helm-chart/.helmignore new file mode 100644 index 000000000000..0e8a0eb36f4c --- /dev/null +++ b/ci/helm-chart/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/ci/helm-chart/Chart.yaml b/ci/helm-chart/Chart.yaml new file mode 100644 index 000000000000..00e7221ee109 --- /dev/null +++ b/ci/helm-chart/Chart.yaml @@ -0,0 +1,23 @@ +apiVersion: v2 +name: code-server +description: A Helm chart for coder/code-server + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 3.31.2 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +appVersion: 4.104.2 diff --git a/ci/helm-chart/templates/NOTES.txt b/ci/helm-chart/templates/NOTES.txt new file mode 100644 index 000000000000..45c9aed3881d --- /dev/null +++ b/ci/helm-chart/templates/NOTES.txt @@ -0,0 +1,24 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "code-server.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "code-server.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "code-server.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl port-forward --namespace {{ .Release.Namespace }} service/{{ include "code-server.fullname" . }} 8080:http +{{- end }} + +Administrator credentials: + + Password: echo $(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "code-server.fullname" . }} -o jsonpath="{.data.password}" | base64 --decode) diff --git a/ci/helm-chart/templates/_helpers.tpl b/ci/helm-chart/templates/_helpers.tpl new file mode 100644 index 000000000000..bb36e8c21972 --- /dev/null +++ b/ci/helm-chart/templates/_helpers.tpl @@ -0,0 +1,63 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "code-server.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "code-server.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "code-server.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common labels +*/}} +{{- define "code-server.labels" -}} +helm.sh/chart: {{ include "code-server.chart" . }} +{{ include "code-server.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "code-server.selectorLabels" -}} +app.kubernetes.io/name: {{ include "code-server.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "code-server.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (include "code-server.fullname" .) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} diff --git a/ci/helm-chart/templates/deployment.yaml b/ci/helm-chart/templates/deployment.yaml new file mode 100644 index 000000000000..8f6fd89a5800 --- /dev/null +++ b/ci/helm-chart/templates/deployment.yaml @@ -0,0 +1,193 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "code-server.fullname" . }} + labels: + app.kubernetes.io/name: {{ include "code-server.name" . }} + helm.sh/chart: {{ include "code-server.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + {{- if .Values.annotations }} + annotations: {{- toYaml .Values.annotations | nindent 4 }} + {{- end }} +spec: + replicas: {{ .Values.replicaCount | default 1 }} + strategy: + type: Recreate + selector: + matchLabels: + app.kubernetes.io/name: {{ include "code-server.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + template: + metadata: + labels: + app.kubernetes.io/name: {{ include "code-server.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + {{- if .Values.podAnnotations }} + annotations: {{- toYaml .Values.podAnnotations | nindent 8 }} + {{- end }} + spec: + imagePullSecrets: {{- toYaml .Values.imagePullSecrets | nindent 8 }} + {{- if .Values.hostnameOverride }} + hostname: {{ .Values.hostnameOverride }} + {{- end }} + {{- if .Values.priorityClassName }} + priorityClassName: {{ .Values.priorityClassName }} + {{- end }} + {{- if .Values.securityContext.enabled }} + securityContext: + fsGroup: {{ .Values.securityContext.fsGroup }} + {{- end }} + {{- if or (and .Values.volumePermissions.enabled .Values.persistence.enabled) .Values.extraInitContainers }} + initContainers: + {{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }} + - name: init-chmod-data + image: busybox:latest + imagePullPolicy: IfNotPresent + command: + - sh + - -c + - | + chown -R {{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }} /home/coder + securityContext: + runAsUser: {{ .Values.volumePermissions.securityContext.runAsUser }} + volumeMounts: + - name: data + mountPath: /home/coder + {{- end }} +{{- if .Values.extraInitContainers }} +{{ tpl .Values.extraInitContainers . | indent 6}} +{{- end }} + {{- end }} + containers: +{{- if .Values.extraContainers }} +{{ tpl .Values.extraContainers . | indent 8}} +{{- end }} + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if .Values.securityContext.enabled }} + securityContext: + runAsUser: {{ .Values.securityContext.runAsUser }} + {{- end }} + {{- if .Values.lifecycle.enabled }} + lifecycle: + {{- if .Values.lifecycle.postStart }} + postStart: + {{ toYaml .Values.lifecycle.postStart | nindent 14 }} + {{- end }} + {{- if .Values.lifecycle.preStop }} + preStop: + {{ toYaml .Values.lifecycle.preStop | nindent 14 }} + {{- end }} + {{- end }} + env: + {{- if .Values.extraVars }} +{{ toYaml .Values.extraVars | indent 10 }} + {{- end }} + - name: PASSWORD + valueFrom: + secretKeyRef: + {{- if .Values.existingSecret }} + name: {{ .Values.existingSecret }} + {{- else }} + name: {{ template "code-server.fullname" . }} + {{- end }} + key: password + {{- if .Values.extraArgs }} + args: +{{ toYaml .Values.extraArgs | indent 10 }} + {{- end }} + volumeMounts: + - name: data + mountPath: /home/coder + {{- range .Values.extraConfigmapMounts }} + - name: {{ .name }} + mountPath: {{ .mountPath }} + subPath: {{ .subPath | default "" }} + readOnly: {{ .readOnly }} + {{- end }} + {{- range .Values.extraSecretMounts }} + - name: {{ .name }} + mountPath: {{ .mountPath }} + subPath: {{ .subPath | default "" }} + readOnly: {{ .readOnly }} + {{- end }} + {{- range .Values.extraVolumeMounts }} + - name: {{ .name }} + mountPath: {{ .mountPath }} + subPath: {{ .subPath | default "" }} + readOnly: {{ .readOnly }} + {{- end }} + ports: + - name: http + containerPort: 8080 + protocol: TCP + {{- range .Values.extraPorts }} + - name: {{ .name }} + containerPort: {{ .port }} + protocol: {{ .protocol }} + {{- end }} + livenessProbe: + httpGet: + path: / + port: http + readinessProbe: + httpGet: + path: / + port: http + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- tpl . $ | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ template "code-server.serviceAccountName" . }} + volumes: + - name: data + {{- if .Values.persistence.enabled }} + {{- if not .Values.persistence.hostPath }} + persistentVolumeClaim: + claimName: {{ .Values.persistence.existingClaim | default (include "code-server.fullname" .) }} + {{- else }} + hostPath: + path: {{ .Values.persistence.hostPath }} + type: Directory + {{- end -}} + {{- else }} + emptyDir: {} + {{- end -}} + {{- range .Values.extraSecretMounts }} + - name: {{ .name }} + secret: + secretName: {{ .secretName }} + defaultMode: {{ .defaultMode }} + {{- end }} + {{- range .Values.extraConfigmapMounts }} + - name: {{ .name }} + configMap: + name: {{ .configMap }} + defaultMode: {{ .defaultMode }} + {{- end }} + {{- range .Values.extraVolumeMounts }} + - name: {{ .name }} + {{- if .existingClaim }} + persistentVolumeClaim: + claimName: {{ .existingClaim }} + {{- else if .hostPath }} + hostPath: + path: {{ .hostPath }} + type: Directory + {{- else }} + emptyDir: + {{- toYaml .emptyDir | nindent 10 }} + {{- end }} + {{- end }} diff --git a/ci/helm-chart/templates/ingress.yaml b/ci/helm-chart/templates/ingress.yaml new file mode 100644 index 000000000000..1da432074b29 --- /dev/null +++ b/ci/helm-chart/templates/ingress.yaml @@ -0,0 +1,63 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "code-server.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "code-server.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if .Values.ingress.ingressClassName }} + ingressClassName: {{ .Values.ingress.ingressClassName }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion -}} + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ . }} + pathType: Prefix + backend: + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- end }} + {{- end }} + {{- else -}} + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ . }} + backend: + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/ci/helm-chart/templates/pvc.yaml b/ci/helm-chart/templates/pvc.yaml new file mode 100644 index 000000000000..2f1c87405886 --- /dev/null +++ b/ci/helm-chart/templates/pvc.yaml @@ -0,0 +1,29 @@ +{{- if and (and .Values.persistence.enabled (not .Values.persistence.existingClaim)) (not .Values.persistence.hostPath) }} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ include "code-server.fullname" . }} + namespace: {{ .Release.Namespace }} +{{- with .Values.persistence.annotations }} + annotations: +{{ toYaml . | indent 4 }} +{{- end }} + labels: + app.kubernetes.io/name: {{ include "code-server.name" . }} + helm.sh/chart: {{ include "code-server.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +spec: + accessModes: + - {{ .Values.persistence.accessMode | quote }} + resources: + requests: + storage: {{ .Values.persistence.size | quote }} +{{- if .Values.persistence.storageClass }} +{{- if (eq "-" .Values.persistence.storageClass) }} + storageClassName: "" +{{- else }} + storageClassName: "{{ .Values.persistence.storageClass }}" +{{- end }} +{{- end }} +{{- end }} diff --git a/ci/helm-chart/templates/secrets.yaml b/ci/helm-chart/templates/secrets.yaml new file mode 100644 index 000000000000..ae59be450743 --- /dev/null +++ b/ci/helm-chart/templates/secrets.yaml @@ -0,0 +1,20 @@ +{{- if not .Values.existingSecret }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "code-server.fullname" . }} + annotations: + "helm.sh/hook": "pre-install" + labels: + app.kubernetes.io/name: {{ include "code-server.name" . }} + helm.sh/chart: {{ include "code-server.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +type: Opaque +data: + {{- if .Values.password }} + password: "{{ .Values.password | b64enc }}" + {{- else }} + password: "{{ randAlphaNum 24 | b64enc }}" + {{- end }} +{{- end }} diff --git a/ci/helm-chart/templates/service.yaml b/ci/helm-chart/templates/service.yaml new file mode 100644 index 000000000000..d5a3c5e8ab38 --- /dev/null +++ b/ci/helm-chart/templates/service.yaml @@ -0,0 +1,25 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "code-server.fullname" . }} + labels: + app.kubernetes.io/name: {{ include "code-server.name" . }} + helm.sh/chart: {{ include "code-server.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + {{- range .Values.extraPorts }} + - port: {{ .port }} + targetPort: {{ .port }} + protocol: {{ .protocol }} + name: {{ .name }} + {{- end }} + selector: + app.kubernetes.io/name: {{ include "code-server.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} diff --git a/ci/helm-chart/templates/serviceaccount.yaml b/ci/helm-chart/templates/serviceaccount.yaml new file mode 100644 index 000000000000..df9e1e37562b --- /dev/null +++ b/ci/helm-chart/templates/serviceaccount.yaml @@ -0,0 +1,11 @@ +{{- if or .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: + app.kubernetes.io/name: {{ include "code-server.name" . }} + helm.sh/chart: {{ include "code-server.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + name: {{ template "code-server.serviceAccountName" . }} +{{- end -}} diff --git a/ci/helm-chart/templates/tests/test-connection.yaml b/ci/helm-chart/templates/tests/test-connection.yaml new file mode 100644 index 000000000000..2e67f56ec64c --- /dev/null +++ b/ci/helm-chart/templates/tests/test-connection.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "code-server.fullname" . }}-test-connection" + labels: + app.kubernetes.io/name: {{ include "code-server.name" . }} + helm.sh/chart: {{ include "code-server.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + annotations: + "helm.sh/hook": test-success +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "code-server.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/ci/helm-chart/values.yaml b/ci/helm-chart/values.yaml new file mode 100644 index 000000000000..a414de0da0ec --- /dev/null +++ b/ci/helm-chart/values.yaml @@ -0,0 +1,226 @@ +# Default values for code-server. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: codercom/code-server + tag: '4.104.2' + pullPolicy: Always + +# Specifies one or more secrets to be used when pulling images from a +# private container repository +# https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry +imagePullSecrets: [] +# - name: registry-creds + +nameOverride: "" +fullnameOverride: "" +hostnameOverride: "" + +# The existing secret to use for code-server authentication in the frontend. the password is stored in the secret under the key `password` +# existingSecret: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +# Specifies annotations for deployment +annotations: {} + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +priorityClassName: "" + +service: + type: ClusterIP + port: 8080 + +ingress: + enabled: false + #annotations: + # kubernetes.io/tls-acme: "true" + #hosts: + # - host: code-server.example.loc + # paths: + # - / + ingressClassName: "" + #tls: + # - secretName: code-server + # hosts: + # - code-server.example.loc + +# Optional additional arguments +extraArgs: [] + # These are the arguments normally passed to code-server; run + # code-server --help for a list of available options. + # + # Each argument and parameter must have its own entry; if you use + # --param value on the command line, then enter it here as: + # + # - --param + # - value + # + # If you receive an error like "Unknown option --param value", it may be + # because both the parameter and value are specified as a single argument, + # rather than two separate arguments (e.g. "- --param value" on a line). + +# Optional additional environment variables +extraVars: [] +# - name: DISABLE_TELEMETRY +# value: "true" +# if dind is desired: +# - name: DOCKER_HOST +# value: "tcp://localhost:2376" + +## +## Init containers parameters: +## volumePermissions: Change the owner of the persist volume mountpoint to RunAsUser:fsGroup +## +volumePermissions: + enabled: true + securityContext: + runAsUser: 0 + +## Pod Security Context +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ +## +securityContext: + enabled: true + fsGroup: 1000 + runAsUser: 1000 + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 1000Mi + +nodeSelector: {} + +tolerations: [] + +affinity: {} + +## Persist data to a persistent volume +persistence: + enabled: true + ## code-server data Persistent Volume Storage Class + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack) + ## + # storageClass: "-" + accessMode: ReadWriteOnce + size: 10Gi + annotations: {} + # existingClaim: "" + # hostPath: /data + +lifecycle: + enabled: false + # postStart: + # exec: + # command: + # - /bin/bash + # - -c + # - curl -s -L SOME_SCRIPT | bash + + # for dind, the following may be helpful + # postStart: + # exec: + # command: + # - /bin/sh + # - -c + # - | + # sudo apt-get update \ + # && sudo apt-get install -y docker.io + +## Enable an Specify container in extraContainers. +## This is meant to allow adding code-server dependencies, like docker-dind. +extraContainers: | +# If docker-dind is used, DOCKER_HOST env is mandatory to set in "extraVars" +# - name: docker-dind +# image: docker:28.3.2-dind +# imagePullPolicy: IfNotPresent +# resources: +# requests: +# cpu: 1 +# ephemeral-storage: "50Gi" +# memory: 10Gi +# securityContext: +# privileged: true +# procMount: Default +# env: +# - name: DOCKER_TLS_CERTDIR +# value: "" # disable TLS setup +# command: +# - dockerd +# - --host=unix:///var/run/docker.sock +# - --host=tcp://0.0.0.0:2376 + + +extraInitContainers: | +# - name: customization +# image: {{ .Values.image.repository }}:{{ .Values.image.tag }} +# imagePullPolicy: IfNotPresent +# env: +# - name: SERVICE_URL +# value: https://open-vsx.org/vscode/gallery +# - name: ITEM_URL +# value: https://open-vsx.org/vscode/item +# command: +# - sh +# - -c +# - | +# code-server --install-extension ms-python.python +# code-server --install-extension golang.Go +# volumeMounts: +# - name: data +# mountPath: /home/coder + +## Additional code-server secret mounts +extraSecretMounts: [] + # - name: secret-files + # mountPath: /etc/secrets + # subPath: private.key # (optional) + # secretName: code-server-secret-files + # readOnly: true + +## Additional code-server volume mounts +extraVolumeMounts: [] + # - name: extra-volume + # mountPath: /mnt/volume + # readOnly: true + # existingClaim: volume-claim + # hostPath: "" + # emptyDir: {} + +extraConfigmapMounts: [] + # - name: certs-configmap + # mountPath: /etc/code-server/ssl/ + # subPath: certificates.crt # (optional) + # configMap: certs-configmap + # readOnly: true + +extraPorts: [] + # - name: minecraft + # port: 25565 + # protocol: tcp diff --git a/ci/images/centos7/Dockerfile b/ci/images/centos7/Dockerfile deleted file mode 100644 index 4e3f1f94c959..000000000000 --- a/ci/images/centos7/Dockerfile +++ /dev/null @@ -1,26 +0,0 @@ -FROM centos:7 - -RUN ARCH="$(uname -m | sed 's/86_64/64/; s/aarch64/arm64/')" && \ - curl -fsSL "https://nodejs.org/dist/v14.4.0/node-v14.4.0-linux-$ARCH.tar.xz" | tar -C /usr/local -xJ && \ - mv /usr/local/node-v14.4.0-linux-$ARCH /usr/local/node-v14.4.0 -ENV PATH=/usr/local/node-v14.4.0/bin:$PATH -RUN npm install -g yarn - -RUN yum groupinstall -y 'Development Tools' -RUN yum install -y python2 libsecret-devel libX11-devel libxkbfile-devel - -RUN npm config set python python2 - -RUN yum install -y epel-release && yum install -y jq -RUN yum install -y rsync - -# Copied from ../debian8/Dockerfile -# Install Go dependencies -RUN ARCH="$(uname -m | sed 's/x86_64/amd64/; s/aarch64/arm64/')" && \ - curl -fsSL "https://dl.google.com/go/go1.14.3.linux-$ARCH.tar.gz" | tar -C /usr/local -xz -ENV PATH=/usr/local/go/bin:/root/go/bin:$PATH -ENV GO111MODULE=on -RUN go get mvdan.cc/sh/v3/cmd/shfmt -RUN go get github.com/goreleaser/nfpm/cmd/nfpm - -RUN curl -fsSL https://get.docker.com | sh diff --git a/ci/images/debian8/Dockerfile b/ci/images/debian8/Dockerfile deleted file mode 100644 index fa3b16dcde4e..000000000000 --- a/ci/images/debian8/Dockerfile +++ /dev/null @@ -1,53 +0,0 @@ -FROM debian:8 - -RUN apt-get update - -# Needed for debian repositories added below. -RUN apt-get install -y curl gnupg - -# Installs node. -RUN curl -fsSL https://deb.nodesource.com/setup_14.x | bash - && \ - apt-get install -y nodejs - -# Installs yarn. -RUN curl -fsSL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ - echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \ - apt-get update && apt-get install -y yarn - -# Installs VS Code build deps. -RUN apt-get install -y build-essential \ - libsecret-1-dev \ - libx11-dev \ - libxkbfile-dev - -# Installs envsubst. -RUN apt-get install -y gettext-base - -# Misc build dependencies. -RUN apt-get install -y git rsync unzip - -# We need latest jq from debian buster for date support. -RUN ARCH="$(dpkg --print-architecture)" && \ - curl -fsSOL http://http.us.debian.org/debian/pool/main/libo/libonig/libonig5_6.9.1-1_$ARCH.deb && \ - dpkg -i libonig*.deb && \ - curl -fsSOL http://http.us.debian.org/debian/pool/main/j/jq/libjq1_1.5+dfsg-2+b1_$ARCH.deb && \ - dpkg -i libjq*.deb && \ - curl -fsSOL http://http.us.debian.org/debian/pool/main/j/jq/jq_1.5+dfsg-2+b1_$ARCH.deb && \ - dpkg -i jq*.deb && rm *.deb - -# Installs shellcheck. -# Unfortunately coredumps on debian:8 so disabled for now. -#RUN curl -fsSL https://github.com/koalaman/shellcheck/releases/download/v0.7.1/shellcheck-v0.7.1.linux.$(uname -m).tar.xz | \ -# tar -xJ && \ -# mv shellcheck*/shellcheck /usr/local/bin && \ -# rm -R shellcheck* - -# Install Go dependencies -RUN ARCH="$(uname -m | sed 's/x86_64/amd64/; s/aarch64/arm64/')" && \ - curl -fsSL "https://dl.google.com/go/go1.14.3.linux-$ARCH.tar.gz" | tar -C /usr/local -xz -ENV PATH=/usr/local/go/bin:/root/go/bin:$PATH -ENV GO111MODULE=on -RUN go get mvdan.cc/sh/v3/cmd/shfmt -RUN go get github.com/goreleaser/nfpm/cmd/nfpm - -RUN curl -fsSL https://get.docker.com | sh diff --git a/ci/lib.sh b/ci/lib.sh index d58c29cb1713..2b5023fd1c6b 100755 --- a/ci/lib.sh +++ b/ci/lib.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -euo pipefail pushd() { builtin pushd "$@" > /dev/null @@ -8,83 +9,41 @@ popd() { builtin popd > /dev/null } -pkg_json_version() { - jq -r .version package.json -} - vscode_version() { jq -r .version lib/vscode/package.json } os() { - local os - os=$(uname | tr '[:upper:]' '[:lower:]') - if [[ $os == "linux" ]]; then - # Alpine's ldd doesn't have a version flag but if you use an invalid flag - # (like --version) it outputs the version to stderr and exits with 1. - local ldd_output - ldd_output=$(ldd --version 2>&1 || true) - if echo "$ldd_output" | grep -iq musl; then - os="alpine" - fi - elif [[ $os == "darwin" ]]; then - os="macos" - fi - echo "$os" + osname=$(uname | tr '[:upper:]' '[:lower:]') + case $osname in + linux) + # Alpine's ldd doesn't have a version flag but if you use an invalid flag + # (like --version) it outputs the version to stderr and exits with 1. + # TODO: Better to check /etc/os-release; see ../install.sh. + ldd_output=$(ldd --version 2>&1 || true) + if echo "$ldd_output" | grep -iq musl; then + osname="alpine" + fi + ;; + darwin) osname="macos" ;; + cygwin* | mingw*) osname="windows" ;; + esac + echo "$osname" } arch() { - case "$(uname -m)" in - aarch64) - echo arm64 - ;; - x86_64) - echo amd64 - ;; - *) - echo "unknown architecture $(uname -a)" - exit 1 - ;; + cpu="$(uname -m)" + case "$cpu" in + aarch64) cpu=arm64 ;; + x86_64) cpu=amd64 ;; esac -} - -curl() { - command curl -H "Authorization: token $GITHUB_TOKEN" "$@" -} - -# Grabs the most recent ci.yaml github workflow run that was successful and triggered from the same commit being pushd. -# This will contain the artifacts we want. -# https://developer.github.com/v3/actions/workflow-runs/#list-workflow-runs -get_artifacts_url() { - curl -fsSL 'https://api.github.com/repos/cdr/code-server/actions/workflows/ci.yaml/runs?status=success&event=push' | jq -r ".workflow_runs[] | select(.head_sha == \"$(git rev-parse HEAD)\") | .artifacts_url" | head -n 1 -} - -# Grabs the artifact's download url. -# https://developer.github.com/v3/actions/artifacts/#list-workflow-run-artifacts -get_artifact_url() { - local artifact_name="$1" - curl -fsSL "$(get_artifacts_url)" | jq -r ".artifacts[] | select(.name == \"$artifact_name\") | .archive_download_url" | head -n 1 -} - -# Uses the above two functions to download a artifact into a directory. -download_artifact() { - local artifact_name="$1" - local dst="$2" - - local tmp_file - tmp_file="$(mktemp)" - - curl -fsSL "$(get_artifact_url "$artifact_name")" > "$tmp_file" - unzip -q -o "$tmp_file" -d "$dst" - rm "$tmp_file" + echo "$cpu" } rsync() { command rsync -a --del "$@" } -VERSION="$(pkg_json_version)" -export VERSION ARCH="$(arch)" export ARCH OS=$(os) diff --git a/ci/release-image/Dockerfile b/ci/release-image/Dockerfile index defc15c9ffb5..fba7189e6999 100644 --- a/ci/release-image/Dockerfile +++ b/ci/release-image/Dockerfile @@ -1,19 +1,29 @@ -FROM debian:10 +# syntax=docker/dockerfile:experimental + +ARG BASE=debian:12 +FROM scratch AS packages +COPY release-packages/code-server*.deb /tmp/ + +FROM $BASE RUN apt-get update \ - && apt-get install -y \ + && apt-get install -y \ curl \ dumb-init \ + git \ + git-lfs \ htop \ locales \ - man \ + lsb-release \ + man-db \ nano \ - git \ + openssh-client \ procps \ - ssh \ sudo \ - vim \ - lsb-release \ + vim-tiny \ + wget \ + zsh \ + && git lfs install \ && rm -rf /var/lib/apt/lists/* # https://wiki.debian.org/Locale#Manually @@ -21,23 +31,31 @@ RUN sed -i "s/# en_US.UTF-8/en_US.UTF-8/" /etc/locale.gen \ && locale-gen ENV LANG=en_US.UTF-8 -RUN chsh -s /bin/bash -ENV SHELL=/bin/bash +RUN if grep -q 1000 /etc/passwd; then \ + userdel -r "$(id -un 1000)"; \ + fi \ + && adduser --gecos '' --disabled-password coder \ + && echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd -RUN adduser --gecos '' --disabled-password coder && \ - echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd +RUN ARCH="$(dpkg --print-architecture)" \ + && curl -fsSL "https://github.com/boxboat/fixuid/releases/download/v0.6.0/fixuid-0.6.0-linux-$ARCH.tar.gz" | tar -C /usr/local/bin -xzf - \ + && chown root:root /usr/local/bin/fixuid \ + && chmod 4755 /usr/local/bin/fixuid \ + && mkdir -p /etc/fixuid \ + && printf "user: coder\ngroup: coder\n" > /etc/fixuid/config.yml -RUN ARCH="$(dpkg --print-architecture)" && \ - curl -fsSL "https://github.com/boxboat/fixuid/releases/download/v0.4.1/fixuid-0.4.1-linux-$ARCH.tar.gz" | tar -C /usr/local/bin -xzf - && \ - chown root:root /usr/local/bin/fixuid && \ - chmod 4755 /usr/local/bin/fixuid && \ - mkdir -p /etc/fixuid && \ - printf "user: coder\ngroup: coder\n" > /etc/fixuid/config.yml +COPY ci/release-image/entrypoint.sh /usr/bin/entrypoint.sh +RUN --mount=from=packages,src=/tmp,dst=/tmp/packages dpkg -i /tmp/packages/code-server*$(dpkg --print-architecture).deb -COPY release-packages/code-server*.deb /tmp/ -RUN dpkg -i /tmp/code-server*$(dpkg --print-architecture).deb && rm /tmp/code-server*.deb +# Allow users to have scripts run on container startup to prepare workspace. +# https://github.com/coder/code-server/issues/5177 +ENV ENTRYPOINTD=${HOME}/entrypoint.d EXPOSE 8080 -USER coder +# This way, if someone sets $DOCKER_USER, docker-exec will still work as +# the uid will remain the same. note: only relevant if -u isn't passed to +# docker-run. +USER 1000 +ENV USER=coder WORKDIR /home/coder -ENTRYPOINT ["dumb-init", "fixuid", "-q", "/usr/bin/code-server", "--bind-addr", "0.0.0.0:8080", "."] +ENTRYPOINT ["/usr/bin/entrypoint.sh", "--bind-addr", "0.0.0.0:8080", "."] diff --git a/ci/release-image/Dockerfile.fedora b/ci/release-image/Dockerfile.fedora new file mode 100644 index 000000000000..ec618530cb78 --- /dev/null +++ b/ci/release-image/Dockerfile.fedora @@ -0,0 +1,51 @@ +# syntax=docker/dockerfile:experimental + +ARG BASE=fedora:39 +FROM scratch AS packages +COPY release-packages/code-server*.rpm /tmp/ + +FROM $BASE + +RUN dnf update -y \ + && dnf install -y \ + curl \ + git \ + git-lfs \ + htop \ + nano \ + openssh-clients \ + procps \ + wget \ + zsh \ + dumb-init \ + glibc-langpack-en \ + && rm -rf /var/cache/dnf +RUN git lfs install + +ENV LANG=en_US.UTF-8 +RUN echo 'LANG="en_US.UTF-8"' > /etc/locale.conf + +RUN useradd -u 1000 coder && echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd + +RUN ARCH="$(uname -m | sed 's/x86_64/amd64/g' | sed 's/aarch64/arm64/g')" \ + && curl -fsSL "https://github.com/boxboat/fixuid/releases/download/v0.6.0/fixuid-0.6.0-linux-$ARCH.tar.gz" | tar -C /usr/local/bin -xzf - \ + && chown root:root /usr/local/bin/fixuid \ + && chmod 4755 /usr/local/bin/fixuid \ + && mkdir -p /etc/fixuid \ + && printf "user: coder\ngroup: coder\n" > /etc/fixuid/config.yml + +COPY ci/release-image/entrypoint.sh /usr/bin/entrypoint.sh +RUN --mount=from=packages,src=/tmp,dst=/tmp/packages rpm -i /tmp/packages/code-server*$(uname -m | sed 's/x86_64/amd64/g' | sed 's/aarch64/arm64/g').rpm + +# Allow users to have scripts run on container startup to prepare workspace. +# https://github.com/coder/code-server/issues/5177 +ENV ENTRYPOINTD=${HOME}/entrypoint.d + +EXPOSE 8080 +# This way, if someone sets $DOCKER_USER, docker-exec will still work as +# the uid will remain the same. note: only relevant if -u isn't passed to +# docker-run. +USER 1000 +ENV USER=coder +WORKDIR /home/coder +ENTRYPOINT ["/usr/bin/entrypoint.sh", "--bind-addr", "0.0.0.0:8080", "."] diff --git a/ci/release-image/Dockerfile.opensuse b/ci/release-image/Dockerfile.opensuse new file mode 100644 index 000000000000..f445d45c27b1 --- /dev/null +++ b/ci/release-image/Dockerfile.opensuse @@ -0,0 +1,51 @@ +# syntax=docker/dockerfile:experimental + +ARG BASE=opensuse/tumbleweed +FROM scratch AS packages +COPY release-packages/code-server*.rpm /tmp/ + +FROM $BASE + +RUN zypper dup -y \ + && zypper in -y \ + curl \ + git \ + git-lfs \ + htop \ + nano \ + openssh-clients \ + procps \ + wget \ + zsh \ + sudo \ + catatonit \ + && rm -rf /var/cache/zypp /var/cache/zypper +RUN git lfs install + +ENV LANG=en_US.UTF-8 +RUN echo 'LANG="en_US.UTF-8"' > /etc/locale.conf + +RUN useradd -u 1000 coder && echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd + +RUN ARCH="$(uname -m | sed 's/x86_64/amd64/g' | sed 's/aarch64/arm64/g')" \ + && curl -fsSL "https://github.com/boxboat/fixuid/releases/download/v0.6.0/fixuid-0.6.0-linux-$ARCH.tar.gz" | tar -C /usr/local/bin -xzf - \ + && chown root:root /usr/local/bin/fixuid \ + && chmod 4755 /usr/local/bin/fixuid \ + && mkdir -p /etc/fixuid \ + && printf "user: coder\ngroup: coder\n" > /etc/fixuid/config.yml + +COPY ci/release-image/entrypoint-catatonit.sh /usr/bin/entrypoint-catatonit.sh +RUN --mount=from=packages,src=/tmp,dst=/tmp/packages rpm -i /tmp/packages/code-server*$(uname -m | sed 's/x86_64/amd64/g' | sed 's/aarch64/arm64/g').rpm + +# Allow users to have scripts run on container startup to prepare workspace. +# https://github.com/coder/code-server/issues/5177 +ENV ENTRYPOINTD=${HOME}/entrypoint.d + +EXPOSE 8080 +# This way, if someone sets $DOCKER_USER, docker-exec will still work as +# the uid will remain the same. note: only relevant if -u isn't passed to +# docker-run. +USER 1000 +ENV USER=coder +WORKDIR /home/coder +ENTRYPOINT ["/usr/bin/entrypoint-catatonit.sh", "--bind-addr", "0.0.0.0:8080", "."] diff --git a/ci/release-image/build.sh b/ci/release-image/build.sh deleted file mode 100755 index 5969e15ae9a6..000000000000 --- a/ci/release-image/build.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -main() { - cd "$(dirname "$0")/../.." - source ./ci/lib.sh - - docker build -t "codercom/code-server-$ARCH:$VERSION" -f ./ci/release-image/Dockerfile . -} - -main "$@" diff --git a/ci/release-image/docker-bake.hcl b/ci/release-image/docker-bake.hcl new file mode 100644 index 000000000000..182f12791ec1 --- /dev/null +++ b/ci/release-image/docker-bake.hcl @@ -0,0 +1,106 @@ +# Use this file from the top of the repo, with `-f ci/release-image/docker-bake.hcl` + +# Uses env var VERSION if set; +# normally, this is set by ci/lib.sh +variable "VERSION" { + default = "latest" +} + +variable "DOCKER_REGISTRY" { + default = "docker.io/codercom/code-server" +} + +variable "GITHUB_REGISTRY" { + default = "ghcr.io/coder/code-server" +} + +group "default" { + targets = [ + "code-server-debian-12", + "code-server-ubuntu-focal", + "code-server-ubuntu-noble", + "code-server-fedora-39", + "code-server-opensuse-tumbleweed", + ] +} + +function "prepend_hyphen_if_not_null" { + params = [tag] + result = notequal("","${tag}") ? "-${tag}" : "${tag}" +} + +# use empty tag (tag="") to generate default tags +function "gen_tags" { + params = [registry, tag] + result = notequal("","${registry}") ? [ + notequal("", "${tag}") ? "${registry}:${tag}" : "${registry}:latest", + notequal("latest",VERSION) ? "${registry}:${VERSION}${prepend_hyphen_if_not_null(tag)}" : "", + ] : [] +} + +# helper function to generate tags for docker registry and github registry. +# set (DOCKER|GITHUB)_REGISTRY="" to disable corresponding registry +function "gen_tags_for_docker_and_ghcr" { + params = [tag] + result = concat( + gen_tags("${DOCKER_REGISTRY}", "${tag}"), + gen_tags("${GITHUB_REGISTRY}", "${tag}"), + ) +} + +target "code-server-debian-12" { + dockerfile = "ci/release-image/Dockerfile" + tags = concat( + gen_tags_for_docker_and_ghcr(""), + gen_tags_for_docker_and_ghcr("debian"), + gen_tags_for_docker_and_ghcr("bookworm"), + ) + platforms = ["linux/amd64", "linux/arm64"] +} + +target "code-server-ubuntu-focal" { + dockerfile = "ci/release-image/Dockerfile" + tags = concat( + gen_tags_for_docker_and_ghcr("ubuntu"), + gen_tags_for_docker_and_ghcr("focal"), + ) + args = { + BASE = "ubuntu:focal" + } + platforms = ["linux/amd64", "linux/arm64"] +} + +target "code-server-ubuntu-noble" { + dockerfile = "ci/release-image/Dockerfile" + tags = concat( + gen_tags_for_docker_and_ghcr("noble"), + ) + args = { + BASE = "ubuntu:noble" + } + platforms = ["linux/amd64", "linux/arm64"] +} + +target "code-server-fedora-39" { + dockerfile = "ci/release-image/Dockerfile.fedora" + tags = concat( + gen_tags_for_docker_and_ghcr("fedora"), + gen_tags_for_docker_and_ghcr("39"), + ) + args = { + BASE = "fedora:39" + } + platforms = ["linux/amd64", "linux/arm64"] +} + +target "code-server-opensuse-tumbleweed" { + dockerfile = "ci/release-image/Dockerfile.opensuse" + tags = concat( + gen_tags_for_docker_and_ghcr("opensuse"), + gen_tags_for_docker_and_ghcr("tumbleweed"), + ) + args = { + BASE = "opensuse/tumbleweed" + } + platforms = ["linux/amd64", "linux/arm64"] +} diff --git a/ci/release-image/entrypoint-catatonit.sh b/ci/release-image/entrypoint-catatonit.sh new file mode 100755 index 000000000000..d22acc6d237b --- /dev/null +++ b/ci/release-image/entrypoint-catatonit.sh @@ -0,0 +1,27 @@ +#!/bin/sh +set -eu + +# We do this first to ensure sudo works below when renaming the user. +# Otherwise the current container UID may not exist in the passwd database. +eval "$(fixuid -q)" + +if [ "${DOCKER_USER-}" ]; then + USER="$DOCKER_USER" + if [ "$DOCKER_USER" != "$(whoami)" ]; then + echo "$DOCKER_USER ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers.d/nopasswd > /dev/null + # Unfortunately we cannot change $HOME as we cannot move any bind mounts + # nor can we bind mount $HOME into a new home as that requires a privileged container. + sudo usermod --login "$DOCKER_USER" coder + sudo groupmod -n "$DOCKER_USER" coder + + sudo sed -i "/coder/d" /etc/sudoers.d/nopasswd + fi +fi + +# Allow users to have scripts run on container startup to prepare workspace. +# https://github.com/coder/code-server/issues/5177 +if [ -d "${ENTRYPOINTD}" ]; then + find "${ENTRYPOINTD}" -type f -executable -print -exec {} \; +fi + +exec catatonit -- /usr/bin/code-server "$@" diff --git a/ci/release-image/entrypoint.sh b/ci/release-image/entrypoint.sh new file mode 100755 index 000000000000..efe2f39d9bd9 --- /dev/null +++ b/ci/release-image/entrypoint.sh @@ -0,0 +1,27 @@ +#!/bin/sh +set -eu + +# We do this first to ensure sudo works below when renaming the user. +# Otherwise the current container UID may not exist in the passwd database. +eval "$(fixuid -q)" + +if [ "${DOCKER_USER-}" ]; then + USER="$DOCKER_USER" + if [ -z "$(id -u "$DOCKER_USER" 2>/dev/null)" ]; then + echo "$DOCKER_USER ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers.d/nopasswd > /dev/null + # Unfortunately we cannot change $HOME as we cannot move any bind mounts + # nor can we bind mount $HOME into a new home as that requires a privileged container. + sudo usermod --login "$DOCKER_USER" coder + sudo groupmod -n "$DOCKER_USER" coder + + sudo sed -i "/coder/d" /etc/sudoers.d/nopasswd + fi +fi + +# Allow users to have scripts run on container startup to prepare workspace. +# https://github.com/coder/code-server/issues/5177 +if [ -d "${ENTRYPOINTD}" ]; then + find "${ENTRYPOINTD}" -type f -executable -print -exec {} \; +fi + +exec dumb-init /usr/bin/code-server "$@" diff --git a/ci/steps/brew-bump.sh b/ci/steps/brew-bump.sh new file mode 100755 index 000000000000..e8af2a22e8fd --- /dev/null +++ b/ci/steps/brew-bump.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash +set -euo pipefail + +main() { + # Only sourcing this so we get access to $VERSION + source ./ci/lib.sh + source ./ci/steps/steps-lib.sh + + echo "Checking environment variables" + + # We need VERSION to bump the brew formula + if ! is_env_var_set "VERSION"; then + echo "VERSION is not set" + exit 1 + fi + + # We need HOMEBREW_GITHUB_API_TOKEN to push up commits + if ! is_env_var_set "HOMEBREW_GITHUB_API_TOKEN"; then + echo "HOMEBREW_GITHUB_API_TOKEN is not set" + exit 1 + fi + + # Find the docs for bump-formula-pr here + # https://github.com/Homebrew/brew/blob/master/Library/Homebrew/dev-cmd/bump-formula-pr.rb#L18 + local output + if ! output=$(brew bump-formula-pr --version="${VERSION}" code-server --no-browse --no-audit --message="PR opened by @${GITHUB_ACTOR}" 2>&1); then + if [[ $output == *"Duplicate PRs should not be opened"* ]]; then + echo "$VERSION is already submitted" + exit 0 + else + echo "$output" + exit 1 + fi + fi +} + +main "$@" diff --git a/ci/steps/build-docker-image.sh b/ci/steps/build-docker-image.sh deleted file mode 100755 index 16653a0e9ed2..000000000000 --- a/ci/steps/build-docker-image.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -main() { - cd "$(dirname "$0")/../.." - source ./ci/lib.sh - - ./ci/release-image/build.sh - - mkdir -p release-images - docker save "codercom/code-server-$ARCH:$VERSION" > "release-images/code-server-$ARCH-$VERSION.tar" -} - -main "$@" diff --git a/ci/steps/docker-buildx-push.sh b/ci/steps/docker-buildx-push.sh new file mode 100755 index 000000000000..6314063ffa54 --- /dev/null +++ b/ci/steps/docker-buildx-push.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -euo pipefail + +main() { + cd "$(dirname "$0")/../.." + # NOTE@jsjoeio - this script assumes VERSION exists as an + # environment variable. + + # NOTE@jsjoeio - this script assumes that you've downloaded + # the release-packages artifact to ./release-packages before + # running this docker buildx step + docker buildx bake -f ci/release-image/docker-bake.hcl --push +} + +main "$@" diff --git a/ci/steps/fmt.sh b/ci/steps/fmt.sh deleted file mode 100755 index 5e323596cd59..000000000000 --- a/ci/steps/fmt.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -main() { - cd "$(dirname "$0")/../.." - - yarn --frozen-lockfile - - git submodule update --init - # We do not `yarn vscode` to make test.sh faster. - # If the patch fails to apply, then it's likely already applied - yarn vscode:patch &> /dev/null || true - - yarn fmt -} - -main "$@" diff --git a/ci/steps/lint.sh b/ci/steps/lint.sh deleted file mode 100755 index b493e160652f..000000000000 --- a/ci/steps/lint.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -main() { - cd "$(dirname "$0")/../.." - - yarn --frozen-lockfile - - git submodule update --init - # We do not `yarn vscode` to make test.sh faster. - # If the patch fails to apply, then it's likely already applied - yarn vscode:patch &> /dev/null || true - - yarn lint -} - -main "$@" diff --git a/ci/steps/publish-npm.sh b/ci/steps/publish-npm.sh index 7bd497d001cd..29c11e951fda 100755 --- a/ci/steps/publish-npm.sh +++ b/ci/steps/publish-npm.sh @@ -4,15 +4,146 @@ set -euo pipefail main() { cd "$(dirname "$0")/../.." source ./ci/lib.sh + source ./ci/steps/steps-lib.sh + ## Authentication tokens + # Needed to publish on NPM + if ! is_env_var_set "NPM_TOKEN"; then + echo "NPM_TOKEN is not set. Cannot publish to npm without credentials." + exit 1 + fi + + ## Publishing Information + # All the variables below are used to determine how we should publish + # the npm package. We also use this information for bumping the version. + # This is because npm won't publish your package unless it's a new version. + # i.e. for development, we bump the version to -- + # example: "version": "4.0.1-4769-ad7b23cfe6ffd72914e34781ef7721b129a23040" + # We use this to grab the PR_NUMBER + if ! is_env_var_set "GITHUB_REF"; then + echo "GITHUB_REF is not set. Are you running this locally? We rely on values provided by GitHub." + exit 1 + fi + + # We use this when setting NPM_VERSION + if ! is_env_var_set "GITHUB_SHA"; then + echo "GITHUB_SHA is not set. Are you running this locally? We rely on values provided by GitHub." + exit 1 + fi + + # We use this to determine the NPM_ENVIRONMENT + if ! is_env_var_set "GITHUB_EVENT_NAME"; then + echo "GITHUB_EVENT_NAME is not set. Are you running this locally? We rely on values provided by GitHub." + exit 1 + fi + + # Check that we're using at least v7 of npm CLI + if ! command -v jq &> /dev/null; then + echo "Couldn't find jq" + echo "We need this in order to modify the package.json for dev builds." + exit 1 + fi + + # This allows us to publish to npm in CI workflows if [[ ${CI-} ]]; then echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc fi - download_artifact npm-package ./release-npm-package + ## Environment + # This string is used to determine how we should tag the npm release. + # Environment can be one of three choices: + # "development" - this means we tag with the PR number, allowing + # a developer to install this version with `npm install code-server@` + # "staging" - this means we tag with `beta`, allowing + # a developer to install this version with `npm install code-server@beta` + # "production" - this means we tag with `latest` (default), allowing + # a developer to install this version with `npm install code-server@latest` + if ! is_env_var_set "NPM_ENVIRONMENT"; then + echo "NPM_ENVIRONMENT is not set." + echo "Determining in script based on GITHUB environment variables." + + if [[ "$GITHUB_EVENT_NAME" == 'push' && "$GITHUB_REF" == 'refs/heads/main' ]]; then + NPM_ENVIRONMENT="staging" + else + NPM_ENVIRONMENT="development" + fi + + fi + + # NOTE@jsjoeio - this script assumes we have the artifact downloaded on disk + # That happens in CI as a step before we run this. # https://github.com/actions/upload-artifact/issues/38 tar -xzf release-npm-package/package.tar.gz - yarn publish --non-interactive release + + # We use this to set the name of the package in the + # package.json + PACKAGE_NAME="code-server" + + # NOTES:@jsjoeio + # We only need to run npm version for "development" and "staging". + # This is because our release:prep script automatically bumps the version + # in the package.json and we commit it as part of the release PR. + if [[ "$NPM_ENVIRONMENT" == "production" ]]; then + NPM_VERSION="$VERSION" + # This means the npm version will be published as "stable" + # and installed when a user runs `npm install code-server` + NPM_TAG="latest" + else + COMMIT_SHA="$GITHUB_SHA" + + if [[ "$NPM_ENVIRONMENT" == "staging" ]]; then + NPM_VERSION="$VERSION-beta-$COMMIT_SHA" + # This means the npm version will be tagged with "beta" + # and installed when a user runs `npm install code-server@beta` + NPM_TAG="beta" + PACKAGE_NAME="@coder/code-server-pr" + fi + + if [[ "$NPM_ENVIRONMENT" == "development" ]]; then + # Source: https://github.com/actions/checkout/issues/58#issuecomment-614041550 + PR_NUMBER=$(echo "$GITHUB_REF" | awk 'BEGIN { FS = "/" } ; { print $3 }') + NPM_VERSION="$VERSION-$PR_NUMBER-$COMMIT_SHA" + PACKAGE_NAME="@coder/code-server-pr" + # This means the npm version will be tagged with "" + # and installed when a user runs `npm install code-server@` + NPM_TAG="$PR_NUMBER" + fi + + echo "- tag: $NPM_TAG" + echo "- version: $NPM_VERSION" + echo "- package name: $PACKAGE_NAME" + echo "- npm environment: $NPM_ENVIRONMENT" + + # We modify the version in the package.json + # to be the current version + the PR number + commit SHA + # or we use current version + beta + commit SHA + # Example: "version": "4.0.1-4769-ad7b23cfe6ffd72914e34781ef7721b129a23040" + # Example: "version": "4.0.1-beta-ad7b23cfe6ffd72914e34781ef7721b129a23040" + pushd release + npm version "$NPM_VERSION" + # Use the development package name + # This is so we don't clutter the code-server versions on npm + # with development versions. + # jq can't edit in place so we must store in memory and echo + local contents + contents="$(jq ".name |= \"$PACKAGE_NAME\"" package.json)" + echo "${contents}" > package.json + popd + fi + + # We need to make sure we haven't already published the version. + # If we get error, continue with script because we want to publish + # If version is valid, we check if we're publishing the same one + local hasVersion + if hasVersion=$(npm view "$PACKAGE_NAME@$NPM_VERSION" version 2> /dev/null) && [[ $hasVersion == "$NPM_VERSION" ]]; then + echo "$NPM_VERSION is already published under $PACKAGE_NAME" + return + fi + + # Since the dev builds are scoped to @coder + # We pass --access public to ensure npm knows it's not private. + cd release + npm publish --tag "$NPM_TAG" --access public } main "$@" diff --git a/ci/steps/push-docker-manifest.sh b/ci/steps/push-docker-manifest.sh deleted file mode 100755 index 08d0fdacf2d1..000000000000 --- a/ci/steps/push-docker-manifest.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -main() { - cd "$(dirname "$0")/../.." - source ./ci/lib.sh - - download_artifact release-images ./release-images - if [[ ${CI-} ]]; then - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin - fi - - for img in ./release-images/*; do - docker load -i "$img" - done - - # We have to ensure the amd64 and arm64 images exist on the remote registry - # in order to build the manifest. - # We don't put the arch in the tag to avoid polluting the main repository. - # These other repositories are private so they don't pollute our organization namespace. - docker push "codercom/code-server-amd64:$VERSION" - docker push "codercom/code-server-arm64:$VERSION" - - export DOCKER_CLI_EXPERIMENTAL=enabled - - docker manifest create "codercom/code-server:$VERSION" \ - "codercom/code-server-amd64:$VERSION" \ - "codercom/code-server-arm64:$VERSION" - docker manifest push --purge "codercom/code-server:$VERSION" - - docker manifest create "codercom/code-server:latest" \ - "codercom/code-server-amd64:$VERSION" \ - "codercom/code-server-arm64:$VERSION" - docker manifest push --purge "codercom/code-server:latest" -} - -main "$@" diff --git a/ci/steps/release-packages.sh b/ci/steps/release-packages.sh deleted file mode 100755 index 040c9de0e035..000000000000 --- a/ci/steps/release-packages.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -main() { - cd "$(dirname "$0")/../.." - - if [[ $OSTYPE == darwin* ]]; then - curl -L https://nodejs.org/dist/v14.4.0/node-v14.4.0-darwin-x64.tar.gz | tar -xz - PATH="$PWD/node-v14.4.0-darwin-x64/bin:$PATH" - fi - - # https://github.com/actions/upload-artifact/issues/38 - tar -xzf release-npm-package/package.tar.gz - - yarn release:standalone - yarn test:standalone-release - yarn package -} - -main "$@" diff --git a/ci/steps/release.sh b/ci/steps/release.sh deleted file mode 100755 index 80083c67f37b..000000000000 --- a/ci/steps/release.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -main() { - cd "$(dirname "$0")/../.." - - yarn --frozen-lockfile - yarn vscode - yarn build - yarn build:vscode - yarn release - - # https://github.com/actions/upload-artifact/issues/38 - mkdir -p release-npm-package - tar -czf release-npm-package/package.tar.gz release -} - -main "$@" diff --git a/ci/steps/steps-lib.sh b/ci/steps/steps-lib.sh new file mode 100755 index 000000000000..e71378e27f6c --- /dev/null +++ b/ci/steps/steps-lib.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env bash + +# This is a library which contains functions used inside ci/steps +# +# We separated it into it's own file so that we could easily unit test +# these functions and helpers + +# Checks whether and environment variable is set. +# Source: https://stackoverflow.com/a/62210688/3015595 +is_env_var_set() { + local name="${1:-}" + if test -n "${!name:-}"; then + return 0 + else + return 1 + fi +} + +# Checks whether a directory exists. +directory_exists() { + local dir="${1:-}" + if [[ -d "${dir:-}" ]]; then + return 0 + else + return 1 + fi +} + +# Checks whether a file exists. +file_exists() { + local file="${1:-}" + if test -f "${file:-}"; then + return 0 + else + return 1 + fi +} + +# Checks whether a file is executable. +is_executable() { + local file="${1:-}" + if [ -f "${file}" ] && [ -r "${file}" ] && [ -x "${file}" ]; then + return 0 + else + return 1 + fi +} diff --git a/ci/steps/test.sh b/ci/steps/test.sh deleted file mode 100755 index 801b2adc83cd..000000000000 --- a/ci/steps/test.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -main() { - cd "$(dirname "$0")/../.." - - yarn --frozen-lockfile - - git submodule update --init - # We do not `yarn vscode` to make test.sh faster. - # If the patch fails to apply, then it's likely already applied - yarn vscode:patch &> /dev/null || true - - yarn test -} - -main "$@" diff --git a/doc/CONTRIBUTING.md b/doc/CONTRIBUTING.md deleted file mode 100644 index af04b57ccf7d..000000000000 --- a/doc/CONTRIBUTING.md +++ /dev/null @@ -1,128 +0,0 @@ - - -# Contributing - -- [Requirements](#requirements) -- [Development Workflow](#development-workflow) -- [Build](#build) -- [Structure](#structure) - - [VS Code Patch](#vs-code-patch) - - - -- [Detailed CI and build process docs](../ci) - -## Requirements - -Please refer to [VS Code's prerequisites](https://github.com/Microsoft/vscode/wiki/How-to-Contribute#prerequisites). - -Differences: - -- We require a minimum of node v12 but later versions should work. -- We use [nfpm](https://github.com/goreleaser/nfpm) to build `.deb` and `.rpm` packages. -- We use [jq](https://stedolan.github.io/jq/) to build code-server releases. -- The [CI container](../ci/images/debian8/Dockerfile) is a useful reference for all our dependencies. - -## Development Workflow - -```shell -yarn -yarn vscode -yarn watch -# Visit http://localhost:8080 once the build completed. -``` - -To develop inside of an isolated docker container: - -```shell -./ci/dev/image/exec.sh - -root@12345:/code-server# yarn -root@12345:/code-server# yarn vscode -root@12345:/code-server# yarn watch -``` - -Any changes made to the source will be live reloaded. - -If changes are made to the patch and you've built previously you must manually -reset VS Code then run `yarn vscode:patch`. - -## Build - -```shell -yarn -yarn vscode -yarn build -yarn build:vscode -yarn release -cd release -yarn --production -# Runs the built JavaScript with Node. -node . -``` - -Now you can build release packages with: - -``` -yarn release:standalone -# The standalone release is in ./release-standalone -yarn test:standalone-release -yarn package -# .deb, .rpm and the standalone archive are in ./release-packages -``` - -## Structure - -The `code-server` script serves an HTTP API to login and start a remote VS Code process. - -The CLI code is in [./src/node](./src/node) and the HTTP routes are implemented in -[./src/node/app](./src/node/app). - -Most of the meaty parts are in our VS Code patch which is described next. - -### VS Code Patch - -Back in v1 of code-server, we had an extensive patch of VS Code that split the codebase -into a frontend and server. The frontend consisted of all UI code and the server ran -the extensions and exposed an API to the frontend for file access and everything else -that the UI needed. - -This worked but eventually Microsoft added support to VS Code to run it in the web. -They have open sourced the frontend but have kept the server closed source. - -So in interest of piggy backing off their work, v2 and beyond use the VS Code -web frontend and fill in the server. This is contained in our -[./ci/dev/vscode.patch](../ci/dev/vscode.patch) under the path `src/vs/server`. - -Other notable changes in our patch include: - -- Add our own build file which includes our code and VS Code's web code. -- Allow multiple extension directories (both user and built-in). -- Modify the loader, websocket, webview, service worker, and asset requests to - use the URL of the page as a base (and TLS if necessary for the websocket). -- Send client-side telemetry through the server. -- Allow modification of the display language. -- Make it possible for us to load code on the client. -- Make extensions work in the browser. -- Make it possible to install extensions of any kind. -- Fix getting permanently disconnected when you sleep or hibernate for a while. -- Add connection type to web socket query parameters. - -Some known issues presently: - -- Creating custom VS Code extensions and debugging them doesn't work. -- Extension profiling and tips are currently disabled. - -As the web portion of VS Code matures, we'll be able to shrink and maybe even entirely -eliminate our patch. In the meantime, however, upgrading the VS Code version requires -ensuring that the patch still applies and has the intended effects. - -To generate a new patch run `yarn vscode:diff`. - -**note**: We have extension docs on the CI and build system at [./ci/README.md](../ci/README.md) - -If functionality doesn't depend on code from VS Code then it should be moved -into code-server otherwise it should be in the patch. - -In the future we'd like to run VS Code unit tests against our builds to ensure features -work as expected. diff --git a/doc/FAQ.md b/doc/FAQ.md deleted file mode 100644 index 129498e4f8f0..000000000000 --- a/doc/FAQ.md +++ /dev/null @@ -1,309 +0,0 @@ - - -# FAQ - -- [Questions?](#questions) -- [How can I reuse my VS Code configuration?](#how-can-i-reuse-my-vs-code-configuration) -- [Differences compared to VS Code?](#differences-compared-to-vs-code) -- [How can I request a missing extension?](#how-can-i-request-a-missing-extension) -- [How do I configure the marketplace URL?](#how-do-i-configure-the-marketplace-url) -- [Where are extensions stored?](#where-are-extensions-stored) -- [How is this different from VS Code Codespaces?](#how-is-this-different-from-vs-code-codespaces) -- [How should I expose code-server to the internet?](#how-should-i-expose-code-server-to-the-internet) -- [How do I securely access web services?](#how-do-i-securely-access-web-services) - - [Sub-paths](#sub-paths) - - [Sub-domains](#sub-domains) -- [Multi-tenancy](#multi-tenancy) -- [Docker in code-server container?](#docker-in-code-server-container) -- [How can I disable telemetry?](#how-can-i-disable-telemetry) -- [How does code-server decide what workspace or folder to open?](#how-does-code-server-decide-what-workspace-or-folder-to-open) -- [How do I debug issues with code-server?](#how-do-i-debug-issues-with-code-server) -- [Heartbeat File](#heartbeat-file) -- [How does the config file work?](#how-does-the-config-file-work) -- [Blank screen on iPad?](#blank-screen-on-ipad) -- [Isn't an install script piped into sh insecure?](#isnt-an-install-script-piped-into-sh-insecure) -- [How do I make my keyboard shortcuts work?](#how-do-i-make-my-keyboard-shortcuts-work) -- [Differences compared to Theia?](#differences-compared-to-theia) -- [Enterprise](#enterprise) - - - -## Questions? - -Please file all questions and support requests at https://github.com/cdr/code-server/discussions. - -## How can I reuse my VS Code configuration? - -The very popular [Settings Sync](https://marketplace.visualstudio.com/items?itemName=Shan.code-settings-sync) extension works. - -You can also pass `--user-data-dir ~/.vscode` to reuse your existing VS Code extensions and configuration. - -Or copy `~/.vscode` into `~/.local/share/code-server`. - -## Differences compared to VS Code? - -`code-server` takes the open source core of VS Code and allows you to run it in the browser. -However, it is not entirely equivalent to Microsoft's VS Code. - -While the core of VS Code is open source, the marketplace and many published Microsoft extensions are not. - -Furthermore, Microsoft prohibits the use of any non-Microsoft VS Code from accessing their marketplace. - -See the [TOS](https://cdn.vsassets.io/v/M146_20190123.39/_content/Microsoft-Visual-Studio-Marketplace-Terms-of-Use.pdf). - -> Marketplace Offerings are intended for use only with Visual Studio Products and Services -> and you may only install and use Marketplace Offerings with Visual Studio Products and Services. - -As a result, we cannot offer any extensions on the Microsoft marketplace. Instead, -we have created our own marketplace for open source extensions. -It works by scraping GitHub for VS Code extensions and building them. It's not perfect but getting -better by the day with more and more extensions. - -These are the closed source extensions presently unavailable: - -1. [Live Share](https://visualstudio.microsoft.com/services/live-share) - - We may implement something similar, see [#33](https://github.com/cdr/code-server/issues/33) -1. [Remote Extensions (SSH, Containers, WSL)](https://github.com/microsoft/vscode-remote-release) - - We may reimplement these at some point, see [#1315](https://github.com/cdr/code-server/issues/1315) - -For more about the closed source parts of VS Code, see [vscodium/vscodium](https://github.com/VSCodium/vscodium#why-does-this-exist). - -## How can I request a missing extension? - -Please open a new issue and select the `Extension request` template. - -If an extension is not available or does not work, you can grab its VSIX from its Github releases or -build it yourself. Then run the `Extensions: Install from VSIX` command in the Command Palette and -point to the .vsix file. - -See below for installing an extension from the cli. - -## How do I configure the marketplace URL? - -If you have your own marketplace that implements the VS Code Extension Gallery API, it is possible to -point code-server to it by setting `$SERVICE_URL` and `$ITEM_URL`. These correspond directly -to `serviceUrl` and `itemUrl` in VS Code's `product.json`. - -e.g. to use [open-vsx.org](https://open-vsx.org): - -```bash -export SERVICE_URL=https://open-vsx.org/vscode/gallery -export ITEM_URL=https://open-vsx.org/vscode/item -``` - -While you can technically use Microsoft's marketplace with these, please do not do so as it -is against their terms of use. See [above](#differences-compared-to-vs-code) and this -discussion regarding the use of the Microsoft URLs in forks: - -https://github.com/microsoft/vscode/issues/31168#issue-244533026 - -These variables are most valuable to our enterprise customers for whom we have a self hosted marketplace product. - -## Where are extensions stored? - -Defaults to `~/.local/share/code-server/extensions`. - -If the `XDG_DATA_HOME` environment variable is set the data directory will be -`$XDG_DATA_HOME/code-server/extensions`. In general we try to follow the XDG directory spec. - -You can install an extension on the CLI with: - -```bash -# From the Coder extension marketplace -code-server --install-extension ms-python.python - -# From a downloaded VSIX on the file system -code-server --install-extension downloaded-ms-python.python.vsix -``` - -## How is this different from VS Code Codespaces? - -VS Code Codespaces is a closed source and paid service by Microsoft. It also allows you to access -VS Code via the browser. - -However, code-server is free, open source and can be run on any machine without any limitations. - -While you can self host environments with VS Code Codespaces, you still need an Azure billing -account and you have to access VS Code via the Codespaces web dashboard instead of directly -connecting to your instance. - -## How should I expose code-server to the internet? - -Please follow [./guide.md](./guide.md) for our recommendations on setting up and using code-server. - -code-server only supports password authentication natively. - -**note**: code-server will rate limit password authentication attempts at 2 a minute and 12 an hour. - -If you want to use external authentication (i.e sign in with Google) you should handle this -with a reverse proxy using something like [oauth2_proxy](https://github.com/pusher/oauth2_proxy) -or [Cloudflare Access](https://teams.cloudflare.com/access). - -For HTTPS, you can use a self signed certificate by passing in just `--cert` or -pass in an existing certificate by providing the path to `--cert` and the path to -the key with `--cert-key`. - -If `code-server` has been passed a certificate it will also respond to HTTPS -requests and will redirect all HTTP requests to HTTPS. - -You can use [Let's Encrypt](https://letsencrypt.org/) to get a TLS certificate -for free. - -Again, please follow [./guide.md](./guide.md) for our recommendations on setting up and using code-server. - -## How do I securely access web services? - -code-server is capable of proxying to any port using either a subdomain or a -subpath which means you can securely access these services using code-server's -built-in authentication. - -### Sub-paths - -Just browse to `/proxy//`. - -### Sub-domains - -You will need a DNS entry that points to your server for each port you want to -access. You can either set up a wildcard DNS entry for `*.` if your domain -name registrar supports it or you can create one for every port you want to -access (`3000.`, `8080.`, etc). - -You should also set up TLS certificates for these subdomains, either using a -wildcard certificate for `*.` or individual certificates for each port. - -Start code-server with the `--proxy-domain` flag set to your domain. - -``` -code-server --proxy-domain -``` - -Now you can browse to `.`. Note that this uses the host header so -ensure your reverse proxy forwards that information if you are using one. - -## Multi-tenancy - -If you want to run multiple code-servers on shared infrastructure, we recommend using virtual -machines with a VM per user. This will easily allow users to run a docker daemon. If you want -to use kubernetes, you'll definitely want to use [kubevirt](https://kubevirt.io) to give each -user a virtual machine instead of just a container. - -## Docker in code-server container? - -If you'd like to access docker inside of code-server, mount the docker socket in from `/var/run/docker.sock`. -Install the docker CLI in the code-server container and you should be able to access the daemon! - -You can even make volume mounts work. Lets say you want to run a container and mount in -`/home/coder/myproject` into it from inside the `code-server` container. You need to make sure -the docker daemon's `/home/coder/myproject` is the same as the one mounted inside the `code-server` -container and the mount will just work. - -## How can I disable telemetry? - -Use the `--disable-telemetry` flag to completely disable telemetry. We use the -data collected only to improve code-server. - -## How does code-server decide what workspace or folder to open? - -code-server tries the following in order: - -1. The `workspace` query parameter. -2. The `folder` query parameter. -3. The workspace or directory passed on the command line. -4. The last opened workspace or directory. - -## How do I debug issues with code-server? - -First run code-server with at least `debug` logging (or `trace` to be really -thorough) by setting the `--log` flag or the `LOG_LEVEL` environment variable. -`-vvv` and `--verbose` are aliases for `--log trace`. - -``` -code-server --log debug -``` - -Once this is done, replicate the issue you're having then collect logging -information from the following places: - -1. stdout -2. The most recently created directory in the `~/.local/share/code-server/logs` directory. -3. The browser console and network tabs. - -Additionally, collecting core dumps (you may need to enable them first) if -code-server crashes can be helpful. - -## Heartbeat File - -`code-server` touches `~/.local/share/code-server/heartbeat` once a minute as long -as there is an active browser connection. - -If you want to shutdown `code-server` if there hasn't been an active connection in X minutes -you can do so by continuously checking the last modified time on the heartbeat file and if it is -older than X minutes, kill `code-server`. - -[#1636](https://github.com/cdr/code-server/issues/1636) will make the experience here better. - -## How does the config file work? - -When `code-server` starts up, it creates a default config file in `~/.config/code-server/config.yaml` that looks -like this: - -```yaml -bind-addr: 127.0.0.1:8080 -auth: password -password: mewkmdasosafuio3422 # This is randomly generated for each config.yaml -cert: false -``` - -Each key in the file maps directly to a `code-server` flag. Run `code-server --help` to see -a listing of all the flags. - -The default config here says to listen on the loopback IP port 8080, enable password authorization -and no TLS. Any flags passed to `code-server` will take priority over the config file. - -The `--config` flag or `$CODE_SERVER_CONFIG` can be used to change the config file's location. - -The default location also respects `$XDG_CONFIG_HOME`. - -## Blank screen on iPad? - -Unfortunately at the moment self signed certificates cause a blank screen on iPadOS - -There does seem to be a way to get it to work if you create your own CA and create a -certificate using the CA and then import the CA onto your iPad. - -See [#1566](https://github.com/cdr/code-server/issues/1566#issuecomment-623159434). - -## Isn't an install script piped into sh insecure? - -Please give -[this wonderful blogpost](https://sandstorm.io/news/2015-09-24-is-curl-bash-insecure-pgp-verified-install) by -[sandstorm.io](https://sandstorm.io) a read. - -## How do I make my keyboard shortcuts work? - -Many shortcuts will not work by default as they'll be caught by the browser. - -If you use Chrome you can get around this by installing the PWA. - -Once you've entered the editor, click the "plus" icon present in the URL toolbar area. -This will install a Chrome PWA and now all keybindings will work! - -For other browsers you'll have to remap keybindings unfortunately. - -## Differences compared to Theia? - -[Theia](https://github.com/eclipse-theia/theia) is a browser IDE loosely based on VS Code. It uses the same -text editor library named [Monaco](https://github.com/Microsoft/monaco-editor) and the same -extension API but everything else is very different. It also uses [open-vsx.org](https://open-vsx.org) -for extensions which has an order of magnitude less extensions than our marketplace. -See [#1473](https://github.com/cdr/code-server/issues/1473). - -You can't just use your VS Code config in Theia like you can with code-server. - -To summarize, code-server is a patched fork of VS Code to run in the browser whereas -Theia takes some parts of VS Code but is an entirely different editor. - -## Enterprise - -Visit [our enterprise page](https://coder.com) for more information about our -enterprise offerings. diff --git a/doc/assets/screenshot.png b/doc/assets/screenshot.png deleted file mode 100644 index 7f76a21e4413..000000000000 Binary files a/doc/assets/screenshot.png and /dev/null differ diff --git a/doc/guide.md b/doc/guide.md deleted file mode 100644 index 11a8781c890e..000000000000 --- a/doc/guide.md +++ /dev/null @@ -1,305 +0,0 @@ - - -# Setup Guide - -- [1. Acquire a remote machine](#1-acquire-a-remote-machine) - - [Requirements](#requirements) - - [Google Cloud](#google-cloud) -- [2. Install code-server](#2-install-code-server) -- [3. Expose code-server](#3-expose-code-server) - - [SSH forwarding](#ssh-forwarding) - - [Let's Encrypt](#lets-encrypt) - - [NGINX](#nginx) - - [Self Signed Certificate](#self-signed-certificate) - - [Change the password?](#change-the-password) - - [How do I securely access development web services?](#how-do-i-securely-access-development-web-services) - - - -This guide demonstrates how to setup and use `code-server`. -To reiterate, `code-server` lets you run VS Code on a remote server and then access it via a browser. - -Further docs are at: - -- [README](../README.md) for a general overview -- [INSTALL](../doc/install.md) for installation -- [FAQ](./FAQ.md) for common questions. -- [CONTRIBUTING](../doc/CONTRIBUTING.md) for development docs - -We highly recommend reading the [FAQ](./FAQ.md) on the [Differences compared to VS Code](./FAQ.md#differences-compared-to-vs-code) before beginning. - -We'll walk you through acquiring a remote machine to run `code-server` on -and then exposing `code-server` so you can securely access it. - -## 1. Acquire a remote machine - -First, you need a machine to run `code-server` on. You can use a physical -machine you have lying around or use a VM on GCP/AWS. - -### Requirements - -For a good experience, we recommend at least: - -- 1 GB of RAM -- 2 cores - -You can use whatever linux distribution floats your boat but in this guide we assume Debian on Google Cloud. - -### Google Cloud - -For demonstration purposes, this guide assumes you're using a VM on GCP but you should be -able to easily use any machine or VM provider. - -You can sign up at https://console.cloud.google.com/getting-started. You'll get a 12 month \$300 -free trial. - -Once you've signed up and created a GCP project, create a new Compute Engine VM Instance. - -1. Navigate to `Compute Engine -> VM Instances` on the sidebar. -2. Now click `Create Instance` to create a new instance. -3. Name it whatever you want. -4. Choose the region closest to you based on [gcping.com](http://www.gcping.com). -5. Any zone is fine. -6. We'd recommend a `E2` series instance from the General-purpose family. - - Change the type to custom and set at least 2 cores and 2 GB of ram. - - Add more vCPUs and memory as you prefer, you can edit after creating the instance as well. - - https://cloud.google.com/compute/docs/machine-types#general_purpose -7. We highly recommend switching the persistent disk to an SSD of at least 32 GB. - - Click `Change` under `Boot Disk` and change the type to `SSD Persistent Disk` and the size - to `32`. - - You can always grow your disk later. -8. Navigate to `Networking -> Network interfaces` and edit the existing interface - to use a static external IP. - - Click done to save network interface changes. -9. If you do not have a [project wide SSH key](https://cloud.google.com/compute/docs/instances/adding-removing-ssh-keys#project-wide), navigate to `Security -> SSH Keys` and add your public key there. -10. Click create! - -Remember, you can shutdown your server when not in use to lower costs. - -We highly recommend learning to use the [`gcloud`](https://cloud.google.com/sdk/gcloud) cli -to avoid the slow dashboard. - -## 2. Install code-server - -We have a [script](../install.sh) to install `code-server` for Linux, macOS and FreeBSD. - -It tries to use the system package manager if possible. - -First run to print out the install process: - -```bash -curl -fsSL https://code-server.dev/install.sh | sh -s -- --dry-run -``` - -Now to actually install: - -```bash -curl -fsSL https://code-server.dev/install.sh | sh -``` - -The install script will print out how to run and start using `code-server`. - -Docs on the install script, manual installation and docker image are at [./install.md](./install.md). - -## 3. Expose code-server - -**Never**, **ever** expose `code-server` directly to the internet without some form of authentication -and encryption as someone can completely takeover your machine with the terminal. - -By default, `code-server` will enable password authentication which will require you to copy the -password from the`code-server`config file to login. It will listen on`localhost` to avoid exposing -itself to the world. This is fine for testing but will not work if you want to access `code-server` -from a different machine. - -There are several approaches to securely operating and exposing `code-server`. - -**tip**: You can list the full set of `code-server` options with `code-server --help` - -### SSH forwarding - -We highly recommend this approach for not requiring any additional setup, you just need an -SSH server on your remote machine. The downside is you won't be able to access `code-server` -on any machine without an SSH client like on iPad. If that's important to you, skip to [Let's Encrypt](#lets-encrypt). - -First, ssh into your instance and edit your `code-server` config file to disable password authentication. - -```bash -# Replaces "auth: password" with "auth: none" in the code-server config. -sed -i.bak 's/auth: password/auth: none/' ~/.config/code-server/config.yaml -``` - -Restart `code-server` with (assuming you followed the guide): - -```bash -systemctl --user restart code-server -``` - -Now forward local port 8080 to `127.0.0.1:8080` on the remote instance by running the following command on your local machine. - -Recommended reading: https://help.ubuntu.com/community/SSH/OpenSSH/PortForwarding. - -```bash -# -N disables executing a remote shell -ssh -N -L 8080:127.0.0.1:8080 [user]@ -``` - -Now if you access http://127.0.0.1:8080 locally, you should see `code-server`! - -If you want to make the SSH port forwarding persistent we recommend using -[mutagen](https://mutagen.io/documentation/introduction/installation). - -``` -# Same as the above SSH command but runs in the background continuously. -# Add `mutagen daemon start` to your ~/.bashrc to start the mutagen daemon when you open a shell. -mutagen forward create --name=code-server tcp:127.0.0.1:8080 :tcp:127.0.0.1:8080 -``` - -We also recommend adding the following lines to your `~/.ssh/config` to quickly detect bricked SSH connections: - -```bash -Host * -ServerAliveInterval 5 -ExitOnForwardFailure yes -``` - -You can also forward your SSH and GPG agent to the instance to securely access GitHub -and sign commits without copying your keys. - -1. https://developer.github.com/v3/guides/using-ssh-agent-forwarding/ -2. https://wiki.gnupg.org/AgentForwarding - -### Let's Encrypt - -[Let's Encrypt](https://letsencrypt.org) is a great option if you want to access `code-server` on an iPad -or do not want to use SSH forwarding. This does require that the remote machine be exposed to the internet. - -Assuming you have been following the guide, edit your instance and checkmark the allow HTTP/HTTPS traffic options. - -1. You'll need to buy a domain name. We recommend [Google Domains](https://domains.google.com). -2. Add an A record to your domain with your instance's IP. -3. Install caddy https://caddyserver.com/docs/download#debian-ubuntu-raspbian. - -```bash -echo "deb [trusted=yes] https://apt.fury.io/caddy/ /" \ - | sudo tee -a /etc/apt/sources.list.d/caddy-fury.list -sudo apt update -sudo apt install caddy -``` - -4. Replace `/etc/caddy/Caddyfile` with sudo to look like this: - -``` -mydomain.com - -reverse_proxy 127.0.0.1:8080 -``` - -Remember to replace `mydomain.com` with your domain name! - -5. Reload caddy with: - -```bash -sudo systemctl reload caddy -``` - -Visit `https://` to access `code-server`. Congratulations! - -In a future release we plan to integrate Let's Encrypt directly with `code-server` to avoid -the dependency on caddy. - -#### NGINX - -If you prefer to use NGINX instead of Caddy then please follow steps 1-2 above and then: - -3. Install `nginx`: - -```bash -sudo apt update -sudo apt install -y nginx certbot python-certbot-nginx -``` - -4. Put the following config into `/etc/nginx/sites-available/code-server` with sudo: - -```nginx -server { - listen 80; - listen [::]:80; - server_name mydomain.com; - - location / { - proxy_pass http://localhost:8080/; - proxy_set_header Host $host; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection upgrade; - proxy_set_header Accept-Encoding gzip; - } -} -``` - -Remember to replace `mydomain.com` with your domain name! - -5. Enable the config: - -```bash -sudo ln -s ../sites-available/code-server /etc/nginx/sites-enabled/code-server -sudo certbot --non-interactive --redirect --agree-tos --nginx -d mydomain.com -m me@example.com -``` - -Make sure to substitute `me@example.com` with your actual email. - -Visit `https://` to access `code-server`. Congratulations! - -### Self Signed Certificate - -**note:** Self signed certificates do not work with iPad and will cause a blank page. You'll -have to use [Let's Encrypt](#lets-encrypt) instead. See the [FAQ](./FAQ.md#blank-screen-on-ipad). - -Recommended reading: https://security.stackexchange.com/a/8112. - -We recommend this as a last resort because self signed certificates do not work with iPads and can -cause other bizarre issues. Not to mention all the warnings when you access `code-server`. -Only use this if: - -1. You do not want to buy a domain or you cannot expose the remote machine to the internet. -2. You do not want to use SSH forwarding. - -ssh into your instance and edit your code-server config file to use a randomly generated self signed certificate: - -```bash -# Replaces "cert: false" with "cert: true" in the code-server config. -sed -i.bak 's/cert: false/cert: true/' ~/.config/code-server/config.yaml -# Replaces "bind-addr: 127.0.0.1:8080" with "bind-addr: 0.0.0.0:443" in the code-server config. -sed -i.bak 's/bind-addr: 127.0.0.1:8080/bind-addr: 0.0.0.0:443/' ~/.config/code-server/config.yaml -# Allows code-server to listen on port 443. -sudo setcap cap_net_bind_service=+ep /usr/lib/code-server/lib/node -``` - -Assuming you have been following the guide, restart `code-server` with: - -```bash -systemctl --user restart code-server -``` - -Edit your instance and checkmark the allow HTTPS traffic option. - -Visit `https://` to access `code-server`. -You'll get a warning when accessing but if you click through you should be good. - -To avoid the warnings, you can use [mkcert](https://mkcert.dev) to create a self signed certificate -trusted by your OS and then pass it into `code-server` via the `cert` and `cert-key` config -fields. - -### Change the password? - -Edit the `password` field in the `code-server` config file at `~/.config/code-server/config.yaml` -and then restart `code-server` with: - -```bash -systemctl --user restart code-server -``` - -### How do I securely access development web services? - -If you're working on a web service and want to access it locally, `code-server` can proxy it for you. - -See the [FAQ](./FAQ.md#how-do-i-securely-access-web-services). diff --git a/doc/install.md b/doc/install.md deleted file mode 100644 index b8ec54a8b0ae..000000000000 --- a/doc/install.md +++ /dev/null @@ -1,187 +0,0 @@ - - -# Install - -- [install.sh](#installsh) - - [Flags](#flags) - - [Detection Reference](#detection-reference) -- [Debian, Ubuntu](#debian-ubuntu) -- [Fedora, CentOS, RHEL, SUSE](#fedora-centos-rhel-suse) -- [Arch Linux](#arch-linux) -- [yarn, npm](#yarn-npm) -- [macOS](#macos) -- [Standalone Releases](#standalone-releases) -- [Docker](#docker) - - - -This document demonstrates how to install `code-server` on -various distros and operating systems. - -## install.sh - -We have a [script](../install.sh) to install code-server for Linux, macOS and FreeBSD. - -It tries to use the system package manager if possible. - -First run to print out the install process: - -```bash -curl -fsSL https://code-server.dev/install.sh | sh -s -- --dry-run -``` - -Now to actually install: - -```bash -curl -fsSL https://code-server.dev/install.sh | sh -``` - -The script will print out how to run and start using code-server. - -If you believe an install script used with `curl | sh` is insecure, please give -[this wonderful blogpost](https://sandstorm.io/news/2015-09-24-is-curl-bash-insecure-pgp-verified-install) by -[sandstorm.io](https://sandstorm.io) a read. - -If you'd still prefer manual installation despite the below [detection reference](#detection-reference) and `--dry-run` -then continue on for docs on manual installation. The [`install.sh`](../install.sh) script runs the _exact_ same -commands presented in the rest of this document. - -### Flags - -- `--dry-run` to echo the commands for the install process without running them. -- `--method` to choose the installation method. - - `--method=detect` to detect the package manager but fallback to `--method=standalone`. - - `--method=standalone` to install a standalone release archive into `~/.local`. -- `--prefix=/usr/local` to install a standalone release archive system wide. -- `--version=X.X.X` to install version `X.X.X` instead of latest. -- `--help` to see full usage docs. - -### Detection Reference - -- For Debian, Ubuntu and Raspbian it will install the latest deb package. -- For Fedora, CentOS, RHEL and openSUSE it will install the latest rpm package. -- For Arch Linux it will install the AUR package. -- For any unrecognized Linux operating system it will install the latest standalone release into `~/.local`. - - - Add `~/.local/bin` to your `$PATH` to run code-server. - -- For macOS it will install the Homebrew package. - - - If Homebrew is not installed it will install the latest standalone release into `~/.local`. - - Add `~/.local/bin` to your `$PATH` to run code-server. - -- For FreeBSD, it will install the [npm package](#yarn-npm) with `yarn` or `npm`. - -- If ran on an architecture with no releases, it will install the [npm package](#yarn-npm) with `yarn` or `npm`. - - We only have releases for amd64 and arm64 presently. - - The [npm package](#yarn-npm) builds the native modules on postinstall. - -## Debian, Ubuntu - -```bash -curl -fOL https://github.com/cdr/code-server/releases/download/v3.4.1/code-server_3.4.1_amd64.deb -sudo dpkg -i code-server_3.4.1_amd64.deb -systemctl --user enable --now code-server -# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml -``` - -## Fedora, CentOS, RHEL, SUSE - -```bash -curl -fOL https://github.com/cdr/code-server/releases/download/v3.4.1/code-server-3.4.1-amd64.rpm -sudo rpm -i code-server-3.4.1-amd64.rpm -systemctl --user enable --now code-server -# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml -``` - -## Arch Linux - -```bash -# Installs code-server from the AUR using yay. -yay -S code-server -systemctl --user enable --now code-server -# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml -``` - -```bash -# Installs code-server from the AUR with plain makepkg. -git clone https://aur.archlinux.org/code-server.git -cd code-server -makepkg -si -systemctl --user enable --now code-server -# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml -``` - -## yarn, npm - -We recommend installing with `yarn` or `npm` when: - -1. You aren't on `amd64` or `arm64`. -2. If you're on Linux with glibc < v2.17 or glibcxx < v3.4.18 - -**note:** Installing via `yarn` or `npm` builds native modules on install and so requires C dependencies. -See [./npm.md](./npm.md) for installing these dependencies. - -You will need at least node v12 installed. See [#1633](https://github.com/cdr/code-server/issues/1633). - -```bash -yarn global add code-server -# Or: npm install -g code-server -code-server -# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml -``` - -## macOS - -```bash -brew install code-server -brew services start code-server -# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml -``` - -## Standalone Releases - -We publish self contained `.tar.gz` archives for every release on [github](https://github.com/cdr/code-server/releases). -They bundle the node binary and `node_modules`. - -These are created from the [npm package](#yarn-npm) and the rest of the releases are created from these. -Only requirement is glibc >= 2.17 && glibcxx >= v3.4.18 on Linux and for macOS there is no minimum system requirement. - -1. Download the latest release archive for your system from [github](https://github.com/cdr/code-server/releases). -2. Unpack the release. -3. You can run code-server by executing `./bin/code-server`. - -You can add the code-server `bin` directory to your `$PATH` to easily execute `code-server` -without the full path every time. - -Here is an example script for installing and using a standalone `code-server` release on Linux: - -```bash -mkdir -p ~/.local/lib ~/.local/bin -curl -fL https://github.com/cdr/code-server/releases/download/v3.4.1/code-server-3.4.1-linux-amd64.tar.gz \ - | tar -C ~/.local/lib -xz -mv ~/.local/lib/code-server-3.4.1-linux-amd64 ~/.local/lib/code-server-3.4.1 -ln -s ~/.local/lib/code-server-3.4.1/bin/code-server ~/.local/bin/code-server -PATH="~/.local/bin:$PATH" -code-server -# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml -``` - -## Docker - -```bash -# This will start a code-server container and expose it at http://127.0.0.1:8080. -# It will also mount your current directory into the container as `/home/coder/project` -# and forward your UID/GID so that all file system operations occur as your user outside -# the container. -docker run -it -p 127.0.0.1:8080:8080 \ - -v "$PWD:/home/coder/project" \ - -u "$(id -u):$(id -g)" \ - codercom/code-server:latest -``` - -Our official image supports `amd64` and `arm64`. - -For `arm32` support there is a popular community maintained alternative: - -https://hub.docker.com/r/linuxserver/code-server diff --git a/doc/npm.md b/doc/npm.md deleted file mode 100644 index f4d0ee097bb8..000000000000 --- a/doc/npm.md +++ /dev/null @@ -1,42 +0,0 @@ - - -# npm Install Requirements - -- [Ubuntu, Debian](#ubuntu-debian) -- [Fedora, CentOS, RHEL](#fedora-centos-rhel) -- [macOS](#macos) - - - -If you're installing the npm module you'll need certain dependencies to build -the native modules used by VS Code. - -You also need at least node v12 installed. See [#1633](https://github.com/cdr/code-server/issues/1633). - -## Ubuntu, Debian - -```bash -sudo apt-get install -y \ - build-essential \ - pkg-config \ - libx11-dev \ - libxkbfile-dev \ - libsecret-1-dev -``` - -## Fedora, CentOS, RHEL - -```bash -sudo yum groupinstall -y 'Development Tools' -sudo yum config-manager --set-enabled PowerTools # unnecessary on CentOS 7 -sudo yum install -y python2 libsecret-devel libX11-devel libxkbfile-devel -npm config set python python2 -``` - -## macOS - -Install [Xcode](https://developer.apple.com/xcode/downloads/) and run: - -```bash -xcode-select --install -``` diff --git a/docs/CODE_OF_CONDUCT.md b/docs/CODE_OF_CONDUCT.md new file mode 100644 index 000000000000..168eac481bb7 --- /dev/null +++ b/docs/CODE_OF_CONDUCT.md @@ -0,0 +1,92 @@ + + + +# Contributor Covenant Code of Conduct + +- [Contributor Covenant Code of Conduct](#contributor-covenant-code-of-conduct) + - [Our Pledge](#our-pledge) + - [Our Standards](#our-standards) + - [Our Responsibilities](#our-responsibilities) + - [Scope](#scope) + - [Enforcement](#enforcement) + - [Attribution](#attribution) + + + + +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +- Using welcoming and inclusive language +- Being respectful of differing viewpoints and experiences +- Gracefully accepting constructive criticism +- Focusing on what is best for the community +- Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +- The use of sexualized language or imagery and unwelcome sexual attention or + advances +- Trolling, insulting/derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or electronic + address, without explicit permission +- Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at opensource@coder.com. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md new file mode 100644 index 000000000000..3a89005e32f6 --- /dev/null +++ b/docs/CONTRIBUTING.md @@ -0,0 +1,296 @@ + + + +# Contributing + +- [Requirements](#requirements) + - [Linux-specific requirements](#linux-specific-requirements) +- [Development workflow](#development-workflow) + - [Version updates to Code](#version-updates-to-code) + - [Patching Code](#patching-code) + - [Build](#build) + - [Creating a Standalone Release](#creating-a-standalone-release) + - [Troubleshooting](#troubleshooting) + - [I see "Forbidden access" when I load code-server in the browser](#i-see-forbidden-access-when-i-load-code-server-in-the-browser) + - ["Can only have one anonymous define call per script"](#can-only-have-one-anonymous-define-call-per-script) + - [Help](#help) +- [Test](#test) + - [Unit tests](#unit-tests) + - [Script tests](#script-tests) + - [Integration tests](#integration-tests) + - [End-to-end tests](#end-to-end-tests) +- [Structure](#structure) + - [Modifications to Code](#modifications-to-code) + - [Currently Known Issues](#currently-known-issues) + + + + +## Requirements + +The prerequisites for contributing to code-server are almost the same as those +for [VS Code](https://github.com/Microsoft/vscode/wiki/How-to-Contribute#prerequisites). +Here is what is needed: + +- `node` v22.x +- `git` v2.x or greater +- [`git-lfs`](https://git-lfs.github.com) +- [`npm`](https://www.npmjs.com/) + - Used to install JS packages and run scripts +- [`nfpm`](https://nfpm.goreleaser.com/) + - Used to build `.deb` and `.rpm` packages +- [`jq`](https://stedolan.github.io/jq/) + - Used to build code-server releases +- [`gnupg`](https://gnupg.org/index.html) + - All commits must be signed and verified; see GitHub's [Managing commit + signature + verification](https://docs.github.com/en/github/authenticating-to-github/managing-commit-signature-verification) + or follow [this tutorial](https://joeprevite.com/verify-commits-on-github) +- `quilt` + - Used to manage patches to Code +- `rsync` and `unzip` + - Used for code-server releases +- `bats` + - Used to run script unit tests + +### Linux-specific requirements + +If you're developing code-server on Linux, make sure you have installed or +install the following dependencies: + +```shell +sudo apt-get install build-essential g++ libx11-dev libxkbfile-dev libsecret-1-dev libkrb5-dev python-is-python3 +``` + +These are required by Code. See [their Wiki](https://github.com/microsoft/vscode/wiki/How-to-Contribute#prerequisites) +for more information. + +## Development workflow + +1. `git clone https://github.com/coder/code-server.git` - Clone `code-server` +2. `git submodule update --init` - Clone `vscode` submodule +3. `quilt push -a` - Apply patches to the `vscode` submodule. +4. `npm install` - Install dependencies +5. `npm run watch` - Launch code-server localhost:8080. code-server will be live + reloaded when changes are made; the browser needs to be refreshed manually. + +When pulling down changes that include modifications to the patches you will +need to apply them with `quilt`. If you pull down changes that update the +`vscode` submodule you will need to run `git submodule update --init` and +re-apply the patches. + +When you make a change that affects people deploying the marketplace please +update the changelog as part of your PR. + +Note that building code-server takes a very, very long time, and loading it in +the browser in development mode also takes a very, very long time. + +Display language (Spanish, etc) support only works in a full build; it will not +work in development mode. + +Generally we prefer that PRs be squashed into `main` but you can rebase or merge +if it is important to keep the individual commits (make sure to clean up the +commits first if you are doing this). + +### Version updates to Code + +1. Remove any patches with `quilt pop -a`. +2. Update the `lib/vscode` submodule to the desired upstream version branch. + 1. `cd lib/vscode && git checkout release/1.66 && cd ../..` + 2. `git add lib && git commit -m "chore: update to Code "` +3. Apply the patches one at a time (`quilt push`). If the application succeeds + but the lines changed, update the patch with `quilt refresh`. If there are + conflicts, then force apply with `quilt push -f`, manually add back the + rejected code, then run `quilt refresh`. +4. From the code-server **project root**, run `npm install`. +5. Check the Node.js version that's used by Electron (which is shipped with VS + Code. If necessary, update our version of Node.js to match. + +### Patching Code + +1. You can go through the patch stack with `quilt push` and `quilt pop`. +2. Create a new patch (`quilt new {name}.diff`) or use an existing patch. +3. Add the file(s) you are patching (`quilt add [-P patch] {file}`). A file + **must** be added before you make changes to it. +4. Make your changes. Patches do not need to be independent of each other but + each patch must result in a working code-server without any broken in-between + states otherwise they are difficult to test and modify. +5. Add your changes to the patch (`quilt refresh`) +6. Add a comment in the patch about the reason for the patch and how to + reproduce the behavior it fixes or adds. Every patch should have an e2e test + as well. + +### Build + +You can build a full production as follows: + +```shell +git submodule update --init +quilt push -a +npm install +npm run build +VERSION=0.0.0 npm run build:vscode +npm run release +``` + +This does not keep `node_modules`. If you want them to be kept, use +`KEEP_MODULES=1 npm run release` + +Run your build: + +```shell +cd release +npm install --omit=dev # Skip if you used KEEP_MODULES=1 +# Runs the built JavaScript with Node. +node . +``` + +Then, to build the release package: + +```shell +npm run release:standalone +npm run test:integration +npm run package +``` + +> On Linux, the currently running distro will become the minimum supported +> version. In our GitHub Actions CI, we use CentOS 8 for maximum compatibility. +> If you need your builds to support older distros, run the build commands +> inside a Docker container with all the build requirements installed. + +#### Creating a Standalone Release + +Part of the build process involves creating standalone releases. At the time of +writing, we do this for the following platforms/architectures: + +- Linux amd64 (.tar.gz, .deb, and .rpm) +- Linux arm64 (.tar.gz, .deb, and .rpm) +- Linux arm7l (.tar.gz) +- Linux armhf.deb +- Linux armhf.rpm +- macOS arm64.tar.gz + +Currently, these are compiled in CI using the `npm run release:standalone` +command in the `release.yaml` workflow. We then upload them to the draft release +and distribute via GitHub Releases. + +### Troubleshooting + +#### I see "Forbidden access" when I load code-server in the browser + +This means your patches didn't apply correctly. We have a patch to remove the +auth from vanilla Code because we use our own. + +Try popping off the patches with `quilt pop -a` and reapplying with `quilt push +-a`. + +#### "Can only have one anonymous define call per script" + +Code might be trying to use a dev or prod HTML in the wrong context. You can try +re-running code-server and setting `VSCODE_DEV=1`. + +### Help + +If you get stuck or need help, you can always start a new GitHub Discussion +[here](https://github.com/coder/code-server/discussions). One of the maintainers +will respond and help you out. + +## Test + +There are four kinds of tests in code-server: + +1. Unit tests +2. Script tests +3. Integration tests +4. End-to-end tests + +### Unit tests + +Our unit tests are written in TypeScript and run using +[Jest](https://jestjs.io/), the testing framework]. + +These live under [test/unit](../test/unit). + +We use unit tests for functions and things that can be tested in isolation. The +file structure is modeled closely after `/src` so it's easy for people to know +where test files should live. + +### Script tests + +Our script tests are written in bash and run using [bats](https://github.com/bats-core/bats-core). + +These tests live under `test/scripts`. + +We use these to test anything related to our scripts (most of which live under +`ci`). + +### Integration tests + +These are a work in progress. We build code-server and run tests with `npm run +test:integration`, which ensures that code-server builds work on their +respective platforms. + +Our integration tests look at components that rely on one another. For example, +testing the CLI requires us to build and package code-server. + +### End-to-end tests + +The end-to-end (e2e) tests are written in TypeScript and run using +[Playwright](https://playwright.dev/). + +These live under [test/e2e](../test/e2e). + +Before the e2e tests run, we run `globalSetup`, which eliminates the need to log +in before each test by preserving the authentication state. + +Take a look at `codeServer.test.ts` to see how you would use it (see +`test.use`). + +We also have a model where you can create helpers to use within tests. See +[models/CodeServer.ts](../test/e2e/models/CodeServer.ts) for an example. + +## Structure + +code-server essentially serves as an HTTP API for logging in and starting a +remote Code process. + +The CLI code is in [src/node](../src/node) and the HTTP routes are implemented +in [src/node/routes](../src/node/routes). + +Most of the meaty parts are in the Code portion of the codebase under +[lib/vscode](../lib/vscode), which we describe next. + +### Modifications to Code + +Our modifications to Code can be found in the [patches](../patches) directory. +We pull in Code as a submodule pointing to an upstream release branch. + +In v1 of code-server, we had Code as a submodule and used a single massive patch +that split the codebase into a front-end and a server. The front-end consisted +of the UI code, while the server ran the extensions and exposed an API to the +front-end for file access and all UI needs. + +Over time, Microsoft added support to Code to run it on the web. They had made +the front-end open source, but not the server. As such, code-server v2 (and +later) uses the Code front-end and implements the server. We did this by using a +Git subtree to fork and modify Code. + +Microsoft eventually made the server open source and we were able to reduce our +changes significantly. Some time later we moved back to a submodule and patches +(managed by `quilt` this time instead of the mega-patch). + +As the web portion of Code continues to mature, we'll be able to shrink and +possibly eliminate our patches. In the meantime, upgrading the Code version +requires us to ensure that our changes are still applied correctly and work as +intended. In the future, we'd like to run Code unit tests against our builds to +ensure that features work as expected. + +> We have [extension docs](../ci/README.md) on the CI and build system. + +If the functionality you're working on does NOT depend on code from Code, please +move it out and into code-server. + +### Currently Known Issues + +- Creating custom Code extensions and debugging them doesn't work +- Extension profiling and tips are currently disabled diff --git a/docs/FAQ.md b/docs/FAQ.md new file mode 100644 index 000000000000..a695cc64ac6a --- /dev/null +++ b/docs/FAQ.md @@ -0,0 +1,508 @@ + + + +# FAQ + +- [Questions?](#questions) +- [How should I expose code-server to the internet?](#how-should-i-expose-code-server-to-the-internet) +- [Can I use code-server on the iPad?](#can-i-use-code-server-on-the-ipad) +- [How does the config file work?](#how-does-the-config-file-work) +- [How do I make my keyboard shortcuts work?](#how-do-i-make-my-keyboard-shortcuts-work) +- [Why can't code-server use Microsoft's extension marketplace?](#why-cant-code-server-use-microsofts-extension-marketplace) +- [How can I request an extension that's missing from the marketplace?](#how-can-i-request-an-extension-thats-missing-from-the-marketplace) +- [How do I install an extension?](#how-do-i-install-an-extension) +- [How do I install an extension manually?](#how-do-i-install-an-extension-manually) +- [How do I use my own extensions marketplace?](#how-do-i-use-my-own-extensions-marketplace) +- [Where are extensions stored?](#where-are-extensions-stored) +- [Where is VS Code configuration stored?](#where-is-vs-code-configuration-stored) +- [How can I reuse my VS Code configuration?](#how-can-i-reuse-my-vs-code-configuration) +- [How does code-server decide what workspace or folder to open?](#how-does-code-server-decide-what-workspace-or-folder-to-open) +- [How do I access my Documents/Downloads/Desktop folders in code-server on macOS?](#how-do-i-access-my-documentsdownloadsdesktop-folders-in-code-server-on-macos) +- [How do I direct server-side requests through a proxy?](#how-do-i-direct-server-side-requests-through-a-proxy) +- [How do I debug issues with code-server?](#how-do-i-debug-issues-with-code-server) +- [What is the healthz endpoint?](#what-is-the-healthz-endpoint) +- [What is the heartbeat file?](#what-is-the-heartbeat-file) +- [How do I change the password?](#how-do-i-change-the-password) +- [Can I store my password hashed?](#can-i-store-my-password-hashed) +- [Is multi-tenancy possible?](#is-multi-tenancy-possible) +- [Can I use Docker in a code-server container?](#can-i-use-docker-in-a-code-server-container) +- [How do I disable telemetry?](#how-do-i-disable-telemetry) +- [What's the difference between code-server and Coder?](#whats-the-difference-between-code-server-and-coder) +- [What's the difference between code-server and Theia?](#whats-the-difference-between-code-server-and-theia) +- [What's the difference between code-server and OpenVSCode-Server?](#whats-the-difference-between-code-server-and-openvscode-server) +- [What's the difference between code-server and GitHub Codespaces?](#whats-the-difference-between-code-server-and-github-codespaces) +- [Does code-server have any security login validation?](#does-code-server-have-any-security-login-validation) +- [Are there community projects involving code-server?](#are-there-community-projects-involving-code-server) +- [How do I change the port?](#how-do-i-change-the-port) +- [How do I hide the coder/coder promotion in Help: Getting Started?](#how-do-i-hide-the-codercoder-promotion-in-help-getting-started) +- [How do I disable the proxy?](#how-do-i-disable-the-proxy) +- [How do I disable file download?](#how-do-i-disable-file-download) +- [Why do web views not work?](#why-do-web-views-not-work) + + + + +## Questions? + +Please file all questions and support requests at +. + +## How should I expose code-server to the internet? + +Please see [our instructions on exposing code-server safely to the +internet](./guide.md). + +## Can I use code-server on the iPad? + +See [iPad](./ipad.md) for information on using code-server on the iPad. + +## How does the config file work? + +When `code-server` starts up, it creates a default config file in `~/.config/code-server/config.yaml`: + +```yaml +bind-addr: 127.0.0.1:8080 +auth: password +password: mew...22 # Randomly generated for each config.yaml +cert: false +``` + +The default config defines the following behavior: + +- Listen on the loopback IP port 8080 +- Enable password authorization +- Do not use TLS + +Each key in the file maps directly to a `code-server` flag (run `code-server --help` to see a listing of all the flags). Any flags passed to `code-server` +will take priority over the config file. + +You can change the config file's location using the `--config` flag or +`$CODE_SERVER_CONFIG` environment variable. + +The default location respects `$XDG_CONFIG_HOME`. + +## How do I make my keyboard shortcuts work? + +Many shortcuts will not work by default, since they'll be "caught" by the browser. + +If you use Chrome, you can work around this by installing the progressive web +app (PWA): + +1. Start the editor +2. Click the **plus** icon in the URL toolbar to install the PWA + +If you use Firefox, you can use the appropriate extension to install PWA. + +1. Go to the installation [website](https://addons.mozilla.org/en-US/firefox/addon/pwas-for-firefox/) of the add-on +2. Add the add-on to Firefox +3. Follow the os-specific instructions on how to install the runtime counterpart + +For other browsers, you'll have to remap keybindings for shortcuts to work. + +## Why can't code-server use Microsoft's extension marketplace? + +Though code-server takes the open-source core of VS Code and allows you to run +it in the browser, it is not entirely equivalent to Microsoft's VS Code. + +One major difference is in regards to extensions and the marketplace. The core +of VS code is open source, while the marketplace and many published Microsoft +extensions are not. Furthermore, Microsoft prohibits the use of any +non-Microsoft VS Code from accessing their marketplace. Per the [Terms of +Service](https://cdn.vsassets.io/v/M146_20190123.39/_content/Microsoft-Visual-Studio-Marketplace-Terms-of-Use.pdf): + +> Marketplace Offerings are intended for use only with Visual Studio Products +> and Services, and you may only install and use Marketplace Offerings with +> Visual Studio Products and Services. + +Because of this, we can't offer any extensions on Microsoft's marketplace. +Instead, we use the [Open-VSX extension gallery](https://open-vsx.org), which is also used by various other forks. +It isn't perfect, but its getting better by the day with more and more extensions. + +We also offer our own marketplace for open source extensions, but plan to +deprecate it at a future date and completely migrate to Open-VSX. + +These are the closed-source extensions that are presently unavailable: + +1. [Live Share](https://visualstudio.microsoft.com/services/live-share). We may + implement something similar (see + [#33](https://github.com/coder/code-server/issues/33)) +1. [Remote Extensions (SSH, Containers, + WSL)](https://github.com/microsoft/vscode-remote-release). We may implement + these again at some point, see + ([#1315](https://github.com/coder/code-server/issues/1315)). + +For more about the closed source portions of VS Code, see [vscodium/vscodium](https://github.com/VSCodium/vscodium#why-does-this-exist). + +## How can I request an extension that's missing from the marketplace? + +To add an extension to Open-VSX, please see [open-vsx/publish-extensions](https://github.com/open-vsx/publish-extensions). +We no longer plan to add new extensions to our legacy extension gallery. + +## How do I install an extension? + +You can install extensions from the marketplace using the extensions sidebar in +code-server or from the command line: + +```console +code-server --install-extension +# example: code-server --install-extension wesbos.theme-cobalt2 + +# From the Coder extension marketplace +code-server --install-extension ms-python.python + +# From a downloaded VSIX on the file system +code-server --install-extension downloaded-ms-python.python.vsix +``` + +## How do I install an extension manually? + +If there's an extension unavailable in the marketplace or an extension that +doesn't work, you can download the VSIX from its GitHub releases or build it +yourself. + +Once you have downloaded the VSIX to the remote machine, you can either: + +- Run the **Extensions: Install from VSIX** command in the Command Palette. +- Run `code-server --install-extension ` in the terminal + +You can also download extensions using the command line. For instance, +downloading from OpenVSX can be done like this: + +```shell +code-server --install-extension +``` + +## How do I use my own extensions marketplace? + +If you own a marketplace that implements the VS Code Extension Gallery API, you +can point code-server to it by setting `$EXTENSIONS_GALLERY`. +This corresponds directly with the `extensionsGallery` entry in in VS Code's `product.json`. + +For example: + +```bash +export EXTENSIONS_GALLERY='{"serviceUrl": "https://my-extensions/api"}' +``` + +Though you can technically use Microsoft's marketplace in this manner, we +strongly discourage you from doing so since this is [against their Terms of Use](#why-cant-code-server-use-microsofts-extension-marketplace). + +For further information, see [this +discussion](https://github.com/microsoft/vscode/issues/31168#issue-244533026) +regarding the use of the Microsoft URLs in forks, as well as [VSCodium's +docs](https://github.com/VSCodium/vscodium/blob/master/DOCS.md#extensions--marketplace). + +## Where are extensions stored? + +Extensions are stored in `~/.local/share/code-server/extensions` by default. + +On Linux and macOS if you set the `XDG_DATA_HOME` environment variable, the +extensions directory will be `$XDG_DATA_HOME/code-server/extensions`. In +general, we try to follow the XDG directory spec. + +## Where is VS Code configuration stored? + +VS Code configuration such as settings and keybindings are stored in +`~/.local/share/code-server` by default. + +On Linux and macOS if you set the `XDG_DATA_HOME` environment variable, the data +directory will be `$XDG_DATA_HOME/code-server`. In general, we try to follow the +XDG directory spec. + +## How can I reuse my VS Code configuration? + +You can use the [Settings +Sync](https://marketplace.visualstudio.com/items?itemName=Shan.code-settings-sync) +extension for this purpose. + +Alternatively, you can also pass `--user-data-dir ~/.vscode` or copy `~/.vscode` +into `~/.local/share/code-server` to reuse your existing VS Code extensions and +configuration. + +## How does code-server decide what workspace or folder to open? + +code-server tries the following in this order: + +1. The `workspace` query parameter +2. The `folder` query parameter +3. The workspace or directory passed via the command line +4. The last opened workspace or directory + +## How do I access my Documents/Downloads/Desktop folders in code-server on macOS? + +Newer versions of macOS require permission through a non-UNIX mechanism for +code-server to access the Desktop, Documents, Pictures, Downloads, and other folders. + +You may have to give Node.js full disk access, since it doesn't implement any of the macOS permission request features natively: + +1. Find where Node.js is installed on your machine + + ```console + $ which node + /usr/local/bin/node + ``` + +2. Grant Node.js full disk access. Open **System Preferences** > **Security & + Privacy** > **Privacy** > **Full Disk Access**. Then, click the 🔒 to unlock, + click **+**, and select the Node.js binary you located in the previous step. + +See [#2794](https://github.com/coder/code-server/issues/2794) for additional context. + +## How do I direct server-side requests through a proxy? + +> code-server proxies only server-side requests. + +To direct server-side requests through a proxy, code-server supports the +following environment variables: + +- `$HTTP_PROXY` +- `$HTTPS_PROXY` +- `$NO_PROXY` + +```sh +export HTTP_PROXY=https://134.8.5.4 +export HTTPS_PROXY=https://134.8.5.4 +# Now all of code-server's server side requests will go through +# https://134.8.5.4 first. +code-server +``` + +- See + [proxy-from-env](https://www.npmjs.com/package/proxy-from-env#environment-variables) + for a detailed reference on these environment variables and their syntax (note + that code-server only uses the `http` and `https` protocols). +- See [proxy-agent](https://www.npmjs.com/package/proxy-agent) for information + on on the supported proxy protocols. + +## How do I debug issues with code-server? + +First, run code-server with the `debug` logging (or `trace` to be really +thorough) by setting the `--log` flag or the `LOG_LEVEL` environment variable. +`-vvv` and `--verbose` are aliases for `--log trace`. + +First, run code-server with `debug` logging (or `trace` logging for more +thorough messages) by setting the `--log` flag or the `LOG_LEVEL` environment +variable. + +```text +code-server --log debug +``` + +> Note that the `-vvv` and `--verbose` flags are aliases for `--log trace`. + +Next, replicate the issue you're having so that you can collect logging +information from the following places: + +1. The most recent files from `~/.local/share/code-server/coder-logs` +2. The browser console +3. The browser network tab + +Additionally, collecting core dumps (you may need to enable them first) if +code-server crashes can be helpful. + +## What is the healthz endpoint? + +You can use the `/healthz` endpoint exposed by code-server to check whether +code-server is running without triggering a heartbeat. The response includes a +status (e.g., `alive` or `expired`) and a timestamp for the last heartbeat +(the default is `0`). + +```json +{ + "status": "alive", + "lastHeartbeat": 1599166210566 +} +``` + +This endpoint doesn't require authentication. + +## What is the heartbeat file? + +As long as there is an active browser connection, code-server touches +`~/.local/share/code-server/heartbeat` once a minute. + +If you want to shutdown code-server if there hasn't been an active connection +after a predetermined amount of time, you can use the --idle-timeout-seconds flag +or set an `CODE_SERVER_IDLE_TIMEOUT_SECONDS` environment variable. + +## How do I change the password? + +Edit the `password` field in the code-server config file at +`~/.config/code-server/config.yaml`, then restart code-server: + +```bash +sudo systemctl restart code-server@$USER +``` + +## Can I store my password hashed? + +Yes, you can do so by setting the value of `hashed-password` instead of `password`. Generate the hash with: + +```shell +echo -n "thisismypassword" | npx argon2-cli -e +$argon2i$v=19$m=4096,t=3,p=1$wst5qhbgk2lu1ih4dmuxvg$ls1alrvdiwtvzhwnzcm1dugg+5dto3dt1d5v9xtlws4 +``` + +Replace `thisismypassword` with your actual password and **remember to put it +inside quotes**! For example: + +```yaml +auth: password +hashed-password: "$argon2i$v=19$m=4096,t=3,p=1$wST5QhBgk2lu1ih4DMuxvg$LS1alrVdIWtvZHwnzCM1DUGg+5DTO3Dt1d5v9XtLws4" +``` + +The `hashed-password` field takes precedence over `password`. + +If you're using Docker Compose file, in order to make this work, you need to change all the single $ to $$. For example: + +```yaml +- HASHED_PASSWORD=$$argon2i$$v=19$$m=4096,t=3,p=1$$wST5QhBgk2lu1ih4DMuxvg$$LS1alrVdIWtvZHwnzCM1DUGg+5DTO3Dt1d5v9XtLws4 +``` + +## Is multi-tenancy possible? + +If you want to run multiple code-servers on shared infrastructure, we recommend +using virtual machines (provide one VM per user). This will easily allow users +to run a Docker daemon. If you want to use Kubernetes, you'll want to +use [kubevirt](https://kubevirt.io) or +[sysbox](https://github.com/nestybox/sysbox) to give each user a VM-like +experience instead of just a container. + +## Can I use Docker in a code-server container? + +If you'd like to access Docker inside of code-server, mount the Docker socket in +from `/var/run/docker.sock`. Then, install the Docker CLI in the code-server +container, and you should be able to access the daemon. + +You can even make volume mounts work. Let's say you want to run a container and +mount into `/home/coder/myproject` from inside the `code-server` container. You +need to make sure the Docker daemon's `/home/coder/myproject` is the same as the +one mounted inside the `code-server` container, and the mount will work. + +If you want Docker enabled when deploying on Kubernetes, look at the `values.yaml` +file for the 3 fields: `extraVars`, `lifecycle.postStart`, and `extraContainers`. + +## How do I disable telemetry? + +Use the `--disable-telemetry` flag to disable telemetry. + +> We use the data collected only to improve code-server. + +## What's the difference between code-server and Coder? + +code-server and Coder are both applications that can be installed on any +machine. The main difference is who they serve. Out of the box, code-server is +simply VS Code in the browser while Coder is a tool for provisioning remote +development environments via Terraform. + +code-server was built for individuals while Coder was built for teams. In Coder, you create Workspaces which can have applications like code-server. If you're looking for a team solution, you should reach for [Coder](https://github.com/coder/coder). + +## What's the difference between code-server and Theia? + +At a high level, code-server is a patched fork of VS Code that runs in the +browser whereas Theia takes some parts of VS Code but is an entirely different +editor. + +[Theia](https://github.com/eclipse-theia/theia) is a browser IDE loosely based +on VS Code. It uses the same text editor library +([Monaco](https://github.com/Microsoft/monaco-editor)) and extension API, but +everything else is different. Theia also uses [Open VSX](https://open-vsx.org) +for extensions. + +Theia doesn't allow you to reuse your existing VS Code config. + +## What's the difference between code-server and OpenVSCode-Server? + +code-server and OpenVSCode-Server both allow you to access VS Code via a +browser. OpenVSCode-Server is a direct fork of VS Code with changes comitted +directly while code-server pulls VS Code in via a submodule and makes changes +via patch files. + +However, OpenVSCode-Server is scoped at only making VS Code available as-is in +the web browser. code-server contains additional changes to make the self-hosted +experience better (see the next section for details). + +## What's the difference between code-server and GitHub Codespaces? + +Both code-server and GitHub Codespaces allow you to access VS Code via a +browser. GitHub Codespaces, however, is a closed-source, paid service offered by +GitHub and Microsoft. + +On the other hand, code-server is self-hosted, free, open-source, and can be run +on any machine with few limitations. + +Specific changes include: + +- Password authentication +- The ability to host at sub-paths +- Self-contained web views that do not call out to Microsoft's servers +- The ability to use your own marketplace and collect your own telemetry +- Built-in proxy for accessing ports on the remote machine integrated into + VS Code's ports panel +- Wrapper process that spawns VS Code on-demand and has a separate CLI +- Notification when updates are available +- [Some other things](https://github.com/coder/code-server/tree/main/patches) + +Some of these changes appear very unlikely to ever be adopted by Microsoft. +Some may make their way upstream, further closing the gap, but at the moment it +looks like there will always be some subtle differences. + +## Does code-server have any security login validation? + +code-server supports setting a single password and limits logins to two per +minute plus an additional twelve per hour. + +## Are there community projects involving code-server? + +Visit the [awesome-code-server](https://github.com/coder/awesome-code-server) +repository to view community projects and guides with code-server! Feel free to +add your own! + +## How do I change the port? + +There are two ways to change the port on which code-server runs: + +1. with an environment variable e.g. `PORT=3000 code-server` +2. using the flag `--bind-addr` e.g. `code-server --bind-addr localhost:3000` + +## How do I hide the coder/coder promotion in Help: Getting Started? + +You can pass the flag `--disable-getting-started-override` to `code-server` or +you can set the environment variable `CS_DISABLE_GETTING_STARTED_OVERRIDE=1` or +`CS_DISABLE_GETTING_STARTED_OVERRIDE=true`. + +## How do I disable the proxy? + +You can pass the flag `--disable-proxy` to `code-server` or +you can set the environment variable `CS_DISABLE_PROXY=1` or +`CS_DISABLE_PROXY=true`. + +Note, this option currently only disables the proxy routes to forwarded ports, including +the domain and path proxy routes over HTTP and WebSocket; however, it does not +disable the automatic port forwarding in the VS Code workbench itself. In other words, +user will still see the Ports tab and notifications, but will not be able to actually +use access the ports. It is recommended to set `remote.autoForwardPorts` to `false` +when using the option. + +## How do I disable file download? + +You can pass the flag `--disable-file-downloads` to `code-server` + +## Why do web views not work? + +Web views rely on service workers, and service workers are only available in a +secure context, so most likely the answer is that you are using an insecure +context (for example an IP address). + +If this happens, in the browser log you will see something like: + +> Error loading webview: Error: Could not register service workers: SecurityError: Failed to register a ServiceWorker for scope with script: An SSL certificate error occurred when fetching the script.. + +To fix this, you must either: + +- Access over localhost/127.0.0.1 which is always considered secure. +- Use a domain with a real certificate (for example with Let's Encrypt). +- Use a trusted self-signed certificate with [mkcert](https://mkcert.dev) (or + create and trust a certificate manually). +- Disable security if your browser allows it. For example, in Chromium see + `chrome://flags/#unsafely-treat-insecure-origin-as-secure` diff --git a/docs/MAINTAINING.md b/docs/MAINTAINING.md new file mode 100644 index 000000000000..c1faf045b2ad --- /dev/null +++ b/docs/MAINTAINING.md @@ -0,0 +1,119 @@ + + + +# Maintaining + +- [Releasing](#releasing) + - [Release Candidates](#release-candidates) + - [AUR](#aur) + - [Docker](#docker) + - [Homebrew](#homebrew) + - [nixpkgs](#nixpkgs) + - [npm](#npm) +- [Testing](#testing) +- [Documentation](#documentation) + - [Troubleshooting](#troubleshooting) + + + + +We keep code-server up to date with VS Code releases (there are usually two or +three a month) but we are not generally actively developing code-server aside +from fixing regressions. + +Most of the work is keeping on top of issues and discussions. + +## Releasing + +1. Check that the changelog lists all the important changes. +2. Make sure the changelog entry lists the current version of VS Code. +3. Update the changelog with the release date. +4. Go to GitHub Actions > Draft release > Run workflow on the commit you want to + release. Make sure CI has finished the build workflow on that commit or this + will fail. For the version we match VS Code's minor and patch version. The + patch number may become temporarily out of sync if we need to put out a + patch, but if we make our own minor change then we will not release it until + the next minor VS Code release. +5. CI will automatically grab the build artifact on that commit (which is why CI + has to have completed), inject the provided version into the `package.json`, + put together platform-specific packages, and upload those packages to a draft + release. +6. Update the resulting draft release with the changelog contents. +7. Publish the draft release after validating it. +8. Bump the Helm chart version once the Docker images have published. + +#### Release Candidates + +We prefer to do release candidates so the community can test things before a +full-blown release. To do this follow the same steps as above but: + +1. Add a `-rc.` suffix to the version. +2. When you publish the release select "pre-release". CI will not automatically + publish pre-releases. +3. Do not update the chart version or merge in the changelog until the final + release. + +#### AUR + +We publish to AUR as a package [here](https://aur.archlinux.org/packages/code-server/). This process is manual and can be done by following the steps in [this repo](https://github.com/coder/code-server-aur). + +#### Docker + +We publish code-server as a Docker image [here](https://hub.docker.com/r/codercom/code-server), tagging it both with the version and latest. + +This is currently automated with the release process. + +#### Homebrew + +We publish code-server on Homebrew [here](https://github.com/Homebrew/homebrew-core/blob/master/Formula/code-server.rb). + +This is currently automated with the release process (but may fail occasionally). If it does, run this locally: + +```shell +# Replace VERSION with version +brew bump-formula-pr --version="${VERSION}" code-server --no-browse --no-audit +``` + +#### nixpkgs + +We publish code-server in nixpkgs but it must be updated manually. + +#### npm + +We publish code-server as a npm package [here](https://www.npmjs.com/package/code-server/v/latest). + +This is currently automated with the release process. + +## Testing + +Our testing structure is laid out under our [Contributing docs](https://coder.com/docs/code-server/latest/CONTRIBUTING#test). + +If you're ever looking to add more tests, here are a few ways to get started: + +- run `npm run test:unit` and look at the coverage chart. You'll see all the + uncovered lines. This is a good place to start. +- look at `test/scripts` to see which scripts are tested. We can always use more + tests there. +- look at `test/e2e`. We can always use more end-to-end tests. + +Otherwise, talk to a current maintainer and ask which part of the codebase is +lacking most when it comes to tests. + +## Documentation + +### Troubleshooting + +Our docs are hosted on [Vercel](https://vercel.com/). Vercel only shows logs in +realtime, which means you need to have the logs open in one tab and reproduce +your error in another tab. Since our logs are private to Coder the organization, +you can only follow these steps if you're a Coder employee. Ask a maintainer for +help if you need it. + +Taking a real scenario, let's say you wanted to troubleshoot [this docs +change](https://github.com/coder/code-server/pull/4042). Here is how you would +do it: + +1. Go to https://vercel.com/codercom/codercom +2. Click "View Function Logs" +3. In a separate tab, open the preview link from github-actions-bot +4. Now look at the function logs and see if there are errors in the logs diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 000000000000..470095071afd --- /dev/null +++ b/docs/README.md @@ -0,0 +1,82 @@ +# code-server + +[!["GitHub Discussions"](https://img.shields.io/badge/%20GitHub-%20Discussions-gray.svg?longCache=true&logo=github&colorB=purple)](https://github.com/coder/code-server/discussions) [!["Join us on Slack"](https://img.shields.io/badge/join-us%20on%20slack-gray.svg?longCache=true&logo=slack&colorB=brightgreen)](https://coder.com/community) [![Twitter Follow](https://img.shields.io/twitter/follow/CoderHQ?label=%40CoderHQ&style=social)](https://twitter.com/coderhq) [![Discord](https://img.shields.io/discord/747933592273027093)](https://discord.com/invite/coder) [![codecov](https://codecov.io/gh/coder/code-server/branch/main/graph/badge.svg?token=5iM9farjnC)](https://codecov.io/gh/coder/code-server) [![See latest](https://img.shields.io/static/v1?label=Docs&message=see%20latest&color=blue)](https://coder.com/docs/code-server/latest) + +Run [VS Code](https://github.com/Microsoft/vscode) on any machine anywhere and +access it in the browser. + +![Screenshot](./assets/screenshot-1.png) +![Screenshot](./assets/screenshot-2.png) + +## Highlights + +- Code on any device with a consistent development environment +- Use cloud servers to speed up tests, compilations, downloads, and more +- Preserve battery life when you're on the go; all intensive tasks run on your + server + +## Requirements + +See [requirements](https://coder.com/docs/code-server/latest/requirements) for minimum specs, as well as instructions +on how to set up a Google VM on which you can install code-server. + +**TL;DR:** Linux machine with WebSockets enabled, 1 GB RAM, and 2 vCPUs + +## Getting started + +There are five ways to get started: + +1. Using the [install + script](https://github.com/coder/code-server/blob/main/install.sh), which + automates most of the process. The script uses the system package manager if + possible. +2. Manually [installing + code-server](https://coder.com/docs/code-server/latest/install) +3. Deploy code-server to your team with [coder/coder](https://cdr.co/coder-github) +4. Using our one-click buttons and guides to [deploy code-server to a cloud + provider](https://github.com/coder/deploy-code-server) ⚡ +5. Using the [code-server feature for + devcontainers](https://github.com/coder/devcontainer-features/blob/main/src/code-server/README.md), + if you already use devcontainers in your project. + +If you use the install script, you can preview what occurs during the install +process: + +```bash +curl -fsSL https://code-server.dev/install.sh | sh -s -- --dry-run +``` + +To install, run: + +```bash +curl -fsSL https://code-server.dev/install.sh | sh +``` + +When done, the install script prints out instructions for running and starting +code-server. + +> **Note** +> To manage code-server for a team on your infrastructure, see: [coder/coder](https://cdr.co/coder-github) + +We also have an in-depth [setup and +configuration](https://coder.com/docs/code-server/latest/guide) guide. + +## Questions? + +See answers to [frequently asked +questions](https://coder.com/docs/code-server/latest/FAQ). + +## Want to help? + +See [Contributing](https://coder.com/docs/code-server/latest/CONTRIBUTING) for +details. + +## Hiring + +Interested in [working at Coder](https://coder.com/careers)? Check out [our open +positions](https://coder.com/careers#openings)! + +## For Teams + +We develop [coder/coder](https://cdr.co/coder-github) to help teams to +adopt remote development. diff --git a/docs/SECURITY.md b/docs/SECURITY.md new file mode 100644 index 000000000000..9ff33e365c4b --- /dev/null +++ b/docs/SECURITY.md @@ -0,0 +1,33 @@ +# Security Policy + +Coder and the code-server team want to keep the code-server project secure and safe for end-users. + +## Tools + +We use the following tools to help us stay on top of vulnerability mitigation. + +- [dependabot](https://dependabot.com/) + - Submits pull requests to upgrade dependencies. We use dependabot's version + upgrades as well as security updates. +- code-scanning + - [CodeQL](https://securitylab.github.com/tools/codeql/) + - Semantic code analysis engine that runs on a regular schedule (see + `codeql-analysis.yml`) + - [trivy](https://github.com/aquasecurity/trivy) + - Comprehensive vulnerability scanner that runs on PRs into the default + branch and scans both our container image and repository code (see + `trivy-scan-repo` and `trivy-scan-image` jobs in `build.yaml`) +- `npm audit` + - Audits NPM dependencies. + +## Supported Versions + +Coder sponsors the development and maintenance of the code-server project. We will fix security issues within 90 days of receiving a report and publish the fix in a subsequent release. The code-server project does not provide backports or patch releases for security issues at this time. + +| Version | Supported | +| ------------------------------------------------------- | ------------------ | +| [Latest](https://github.com/coder/code-server/releases) | :white_check_mark: | + +## Reporting a Vulnerability + +To report a vulnerability, please send an email to security[@]coder.com, and our security team will respond to you. diff --git a/docs/android.md b/docs/android.md new file mode 100644 index 000000000000..0b1dc24abf6e --- /dev/null +++ b/docs/android.md @@ -0,0 +1,31 @@ +# Running code-server using UserLAnd + +1. Install UserLAnd from [Google Play](https://play.google.com/store/apps/details?id=tech.ula&hl=en_US&gl=US) +2. Install an Ubuntu VM +3. Start app +4. Install Node.js and `curl` using `sudo apt install nodejs npm curl -y` +5. Install `nvm`: + +```shell +curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash +``` + +6. Exit the terminal using `exit` and then reopen the terminal +7. Install and use Node.js 22: + +```shell +nvm install 22 +nvm use 22 +``` + +8. Install code-server globally on device with: `npm install --global code-server` +9. Run code-server with `code-server` +10. Access on localhost:8080 in your browser + +# Running code-server using Nix-on-Droid + +1. Install Nix-on-Droid from [F-Droid](https://f-droid.org/packages/com.termux.nix/) +2. Start app +3. Spawn a shell with code-server by running `nix-shell -p code-server` +4. Run code-server with `code-server` +5. Access on localhost:8080 in your browser diff --git a/docs/assets/images/icons/collab.svg b/docs/assets/images/icons/collab.svg new file mode 100644 index 000000000000..239666a993bf --- /dev/null +++ b/docs/assets/images/icons/collab.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/assets/images/icons/contributing.svg b/docs/assets/images/icons/contributing.svg new file mode 100644 index 000000000000..c814591e1c7f --- /dev/null +++ b/docs/assets/images/icons/contributing.svg @@ -0,0 +1 @@ + diff --git a/docs/assets/images/icons/faq.svg b/docs/assets/images/icons/faq.svg new file mode 100644 index 000000000000..a3e196d298a9 --- /dev/null +++ b/docs/assets/images/icons/faq.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/assets/images/icons/home.svg b/docs/assets/images/icons/home.svg new file mode 100644 index 000000000000..0f7bee254cd3 --- /dev/null +++ b/docs/assets/images/icons/home.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/assets/images/icons/requirements.svg b/docs/assets/images/icons/requirements.svg new file mode 100644 index 000000000000..c3888f90274f --- /dev/null +++ b/docs/assets/images/icons/requirements.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/assets/images/icons/upgrade.svg b/docs/assets/images/icons/upgrade.svg new file mode 100644 index 000000000000..28c35752f201 --- /dev/null +++ b/docs/assets/images/icons/upgrade.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/assets/images/icons/usage.svg b/docs/assets/images/icons/usage.svg new file mode 100644 index 000000000000..f38aa04813e3 --- /dev/null +++ b/docs/assets/images/icons/usage.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/docs/assets/images/icons/wrench.svg b/docs/assets/images/icons/wrench.svg new file mode 100644 index 000000000000..acca9b7614a1 --- /dev/null +++ b/docs/assets/images/icons/wrench.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/assets/screenshot-1.png b/docs/assets/screenshot-1.png new file mode 100644 index 000000000000..cacbc21bd771 Binary files /dev/null and b/docs/assets/screenshot-1.png differ diff --git a/docs/assets/screenshot-2.png b/docs/assets/screenshot-2.png new file mode 100644 index 000000000000..5861fac0b905 Binary files /dev/null and b/docs/assets/screenshot-2.png differ diff --git a/docs/coder.md b/docs/coder.md new file mode 100644 index 000000000000..f62a3c2edcd8 --- /dev/null +++ b/docs/coder.md @@ -0,0 +1,48 @@ +# Coder + +To install and run code-server in a Coder workspace, we suggest using the `install.sh` +script in your template like so: + +```terraform +resource "coder_agent" "dev" { + arch = "amd64" + os = "linux" + startup_script = < + + +# Setup Guide + +- [Expose code-server](#expose-code-server) + - [Port forwarding via SSH](#port-forwarding-via-ssh) + - [Using Let's Encrypt with Caddy](#using-lets-encrypt-with-caddy) + - [Using Let's Encrypt with NGINX](#using-lets-encrypt-with-nginx) + - [Using a self-signed certificate](#using-a-self-signed-certificate) + - [TLS 1.3 and Safari](#tls-13-and-safari) +- [External authentication](#external-authentication) +- [HTTPS and self-signed certificates](#https-and-self-signed-certificates) +- [Accessing web services](#accessing-web-services) + - [Using a subdomain](#using-a-subdomain) + - [Using a subpath](#using-a-subpath) + - [Using your own proxy](#using-your-own-proxy) + - [Stripping `/proxy/` from the request path](#stripping-proxyport-from-the-request-path) + - [Proxying to create a React app](#proxying-to-create-a-react-app) + - [Proxying to a Vue app](#proxying-to-a-vue-app) + - [Proxying to an Angular app](#proxying-to-an-angular-app) + - [Proxying to a Svelte app](#proxying-to-a-svelte-app) + - [Prefixing `/absproxy/` with a path](#prefixing-absproxyport-with-a-path) + - [Preflight requests](#preflight-requests) +- [Internationalization and customization](#internationalization-and-customization) + - [Available keys and placeholders](#available-keys-and-placeholders) + - [Legacy flag](#legacy-flag) + + + + +This article will walk you through exposing code-server securely once you've +completed the [installation process](install.md). + +## Expose code-server + +**Never** expose code-server directly to the internet without some form of +authentication and encryption, otherwise someone can take over your machine via +the terminal. + +By default, code-server uses password authentication. As such, you must copy the +password from code-server's config file to log in. To avoid exposing itself +unnecessarily, code-server listens on `localhost`; this practice is fine for +testing, but it doesn't work if you want to access code-server from a different +machine. + +> **Rate limits:** code-server rate limits password authentication attempts to +> two per minute plus an additional twelve per hour. + +There are several approaches to operating and exposing code-server securely: + +- Port forwarding via SSH +- Using Let's Encrypt with Caddy +- Using Let's Encrypt with NGINX +- Using a self-signed certificate + +### Port forwarding via SSH + +We highly recommend using [port forwarding via +SSH](https://help.ubuntu.com/community/SSH/OpenSSH/PortForwarding) to access +code-server. If you have an SSH server on your remote machine, this approach +doesn't require any additional setup at all. + +The downside to SSH forwarding, however, is that you can't access code-server +when using machines without SSH clients (such as iPads). If this applies to you, +we recommend using another method, such as [Let's Encrypt](#let-encrypt) instead. + +> To work properly, your environment should have WebSockets enabled, which +> code-server uses to communicate between the browser and server. + +1. SSH into your instance and edit the code-server config file to disable + password authentication: + + ```console + # Replaces "auth: password" with "auth: none" in the code-server config. + sed -i.bak 's/auth: password/auth: none/' ~/.config/code-server/config.yaml + ``` + +2. Restart code-server: + + ```console + sudo systemctl restart code-server@$USER + ``` + +3. Forward local port `8080` to `127.0.0.1:8080` on the remote instance by running the following command on your local machine: + + ```console + # -N disables executing a remote shell + ssh -N -L 8080:127.0.0.1:8080 [user]@ + ``` + +4. At this point, you can access code-server by pointing your web browser to `http://127.0.0.1:8080`. + +5. If you'd like to make the port forwarding via SSH persistent, we recommend + using [mutagen](https://mutagen.io/documentation/introduction/installation) + to do so. Once you've installed mutagen, you can port forward as follows: + + ```shell + # This is the same as the above SSH command, but it runs in the background + # continuously. Be sure to add `mutagen daemon start` to your ~/.bashrc to + # start the mutagen daemon when you open a shell. + mutagen forward create --name=code-server tcp:127.0.0.1:8080 < instance-ip > :tcp:127.0.0.1:8080 + ``` + +6. Optional, but highly recommended: add the following to `~/.ssh/config` so + that you can detect bricked SSH connections: + + ```bash + Host * + ServerAliveInterval 5 + ExitOnForwardFailure yes + ``` + +> You can [forward your +> SSH](https://developer.github.com/v3/guides/using-ssh-agent-forwarding/) and +> [GPG agent](https://wiki.gnupg.org/AgentForwarding) to the instance to +> securely access GitHub and sign commits without having to copy your keys. + +### Using Let's Encrypt with Caddy + +Using [Let's Encrypt](https://letsencrypt.org) is an option if you want to +access code-server on an iPad or do not want to use SSH port forwarding. + +1. This option requires that the remote machine be exposed to the internet. Make sure that your instance allows HTTP/HTTPS traffic. + +2. You'll need a domain name (if you don't have one, you can purchase one from + [Google Domains](https://domains.google.com) or the domain service of your + choice). Once you have a domain name, add an A record to your domain that contains your + instance's IP address. + +3. Install [Caddy](https://caddyserver.com/docs/download#debian-ubuntu-raspbian): + + ```console + sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https + curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg + curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list + sudo apt update + sudo apt install caddy + ``` + +4. Replace `/etc/caddy/Caddyfile` using `sudo` so that the file looks like this: + + ```text + mydomain.com { + reverse_proxy 127.0.0.1:8080 + } + ``` + + If you want to serve code-server from a sub-path, you can do so as follows: + + ```text + mydomain.com/code/* { + uri strip_prefix /code + reverse_proxy 127.0.0.1:8080 + } + ``` + + Remember to replace `mydomain.com` with your domain name! + +5. Reload Caddy: + + ```console + sudo systemctl reload caddy + ``` + +At this point, you should be able to access code-server via +`https://mydomain.com`. + +### Using Let's Encrypt with NGINX + +1. This option requires that the remote machine be exposed to the internet. Make + sure that your instance allows HTTP/HTTPS traffic. + +2. You'll need a domain name (if you don't have one, you can purchase one from + [Google Domains](https://domains.google.com) or the domain service of your + choice). Once you have a domain name, add an A record to your domain that contains your + instance's IP address. + +3. Install NGINX: + + ```bash + sudo apt update + sudo apt install -y nginx certbot python3-certbot-nginx + ``` + +4. Update `/etc/nginx/sites-available/code-server` using sudo with the following + configuration: + + ```text + server { + listen 80; + listen [::]:80; + server_name mydomain.com; + + location / { + proxy_pass http://localhost:8080/; + proxy_set_header Host $http_host; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection upgrade; + proxy_set_header Accept-Encoding gzip; + } + } + ``` + + Be sure to replace `mydomain.com` with your domain name! + +5. Enable the config: + ```console + sudo ln -s ../sites-available/code-server /etc/nginx/sites-enabled/code-server + sudo certbot --non-interactive --redirect --agree-tos --nginx -d mydomain.com -m me@example.com + ``` + Be sure to replace `me@example.com` with your actual email. + +At this point, you should be able to access code-server via +`https://mydomain.com`. + +### Using a self-signed certificate + +> Self signed certificates do not work with iPad; see [./ipad.md](./ipad.md) for +> more information. + +Before proceeding, we recommend familiarizing yourself with the [risks of +self-signing a certificate for +SSL](https://security.stackexchange.com/questions/8110). + +We recommend self-signed certificates as a last resort, since self-signed +certificates do not work with iPads and may cause unexpected issues with +code-server. You should only proceed with this option if: + +- You do not want to buy a domain or you cannot expose the remote machine to + the internet +- You do not want to use port forwarding via SSH + +To use a self-signed certificate: + +1. This option requires that the remote machine be exposed to the internet. Make + sure that your instance allows HTTP/HTTPS traffic. + +1. SSH into your instance and edit your code-server config file to use a + randomly generated self-signed certificate: + + ```console + # Replaces "cert: false" with "cert: true" in the code-server config. + sed -i.bak 's/cert: false/cert: true/' ~/.config/code-server/config.yaml + # Replaces "bind-addr: 127.0.0.1:8080" with "bind-addr: 0.0.0.0:443" in the code-server config. + sed -i.bak 's/bind-addr: 127.0.0.1:8080/bind-addr: 0.0.0.0:443/' ~/.config/code-server/config.yaml + # Allows code-server to listen on port 443. + sudo setcap cap_net_bind_service=+ep /usr/lib/code-server/lib/node + ``` + +1. Restart code-server: + + ```console + sudo systemctl restart code-server@$USER + ``` + +At this point, you should be able to access code-server via +`https://`. + +If you'd like to avoid the warnings displayed by code-server when using a +self-signed certificate, you can use [mkcert](https://mkcert.dev) to create a +self-signed certificate that's trusted by your operating system, then pass the +certificate to code-server via the `cert` and `cert-key` config fields. + +### TLS 1.3 and Safari + +If you will be using Safari and your configuration does not allow anything less +than TLS 1.3 you will need to add support for TLS 1.2 since Safari does not +support TLS 1.3 for web sockets at the time of writing. If this is the case you +should see OSSStatus: 9836 in the browser console. + +## External authentication + +If you want to use external authentication mechanism (e.g., Sign in with +Google), you can do this with a reverse proxy such as: + +- [Pomerium](https://www.pomerium.com/docs/guides/code-server.html) +- [oauth2-proxy](https://oauth2-proxy.github.io/oauth2-proxy/) +- [Cloudflare Access](https://www.cloudflare.com/zero-trust/products/access/) + +## HTTPS and self-signed certificates + +For HTTPS, you can use a self-signed certificate by: + +- Passing in `--cert` +- Passing in an existing certificate by providing the path to `--cert` and the + path to the key with `--cert-key` + +The self signed certificate will be generated to +`~/.local/share/code-server/self-signed.crt`. + +If you pass a certificate to code-server, it will respond to HTTPS requests and +redirect all HTTP requests to HTTPS. + +> You can use [Let's Encrypt](https://letsencrypt.org/) to get a TLS certificate +> for free. + +Note: if you set `proxy_set_header Host $host;` in your reverse proxy config, it +will change the address displayed in the green section of code-server in the +bottom left to show the correct address. + +## Accessing web services + +If you're working on web services and want to access them locally, code-server +can proxy to any port using either a subdomain or a subpath, allowing you to +securely access these services using code-server's built-in authentication. + +### Using a subdomain + +You will need a DNS entry that points to your server for each port you want to +access. You can either set up a wildcard DNS entry for `*.` if your +domain name registrar supports it, or you can create one for every port you want +to access (`3000.`, `8080.`, etc). + +You should also set up TLS certificates for these subdomains, either using a +wildcard certificate for `*.` or individual certificates for each port. + +To set your domain, start code-server with the `--proxy-domain` flag: + +```console +code-server --proxy-domain +``` + +For instance, if you have code-server exposed on `domain.tld` and a Python +server running on port 8080 of the same machine code-server is running on, you +could run code-server with `--proxy-domain domain.tld` and access the Python +server via `8080.domain.tld`. + +Note that this uses the host header, so ensure your reverse proxy (if you're +using one) forwards that information. + +### Using a subpath + +Simply browse to `/proxy//`. For instance, if you have code-server +exposed on `domain.tld` and a Python server running on port 8080 of the same +machine code-server is running on, you could access the Python server via +`domain.tld/proxy/8000`. + +### Using your own proxy + +You can make extensions and the ports panel use your own proxy by setting +`VSCODE_PROXY_URI`. For example if you set +`VSCODE_PROXY_URI=https://{{port}}.kyle.dev` when an application is detected +running on port 3000 of the same machine code-server is running on the ports +panel will create a link to https://3000.kyle.dev instead of pointing to the +built-in subpath-based proxy. + +Note: relative paths are also supported i.e. +`VSCODE_PROXY_URI=./proxy/{{port}}` + +### Stripping `/proxy/` from the request path + +You may notice that the code-server proxy strips `/proxy/` from the +request path. + +HTTP servers should use relative URLs to avoid the need to be coupled to the +absolute path at which they are served. This means you must [use trailing +slashes on all paths with +subpaths](https://blog.cdivilly.com/2019/02/28/uri-trailing-slashes). + +This reasoning is why the default behavior is to strip `/proxy/` from the +base path. If your application uses relative URLs and does not assume the +absolute path at which it is being served, it will just work no matter what port +you decide to serve it off or if you put it in behind code-server or any other +proxy. + +However, some prefer the cleaner aesthetic of no trailing slashes. Omitting the +trailing slashes couples you to the base path, since you cannot use relative +redirects correctly anymore. If you're okay with this tradeoff, use `/absproxy` +instead and the path will be passed as is (e.g., `/absproxy/3000/my-app-path`). + +### Proxying to create a React app + +You must use `/absproxy/` with `create-react-app` (see +[#2565](https://github.com/coder/code-server/issues/2565) and +[#2222](https://github.com/coder/code-server/issues/2222) for more information). +You will need to inform `create-react-app` of the path at which you are serving +via `$PUBLIC_URL` and webpack via `$WDS_SOCKET_PATH`: + +```sh +PUBLIC_URL=/absproxy/3000 \ + WDS_SOCKET_PATH=$PUBLIC_URL/sockjs-node \ + BROWSER=none yarn start +``` + +You should then be able to visit +`https://my-code-server-address.io/absproxy/3000` to see your app exposed +through code-server. + +> We highly recommend using the subdomain approach instead to avoid this class of issue. + +### Proxying to a Vue app + +Similar to the situation with React apps, you have to make a few modifications +to proxy a Vue app. + +1. add `vue.config.js` +2. update the values to match this (you can use any free port): + +```js +module.exports = { + devServer: { + port: 3454, + sockPath: "sockjs-node", + }, + publicPath: "/absproxy/3454", +} +``` + +3. access app at `/absproxy/3454` e.g. `http://localhost:8080/absproxy/3454` + +Read more about `publicPath` in the [Vue.js docs](https://cli.vuejs.org/config/#publicpath) + +### Proxying to an Angular app + +In order to use code-server's built-in proxy with Angular, you need to make the +following changes in your app: + +1. use `` in `src/index.html` +2. add `--serve-path /absproxy/4200` to `ng serve` in your `package.json` + +For additional context, see [this GitHub Discussion](https://github.com/coder/code-server/discussions/5439#discussioncomment-3371983). + +### Proxying to a Svelte app + +In order to use code-server's built-in proxy with Svelte, you need to make the +following changes in your app: + +1. Add `svelte.config.js` if you don't already have one +2. Update the values to match this (you can use any free port): + +```js +const config = { + kit: { + paths: { + base: "/absproxy/5173", + }, + }, +} +``` + +3. Access app at `/absproxy/5173/` e.g. `http://localhost:8080/absproxy/5173/ + +For additional context, see [this Github Issue](https://github.com/sveltejs/kit/issues/2958) + +### Prefixing `/absproxy/` with a path + +This is a case where you need to serve an application via `absproxy` as +explained above while serving code-server itself from a path other than the root +in your domain. + +For example: `http://my-code-server.com/user/123/workspace/my-app`. To achieve +this result: + +1. Start code-server with the switch `--abs-proxy-base-path=/user/123/workspace` +2. Follow one of the instructions above for your framework. + +### Preflight requests + +By default, if you have auth enabled, code-server will authenticate all proxied +requests including preflight requests. This can cause issues because preflight +requests do not typically include credentials. To allow all preflight requests +through the proxy without authentication, use `--skip-auth-preflight`. + +## Internationalization and customization + +code-server allows you to provide a JSON file to configure certain strings. This +can be used for both internationalization and customization. + +Create a JSON file with your custom strings: + +```json +{ + "WELCOME": "Welcome to {{app}}", + "LOGIN_TITLE": "{{app}} Access Portal", + "LOGIN_BELOW": "Please log in to continue", + "PASSWORD_PLACEHOLDER": "Enter Password" +} +``` + +Then reference the file: + +```shell +code-server --i18n /path/to/custom-strings.json +``` + +Or this can be done in the config file: + +```yaml +i18n: /path/to/custom-strings.json +``` + +You can combine this with the `--locale` flag to configure language support for +both code-server and VS Code in cases where code-server has no support but VS +Code does. If you are using this for internationalization, please consider +sending us a pull request to contribute it to `src/node/i18n/locales`. + +### Available keys and placeholders + +Refer to [../src/node/i18n/locales/en.json](../src/node/i18n/locales/en.json) +for a full list of the available keys for translations. Note that the only +placeholders supported for each key are the ones used in the default string. + +The `--app-name` flag controls the `{{app}}` placeholder in templates. If you +want to change the name, you can either: + +1. Set `--app-name` (potentially alongside `--i18n`) +2. Use `--i18n` and hardcode the name in your strings + +### Legacy flag + +The `--welcome-text` flag is now deprecated. Use the `WELCOME` key instead. diff --git a/docs/helm.md b/docs/helm.md new file mode 100644 index 000000000000..cf33d82892cf --- /dev/null +++ b/docs/helm.md @@ -0,0 +1,160 @@ +# code-server Helm Chart + +[![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square)](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) [![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)](https://img.shields.io/badge/Type-application-informational?style=flat-square) [![AppVersion: 4.8.0](https://img.shields.io/badge/AppVersion-4.8.0-informational?style=flat-square)](https://img.shields.io/badge/AppVersion-4.8.0-informational?style=flat-square) + +[code-server](https://github.com/coder/code-server) code-server is VS Code running +on a remote server, accessible through the browser. + +This chart is community maintained by [@Matthew-Beckett](https://github.com/Matthew-Beckett) and [@alexgorbatchev](https://github.com/alexgorbatchev) + +## Quickstart + +```console +$ git clone https://github.com/coder/code-server +$ cd code-server +$ helm upgrade --install code-server ci/helm-chart +``` + +## Introduction + +This chart bootstraps a code-server deployment on a +[Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) +package manager. + +## Prerequisites + +- Kubernetes 1.6+ + +## Installing the Chart + +To install the chart with the release name `code-server`: + +```console +$ git clone https://github.com/coder/code-server +$ cd code-server +$ helm upgrade --install code-server ci/helm-chart +``` + +The command deploys code-server on the Kubernetes cluster in the default +configuration. The [configuration](#configuration) section lists the parameters +that can be configured during installation. + +> **Tip**: List all releases using `helm list` + +## Uninstalling the Chart + +To uninstall/delete the `code-server` deployment: + +```console +$ helm delete code-server +``` + +The command removes all the Kubernetes components associated with the chart and +deletes the release. + +## Configuration + +The following table lists the configurable parameters of the code-server chart +and their default values. + +## Values + +| Key | Type | Default | +| ------------------------------------------- | ------ | ------------------------ | +| affinity | object | `{}` | +| extraArgs | list | `[]` | +| extraConfigmapMounts | list | `[]` | +| extraContainers | string | `""` | +| extraInitContainers | string | `""` | +| extraSecretMounts | list | `[]` | +| extraVars | list | `[]` | +| extraVolumeMounts | list | `[]` | +| fullnameOverride | string | `""` | +| hostnameOverride | string | `""` | +| image.pullPolicy | string | `"Always"` | +| image.repository | string | `"codercom/code-server"` | +| image.tag | string | `"4.8.0"` | +| imagePullSecrets | list | `[]` | +| ingress.enabled | bool | `false` | +| nameOverride | string | `""` | +| nodeSelector | object | `{}` | +| persistence.accessMode | string | `"ReadWriteOnce"` | +| persistence.annotations | object | `{}` | +| persistence.enabled | bool | `true` | +| persistence.size | string | `"1Gi"` | +| podAnnotations | object | `{}` | +| podSecurityContext | object | `{}` | +| replicaCount | int | `1` | +| resources | object | `{}` | +| securityContext.enabled | bool | `true` | +| securityContext.fsGroup | int | `1000` | +| securityContext.runAsUser | int | `1000` | +| service.port | int | `8443` | +| service.type | string | `"ClusterIP"` | +| serviceAccount.create | bool | `true` | +| serviceAccount.name | string | `nil` | +| tolerations | list | `[]` | +| volumePermissions.enabled | bool | `true` | +| volumePermissions.securityContext.runAsUser | int | `0` | + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, + +```console +$ helm upgrade --install code-server \ + ci/helm-chart \ + --set persistence.enabled=false +``` + +The above command sets the the persistence storage to false. + +Alternatively, a YAML file that specifies the values for the above parameters +can be provided while installing the chart. For example, + +```console +$ helm upgrade --install code-server ci/helm-chart -f values.yaml +``` + +> **Tip**: You can use the default [values.yaml](values.yaml) + +# Extra Containers + +There are two parameters which allow to add more containers to pod. +Use `extraContainers` to add regular containers +and `extraInitContainers` to add init containers. You can read more +about init containers in [k8s documentation](https://kubernetes.io/docs/concepts/workloads/pods/init-containers/). + +Both parameters accept strings and use them as a templates + +Example of using `extraInitContainers`: + +```yaml +extraInitContainers: | + - name: customization + image: {{ .Values.image.repository }}:{{ .Values.image.tag }} + imagePullPolicy: IfNotPresent + env: + - name: SERVICE_URL + value: https://open-vsx.org/vscode/gallery + - name: ITEM_URL + value: https://open-vsx.org/vscode/item + command: + - sh + - -c + - | + code-server --install-extension ms-python.python + code-server --install-extension golang.Go + volumeMounts: + - name: data + mountPath: /home/coder +``` + +With this yaml in file `init.yaml`, you can execute + +```console +$ helm upgrade --install code-server \ + ci/helm-chart \ + --values init.yaml +``` + +to deploy code-server with python and golang extensions preinstalled +before main container have started. diff --git a/docs/install.md b/docs/install.md new file mode 100644 index 000000000000..30da4d415e77 --- /dev/null +++ b/docs/install.md @@ -0,0 +1,362 @@ + + + +# Install + +- [install.sh](#installsh) + - [Detection reference](#detection-reference) +- [npm](#npm) +- [Standalone releases](#standalone-releases) +- [Debian, Ubuntu](#debian-ubuntu) +- [Fedora, CentOS, RHEL, SUSE](#fedora-centos-rhel-suse) +- [Arch Linux](#arch-linux) +- [Artix Linux](#artix-linux) +- [macOS](#macos) +- [Docker](#docker) +- [Helm](#helm) +- [Windows](#windows) +- [Raspberry Pi](#raspberry-pi) +- [Termux](#termux) +- [Cloud providers](#cloud-providers) +- [Uninstall](#uninstall) + - [install.sh](#installsh-1) + - [Homebrew](#homebrew) + - [npm](#npm-1) + - [Debian, Ubuntu](#debian-ubuntu-1) + + + + +This document demonstrates how to install `code-server` on various distros and +operating systems. + +## install.sh + +The easiest way to install code-server is to use our [install +script](https://github.com/coder/code-server/blob/main/install.sh) for Linux, macOS and FreeBSD. The install script +[attempts to use the system package manager](#detection-reference) if possible. + +You can preview what occurs during the install process: + +```bash +curl -fsSL https://code-server.dev/install.sh | sh -s -- --dry-run +``` + +To install, run: + +```bash +curl -fsSL https://code-server.dev/install.sh | sh +``` + +You can modify the installation process by including one or more of the +following flags: + +- `--dry-run`: echo the commands for the install process without running them. +- `--method`: choose the installation method. + - `--method=detect`: detect the package manager but fallback to + `--method=standalone`. + - `--method=standalone`: install a standalone release archive into `~/.local`. +- `--prefix=/usr/local`: install a standalone release archive system-wide. +- `--version=X.X.X`: install version `X.X.X` instead of latest version. +- `--help`: see usage docs. +- `--edge`: install the latest edge version (i.e. pre-release) + +When done, the install script prints out instructions for running and starting +code-server. + +> If you're concerned about the install script's use of `curl | sh` and the +> security implications, please see [this blog +> post](https://sandstorm.io/news/2015-09-24-is-curl-bash-insecure-pgp-verified-install) +> by [sandstorm.io](https://sandstorm.io). + +If you prefer to install code-server manually, despite the [detection +references](#detection-reference) and `--dry-run` feature, then continue on for +information on how to do this. The [`install.sh`](https://github.com/coder/code-server/blob/main/install.sh) script runs the +_exact_ same commands presented in the rest of this document. + +### Detection reference + +- For Debian and Ubuntu, code-server will install the latest deb package. +- For Fedora, CentOS, RHEL and openSUSE, code-server will install the latest RPM + package. +- For Arch Linux, code-server will install the AUR package. +- For any unrecognized Linux operating system, code-server will install the + latest standalone release into `~/.local`. + - Ensure that you add `~/.local/bin` to your `$PATH` to run code-server. + +- For macOS, code-server will install the Homebrew package (if you don't have + Homebrew installed, code-server will install the latest standalone release + into `~/.local`). + - Ensure that you add `~/.local/bin` to your `$PATH` to run code-server. + +- For FreeBSD, code-server will install the [npm package](#npm) with `npm` + +- If you're installing code-server onto architecture with no releases, + code-server will install the [npm package](#npm) with `npm` + - We currently offer releases for amd64 and arm64. + - The [npm package](#npm) builds the native modules on post-install. + +## npm + +We recommend installing with `npm` when: + +1. You aren't using a machine with `amd64` or `arm64`. +2. You are installing code-server on Windows. +3. You're on Linux with `glibc` < v2.28 or `glibcxx` < v3.4.21. +4. You're running Alpine Linux or are using a non-glibc libc. See + [#1430](https://github.com/coder/code-server/issues/1430#issuecomment-629883198) + for more information. + +Installing code-server with `npm` builds native modules on install. + +This process requires C dependencies; see our guide on [installing with npm](./npm.md) for more information. + +## Standalone releases + +We publish self-contained `.tar.gz` archives for every release on +[GitHub](https://github.com/coder/code-server/releases). The archives bundle the +node binary and node modules. + +We create the standalone releases using the [npm package](#npm), and we +then create the remaining releases using the standalone version. + +The only requirement to use the standalone release is `glibc` >= 2.28 and +`glibcxx` >= v3.4.21 on Linux (for macOS, there is no minimum system +requirement). + +To use a standalone release: + +1. Download the latest release archive for your system from + [GitHub](https://github.com/coder/code-server/releases). +2. Unpack the release. +3. Run code-server by executing `./bin/code-server`. + +You can add `./bin/code-server` to your `$PATH` so that you can execute +`code-server` without providing full path each time. + +Here is a sample script for installing and using a standalone code-server +release on Linux: + +```bash +mkdir -p ~/.local/lib ~/.local/bin +curl -fL https://github.com/coder/code-server/releases/download/v$VERSION/code-server-$VERSION-linux-amd64.tar.gz \ + | tar -C ~/.local/lib -xz +mv ~/.local/lib/code-server-$VERSION-linux-amd64 ~/.local/lib/code-server-$VERSION +ln -s ~/.local/lib/code-server-$VERSION/bin/code-server ~/.local/bin/code-server +PATH="~/.local/bin:$PATH" +code-server +# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml +``` + +## Debian, Ubuntu + +> The standalone arm64 .deb does not support Ubuntu 16.04 or earlier. Please +> upgrade or [build with npm](#npm). + +```bash +curl -fOL https://github.com/coder/code-server/releases/download/v$VERSION/code-server_${VERSION}_amd64.deb +sudo dpkg -i code-server_${VERSION}_amd64.deb +sudo systemctl enable --now code-server@$USER +# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml +``` + +## Fedora, CentOS, RHEL, SUSE + +> The standalone arm64 .rpm does not support CentOS 7. Please upgrade or [build +> with npm](#npm). + +```bash +curl -fOL https://github.com/coder/code-server/releases/download/v$VERSION/code-server-$VERSION-amd64.rpm +sudo rpm -i code-server-$VERSION-amd64.rpm +sudo systemctl enable --now code-server@$USER +# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml +``` + +## Arch Linux + +```bash +# Install code-server from the AUR using yay. +yay -S code-server +sudo systemctl enable --now code-server@$USER +# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml +``` + +```bash +# Install code-server from the AUR with plain makepkg. +git clone https://aur.archlinux.org/code-server.git +cd code-server +makepkg -si +sudo systemctl enable --now code-server@$USER +# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml +``` + +## Artix Linux + +```bash +# Install code-server from the AUR +git clone https://aur.archlinux.org/code-server.git +cd code-server +makepkg -si +``` + +Save the file as `code-server` in `/etc/init.d/` and make it executable with `chmod +x code-server`. Put your username in line 3. + +```bash +#!/sbin/openrc-run +name=$RC_SVCNAME +description="$name - VS Code on a remote server" +user="" # your username here +homedir="/home/$user" +command="$(which code-server)" +# Just because you can do this does not mean you should. Use ~/.config/code-server/config.yaml instead +#command_args="--extensions-dir $homedir/.local/share/$name/extensions --user-data-dir $homedir/.local/share/$name --disable-telemetry" +command_user="$user:$user" +pidfile="/run/$name/$name.pid" +command_background="yes" +extra_commands="report" + +depend() { + use logger dns + need net +} + +start_pre() { + checkpath --directory --owner $command_user --mode 0755 /run/$name /var/log/$name +} + +start() { + default_start + report +} + +stop() { + default_stop +} + +status() { + default_status + report +} + +report() { + # Report to the user + einfo "Reading configuration from ~/.config/code-server/config.yaml" +} +``` + +Start on boot with default runlevel + +``` +rc-update add code-server default +``` + +Start the service immediately + +``` +rc-service code-server start +``` + +## macOS + +```bash +brew install code-server +brew services start code-server +# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml +``` + +## Docker + +```bash +# This will start a code-server container and expose it at http://127.0.0.1:8080. +# It will also mount your current directory into the container as `/home/coder/project` +# and forward your UID/GID so that all file system operations occur as your user outside +# the container. +# +# Your $HOME/.config is mounted at $HOME/.config within the container to ensure you can +# easily access/modify your code-server config in $HOME/.config/code-server/config.json +# outside the container. +mkdir -p ~/.config +docker run -it --name code-server -p 127.0.0.1:8080:8080 \ + -v "$HOME/.local:/home/coder/.local" \ + -v "$HOME/.config:/home/coder/.config" \ + -v "$PWD:/home/coder/project" \ + -u "$(id -u):$(id -g)" \ + -e "DOCKER_USER=$USER" \ + codercom/code-server:latest +``` + +Our official image supports `amd64` and `arm64`. For `arm32` support, you can +use a [community-maintained code-server +alternative](https://hub.docker.com/r/linuxserver/code-server). + +## Helm + +You can install code-server using the [Helm package manager](https://coder.com/docs/code-server/latest/helm). + +## Windows + +We currently [do not publish Windows +releases](https://github.com/coder/code-server/issues/1397). We recommend +installing code-server onto Windows with [`npm`](#npm). + +## Raspberry Pi + +We recommend installing code-server onto Raspberry Pi with [`npm`](#npm). + +If you see an error related to `node-gyp` during installation, See [#5174](https://github.com/coder/code-server/issues/5174) for more information. + +## Termux + +Please see code-server's [Termux docs](./termux.md#installation) for more +information. + +## Cloud providers + +We maintain [one-click apps and install scripts for cloud +providers](https://github.com/coder/deploy-code-server) such as DigitalOcean, +Railway, Heroku, and Azure. + +## Uninstall + +code-server can be completely uninstalled by removing the application directory, and your user configuration directory. + +To delete settings and data: + +```shell +rm -rf ~/.local/share/code-server ~/.config/code-server +``` + +### install.sh + +If you installed with the install script, by default code-server will be in `~/.local/lib/code-server-` and you can remove it with `rm -rf`. e.g. + +```shell +rm -rf ~/.local/lib/code-server-* +``` + +### Homebrew + +To remove the code-server homebrew package, run: + +```shell +brew remove code-server + +# Alternatively +brew uninstall code-server +``` + +### npm + +To remove the code-server global module, run: + +```shell +npm uninstall --global code-server +``` + +### Debian, Ubuntu + +To uninstall, run: + +```shell +sudo apt remove code-server +``` diff --git a/docs/ios.md b/docs/ios.md new file mode 100644 index 000000000000..fc484e19b0dd --- /dev/null +++ b/docs/ios.md @@ -0,0 +1,9 @@ +# Using code-server on iOS with iSH + +1. Install iSH from the [App Store](https://apps.apple.com/us/app/ish-shell/id1436902243) +2. Install `curl` and `nano` with `apk add curl nano` +3. Configure iSH to use an earlier version of NodeJS with `nano /etc/apk/repositories` and edit `v3.14` to `v3.12` on both repository links. +4. Install `nodejs` and `npm` with `apk add nodejs npm` +5. Install code-server with `curl -fsSL https://code-server.dev/install.sh | sh` +6. Run code-server with `code-server` +7. Access on localhost:8080 in your browser diff --git a/docs/ipad.md b/docs/ipad.md new file mode 100644 index 000000000000..ef951cc4e6fe --- /dev/null +++ b/docs/ipad.md @@ -0,0 +1,199 @@ + + + +# iPad + +- [Using the code-server progressive web app (PWA)](#using-the-code-server-progressive-web-app-pwa) +- [Access code-server using Servediter](#access-code-server-using-servediter) +- [Raspberry Pi USB-C network](#raspberry-pi-usb-c-network) +- [Recommendations](#recommendations) +- [Known issues](#known-issues) + - [Workaround for issue with `ctrl+c` not stopping a running process in the terminal](#workaround-for-issue-with-ctrlc-not-stopping-a-running-process-in-the-terminal) +- [Access code-server with a self-signed certificate on an iPad](#access-code-server-with-a-self-signed-certificate-on-an-ipad) + - [Certificate requirements](#certificate-requirements) + - [Sharing a self-signed certificate with an iPad](#sharing-a-self-signed-certificate-with-an-ipad) + + + + +Once you've installed code-server, you can access it from an iPad. + +## Using the code-server progressive web app (PWA) + +To use code-server on an iPad, we recommend installing the code-server +progressive web app (PWA): + +1. Open code-server in Safari. +2. Click the **Share** icon. +3. Click **Add to Home Screen**. + +You can now open code-server from the Home screen, and when you do, you'll be +using the PWA. Running code-server as a PWA gets you more screen real estate and +access to top-level keyboard shortcuts since its running like a native app. + +For example, you can use `cmd+w` to close an active file in the workbench. You +can add this to `keybindings.json`: + +1. Open code-server +2. Go to **Command Palette** > **Open Keyboard Shortcuts (JSON)** +3. Add the following to `keybindings.json` + + ```json + { + "key": "cmd+w", + "command": "workbench.action.closeActiveEditor" + } + ``` + +4. Test the command by using `cmd+w` to close an active file. + +## Access code-server using Servediter + +If you are unable to get the self-signed certificate working, or you do not have a domain +name to use, you can use [Servediter for code-server](https://apps.apple.com/us/app/servediter-for-code-server/id1504491325). + +> Servediter for code-server is **not** officially supported by the code-server team! + +To use Servediter: + +1. Download the app from the App Store. +2. When prompted, provide your server information. If you are running a local + server or a [Raspberry Pi connected via USB-C](#raspberry-pi-usb-c-network), you will input your settings + into **Self Hosted Server**. + +## Raspberry Pi USB-C network + +We've heard of users having great success using code-server on an iPad connected +to a Raspberry Pi via USB-C (the Raspberry Pi provides both power and direct +network access). Setting this up requires you to turn on **Network over USB-C** +on the Raspberry Pi, then continuing with code-server as usual on the iPad. + +For more information, see: + +- [General introduction to Pi as an iPad + accessory](https://www.youtube.com/watch?v=IR6sDcKo3V8) +- [iPad with Pi FAQ](https://www.youtube.com/watch?v=SPSlyqo5Q2Q) +- [Technical guide to connecting a Raspberry Pi to an + iPad](https://www.geeky-gadgets.com/connect-a-raspberry-pi-4-to-an-ipad-pro-21-01-2020/) + +You may also find the following tips from [Acker +Apple](http://github.com/ackerapple/) helpful: + +> Here are my keys to success. I bought a 4" touch screen with fan included that +> attaches as a case to the Pi. I use the touch screen for anytime I have +> connection issues, otherwise I turn off the Pi screen. I gave my Pi a network +> name so I can easily connect at home on wifi or when on go with 1 usb-c cable +> that supplys both power and network connectivity. Lastly, not all usb-c cables +> are equal and not all will work so try different usb-c cables if you are going +> mad (confirm over wifi first then move to cable). + +## Recommendations + +Once you can access code-server on your iPad, you may find the following tips +and tricks helpful: + +- Use multi-task mode to make code changes and see the browser at the same time + - This prevents the iOS background from dropping an app's state if you are + switching between code-server and browser (with both in full-screen) +- Be sure you are using the debug/terminal that is built into VS Code so that + you don’t need another terminal app running + - This also prevents switching between full screen apps and losing your view + due to iOS' background app memory management + +## Known issues + +- Getting self-signed certificates to work [is an involved + process](#access-code-server-with-a-self-signed-certificate-on-an-ipad) +- Keyboard issues: + - The keyboard disappear sometimes + [#979](https://github.com/coder/code-server/issues/979) + - Some expectations regarding shortcuts may not be met: + - `cmd + n` opens new browser window instead of new file, and it's difficult + to set alternative as a workaround + - In general, expect to edit your keyboard shortcuts + - There's no escape key by default on the Magic Keyboard, so most users set + the globe key to be an escape key +- Trackpad scrolling does not work on iPadOS < 14.5 + ([#1455](https://github.com/coder/code-server/issues/1455)) + - [WebKit fix](https://bugs.webkit.org/show_bug.cgi?id=210071#c13) +- Keyboard may lose focus in Safari / split view [#4182](https://github.com/coder/code-server/issues/4182) +- Terminal text does not appear by default [#3824](https://github.com/coder/code-server/issues/3824) +- Copy & paste in terminal does not work well with keyboard shortcuts [#3491](https://github.com/coder/code-server/issues/3491) +- `ctrl+c` does not stop a long-running process in the browser + - Tracking upstream issue here: + [#114009](https://github.com/microsoft/vscode/issues/114009) + - See [workaround](#ctrl-c-workaround) + +Additionally, see [issues in the code-server repo that are tagged with the `os-ios` +label](https://github.com/coder/code-server/issues?q=is%3Aopen+is%3Aissue+label%3Aos-ios) +for more information. + +### Workaround for issue with `ctrl+c` not stopping a running process in the terminal + +This's currently an issue with `ctrl+c` not stopping a running process in the +integrated terminal. We have filed an issue upstream and are tracking +[here](https://github.com/microsoft/vscode/issues/114009). + +In the meantime, you can manually define a shortcut as a workaround: + +1. Open the Command Palette +2. Look for **Preferences: Open Keyboard Shortcuts (JSON)** +3. Add the following snippet: + + ```json + { + "key": "ctrl+c", + "command": "workbench.action.terminal.sendSequence", + "args": { + "text": "\u0003" + }, + "when": "terminalFocus" + } + ``` + +_Source: [StackOverflow](https://stackoverflow.com/a/52735954/3015595)_ + +## Access code-server with a self-signed certificate on an iPad + +If you've installed code-server and are [running it with a self-signed +certificate](./guide.md#using-a-self-signed-certificate), you may see multiple +security warnings from Safari. To fix this, you'll need to install the +self-signed certificate generated by code-server as a profile on your device (you'll also need to do this to +enable WebSocket connections). + +### Certificate requirements + +- We're assuming that you're using the self-signed certificate code-server + generates for you (if not, make sure that your certificate [abides by the + guidelines issued by Apple](https://support.apple.com/en-us/HT210176)). +- We've noticed that the certificate has to include `basicConstraints=CA:true`. +- Your certificate must have a subject alt name that matches the hostname you'll + use to access code-server from the iPad. You can pass this name to code-server + so that it generates the certificate correctly using `--cert-host`. + +### Sharing a self-signed certificate with an iPad + +To share a self-signed certificate with an iPad: + +1. Get the location of the certificate code-server generated; code-server prints + the certificate's location in its logs: + + ```console + [2020-10-30T08:55:45.139Z] info - Using generated certificate and key for HTTPS: ~/.local/share/code-server/mymbp_local.crt + ``` + +2. Send the certificate to the iPad, either by emailing it to yourself or using + Apple's Airdrop feature. + +3. Open the `*.crt` file so that you're prompted to go into Settings to install. + +4. Go to **Settings** > **General** > **Profile**, and select the profile. Tap **Install**. + +5. Go to **Settings** > **About** > **Certificate Trust Settings** and [enable + full trust for your certificate](https://support.apple.com/en-us/HT204477). + +You should be able to access code-server without all of Safari's warnings now. + +**warning**: Your iPad must access code-server via a domain name. It could be local +DNS like `mymacbookpro.local`, but it must be a domain name. Otherwise, Safari will +not allow WebSockets connections. diff --git a/docs/manifest.json b/docs/manifest.json new file mode 100644 index 000000000000..4e82dcd7d713 --- /dev/null +++ b/docs/manifest.json @@ -0,0 +1,114 @@ +{ + "versions": ["v4.8.0"], + "routes": [ + { + "title": "Home", + "description": "Learn how to install and run code-server.", + "path": "./README.md", + "icon_path": "assets/images/icons/home.svg" + }, + { + "title": "Requirements", + "description": "Learn about what you need to run code-server.", + "icon_path": "assets/images/icons/requirements.svg", + "path": "./requirements.md" + }, + { + "title": "Install", + "description": "How to install code-server.", + "icon_path": "assets/images/icons/wrench.svg", + "path": "./install.md", + "children": [ + { + "title": "npm", + "description": "How to install code-server using npm", + "path": "./npm.md" + }, + { + "title": "Helm", + "description": "How to install code-server using the Helm package manager", + "path": "./helm.md" + } + ] + }, + { + "title": "Usage", + "description": "How to set up and use code-server.", + "icon_path": "assets/images/icons/usage.svg", + "path": "./guide.md", + "children": [ + { + "title": "Coder", + "description": "How to run code-server in Coder", + "path": "./coder.md" + }, + { + "title": "iPad", + "description": "How to access your code-server installation using an iPad.", + "path": "./ipad.md" + }, + { + "title": "Termux", + "description": "How to install Termux to run code-server on an Android device.", + "path": "./termux.md" + }, + { + "title": "iOS", + "description": "How to use code-server on iOS with iSH.", + "path": "./ios.md" + }, + { + "title": "Android", + "description": "How to run code-server on an Android device using UserLAnd.", + "path": "./android.md" + } + ] + }, + { + "title": "Collaboration", + "description": "How to setup real time collaboration using code server.", + "icon_path": "assets/images/icons/collab.svg", + "path": "./collaboration.md" + }, + { + "title": "Upgrade", + "description": "How to upgrade code-server.", + "icon_path": "assets/images/icons/upgrade.svg", + "path": "./upgrade.md" + }, + { + "title": "FAQ", + "description": "Frequently asked questions on installing and running code-server.", + "icon_path": "assets/images/icons/faq.svg", + "path": "./FAQ.md" + }, + { + "title": "Contributing", + "description": "How to contribute to code-server.", + "icon_path": "assets/images/icons/contributing.svg", + "path": "./CONTRIBUTING.md", + "children": [ + { + "title": "Code of conduct", + "description": "Coder expects contributors to code-server to behave in a manner that creates an open and welcoming environment.", + "path": "./CODE_OF_CONDUCT.md" + }, + { + "title": "Maintenance", + "description": "Learn about the workflow followed by code-server's maintainers.", + "path": "./MAINTAINING.md" + }, + { + "title": "Triage", + "description": "How the maintainers triage issues with code-server.", + "path": "./triage.md" + }, + { + "title": "Security", + "description": "Learn about the tools used to detect vulnerabilities in code-server, and how you can report vulnerabilities.", + "path": "./SECURITY.md" + } + ] + } + ] +} diff --git a/docs/npm.md b/docs/npm.md new file mode 100644 index 000000000000..8d3afd0be06a --- /dev/null +++ b/docs/npm.md @@ -0,0 +1,150 @@ + + + +# npm Install Requirements + +- [Node.js version](#nodejs-version) +- [Ubuntu, Debian](#ubuntu-debian) +- [Fedora, CentOS, RHEL](#fedora-centos-rhel) +- [Alpine](#alpine) +- [macOS](#macos) +- [FreeBSD](#freebsd) +- [Windows](#windows) +- [Installing](#installing) +- [Troubleshooting](#troubleshooting) + - [Issues with Node.js after version upgrades](#issues-with-nodejs-after-version-upgrades) + - [Debugging install issues with npm](#debugging-install-issues-with-npm) + + + + +If you're installing code-server via `npm`, you'll need to install additional +dependencies required to build the native modules used by VS Code. This article +includes installing instructions based on your operating system. + +> **WARNING**: Do not use `yarn` to install code-server. Unlike `npm`, it does not respect +> lockfiles for distributed applications. It will instead use the latest version +> available at installation time - which might not be the one used for a given +> code-server release, and [might lead to unexpected behavior](https://github.com/coder/code-server/issues/4927). + +## Node.js version + +We use the same major version of Node.js shipped with Code's remote, which is +currently `22.x`. VS Code also [lists Node.js +requirements](https://github.com/microsoft/vscode/wiki/How-to-Contribute#prerequisites). + +Using other versions of Node.js [may lead to unexpected +behavior](https://github.com/coder/code-server/issues/1633). + +## Ubuntu, Debian + +```bash +sudo apt-get install -y \ + build-essential \ + pkg-config \ + python3 +npm config set python python3 +``` + +Proceed to [installing](#installing) + +## Fedora, CentOS, RHEL + +```bash +sudo yum groupinstall -y 'Development Tools' +sudo yum config-manager --set-enabled PowerTools # unnecessary on CentOS 7 +sudo yum install -y python2 +npm config set python python2 +``` + +Proceed to [installing](#installing) + +## Alpine + +```bash +apk add alpine-sdk bash libstdc++ libc6-compat python3 krb5-dev +``` + +Proceed to [installing](#installing) + +## macOS + +```bash +xcode-select --install +``` + +Proceed to [installing](#installing) + +## FreeBSD + +```sh +pkg install -y git python npm-node22 pkgconf +pkg install -y libinotify +``` + +Proceed to [installing](#installing) + +## Windows + +Installing code-server requires all of the [prerequisites for VS Code development](https://github.com/Microsoft/vscode/wiki/How-to-Contribute#prerequisites). When installing the C++ compiler tool chain, we recommend using "Option 2: Visual Studio 2019" for best results. + +Next, install code-server with: + +```bash +npm install --global code-server +code-server +# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml +``` + +A `postinstall.sh` script will attempt to run. Select your terminal (e.g., Git bash) as the default shell for npm run-scripts. If an additional dialog does not appear, run the install command again. + +If the `code-server` command is not found, you'll need to [add a directory to your PATH](https://www.architectryan.com/2018/03/17/add-to-the-path-on-windows-10/). To find the directory, use the following command: + +```shell +npm config get prefix +``` + +For help and additional troubleshooting, see [#1397](https://github.com/coder/code-server/issues/1397). + +## Installing + +After adding the dependencies for your OS, install the code-server package globally: + +```bash +npm install --global code-server +code-server +# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml +``` + +## Troubleshooting + +If you need further assistance, post on our [GitHub Discussions +page](https://github.com/coder/code-server/discussions). + +### Issues with Node.js after version upgrades + +Occasionally, you may run into issues with Node.js. + +If you install code-server using `npm`, and you upgrade your Node.js +version, you may need to reinstall code-server to recompile native modules. +Sometimes, you can get around this by navigating into code-server's `lib/vscode` +directory and running `npm rebuild` to recompile the modules. + +A step-by-step example of how you might do this is: + +1. Install code-server: `brew install code-server` +2. Navigate into the directory: `cd /usr/local/Cellar/code-server//libexec/lib/vscode/` +3. Recompile the native modules: `npm rebuild` +4. Restart code-server + +### Debugging install issues with npm + +To debug installation issues, install with `npm`: + +```shell +# Uninstall +npm uninstall --global code-server > /dev/null 2>&1 + +# Install with logging +npm install --loglevel verbose --global code-server +``` diff --git a/docs/requirements.md b/docs/requirements.md new file mode 100644 index 000000000000..835fe5754bd1 --- /dev/null +++ b/docs/requirements.md @@ -0,0 +1,56 @@ +# Requirements + +You'll need a machine on which you can run code-server. You can use a physical +machine you have, or you can use a VM on GCP/AWS. + +At the minimum, we recommend: + +- 1 GB of RAM +- 2 CPU cores + +You can use any Linux distribution, but [our +docs](https://coder.com/docs/code-server/latest/guide) assume that you're using +Debian hosted by Google Cloud (see the following section for instructions on +setting this up). + +Your environment must have WebSockets enabled, since code-server uses WebSockets +for communication between the browser and the server. + +## Set up a VM on Google Cloud + +The following steps walk you through setting up a VM running Debian using Google +Cloud (though you are welcome to use any machine or VM provider). + +If you're [signing up with Google](https://console.cloud.google.com/getting-started) for the first time, you should get a 3-month trial with +\$300 of credits. + +After you sign up and create a new Google Cloud Provider (GCP) project, create a +new Compute Engine VM instance: + +1. Using the sidebar, navigate to **Compute Engine** > **VM Instances**. +2. Click **Create Instance**. +3. Provide a **name** for new instance. +4. Choose the **region** that's closest to you based on [GCP + ping](https://gcping.com/). +5. Choose a **zone** (any option is fine). +6. We recommend choosing an **E2 series instance** from the [general-purpose + family](https://cloud.google.com/compute/docs/machine-types#general_purpose). +7. Change the instance type to **custom** and set at least **2 cores** and **2 + GB of RAM**. You can add more resources if desired, though you can also edit + your instance at a later point. +8. Though optional, we highly recommend switching the persistent disk to an SSD + with at least 32 GB. To do so, click **change** under **Boot Disk**. Then, + change the type to **SSD Persistent Disk**, and set the size to **32**. (You + can also grow your disk at a later date). +9. Go to **Networking** > **Networking Interfaces** and edit the existing + interface to use a static internal IP. Click **Done** to save. +10. If you don't have a [project-wide SSH + key](https://cloud.google.com/compute/docs/instances/adding-removing-ssh-keys#project-wide), + go to **Security** > **SSH Keys** to add your public key. +11. Click **Create** to proceed. + +Notes: + +- To lower costs, you can shut down your server when you're not using it. +- We recommend using the `gcloud cli` to avoid using the GCP Dashboard if possible. +- For serving code-server over HTTPS, we recommend using an external domain name along with a service such as Let's Encrypt diff --git a/docs/termux.md b/docs/termux.md new file mode 100644 index 000000000000..db81cb57d1e1 --- /dev/null +++ b/docs/termux.md @@ -0,0 +1,203 @@ + + + +# Termux + +- [Install](#install) +- [NPM Installation](#npm-installation) +- [Upgrade](#upgrade) +- [Known Issues](#known-issues) + - [Git won't work in `/sdcard`](#git-wont-work-in-sdcard) + - [Many extensions including language packs fail to install](#many-extensions-including-language-packs-fail-to-install) +- [Extra](#extra) + - [Keyboard Shortcuts and Tab Key](#keyboard-shortcuts-and-tab-key) + - [Create a new user](#create-a-new-user) + - [Install Go](#install-go) + - [Install Python](#install-python) + + + + +## Install + +1. Get [Termux](https://f-droid.org/en/packages/com.termux/) from **F-Droid**. +2. Run `pkg install tur-repo` +3. Run `pkg install code-server` +4. You can now start code server by simply running `code-server`. + +## NPM Installation + +1. Get [Termux](https://f-droid.org/en/packages/com.termux/) from **F-Droid**. + +2. We will now change using the following command. + +```sh +termux-change-repo +``` + +Now select `Main Repository` then change repo to `Mirrors by Grimler Hosted on grimler.se`. + +3. After successfully updating of repository update and upgrade all the packages by the following command + +```sh +pkg update +pkg upgrade -y +``` + +4. Now let's install requirement dependancy. + +```sh +pkg install -y \ + build-essential \ + binutils \ + pkg-config \ + python3 \ + nodejs-lts +npm config set python python3 +node -v +``` + +you will get Node version `v22` + +5. Now install code-server following our guide on [installing with npm](./npm.md) + +6. Congratulation code-server is installed on your device using the following command. + +```sh +code-server --auth none +``` + +7. If already installed then use the following command for upgradation. + +``` +npm update --global code-server +``` + +## Upgrade + +1. Remove all previous installs `rm -rf ~/.local/lib/code-server-*` +2. Run the install script again `curl -fsSL https://code-server.dev/install.sh | sh` + +## Known Issues + +### Git won't work in `/sdcard` + +Issue : Using git in the `/sdcard` directory will fail during cloning/commit/staging/etc...\ +Fix : None\ +Potential Workaround : + +1. Create a soft-link from the debian-fs to your folder in `/sdcard` +2. Use git from termux (preferred) + +### Many extensions including language packs fail to install + +Issue: Android is not seen as a Linux environment but as a separate, unsupported platform, so code-server only allows [Web Extensions](https://code.visualstudio.com/api/extension-guides/web-extensions), refusing to download extensions that run on the server.\ +Fix: None\ +Potential workarounds : + +Either + +- Manually download extensions as `.vsix` file and install them via `Extensions: Install from VSIX...` in the Command Palette. + +- Use an override to pretend the platform is Linux: + +Create a JS script that patches `process.platform`: + +```js +// android-as-linux.js +Object.defineProperty(process, "platform", { + get() { + return "linux" + }, +}) +``` + +Then use Node's `--require` option to make sure it is loaded before `code-server` starts: + +```sh +NODE_OPTIONS="--require /path/to/android-as-linux.js" code-server +``` + +⚠️ Note that Android and Linux are not 100% compatible, so use these workarounds at your own risk. Extensions that have native dependencies other than Node or that directly interact with the OS might cause issues. + +## Extra + +### Keyboard Shortcuts and Tab Key + +In order to support the tab key and use keyboard shortcuts, add this to your +settings.json: + +```json +{ + "keyboard.dispatch": "keyCode" +} +``` + +### Create a new user + +To create a new user follow these simple steps - + +1. Create a new user by running `useradd -m`. +2. Change the password by running `passwd `. +3. Give your new user sudo access by running `visudo`, scroll down to `User privilege specification` and add the following line after root `username ALL=(ALL:ALL) ALL`. +4. Now edit the `/etc/passwd` file with your command line editor of choice and at the end of the line that specifies your user change `/bin/sh` to `/bin/bash`. +5. Now switch users by running `su - ` + +- Remember the `-` betweeen `su` and username is required to execute `/etc/profile`,\ + since `/etc/profile` may have some necessary things to be executed you should always add a `-`. + +### Install Go + +> From https://golang.org/doc/install + +1. Go to https://golang.org/dl/ and copy the download link for `linux arm` and run the following: + +```bash +wget download_link +``` + +2. Extract the downloaded archive. (This step will erase all previous GO installs, make sure to create a backup if you have previously installed GO) + +```bash +rm -rf /usr/local/go && tar -C /usr/local -xzf archive_name +``` + +3. Run `nano /etc/profile` and add the following line `export PATH=$PATH:/usr/local/go/bin`. +4. Now run `exit` (depending on if you have switched users or not, you may have to run `exit` multiple times to get to normal termux shell) and start Debian again. +5. Check if your install was successful by running `go version` + +### Install Python + +> Run these commands as root + +1. Run the following commands to install required packages to build python: + +```bash +sudo apt-get update +sudo apt-get install make build-essential libssl-dev zlib1g-dev \ + libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \ + libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev +``` + +2. Install [pyenv](https://github.com/pyenv/pyenv/) from [pyenv-installer](https://github.com/pyenv/pyenv-installer) by running: + +```bash +curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash +``` + +3. Run `nano /etc/profile` and add the following: + +```bash +export PYENV_ROOT="/root/.pyenv" +export PATH="/root/.pyenv/bin:$PATH" +eval "$(pyenv init --path)" +eval "$(pyenv virtualenv-init -)" +``` + +4. Exit and start Debian again. +5. Run `pyenv versions` to list all installable versions. +6. Run `pyenv install version` to install the desired python version. + > The build process may take some time (an hour or 2 depending on your device). +7. Run `touch /root/.pyenv/version && echo "your_version_here" > /root/.pyenv/version` +8. (You may have to start Debian again) Run `python3 -V` to verify if PATH works or not. + > If `python3` doesn't work but pyenv says that the install was successful in step 6 then try running `$PYENV_ROOT/versions/your_version/bin/python3`. diff --git a/docs/triage.md b/docs/triage.md new file mode 100644 index 000000000000..6d4120f97209 --- /dev/null +++ b/docs/triage.md @@ -0,0 +1,35 @@ +# Triage + +Triaging code-server issues is done with the following issue filter: + +```text +is:issue is:open no:project sort:created-asc -label:blocked -label:upstream -label:waiting-for-info -label:extension-request +``` + +This will show issues that: + +1. Are open. +1. Have no assigned project. +1. Are not `blocked` or tagged for work by `upstream` (the VS Code core team). + If an upstream issue is detrimental to the code-server experience we may fix + it in our patch instead of waiting for the VS Code team to fix it. Someone + should periodically go through these issues to see if they can be unblocked! +1. Are not labeled `waiting-for-info`. +1. Are not extension requests. + +## Triage process + +1. If an issue is a question/discussion, it should be converted into a GitHub + discussion. +1. Otherwise, give the issue the appropriate labels (feel free to create new + ones if necessary). There are no hard and set rules for labels. We don't have + many so look through and see how they've been used throughout the repository. + They all also have descriptions. +1. If more information is required, please ask the submitter and tag as + `waiting-for-info` and wait. +1. Finally, the issue should be moved into the + [code-server](https://github.com/coder/code-server/projects/1) project where we + pick out issues to fix and track their progress. + +We also use [milestones](https://github.com/coder/code-server/milestones) to track +what issues are planned/or were closed for what release. diff --git a/docs/upgrade.md b/docs/upgrade.md new file mode 100644 index 000000000000..f4f90e6ce044 --- /dev/null +++ b/docs/upgrade.md @@ -0,0 +1,5 @@ +# Upgrade + +To upgrade code-server, install the new version over the old version. All user +data is in `~/.local/share/code-server`, so they are preserved between +installations. diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 000000000000..b13ebc0dc4de --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,84 @@ +import { fixupConfigRules } from "@eslint/compat" +import globals from "globals" +import tsParser from "@typescript-eslint/parser" +import path from "node:path" +import { fileURLToPath } from "node:url" +import js from "@eslint/js" +import { FlatCompat } from "@eslint/eslintrc" + +const __filename = fileURLToPath(import.meta.url) +const __dirname = path.dirname(__filename) +const compat = new FlatCompat({ + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended, + allConfig: js.configs.all, +}) + +export default [ + ...fixupConfigRules( + compat.extends( + "eslint:recommended", + "plugin:@typescript-eslint/recommended", + "plugin:import/recommended", + "plugin:import/typescript", + "plugin:prettier/recommended", + "prettier", + ), + ), + { + languageOptions: { + globals: { + ...globals.browser, + ...globals.jest, + ...globals.node, + }, + + parser: tsParser, + ecmaVersion: 2018, + sourceType: "module", + }, + + settings: { + "import/resolver": { + typescript: { + alwaysTryTypes: true, + }, + }, + }, + + rules: { + "@typescript-eslint/no-unused-vars": [ + "error", + { + args: "none", + }, + ], + + "no-dupe-class-members": "off", + "@typescript-eslint/no-use-before-define": "off", + "@typescript-eslint/no-non-null-assertion": "off", + "@typescript-eslint/ban-types": "off", + "@typescript-eslint/no-var-requires": "off", + "@typescript-eslint/explicit-module-boundary-types": "off", + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-extra-semi": "off", + "@typescript-eslint/no-require-imports": "off", + "@typescript-eslint/no-unused-vars": "off", // TODO: Fix these. + "@typescript-eslint/no-empty-object-type": "off", + eqeqeq: "error", + + "import/order": [ + "error", + { + alphabetize: { + order: "asc", + }, + + groups: [["builtin", "external", "internal"], "parent", "sibling"], + }, + ], + + "no-async-promise-executor": "off", + }, + }, +] diff --git a/flake.lock b/flake.lock new file mode 100644 index 000000000000..948f73585131 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1739303263, + "narHash": "sha256-c/Z/6gZLN8BIpYh1B3qMzEn0TArjf4F2lmy59lDLVBM=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "6cc4213488e886db863878a1e3dc26cc932d38b8", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable-small", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 000000000000..3a1f7efbc122 --- /dev/null +++ b/flake.nix @@ -0,0 +1,37 @@ +{ + description = "code-server"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable-small"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem + (system: + let pkgs = nixpkgs.legacyPackages.${system}; + nodejs = pkgs.nodejs_22; + in { + devShells.default = pkgs.mkShell { + nativeBuildInputs = with pkgs; [ + imagemagick + nodejs + python3 + pkg-config + git + rsync + jq + moreutils + quilt + bats + openssl + ]; + buildInputs = with pkgs; (lib.optionals (!stdenv.isDarwin) [ libsecret libkrb5 ] + ++ (with xorg; [ libX11 libxkbfile ]) + ++ lib.optionals stdenv.isDarwin (with pkgs.darwin.apple_sdk.frameworks; [ + AppKit Cocoa CoreServices Security xcbuild + ])); + }; + } + ); +} diff --git a/install.sh b/install.sh index 1038adc7d319..81c1ce68edcd 100755 --- a/install.sh +++ b/install.sh @@ -2,7 +2,7 @@ set -eu # code-server's automatic install script. -# See https://github.com/cdr/code-server/blob/master/doc/install.md +# See https://coder.com/docs/code-server/latest/install usage() { arg0="$0" @@ -14,68 +14,107 @@ usage() { fi cath << EOF -Installs code-server for Linux, macOS and FreeBSD. +Installs code-server. It tries to use the system package manager if possible. After successful installation it explains how to start using code-server. + +Pass in user@host to install code-server on user@host over ssh. +The remote host must have internet access. ${not_curl_usage-} Usage: - $arg0 [--dry-run] [--version X.X.X] [--method detect] [--prefix ~/.local] + $arg0 [--dry-run] [--version X.X.X] [--edge] [--method detect] \ + [--prefix ~/.local] [--rsh ssh] [user@host] --dry-run Echo the commands for the install process without running them. + --version X.X.X Install a specific version instead of the latest. + + --edge + Install the latest edge version instead of the latest stable version. + --method [detect | standalone] Choose the installation method. Defaults to detect. - detect detects the system package manager and tries to use it. Full reference on the process is further below. - standalone installs a standalone release archive into ~/.local Add ~/.local/bin to your \$PATH to use it. + --prefix Sets the prefix used by standalone release archives. Defaults to ~/.local The release is unarchived into ~/.local/lib/code-server-X.X.X and the binary symlinked into ~/.local/bin/code-server - To install system wide pass ---prefix=/usr/local + To install system wide pass --prefix=/usr/local -- For Debian, Ubuntu and Raspbian it will install the latest deb package. -- For Fedora, CentOS, RHEL and openSUSE it will install the latest rpm package. -- For Arch Linux it will install the AUR package. -- For any unrecognized Linux operating system it will install the latest standalone - release into ~/.local + --rsh + Specifies the remote shell for remote installation. Defaults to ssh. -- For macOS it will install the Homebrew package. - - If Homebrew is not installed it will install the latest standalone release - into ~/.local +The detection method works as follows: + - Debian, Ubuntu, Raspbian: install the deb package from GitHub. + - Fedora, CentOS, RHEL, openSUSE: install the rpm package from GitHub. + - Arch Linux: install from the AUR (which pulls releases from GitHub). + - FreeBSD, Alpine: install from npm. + - macOS: install using Homebrew if installed otherwise install from GitHub. + - All others: install the release from GitHub. -- For FreeBSD, it will install the npm package with yarn or npm. +We only build releases on GitHub for amd64 and arm64 on Linux and amd64 for +macOS. When the detection method tries to pull a release from GitHub it will +fall back to installing from npm when there is no matching release for the +system's operating system and architecture. -- If ran on an architecture with no releases, it will install the - npm package with yarn or npm. - - We only have releases for amd64 and arm64 presently. - - The npm package builds the native modules on postinstall. +The standalone method will force installion using GitHub releases. It will not +fall back to npm so on architectures without pre-built releases this will error. -It will cache all downloaded assets into ~/.cache/code-server +The installer will cache all downloaded assets into ~/.cache/code-server -More installation docs are at https://github.com/cdr/code-server/blob/master/doc/install.md +More installation docs are at https://coder.com/docs/code-server/latest/install EOF } echo_latest_version() { - # https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c#gistcomment-2758860 - version="$(curl -fsSLI -o /dev/null -w "%{url_effective}" https://github.com/cdr/code-server/releases/latest)" - version="${version#https://github.com/cdr/code-server/releases/tag/}" + if [ "${EDGE-}" ]; then + version="$(curl -fsSL https://api.github.com/repos/coder/code-server/releases | awk 'match($0,/.*"html_url": "(.*\/releases\/tag\/.*)".*/)' | head -n 1 | awk -F '"' '{print $4}')" + else + # https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c#gistcomment-2758860 + version="$(curl -fsSLI -o /dev/null -w "%{url_effective}" https://github.com/coder/code-server/releases/latest)" + fi + version="${version#https://github.com/coder/code-server/releases/tag/}" version="${version#v}" echo "$version" } +echo_npm_postinstall() { + echoh + cath << EOF +npm package has been installed. + +Extend your path to use code-server: + PATH="$NPM_BIN_DIR:\$PATH" +Then run with: + code-server +EOF +} + echo_standalone_postinstall() { echoh cath << EOF Standalone release has been installed into $STANDALONE_INSTALL_PREFIX/lib/code-server-$VERSION -Please extend your path to use code-server: + +Extend your path to use code-server: PATH="$STANDALONE_INSTALL_PREFIX/bin:\$PATH" -Then you can run: +Then run with: + code-server +EOF +} + +echo_brew_postinstall() { + echoh + cath << EOF +Brew release has been installed. + +Run with: code-server EOF } @@ -83,13 +122,20 @@ EOF echo_systemd_postinstall() { echoh cath << EOF +$1 package has been installed. + To have systemd start code-server now and restart on boot: - systemctl --user enable --now code-server + sudo systemctl enable --now code-server@\$USER Or, if you don't want/need a background service you can run: code-server EOF } +echo_coder_postinstall() { + echoh + echoh "Deploy code-server for your team with Coder: https://github.com/coder/coder" +} + main() { if [ "${TRACE-}" ]; then set -x @@ -98,146 +144,187 @@ main() { unset \ DRY_RUN \ METHOD \ - STANDALONE_INSTALL_PREFIX \ - VERSION \ - OPTIONAL + OPTIONAL \ + ALL_FLAGS \ + RSH_ARGS \ + EDGE \ + RSH + ALL_FLAGS="" while [ "$#" -gt 0 ]; do case "$1" in - --dry-run) - DRY_RUN=1 - ;; - --method) - METHOD="$(parse_arg "$@")" - shift - ;; - --method=*) - METHOD="$(parse_arg "$@")" - ;; - --prefix) - STANDALONE_INSTALL_PREFIX="$(parse_arg "$@")" - shift - ;; - --prefix=*) - STANDALONE_INSTALL_PREFIX="$(parse_arg "$@")" - ;; - --version) - VERSION="$(parse_arg "$@")" - shift - ;; - --version=*) - VERSION="$(parse_arg "$@")" - ;; - -h | --h | -help | --help) - usage - exit 0 - ;; - *) - echoerr "Unknown flag $1" - echoerr "Run with --help to see usage." - exit 1 - ;; + -*) + ALL_FLAGS="${ALL_FLAGS} $1" + ;; + esac + + case "$1" in + --dry-run) + DRY_RUN=1 + ;; + --method) + METHOD="$(parse_arg "$@")" + shift + ;; + --method=*) + METHOD="$(parse_arg "$@")" + ;; + --prefix) + STANDALONE_INSTALL_PREFIX="$(parse_arg "$@")" + shift + ;; + --prefix=*) + STANDALONE_INSTALL_PREFIX="$(parse_arg "$@")" + ;; + --version) + VERSION="$(parse_arg "$@")" + shift + ;; + --version=*) + VERSION="$(parse_arg "$@")" + ;; + --edge) + EDGE=1 + ;; + --rsh) + RSH="$(parse_arg "$@")" + shift + ;; + --rsh=*) + RSH="$(parse_arg "$@")" + ;; + -h | --h | -help | --help) + usage + exit 0 + ;; + --) + shift + # We remove the -- added above. + ALL_FLAGS="${ALL_FLAGS% --}" + RSH_ARGS="$*" + break + ;; + -*) + echoerr "Unknown flag $1" + echoerr "Run with --help to see usage." + exit 1 + ;; + *) + RSH_ARGS="$*" + break + ;; esac shift done - VERSION="${VERSION-$(echo_latest_version)}" + if [ "${RSH_ARGS-}" ]; then + RSH="${RSH-ssh}" + echoh "Installing remotely with $RSH $RSH_ARGS" + curl -fsSL https://code-server.dev/install.sh | prefix "$RSH_ARGS" "$RSH" "$RSH_ARGS" sh -s -- "$ALL_FLAGS" + return + fi + METHOD="${METHOD-detect}" if [ "$METHOD" != detect ] && [ "$METHOD" != standalone ]; then echoerr "Unknown install method \"$METHOD\"" echoerr "Run with --help to see usage." exit 1 fi - STANDALONE_INSTALL_PREFIX="${STANDALONE_INSTALL_PREFIX-$HOME/.local}" - OS="$(os)" - if [ ! "$OS" ]; then - echoerr "Unsupported OS $(uname)." - exit 1 - fi + # These are used by the various install_* functions that make use of GitHub + # releases in order to download and unpack the right release. + CACHE_DIR=$(echo_cache_dir) + STANDALONE_INSTALL_PREFIX=${STANDALONE_INSTALL_PREFIX:-$HOME/.local} + VERSION=${VERSION:-$(echo_latest_version)} + # These can be overridden for testing but shouldn't normally be used as it can + # result in a broken code-server. + OS=${OS:-$(os)} + ARCH=${ARCH:-$(arch)} distro_name - ARCH="$(arch)" - if [ ! "$ARCH" ]; then - if [ "$METHOD" = standalone ]; then - echoerr "No precompiled releases for $(uname -m)." - echoerr 'Please rerun without the "--method standalone" flag to install from npm.' - exit 1 - fi - echoh "No precompiled releases for $(uname -m)." - install_npm - return - fi - - if [ "$OS" = "freebsd" ]; then - if [ "$METHOD" = standalone ]; then - echoerr "No precompiled releases available for $OS." - echoerr 'Please rerun without the "--method standalone" flag to install from npm.' + # Standalone installs by pulling pre-built releases from GitHub. + if [ "$METHOD" = standalone ]; then + if has_standalone; then + install_standalone + echo_coder_postinstall + exit 0 + else + echoerr "There are no standalone releases for $ARCH" + echoerr "Please try again without '--method standalone'" exit 1 fi - echoh "No precompiled releases available for $OS." - install_npm - return - fi - - CACHE_DIR="$(echo_cache_dir)" - - if [ "$METHOD" = standalone ]; then - install_standalone - return fi - case "$(distro)" in - macos) - install_macos - ;; - ubuntu | debian | raspbian) - install_deb - ;; - centos | fedora | rhel | opensuse) - install_rpm - ;; - arch) - install_aur - ;; - *) - echoh "Unsupported package manager." - install_standalone - ;; + # DISTRO can be overridden for testing but shouldn't normally be used as it + # can result in a broken code-server. + DISTRO=${DISTRO:-$(distro)} + + case $DISTRO in + # macOS uses brew when available and falls back to standalone. We only have + # amd64 for macOS so for anything else use npm. + macos) + BREW_PATH="${BREW_PATH-brew}" + if command_exists "$BREW_PATH"; then + install_brew + else + echoh "Homebrew not installed." + echoh "Falling back to standalone installation." + npm_fallback install_standalone + fi + ;; + # The .deb and .rpm files are pulled from GitHub and we only have amd64 and + # arm64 there and need to fall back to npm otherwise. + debian) npm_fallback install_deb ;; + fedora | opensuse) npm_fallback install_rpm ;; + # Arch uses the AUR package which only supports amd64 and arm64 since it + # pulls releases from GitHub so we need to fall back to npm. + arch) npm_fallback install_aur ;; + # We don't have GitHub releases that work on Alpine or FreeBSD so we have no + # choice but to use npm here. + alpine | freebsd) install_npm ;; + # For anything else we'll try to install standalone but fall back to npm if + # we don't have releases for the architecture. + *) + echoh "Unsupported package manager." + echoh "Falling back to standalone installation." + npm_fallback install_standalone + ;; esac + + echo_coder_postinstall } parse_arg() { case "$1" in - *=*) - # Remove everything after first equal sign. - opt="${1%%=*}" - # Remove everything before first equal sign. - optarg="${1#*=}" - if [ ! "$optarg" ] && [ ! "${OPTIONAL-}" ]; then - echoerr "$opt requires an argument" - echoerr "Run with --help to see usage." - exit 1 - fi - echo "$optarg" - return - ;; + *=*) + # Remove everything after first equal sign. + opt="${1%%=*}" + # Remove everything before first equal sign. + optarg="${1#*=}" + if [ ! "$optarg" ] && [ ! "${OPTIONAL-}" ]; then + echoerr "$opt requires an argument" + echoerr "Run with --help to see usage." + exit 1 + fi + echo "$optarg" + return + ;; esac case "${2-}" in - "" | -*) - if [ ! "${OPTIONAL-}" ]; then - echoerr "$1 requires an argument" - echoerr "Run with --help to see usage." - exit 1 - fi - ;; - *) - echo "$2" - return - ;; + "" | -*) + if [ ! "${OPTIONAL-}" ]; then + echoerr "$1 requires an argument" + echoerr "Run with --help to see usage." + exit 1 + fi + ;; + *) + echo "$2" + return + ;; esac } @@ -259,45 +346,39 @@ fetch() { sh_c mv "$FILE.incomplete" "$FILE" } -install_macos() { - if command_exists brew; then - echoh "Installing from Homebrew." - echoh - - sh_c brew install code-server - - return - fi +install_brew() { + echoh "Installing latest from Homebrew." + echoh - echoh "Homebrew not installed." + sh_c "$BREW_PATH" install code-server - install_standalone + echo_brew_postinstall } install_deb() { - echoh "Installing v$VERSION deb package from GitHub releases." + echoh "Installing v$VERSION of the $ARCH deb package from GitHub." echoh - fetch "https://github.com/cdr/code-server/releases/download/v$VERSION/code-server_$%7BVERSION%7D_$ARCH.deb" \ + fetch "https://github.com/coder/code-server/releases/download/v$VERSION/code-server_$%7BVERSION%7D_$ARCH.deb" \ "$CACHE_DIR/code-server_${VERSION}_$ARCH.deb" sudo_sh_c dpkg -i "$CACHE_DIR/code-server_${VERSION}_$ARCH.deb" - echo_systemd_postinstall + echo_systemd_postinstall deb } install_rpm() { - echoh "Installing v$VERSION rpm package from GitHub releases." + echoh "Installing v$VERSION of the $ARCH rpm package from GitHub." echoh - fetch "https://github.com/cdr/code-server/releases/download/v$VERSION/code-server-$VERSION-$ARCH.rpm" \ + fetch "https://github.com/coder/code-server/releases/download/v$VERSION/code-server-$VERSION-$ARCH.rpm" \ "$CACHE_DIR/code-server-$VERSION-$ARCH.rpm" - sudo_sh_c rpm -i "$CACHE_DIR/code-server-$VERSION-$ARCH.rpm" + sudo_sh_c rpm -U "$CACHE_DIR/code-server-$VERSION-$ARCH.rpm" - echo_systemd_postinstall + echo_systemd_postinstall rpm } install_aur() { - echoh "Installing from the AUR." + echoh "Installing latest from the AUR." echoh sh_c mkdir -p "$CACHE_DIR/code-server-aur" @@ -306,18 +387,22 @@ install_aur() { if [ ! "${DRY_RUN-}" ]; then cd "$CACHE_DIR/code-server-aur" fi - sh_c makepkg -si + sh_c makepkg -si --noconfirm - echo_systemd_postinstall + echo_systemd_postinstall AUR } install_standalone() { - echoh "Installing standalone release archive v$VERSION from GitHub releases." + echoh "Installing v$VERSION of the $ARCH release from GitHub." echoh - fetch "https://github.com/cdr/code-server/releases/download/v$VERSION/code-server-$VERSION-$OS-$ARCH.tar.gz" \ + fetch "https://github.com/coder/code-server/releases/download/v$VERSION/code-server-$VERSION-$OS-$ARCH.tar.gz" \ "$CACHE_DIR/code-server-$VERSION-$OS-$ARCH.tar.gz" + # -w only works if the directory exists so try creating it first. If this + # fails we can ignore the error as the -w check will then swap us to sudo. + sh_c mkdir -p "$STANDALONE_INSTALL_PREFIX" 2> /dev/null || true + sh_c="sh_c" if [ ! -w "$STANDALONE_INSTALL_PREFIX" ]; then sh_c="sudo_sh_c" @@ -339,55 +424,73 @@ install_standalone() { } install_npm() { - if command_exists yarn; then - sh_c="sh_c" - if [ ! -w "$(yarn global bin)" ]; then - sh_c="sudo_sh_c" - fi - echoh "Installing with yarn." - echoh - "$sh_c" yarn global add code-server --unsafe-perm - return - elif command_exists npm; then + echoh "Installing v$VERSION from npm." + echoh + + NPM_PATH="${YARN_PATH-npm}" + + if command_exists "$NPM_PATH"; then sh_c="sh_c" - if [ ! -w "$(npm config get prefix)" ]; then + if [ ! "${DRY_RUN-}" ] && [ ! -w "$(NPM_PATH config get prefix)" ]; then sh_c="sudo_sh_c" fi echoh "Installing with npm." echoh - "$sh_c" npm install -g code-server --unsafe-perm + "$sh_c" "$NPM_PATH" install -g "code-server@$VERSION" --unsafe-perm + NPM_BIN_DIR="\$($NPM_PATH bin -g)" echo_npm_postinstall return fi - echoh - echoerr "Please install npm or yarn to install code-server!" - echoerr "You will need at least node v12 and a few C dependencies." - echoerr "See the docs https://github.com/cdr/code-server#yarn-npm" + echoerr "Please install npm to install code-server!" + echoerr "You will need at least node v20 and a few C dependencies." + echoerr "See the docs https://coder.com/docs/code-server/latest/install#npm" + exit 1 } +# Run $1 if we have a standalone otherwise run install_npm. +npm_fallback() { + if has_standalone; then + $1 + else + echoh "No standalone releases for $ARCH." + echoh "Falling back to installation from npm." + install_npm + fi +} + +# Determine if we have standalone releases on GitHub for the system's arch. +has_standalone() { + case $ARCH in + arm64) return 0 ;; + # We only have arm64 for macOS. + amd64) + [ "$(distro)" != macos ] + return + ;; + *) return 1 ;; + esac +} + os() { - case "$(uname)" in - Linux) - echo linux - ;; - Darwin) - echo macos - ;; - FreeBSD) - echo freebsd - ;; + uname="$(uname)" + case $uname in + Linux) echo linux ;; + Darwin) echo macos ;; + FreeBSD) echo freebsd ;; + *) echo "$uname" ;; esac } -# distro prints the detected operating system including linux distros. +# Print the detected Linux distro, otherwise print the OS name. # # Example outputs: -# - macos -# - debian, ubuntu, raspbian -# - centos, fedora, rhel, opensuse -# - alpine -# - arch -# - freebsd +# - macos -> macos +# - freebsd -> freebsd +# - ubuntu, raspbian, debian ... -> debian +# - amzn, centos, rhel, fedora, ... -> fedora +# - opensuse-{leap,tumbleweed} -> opensuse +# - alpine -> alpine +# - arch, manjaro, endeavouros, ... -> arch # # Inspired by https://github.com/docker/docker-install/blob/26ff363bcf3b3f5a00498ac43694bf1c7d9ce16c/install.sh#L111-L120. distro() { @@ -399,12 +502,15 @@ distro() { if [ -f /etc/os-release ]; then ( . /etc/os-release - case "$ID" in opensuse-*) - # opensuse's ID's look like opensuse-leap and opensuse-tumbleweed. - echo "opensuse" - return - ;; - esac + if [ "${ID_LIKE-}" ]; then + for id_like in $ID_LIKE; do + case "$id_like" in debian | fedora | opensuse | arch) + echo "$id_like" + return + ;; + esac + done + fi echo "$ID" ) @@ -412,7 +518,7 @@ distro() { fi } -# os_name prints a pretty human readable name for the OS/Distro. +# Print a human-readable name for the OS/distro. distro_name() { if [ "$(uname)" = "Darwin" ]; then echo "macOS v$(sw_vers -productVersion)" @@ -432,21 +538,17 @@ distro_name() { } arch() { - case "$(uname -m)" in - aarch64) - echo arm64 - ;; - x86_64) - echo amd64 - ;; - amd64) # FreeBSD. - echo amd64 - ;; + uname_m=$(uname -m) + case $uname_m in + aarch64) echo arm64 ;; + x86_64) echo amd64 ;; + *) echo "$uname_m" ;; esac } command_exists() { - command -v "$@" > /dev/null 2>&1 + if [ ! "$1" ]; then return 1; fi + command -v "$@" > /dev/null } sh_c() { @@ -459,15 +561,17 @@ sh_c() { sudo_sh_c() { if [ "$(id -u)" = 0 ]; then sh_c "$@" + elif command_exists doas; then + sh_c "doas $*" elif command_exists sudo; then sh_c "sudo $*" elif command_exists su; then - sh_c "su -c '$*'" + sh_c "su root -c '$*'" else echoh echoerr "This script needs to run the following command as root." echoerr " $*" - echoerr "Please install sudo or su." + echoerr "Please install doas, sudo, or su." exit 1 fi } @@ -494,10 +598,21 @@ echoerr() { echoh "$@" >&2 } -# humanpath replaces all occurances of " $HOME" with " ~" -# and all occurances of '"$HOME' with the literal '"$HOME'. +# humanpath replaces all occurrences of " $HOME" with " ~" +# and all occurrences of '"$HOME' with the literal '"$HOME'. humanpath() { sed "s# $HOME# ~#g; s#\"$HOME#\"\$HOME#g" } +# We need to make sure we exit with a non zero exit if the command fails. +# /bin/sh does not support -o pipefail unfortunately. +prefix() { + PREFIX="$1" + shift + fifo="$(mktemp -d)/fifo" + mkfifo "$fifo" + sed -e "s#^#$PREFIX: #" "$fifo" & + "$@" > "$fifo" 2>&1 +} + main "$@" diff --git a/lib/vscode b/lib/vscode index db40434f5629..7d842fb85a02 160000 --- a/lib/vscode +++ b/lib/vscode @@ -1 +1 @@ -Subproject commit db40434f562994116e5b21c24015a2e40b2504e6 +Subproject commit 7d842fb85a0275a4a8e4d7e040d2625abbf7f084 diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 000000000000..8bd50af3431d --- /dev/null +++ b/package-lock.json @@ -0,0 +1,6750 @@ +{ + "name": "code-server", + "version": "0.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "code-server", + "version": "0.0.0", + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "@coder/logger": "^3.0.1", + "argon2": "^0.31.1", + "compression": "^1.7.4", + "cookie-parser": "^1.4.6", + "env-paths": "^2.2.1", + "express": "^5.0.1", + "http-proxy": "^1.18.1", + "httpolyglot": "^0.1.2", + "i18next": "^25.3.0", + "js-yaml": "^4.1.0", + "limiter": "^2.1.0", + "pem": "^1.14.8", + "proxy-agent": "^6.3.1", + "qs": "6.14.0", + "rotating-file-stream": "^3.1.1", + "safe-compare": "^1.1.4", + "semver": "^7.5.4", + "ws": "^8.14.2", + "xdg-basedir": "^4.0.0" + }, + "bin": { + "code-server": "out/node/entry.js" + }, + "devDependencies": { + "@eslint/compat": "^1.2.0", + "@eslint/eslintrc": "^3.1.0", + "@eslint/js": "^9.12.0", + "@schemastore/package": "^0.0.10", + "@types/compression": "^1.7.3", + "@types/cookie-parser": "^1.4.4", + "@types/eslint__js": "^8.42.3", + "@types/express": "^5.0.0", + "@types/http-proxy": "1.17.7", + "@types/js-yaml": "^4.0.6", + "@types/node": "22.x", + "@types/pem": "^1.14.1", + "@types/proxy-from-env": "^1.0.1", + "@types/safe-compare": "^1.1.0", + "@types/semver": "^7.5.2", + "@types/trusted-types": "^2.0.4", + "@types/ws": "^8.5.5", + "doctoc": "^2.2.1", + "eslint": "^9.12.0", + "eslint-config-prettier": "^9.0.0", + "eslint-import-resolver-typescript": "^4.4.4", + "eslint-plugin-import": "^2.28.1", + "eslint-plugin-prettier": "^5.0.0", + "globals": "^16.1.0", + "prettier": "3.6.2", + "prettier-plugin-sh": "^0.14.0", + "ts-node": "^10.9.1", + "typescript": "^5.6.2", + "typescript-eslint": "^8.8.0" + }, + "engines": { + "node": "22" + } + }, + "node_modules/@babel/runtime": { + "version": "7.27.6", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.27.6.tgz", + "integrity": "sha512-vbavdySgbTTrmFE+EsiqUTzlOr5bzlnJtUv9PynGCAKvfQqjIXbvFdumPM/GxMDfyuGMJaJAU6TO4zc1Jf1i8Q==", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@coder/logger": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@coder/logger/-/logger-3.0.1.tgz", + "integrity": "sha512-G/wWSaNZW8HvQZWXlXdbZbp/MOQBPH4W1AKSEI3PBfr0qc9G+pdLrXvm3XakQpNVqmD6WFAbLfcjdG0BuoAO0g==" + }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@emnapi/core": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.4.4.tgz", + "integrity": "sha512-A9CnAbC6ARNMKcIcrQwq6HeHCjpcBZ5wSx4U01WXCqEKlrzB9F9315WDNHkrs2xbx7YjjSxbUYxuN6EQzpcY2g==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/wasi-threads": "1.0.3", + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/runtime": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.4.4.tgz", + "integrity": "sha512-hHyapA4A3gPaDCNfiqyZUStTMqIkKRshqPIuDOXv1hcBnD4U3l8cP0T1HMCfGRxQ6V64TGCcoswChANyOAwbQg==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/wasi-threads": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.0.3.tgz", + "integrity": "sha512-8K5IFFsQqF9wQNJptGbS6FNKgUTsSRYnTqNCG1vPP8jFdjSv18n2mQfJpkt2Oibo9iBEzcDnDxNwKTzC7svlJw==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.9.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.0.tgz", + "integrity": "sha512-ayVFHdtZ+hsq1t2Dy24wCmGXGe4q9Gu3smhLYALJrr473ZH27MsnSL+LKUlimp4BWJqMDMLmPpx/Q9R3OAlL4g==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.1.tgz", + "integrity": "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/compat": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@eslint/compat/-/compat-1.2.0.tgz", + "integrity": "sha512-CkPWddN7J9JPrQedEr2X7AjK9y1jaMJtxZ4A/+jTMFA2+n5BWhcKHW/EbJyARqg2zzQfgtWUtVmG3hrG6+nGpg==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "peerDependencies": { + "eslint": "^9.10.0" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + } + } + }, + "node_modules/@eslint/config-array": { + "version": "0.21.0", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.0.tgz", + "integrity": "sha512-ENIdc4iLu0d93HeYirvKmrzshzofPw6VkZRKQGe9Nv46ZnWUzcF1xV01dcvEg/1wXUR61OmmlSfyeyO7EvjLxQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/object-schema": "^2.1.6", + "debug": "^4.3.1", + "minimatch": "^3.1.2" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/config-helpers": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.3.1.tgz", + "integrity": "sha512-xR93k9WhrDYpXHORXpxVL5oHj3Era7wo6k/Wd8/IsQNnZUTzkGS29lyn3nAT05v6ltUuTFVCCYDEGfy2Or/sPA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/core": { + "version": "0.15.2", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.15.2.tgz", + "integrity": "sha512-78Md3/Rrxh83gCxoUc0EiciuOHsIITzLy53m3d9UyiW8y9Dj2D29FeETqyKA+BRK76tnTp6RXWb3pCay8Oyomg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@types/json-schema": "^7.0.15" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.1.tgz", + "integrity": "sha512-gtF186CXhIl1p4pJNGZw8Yc6RlshoePRvE0X91oPGb3vZ8pM3qOS9W9NGPat9LziaBV7XrJWGylNQXkGcnM3IQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^10.0.1", + "globals": "^14.0.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@eslint/js": { + "version": "9.36.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.36.0.tgz", + "integrity": "sha512-uhCbYtYynH30iZErszX78U+nR3pJU3RHGQ57NXy5QupD4SBVwDeU8TNBy+MjMngc1UyIW9noKqsRqfjQTBU2dw==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://eslint.org/donate" + } + }, + "node_modules/@eslint/object-schema": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.6.tgz", + "integrity": "sha512-RBMg5FRL0I0gs51M/guSAj5/e14VQ4tpZnQNWwuDT66P14I43ItmPfIZRhO9fUVIPOAQXU47atlywZ/czoqFPA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/plugin-kit": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.3.5.tgz", + "integrity": "sha512-Z5kJ+wU3oA7MMIqVR9tyZRtjYPr4OC004Q4Rw7pgOKUOKkJfZ3O24nz3WYfGRpMDNmcOi3TwQOmgm7B7Tpii0w==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^0.15.2", + "levn": "^0.4.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@humanfs/core": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", + "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node": { + "version": "0.16.6", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.6.tgz", + "integrity": "sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanfs/core": "^0.19.1", + "@humanwhocodes/retry": "^0.3.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node/node_modules/@humanwhocodes/retry": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.1.tgz", + "integrity": "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/retry": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.2.tgz", + "integrity": "sha512-xeO57FpIu4p1Ri3Jq/EXq4ClRm86dVF2z/+kvFnyqVYRavTZmaFaUBbWCOuuTh0o/g7DSsk6kc2vrS4Vl5oPOQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", + "dev": true + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, + "node_modules/@mapbox/node-pre-gyp": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.11.tgz", + "integrity": "sha512-Yhlar6v9WQgUp/He7BdgzOz8lqMQ8sU+jkCq7Wx8Myc5YFJLbEe7lgui/V7G1qB1DJykHSGwreceSaD60Y0PUQ==", + "dependencies": { + "detect-libc": "^2.0.0", + "https-proxy-agent": "^5.0.0", + "make-dir": "^3.1.0", + "node-fetch": "^2.6.7", + "nopt": "^5.0.0", + "npmlog": "^5.0.1", + "rimraf": "^3.0.2", + "semver": "^7.3.5", + "tar": "^6.1.11" + }, + "bin": { + "node-pre-gyp": "bin/node-pre-gyp" + } + }, + "node_modules/@napi-rs/wasm-runtime": { + "version": "0.2.12", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-0.2.12.tgz", + "integrity": "sha512-ZVWUcfwY4E/yPitQJl481FjFo3K22D6qF0DuFH6Y/nbnE11GY5uguDxZMGXPQ8WQ0128MXQD7TnfHyK4oWoIJQ==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/core": "^1.4.3", + "@emnapi/runtime": "^1.4.3", + "@tybys/wasm-util": "^0.10.0" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@phc/format": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@phc/format/-/format-1.0.0.tgz", + "integrity": "sha512-m7X9U6BG2+J+R1lSOdCiITLLrxm+cWlNI3HUFA92oLO77ObGNzaKdh8pMLqdZcshtkKuV84olNNXDfMc4FezBQ==", + "engines": { + "node": ">=10" + } + }, + "node_modules/@pkgr/core": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@pkgr/core/-/core-0.1.1.tgz", + "integrity": "sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, + "node_modules/@rtsao/scc": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@rtsao/scc/-/scc-1.1.0.tgz", + "integrity": "sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==", + "dev": true + }, + "node_modules/@schemastore/package": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/@schemastore/package/-/package-0.0.10.tgz", + "integrity": "sha512-D3LxMCnkgsb4LO5sDKf6E+yahM2SqpEHmkqMPDSJis5Cy/j2MgWo/g/iq0lECK0mrPWfx3hqKm2ZJlqxwbRJQA==", + "dev": true + }, + "node_modules/@textlint/ast-node-types": { + "version": "12.6.1", + "resolved": "https://registry.npmjs.org/@textlint/ast-node-types/-/ast-node-types-12.6.1.tgz", + "integrity": "sha512-uzlJ+ZsCAyJm+lBi7j0UeBbj+Oy6w/VWoGJ3iHRHE5eZ8Z4iK66mq+PG/spupmbllLtz77OJbY89BYqgFyjXmA==", + "dev": true + }, + "node_modules/@textlint/markdown-to-ast": { + "version": "12.6.1", + "resolved": "https://registry.npmjs.org/@textlint/markdown-to-ast/-/markdown-to-ast-12.6.1.tgz", + "integrity": "sha512-T0HO+VrU9VbLRiEx/kH4+gwGMHNMIGkp0Pok+p0I33saOOLyhfGvwOKQgvt2qkxzQEV2L5MtGB8EnW4r5d3CqQ==", + "dev": true, + "dependencies": { + "@textlint/ast-node-types": "^12.6.1", + "debug": "^4.3.4", + "mdast-util-gfm-autolink-literal": "^0.1.3", + "remark-footnotes": "^3.0.0", + "remark-frontmatter": "^3.0.0", + "remark-gfm": "^1.0.0", + "remark-parse": "^9.0.0", + "traverse": "^0.6.7", + "unified": "^9.2.2" + } + }, + "node_modules/@tootallnate/quickjs-emscripten": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@tootallnate/quickjs-emscripten/-/quickjs-emscripten-0.23.0.tgz", + "integrity": "sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==", + "license": "MIT" + }, + "node_modules/@tsconfig/node10": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", + "integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==", + "dev": true + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "dev": true + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "dev": true + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", + "dev": true + }, + "node_modules/@tybys/wasm-util": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.0.tgz", + "integrity": "sha512-VyyPYFlOMNylG45GoAe0xDoLwWuowvf92F9kySqzYh8vmYm7D2u4iUJKa1tOUpS70Ku13ASrOkS4ScXFsTaCNQ==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@types/body-parser": { + "version": "1.19.5", + "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.5.tgz", + "integrity": "sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg==", + "dev": true, + "dependencies": { + "@types/connect": "*", + "@types/node": "*" + } + }, + "node_modules/@types/compression": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@types/compression/-/compression-1.8.0.tgz", + "integrity": "sha512-g4vmPIwbTii9dX1HVioHbOolubEaf4re4vDxuzpKrzz9uI7uarBExi9begX0cXyIB85jXZ5X2A/v8rsHZxSAPw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/express": "*", + "@types/node": "*" + } + }, + "node_modules/@types/connect": { + "version": "3.4.38", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz", + "integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/cookie-parser": { + "version": "1.4.7", + "resolved": "https://registry.npmjs.org/@types/cookie-parser/-/cookie-parser-1.4.7.tgz", + "integrity": "sha512-Fvuyi354Z+uayxzIGCwYTayFKocfV7TuDYZClCdIP9ckhvAu/ixDtCB6qx2TT0FKjPLf1f3P/J1rgf6lPs64mw==", + "dev": true, + "dependencies": { + "@types/express": "*" + } + }, + "node_modules/@types/eslint": { + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-9.6.1.tgz", + "integrity": "sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "*", + "@types/json-schema": "*" + } + }, + "node_modules/@types/eslint__js": { + "version": "8.42.3", + "resolved": "https://registry.npmjs.org/@types/eslint__js/-/eslint__js-8.42.3.tgz", + "integrity": "sha512-alfG737uhmPdnvkrLdZLcEKJ/B8s9Y4hrZ+YAdzUeoArBlSUERA2E87ROfOaS4jd/C45fzOoZzidLc1IPwLqOw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/eslint": "*" + } + }, + "node_modules/@types/estree": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", + "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/express": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/@types/express/-/express-5.0.3.tgz", + "integrity": "sha512-wGA0NX93b19/dZC1J18tKWVIYWyyF2ZjT9vin/NRu0qzzvfVzWjs04iq2rQ3H65vCTQYlRqs3YHfY7zjdV+9Kw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "^5.0.0", + "@types/serve-static": "*" + } + }, + "node_modules/@types/express-serve-static-core": { + "version": "5.0.6", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-5.0.6.tgz", + "integrity": "sha512-3xhRnjJPkULekpSzgtoNYYcTWgEZkp4myc+Saevii5JPnHNvHMRlBSHDbs7Bh1iPPoVTERHEZXyhyLbMEsExsA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*", + "@types/send": "*" + } + }, + "node_modules/@types/http-errors": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.4.tgz", + "integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==", + "dev": true + }, + "node_modules/@types/http-proxy": { + "version": "1.17.7", + "resolved": "https://registry.npmjs.org/@types/http-proxy/-/http-proxy-1.17.7.tgz", + "integrity": "sha512-9hdj6iXH64tHSLTY+Vt2eYOGzSogC+JQ2H7bdPWkuh7KXP5qLllWx++t+K9Wk556c3dkDdPws/SpMRi0sdCT1w==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/js-yaml": { + "version": "4.0.9", + "resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.9.tgz", + "integrity": "sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg==", + "dev": true + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", + "dev": true + }, + "node_modules/@types/mdast": { + "version": "3.0.15", + "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-3.0.15.tgz", + "integrity": "sha512-LnwD+mUEfxWMa1QpDraczIn6k0Ee3SMicuYSSzS6ZYl2gKS09EClnJYGd8Du6rfc5r/GZEk5o1mRb8TaTj03sQ==", + "dev": true, + "dependencies": { + "@types/unist": "^2" + } + }, + "node_modules/@types/mime": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz", + "integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==", + "dev": true + }, + "node_modules/@types/node": { + "version": "22.15.31", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.31.tgz", + "integrity": "sha512-jnVe5ULKl6tijxUhvQeNbQG/84fHfg+yMak02cT8QVhBx/F05rAVxCGBYYTh2EKz22D6JF5ktXuNwdx7b9iEGw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/@types/pem": { + "version": "1.14.4", + "resolved": "https://registry.npmjs.org/@types/pem/-/pem-1.14.4.tgz", + "integrity": "sha512-Xt6qY6kX1RD4UmYNhWCCf3OSJrRcwbQIaJ/mQSjjAHxIjXMHx/vHNPOgEU3HdVKS1k/U5CZ6ClQlRo8egkl8xg==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/proxy-from-env": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@types/proxy-from-env/-/proxy-from-env-1.0.4.tgz", + "integrity": "sha512-TPR9/bCZAr3V1eHN4G3LD3OLicdJjqX1QRXWuNcCYgE66f/K8jO2ZRtHxI2D9MbnuUP6+qiKSS8eUHp6TFHGCw==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/qs": { + "version": "6.9.18", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.18.tgz", + "integrity": "sha512-kK7dgTYDyGqS+e2Q4aK9X3D7q234CIZ1Bv0q/7Z5IwRDoADNU81xXJK/YVyLbLTZCoIwUoDoffFeF+p/eIklAA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/range-parser": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.7.tgz", + "integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/safe-compare": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@types/safe-compare/-/safe-compare-1.1.2.tgz", + "integrity": "sha512-kK/IM1+pvwCMom+Kezt/UlP8LMEwm8rP6UgGbRc6zUnhU/csoBQ5rWgmD2CJuHxiMiX+H1VqPGpo0kDluJGXYA==", + "dev": true + }, + "node_modules/@types/semver": { + "version": "7.7.0", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.7.0.tgz", + "integrity": "sha512-k107IF4+Xr7UHjwDc7Cfd6PRQfbdkiRabXGRjo07b4WyPahFBZCZ1sE+BNxYIJPPg73UkfOsVOLwqVc/6ETrIA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/send": { + "version": "0.17.4", + "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.4.tgz", + "integrity": "sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA==", + "dev": true, + "dependencies": { + "@types/mime": "^1", + "@types/node": "*" + } + }, + "node_modules/@types/serve-static": { + "version": "1.15.7", + "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.7.tgz", + "integrity": "sha512-W8Ym+h8nhuRwaKPaDw34QUkwsGi6Rc4yYqvKFo5rm2FUEhCFbzVWrxXUxuKK8TASjWsysJY0nsmNCGhCOIsrOw==", + "dev": true, + "dependencies": { + "@types/http-errors": "*", + "@types/node": "*", + "@types/send": "*" + } + }, + "node_modules/@types/trusted-types": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz", + "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==", + "dev": true + }, + "node_modules/@types/unist": { + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.11.tgz", + "integrity": "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==", + "dev": true + }, + "node_modules/@types/ws": { + "version": "8.5.12", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.12.tgz", + "integrity": "sha512-3tPRkv1EtkDpzlgyKyI8pGsGZAGPEaXeu0DOj5DI25Ja91bdAYddYHbADRYVrZMRbfW+1l5YwXVDKohDJNQxkQ==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "8.33.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.33.0.tgz", + "integrity": "sha512-CACyQuqSHt7ma3Ns601xykeBK/rDeZa3w6IS6UtMQbixO5DWy+8TilKkviGDH6jtWCo8FGRKEK5cLLkPvEammQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/regexpp": "^4.10.0", + "@typescript-eslint/scope-manager": "8.33.0", + "@typescript-eslint/type-utils": "8.33.0", + "@typescript-eslint/utils": "8.33.0", + "@typescript-eslint/visitor-keys": "8.33.0", + "graphemer": "^1.4.0", + "ignore": "^7.0.0", + "natural-compare": "^1.4.0", + "ts-api-utils": "^2.1.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^8.33.0", + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.9.0" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", + "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "8.33.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.33.0.tgz", + "integrity": "sha512-JaehZvf6m0yqYp34+RVnihBAChkqeH+tqqhS0GuX1qgPpwLvmTPheKEs6OeCK6hVJgXZHJ2vbjnC9j119auStQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/scope-manager": "8.33.0", + "@typescript-eslint/types": "8.33.0", + "@typescript-eslint/typescript-estree": "8.33.0", + "@typescript-eslint/visitor-keys": "8.33.0", + "debug": "^4.3.4" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.9.0" + } + }, + "node_modules/@typescript-eslint/project-service": { + "version": "8.33.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.33.0.tgz", + "integrity": "sha512-d1hz0u9l6N+u/gcrk6s6gYdl7/+pp8yHheRTqP6X5hVDKALEaTn8WfGiit7G511yueBEL3OpOEpD+3/MBdoN+A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/tsconfig-utils": "^8.33.0", + "@typescript-eslint/types": "^8.33.0", + "debug": "^4.3.4" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "8.33.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.33.0.tgz", + "integrity": "sha512-LMi/oqrzpqxyO72ltP+dBSP6V0xiUb4saY7WLtxSfiNEBI8m321LLVFU9/QDJxjDQG9/tjSqKz/E3380TEqSTw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.33.0", + "@typescript-eslint/visitor-keys": "8.33.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/tsconfig-utils": { + "version": "8.33.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.33.0.tgz", + "integrity": "sha512-sTkETlbqhEoiFmGr1gsdq5HyVbSOF0145SYDJ/EQmXHtKViCaGvnyLqWFFHtEXoS0J1yU8Wyou2UGmgW88fEug==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <5.9.0" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "8.33.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.33.0.tgz", + "integrity": "sha512-lScnHNCBqL1QayuSrWeqAL5GmqNdVUQAAMTaCwdYEdWfIrSrOGzyLGRCHXcCixa5NK6i5l0AfSO2oBSjCjf4XQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/typescript-estree": "8.33.0", + "@typescript-eslint/utils": "8.33.0", + "debug": "^4.3.4", + "ts-api-utils": "^2.1.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.9.0" + } + }, + "node_modules/@typescript-eslint/types": { + "version": "8.33.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.33.0.tgz", + "integrity": "sha512-DKuXOKpM5IDT1FA2g9x9x1Ug81YuKrzf4mYX8FAVSNu5Wo/LELHWQyM1pQaDkI42bX15PWl0vNPt1uGiIFUOpg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "8.33.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.33.0.tgz", + "integrity": "sha512-vegY4FQoB6jL97Tu/lWRsAiUUp8qJTqzAmENH2k59SJhw0Th1oszb9Idq/FyyONLuNqT1OADJPXfyUNOR8SzAQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/project-service": "8.33.0", + "@typescript-eslint/tsconfig-utils": "8.33.0", + "@typescript-eslint/types": "8.33.0", + "@typescript-eslint/visitor-keys": "8.33.0", + "debug": "^4.3.4", + "fast-glob": "^3.3.2", + "is-glob": "^4.0.3", + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "ts-api-utils": "^2.1.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <5.9.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "8.33.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.33.0.tgz", + "integrity": "sha512-lPFuQaLA9aSNa7D5u2EpRiqdAUhzShwGg/nhpBlc4GR6kcTABttCuyjFs8BcEZ8VWrjCBof/bePhP3Q3fS+Yrw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.7.0", + "@typescript-eslint/scope-manager": "8.33.0", + "@typescript-eslint/types": "8.33.0", + "@typescript-eslint/typescript-estree": "8.33.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.9.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "8.33.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.33.0.tgz", + "integrity": "sha512-7RW7CMYoskiz5OOGAWjJFxgb7c5UNjTG292gYhWeOAcFmYCtVCSqjqSBj5zMhxbXo2JOW95YYrUWJfU0zrpaGQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.33.0", + "eslint-visitor-keys": "^4.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/visitor-keys/node_modules/eslint-visitor-keys": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", + "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@unrs/resolver-binding-android-arm-eabi": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-android-arm-eabi/-/resolver-binding-android-arm-eabi-1.11.1.tgz", + "integrity": "sha512-ppLRUgHVaGRWUx0R0Ut06Mjo9gBaBkg3v/8AxusGLhsIotbBLuRk51rAzqLC8gq6NyyAojEXglNjzf6R948DNw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@unrs/resolver-binding-android-arm64": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-android-arm64/-/resolver-binding-android-arm64-1.11.1.tgz", + "integrity": "sha512-lCxkVtb4wp1v+EoN+HjIG9cIIzPkX5OtM03pQYkG+U5O/wL53LC4QbIeazgiKqluGeVEeBlZahHalCaBvU1a2g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@unrs/resolver-binding-darwin-arm64": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-darwin-arm64/-/resolver-binding-darwin-arm64-1.11.1.tgz", + "integrity": "sha512-gPVA1UjRu1Y/IsB/dQEsp2V1pm44Of6+LWvbLc9SDk1c2KhhDRDBUkQCYVWe6f26uJb3fOK8saWMgtX8IrMk3g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@unrs/resolver-binding-darwin-x64": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-darwin-x64/-/resolver-binding-darwin-x64-1.11.1.tgz", + "integrity": "sha512-cFzP7rWKd3lZaCsDze07QX1SC24lO8mPty9vdP+YVa3MGdVgPmFc59317b2ioXtgCMKGiCLxJ4HQs62oz6GfRQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@unrs/resolver-binding-freebsd-x64": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-freebsd-x64/-/resolver-binding-freebsd-x64-1.11.1.tgz", + "integrity": "sha512-fqtGgak3zX4DCB6PFpsH5+Kmt/8CIi4Bry4rb1ho6Av2QHTREM+47y282Uqiu3ZRF5IQioJQ5qWRV6jduA+iGw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@unrs/resolver-binding-linux-arm-gnueabihf": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-arm-gnueabihf/-/resolver-binding-linux-arm-gnueabihf-1.11.1.tgz", + "integrity": "sha512-u92mvlcYtp9MRKmP+ZvMmtPN34+/3lMHlyMj7wXJDeXxuM0Vgzz0+PPJNsro1m3IZPYChIkn944wW8TYgGKFHw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-arm-musleabihf": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-arm-musleabihf/-/resolver-binding-linux-arm-musleabihf-1.11.1.tgz", + "integrity": "sha512-cINaoY2z7LVCrfHkIcmvj7osTOtm6VVT16b5oQdS4beibX2SYBwgYLmqhBjA1t51CarSaBuX5YNsWLjsqfW5Cw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-arm64-gnu": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-arm64-gnu/-/resolver-binding-linux-arm64-gnu-1.11.1.tgz", + "integrity": "sha512-34gw7PjDGB9JgePJEmhEqBhWvCiiWCuXsL9hYphDF7crW7UgI05gyBAi6MF58uGcMOiOqSJ2ybEeCvHcq0BCmQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-arm64-musl": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-arm64-musl/-/resolver-binding-linux-arm64-musl-1.11.1.tgz", + "integrity": "sha512-RyMIx6Uf53hhOtJDIamSbTskA99sPHS96wxVE/bJtePJJtpdKGXO1wY90oRdXuYOGOTuqjT8ACccMc4K6QmT3w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-ppc64-gnu": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-ppc64-gnu/-/resolver-binding-linux-ppc64-gnu-1.11.1.tgz", + "integrity": "sha512-D8Vae74A4/a+mZH0FbOkFJL9DSK2R6TFPC9M+jCWYia/q2einCubX10pecpDiTmkJVUH+y8K3BZClycD8nCShA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-riscv64-gnu": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-riscv64-gnu/-/resolver-binding-linux-riscv64-gnu-1.11.1.tgz", + "integrity": "sha512-frxL4OrzOWVVsOc96+V3aqTIQl1O2TjgExV4EKgRY09AJ9leZpEg8Ak9phadbuX0BA4k8U5qtvMSQQGGmaJqcQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-riscv64-musl": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-riscv64-musl/-/resolver-binding-linux-riscv64-musl-1.11.1.tgz", + "integrity": "sha512-mJ5vuDaIZ+l/acv01sHoXfpnyrNKOk/3aDoEdLO/Xtn9HuZlDD6jKxHlkN8ZhWyLJsRBxfv9GYM2utQ1SChKew==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-s390x-gnu": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-s390x-gnu/-/resolver-binding-linux-s390x-gnu-1.11.1.tgz", + "integrity": "sha512-kELo8ebBVtb9sA7rMe1Cph4QHreByhaZ2QEADd9NzIQsYNQpt9UkM9iqr2lhGr5afh885d/cB5QeTXSbZHTYPg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-x64-gnu": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-x64-gnu/-/resolver-binding-linux-x64-gnu-1.11.1.tgz", + "integrity": "sha512-C3ZAHugKgovV5YvAMsxhq0gtXuwESUKc5MhEtjBpLoHPLYM+iuwSj3lflFwK3DPm68660rZ7G8BMcwSro7hD5w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-x64-musl": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-x64-musl/-/resolver-binding-linux-x64-musl-1.11.1.tgz", + "integrity": "sha512-rV0YSoyhK2nZ4vEswT/QwqzqQXw5I6CjoaYMOX0TqBlWhojUf8P94mvI7nuJTeaCkkds3QE4+zS8Ko+GdXuZtA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-wasm32-wasi": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-wasm32-wasi/-/resolver-binding-wasm32-wasi-1.11.1.tgz", + "integrity": "sha512-5u4RkfxJm+Ng7IWgkzi3qrFOvLvQYnPBmjmZQ8+szTK/b31fQCnleNl1GgEt7nIsZRIf5PLhPwT0WM+q45x/UQ==", + "cpu": [ + "wasm32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@napi-rs/wasm-runtime": "^0.2.11" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@unrs/resolver-binding-win32-arm64-msvc": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-win32-arm64-msvc/-/resolver-binding-win32-arm64-msvc-1.11.1.tgz", + "integrity": "sha512-nRcz5Il4ln0kMhfL8S3hLkxI85BXs3o8EYoattsJNdsX4YUU89iOkVn7g0VHSRxFuVMdM4Q1jEpIId1Ihim/Uw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@unrs/resolver-binding-win32-ia32-msvc": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-win32-ia32-msvc/-/resolver-binding-win32-ia32-msvc-1.11.1.tgz", + "integrity": "sha512-DCEI6t5i1NmAZp6pFonpD5m7i6aFrpofcp4LA2i8IIq60Jyo28hamKBxNrZcyOwVOZkgsRp9O2sXWBWP8MnvIQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@unrs/resolver-binding-win32-x64-msvc": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-win32-x64-msvc/-/resolver-binding-win32-x64-msvc-1.11.1.tgz", + "integrity": "sha512-lrW200hZdbfRtztbygyaq/6jP6AKE8qQN2KvPcJ+x7wiD038YtnYtZ82IMNJ69GJibV7bwL3y9FgK+5w/pYt6g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" + }, + "node_modules/accepts": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz", + "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==", + "license": "MIT", + "dependencies": { + "mime-types": "^3.0.0", + "negotiator": "^1.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/acorn": { + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", + "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.3.4", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz", + "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==", + "dev": true, + "dependencies": { + "acorn": "^8.11.0" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/anchor-markdown-header": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/anchor-markdown-header/-/anchor-markdown-header-0.6.0.tgz", + "integrity": "sha512-v7HJMtE1X7wTpNFseRhxsY/pivP4uAJbidVhPT+yhz4i/vV1+qx371IXuV9V7bN6KjFtheLJxqaSm0Y/8neJTA==", + "dev": true, + "dependencies": { + "emoji-regex": "~10.1.0" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/aproba": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz", + "integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==" + }, + "node_modules/are-we-there-yet": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-2.0.0.tgz", + "integrity": "sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==", + "deprecated": "This package is no longer supported.", + "dependencies": { + "delegates": "^1.0.0", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, + "node_modules/argon2": { + "version": "0.31.2", + "resolved": "https://registry.npmjs.org/argon2/-/argon2-0.31.2.tgz", + "integrity": "sha512-QSnJ8By5Mth60IEte45w9Y7v6bWcQw3YhRtJKKN8oNCxnTLDiv/AXXkDPf2srTMfxFVn3QJdVv2nhXESsUa+Yg==", + "hasInstallScript": true, + "dependencies": { + "@mapbox/node-pre-gyp": "^1.0.11", + "@phc/format": "^1.0.0", + "node-addon-api": "^7.0.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + }, + "node_modules/array-buffer-byte-length": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.1.tgz", + "integrity": "sha512-ahC5W1xgou+KTXix4sAO8Ki12Q+jf4i0+tmk3sC+zgcynshkHxzpXdImBehiUYKKKDwvfFiJl1tZt6ewscS1Mg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.5", + "is-array-buffer": "^3.0.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array-includes": { + "version": "3.1.8", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.8.tgz", + "integrity": "sha512-itaWrbYbqpGXkGhZPGUulwnhVf5Hpy1xiCFsGqyIGglbBxmG5vSjxQen3/WGOjPpNEv1RtBLKxbmVXm8HpJStQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.4", + "is-string": "^1.0.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.findlastindex": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.5.tgz", + "integrity": "sha512-zfETvRFA8o7EiNn++N5f/kaCw221hrpGsDmcpndVupkPzEc1Wuf3VgC0qby1BbHs7f5DVYjgtEU2LLh5bqeGfQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "es-shim-unscopables": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.flat": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.2.tgz", + "integrity": "sha512-djYB+Zx2vLewY8RWlNCUdHjDXs2XOgm602S9E7P/UpHgfeHL00cRiIF+IN/G/aUJ7kGPb6yO/ErDI5V2s8iycA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "es-shim-unscopables": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.flatmap": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.2.tgz", + "integrity": "sha512-Ewyx0c9PmpcsByhSW4r+9zDU7sGjFc86qf/kKtuSCRdhfbk0SNLLkaT5qvcHnRGgc5NP/ly/y+qkXkqONX54CQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "es-shim-unscopables": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/arraybuffer.prototype.slice": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.3.tgz", + "integrity": "sha512-bMxMKAjg13EBSVscxTaYA4mRc5t1UAXa2kXiGTNfZ079HIWXEkKmkgFrh/nJqamaLSrXO5H4WFFkPEaLJWbs3A==", + "dev": true, + "dependencies": { + "array-buffer-byte-length": "^1.0.1", + "call-bind": "^1.0.5", + "define-properties": "^1.2.1", + "es-abstract": "^1.22.3", + "es-errors": "^1.2.1", + "get-intrinsic": "^1.2.3", + "is-array-buffer": "^3.0.4", + "is-shared-array-buffer": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/ast-types": { + "version": "0.13.4", + "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.13.4.tgz", + "integrity": "sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w==", + "license": "MIT", + "dependencies": { + "tslib": "^2.0.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/available-typed-arrays": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", + "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", + "dev": true, + "dependencies": { + "possible-typed-array-names": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/bail": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/bail/-/bail-1.0.5.tgz", + "integrity": "sha512-xFbRxM1tahm08yHBP16MMjVUAvDaBMD38zsM9EMAUN61omwLmKlOpB/Zku5QkjZ8TZ4vn53pj+t518cH0S03RQ==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "license": "MIT" + }, + "node_modules/basic-ftp": { + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/basic-ftp/-/basic-ftp-5.0.5.tgz", + "integrity": "sha512-4Bcg1P8xhUuqcii/S0Z9wiHIrQVPMermM1any+MX5GeGD7faD3/msQUDGLol9wOcz4/jbg/WJnGqoJF6LiBdtg==", + "license": "MIT", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/body-parser": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.0.tgz", + "integrity": "sha512-02qvAaxv8tp7fBa/mw1ga98OGm+eCbqzJOKoRt70sLmfEEi+jyBYVTDGfCL/k06/4EMk/z01gCe7HoCH/f2LTg==", + "license": "MIT", + "dependencies": { + "bytes": "^3.1.2", + "content-type": "^1.0.5", + "debug": "^4.4.0", + "http-errors": "^2.0.0", + "iconv-lite": "^0.6.3", + "on-finished": "^2.4.1", + "qs": "^6.14.0", + "raw-body": "^3.0.0", + "type-is": "^2.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/buffer-alloc": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", + "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", + "dependencies": { + "buffer-alloc-unsafe": "^1.1.0", + "buffer-fill": "^1.0.0" + } + }, + "node_modules/buffer-alloc-unsafe": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", + "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==" + }, + "node_modules/buffer-fill": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", + "integrity": "sha512-T7zexNBwiiaCOGDg9xNX9PBmjrubblRkENuptryuI64URkXDFum9il/JGL8Lm8wYfAXpredVXXZz7eMHilimiQ==" + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", + "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", + "dev": true, + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/ccount": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/ccount/-/ccount-1.1.0.tgz", + "integrity": "sha512-vlNK021QdI7PNeiUh/lKkC/mNHHfV0m/Ad5JoI0TYtlBnJAslM/JIkm/tGC88bkLIwO6OQ5uV6ztS6kVAtCDlg==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/character-entities": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-1.2.4.tgz", + "integrity": "sha512-iBMyeEHxfVnIakwOuDXpVkc54HijNgCyQB2w0VfGQThle6NXn50zU6V/u+LDhxHcDUPojn6Kpga3PTAD8W1bQw==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-entities-legacy": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-1.1.4.tgz", + "integrity": "sha512-3Xnr+7ZFS1uxeiUDvV02wQ+QDbc55o97tIV5zHScSPJpcLm/r0DFPcoY3tYRp+VZukxuMeKgXYmsXQHO05zQeA==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-reference-invalid": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-1.1.4.tgz", + "integrity": "sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/charenc": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz", + "integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==", + "engines": { + "node": "*" + } + }, + "node_modules/chownr": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", + "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", + "engines": { + "node": ">=10" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/color-support": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", + "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", + "bin": { + "color-support": "bin.js" + } + }, + "node_modules/compressible": { + "version": "2.0.18", + "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz", + "integrity": "sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==", + "dependencies": { + "mime-db": ">= 1.43.0 < 2" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/compression": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/compression/-/compression-1.8.1.tgz", + "integrity": "sha512-9mAqGPHLakhCLeNyxPkK4xVo746zQ/czLH1Ky+vkitMnWfWZps8r0qXuwhwizagCRttsL4lfG4pIOvaWLpAP0w==", + "license": "MIT", + "dependencies": { + "bytes": "3.1.2", + "compressible": "~2.0.18", + "debug": "2.6.9", + "negotiator": "~0.6.4", + "on-headers": "~1.1.0", + "safe-buffer": "5.2.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/compression/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/compression/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + }, + "node_modules/compression/node_modules/negotiator": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.4.tgz", + "integrity": "sha512-myRT3DiWPHqho5PrJaIRyaMv2kgYf0mUVgBNOYMuCH5Ki1yEiQaf/ZJuQ62nvpc44wL5WDbTX7yGJi1Neevw8w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "license": "MIT" + }, + "node_modules/console-control-strings": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", + "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==" + }, + "node_modules/content-disposition": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.0.0.tgz", + "integrity": "sha512-Au9nRL8VNUut/XSzbQA38+M78dzP4D+eqg3gfJHMIHHYa3bg067xj1KxMUWj+VULbiZMowKngFFbKczUrNJ1mg==", + "license": "MIT", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-parser": { + "version": "1.4.7", + "resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.7.tgz", + "integrity": "sha512-nGUvgXnotP3BsjiLX2ypbQnWoGUPIIfHQNZkkC668ntrzGWEZVW70HDEB1qnNGMicPje6EttlIgzo51YSwNQGw==", + "license": "MIT", + "dependencies": { + "cookie": "0.7.2", + "cookie-signature": "1.0.6" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" + }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/crypt": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz", + "integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==", + "engines": { + "node": "*" + } + }, + "node_modules/data-uri-to-buffer": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-6.0.2.tgz", + "integrity": "sha512-7hvf7/GW8e86rW0ptuwS3OcBGDjIi6SZva7hCyWC0yYry2cOPmLIjXAUHI6DK2HsnwJd9ifmt57i8eV2n4YNpw==", + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/data-view-buffer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.1.tgz", + "integrity": "sha512-0lht7OugA5x3iJLOWFhWK/5ehONdprk0ISXqVFn/NFrDu+cuc8iADFrGQz5BnRK7LLU3JmkbXSxaqX+/mXYtUA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.6", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/data-view-byte-length": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/data-view-byte-length/-/data-view-byte-length-1.0.1.tgz", + "integrity": "sha512-4J7wRJD3ABAzr8wP+OcIcqq2dlUKp4DVflx++hs5h5ZKydWMI6/D/fAot+yh6g2tHh8fLFTvNOaVN357NvSrOQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/data-view-byte-offset": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/data-view-byte-offset/-/data-view-byte-offset-1.0.0.tgz", + "integrity": "sha512-t/Ygsytq+R995EJ5PZlD4Cu56sWa8InXySaViRzw9apusqsOO2bQP+SbYzAhR0pFKoB+43lYy8rWban9JSuXnA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.6", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/debug": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz", + "integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dev": true, + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/define-properties": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", + "dev": true, + "dependencies": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/degenerator": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/degenerator/-/degenerator-5.0.1.tgz", + "integrity": "sha512-TllpMR/t0M5sqCXfj85i4XaAzxmS5tVA16dqvdkMwGmzI+dXLXnw3J+3Vdv7VKw+ThlTMboK6i9rnZ6Nntj5CQ==", + "license": "MIT", + "dependencies": { + "ast-types": "^0.13.4", + "escodegen": "^2.1.0", + "esprima": "^4.0.1" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/delegates": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==" + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/detect-libc": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.3.tgz", + "integrity": "sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw==", + "engines": { + "node": ">=8" + } + }, + "node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/doctoc": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/doctoc/-/doctoc-2.2.1.tgz", + "integrity": "sha512-qNJ1gsuo7hH40vlXTVVrADm6pdg30bns/Mo7Nv1SxuXSM1bwF9b4xQ40a6EFT/L1cI+Yylbyi8MPI4G4y7XJzQ==", + "dev": true, + "dependencies": { + "@textlint/markdown-to-ast": "^12.1.1", + "anchor-markdown-header": "^0.6.0", + "htmlparser2": "^7.2.0", + "minimist": "^1.2.6", + "underscore": "^1.13.2", + "update-section": "^0.3.3" + }, + "bin": { + "doctoc": "doctoc.js" + } + }, + "node_modules/dom-serializer": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.4.1.tgz", + "integrity": "sha512-VHwB3KfrcOOkelEG2ZOfxqLZdfkil8PtJi4P8N2MMXucZq2yLp75ClViUlOVwyoHEDjYU433Aq+5zWP61+RGag==", + "dev": true, + "dependencies": { + "domelementtype": "^2.0.1", + "domhandler": "^4.2.0", + "entities": "^2.0.0" + }, + "funding": { + "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" + } + }, + "node_modules/dom-serializer/node_modules/entities": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz", + "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==", + "dev": true, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/domelementtype": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz", + "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ] + }, + "node_modules/domhandler": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.3.1.tgz", + "integrity": "sha512-GrwoxYN+uWlzO8uhUXRl0P+kHE4GtVPfYzVLcUxPL7KNdHKj66vvlhiweIHqYYXWlw+T8iLMp42Lm67ghw4WMQ==", + "dev": true, + "dependencies": { + "domelementtype": "^2.2.0" + }, + "engines": { + "node": ">= 4" + }, + "funding": { + "url": "https://github.com/fb55/domhandler?sponsor=1" + } + }, + "node_modules/domutils": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.8.0.tgz", + "integrity": "sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==", + "dev": true, + "dependencies": { + "dom-serializer": "^1.0.1", + "domelementtype": "^2.2.0", + "domhandler": "^4.2.0" + }, + "funding": { + "url": "https://github.com/fb55/domutils?sponsor=1" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "license": "MIT" + }, + "node_modules/emoji-regex": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.1.0.tgz", + "integrity": "sha512-xAEnNCT3w2Tg6MA7ly6QqYJvEoY1tm9iIjJ3yMKK9JPlWuRHAMoe5iETwQnx3M9TVbFMfsrBgWKR+IsmswwNjg==", + "dev": true + }, + "node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/entities": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/entities/-/entities-3.0.1.tgz", + "integrity": "sha512-WiyBqoomrwMdFG1e0kqvASYfnlb0lp8M5o5Fw2OFq1hNZxxcNk8Ik0Xm7LxzBhuidnZB/UtBqVCgUz3kBOP51Q==", + "dev": true, + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/env-paths": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", + "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==", + "engines": { + "node": ">=6" + } + }, + "node_modules/es-abstract": { + "version": "1.23.3", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.3.tgz", + "integrity": "sha512-e+HfNH61Bj1X9/jLc5v1owaLYuHdeHHSQlkhCBiTK8rBvKaULl/beGMxwrMXjpYrv4pz22BlY570vVePA2ho4A==", + "dev": true, + "dependencies": { + "array-buffer-byte-length": "^1.0.1", + "arraybuffer.prototype.slice": "^1.0.3", + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.7", + "data-view-buffer": "^1.0.1", + "data-view-byte-length": "^1.0.1", + "data-view-byte-offset": "^1.0.0", + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "es-set-tostringtag": "^2.0.3", + "es-to-primitive": "^1.2.1", + "function.prototype.name": "^1.1.6", + "get-intrinsic": "^1.2.4", + "get-symbol-description": "^1.0.2", + "globalthis": "^1.0.3", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2", + "has-proto": "^1.0.3", + "has-symbols": "^1.0.3", + "hasown": "^2.0.2", + "internal-slot": "^1.0.7", + "is-array-buffer": "^3.0.4", + "is-callable": "^1.2.7", + "is-data-view": "^1.0.1", + "is-negative-zero": "^2.0.3", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.3", + "is-string": "^1.0.7", + "is-typed-array": "^1.1.13", + "is-weakref": "^1.0.2", + "object-inspect": "^1.13.1", + "object-keys": "^1.1.1", + "object.assign": "^4.1.5", + "regexp.prototype.flags": "^1.5.2", + "safe-array-concat": "^1.1.2", + "safe-regex-test": "^1.0.3", + "string.prototype.trim": "^1.2.9", + "string.prototype.trimend": "^1.0.8", + "string.prototype.trimstart": "^1.0.8", + "typed-array-buffer": "^1.0.2", + "typed-array-byte-length": "^1.0.1", + "typed-array-byte-offset": "^1.0.2", + "typed-array-length": "^1.0.6", + "unbox-primitive": "^1.0.2", + "which-typed-array": "^1.1.15" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.3.tgz", + "integrity": "sha512-3T8uNMC3OQTHkFUsFq8r/BwAXLHvU/9O9mE0fBc/MY5iq/8H7ncvO947LmYA6ldWw9Uh8Yhf25zu6n7nML5QWQ==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.2.4", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.1" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-shim-unscopables": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.2.tgz", + "integrity": "sha512-J3yBRXCzDu4ULnQwxyToo/OjdMx6akgVC7K6few0a7F/0wLtmKKN7I73AH5T2836UuXRqN7Qg+IIUw/+YJksRw==", + "dev": true, + "dependencies": { + "hasown": "^2.0.0" + } + }, + "node_modules/es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "dev": true, + "dependencies": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es6-promisify": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-7.0.0.tgz", + "integrity": "sha512-ginqzK3J90Rd4/Yz7qRrqUeIpe3TwSXTPPZtPne7tGBPeAaQiU8qt4fpKApnxHcq1AwtUdHVg5P77x/yrggG8Q==", + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "license": "MIT" + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/escodegen": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.1.0.tgz", + "integrity": "sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==", + "license": "BSD-2-Clause", + "dependencies": { + "esprima": "^4.0.1", + "estraverse": "^5.2.0", + "esutils": "^2.0.2" + }, + "bin": { + "escodegen": "bin/escodegen.js", + "esgenerate": "bin/esgenerate.js" + }, + "engines": { + "node": ">=6.0" + }, + "optionalDependencies": { + "source-map": "~0.6.1" + } + }, + "node_modules/eslint": { + "version": "9.36.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.36.0.tgz", + "integrity": "sha512-hB4FIzXovouYzwzECDcUkJ4OcfOEkXTv2zRY6B9bkwjx/cprAq0uvm1nl7zvQ0/TsUk0zQiN4uPfJpB9m+rPMQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.8.0", + "@eslint-community/regexpp": "^4.12.1", + "@eslint/config-array": "^0.21.0", + "@eslint/config-helpers": "^0.3.1", + "@eslint/core": "^0.15.2", + "@eslint/eslintrc": "^3.3.1", + "@eslint/js": "9.36.0", + "@eslint/plugin-kit": "^0.3.5", + "@humanfs/node": "^0.16.6", + "@humanwhocodes/module-importer": "^1.0.1", + "@humanwhocodes/retry": "^0.4.2", + "@types/estree": "^1.0.6", + "@types/json-schema": "^7.0.15", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.6", + "debug": "^4.3.2", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^8.4.0", + "eslint-visitor-keys": "^4.2.1", + "espree": "^10.4.0", + "esquery": "^1.5.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^8.0.0", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } + } + }, + "node_modules/eslint-config-prettier": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz", + "integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==", + "dev": true, + "bin": { + "eslint-config-prettier": "bin/cli.js" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, + "node_modules/eslint-import-context": { + "version": "0.1.9", + "resolved": "https://registry.npmjs.org/eslint-import-context/-/eslint-import-context-0.1.9.tgz", + "integrity": "sha512-K9Hb+yRaGAGUbwjhFNHvSmmkZs9+zbuoe3kFQ4V1wYjrepUFYM2dZAfNtjbbj3qsPfUfsA68Bx/ICWQMi+C8Eg==", + "dev": true, + "license": "MIT", + "dependencies": { + "get-tsconfig": "^4.10.1", + "stable-hash-x": "^0.2.0" + }, + "engines": { + "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint-import-context" + }, + "peerDependencies": { + "unrs-resolver": "^1.0.0" + }, + "peerDependenciesMeta": { + "unrs-resolver": { + "optional": true + } + } + }, + "node_modules/eslint-import-resolver-node": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", + "integrity": "sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==", + "dev": true, + "dependencies": { + "debug": "^3.2.7", + "is-core-module": "^2.13.0", + "resolve": "^1.22.4" + } + }, + "node_modules/eslint-import-resolver-node/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-import-resolver-typescript": { + "version": "4.4.4", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-4.4.4.tgz", + "integrity": "sha512-1iM2zeBvrYmUNTj2vSC/90JTHDth+dfOfiNKkxApWRsTJYNrc8rOdxxIf5vazX+BiAXTeOT0UvWpGI/7qIWQOw==", + "dev": true, + "license": "ISC", + "dependencies": { + "debug": "^4.4.1", + "eslint-import-context": "^0.1.8", + "get-tsconfig": "^4.10.1", + "is-bun-module": "^2.0.0", + "stable-hash-x": "^0.2.0", + "tinyglobby": "^0.2.14", + "unrs-resolver": "^1.7.11" + }, + "engines": { + "node": "^16.17.0 || >=18.6.0" + }, + "funding": { + "url": "https://opencollective.com/eslint-import-resolver-typescript" + }, + "peerDependencies": { + "eslint": "*", + "eslint-plugin-import": "*", + "eslint-plugin-import-x": "*" + }, + "peerDependenciesMeta": { + "eslint-plugin-import": { + "optional": true + }, + "eslint-plugin-import-x": { + "optional": true + } + } + }, + "node_modules/eslint-module-utils": { + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.12.0.tgz", + "integrity": "sha512-wALZ0HFoytlyh/1+4wuZ9FJCD/leWHQzzrxJ8+rebyReSLk7LApMyd3WJaLVoN+D5+WIdJyDK1c6JnE65V4Zyg==", + "dev": true, + "dependencies": { + "debug": "^3.2.7" + }, + "engines": { + "node": ">=4" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + } + } + }, + "node_modules/eslint-module-utils/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-plugin-import": { + "version": "2.31.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.31.0.tgz", + "integrity": "sha512-ixmkI62Rbc2/w8Vfxyh1jQRTdRTF52VxwRVHl/ykPAmqG+Nb7/kNn+byLP0LxPgI7zWA16Jt82SybJInmMia3A==", + "dev": true, + "dependencies": { + "@rtsao/scc": "^1.1.0", + "array-includes": "^3.1.8", + "array.prototype.findlastindex": "^1.2.5", + "array.prototype.flat": "^1.3.2", + "array.prototype.flatmap": "^1.3.2", + "debug": "^3.2.7", + "doctrine": "^2.1.0", + "eslint-import-resolver-node": "^0.3.9", + "eslint-module-utils": "^2.12.0", + "hasown": "^2.0.2", + "is-core-module": "^2.15.1", + "is-glob": "^4.0.3", + "minimatch": "^3.1.2", + "object.fromentries": "^2.0.8", + "object.groupby": "^1.0.3", + "object.values": "^1.2.0", + "semver": "^6.3.1", + "string.prototype.trimend": "^1.0.8", + "tsconfig-paths": "^3.15.0" + }, + "engines": { + "node": ">=4" + }, + "peerDependencies": { + "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 || ^9" + } + }, + "node_modules/eslint-plugin-import/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-plugin-import/node_modules/doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/eslint-plugin-import/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/eslint-plugin-prettier": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.2.1.tgz", + "integrity": "sha512-gH3iR3g4JfF+yYPaJYkN7jEl9QbweL/YfkoRlNnuIEHEz1vHVlCmWOS+eGGiRuzHQXdJFCOTxRgvju9b8VUmrw==", + "dev": true, + "dependencies": { + "prettier-linter-helpers": "^1.0.0", + "synckit": "^0.9.1" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint-plugin-prettier" + }, + "peerDependencies": { + "@types/eslint": ">=8.0.0", + "eslint": ">=8.0.0", + "eslint-config-prettier": "*", + "prettier": ">=3.0.0" + }, + "peerDependenciesMeta": { + "@types/eslint": { + "optional": true + }, + "eslint-config-prettier": { + "optional": true + } + } + }, + "node_modules/eslint-scope": { + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz", + "integrity": "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/eslint-visitor-keys": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz", + "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/espree": { + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz", + "integrity": "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^8.15.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^4.2.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/espree/node_modules/eslint-visitor-keys": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz", + "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "license": "BSD-2-Clause", + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/esquery": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", + "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", + "dev": true, + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/eventemitter3": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==" + }, + "node_modules/express": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/express/-/express-5.1.0.tgz", + "integrity": "sha512-DT9ck5YIRU+8GYzzU5kT3eHGA5iL+1Zd0EutOmTE9Dtk+Tvuzd23VBU+ec7HPNSTxXYO55gPV/hq4pSBJDjFpA==", + "license": "MIT", + "dependencies": { + "accepts": "^2.0.0", + "body-parser": "^2.2.0", + "content-disposition": "^1.0.0", + "content-type": "^1.0.5", + "cookie": "^0.7.1", + "cookie-signature": "^1.2.1", + "debug": "^4.4.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "finalhandler": "^2.1.0", + "fresh": "^2.0.0", + "http-errors": "^2.0.0", + "merge-descriptors": "^2.0.0", + "mime-types": "^3.0.0", + "on-finished": "^2.4.1", + "once": "^1.4.0", + "parseurl": "^1.3.3", + "proxy-addr": "^2.0.7", + "qs": "^6.14.0", + "range-parser": "^1.2.1", + "router": "^2.2.0", + "send": "^1.1.0", + "serve-static": "^2.2.0", + "statuses": "^2.0.1", + "type-is": "^2.0.1", + "vary": "^1.1.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/express/node_modules/cookie-signature": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz", + "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==", + "license": "MIT", + "engines": { + "node": ">=6.6.0" + } + }, + "node_modules/extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-diff": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz", + "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==", + "dev": true + }, + "node_modules/fast-glob": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", + "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.8" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-glob/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true + }, + "node_modules/fastq": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.1.tgz", + "integrity": "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/fault": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/fault/-/fault-1.0.4.tgz", + "integrity": "sha512-CJ0HCB5tL5fYTEA7ToAq5+kTwd++Borf1/bifxd9iT70QcXr4MRrO3Llf8Ifs70q+SJcGHFtnIE/Nw6giCtECA==", + "dev": true, + "dependencies": { + "format": "^0.2.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/file-entry-cache": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "flat-cache": "^4.0.0" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/finalhandler": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.0.tgz", + "integrity": "sha512-/t88Ty3d5JWQbWYgaOGCCYfXRwV1+be02WqYYlL6h0lEiUAMPM8o8qKGO01YIkOHzka2up08wvgYD0mDiI+q3Q==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "on-finished": "^2.4.1", + "parseurl": "^1.3.3", + "statuses": "^2.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat-cache": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", + "dev": true, + "license": "MIT", + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.4" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/flatted": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.1.tgz", + "integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==", + "dev": true, + "license": "ISC" + }, + "node_modules/follow-redirects": { + "version": "1.15.9", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz", + "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "dev": true, + "dependencies": { + "is-callable": "^1.1.3" + } + }, + "node_modules/format": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/format/-/format-0.2.2.tgz", + "integrity": "sha512-wzsgA6WOq+09wrU1tsJ09udeR/YZRaeArL9e1wPbFg3GG2yDnC2ldKpxs4xunpFF9DgqCqOIra3bc1HWrJ37Ww==", + "dev": true, + "engines": { + "node": ">=0.4.x" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz", + "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/fs-minipass": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/fs-minipass/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/function.prototype.name": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.6.tgz", + "integrity": "sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "functions-have-names": "^1.2.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gauge": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-3.0.2.tgz", + "integrity": "sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==", + "deprecated": "This package is no longer supported.", + "dependencies": { + "aproba": "^1.0.3 || ^2.0.0", + "color-support": "^1.1.2", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.1", + "object-assign": "^4.1.1", + "signal-exit": "^3.0.0", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1", + "wide-align": "^1.1.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/get-symbol-description": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.2.tgz", + "integrity": "sha512-g0QYk1dZBxGwk+Ngc+ltRH2IBp2f7zBkBMBJZCDerh6EhlhSR6+9irMCuT/09zD6qkarHUSn529sK/yL4S27mg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.5", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-tsconfig": { + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.10.1.tgz", + "integrity": "sha512-auHyJ4AgMz7vgS8Hp3N6HXSmlMdUyhSUrfBF16w153rxtLIEOE+HGqaBppczZvnHLqQJfiHotCYpNhl0lUROFQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, + "node_modules/get-uri": { + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/get-uri/-/get-uri-6.0.4.tgz", + "integrity": "sha512-E1b1lFFLvLgak2whF2xDBcOy6NLVGZBqqjJjsIhvopKfWWEi64pLVTWWehV8KlLerZkfNTA95sTe2OdJKm1OzQ==", + "license": "MIT", + "dependencies": { + "basic-ftp": "^5.0.2", + "data-uri-to-buffer": "^6.0.2", + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/globals": { + "version": "16.4.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-16.4.0.tgz", + "integrity": "sha512-ob/2LcVVaVGCYN+r14cnwnoDPUufjiYgSqRhiFD0Q1iI4Odora5RE8Iv1D24hAz5oMophRGkGz+yuvQmmUMnMw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/globalthis": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz", + "integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==", + "dev": true, + "dependencies": { + "define-properties": "^1.2.1", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true, + "license": "MIT" + }, + "node_modules/has-bigints": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", + "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "dev": true, + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", + "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "dev": true, + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-unicode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==" + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/htmlparser2": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-7.2.0.tgz", + "integrity": "sha512-H7MImA4MS6cw7nbyURtLPO1Tms7C5H602LRETv95z1MxO/7CP7rDVROehUYeYBUYEON94NXXDEPmZuq+hX4sog==", + "dev": true, + "funding": [ + "https://github.com/fb55/htmlparser2?sponsor=1", + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ], + "dependencies": { + "domelementtype": "^2.0.1", + "domhandler": "^4.2.2", + "domutils": "^2.8.0", + "entities": "^3.0.1" + } + }, + "node_modules/http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "license": "MIT", + "dependencies": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/http-proxy": { + "version": "1.18.1", + "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz", + "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==", + "dependencies": { + "eventemitter3": "^4.0.0", + "follow-redirects": "^1.0.0", + "requires-port": "^1.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/http-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", + "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.0", + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/http-proxy-agent/node_modules/agent-base": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.3.tgz", + "integrity": "sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw==", + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/httpolyglot": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/httpolyglot/-/httpolyglot-0.1.2.tgz", + "integrity": "sha512-ouHI1AaQMLgn4L224527S5+vq6hgvqPteurVfbm7ChViM3He2Wa8KP1Ny7pTYd7QKnDSPKcN8JYfC8r/lmsE3A==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/i18next": { + "version": "25.3.0", + "resolved": "https://registry.npmjs.org/i18next/-/i18next-25.3.0.tgz", + "integrity": "sha512-ZSQIiNGfqSG6yoLHaCvrkPp16UejHI8PCDxFYaNG/1qxtmqNmqEg4JlWKlxkrUmrin2sEjsy+Mjy1TRozBhOgw==", + "funding": [ + { + "type": "individual", + "url": "https://locize.com/" + }, + { + "type": "individual", + "url": "https://locize.com/i18next.html" + }, + { + "type": "individual", + "url": "https://www.i18next.com/how-to/faq#i18next-is-awesome.-how-can-i-support-the-project" + } + ], + "dependencies": { + "@babel/runtime": "^7.27.6" + }, + "peerDependencies": { + "typescript": "^5" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/internal-slot": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.7.tgz", + "integrity": "sha512-NGnrKwXzSms2qUUih/ILZ5JBqNTSa1+ZmP6flaIp6KmSElgE9qdndzS3cqjrDovwFdmwsGsLdeFgB6suw+1e9g==", + "dev": true, + "dependencies": { + "es-errors": "^1.3.0", + "hasown": "^2.0.0", + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ip-address": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-9.0.5.tgz", + "integrity": "sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g==", + "license": "MIT", + "dependencies": { + "jsbn": "1.1.0", + "sprintf-js": "^1.1.3" + }, + "engines": { + "node": ">= 12" + } + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-alphabetical": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-1.0.4.tgz", + "integrity": "sha512-DwzsA04LQ10FHTZuL0/grVDk4rFoVH1pjAToYwBrHSxcrBIGQuXrQMtD5U1b0U2XVgKZCTLLP8u2Qxqhy3l2Vg==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-alphanumerical": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-1.0.4.tgz", + "integrity": "sha512-UzoZUr+XfVz3t3v4KyGEniVL9BDRoQtY7tOyrRybkVNjDFWyo1yhXNGrrBTQxp3ib9BLAWs7k2YKBQsFRkZG9A==", + "dev": true, + "dependencies": { + "is-alphabetical": "^1.0.0", + "is-decimal": "^1.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-array-buffer": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.4.tgz", + "integrity": "sha512-wcjaerHw0ydZwfhiKbXJWLDY8A7yV7KhjQOpb83hGgGfId/aQa4TOvwyzn2PuswW2gPCYEL/nEAiSVpdOj1lXw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-bigint": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", + "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "dev": true, + "dependencies": { + "has-bigints": "^1.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-boolean-object": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", + "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" + }, + "node_modules/is-bun-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-bun-module/-/is-bun-module-2.0.0.tgz", + "integrity": "sha512-gNCGbnnnnFAUGKeZ9PdbyeGYJqewpmc2aKHUEMO5nQPWU9lOmv7jcmQIv+qHD8fXW6W7qfuCwX4rY9LNRjXrkQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.7.1" + } + }, + "node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-core-module": { + "version": "2.15.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.15.1.tgz", + "integrity": "sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ==", + "dev": true, + "dependencies": { + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-data-view": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.1.tgz", + "integrity": "sha512-AHkaJrsUVW6wq6JS8y3JnM/GJF/9cf+k20+iDzlSaJrinEo5+7vRiteOSwBhHRiAyQATN1AmY4hwzxJKPmYf+w==", + "dev": true, + "dependencies": { + "is-typed-array": "^1.1.13" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-date-object": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", + "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-decimal": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-1.0.4.tgz", + "integrity": "sha512-RGdriMmQQvZ2aqaQq3awNA6dCGtKpiDFcOzrTWrDAT2MiWrKQVPmxLGHl7Y2nNu6led0kEyoX0enY0qXYsv9zw==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-hexadecimal": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-1.0.4.tgz", + "integrity": "sha512-gyPJuv83bHMpocVYoqof5VDiZveEoGoFL8m3BXNb2VW8Xs+rz9kqO8LOQ5DH6EsuvilT1ApazU0pyl+ytbPtlw==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-negative-zero": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.3.tgz", + "integrity": "sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-number-object": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", + "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-promise": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz", + "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==", + "license": "MIT" + }, + "node_modules/is-regex": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", + "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-shared-array-buffer": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.3.tgz", + "integrity": "sha512-nA2hv5XIhLR3uVzDDfCIknerhx8XUKnstuOERPNNIinXG7v9u+ohXF67vxm4TPTEPU6lm61ZkwP3c9PCB97rhg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-string": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", + "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-symbol": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", + "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", + "dev": true, + "dependencies": { + "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-typed-array": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.13.tgz", + "integrity": "sha512-uZ25/bUAlUY5fR4OKT4rZQEBrzQWYV9ZJYGGsUmEJ6thodVJ1HX64ePQ6Z0qPWP+m+Uq6e9UugrE38jeYsDSMw==", + "dev": true, + "dependencies": { + "which-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakref": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", + "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/jsbn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz", + "integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==", + "license": "MIT" + }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true + }, + "node_modules/json5": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", + "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", + "dev": true, + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" + } + }, + "node_modules/just-performance": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/just-performance/-/just-performance-4.3.0.tgz", + "integrity": "sha512-L7RjvtJsL0QO8xFs5wEoDDzzJwoiowRw6Rn/GnvldlchS2JQr9wFYPiwZcDfrbbujEKqKN0tvENdbjXdYhDp5Q==" + }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/limiter": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/limiter/-/limiter-2.1.0.tgz", + "integrity": "sha512-361TYz6iay6n+9KvUUImqdLuFigK+K79qrUtBsXhJTLdH4rIt/r1y8r1iozwh8KbZNpujbFTSh74mJ7bwbAMOw==", + "dependencies": { + "just-performance": "4.3.0" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, + "node_modules/longest-streak": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-2.0.4.tgz", + "integrity": "sha512-vM6rUVCVUJJt33bnmHiZEvr7wPT78ztX7rojL+LW51bHtLh6HTjx84LA5W4+oa6aKEJA7jJu5LR6vQRBpA5DVg==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/lru-cache": { + "version": "7.18.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", + "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", + "engines": { + "node": ">=12" + } + }, + "node_modules/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/make-dir/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, + "node_modules/markdown-table": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-2.0.0.tgz", + "integrity": "sha512-Ezda85ToJUBhM6WGaG6veasyym+Tbs3cMAw/ZhOPqXiYsr0jgocBV3j3nx+4lk47plLlIqjwuTm/ywVI+zjJ/A==", + "dev": true, + "dependencies": { + "repeat-string": "^1.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/md5": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz", + "integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==", + "dependencies": { + "charenc": "0.0.2", + "crypt": "0.0.2", + "is-buffer": "~1.1.6" + } + }, + "node_modules/mdast-util-find-and-replace": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/mdast-util-find-and-replace/-/mdast-util-find-and-replace-1.1.1.tgz", + "integrity": "sha512-9cKl33Y21lyckGzpSmEQnIDjEfeeWelN5s1kUW1LwdB0Fkuq2u+4GdqcGEygYxJE8GVqCl0741bYXHgamfWAZA==", + "dev": true, + "dependencies": { + "escape-string-regexp": "^4.0.0", + "unist-util-is": "^4.0.0", + "unist-util-visit-parents": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-footnote": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/mdast-util-footnote/-/mdast-util-footnote-0.1.7.tgz", + "integrity": "sha512-QxNdO8qSxqbO2e3m09KwDKfWiLgqyCurdWTQ198NpbZ2hxntdc+VKS4fDJCmNWbAroUdYnSthu+XbZ8ovh8C3w==", + "dev": true, + "dependencies": { + "mdast-util-to-markdown": "^0.6.0", + "micromark": "~2.11.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-from-markdown": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-0.8.5.tgz", + "integrity": "sha512-2hkTXtYYnr+NubD/g6KGBS/0mFmBcifAsI0yIWRiRo0PjVs6SSOSOdtzbp6kSGnShDN6G5aWZpKQ2lWRy27mWQ==", + "dev": true, + "dependencies": { + "@types/mdast": "^3.0.0", + "mdast-util-to-string": "^2.0.0", + "micromark": "~2.11.0", + "parse-entities": "^2.0.0", + "unist-util-stringify-position": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-frontmatter": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/mdast-util-frontmatter/-/mdast-util-frontmatter-0.2.0.tgz", + "integrity": "sha512-FHKL4w4S5fdt1KjJCwB0178WJ0evnyyQr5kXTM3wrOVpytD0hrkvd+AOOjU9Td8onOejCkmZ+HQRT3CZ3coHHQ==", + "dev": true, + "dependencies": { + "micromark-extension-frontmatter": "^0.2.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/mdast-util-gfm/-/mdast-util-gfm-0.1.2.tgz", + "integrity": "sha512-NNkhDx/qYcuOWB7xHUGWZYVXvjPFFd6afg6/e2g+SV4r9q5XUcCbV4Wfa3DLYIiD+xAEZc6K4MGaE/m0KDcPwQ==", + "dev": true, + "dependencies": { + "mdast-util-gfm-autolink-literal": "^0.1.0", + "mdast-util-gfm-strikethrough": "^0.2.0", + "mdast-util-gfm-table": "^0.1.0", + "mdast-util-gfm-task-list-item": "^0.1.0", + "mdast-util-to-markdown": "^0.6.1" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-autolink-literal": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-autolink-literal/-/mdast-util-gfm-autolink-literal-0.1.3.tgz", + "integrity": "sha512-GjmLjWrXg1wqMIO9+ZsRik/s7PLwTaeCHVB7vRxUwLntZc8mzmTsLVr6HW1yLokcnhfURsn5zmSVdi3/xWWu1A==", + "dev": true, + "dependencies": { + "ccount": "^1.0.0", + "mdast-util-find-and-replace": "^1.1.0", + "micromark": "^2.11.3" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-strikethrough": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-strikethrough/-/mdast-util-gfm-strikethrough-0.2.3.tgz", + "integrity": "sha512-5OQLXpt6qdbttcDG/UxYY7Yjj3e8P7X16LzvpX8pIQPYJ/C2Z1qFGMmcw+1PZMUM3Z8wt8NRfYTvCni93mgsgA==", + "dev": true, + "dependencies": { + "mdast-util-to-markdown": "^0.6.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-table": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-table/-/mdast-util-gfm-table-0.1.6.tgz", + "integrity": "sha512-j4yDxQ66AJSBwGkbpFEp9uG/LS1tZV3P33fN1gkyRB2LoRL+RR3f76m0HPHaby6F4Z5xr9Fv1URmATlRRUIpRQ==", + "dev": true, + "dependencies": { + "markdown-table": "^2.0.0", + "mdast-util-to-markdown": "~0.6.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-task-list-item": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-task-list-item/-/mdast-util-gfm-task-list-item-0.1.6.tgz", + "integrity": "sha512-/d51FFIfPsSmCIRNp7E6pozM9z1GYPIkSy1urQ8s/o4TC22BZ7DqfHFWiqBD23bc7J3vV1Fc9O4QIHBlfuit8A==", + "dev": true, + "dependencies": { + "mdast-util-to-markdown": "~0.6.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-markdown": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-0.6.5.tgz", + "integrity": "sha512-XeV9sDE7ZlOQvs45C9UKMtfTcctcaj/pGwH8YLbMHoMOXNNCn2LsqVQOqrF1+/NU8lKDAqozme9SCXWyo9oAcQ==", + "dev": true, + "dependencies": { + "@types/unist": "^2.0.0", + "longest-streak": "^2.0.0", + "mdast-util-to-string": "^2.0.0", + "parse-entities": "^2.0.0", + "repeat-string": "^1.0.0", + "zwitch": "^1.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-2.0.0.tgz", + "integrity": "sha512-AW4DRS3QbBayY/jJmD8437V1Gombjf8RSOUCMFBuo5iHi58AGEgVCKQ+ezHkZZDpAQS75hcBMpLqjpJTjtUL7w==", + "dev": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/media-typer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz", + "integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/merge-descriptors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz", + "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromark": { + "version": "2.11.4", + "resolved": "https://registry.npmjs.org/micromark/-/micromark-2.11.4.tgz", + "integrity": "sha512-+WoovN/ppKolQOFIAajxi7Lu9kInbPxFuTBVEavFcL8eAfVstoc5MocPmqBeAdBOJV00uaVjegzH4+MA0DN/uA==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "dependencies": { + "debug": "^4.0.0", + "parse-entities": "^2.0.0" + } + }, + "node_modules/micromark-extension-footnote": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/micromark-extension-footnote/-/micromark-extension-footnote-0.3.2.tgz", + "integrity": "sha512-gr/BeIxbIWQoUm02cIfK7mdMZ/fbroRpLsck4kvFtjbzP4yi+OPVbnukTc/zy0i7spC2xYE/dbX1Sur8BEDJsQ==", + "dev": true, + "dependencies": { + "micromark": "~2.11.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-frontmatter": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/micromark-extension-frontmatter/-/micromark-extension-frontmatter-0.2.2.tgz", + "integrity": "sha512-q6nPLFCMTLtfsctAuS0Xh4vaolxSFUWUWR6PZSrXXiRy+SANGllpcqdXFv2z07l0Xz/6Hl40hK0ffNCJPH2n1A==", + "dev": true, + "dependencies": { + "fault": "^1.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm/-/micromark-extension-gfm-0.3.3.tgz", + "integrity": "sha512-oVN4zv5/tAIA+l3GbMi7lWeYpJ14oQyJ3uEim20ktYFAcfX1x3LNlFGGlmrZHt7u9YlKExmyJdDGaTt6cMSR/A==", + "dev": true, + "dependencies": { + "micromark": "~2.11.0", + "micromark-extension-gfm-autolink-literal": "~0.5.0", + "micromark-extension-gfm-strikethrough": "~0.6.5", + "micromark-extension-gfm-table": "~0.4.0", + "micromark-extension-gfm-tagfilter": "~0.3.0", + "micromark-extension-gfm-task-list-item": "~0.3.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-autolink-literal": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-autolink-literal/-/micromark-extension-gfm-autolink-literal-0.5.7.tgz", + "integrity": "sha512-ePiDGH0/lhcngCe8FtH4ARFoxKTUelMp4L7Gg2pujYD5CSMb9PbblnyL+AAMud/SNMyusbS2XDSiPIRcQoNFAw==", + "dev": true, + "dependencies": { + "micromark": "~2.11.3" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-strikethrough": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-strikethrough/-/micromark-extension-gfm-strikethrough-0.6.5.tgz", + "integrity": "sha512-PpOKlgokpQRwUesRwWEp+fHjGGkZEejj83k9gU5iXCbDG+XBA92BqnRKYJdfqfkrRcZRgGuPuXb7DaK/DmxOhw==", + "dev": true, + "dependencies": { + "micromark": "~2.11.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-table": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-table/-/micromark-extension-gfm-table-0.4.3.tgz", + "integrity": "sha512-hVGvESPq0fk6ALWtomcwmgLvH8ZSVpcPjzi0AjPclB9FsVRgMtGZkUcpE0zgjOCFAznKepF4z3hX8z6e3HODdA==", + "dev": true, + "dependencies": { + "micromark": "~2.11.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-tagfilter": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-tagfilter/-/micromark-extension-gfm-tagfilter-0.3.0.tgz", + "integrity": "sha512-9GU0xBatryXifL//FJH+tAZ6i240xQuFrSL7mYi8f4oZSbc+NvXjkrHemeYP0+L4ZUT+Ptz3b95zhUZnMtoi/Q==", + "dev": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-task-list-item": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-task-list-item/-/micromark-extension-gfm-task-list-item-0.3.3.tgz", + "integrity": "sha512-0zvM5iSLKrc/NQl84pZSjGo66aTGd57C1idmlWmE87lkMcXrTxg1uXa/nXomxJytoje9trP0NDLvw4bZ/Z/XCQ==", + "dev": true, + "dependencies": { + "micromark": "~2.11.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dev": true, + "license": "MIT", + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/mime-db": { + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.1.tgz", + "integrity": "sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA==", + "license": "MIT", + "dependencies": { + "mime-db": "^1.54.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/minipass": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/minizlib": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", + "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", + "dependencies": { + "minipass": "^3.0.0", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/minizlib/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/mvdan-sh": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/mvdan-sh/-/mvdan-sh-0.10.1.tgz", + "integrity": "sha512-kMbrH0EObaKmK3nVRKUIIya1dpASHIEusM13S4V1ViHFuxuNxCo+arxoa6j/dbV22YBGjl7UKJm9QQKJ2Crzhg==", + "dev": true + }, + "node_modules/napi-postinstall": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/napi-postinstall/-/napi-postinstall-0.3.0.tgz", + "integrity": "sha512-M7NqKyhODKV1gRLdkwE7pDsZP2/SC2a2vHkOYh9MCpKMbWVfyVfUw5MaH83Fv6XMjxr5jryUp3IDDL9rlxsTeA==", + "dev": true, + "license": "MIT", + "bin": { + "napi-postinstall": "lib/cli.js" + }, + "engines": { + "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/napi-postinstall" + } + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true + }, + "node_modules/negotiator": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz", + "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/netmask": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/netmask/-/netmask-2.0.2.tgz", + "integrity": "sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==", + "license": "MIT", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/node-addon-api": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.1.tgz", + "integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==" + }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/nopt": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz", + "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==", + "dependencies": { + "abbrev": "1" + }, + "bin": { + "nopt": "bin/nopt.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/npmlog": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-5.0.1.tgz", + "integrity": "sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==", + "deprecated": "This package is no longer supported.", + "dependencies": { + "are-we-there-yet": "^2.0.0", + "console-control-strings": "^1.1.0", + "gauge": "^3.0.0", + "set-blocking": "^2.0.0" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.assign": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.5.tgz", + "integrity": "sha512-byy+U7gp+FVwmyzKPYhW2h5l3crpmGsxl7X2s8y43IgxvG4g3QZ6CffDtsNQy1WsmZpQbO+ybo0AlW7TY6DcBQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.5", + "define-properties": "^1.2.1", + "has-symbols": "^1.0.3", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object.fromentries": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.8.tgz", + "integrity": "sha512-k6E21FzySsSK5a21KRADBd/NGneRegFO5pLHfdQLpRDETUNJueLXs3WCzyQ3tFRDYgbq3KHGXfTbi2bs8WQ6rQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object.groupby": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.3.tgz", + "integrity": "sha512-+Lhy3TQTuzXI5hevh8sBGqbmurHbbIjAi0Z4S63nthVLmLxfbj4T54a4CfZrXIrt9iP4mVAPYMo/v99taj3wjQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.values": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.2.0.tgz", + "integrity": "sha512-yBYjY9QX2hnRmZHAjG/f13MzmBzxzYgQhFrke06TTyKY5zSTEqkOeukBzIdVA3j3ulu8Qa3MbVFShV7T2RmGtQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "license": "MIT", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/on-headers": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.1.0.tgz", + "integrity": "sha512-737ZY3yNnXy37FHkQxPzt4UZ2UWPWiCZWLvFZ4fu5cueciegX0zGPnrlY6bwRg4FdQOe9YU8MkmJwGhoMybl8A==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/pac-proxy-agent": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/pac-proxy-agent/-/pac-proxy-agent-7.2.0.tgz", + "integrity": "sha512-TEB8ESquiLMc0lV8vcd5Ql/JAKAoyzHFXaStwjkzpOpC5Yv+pIzLfHvjTSdf3vpa2bMiUQrg9i6276yn8666aA==", + "license": "MIT", + "dependencies": { + "@tootallnate/quickjs-emscripten": "^0.23.0", + "agent-base": "^7.1.2", + "debug": "^4.3.4", + "get-uri": "^6.0.1", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.6", + "pac-resolver": "^7.0.1", + "socks-proxy-agent": "^8.0.5" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/pac-proxy-agent/node_modules/agent-base": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.3.tgz", + "integrity": "sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw==", + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/pac-proxy-agent/node_modules/https-proxy-agent": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", + "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/pac-resolver": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/pac-resolver/-/pac-resolver-7.0.1.tgz", + "integrity": "sha512-5NPgf87AT2STgwa2ntRMr45jTKrYBGkVU36yT0ig/n/GMAa3oPqhZfIQ2kMEimReg0+t9kZViDVZ83qfVUlckg==", + "license": "MIT", + "dependencies": { + "degenerator": "^5.0.0", + "netmask": "^2.0.2" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "license": "MIT", + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/parse-entities": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-2.0.0.tgz", + "integrity": "sha512-kkywGpCcRYhqQIchaWqZ875wzpS/bMKhz5HnN3p7wveJTkTtyAB/AlnS0f8DFSqYW1T82t6yEAkEcB+A1I3MbQ==", + "dev": true, + "dependencies": { + "character-entities": "^1.0.0", + "character-entities-legacy": "^1.0.0", + "character-reference-invalid": "^1.0.0", + "is-alphanumerical": "^1.0.0", + "is-decimal": "^1.0.0", + "is-hexadecimal": "^1.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "node_modules/path-to-regexp": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.3.0.tgz", + "integrity": "sha512-7jdwVIRtsP8MYpdXSwOS0YdD0Du+qOoF/AEPIt88PcCFrZCzx41oxku1jD88hZBwbNUIEfpqvuhjFaMAqMTWnA==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/pem": { + "version": "1.14.8", + "resolved": "https://registry.npmjs.org/pem/-/pem-1.14.8.tgz", + "integrity": "sha512-ZpbOf4dj9/fQg5tQzTqv4jSKJQsK7tPl0pm4/pvPcZVjZcJg7TMfr3PBk6gJH97lnpJDu4e4v8UUqEz5daipCg==", + "dependencies": { + "es6-promisify": "^7.0.0", + "md5": "^2.3.0", + "os-tmpdir": "^1.0.2", + "which": "^2.0.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/possible-typed-array-names": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz", + "integrity": "sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/prettier": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.6.2.tgz", + "integrity": "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/prettier-linter-helpers": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", + "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", + "dev": true, + "dependencies": { + "fast-diff": "^1.1.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/prettier-plugin-sh": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/prettier-plugin-sh/-/prettier-plugin-sh-0.14.0.tgz", + "integrity": "sha512-hfXulj5+zEl/ulrO5kMuuTPKmXvOg0bnLHY1hKFNN/N+/903iZbNp8NyZBTsgI8dtkSgFfAEIQq0IQTyP1ZVFQ==", + "dev": true, + "dependencies": { + "mvdan-sh": "^0.10.1", + "sh-syntax": "^0.4.1" + }, + "engines": { + "node": ">=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + }, + "peerDependencies": { + "prettier": "^3.0.3" + } + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/proxy-agent": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-6.5.0.tgz", + "integrity": "sha512-TmatMXdr2KlRiA2CyDu8GqR8EjahTG3aY3nXjdzFyoZbmB8hrBsTyMezhULIXKnC0jpfjlmiZ3+EaCzoInSu/A==", + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "^4.3.4", + "http-proxy-agent": "^7.0.1", + "https-proxy-agent": "^7.0.6", + "lru-cache": "^7.14.1", + "pac-proxy-agent": "^7.1.0", + "proxy-from-env": "^1.1.0", + "socks-proxy-agent": "^8.0.5" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/proxy-agent/node_modules/agent-base": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.3.tgz", + "integrity": "sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw==", + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/proxy-agent/node_modules/https-proxy-agent": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", + "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/qs": { + "version": "6.14.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.0.tgz", + "integrity": "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==", + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.1.tgz", + "integrity": "sha512-9G8cA+tuMS75+6G/TzW8OtLzmBDMo8p1JRxN5AZ+LAp8uxGA8V8GZm4GQ4/N5QNQEnLmg6SS7wyuSmbKepiKqA==", + "license": "MIT", + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.7.0", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/raw-body/node_modules/iconv-lite": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.0.tgz", + "integrity": "sha512-cf6L2Ds3h57VVmkZe+Pn+5APsT7FpqJtEhhieDCvrE2MK5Qk9MyffgQyuxQTm6BChfeZNtcOLHp9IcWRVcIcBQ==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/regexp.prototype.flags": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.3.tgz", + "integrity": "sha512-vqlC04+RQoFalODCbCumG2xIOvapzVMHwsyIGM/SIE8fRhFFsXeH8/QQ+s0T0kDAhKc4k30s73/0ydkHQz6HlQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-errors": "^1.3.0", + "set-function-name": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/remark-footnotes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/remark-footnotes/-/remark-footnotes-3.0.0.tgz", + "integrity": "sha512-ZssAvH9FjGYlJ/PBVKdSmfyPc3Cz4rTWgZLI4iE/SX8Nt5l3o3oEjv3wwG5VD7xOjktzdwp5coac+kJV9l4jgg==", + "dev": true, + "dependencies": { + "mdast-util-footnote": "^0.1.0", + "micromark-extension-footnote": "^0.3.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-frontmatter": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/remark-frontmatter/-/remark-frontmatter-3.0.0.tgz", + "integrity": "sha512-mSuDd3svCHs+2PyO29h7iijIZx4plX0fheacJcAoYAASfgzgVIcXGYSq9GFyYocFLftQs8IOmmkgtOovs6d4oA==", + "dev": true, + "dependencies": { + "mdast-util-frontmatter": "^0.2.0", + "micromark-extension-frontmatter": "^0.2.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-gfm": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/remark-gfm/-/remark-gfm-1.0.0.tgz", + "integrity": "sha512-KfexHJCiqvrdBZVbQ6RopMZGwaXz6wFJEfByIuEwGf0arvITHjiKKZ1dpXujjH9KZdm1//XJQwgfnJ3lmXaDPA==", + "dev": true, + "dependencies": { + "mdast-util-gfm": "^0.1.0", + "micromark-extension-gfm": "^0.3.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-parse": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-9.0.0.tgz", + "integrity": "sha512-geKatMwSzEXKHuzBNU1z676sGcDcFoChMK38TgdHJNAYfFtsfHDQG7MoJAjs6sgYMqyLduCYWDIWZIxiPeafEw==", + "dev": true, + "dependencies": { + "mdast-util-from-markdown": "^0.8.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w==", + "dev": true, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" + }, + "node_modules/resolve": { + "version": "1.22.8", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", + "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", + "dev": true, + "dependencies": { + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, + "node_modules/reusify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", + "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", + "dev": true, + "license": "MIT", + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rotating-file-stream": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/rotating-file-stream/-/rotating-file-stream-3.2.5.tgz", + "integrity": "sha512-T8iBxUA4SookMTU97cIHUPck7beLOvN4g+y4db9E2eLn54OFsdp4qMnxuqmmJ05lcQHzueEVnPRykxfnPG948g==", + "engines": { + "node": ">=14.0" + }, + "funding": { + "url": "https://www.blockchain.com/btc/address/12p1p5q7sK75tPyuesZmssiMYr4TKzpSCN" + } + }, + "node_modules/router": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz", + "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "depd": "^2.0.0", + "is-promise": "^4.0.0", + "parseurl": "^1.3.3", + "path-to-regexp": "^8.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/safe-array-concat": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.2.tgz", + "integrity": "sha512-vj6RsCsWBCf19jIeHEfkRMw8DPiBb+DMXklQ/1SGDHOMlHdPUkZXFQ2YdplS23zESTijAcurb1aSgJA3AgMu1Q==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "get-intrinsic": "^1.2.4", + "has-symbols": "^1.0.3", + "isarray": "^2.0.5" + }, + "engines": { + "node": ">=0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/safe-compare": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/safe-compare/-/safe-compare-1.1.4.tgz", + "integrity": "sha512-b9wZ986HHCo/HbKrRpBJb2kqXMK9CEWIE1egeEvZsYn69ay3kdfl9nG3RyOcR+jInTDf7a86WQ1d4VJX7goSSQ==", + "dependencies": { + "buffer-alloc": "^1.2.0" + } + }, + "node_modules/safe-regex-test": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.3.tgz", + "integrity": "sha512-CdASjNJPvRa7roO6Ra/gLYBTzYzzPyyBXxIMdGW3USQLyjWEls2RgW5UBTXaQVp+OrpeCK3bLem8smtmheoRuw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.6", + "es-errors": "^1.3.0", + "is-regex": "^1.1.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" + }, + "node_modules/semver": { + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", + "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/send": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/send/-/send-1.2.0.tgz", + "integrity": "sha512-uaW0WwXKpL9blXE2o0bRhoL2EGXIrZxQ2ZQ4mgcfoBxdFmQold+qWsD2jLrfZ0trjKL6vOw0j//eAwcALFjKSw==", + "license": "MIT", + "dependencies": { + "debug": "^4.3.5", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "fresh": "^2.0.0", + "http-errors": "^2.0.0", + "mime-types": "^3.0.1", + "ms": "^2.1.3", + "on-finished": "^2.4.1", + "range-parser": "^1.2.1", + "statuses": "^2.0.1" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/serve-static": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.0.tgz", + "integrity": "sha512-61g9pCh0Vnh7IutZjtLGGpTA355+OPn2TyDv/6ivP2h/AdAVX9azsoxmg2/M6nZeQZNYBEwIcsne1mJd9oQItQ==", + "license": "MIT", + "dependencies": { + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "parseurl": "^1.3.3", + "send": "^1.2.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==" + }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "dev": true, + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/set-function-name": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.2.tgz", + "integrity": "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==", + "dev": true, + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "functions-have-names": "^1.2.3", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "license": "ISC" + }, + "node_modules/sh-syntax": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/sh-syntax/-/sh-syntax-0.4.2.tgz", + "integrity": "sha512-/l2UZ5fhGZLVZa16XQM9/Vq/hezGGbdHeVEA01uWjOL1+7Ek/gt6FquW0iKKws4a9AYPYvlz6RyVvjh3JxOteg==", + "dev": true, + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/side-channel": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" + }, + "node_modules/smart-buffer": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", + "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", + "license": "MIT", + "engines": { + "node": ">= 6.0.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/socks": { + "version": "2.8.4", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.8.4.tgz", + "integrity": "sha512-D3YaD0aRxR3mEcqnidIs7ReYJFVzWdd6fXJYUM8ixcQcJRGTka/b3saV0KflYhyVJXKhb947GndU35SxYNResQ==", + "license": "MIT", + "dependencies": { + "ip-address": "^9.0.5", + "smart-buffer": "^4.2.0" + }, + "engines": { + "node": ">= 10.0.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/socks-proxy-agent": { + "version": "8.0.5", + "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-8.0.5.tgz", + "integrity": "sha512-HehCEsotFqbPW9sJ8WVYB6UbmIMv7kUUORIF2Nncq4VQvBfNBLibW9YZR5dlYCSUhwcD628pRllm7n+E+YTzJw==", + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "^4.3.4", + "socks": "^2.8.3" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/socks-proxy-agent/node_modules/agent-base": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.3.tgz", + "integrity": "sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw==", + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "license": "BSD-3-Clause", + "optional": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sprintf-js": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz", + "integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==", + "license": "BSD-3-Clause" + }, + "node_modules/stable-hash-x": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/stable-hash-x/-/stable-hash-x-0.2.0.tgz", + "integrity": "sha512-o3yWv49B/o4QZk5ZcsALc6t0+eCelPc44zZsLtCQnZPDwFpDYSWcDnrv2TtMmMbQ7uKo3J0HTURCqckw23czNQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "node_modules/string.prototype.trim": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.9.tgz", + "integrity": "sha512-klHuCNxiMZ8MlsOihJhJEBJAiMVqU3Z2nEXWfWnIqjN0gEFS9J9+IxKozWWtQGcgoa1WUZzLjKPTr4ZHNFTFxw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.0", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimend": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.8.tgz", + "integrity": "sha512-p73uL5VCHCO2BZZ6krwwQE3kCzM7NKmis8S//xEC6fQonchbum4eP6kR4DLEjQFO3Wnj3Fuo8NM0kOSjVdHjZQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimstart": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz", + "integrity": "sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/synckit": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.9.1.tgz", + "integrity": "sha512-7gr8p9TQP6RAHusBOSLs46F4564ZrjV8xFmw5zCmgmhGUcw2hxsShhJ6CEiHQMgPDwAQ1fWHPM0ypc4RMAig4A==", + "dev": true, + "dependencies": { + "@pkgr/core": "^0.1.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, + "node_modules/tar": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz", + "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==", + "dependencies": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^5.0.0", + "minizlib": "^2.1.1", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.14", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.14.tgz", + "integrity": "sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.4.4", + "picomatch": "^4.0.2" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tinyglobby/node_modules/fdir": { + "version": "6.4.6", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.6.tgz", + "integrity": "sha512-hiFoqpyZcfNm1yc4u8oWCf9A2c4D3QjCrks3zmoVKVxpQRzmPNar1hUJcBG2RQHvEVGDN+Jm81ZheVLAQMK6+w==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/tinyglobby/node_modules/picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, + "node_modules/traverse": { + "version": "0.6.10", + "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.6.10.tgz", + "integrity": "sha512-hN4uFRxbK+PX56DxYiGHsTn2dME3TVr9vbNqlQGcGcPhJAn+tdP126iA+TArMpI4YSgnTkMWyoLl5bf81Hi5TA==", + "dev": true, + "dependencies": { + "gopd": "^1.0.1", + "typedarray.prototype.slice": "^1.0.3", + "which-typed-array": "^1.1.15" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/trough": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/trough/-/trough-1.0.5.tgz", + "integrity": "sha512-rvuRbTarPXmMb79SmzEp8aqXNKcK+y0XaB298IXueQ8I2PsrATcPBCSPyK/dDNa2iWOhKlfNnOjdAOTBU/nkFA==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/ts-api-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.1.0.tgz", + "integrity": "sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.12" + }, + "peerDependencies": { + "typescript": ">=4.8.4" + } + }, + "node_modules/ts-node": { + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", + "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", + "dev": true, + "dependencies": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + }, + "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" + }, + "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 + } + } + }, + "node_modules/tsconfig-paths": { + "version": "3.15.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", + "integrity": "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==", + "dev": true, + "dependencies": { + "@types/json5": "^0.0.29", + "json5": "^1.0.2", + "minimist": "^1.2.6", + "strip-bom": "^3.0.0" + } + }, + "node_modules/tslib": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz", + "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==" + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/type-is": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.1.tgz", + "integrity": "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==", + "license": "MIT", + "dependencies": { + "content-type": "^1.0.5", + "media-typer": "^1.1.0", + "mime-types": "^3.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/typed-array-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.2.tgz", + "integrity": "sha512-gEymJYKZtKXzzBzM4jqa9w6Q1Jjm7x2d+sh19AdsD4wqnMPDYyvwpsIc2Q/835kHuo3BEQ7CjelGhfTsoBb2MQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "is-typed-array": "^1.1.13" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/typed-array-byte-length": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.1.tgz", + "integrity": "sha512-3iMJ9q0ao7WE9tWcaYKIptkNBuOIcZCCT0d4MRvuuH88fEoEH62IuQe0OtraD3ebQEoTRk8XCBoknUNc1Y67pw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-proto": "^1.0.3", + "is-typed-array": "^1.1.13" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-byte-offset": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.2.tgz", + "integrity": "sha512-Ous0vodHa56FviZucS2E63zkgtgrACj7omjwd/8lTEMEPFFyjfixMZ1ZXenpgCFBBt4EC1J2XsyVS2gkG0eTFA==", + "dev": true, + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-proto": "^1.0.3", + "is-typed-array": "^1.1.13" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-length": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.6.tgz", + "integrity": "sha512-/OxDN6OtAk5KBpGb28T+HZc2M+ADtvRxXrKKbUwtsLgdoxgX13hyy7ek6bFRl5+aBs2yZzB0c4CnQfAtVypW/g==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-proto": "^1.0.3", + "is-typed-array": "^1.1.13", + "possible-typed-array-names": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typedarray.prototype.slice": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typedarray.prototype.slice/-/typedarray.prototype.slice-1.0.3.tgz", + "integrity": "sha512-8WbVAQAUlENo1q3c3zZYuy5k9VzBQvp8AX9WOtbvyWlLM1v5JaSRmjubLjzHF4JFtptjH/5c/i95yaElvcjC0A==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.0", + "es-errors": "^1.3.0", + "typed-array-buffer": "^1.0.2", + "typed-array-byte-offset": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typescript": { + "version": "5.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz", + "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", + "devOptional": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/typescript-eslint": { + "version": "8.33.0", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.33.0.tgz", + "integrity": "sha512-5YmNhF24ylCsvdNW2oJwMzTbaeO4bg90KeGtMjUw0AGtHksgEPLRTUil+coHwCfiu4QjVJFnjp94DmU6zV7DhQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/eslint-plugin": "8.33.0", + "@typescript-eslint/parser": "8.33.0", + "@typescript-eslint/utils": "8.33.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.9.0" + } + }, + "node_modules/unbox-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", + "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-bigints": "^1.0.2", + "has-symbols": "^1.0.3", + "which-boxed-primitive": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/underscore": { + "version": "1.13.7", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.7.tgz", + "integrity": "sha512-GMXzWtsc57XAtguZgaQViUOzs0KTkk8ojr3/xAxXLITqf/3EMwxC0inyETfDFjH/Krbhuep0HNbbjI9i/q3F3g==", + "dev": true + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/unified": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/unified/-/unified-9.2.2.tgz", + "integrity": "sha512-Sg7j110mtefBD+qunSLO1lqOEKdrwBFBrR6Qd8f4uwkhWNlbkaqwHse6e7QvD3AP/MNoJdEDLaf8OxYyoWgorQ==", + "dev": true, + "dependencies": { + "bail": "^1.0.0", + "extend": "^3.0.0", + "is-buffer": "^2.0.0", + "is-plain-obj": "^2.0.0", + "trough": "^1.0.0", + "vfile": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unified/node_modules/is-buffer": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", + "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "engines": { + "node": ">=4" + } + }, + "node_modules/unist-util-is": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-4.1.0.tgz", + "integrity": "sha512-ZOQSsnce92GrxSqlnEEseX0gi7GH9zTJZ0p9dtu87WRb/37mMPO2Ilx1s/t9vBHrFhbgweUwb+t7cIn5dxPhZg==", + "dev": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-stringify-position": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-2.0.3.tgz", + "integrity": "sha512-3faScn5I+hy9VleOq/qNbAd6pAx7iH5jYBMS9I1HgQVijz/4mv5Bvw5iw1sC/90CODiKo81G/ps8AJrISn687g==", + "dev": true, + "dependencies": { + "@types/unist": "^2.0.2" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit-parents": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-3.1.1.tgz", + "integrity": "sha512-1KROIZWo6bcMrZEwiH2UrXDyalAa0uqzWCxCJj6lPOvTve2WkfgCytoDTPaMnodXh1WrXOq0haVYHj99ynJlsg==", + "dev": true, + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/unrs-resolver": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/unrs-resolver/-/unrs-resolver-1.11.1.tgz", + "integrity": "sha512-bSjt9pjaEBnNiGgc9rUiHGKv5l4/TGzDmYw3RhnkJGtLhbnnA/5qJj7x3dNDCRx/PJxu774LlH8lCOlB4hEfKg==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "napi-postinstall": "^0.3.0" + }, + "funding": { + "url": "https://opencollective.com/unrs-resolver" + }, + "optionalDependencies": { + "@unrs/resolver-binding-android-arm-eabi": "1.11.1", + "@unrs/resolver-binding-android-arm64": "1.11.1", + "@unrs/resolver-binding-darwin-arm64": "1.11.1", + "@unrs/resolver-binding-darwin-x64": "1.11.1", + "@unrs/resolver-binding-freebsd-x64": "1.11.1", + "@unrs/resolver-binding-linux-arm-gnueabihf": "1.11.1", + "@unrs/resolver-binding-linux-arm-musleabihf": "1.11.1", + "@unrs/resolver-binding-linux-arm64-gnu": "1.11.1", + "@unrs/resolver-binding-linux-arm64-musl": "1.11.1", + "@unrs/resolver-binding-linux-ppc64-gnu": "1.11.1", + "@unrs/resolver-binding-linux-riscv64-gnu": "1.11.1", + "@unrs/resolver-binding-linux-riscv64-musl": "1.11.1", + "@unrs/resolver-binding-linux-s390x-gnu": "1.11.1", + "@unrs/resolver-binding-linux-x64-gnu": "1.11.1", + "@unrs/resolver-binding-linux-x64-musl": "1.11.1", + "@unrs/resolver-binding-wasm32-wasi": "1.11.1", + "@unrs/resolver-binding-win32-arm64-msvc": "1.11.1", + "@unrs/resolver-binding-win32-ia32-msvc": "1.11.1", + "@unrs/resolver-binding-win32-x64-msvc": "1.11.1" + } + }, + "node_modules/update-section": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/update-section/-/update-section-0.3.3.tgz", + "integrity": "sha512-BpRZMZpgXLuTiKeiu7kK0nIPwGdyrqrs6EDSaXtjD/aQ2T+qVo9a5hRC3HN3iJjCMxNT/VxoLGQ7E/OzE5ucnw==", + "dev": true + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "dev": true + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/vfile": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-4.2.1.tgz", + "integrity": "sha512-O6AE4OskCG5S1emQ/4gl8zK586RqA3srz3nfK/Viy0UPToBc5Trp9BVFb1u0CjsKrAWwnpr4ifM/KBXPWwJbCA==", + "dev": true, + "dependencies": { + "@types/unist": "^2.0.0", + "is-buffer": "^2.0.0", + "unist-util-stringify-position": "^2.0.0", + "vfile-message": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/vfile-message": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-2.0.4.tgz", + "integrity": "sha512-DjssxRGkMvifUOJre00juHoP9DPWuzjxKuMDrhNbk2TdaYYBNMStsNhEOt3idrtI12VQYM/1+iM0KOzXi4pxwQ==", + "dev": true, + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-stringify-position": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/vfile/node_modules/is-buffer": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", + "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "engines": { + "node": ">=4" + } + }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/which-boxed-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", + "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "dev": true, + "dependencies": { + "is-bigint": "^1.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "is-symbol": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-typed-array": { + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.15.tgz", + "integrity": "sha512-oV0jmFtUky6CXfkqehVvBP/LSWJ2sy4vWMioiENyJLePrBO/yKyV9OyJySfAKosh+RYkIl5zJCNZ8/4JncrpdA==", + "dev": true, + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/wide-align": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz", + "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==", + "dependencies": { + "string-width": "^1.0.2 || 2 || 3 || 4" + } + }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + }, + "node_modules/ws": { + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", + "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/xdg-basedir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz", + "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", + "engines": { + "node": ">=8" + } + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/zwitch": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-1.0.5.tgz", + "integrity": "sha512-V50KMwwzqJV0NpZIZFwfOD5/lyny3WlSzRiXgA0G7VUnRlqttta1L6UQIHzd6EuBY/cHGfwTIck7w1yH6Q5zUw==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + } + } +} diff --git a/package.json b/package.json index 169327dae582..8bd1c71b7caa 100644 --- a/package.json +++ b/package.json @@ -1,85 +1,95 @@ { "name": "code-server", "license": "MIT", - "version": "3.5.0", + "version": "0.0.0", "description": "Run VS Code on a remote server.", - "homepage": "https://github.com/cdr/code-server", + "homepage": "https://github.com/coder/code-server", "bugs": { - "url": "https://github.com/cdr/code-server/issues" + "url": "https://github.com/coder/code-server/issues" }, - "repository": "https://github.com/cdr/code-server", + "repository": "https://github.com/coder/code-server", "scripts": { "clean": "./ci/build/clean.sh", - "vscode": "./ci/dev/vscode.sh", - "vscode:patch": "./ci/dev/patch-vscode.sh", - "vscode:diff": "./ci/dev/diff-vscode.sh", "build": "./ci/build/build-code-server.sh", "build:vscode": "./ci/build/build-vscode.sh", + "doctoc": "./ci/dev/doctoc.sh", "release": "./ci/build/build-release.sh", "release:standalone": "./ci/build/build-standalone-release.sh", - "release:github-draft": "./ci/build/release-github-draft.sh", - "release:github-assets": "./ci/build/release-github-assets.sh", - "test:standalone-release": "./ci/build/test-standalone-release.sh", + "release:prep": "./ci/build/release-prep.sh", + "test:e2e": "VSCODE_IPC_HOOK_CLI= ./ci/dev/test-e2e.sh", + "test:e2e:proxy": "USE_PROXY=1 ./ci/dev/test-e2e.sh", + "test:unit": "./ci/dev/test-unit.sh --forceExit --detectOpenHandles", + "test:integration": "./ci/dev/test-integration.sh", + "test:native": "./ci/dev/test-native.sh", + "test:scripts": "./ci/dev/test-scripts.sh", "package": "./ci/build/build-packages.sh", - "_____": "", - "fmt": "./ci/dev/fmt.sh", - "lint": "./ci/dev/lint.sh", - "test": "./ci/dev/test.sh", - "ci": "./ci/dev/ci.sh", - "watch": "NODE_OPTIONS=--max_old_space_size=32384 ts-node ./ci/dev/watch.ts" + "prettier": "prettier --write --log-level=warn --cache .", + "preinstall": "node ./ci/dev/preinstall.js", + "postinstall": "./ci/dev/postinstall.sh", + "publish:npm": "./ci/steps/publish-npm.sh", + "publish:docker": "./ci/steps/docker-buildx-push.sh", + "fmt": "npm run prettier && ./ci/dev/doctoc.sh", + "lint:scripts": "./ci/dev/lint-scripts.sh", + "lint:ts": "eslint --max-warnings=0 --fix $(git ls-files '*.ts' '*.js' | grep -v 'lib/vscode')", + "test": "echo 'Run npm run test:unit or npm run test:e2e' && exit 1", + "watch": "VSCODE_DEV=1 VSCODE_IPC_HOOK_CLI= NODE_OPTIONS='--max_old_space_size=32384 --trace-warnings' ts-node ./ci/dev/watch.ts", + "icons": "./ci/dev/gen_icons.sh" }, "main": "out/node/entry.js", "devDependencies": { - "@types/fs-extra": "^8.0.1", - "@types/http-proxy": "^1.17.4", - "@types/js-yaml": "^3.12.3", - "@types/mocha": "^5.2.7", - "@types/node": "^12.12.7", - "@types/parcel-bundler": "^1.12.1", - "@types/pem": "^1.9.5", + "@eslint/compat": "^1.2.0", + "@eslint/eslintrc": "^3.1.0", + "@eslint/js": "^9.12.0", + "@schemastore/package": "^0.0.10", + "@types/compression": "^1.7.3", + "@types/cookie-parser": "^1.4.4", + "@types/eslint__js": "^8.42.3", + "@types/express": "^5.0.0", + "@types/http-proxy": "1.17.7", + "@types/js-yaml": "^4.0.6", + "@types/node": "22.x", + "@types/pem": "^1.14.1", + "@types/proxy-from-env": "^1.0.1", "@types/safe-compare": "^1.1.0", - "@types/semver": "^7.1.0", - "@types/tar-fs": "^1.16.2", - "@types/tar-stream": "^1.6.1", - "@types/ws": "^6.0.4", - "@typescript-eslint/eslint-plugin": "^2.0.0", - "@typescript-eslint/parser": "^2.0.0", - "doctoc": "^1.4.0", - "eslint": "^6.2.0", - "eslint-config-prettier": "^6.0.0", - "eslint-plugin-import": "^2.18.2", - "eslint-plugin-prettier": "^3.1.0", - "leaked-handles": "^5.2.0", - "mocha": "^6.2.0", - "parcel-bundler": "^1.12.4", - "prettier": "^2.0.5", - "stylelint": "^13.0.0", - "stylelint-config-recommended": "^3.0.0", - "ts-node": "^8.4.1", - "typescript": "3.7.2" - }, - "resolutions": { - "@types/node": "^12.12.7", - "safe-buffer": "^5.1.1", - "vfile-message": "^2.0.2" + "@types/semver": "^7.5.2", + "@types/trusted-types": "^2.0.4", + "@types/ws": "^8.5.5", + "doctoc": "^2.2.1", + "eslint": "^9.12.0", + "eslint-config-prettier": "^9.0.0", + "eslint-import-resolver-typescript": "^4.4.4", + "eslint-plugin-import": "^2.28.1", + "eslint-plugin-prettier": "^5.0.0", + "globals": "^16.1.0", + "prettier": "3.6.2", + "prettier-plugin-sh": "^0.14.0", + "ts-node": "^10.9.1", + "typescript": "^5.6.2", + "typescript-eslint": "^8.8.0" }, "dependencies": { - "@coder/logger": "1.1.16", - "env-paths": "^2.2.0", - "fs-extra": "^8.1.0", - "http-proxy": "^1.18.0", + "@coder/logger": "^3.0.1", + "argon2": "^0.31.1", + "compression": "^1.7.4", + "cookie-parser": "^1.4.6", + "env-paths": "^2.2.1", + "express": "^5.0.1", + "http-proxy": "^1.18.1", "httpolyglot": "^0.1.2", - "js-yaml": "^3.13.1", - "limiter": "^1.1.5", - "pem": "^1.14.2", - "rotating-file-stream": "^2.1.1", + "i18next": "^25.3.0", + "js-yaml": "^4.1.0", + "limiter": "^2.1.0", + "pem": "^1.14.8", + "proxy-agent": "^6.3.1", + "qs": "6.14.0", + "rotating-file-stream": "^3.1.1", "safe-compare": "^1.1.4", - "semver": "^7.1.3", - "tar": "^6.0.1", - "tar-fs": "^2.0.0", - "ws": "^7.2.0", - "xdg-basedir": "^4.0.0", - "yarn": "^1.22.4" + "semver": "^7.5.4", + "ws": "^8.14.2", + "xdg-basedir": "^4.0.0" + }, + "resolutions": { + "@types/node": "22.x" }, "bin": { "code-server": "out/node/entry.js" @@ -90,9 +100,54 @@ "ide", "coder", "vscode-remote", - "browser-ide" + "browser-ide", + "remote-development" ], "engines": { - "node": ">= 12" + "node": "22" + }, + "jest": { + "transform": { + "^.+\\.ts$": "/test/node_modules/ts-jest" + }, + "testEnvironment": "node", + "testPathIgnorePatterns": [ + "/node_modules/", + "/lib/", + "/out/", + "test/e2e" + ], + "collectCoverage": true, + "collectCoverageFrom": [ + "/src/**/*.ts" + ], + "coverageDirectory": "/coverage", + "coverageReporters": [ + "json", + "json-summary", + "text", + "clover" + ], + "coveragePathIgnorePatterns": [ + "/out" + ], + "coverageThreshold": { + "global": { + "lines": 60 + } + }, + "modulePathIgnorePatterns": [ + "/release-packages", + "/release", + "/release-standalone", + "/release-npm-package", + "/release-gcp", + "/release-images", + "/lib" + ], + "moduleNameMapper": { + "^.+\\.(css|less)$": "/test/utils/cssStub.ts" + }, + "globalSetup": "/test/utils/globalUnitSetup.ts" } } diff --git a/patches/base-path.diff b/patches/base-path.diff new file mode 100644 index 000000000000..5c6e5b8b1e31 --- /dev/null +++ b/patches/base-path.diff @@ -0,0 +1,307 @@ +Add base path support + +Some users will host code-server behind a path-rewriting reverse proxy, for +example domain.tld/my/base/path. This patch adds support for that since Code +assumes everything is on / by default. + +To test this serve code-server behind a reverse proxy with a path like /code. + +Index: code-server/lib/vscode/src/vs/base/common/network.ts +=================================================================== +--- code-server.orig/lib/vscode/src/vs/base/common/network.ts ++++ code-server/lib/vscode/src/vs/base/common/network.ts +@@ -232,7 +232,9 @@ class RemoteAuthoritiesImpl { + return URI.from({ + scheme: platform.isWeb ? this._preferredWebSchema : Schemas.vscodeRemoteResource, + authority: `${host}:${port}`, +- path: this._remoteResourcesPath, ++ path: platform.isWeb ++ ? (window.location.pathname + "/" + this._remoteResourcesPath).replace(/\/\/+/g, "/") ++ : this._remoteResourcesPath, + query + }); + } +Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench-dev.html +=================================================================== +--- code-server.orig/lib/vscode/src/vs/code/browser/workbench/workbench-dev.html ++++ code-server/lib/vscode/src/vs/code/browser/workbench/workbench-dev.html +@@ -11,8 +11,8 @@ + + + +- +- ++ ++ + + + +@@ -27,9 +27,9 @@ + + + +- +- +- ++ ++ ++ + + + +@@ -39,7 +39,7 @@ + + + + + diff --git a/src/browser/pages/global.css b/src/browser/pages/global.css index fcc3ace34300..ba79ea6134c6 100644 --- a/src/browser/pages/global.css +++ b/src/browser/pages/global.css @@ -1,3 +1,7 @@ +:root { + color-scheme: light dark; +} + html, body, #root { @@ -7,9 +11,12 @@ body, body { background: rgb(244, 247, 252); + background: light-dark(rgb(244, 247, 252), #111827); color: #111; + color: light-dark(#111, #ddd); margin: 0; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", + font-family: + -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; overflow: hidden; } @@ -23,12 +30,15 @@ button { .-button { background-color: rgb(87, 114, 245); + background-color: light-dark(rgb(87, 114, 245), rgb(26, 86, 219)); border-radius: 5px; border: none; box-sizing: border-box; color: white; + color: light-dark(white, white); cursor: pointer; padding: 18px 20px; + font-weight: 500; text-decoration: none; } @@ -45,15 +55,20 @@ button { .card-box { background-color: rgb(250, 253, 258); + background-color: light-dark(rgb(250, 253, 258), #1f2937); border-radius: 5px; - box-shadow: rgba(60, 66, 87, 0.117647) 0px 7px 14px 0px, rgba(0, 0, 0, 0.117647) 0px 3px 6px 0px; + box-shadow: + light-dark(rgba(60, 66, 87, 0.117647), rgba(10, 10, 10, 0.617647)) 0px 7px 14px 0px, + rgba(0, 0, 0, 0.117647) 0px 3px 6px 0px; max-width: 650px; width: 100%; } .card-box > .header { border-bottom: 1px solid #ddd; + border-bottom: 1px solid light-dark(#ddd, #111827); color: #444; + color: light-dark(#444, #fff); padding: 30px; } @@ -64,6 +79,7 @@ button { .card-box > .header > .sub { color: #555; + color: light-dark(#555, #9ca3af); margin-top: 10px; } diff --git a/src/browser/pages/login.css b/src/browser/pages/login.css index 43d03e7eeab2..33b541c9e844 100644 --- a/src/browser/pages/login.css +++ b/src/browser/pages/login.css @@ -1,4 +1,6 @@ body { + min-height: 568px; + min-width: 320px; overflow: auto; } @@ -15,6 +17,12 @@ body { width: 100%; } +@media (max-width: 600px) { + .login-form > .field { + flex-direction: column; + } +} + .login-form > .error { color: red; margin-top: 16px; @@ -22,14 +30,23 @@ body { .login-form > .field > .password { background-color: rgb(244, 247, 252); + background-color: light-dark(rgb(244, 247, 252), #374151); border-radius: 5px; border: 1px solid #ddd; + border: 1px solid light-dark(#ddd, #4b5563); box-sizing: border-box; - color: black; flex: 1; padding: 16px; } +.login-form > .field > .password::placeholder { + color: rgb(148 163 184); +} + +.login-form > .field > .password:focus { + outline: 2px solid rgb(63, 131, 248); +} + .login-form > .user { display: none; } @@ -37,3 +54,14 @@ body { .login-form > .field > .submit { margin-left: 20px; } + +@media (max-width: 600px) { + .login-form > .field > .submit { + margin-left: 0px; + margin-top: 16px; + } +} + +input { + -webkit-appearance: none; +} diff --git a/src/browser/pages/login.html b/src/browser/pages/login.html index f2b262991cf4..c7fb2f2ac67e 100644 --- a/src/browser/pages/login.html +++ b/src/browser/pages/login.html @@ -1,4 +1,4 @@ - + @@ -10,42 +10,53 @@ http-equiv="Content-Security-Policy" content="style-src 'self'; script-src 'self' 'unsafe-inline'; manifest-src 'self'; img-src 'self' data:; font-src 'self' data:;" /> - code-server login - - - - + + {{I18N_LOGIN_TITLE}} + + + + + + +
-

Welcome to code-server

-
Please log in below. {{PASSWORD_MSG}}
+

{{WELCOME_TEXT}}

+
{{I18N_LOGIN_BELOW}} {{PASSWORD_MSG}}
+ - - diff --git a/src/browser/pages/login.ts b/src/browser/pages/login.ts deleted file mode 100644 index c7fc92d4a0e7..000000000000 --- a/src/browser/pages/login.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { getOptions } from "../../common/util" - -const options = getOptions() -const el = document.getElementById("base") as HTMLInputElement -if (el) { - el.value = options.base -} diff --git a/src/browser/pages/update.css b/src/browser/pages/update.css deleted file mode 100644 index eaa8feec8b4a..000000000000 --- a/src/browser/pages/update.css +++ /dev/null @@ -1,26 +0,0 @@ -.update-form { - text-align: center; -} - -.update-form > .cancel { - background-color: red; -} - -.update-form > .error { - color: red; - margin-top: 16px; -} - -.update-form > .links { - margin-top: 20px; -} - -.update-form > .links > .link { - color: rgb(87, 114, 245); - text-align: center; - text-decoration: none; -} - -.update-form > .links > .link:hover { - text-decoration: underline; -} diff --git a/src/browser/pages/vscode.html b/src/browser/pages/vscode.html deleted file mode 100644 index accb07e26e2c..000000000000 --- a/src/browser/pages/vscode.html +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/browser/pages/vscode.ts b/src/browser/pages/vscode.ts deleted file mode 100644 index feb38a2898a9..000000000000 --- a/src/browser/pages/vscode.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { getOptions } from "../../common/util" - -const options = getOptions() - -// TODO: Add proper types. -/* eslint-disable @typescript-eslint/no-explicit-any */ - -let nlsConfig: any -try { - nlsConfig = JSON.parse(document.getElementById("vscode-remote-nls-configuration")!.getAttribute("data-settings")!) - if (nlsConfig._resolvedLanguagePackCoreLocation) { - const bundles = Object.create(null) - nlsConfig.loadBundle = (bundle: any, _language: any, cb: any): void => { - const result = bundles[bundle] - if (result) { - return cb(undefined, result) - } - // FIXME: Only works if path separators are /. - const path = nlsConfig._resolvedLanguagePackCoreLocation + "/" + bundle.replace(/\//g, "!") + ".nls.json" - fetch(`{{BASE}}/resource/?path=${encodeURIComponent(path)}`) - .then((response) => response.json()) - .then((json) => { - bundles[bundle] = json - cb(undefined, json) - }) - .catch(cb) - } - } -} catch (error) { - /* Probably fine. */ -} - -;(self.require as any) = { - baseUrl: `${options.csStaticBase}/lib/vscode/out`, - recordStats: true, - paths: { - "vscode-textmate": `../node_modules/vscode-textmate/release/main`, - "vscode-oniguruma": `../node_modules/vscode-oniguruma/release/main`, - xterm: `../node_modules/xterm/lib/xterm.js`, - "xterm-addon-search": `../node_modules/xterm-addon-search/lib/xterm-addon-search.js`, - "xterm-addon-unicode11": `../node_modules/xterm-addon-unicode11/lib/xterm-addon-unicode11.js`, - "xterm-addon-webgl": `../node_modules/xterm-addon-webgl/lib/xterm-addon-webgl.js`, - "semver-umd": `../node_modules/semver-umd/lib/semver-umd.js`, - "iconv-lite-umd": `../node_modules/iconv-lite-umd/lib/iconv-lite-umd.js`, - jschardet: `../node_modules/jschardet/dist/jschardet.min.js`, - }, - "vs/nls": nlsConfig, -} - -try { - document.body.style.background = JSON.parse(localStorage.getItem("colorThemeData")!).colorMap["editor.background"] -} catch (error) { - // Oh well. -} diff --git a/src/browser/register.ts b/src/browser/register.ts deleted file mode 100644 index 60f054bc3b22..000000000000 --- a/src/browser/register.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { getOptions, normalize } from "../common/util" - -const options = getOptions() - -import "./pages/error.css" -import "./pages/global.css" -import "./pages/login.css" - -if ("serviceWorker" in navigator) { - const path = normalize(`${options.csStaticBase}/dist/serviceWorker.js`) - navigator.serviceWorker - .register(path, { - scope: options.base || "/", - }) - .then(() => { - console.log("[Service Worker] registered") - }) -} diff --git a/src/browser/robots.txt b/src/browser/robots.txt new file mode 100644 index 000000000000..1f53798bb4fe --- /dev/null +++ b/src/browser/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: / diff --git a/src/browser/security.txt b/src/browser/security.txt new file mode 100644 index 000000000000..18996f284232 --- /dev/null +++ b/src/browser/security.txt @@ -0,0 +1,6 @@ +Contact: mailto:security@coder.com +Acknowledgments: https://coder.com/security/thanks +Preferred-Languages: en-US +Canonical: https://coder.com/.well-known/security.txt +Policy: https://coder.com/security/policy +Hiring: https://coder.com/careers \ No newline at end of file diff --git a/src/browser/serviceWorker.ts b/src/browser/serviceWorker.ts index b7f2e9c59cf4..37fbf7afa5f5 100644 --- a/src/browser/serviceWorker.ts +++ b/src/browser/serviceWorker.ts @@ -1,24 +1,12 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ - self.addEventListener("install", () => { - console.log("[Service Worker] install") + console.debug("[Service Worker] installed") }) self.addEventListener("activate", (event: any) => { event.waitUntil((self as any).clients.claim()) + console.debug("[Service Worker] activated") }) -self.addEventListener("fetch", (event: any) => { - if (!navigator.onLine) { - event.respondWith( - new Promise((resolve) => { - resolve( - new Response("OFFLINE", { - status: 200, - statusText: "OK", - }), - ) - }), - ) - } +self.addEventListener("fetch", () => { + // Without this event handler we won't be recognized as a PWA. }) diff --git a/src/common/emitter.ts b/src/common/emitter.ts index 7a1ebf6686be..78d0d7990ddb 100644 --- a/src/common/emitter.ts +++ b/src/common/emitter.ts @@ -1,7 +1,13 @@ -import { Callback } from "./types" +import { logger } from "@coder/logger" + +/** + * Event emitter callback. Called with the emitted value and a promise that + * resolves when all emitters have finished. + */ +export type Callback> = (t: T, p: Promise) => R export interface Disposable { - dispose(): void + dispose(): void | Promise } export interface Event { @@ -32,8 +38,21 @@ export class Emitter { /** * Emit an event with a value. */ - public emit(value: T): void { - this.listeners.forEach((cb) => cb(value)) + public async emit(value: T): Promise { + let resolve: () => void + const promise = new Promise((r) => (resolve = r)) + + await Promise.all( + this.listeners.map(async (cb) => { + try { + await cb(value, promise) + } catch (error: any) { + logger.error(error.message) + } + }), + ) + + resolve!() } public dispose(): void { diff --git a/src/common/http.ts b/src/common/http.ts index 4749247d7af6..5f94c2cd0522 100644 --- a/src/common/http.ts +++ b/src/common/http.ts @@ -4,13 +4,26 @@ export enum HttpCode { NotFound = 404, BadRequest = 400, Unauthorized = 401, + Forbidden = 403, LargePayload = 413, ServerError = 500, } +/** + * Represents an error with a message and an HTTP status code. This code will be + * used in the HTTP response. + */ export class HttpError extends Error { - public constructor(message: string, public readonly code: number, public readonly details?: object) { + public constructor( + message: string, + public readonly statusCode: HttpCode, + public readonly details?: object, + ) { super(message) this.name = this.constructor.name } } + +export enum CookieKeys { + Session = "code-server-session", +} diff --git a/src/common/types.ts b/src/common/types.ts deleted file mode 100644 index a8a0e4c1b7c1..000000000000 --- a/src/common/types.ts +++ /dev/null @@ -1 +0,0 @@ -export type Callback = (t: T) => R diff --git a/src/common/util.ts b/src/common/util.ts index 7baa355adda0..6639beca42b1 100644 --- a/src/common/util.ts +++ b/src/common/util.ts @@ -1,20 +1,3 @@ -import { logger, field } from "@coder/logger" - -export interface Options { - base: string - csStaticBase: string - logLevel: number -} - -/** - * Split a string up to the delimiter. If the delimiter doesn't exist the first - * item will have all the text and the second item will be an empty string. - */ -export const split = (str: string, delimiter: string): [string, string] => { - const index = str.indexOf(delimiter) - return index !== -1 ? [str.substring(0, index).trim(), str.substring(index + 1)] : [str, ""] -} - /** * Appends an 's' to the provided string if count is greater than one; * otherwise the string is returned @@ -31,73 +14,22 @@ export const generateUuid = (length = 24): string => { /** * Remove extra slashes in a URL. + * + * This is meant to fill the job of `path.join` so you can concatenate paths and + * then normalize out any extra slashes. + * + * If you are using `path.join` you do not need this but note that `path` is for + * file system paths, not URLs. */ export const normalize = (url: string, keepTrailing = false): string => { return url.replace(/\/\/+/g, "/").replace(/\/+$/, keepTrailing ? "/" : "") } -/** - * Remove leading and trailing slashes. - */ -export const trimSlashes = (url: string): string => { - return url.replace(/^\/+|\/+$/g, "") -} - -/** - * Resolve a relative base against the window location. This is used for - * anything that doesn't work with a relative path. - */ -export const resolveBase = (base?: string): string => { - // After resolving the base will either start with / or be an empty string. - if (!base || base.startsWith("/")) { - return base ?? "" - } - const parts = location.pathname.split("/") - parts[parts.length - 1] = base - const url = new URL(location.origin + "/" + parts.join("/")) - return normalize(url.pathname) -} - -/** - * Get options embedded in the HTML or query params. - */ -export const getOptions = (): T => { - let options: T - try { - options = JSON.parse(document.getElementById("coder-options")!.getAttribute("data-settings")!) - } catch (error) { - options = {} as T - } - - const params = new URLSearchParams(location.search) - const queryOpts = params.get("options") - if (queryOpts) { - options = { - ...options, - ...JSON.parse(queryOpts), - } - } - - logger.level = options.logLevel - - options.base = resolveBase(options.base) - options.csStaticBase = resolveBase(options.csStaticBase) - - logger.debug("got options", field("options", options)) - - return options -} - -/** - * Wrap the value in an array if it's not already an array. If the value is - * undefined return an empty array. - */ -export const arrayify = (value?: T | T[]): T[] => { - if (Array.isArray(value)) { - return value - } - if (typeof value === "undefined") { - return [] +// TODO: Might make sense to add Error handling to the logger itself. +export function logError(logger: { error: (msg: string) => void }, prefix: string, err: unknown): void { + if (err instanceof Error) { + logger.error(`${prefix}: ${err.message} ${err.stack}`) + } else { + logger.error(`${prefix}: ${err}`) } - return [value] } diff --git a/src/node/app.ts b/src/node/app.ts new file mode 100644 index 000000000000..2043e3fd4bc0 --- /dev/null +++ b/src/node/app.ts @@ -0,0 +1,134 @@ +import { logger } from "@coder/logger" +import compression from "compression" +import express, { Express } from "express" +import { promises as fs } from "fs" +import http from "http" +import * as httpolyglot from "httpolyglot" +import { Disposable } from "../common/emitter" +import * as util from "../common/util" +import { DefaultedArgs } from "./cli" +import { disposer } from "./http" +import { isNodeJSErrnoException } from "./util" +import { EditorSessionManager, makeEditorSessionManagerServer } from "./vscodeSocket" +import { handleUpgrade } from "./wsRouter" + +type SocketOptions = { socket: string; "socket-mode"?: string } +type ListenOptions = DefaultedArgs | SocketOptions + +export interface App extends Disposable { + /** Handles regular HTTP requests. */ + router: Express + /** Handles websocket requests. */ + wsRouter: Express + /** The underlying HTTP server. */ + server: http.Server + /** Handles requests to the editor session management API. */ + editorSessionManagerServer: http.Server +} + +const isSocketOpts = (opts: ListenOptions): opts is SocketOptions => { + return !!(opts as SocketOptions).socket || !(opts as DefaultedArgs).host +} + +export const listen = async (server: http.Server, opts: ListenOptions) => { + if (isSocketOpts(opts)) { + try { + await fs.unlink(opts.socket) + } catch (error: any) { + handleArgsSocketCatchError(error) + } + } + await new Promise(async (resolve, reject) => { + server.on("error", reject) + const onListen = () => { + // Promise resolved earlier so this is an unrelated error. + server.off("error", reject) + server.on("error", (err) => util.logError(logger, "http server error", err)) + resolve() + } + if (isSocketOpts(opts)) { + server.listen(opts.socket, onListen) + } else { + // [] is the correct format when using :: but Node errors with them. + server.listen(opts.port, opts.host.replace(/^\[|\]$/g, ""), onListen) + } + }) + + // NOTE@jsjoeio: we need to chmod after the server is finished + // listening. Otherwise, the socket may not have been created yet. + if (isSocketOpts(opts)) { + if (opts["socket-mode"]) { + await fs.chmod(opts.socket, opts["socket-mode"]) + } + } +} + +/** + * Create an Express app and an HTTP/S server to serve it. + */ +export const createApp = async (args: DefaultedArgs): Promise => { + const router = express() + router.use(compression()) + + const server = args.cert + ? httpolyglot.createServer( + { + cert: args.cert && (await fs.readFile(args.cert.value)), + key: args["cert-key"] && (await fs.readFile(args["cert-key"])), + }, + router, + ) + : http.createServer(router) + + const disposeServer = disposer(server) + + await listen(server, args) + + const wsRouter = express() + handleUpgrade(wsRouter, server) + + const editorSessionManager = new EditorSessionManager() + const editorSessionManagerServer = await makeEditorSessionManagerServer(args["session-socket"], editorSessionManager) + const disposeEditorSessionManagerServer = disposer(editorSessionManagerServer) + + const dispose = async () => { + await Promise.all([disposeServer(), disposeEditorSessionManagerServer()]) + } + + return { router, wsRouter, server, dispose, editorSessionManagerServer } +} + +/** + * Get the address of a server as a string (protocol *is* included) while + * ensuring there is one (will throw if there isn't). + * + * The address might be a URL or it might be a pipe or socket path. + */ +export const ensureAddress = (server: http.Server, protocol: string): URL | string => { + const addr = server.address() + + if (!addr) { + throw new Error("Server has no address") + } + + if (typeof addr !== "string") { + const host = addr.family === "IPv6" ? `[${addr.address}]` : addr.address + return new URL(`${protocol}://${host}:${addr.port}`) + } + + // If this is a string then it is a pipe or Unix socket. + return addr +} + +/** + * Handles the error that occurs in the catch block + * after we try fs.unlink(args.socket). + * + * We extracted into a function so that we could + * test this logic more easily. + */ +export const handleArgsSocketCatchError = (error: any) => { + if (!isNodeJSErrnoException(error) || error.code !== "ENOENT") { + throw Error(error.message ? error.message : error) + } +} diff --git a/src/node/app/login.ts b/src/node/app/login.ts deleted file mode 100644 index 0fe1e0b6ed53..000000000000 --- a/src/node/app/login.ts +++ /dev/null @@ -1,144 +0,0 @@ -import * as http from "http" -import * as limiter from "limiter" -import * as querystring from "querystring" -import { HttpCode, HttpError } from "../../common/http" -import { AuthType, HttpProvider, HttpProviderOptions, HttpResponse, Route } from "../http" -import { hash, humanPath } from "../util" - -interface LoginPayload { - password?: string - /** - * Since we must set a cookie with an absolute path, we need to know the full - * base path. - */ - base?: string -} - -/** - * Login HTTP provider. - */ -export class LoginHttpProvider extends HttpProvider { - public constructor( - options: HttpProviderOptions, - private readonly configFile: string, - private readonly envPassword: boolean, - ) { - super(options) - } - - public async handleRequest(route: Route, request: http.IncomingMessage): Promise { - if (this.options.auth !== AuthType.Password || !this.isRoot(route)) { - throw new HttpError("Not found", HttpCode.NotFound) - } - switch (route.base) { - case "/": - switch (request.method) { - case "POST": - this.ensureMethod(request, ["GET", "POST"]) - return this.tryLogin(route, request) - default: - this.ensureMethod(request) - if (this.authenticated(request)) { - return { - redirect: (Array.isArray(route.query.to) ? route.query.to[0] : route.query.to) || "/", - query: { to: undefined }, - } - } - return this.getRoot(route) - } - } - - throw new HttpError("Not found", HttpCode.NotFound) - } - - public async getRoot(route: Route, error?: Error): Promise { - const response = await this.getUtf8Resource(this.rootPath, "src/browser/pages/login.html") - response.content = response.content.replace(/{{ERROR}}/, error ? `
${error.message}
` : "") - let passwordMsg = `Check the config file at ${humanPath(this.configFile)} for the password.` - if (this.envPassword) { - passwordMsg = "Password was set from $PASSWORD." - } - response.content = response.content.replace(/{{PASSWORD_MSG}}/g, passwordMsg) - return this.replaceTemplates(route, response) - } - - private readonly limiter = new RateLimiter() - - /** - * Try logging in. On failure, show the login page with an error. - */ - private async tryLogin(route: Route, request: http.IncomingMessage): Promise { - // Already authenticated via cookies? - const providedPassword = this.authenticated(request) - if (providedPassword) { - return { code: HttpCode.Ok } - } - - try { - if (!this.limiter.try()) { - throw new Error("Login rate limited!") - } - - const data = await this.getData(request) - const payload = data ? querystring.parse(data) : {} - return await this.login(payload, route, request) - } catch (error) { - return this.getRoot(route, error) - } - } - - /** - * Return a cookie if the user is authenticated otherwise throw an error. - */ - private async login(payload: LoginPayload, route: Route, request: http.IncomingMessage): Promise { - const password = this.authenticated(request, { - key: typeof payload.password === "string" ? [hash(payload.password)] : undefined, - }) - - if (password) { - return { - redirect: (Array.isArray(route.query.to) ? route.query.to[0] : route.query.to) || "/", - query: { to: undefined }, - cookie: - typeof password === "string" - ? { - key: "key", - value: password, - path: payload.base, - } - : undefined, - } - } - - // Only log if it was an actual login attempt. - if (payload && payload.password) { - console.error( - "Failed login attempt", - JSON.stringify({ - xForwardedFor: request.headers["x-forwarded-for"], - remoteAddress: request.connection.remoteAddress, - userAgent: request.headers["user-agent"], - timestamp: Math.floor(new Date().getTime() / 1000), - }), - ) - - throw new Error("Incorrect password") - } - - throw new Error("Missing password") - } -} - -// RateLimiter wraps around the limiter library for logins. -// It allows 2 logins every minute and 12 logins every hour. -class RateLimiter { - private readonly minuteLimiter = new limiter.RateLimiter(2, "minute") - private readonly hourLimiter = new limiter.RateLimiter(12, "hour") - - public try(): boolean { - if (this.minuteLimiter.tryRemoveTokens(1)) { - return true - } - return this.hourLimiter.tryRemoveTokens(1) - } -} diff --git a/src/node/app/proxy.ts b/src/node/app/proxy.ts deleted file mode 100644 index a332cc055d95..000000000000 --- a/src/node/app/proxy.ts +++ /dev/null @@ -1,43 +0,0 @@ -import * as http from "http" -import { HttpCode, HttpError } from "../../common/http" -import { HttpProvider, HttpResponse, Route, WsResponse } from "../http" - -/** - * Proxy HTTP provider. - */ -export class ProxyHttpProvider extends HttpProvider { - public async handleRequest(route: Route, request: http.IncomingMessage): Promise { - if (!this.authenticated(request)) { - if (this.isRoot(route)) { - return { redirect: "/login", query: { to: route.fullPath } } - } - throw new HttpError("Unauthorized", HttpCode.Unauthorized) - } - - // Ensure there is a trailing slash so relative paths work correctly. - if (this.isRoot(route) && !route.fullPath.endsWith("/")) { - return { - redirect: `${route.fullPath}/`, - } - } - - const port = route.base.replace(/^\//, "") - return { - proxy: { - strip: `${route.providerBase}/${port}`, - port, - }, - } - } - - public async handleWebSocket(route: Route, request: http.IncomingMessage): Promise { - this.ensureAuthenticated(request) - const port = route.base.replace(/^\//, "") - return { - proxy: { - strip: `${route.providerBase}/${port}`, - port, - }, - } - } -} diff --git a/src/node/app/static.ts b/src/node/app/static.ts deleted file mode 100644 index 471d0c987df3..000000000000 --- a/src/node/app/static.ts +++ /dev/null @@ -1,73 +0,0 @@ -import { field, logger } from "@coder/logger" -import * as http from "http" -import * as path from "path" -import { Readable } from "stream" -import * as tarFs from "tar-fs" -import * as zlib from "zlib" -import { HttpProvider, HttpResponse, Route } from "../http" -import { pathToFsPath } from "../util" - -/** - * Static file HTTP provider. Static requests do not require authentication if - * the resource is in the application's directory except requests to serve a - * directory as a tar which always requires authentication. - */ -export class StaticHttpProvider extends HttpProvider { - public async handleRequest(route: Route, request: http.IncomingMessage): Promise { - this.ensureMethod(request) - - if (typeof route.query.tar === "string") { - this.ensureAuthenticated(request) - return this.getTarredResource(request, pathToFsPath(route.query.tar)) - } - - const response = await this.getReplacedResource(request, route) - if (!this.isDev) { - response.cache = true - } - return response - } - - /** - * Return a resource with variables replaced where necessary. - */ - protected async getReplacedResource(request: http.IncomingMessage, route: Route): Promise { - // The first part is always the commit (for caching purposes). - const split = route.requestPath.split("/").slice(1) - - const resourcePath = path.resolve("/", ...split) - - // Make sure it's in code-server or a plugin. - const validPaths = [this.rootPath, process.env.PLUGIN_DIR] - if (!validPaths.find((p) => p && resourcePath.startsWith(p))) { - this.ensureAuthenticated(request) - } - - switch (split[split.length - 1]) { - case "manifest.json": { - const response = await this.getUtf8Resource(resourcePath) - return this.replaceTemplates(route, response) - } - } - return this.getResource(resourcePath) - } - - /** - * Tar up and stream a directory. - */ - private async getTarredResource(request: http.IncomingMessage, ...parts: string[]): Promise { - const filePath = path.join(...parts) - let stream: Readable = tarFs.pack(filePath) - const headers: http.OutgoingHttpHeaders = {} - if (request.headers["accept-encoding"] && request.headers["accept-encoding"].includes("gzip")) { - logger.debug("gzipping tar", field("filePath", filePath)) - const compress = zlib.createGzip() - stream.pipe(compress) - stream.on("error", (error) => compress.destroy(error)) - stream.on("close", () => compress.end()) - stream = compress - headers["content-encoding"] = "gzip" - } - return { stream, filePath, mime: "application/x-tar", cache: true, headers } - } -} diff --git a/src/node/app/vscode.ts b/src/node/app/vscode.ts deleted file mode 100644 index ed4f714e5a69..000000000000 --- a/src/node/app/vscode.ts +++ /dev/null @@ -1,237 +0,0 @@ -import { field, logger } from "@coder/logger" -import * as cp from "child_process" -import * as crypto from "crypto" -import * as fs from "fs-extra" -import * as http from "http" -import * as net from "net" -import * as path from "path" -import { - CodeServerMessage, - Options, - StartPath, - VscodeMessage, - VscodeOptions, - WorkbenchOptions, -} from "../../../lib/vscode/src/vs/server/ipc" -import { HttpCode, HttpError } from "../../common/http" -import { arrayify, generateUuid } from "../../common/util" -import { Args } from "../cli" -import { HttpProvider, HttpProviderOptions, HttpResponse, Route } from "../http" -import { settings } from "../settings" -import { pathToFsPath } from "../util" - -export class VscodeHttpProvider extends HttpProvider { - private readonly serverRootPath: string - private readonly vsRootPath: string - private _vscode?: Promise - - public constructor(options: HttpProviderOptions, private readonly args: Args) { - super(options) - this.vsRootPath = path.resolve(this.rootPath, "lib/vscode") - this.serverRootPath = path.join(this.vsRootPath, "out/vs/server") - } - - public get running(): boolean { - return !!this._vscode - } - - public async dispose(): Promise { - if (this._vscode) { - const vscode = await this._vscode - vscode.removeAllListeners() - this._vscode = undefined - vscode.kill() - } - } - - private async initialize(options: VscodeOptions): Promise { - const id = generateUuid() - const vscode = await this.fork() - - logger.debug("setting up vs code...") - return new Promise((resolve, reject) => { - vscode.once("message", (message: VscodeMessage) => { - logger.debug("got message from vs code", field("message", message)) - return message.type === "options" && message.id === id - ? resolve(message.options) - : reject(new Error("Unexpected response during initialization")) - }) - vscode.once("error", reject) - vscode.once("exit", (code) => reject(new Error(`VS Code exited unexpectedly with code ${code}`))) - this.send({ type: "init", id, options }, vscode) - }) - } - - private fork(): Promise { - if (!this._vscode) { - logger.debug("forking vs code...") - const vscode = cp.fork(path.join(this.serverRootPath, "fork")) - vscode.on("error", (error) => { - logger.error(error.message) - this._vscode = undefined - }) - vscode.on("exit", (code) => { - logger.error(`VS Code exited unexpectedly with code ${code}`) - this._vscode = undefined - }) - - this._vscode = new Promise((resolve, reject) => { - vscode.once("message", (message: VscodeMessage) => { - logger.debug("got message from vs code", field("message", message)) - return message.type === "ready" - ? resolve(vscode) - : reject(new Error("Unexpected response waiting for ready response")) - }) - vscode.once("error", reject) - vscode.once("exit", (code) => reject(new Error(`VS Code exited unexpectedly with code ${code}`))) - }) - } - - return this._vscode - } - - public async handleWebSocket(route: Route, request: http.IncomingMessage, socket: net.Socket): Promise { - if (!this.authenticated(request)) { - throw new Error("not authenticated") - } - - // VS Code expects a raw socket. It will handle all the web socket frames. - // We just need to handle the initial upgrade. - // This magic value is specified by the websocket spec. - const magic = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" - const reply = crypto - .createHash("sha1") - .update(request.headers["sec-websocket-key"] + magic) - .digest("base64") - socket.write( - [ - "HTTP/1.1 101 Switching Protocols", - "Upgrade: websocket", - "Connection: Upgrade", - `Sec-WebSocket-Accept: ${reply}`, - ].join("\r\n") + "\r\n\r\n", - ) - - const vscode = await this._vscode - this.send({ type: "socket", query: route.query }, vscode, socket) - } - - private send(message: CodeServerMessage, vscode?: cp.ChildProcess, socket?: net.Socket): void { - if (!vscode || vscode.killed) { - throw new Error("vscode is not running") - } - vscode.send(message, socket) - } - - public async handleRequest(route: Route, request: http.IncomingMessage): Promise { - this.ensureMethod(request) - - switch (route.base) { - case "/": - if (!this.isRoot(route)) { - throw new HttpError("Not found", HttpCode.NotFound) - } else if (!this.authenticated(request)) { - return { redirect: "/login", query: { to: route.providerBase } } - } - try { - return await this.getRoot(request, route) - } catch (error) { - const message = `
VS Code failed to load.
${ - this.isDev - ? `
It might not have finished compiling.
` + - `Check for Finished compilation in the output.` - : "" - }

${error}` - return this.getErrorRoot(route, "VS Code failed to load", "500", message) - } - } - - this.ensureAuthenticated(request) - - switch (route.base) { - case "/resource": - case "/vscode-remote-resource": - if (typeof route.query.path === "string") { - return this.getResource(pathToFsPath(route.query.path)) - } - break - case "/webview": - if (/^\/vscode-resource/.test(route.requestPath)) { - return this.getResource(route.requestPath.replace(/^\/vscode-resource(\/file)?/, "")) - } - return this.getResource(this.vsRootPath, "out/vs/workbench/contrib/webview/browser/pre", route.requestPath) - } - - throw new HttpError("Not found", HttpCode.NotFound) - } - - private async getRoot(request: http.IncomingMessage, route: Route): Promise { - const remoteAuthority = request.headers.host as string - const { lastVisited } = await settings.read() - const startPath = await this.getFirstPath([ - { url: route.query.workspace, workspace: true }, - { url: route.query.folder, workspace: false }, - this.args._ && this.args._.length > 0 ? { url: path.resolve(this.args._[this.args._.length - 1]) } : undefined, - lastVisited, - ]) - const [response, options] = await Promise.all([ - await this.getUtf8Resource(this.rootPath, "src/browser/pages/vscode.html"), - this.initialize({ - args: this.args, - remoteAuthority, - startPath, - }), - ]) - - settings.write({ - lastVisited: startPath || lastVisited, // If startpath is undefined, then fallback to lastVisited - query: route.query, - }) - - if (!this.isDev) { - response.content = response.content.replace(//g, "") - } - - options.productConfiguration.codeServerVersion = require("../../../package.json").version - - response.content = response.content - .replace(`"{{REMOTE_USER_DATA_URI}}"`, `'${JSON.stringify(options.remoteUserDataUri)}'`) - .replace(`"{{PRODUCT_CONFIGURATION}}"`, `'${JSON.stringify(options.productConfiguration)}'`) - .replace(`"{{WORKBENCH_WEB_CONFIGURATION}}"`, `'${JSON.stringify(options.workbenchWebConfiguration)}'`) - .replace(`"{{NLS_CONFIGURATION}}"`, `'${JSON.stringify(options.nlsConfiguration)}'`) - return this.replaceTemplates(route, response, { - disableTelemetry: !!this.args["disable-telemetry"], - }) - } - - /** - * Choose the first non-empty path. - */ - private async getFirstPath( - startPaths: Array<{ url?: string | string[]; workspace?: boolean } | undefined>, - ): Promise { - const isFile = async (path: string): Promise => { - try { - const stat = await fs.stat(path) - return stat.isFile() - } catch (error) { - logger.warn(error.message) - return false - } - } - for (let i = 0; i < startPaths.length; ++i) { - const startPath = startPaths[i] - const url = arrayify(startPath && startPath.url).find((p) => !!p) - if (startPath && url) { - return { - url, - // The only time `workspace` is undefined is for the command-line - // argument, in which case it's a path (not a URL) so we can stat it - // without having to parse it. - workspace: typeof startPath.workspace !== "undefined" ? startPath.workspace : await isFile(url), - } - } - } - return undefined - } -} diff --git a/src/node/cli.ts b/src/node/cli.ts index 22c65dbf012d..0fce9cfbf25f 100644 --- a/src/node/cli.ts +++ b/src/node/cli.ts @@ -1,11 +1,19 @@ import { field, Level, logger } from "@coder/logger" -import * as fs from "fs-extra" -import yaml from "js-yaml" -import * as os from "os" +import { promises as fs } from "fs" +import { load } from "js-yaml" import * as path from "path" -import { Args as VsArgs } from "../../lib/vscode/src/vs/server/ipc" -import { AuthType } from "./http" -import { generatePassword, humanPath, paths } from "./util" +import { generateCertificate, generatePassword, paths, splitOnFirstEquals } from "./util" +import { EditorSessionManagerClient } from "./vscodeSocket" + +export enum Feature { + // No current experimental features! + Placeholder = "placeholder", +} + +export enum AuthType { + Password = "password", + None = "none", +} export class Optional { public constructor(public readonly value?: T) {} @@ -21,30 +29,74 @@ export enum LogLevel { export class OptionalString extends Optional {} -export interface Args extends VsArgs { - readonly config?: string - readonly auth?: AuthType - readonly password?: string - readonly cert?: OptionalString - readonly "cert-key"?: string - readonly "disable-telemetry"?: boolean - readonly help?: boolean - readonly host?: string - readonly json?: boolean +/** + * (VS) Code flags provided by the user. + */ +export interface UserProvidedCodeArgs { + "disable-telemetry"?: boolean + force?: boolean + "user-data-dir"?: string + "enable-proposed-api"?: string[] + "extensions-dir"?: string + "builtin-extensions-dir"?: string + "install-extension"?: string[] + "uninstall-extension"?: string[] + "list-extensions"?: boolean + "locate-extension"?: string[] + "show-versions"?: boolean + category?: string + "github-auth"?: string + "disable-update-check"?: boolean + "disable-file-downloads"?: boolean + "disable-file-uploads"?: boolean + "disable-workspace-trust"?: boolean + "disable-getting-started-override"?: boolean + "disable-proxy"?: boolean + "session-socket"?: string + "link-protection-trusted-domains"?: string[] + // locale is used by both VS Code and code-server. + locale?: string +} + +/** + * Arguments that the user explicitly provided on the command line. All + * arguments must be optional. + * + * For arguments with defaults see DefaultedArgs. + */ +export interface UserProvidedArgs extends UserProvidedCodeArgs { + config?: string + auth?: AuthType + password?: string + "hashed-password"?: string + cert?: OptionalString + "cert-host"?: string + "cert-key"?: string + enable?: string[] + help?: boolean + host?: string + port?: number + json?: boolean log?: LogLevel - readonly open?: boolean - readonly port?: number - readonly "bind-addr"?: string - readonly socket?: string - readonly version?: boolean - readonly force?: boolean - readonly "list-extensions"?: boolean - readonly "install-extension"?: string[] - readonly "show-versions"?: boolean - readonly "uninstall-extension"?: string[] - readonly "proxy-domain"?: string[] - readonly locale?: string - readonly _: string[] + open?: boolean + "bind-addr"?: string + socket?: string + "socket-mode"?: string + "trusted-origins"?: string[] + version?: boolean + "proxy-domain"?: string[] + "skip-auth-preflight"?: boolean + "reuse-window"?: boolean + "new-window"?: boolean + "ignore-last-opened"?: boolean + verbose?: boolean + "app-name"?: string + "welcome-text"?: string + "abs-proxy-base-path"?: string + i18n?: string + "idle-timeout-seconds"?: number + /* Positional arguments. */ + _?: string[] } interface Option { @@ -61,43 +113,103 @@ interface Option { * Description of the option. Leave blank to hide the option. */ description?: string + + /** + * If marked as deprecated, the option is marked as deprecated in help. + */ + deprecated?: boolean } type OptionType = T extends boolean ? "boolean" : T extends OptionalString - ? typeof OptionalString - : T extends LogLevel - ? typeof LogLevel - : T extends AuthType - ? typeof AuthType - : T extends number - ? "number" - : T extends string - ? "string" - : T extends string[] - ? "string[]" - : "unknown" - -type Options = { + ? typeof OptionalString + : T extends LogLevel + ? typeof LogLevel + : T extends AuthType + ? typeof AuthType + : T extends number + ? "number" + : T extends string + ? "string" + : T extends string[] + ? "string[]" + : "unknown" + +export type Options = { [P in keyof T]: Option> } -const options: Options> = { +export const options: Options> = { auth: { type: AuthType, description: "The type of authentication to use." }, password: { type: "string", description: "The password for password authentication (can only be passed in via $PASSWORD or the config file).", }, + "hashed-password": { + type: "string", + description: + "The password hashed with argon2 for password authentication (can only be passed in via $HASHED_PASSWORD or the config file). \n" + + "Takes precedence over 'password'.", + }, cert: { type: OptionalString, path: true, - description: "Path to certificate. Generated if no path is provided.", + description: "Path to certificate. A self signed certificate is generated if none is provided.", + }, + "cert-host": { + type: "string", + description: "Hostname to use when generating a self signed certificate.", }, "cert-key": { type: "string", path: true, description: "Path to certificate key when using non-generated cert." }, "disable-telemetry": { type: "boolean", description: "Disable telemetry." }, + "disable-update-check": { + type: "boolean", + description: + "Disable update check. Without this flag, code-server checks every 6 hours against the latest github release and \n" + + "then notifies you once every week that a new release is available.", + }, + "session-socket": { + type: "string", + }, + "disable-file-downloads": { + type: "boolean", + description: + "Disable file downloads from Code. This can also be set with CS_DISABLE_FILE_DOWNLOADS set to 'true' or '1'.", + }, + "disable-file-uploads": { + type: "boolean", + description: "Disable file uploads.", + }, + "disable-workspace-trust": { + type: "boolean", + description: "Disable Workspace Trust feature. This switch only affects the current session.", + }, + "disable-getting-started-override": { + type: "boolean", + description: "Disable the coder/coder override in the Help: Getting Started page.", + }, + "disable-proxy": { + type: "boolean", + description: "Disable domain and path proxy routes.", + }, + // --enable can be used to enable experimental features. These features + // provide no guarantees. + enable: { type: "string[]" }, help: { type: "boolean", short: "h", description: "Show this output." }, json: { type: "boolean" }, + "link-protection-trusted-domains": { + type: "string[]", + description: "Links matching a trusted domain can be opened without link protection.", + }, + locale: { + // The preferred way to set the locale is via the UI. + type: "string", + description: ` + Set vscode display language and language to show on the login page, more info see + https://en.wikipedia.org/wiki/IETF_language_tag + `, + }, open: { type: "boolean", description: "Open in browser on startup. Does not work remotely." }, "bind-addr": { @@ -115,32 +227,91 @@ const options: Options> = { port: { type: "number", description: "" }, socket: { type: "string", path: true, description: "Path to a socket (bind-addr will be ignored)." }, + "socket-mode": { type: "string", description: "File mode of the socket." }, + "trusted-origins": { + type: "string[]", + description: + "Disables authenticate origin check for trusted origin. Useful if not able to access reverse proxy configuration.", + }, version: { type: "boolean", short: "v", description: "Display version information." }, _: { type: "string[]" }, "user-data-dir": { type: "string", path: true, description: "Path to the user data directory." }, "extensions-dir": { type: "string", path: true, description: "Path to the extensions directory." }, "builtin-extensions-dir": { type: "string", path: true }, - "extra-extensions-dir": { type: "string[]", path: true }, - "extra-builtin-extensions-dir": { type: "string[]", path: true }, "list-extensions": { type: "boolean", description: "List installed VS Code extensions." }, force: { type: "boolean", description: "Avoid prompts when installing VS Code extensions." }, + "locate-extension": { type: "string[]" }, + category: { type: "string" }, "install-extension": { type: "string[]", description: - "Install or update a VS Code extension by id or vsix. The identifier of an extension is `${publisher}.${name}`. To install a specific version provide `@${version}`. For example: 'vscode.csharp@1.2.3'.", + "Install or update a VS Code extension by id or vsix. The identifier of an extension is `${publisher}.${name}`.\n" + + "To install a specific version provide `@${version}`. For example: 'vscode.csharp@1.2.3'.", + }, + "enable-proposed-api": { + type: "string[]", + description: + "Enable proposed API features for extensions. Can receive one or more extension IDs to enable individually.", }, "uninstall-extension": { type: "string[]", description: "Uninstall a VS Code extension by id." }, "show-versions": { type: "boolean", description: "Show VS Code extension versions." }, + "github-auth": { + type: "string", + description: "GitHub authentication token (can only be passed in via $GITHUB_TOKEN or the config file).", + }, "proxy-domain": { type: "string[]", description: "Domain used for proxying ports." }, + "skip-auth-preflight": { + type: "boolean", + description: "Allows preflight requests through proxy without authentication.", + }, + "ignore-last-opened": { + type: "boolean", + short: "e", + description: "Ignore the last opened directory or workspace in favor of an empty window.", + }, + "new-window": { + type: "boolean", + short: "n", + description: "Force to open a new window.", + }, + "reuse-window": { + type: "boolean", + short: "r", + description: "Force to open a file or folder in an already opened window.", + }, - locale: { type: "string" }, log: { type: LogLevel }, verbose: { type: "boolean", short: "vvv", description: "Enable verbose logging." }, + "app-name": { + type: "string", + short: "an", + description: + "Will replace the {{app}} placeholder in any strings, which by default includes the title bar and welcome message", + }, + "welcome-text": { + type: "string", + short: "w", + description: "Text to show on login page", + deprecated: true, + }, + "abs-proxy-base-path": { + type: "string", + description: "The base path to prefix to all absproxy requests", + }, + i18n: { + type: "string", + path: true, + description: "Path to JSON file with custom translations. Merges with default strings and supports all i18n keys.", + }, + "idle-timeout-seconds": { + type: "number", + description: "Timeout in seconds to wait before shutting down when idle.", + }, } -export const optionDescriptions = (): string[] => { - const entries = Object.entries(options).filter(([, v]) => !!v.description) +export const optionDescriptions = (opts: Partial>> = options): string[] => { + const entries = Object.entries(opts).filter(([, v]) => !!v.description) const widths = entries.reduce( (prev, [k, v]) => ({ long: k.length > prev.long ? k.length : prev.long, @@ -148,28 +319,45 @@ export const optionDescriptions = (): string[] => { }), { short: 0, long: 0 }, ) - return entries.map( - ([k, v]) => - `${" ".repeat(widths.short - (v.short ? v.short.length : 0))}${v.short ? `-${v.short}` : " "} --${k}${" ".repeat( - widths.long - k.length, - )} ${v.description}${typeof v.type === "object" ? ` [${Object.values(v.type).join(", ")}]` : ""}`, - ) + return entries.map(([k, v]) => { + const help = `${" ".repeat(widths.short - (v.short ? v.short.length : 0))}${v.short ? `-${v.short}` : " "} --${k} ` + return ( + help + + v.description + ?.trim() + .split(/\n/) + .map((line, i) => { + line = line.trim() + if (i === 0) { + return " ".repeat(widths.long - k.length) + (v.deprecated ? "(deprecated) " : "") + line + } + return " ".repeat(widths.long + widths.short + 6) + line + }) + .join("\n") + + (typeof v.type === "object" ? ` [${Object.values(v.type).join(", ")}]` : "") + ) + }) } +/** + * Parse arguments into UserProvidedArgs. This should not go beyond checking + * that arguments are valid types and have values when required. + */ export const parse = ( argv: string[], opts?: { - configFile: string + configFile?: string }, -): Args => { +): UserProvidedArgs => { const error = (msg: string): Error => { if (opts?.configFile) { msg = `error reading ${opts.configFile}: ${msg}` } + return new Error(msg) } - const args: Args = { _: [] } + const args: UserProvidedArgs = {} let ended = false for (let i = 0; i < argv.length; ++i) { @@ -183,17 +371,17 @@ export const parse = ( // Options start with a dash and require a value if non-boolean. if (!ended && arg.startsWith("-")) { - let key: keyof Args | undefined + let key: keyof UserProvidedArgs | undefined let value: string | undefined if (arg.startsWith("--")) { - const split = arg.replace(/^--/, "").split("=", 2) - key = split[0] as keyof Args + const split = splitOnFirstEquals(arg.replace(/^--/, "")) + key = split[0] as keyof UserProvidedArgs value = split[1] } else { const short = arg.replace(/^-/, "") const pair = Object.entries(options).find(([, v]) => v.short === short) if (pair) { - key = pair[0] as keyof Args + key = pair[0] as keyof UserProvidedArgs } } @@ -205,6 +393,18 @@ export const parse = ( throw new Error("--password can only be set in the config file or passed in via $PASSWORD") } + if (key === "hashed-password" && !opts?.configFile) { + throw new Error("--hashed-password can only be set in the config file or passed in via $HASHED_PASSWORD") + } + + if (key === "github-auth" && !opts?.configFile) { + throw new Error("--github-auth can only be set in the config file or passed in via $GITHUB_TOKEN") + } + + if (key === "idle-timeout-seconds" && Number(value) <= 60) { + throw new Error("--idle-timeout-seconds must be greater than 60 seconds.") + } + const option = options[key] if (option.type === "boolean") { ;(args[key] as boolean) = true @@ -264,10 +464,78 @@ export const parse = ( } // Everything else goes into _. + if (typeof args._ === "undefined") { + args._ = [] + } + args._.push(arg) } - logger.debug("parsed command line", field("args", args)) + // If a cert was provided a key must also be provided. + if (args.cert && args.cert.value && !args["cert-key"]) { + throw new Error("--cert-key is missing") + } + + logger.debug(() => [`parsed ${opts?.configFile ? "config" : "command line"}`, field("args", redactArgs(args))]) + + return args +} + +/** + * Redact sensitive information from arguments for logging. + */ +export const redactArgs = (args: UserProvidedArgs): UserProvidedArgs => { + return { + ...args, + password: args.password ? "" : undefined, + "hashed-password": args["hashed-password"] ? "" : undefined, + "github-auth": args["github-auth"] ? "" : undefined, + } +} + +/** + * User-provided arguments with defaults. The distinction between user-provided + * args and defaulted args exists so we can tell the difference between end + * values and what the user actually provided on the command line. + */ +export interface DefaultedArgs extends ConfigArgs { + auth: AuthType + cert?: { + value: string + } + host: string + port: number + "proxy-domain": string[] + verbose: boolean + usingEnvPassword: boolean + usingEnvHashedPassword: boolean + "extensions-dir": string + "user-data-dir": string + "session-socket": string + /* Positional arguments. */ + _: string[] +} + +/** + * Take CLI and config arguments (optional) and return a single set of arguments + * with the defaults set. Arguments from the CLI are prioritized over config + * arguments. + */ +export async function setDefaults(cliArgs: UserProvidedArgs, configArgs?: ConfigArgs): Promise { + const args = Object.assign({}, configArgs || {}, cliArgs) + + if (!args["user-data-dir"]) { + args["user-data-dir"] = paths.data + } + + if (!args["extensions-dir"]) { + args["extensions-dir"] = path.join(args["user-data-dir"], "extensions") + } + + if (!args["session-socket"]) { + args["session-socket"] = path.join(args["user-data-dir"], "code-server-ipc.sock") + } + process.env.CODE_SERVER_SESSION_SOCKET = args["session-socket"] // --verbose takes priority over --log and --log takes priority over the // environment variable. @@ -299,7 +567,7 @@ export const parse = ( args.verbose = false break case LogLevel.Warn: - logger.level = Level.Warning + logger.level = Level.Warn args.verbose = false break case LogLevel.Error: @@ -308,38 +576,126 @@ export const parse = ( break } - return args -} + // Default to using a password. + if (!args.auth) { + args.auth = AuthType.Password + } -export async function setDefaults(args: Args): Promise { - args = { ...args } + const addr = bindAddrFromAllSources(configArgs || {}, cliArgs) + args.host = addr.host + args.port = addr.port - if (!args["user-data-dir"]) { - await copyOldMacOSDataDir() - args["user-data-dir"] = paths.data + if (args.cert && !args.cert.value) { + const { cert, certKey } = await generateCertificate(args["cert-host"] || "localhost") + args.cert = { + value: cert, + } + args["cert-key"] = certKey } - if (!args["extensions-dir"]) { - args["extensions-dir"] = path.join(args["user-data-dir"], "extensions") + let usingEnvPassword = !!process.env.PASSWORD + if (process.env.PASSWORD) { + args.password = process.env.PASSWORD } - return args + if (process.env.CS_DISABLE_FILE_DOWNLOADS?.match(/^(1|true)$/)) { + args["disable-file-downloads"] = true + } + + if (process.env.CS_DISABLE_GETTING_STARTED_OVERRIDE?.match(/^(1|true)$/)) { + args["disable-getting-started-override"] = true + } + + if (process.env.CS_DISABLE_PROXY?.match(/^(1|true)$/)) { + args["disable-proxy"] = true + } + + const usingEnvHashedPassword = !!process.env.HASHED_PASSWORD + if (process.env.HASHED_PASSWORD) { + args["hashed-password"] = process.env.HASHED_PASSWORD + usingEnvPassword = false + } + + if (process.env.GITHUB_TOKEN) { + args["github-auth"] = process.env.GITHUB_TOKEN + } + + if (process.env.CODE_SERVER_IDLE_TIMEOUT_SECONDS) { + if (isNaN(Number(process.env.CODE_SERVER_IDLE_TIMEOUT_SECONDS))) { + logger.info("CODE_SERVER_IDLE_TIMEOUT_SECONDS must be a number") + } + if (Number(process.env.CODE_SERVER_IDLE_TIMEOUT_SECONDS) <= 60) { + throw new Error("--idle-timeout-seconds must be greater than 60 seconds.") + } + args["idle-timeout-seconds"] = Number(process.env.CODE_SERVER_IDLE_TIMEOUT_SECONDS) + } + + // Ensure they're not readable by child processes. + delete process.env.PASSWORD + delete process.env.HASHED_PASSWORD + delete process.env.GITHUB_TOKEN + + // Filter duplicate proxy domains and remove any leading `*.`. + const proxyDomains = new Set((args["proxy-domain"] || []).map((d) => d.replace(/^\*\./, ""))) + const finalProxies = [] + + for (const proxyDomain of proxyDomains) { + if (!proxyDomain.includes("{{port}}")) { + finalProxies.push("{{port}}." + proxyDomain) + } else { + finalProxies.push(proxyDomain) + } + } + + // all proxies are of format anyprefix-{{port}}-anysuffix.{{host}}, where {{host}} is optional + // e.g. code-8080.domain.tld would match for code-{{port}}.domain.tld and code-{{port}}.{{host}} + if (finalProxies.length > 0 && !process.env.VSCODE_PROXY_URI) { + process.env.VSCODE_PROXY_URI = `//${finalProxies[0]}` + } + args["proxy-domain"] = finalProxies + + args._ = getResolvedPathsFromArgs(args) + + return { + ...args, + usingEnvPassword, + usingEnvHashedPassword, + } as DefaultedArgs // TODO: Technically no guarantee this is fulfilled. +} + +export function getResolvedPathsFromArgs(args: UserProvidedArgs): string[] { + return (args._ ?? []).map((p) => path.resolve(p)) } -async function defaultConfigFile(): Promise { +/** + * Helper function to return the default config file. + * + * @param {string} password - Password passed in (usually from generatePassword()) + * @returns The default config file: + * + * - bind-addr: 127.0.0.1:8080 + * - auth: password + * - password: + * - cert: false + */ +export function defaultConfigFile(password: string): string { return `bind-addr: 127.0.0.1:8080 auth: password -password: ${await generatePassword()} +password: ${password} cert: false ` } +interface ConfigArgs extends UserProvidedArgs { + config: string +} + /** * Reads the code-server yaml config file and returns it as Args. * * @param configPath Read the config from configPath instead of $CODE_SERVER_CONFIG or the default. */ -export async function readConfigFile(configPath?: string): Promise { +export async function readConfigFile(configPath?: string): Promise { if (!configPath) { configPath = process.env.CODE_SERVER_CONFIG if (!configPath) { @@ -347,28 +703,53 @@ export async function readConfigFile(configPath?: string): Promise { } } - if (!(await fs.pathExists(configPath))) { - await fs.outputFile(configPath, await defaultConfigFile()) - logger.info(`Wrote default config file to ${humanPath(configPath)}`) + await fs.mkdir(path.dirname(configPath), { recursive: true }) + + try { + const generatedPassword = await generatePassword() + await fs.writeFile(configPath, defaultConfigFile(generatedPassword), { + flag: "wx", // wx means to fail if the path exists. + }) + logger.info(`Wrote default config file to ${configPath}`) + } catch (error: any) { + // EEXIST is fine; we don't want to overwrite existing configurations. + if (error.code !== "EEXIST") { + throw error + } } - if (!process.env.CODE_SERVER_PARENT_PID) { - logger.info(`Using config file ${humanPath(configPath)}`) + const configFile = await fs.readFile(configPath, "utf8") + return parseConfigFile(configFile, configPath) +} + +/** + * parseConfigFile parses configFile into ConfigArgs. + * configPath is used as the filename in error messages + */ +export function parseConfigFile(configFile: string, configPath: string): ConfigArgs { + if (!configFile) { + return { config: configPath } } - const configFile = await fs.readFile(configPath) - const config = yaml.safeLoad(configFile.toString(), { + const config = load(configFile, { filename: configPath, }) + if (!config || typeof config === "string") { + throw new Error(`invalid config: ${config}`) + } // We convert the config file into a set of flags. // This is a temporary measure until we add a proper CLI library. - const configFileArgv = Object.entries(config).map(([optName, opt]) => { - if (opt === true) { - return `--${optName}` - } - return `--${optName}=${opt}` - }) + const configFileArgv = Object.entries(config) + .map(([optName, opt]) => { + if (opt === true) { + return `--${optName}` + } else if (Array.isArray(opt)) { + return opt.map((o) => `--${optName}=${o}`) + } + return `--${optName}=${opt}` + }) + .flat() const args = parse(configFileArgv, { configFile: configPath, }) @@ -378,9 +759,15 @@ export async function readConfigFile(configPath?: string): Promise { } } -function parseBindAddr(bindAddr: string): [string, number] { +function parseBindAddr(bindAddr: string): Addr { const u = new URL(`http://${bindAddr}`) - return [u.hostname, parseInt(u.port, 10)] + return { + host: u.hostname, + // With the http scheme 80 will be dropped so assume it's 80 if missing. + // This means --bind-addr without a port will default to 80 as well + // and not the code-server default. + port: u.port ? parseInt(u.port, 10) : 80, + } } interface Addr { @@ -388,10 +775,17 @@ interface Addr { port: number } -function bindAddrFromArgs(addr: Addr, args: Args): Addr { +/** + * This function creates the bind address + * using the CLI args. + */ +export function bindAddrFromArgs(addr: Addr, args: UserProvidedArgs): Addr { addr = { ...addr } if (args["bind-addr"]) { - ;[addr.host, addr.port] = parseBindAddr(args["bind-addr"]) + addr = parseBindAddr(args["bind-addr"]) + } + if (process.env.CODE_SERVER_HOST) { + addr.host = process.env.CODE_SERVER_HOST } if (args.host) { addr.host = args.host @@ -406,29 +800,101 @@ function bindAddrFromArgs(addr: Addr, args: Args): Addr { return addr } -export function bindAddrFromAllSources(cliArgs: Args, configArgs: Args): [string, number] { +function bindAddrFromAllSources(...argsConfig: UserProvidedArgs[]): Addr { let addr: Addr = { host: "localhost", port: 8080, } - addr = bindAddrFromArgs(addr, configArgs) - addr = bindAddrFromArgs(addr, cliArgs) + for (const args of argsConfig) { + addr = bindAddrFromArgs(addr, args) + } - return [addr.host, addr.port] + return addr } -async function copyOldMacOSDataDir(): Promise { - if (os.platform() !== "darwin") { - return +/** + * Determine if it looks like the user is trying to open a file or folder in an + * existing instance. The arguments here should be the arguments the user + * explicitly passed on the command line, *NOT DEFAULTS* or the configuration. + */ +export const shouldOpenInExistingInstance = async ( + args: UserProvidedArgs, + sessionSocket: string, +): Promise => { + // Always use the existing instance if we're running from VS Code's terminal. + if (process.env.VSCODE_IPC_HOOK_CLI) { + logger.debug("Found VSCODE_IPC_HOOK_CLI") + return process.env.VSCODE_IPC_HOOK_CLI } - if (await fs.pathExists(paths.data)) { - return + + const paths = getResolvedPathsFromArgs(args) + const client = new EditorSessionManagerClient(sessionSocket) + + // If these flags are set then assume the user is trying to open in an + // existing instance since these flags have no effect otherwise. That means + // if there is no existing instance we should error rather than falling back + // to spawning code-server normally. + const openInFlagCount = ["reuse-window", "new-window"].reduce((prev, cur) => { + return args[cur as keyof UserProvidedArgs] ? prev + 1 : prev + }, 0) + if (openInFlagCount > 0) { + logger.debug("Found --reuse-window or --new-window") + const socketPath = await client.getConnectedSocketPath(paths[0]) + if (!socketPath) { + throw new Error(`No opened code-server instances found to handle ${paths[0]}`) + } + return socketPath + } + + // It's possible the user is trying to spawn another instance of code-server. + // 1. Check if any unrelated flags are set (this should only run when + // code-server is invoked exactly like this: `code-server my-file`). + // 2. That a file or directory was passed. + // 3. That the socket is active. + // 4. That an instance exists to handle the path (implied by #3). + if (Object.keys(args).length === 1 && typeof args._ !== "undefined" && args._.length > 0) { + if (!(await client.canConnect())) { + return undefined + } + const socketPath = await client.getConnectedSocketPath(paths[0]) + if (socketPath) { + logger.debug("Found existing code-server socket") + return socketPath + } } - // If the old data directory exists, we copy it in. - const oldDataDir = path.join(os.homedir(), "Library/Application Support", "code-server") - if (await fs.pathExists(oldDataDir)) { - await fs.copy(oldDataDir, paths.data) + return undefined +} + +/** + * Arguments for running Code's server. + * + * A subset of ../../lib/vscode/src/vs/server/node/serverEnvironmentService.ts:90 + */ +export interface CodeArgs extends UserProvidedCodeArgs { + "accept-server-license-terms"?: boolean + "connection-token"?: string + help: boolean + port?: string + version: boolean + "without-connection-token"?: boolean + "without-browser-env-var"?: boolean + compatibility?: string + log?: string[] +} + +/** + * Convert our arguments to equivalent VS Code server arguments. + * Does not add any extra arguments. + */ +export const toCodeArgs = async (args: DefaultedArgs): Promise => { + return { + ...args, + /** Type casting. */ + help: !!args.help, + version: !!args.version, + port: args.port?.toString(), + log: args.log ? [args.log] : undefined, } } diff --git a/src/node/constants.ts b/src/node/constants.ts new file mode 100644 index 000000000000..bb6873dfa113 --- /dev/null +++ b/src/node/constants.ts @@ -0,0 +1,48 @@ +import { logger } from "@coder/logger" +import type { JSONSchemaForNPMPackageJsonFiles } from "@schemastore/package" +import * as os from "os" +import * as path from "path" + +export function getPackageJson(relativePath: string): JSONSchemaForNPMPackageJsonFiles { + let pkg = {} + try { + pkg = require(relativePath) + } catch (error: any) { + logger.warn(error.message) + } + + return pkg +} + +export const rootPath = path.resolve(__dirname, "../..") +export const vsRootPath = path.join(rootPath, "lib/vscode") +const PACKAGE_JSON = "package.json" +const pkg = getPackageJson(`${rootPath}/${PACKAGE_JSON}`) +const codePkg = getPackageJson(`${vsRootPath}/${PACKAGE_JSON}`) || { version: "0.0.0" } +export const version = pkg.version || "development" +export const commit = pkg.commit || "development" +export const codeVersion = codePkg.version || "development" +export const tmpdir = path.join(os.tmpdir(), "code-server") +export const isDevMode = commit === "development" +export const httpProxyUri = + process.env.HTTPS_PROXY || process.env.https_proxy || process.env.HTTP_PROXY || process.env.http_proxy + +/** + * getVersionString returns a human-readable version string suitable + * for outputting to the console. + */ +export function getVersionString(): string { + return [version, commit, "with Code", codeVersion].join(" ") +} + +/** + * getVersionJsonString returns a machine-readable version string + * suitable for outputting to the console. + */ +export function getVersionJsonString(): string { + return JSON.stringify({ + codeServer: version, + commit, + vscode: codeVersion, + }) +} diff --git a/src/node/entry.ts b/src/node/entry.ts index 256fc63b45a1..749b6e966cbc 100644 --- a/src/node/entry.ts +++ b/src/node/entry.ts @@ -1,192 +1,66 @@ -import { field, logger } from "@coder/logger" -import * as cp from "child_process" -import * as path from "path" -import { CliMessage } from "../../lib/vscode/src/vs/server/ipc" -import { plural } from "../common/util" -import { LoginHttpProvider } from "./app/login" -import { ProxyHttpProvider } from "./app/proxy" -import { StaticHttpProvider } from "./app/static" -import { UpdateHttpProvider } from "./app/update" -import { VscodeHttpProvider } from "./app/vscode" -import { Args, bindAddrFromAllSources, optionDescriptions, parse, readConfigFile, setDefaults } from "./cli" -import { AuthType, HttpServer, HttpServerOptions } from "./http" -import { loadPlugins } from "./plugin" -import { generateCertificate, hash, humanPath, open } from "./util" -import { ipcMain, wrap } from "./wrapper" - -process.on("uncaughtException", (error) => { - logger.error(`Uncaught exception: ${error.message}`) - if (typeof error.stack !== "undefined") { - logger.error(error.stack) - } -}) - -let pkg: { version?: string; commit?: string } = {} -try { - pkg = require("../../package.json") -} catch (error) { - logger.warn(error.message) -} - -const version = pkg.version || "development" -const commit = pkg.commit || "development" - -const main = async (args: Args, cliArgs: Args, configArgs: Args): Promise => { - if (!args.auth) { - args = { - ...args, - auth: AuthType.Password, - } - } - - logger.info(`Using user-data-dir ${humanPath(args["user-data-dir"])}`) - - logger.trace(`Using extensions-dir ${humanPath(args["extensions-dir"])}`) - - const envPassword = !!process.env.PASSWORD - const password = args.auth === AuthType.Password && (process.env.PASSWORD || args.password) - if (args.auth === AuthType.Password && !password) { - throw new Error("Please pass in a password via the config file or $PASSWORD") - } - const [host, port] = bindAddrFromAllSources(cliArgs, configArgs) - - // Spawn the main HTTP server. - const options: HttpServerOptions = { - auth: args.auth, - commit, - host: host, - // The hash does not add any actual security but we do it for obfuscation purposes. - password: password ? hash(password) : undefined, - port: port, - proxyDomains: args["proxy-domain"], - socket: args.socket, - ...(args.cert && !args.cert.value - ? await generateCertificate() - : { - cert: args.cert && args.cert.value, - certKey: args["cert-key"], - }), - } - - if (options.cert && !options.certKey) { - throw new Error("--cert-key is missing") - } - - const httpServer = new HttpServer(options) - httpServer.registerHttpProvider(["/", "/vscode"], VscodeHttpProvider, args) - httpServer.registerHttpProvider("/update", UpdateHttpProvider, false) - httpServer.registerHttpProvider("/proxy", ProxyHttpProvider) - httpServer.registerHttpProvider("/login", LoginHttpProvider, args.config!, envPassword) - httpServer.registerHttpProvider("/static", StaticHttpProvider) - - await loadPlugins(httpServer, args) - - ipcMain().onDispose(() => { - httpServer.dispose().then((errors) => { - errors.forEach((error) => logger.error(error.message)) - }) - }) - - logger.info(`code-server ${version} ${commit}`) - const serverAddress = await httpServer.listen() - logger.info(`HTTP server listening on ${serverAddress}`) - - if (args.auth === AuthType.Password) { - if (envPassword) { - logger.info(" - Using password from $PASSWORD") - } else { - logger.info(` - Using password from ${humanPath(args.config)}`) - } - logger.info(" - To disable use `--auth none`") - } else { - logger.info(" - No authentication") - } - delete process.env.PASSWORD - - if (httpServer.protocol === "https") { - logger.info( - args.cert && args.cert.value - ? ` - Using provided certificate and key for HTTPS` - : ` - Using generated certificate and key for HTTPS`, - ) - } else { - logger.info(" - Not serving HTTPS") - } - - if (httpServer.proxyDomains.size > 0) { - logger.info(` - ${plural(httpServer.proxyDomains.size, "Proxying the following domain")}:`) - httpServer.proxyDomains.forEach((domain) => logger.info(` - *.${domain}`)) - } - - if (serverAddress && !options.socket && args.open) { - // The web socket doesn't seem to work if browsing with 0.0.0.0. - const openAddress = serverAddress.replace(/:\/\/0.0.0.0/, "://localhost") - await open(openAddress).catch(console.error) - logger.info(`Opened ${openAddress}`) - } -} +import { logger } from "@coder/logger" +import { optionDescriptions, parse, readConfigFile, setDefaults, shouldOpenInExistingInstance } from "./cli" +import { getVersionString, getVersionJsonString } from "./constants" +import { openInExistingInstance, runCodeServer, runCodeCli, shouldSpawnCliProcess } from "./main" +import { isChild, wrapper } from "./wrapper" async function entry(): Promise { - const tryParse = async (): Promise<[Args, Args, Args]> => { - try { - const cliArgs = parse(process.argv.slice(2)) - const configArgs = await readConfigFile(cliArgs.config) - // This prioritizes the flags set in args over the ones in the config file. - let args = Object.assign(configArgs, cliArgs) - args = await setDefaults(args) - return [args, cliArgs, configArgs] - } catch (error) { - console.error(error.message) - process.exit(1) - } + // There's no need to check flags like --help or to spawn in an existing + // instance for the child process because these would have already happened in + // the parent and the child wouldn't have been spawned. We also get the + // arguments from the parent so we don't have to parse twice and to account + // for environment manipulation (like how PASSWORD gets removed to avoid + // leaking to child processes). + if (isChild(wrapper)) { + const args = await wrapper.handshake() + wrapper.preventExit() + const server = await runCodeServer(args) + wrapper.onDispose(() => server.dispose()) + return } - const [args, cliArgs, configArgs] = await tryParse() + const cliArgs = parse(process.argv.slice(2)) + const configArgs = await readConfigFile(cliArgs.config) + const args = await setDefaults(cliArgs, configArgs) + if (args.help) { - console.log("code-server", version, commit) + console.log("code-server", getVersionString()) console.log("") console.log(`Usage: code-server [options] [path]`) + console.log(` - Opening a directory: code-server ./path/to/your/project`) + console.log(` - Opening a saved workspace: code-server ./path/to/your/project.code-workspace`) console.log("") console.log("Options") optionDescriptions().forEach((description) => { console.log("", description) }) - } else if (args.version) { + return + } + + if (args.version) { if (args.json) { - console.log({ - codeServer: version, - commit, - vscode: require("../../lib/vscode/package.json").version, - }) + console.log(getVersionJsonString()) } else { - console.log(version, commit) + console.log(getVersionString()) } - process.exit(0) - } else if (args["list-extensions"] || args["install-extension"] || args["uninstall-extension"]) { - logger.debug("forking vs code cli...") - const vscode = cp.fork(path.resolve(__dirname, "../../lib/vscode/out/vs/server/fork"), [], { - env: { - ...process.env, - CODE_SERVER_PARENT_PID: process.pid.toString(), - }, - }) - vscode.once("message", (message) => { - logger.debug("Got message from VS Code", field("message", message)) - if (message.type !== "ready") { - logger.error("Unexpected response waiting for ready response") - process.exit(1) - } - const send: CliMessage = { type: "cli", args } - vscode.send(send) - }) - vscode.once("error", (error) => { - logger.error(error.message) - process.exit(1) - }) - vscode.on("exit", (code) => process.exit(code || 0)) - } else { - wrap(() => main(args, cliArgs, configArgs)) + return } + + if (shouldSpawnCliProcess(args)) { + logger.debug("Found VS Code arguments; spawning VS Code CLI") + return runCodeCli(args) + } + + const socketPath = await shouldOpenInExistingInstance(cliArgs, args["session-socket"]) + if (socketPath) { + logger.debug("Trying to open in existing instance") + return openInExistingInstance(args, socketPath) + } + + return wrapper.start(args) } -entry() +entry().catch((error) => { + logger.error(error.message) + wrapper.exit(error) +}) diff --git a/src/node/heart.ts b/src/node/heart.ts new file mode 100644 index 000000000000..b78f4edb80d2 --- /dev/null +++ b/src/node/heart.ts @@ -0,0 +1,82 @@ +import { logger } from "@coder/logger" +import { promises as fs } from "fs" +import { Emitter } from "../common/emitter" + +/** + * Provides a heartbeat using a local file to indicate activity. + */ +export class Heart { + private heartbeatTimer?: NodeJS.Timeout + private heartbeatInterval = 60000 + public lastHeartbeat = 0 + private readonly _onChange = new Emitter<"alive" | "expired" | "unknown">() + readonly onChange = this._onChange.event + private state: "alive" | "expired" | "unknown" = "expired" + + public constructor( + private readonly heartbeatPath: string, + private readonly isActive: () => Promise, + ) { + this.beat = this.beat.bind(this) + this.alive = this.alive.bind(this) + } + + private setState(state: typeof this.state) { + if (this.state !== state) { + this.state = state + this._onChange.emit(this.state) + } + } + + public alive(): boolean { + const now = Date.now() + return now - this.lastHeartbeat < this.heartbeatInterval + } + /** + * Write to the heartbeat file if we haven't already done so within the + * timeout and start or reset a timer that keeps running as long as there is + * activity. Failures are logged as warnings. + */ + public async beat(): Promise { + if (this.alive()) { + this.setState("alive") + return + } + + logger.debug("heartbeat") + this.lastHeartbeat = Date.now() + if (typeof this.heartbeatTimer !== "undefined") { + clearTimeout(this.heartbeatTimer) + } + + this.heartbeatTimer = setTimeout(async () => { + try { + if (await this.isActive()) { + this.beat() + } else { + this.setState("expired") + } + } catch (error: unknown) { + logger.warn((error as Error).message) + this.setState("unknown") + } + }, this.heartbeatInterval) + + this.setState("alive") + + try { + return await fs.writeFile(this.heartbeatPath, "") + } catch (error: any) { + logger.warn(error.message) + } + } + + /** + * Call to clear any heartbeatTimer for shutdown. + */ + public dispose(): void { + if (typeof this.heartbeatTimer !== "undefined") { + clearTimeout(this.heartbeatTimer) + } + } +} diff --git a/src/node/http.ts b/src/node/http.ts index 5c8346f7c3ba..6500dc87fadc 100644 --- a/src/node/http.ts +++ b/src/node/http.ts @@ -1,913 +1,419 @@ import { field, logger } from "@coder/logger" -import * as fs from "fs-extra" +import * as express from "express" import * as http from "http" -import proxy from "http-proxy" -import * as httpolyglot from "httpolyglot" -import * as https from "https" import * as net from "net" -import * as path from "path" -import * as querystring from "querystring" -import safeCompare from "safe-compare" -import { Readable } from "stream" -import * as tls from "tls" -import * as url from "url" -import { HttpCode, HttpError } from "../common/http" -import { arrayify, normalize, Options, plural, split, trimSlashes } from "../common/util" -import { SocketProxyProvider } from "./socket" -import { getMediaMime, paths } from "./util" - -export type Cookies = { [key: string]: string[] | undefined } -export type PostData = { [key: string]: string | string[] | undefined } - -interface ProxyRequest extends http.IncomingMessage { - base?: string -} - -interface AuthPayload extends Cookies { - key?: string[] -} - -export enum AuthType { - Password = "password", - None = "none", -} - -export type Query = { [key: string]: string | string[] | undefined } - -export interface ProxyOptions { - /** - * A path to strip from from the beginning of the request before proxying - */ - strip?: string - /** - * A path to add to the beginning of the request before proxying. - */ - prepend?: string - /** - * The port to proxy. - */ - port: string -} - -export interface HttpResponse { - /* - * Whether to set cache-control headers for this response. - */ - cache?: boolean - /** - * If the code cannot be determined automatically set it here. The - * defaults are 302 for redirects and 200 for successful requests. For errors - * you should throw an HttpError and include the code there. If you - * use Error it will default to 404 for ENOENT and EISDIR and 500 otherwise. - */ - code?: number - /** - * Content to write in the response. Mutually exclusive with stream. - */ - content?: T - /** - * Cookie to write with the response. - * NOTE: Cookie paths must be absolute. The default is /. - */ - cookie?: { key: string; value: string; path?: string } - /** - * Used to automatically determine the appropriate mime type. - */ - filePath?: string - /** - * Additional headers to include. - */ - headers?: http.OutgoingHttpHeaders - /** - * If the mime type cannot be determined automatically set it here. - */ - mime?: string - /** - * Redirect to this path. This is constructed against the site base (not the - * provider's base). - */ - redirect?: string - /** - * Stream this to the response. Mutually exclusive with content. - */ - stream?: Readable - /** - * Query variables to add in addition to current ones when redirecting. Use - * `undefined` to remove a query variable. - */ - query?: Query - /** - * Indicates the request should be proxied. - */ - proxy?: ProxyOptions -} - -export interface WsResponse { - /** - * Indicates the web socket should be proxied. - */ - proxy?: ProxyOptions -} +import qs from "qs" +import { Disposable } from "../common/emitter" +import { CookieKeys, HttpCode, HttpError } from "../common/http" +import { normalize } from "../common/util" +import { AuthType, DefaultedArgs } from "./cli" +import { version as codeServerVersion } from "./constants" +import { Heart } from "./heart" +import { CoderSettings, SettingsProvider } from "./settings" +import { UpdateProvider } from "./update" +import { + getPasswordMethod, + IsCookieValidArgs, + isCookieValid, + sanitizeString, + escapeHtml, + escapeJSON, + splitOnFirstEquals, +} from "./util" /** - * Use when you need to run search and replace on a file's content before - * sending it. + * Base options included on every page. */ -export interface HttpStringFileResponse extends HttpResponse { - content: string - filePath: string -} - -export interface RedirectResponse extends HttpResponse { - redirect: string -} - -export interface HttpServerOptions { - readonly auth?: AuthType - readonly cert?: string - readonly certKey?: string - readonly commit?: string - readonly host?: string - readonly password?: string - readonly port?: number - readonly proxyDomains?: string[] - readonly socket?: string -} - -export interface Route { - /** - * Provider base path part (for /provider/base/path it would be /provider). - */ - providerBase: string - /** - * Base path part (for /provider/base/path it would be /base). - */ +export interface ClientConfiguration { + codeServerVersion: string + /** Relative path from this page to the root. No trailing slash. */ base: string - /** - * Remaining part of the route after factoring out the base and provider base - * (for /provider/base/path it would be /path). It can be blank. - */ - requestPath: string - /** - * Query variables included in the request. - */ - query: querystring.ParsedUrlQuery - /** - * Normalized version of `originalPath`. - */ - fullPath: string - /** - * Original path of the request without any modifications. - */ - originalPath: string + /** Relative path from this page to the static root. No trailing slash. */ + csStaticBase: string } -interface ProviderRoute extends Route { - provider: HttpProvider +declare global { + // eslint-disable-next-line @typescript-eslint/no-namespace + namespace Express { + export interface Request { + args: DefaultedArgs + heart: Heart + settings: SettingsProvider + updater: UpdateProvider + } + } } -export interface HttpProviderOptions { - readonly auth: AuthType - readonly commit: string - readonly password?: string +export const createClientConfiguration = (req: express.Request): ClientConfiguration => { + const base = relativeRoot(req.originalUrl) + + return { + base, + csStaticBase: base + "/_static", + codeServerVersion, + } } /** - * Provides HTTP responses. This abstract class provides some helpers for - * interpreting, creating, and authenticating responses. + * Replace common variable strings in HTML templates. */ -export abstract class HttpProvider { - protected readonly rootPath = path.resolve(__dirname, "../..") - - public constructor(protected readonly options: HttpProviderOptions) {} - - public async dispose(): Promise { - // No default behavior. - } - - /** - * Handle web sockets on the registered endpoint. Normally the provider - * handles the request itself but it can return a response when necessary. The - * default is to throw a 404. - */ - public handleWebSocket( - /* eslint-disable @typescript-eslint/no-unused-vars */ - _route: Route, - _request: http.IncomingMessage, - _socket: net.Socket, - _head: Buffer, - /* eslint-enable @typescript-eslint/no-unused-vars */ - ): Promise { - throw new HttpError("Not found", HttpCode.NotFound) +export const replaceTemplates = ( + req: express.Request, + content: string, + extraOpts?: Omit, +): string => { + const serverOptions: ClientConfiguration = { + ...createClientConfiguration(req), + ...extraOpts, } - /** - * Handle requests to the registered endpoint. - */ - public abstract handleRequest(route: Route, request: http.IncomingMessage): Promise - - /** - * Get the base relative to the provided route. For each slash we need to go - * up a directory. For example: - * / => . - * /foo => . - * /foo/ => ./.. - * /foo/bar => ./.. - * /foo/bar/ => ./../.. - */ - public base(route: Route): string { - const depth = (route.originalPath.match(/\//g) || []).length - return normalize("./" + (depth > 1 ? "../".repeat(depth - 1) : "")) - } + return content + .replace(/{{TO}}/g, (typeof req.query.to === "string" && escapeHtml(req.query.to)) || "/") + .replace(/{{BASE}}/g, serverOptions.base) + .replace(/{{CS_STATIC_BASE}}/g, serverOptions.csStaticBase) + .replace("{{OPTIONS}}", () => escapeJSON(serverOptions)) +} - /** - * Get error response. - */ - public async getErrorRoot(route: Route, title: string, header: string, body: string): Promise { - const response = await this.getUtf8Resource(this.rootPath, "src/browser/pages/error.html") - response.content = response.content - .replace(/{{ERROR_TITLE}}/g, title) - .replace(/{{ERROR_HEADER}}/g, header) - .replace(/{{ERROR_BODY}}/g, body) - return this.replaceTemplates(route, response) +/** + * Throw an error if proxy is not enabled. Call `next` if provided. + */ +export const ensureProxyEnabled = (req: express.Request, _?: express.Response, next?: express.NextFunction): void => { + if (!proxyEnabled(req)) { + throw new HttpError("Forbidden", HttpCode.Forbidden) } - - /** - * Replace common templates strings. - */ - protected replaceTemplates( - route: Route, - response: HttpStringFileResponse, - extraOptions?: Omit, - ): HttpStringFileResponse { - const base = this.base(route) - const options: Options = { - base, - csStaticBase: base + "/static/" + this.options.commit + this.rootPath, - logLevel: logger.level, - ...extraOptions, - } - response.content = response.content - .replace(/{{TO}}/g, Array.isArray(route.query.to) ? route.query.to[0] : route.query.to || "/dashboard") - .replace(/{{BASE}}/g, options.base) - .replace(/{{CS_STATIC_BASE}}/g, options.csStaticBase) - .replace(/"{{OPTIONS}}"/, `'${JSON.stringify(options)}'`) - return response + if (next) { + next() } +} - protected get isDev(): boolean { - return this.options.commit === "development" - } +/** + * Return true if proxy is enabled. + */ +export const proxyEnabled = (req: express.Request): boolean => { + return !req.args["disable-proxy"] +} - /** - * Get a file resource. - * TODO: Would a stream be faster, at least for large files? - */ - protected async getResource(...parts: string[]): Promise { - const filePath = path.join(...parts) - return { content: await fs.readFile(filePath), filePath } +/** + * Throw an error if not authorized. Call `next` if provided. + */ +export const ensureAuthenticated = async ( + req: express.Request, + _?: express.Response, + next?: express.NextFunction, +): Promise => { + const isAuthenticated = await authenticated(req) + if (!isAuthenticated) { + throw new HttpError("Unauthorized", HttpCode.Unauthorized) } - - /** - * Get a file resource as a string. - */ - protected async getUtf8Resource(...parts: string[]): Promise { - const filePath = path.join(...parts) - return { content: await fs.readFile(filePath, "utf8"), filePath } - } - - /** - * Helper to error on invalid methods (default GET). - */ - protected ensureMethod(request: http.IncomingMessage, method?: string | string[]): void { - const check = arrayify(method || "GET") - if (!request.method || !check.includes(request.method)) { - throw new HttpError(`Unsupported method ${request.method}`, HttpCode.BadRequest) - } + if (next) { + next() } +} - /** - * Helper to error if not authorized. - */ - protected ensureAuthenticated(request: http.IncomingMessage): void { - if (!this.authenticated(request)) { - throw new HttpError("Unauthorized", HttpCode.Unauthorized) +/** + * Return true if authenticated via cookies. + */ +export const authenticated = async (req: express.Request): Promise => { + switch (req.args.auth) { + case AuthType.None: { + return true } - } + case AuthType.Password: { + // The password is stored in the cookie after being hashed. + const hashedPasswordFromArgs = req.args["hashed-password"] + const passwordMethod = getPasswordMethod(hashedPasswordFromArgs) + const isCookieValidArgs: IsCookieValidArgs = { + passwordMethod, + cookieKey: sanitizeString(req.cookies[CookieKeys.Session]), + passwordFromArgs: req.args.password || "", + hashedPasswordFromArgs: req.args["hashed-password"], + } - /** - * Use the first query value or the default if there isn't one. - */ - protected queryOrDefault(value: string | string[] | undefined, def: string): string { - if (Array.isArray(value)) { - value = value[0] + return await isCookieValid(isCookieValidArgs) } - return typeof value !== "undefined" ? value : def - } - - /** - * Return the provided password value if the payload contains the right - * password otherwise return false. If no payload is specified use cookies. - */ - public authenticated(request: http.IncomingMessage, payload?: AuthPayload): string | boolean { - switch (this.options.auth) { - case AuthType.None: - return true - case AuthType.Password: - if (typeof payload === "undefined") { - payload = this.parseCookies(request) - } - if (this.options.password && payload.key) { - for (let i = 0; i < payload.key.length; ++i) { - if (safeCompare(payload.key[i], this.options.password)) { - return payload.key[i] - } - } - } - return false - default: - throw new Error(`Unsupported auth type ${this.options.auth}`) + default: { + throw new Error(`Unsupported auth type ${req.args.auth}`) } } +} - /** - * Parse POST data. - */ - protected getData(request: http.IncomingMessage): Promise { - return request.method === "POST" || request.method === "DELETE" - ? new Promise((resolve, reject) => { - let body = "" - const onEnd = (): void => { - off() // eslint-disable-line @typescript-eslint/no-use-before-define - resolve(body || undefined) - } - const onError = (error: Error): void => { - off() // eslint-disable-line @typescript-eslint/no-use-before-define - reject(error) - } - const onData = (d: Buffer): void => { - body += d - if (body.length > 1e6) { - onError(new HttpError("Payload is too large", HttpCode.LargePayload)) - request.connection.destroy() - } - } - const off = (): void => { - request.off("error", onError) - request.off("data", onError) - request.off("end", onEnd) - } - request.on("error", onError) - request.on("data", onData) - request.on("end", onEnd) - }) - : Promise.resolve(undefined) - } +/** + * Get the relative path that will get us to the root of the page. For each + * slash we need to go up a directory. Will not have a trailing slash. + * + * For example: + * + * / => . + * /foo => . + * /foo/ => ./.. + * /foo/bar => ./.. + * /foo/bar/ => ./../.. + * + * All paths must be relative in order to work behind a reverse proxy since we + * we do not know the base path. Anything that needs to be absolute (for + * example cookies) must get the base path from the frontend. + * + * All relative paths must be prefixed with the relative root to ensure they + * work no matter the depth at which they happen to appear. + * + * For Express `req.originalUrl` should be used as they remove the base from the + * standard `url` property making it impossible to get the true depth. + */ +export const relativeRoot = (originalUrl: string): string => { + const depth = (originalUrl.split("?", 1)[0].match(/\//g) || []).length + return normalize("./" + (depth > 1 ? "../".repeat(depth - 1) : "")) +} - /** - * Parse cookies. - */ - protected parseCookies(request: http.IncomingMessage): T { - const cookies: { [key: string]: string[] } = {} - if (request.headers.cookie) { - request.headers.cookie.split(";").forEach((keyValue) => { - const [key, value] = split(keyValue, "=") - if (!cookies[key]) { - cookies[key] = [] - } - cookies[key].push(decodeURI(value)) - }) - } - return cookies as T - } +/** + * A helper function to construct a redirect path based on + * an Express Request, query and a path to redirect to. + * + * Redirect path is relative to `/${to}`. + */ +export const constructRedirectPath = (req: express.Request, query: qs.ParsedQs, to: string): string => { + const relativePath = normalize(`${relativeRoot(req.originalUrl)}/${to}`, true) + // %2f or %2F are both equalivent to an encoded slash / + const queryString = qs.stringify(query).replace(/%2[fF]/g, "/") + const redirectPath = `${relativePath}${queryString ? `?${queryString}` : ""}` - /** - * Return true if the route is for the root page. For example /base, /base/, - * or /base/index.html but not /base/path or /base/file.js. - */ - protected isRoot(route: Route): boolean { - return !route.requestPath || route.requestPath === "/index.html" - } + return redirectPath } /** - * Provides a heartbeat using a local file to indicate activity. + * Redirect relatively to `/${to}`. Query variables on the current URI will be + * preserved. `to` should be a simple path without any query parameters + * `override` will merge with the existing query (use `undefined` to unset). */ -export class Heart { - private heartbeatTimer?: NodeJS.Timeout - private heartbeatInterval = 60000 - private lastHeartbeat = 0 - - public constructor(private readonly heartbeatPath: string, private readonly isActive: () => Promise) {} - - /** - * Write to the heartbeat file if we haven't already done so within the - * timeout and start or reset a timer that keeps running as long as there is - * activity. Failures are logged as warnings. - */ - public beat(): void { - const now = Date.now() - if (now - this.lastHeartbeat >= this.heartbeatInterval) { - logger.trace("heartbeat") - fs.outputFile(this.heartbeatPath, "").catch((error) => { - logger.warn(error.message) - }) - this.lastHeartbeat = now - if (typeof this.heartbeatTimer !== "undefined") { - clearTimeout(this.heartbeatTimer) - } - this.heartbeatTimer = setTimeout(() => { - this.isActive() - .then((active) => { - if (active) { - this.beat() - } - }) - .catch((error) => { - logger.warn(error.message) - }) - }, this.heartbeatInterval) +export const redirect = (req: express.Request, res: express.Response, to: string, override: qs.ParsedQs = {}): void => { + const query = Object.assign({}, req.query, override) + Object.keys(override).forEach((key) => { + if (typeof override[key] === "undefined") { + delete query[key] } - } -} + }) -export interface HttpProvider0 { - new (options: HttpProviderOptions): T + const redirectPath = constructRedirectPath(req, query, to) + logger.debug(`redirecting from ${req.originalUrl} to ${redirectPath}`) + res.redirect(redirectPath) } -export interface HttpProvider1 { - new (options: HttpProviderOptions, a1: A1): T -} +/** + * Get the value that should be used for setting a cookie domain. This will + * allow the user to authenticate once no matter what sub-domain they use to log + * in. This will use the highest level proxy domain (e.g. `coder.com` over + * `test.coder.com` if both are specified). + */ +export const getCookieDomain = (host: string, proxyDomains: string[]): string | undefined => { + const idx = host.lastIndexOf(":") + host = idx !== -1 ? host.substring(0, idx) : host + // If any of these are true we will still set cookies but without an explicit + // `Domain` attribute on the cookie. + if ( + // The host can be be blank or missing so there's nothing we can set. + !host || + // IP addresses can't have subdomains so there's no value in setting the + // domain for them. Assume that anything with a : is ipv6 (valid domain name + // characters are alphanumeric or dashes)... + host.includes(":") || + // ...and that anything entirely numbers and dots is ipv4 (currently tlds + // cannot be entirely numbers). + !/[^0-9.]/.test(host) || + // localhost subdomains don't seem to work at all (browser bug?). A cookie + // set at dev.localhost cannot be read by 8080.dev.localhost. + host.endsWith(".localhost") || + // Domains without at least one dot (technically two since domain.tld will + // become .domain.tld) are considered invalid according to the spec so don't + // set the domain for them. In my testing though localhost is the only + // problem (the browser just doesn't store the cookie at all). localhost has + // an additional problem which is that a reverse proxy might give + // code-server localhost even though the domain is really domain.tld (by + // default NGINX does this). + !host.includes(".") + ) { + logger.debug("no valid cookie domain", field("host", host)) + return undefined + } -export interface HttpProvider2 { - new (options: HttpProviderOptions, a1: A1, a2: A2): T -} + proxyDomains.forEach((domain) => { + if (host.endsWith(domain) && domain.length < host.length) { + host = domain + } + }) -export interface HttpProvider3 { - new (options: HttpProviderOptions, a1: A1, a2: A2, a3: A3): T + logger.debug("got cookie domain", field("host", host)) + return host || undefined } /** - * An HTTP server. Its main role is to route incoming HTTP requests to the - * appropriate provider for that endpoint then write out the response. It also - * covers some common use cases like redirects and caching. + * Return a function capable of fully disposing an HTTP server. */ -export class HttpServer { - protected readonly server: http.Server | https.Server - private listenPromise: Promise | undefined - public readonly protocol: "http" | "https" - private readonly providers = new Map() - private readonly heart: Heart - private readonly socketProvider = new SocketProxyProvider() - - /** - * Proxy domains are stored here without the leading `*.` - */ - public readonly proxyDomains: Set - - /** - * Provides the actual proxying functionality. - */ - private readonly proxy = proxy.createProxyServer({}) - - public constructor(private readonly options: HttpServerOptions) { - this.proxyDomains = new Set((options.proxyDomains || []).map((d) => d.replace(/^\*\./, ""))) - this.heart = new Heart(path.join(paths.data, "heartbeat"), async () => { - const connections = await this.getConnections() - logger.trace(plural(connections, `${connections} active connection`)) - return connections !== 0 - }) - this.protocol = this.options.cert ? "https" : "http" - if (this.protocol === "https") { - this.server = httpolyglot.createServer( - { - cert: this.options.cert && fs.readFileSync(this.options.cert), - key: this.options.certKey && fs.readFileSync(this.options.certKey), - }, - this.onRequest, - ) - } else { - this.server = http.createServer(this.onRequest) - } - this.proxy.on("error", (error, _request, response) => { - response.writeHead(HttpCode.ServerError) - response.end(error.message) - }) - // Intercept the response to rewrite absolute redirects against the base path. - this.proxy.on("proxyRes", (response, request: ProxyRequest) => { - if (response.headers.location && response.headers.location.startsWith("/") && request.base) { - response.headers.location = request.base + response.headers.location - } - }) - } +export function disposer(server: http.Server): Disposable["dispose"] { + const sockets = new Set() + let cleanupTimeout: undefined | NodeJS.Timeout - /** - * Stop and dispose everything. Return an array of disposal errors. - */ - public async dispose(): Promise { - this.socketProvider.stop() - const providers = Array.from(this.providers.values()) - // Catch so all the errors can be seen rather than just the first one. - const responses = await Promise.all(providers.map((p) => p.dispose().catch((e) => e))) - return responses.filter((r): r is Error => typeof r !== "undefined") - } + server.on("connection", (socket) => { + sockets.add(socket) - public async getConnections(): Promise { - return new Promise((resolve, reject) => { - this.server.getConnections((error, count) => { - return error ? reject(error) : resolve(count) - }) - }) - } + socket.on("close", () => { + sockets.delete(socket) - /** - * Register a provider for a top-level endpoint. - */ - public registerHttpProvider(endpoint: string | string[], provider: HttpProvider0): T - public registerHttpProvider( - endpoint: string | string[], - provider: HttpProvider1, - a1: A1, - ): T - public registerHttpProvider( - endpoint: string | string[], - provider: HttpProvider2, - a1: A1, - a2: A2, - ): T - public registerHttpProvider( - endpoint: string | string[], - provider: HttpProvider3, - a1: A1, - a2: A2, - a3: A3, - ): T - // eslint-disable-next-line @typescript-eslint/no-explicit-any - public registerHttpProvider(endpoint: string | string[], provider: any, ...args: any[]): void { - const p = new provider( - { - auth: this.options.auth || AuthType.None, - commit: this.options.commit, - password: this.options.password, - }, - ...args, - ) - const endpoints = arrayify(endpoint).map(trimSlashes) - endpoints.forEach((endpoint) => { - if (/\//.test(endpoint)) { - throw new Error(`Only top-level endpoints are supported (got ${endpoint})`) - } - const existingProvider = this.providers.get(`/${endpoint}`) - this.providers.set(`/${endpoint}`, p) - if (existingProvider) { - logger.debug(`Overridding existing /${endpoint} provider`) - // If the existing provider isn't registered elsewhere we can dispose. - if (!Array.from(this.providers.values()).find((p) => p === existingProvider)) { - logger.debug(`Disposing existing /${endpoint} provider`) - existingProvider.dispose() - } + if (cleanupTimeout && sockets.size === 0) { + clearTimeout(cleanupTimeout) + cleanupTimeout = undefined } }) - } - - /** - * Start listening on the specified port. - */ - public listen(): Promise { - if (!this.listenPromise) { - this.listenPromise = new Promise((resolve, reject) => { - this.server.on("error", reject) - this.server.on("upgrade", this.onUpgrade) - const onListen = (): void => resolve(this.address()) - if (this.options.socket) { - this.server.listen(this.options.socket, onListen) - } else { - this.server.listen(this.options.port, this.options.host, onListen) + }) + + return () => { + return new Promise((resolve, reject) => { + // The whole reason we need this disposer is because close will not + // actually close anything; it only prevents future connections then waits + // until everything is closed. + server.close((err) => { + if (err) { + return reject(err) } - }) - } - return this.listenPromise - } - /** - * The *local* address of the server. - */ - public address(): string | null { - const address = this.server.address() - const endpoint = - typeof address !== "string" && address !== null - ? (address.address === "::" ? "localhost" : address.address) + ":" + address.port - : address - return endpoint && `${this.protocol}://${endpoint}` - } - - private onRequest = async (request: http.IncomingMessage, response: http.ServerResponse): Promise => { - this.heart.beat() - const route = this.parseUrl(request) - const write = (payload: HttpResponse): void => { - response.writeHead(payload.redirect ? HttpCode.Redirect : payload.code || HttpCode.Ok, { - "Content-Type": payload.mime || getMediaMime(payload.filePath), - ...(payload.redirect ? { Location: this.constructRedirect(request, route, payload as RedirectResponse) } : {}), - ...(request.headers["service-worker"] ? { "Service-Worker-Allowed": route.provider.base(route) } : {}), - ...(payload.cache ? { "Cache-Control": "public, max-age=31536000" } : {}), - ...(payload.cookie - ? { - "Set-Cookie": [ - `${payload.cookie.key}=${payload.cookie.value}`, - `Path=${normalize(payload.cookie.path || "/", true)}`, - this.getCookieDomain(request.headers.host || ""), - // "HttpOnly", - "SameSite=lax", - ] - .filter((l) => !!l) - .join(";"), - } - : {}), - ...payload.headers, + resolve() }) - if (payload.stream) { - payload.stream.on("error", (error: NodeJS.ErrnoException) => { - response.writeHead(error.code === "ENOENT" ? HttpCode.NotFound : HttpCode.ServerError) - response.end(error.message) - }) - payload.stream.on("close", () => response.end()) - payload.stream.pipe(response) - } else if (typeof payload.content === "string" || payload.content instanceof Buffer) { - response.end(payload.content) - } else if (payload.content && typeof payload.content === "object") { - response.end(JSON.stringify(payload.content)) - } else { - response.end() - } - } - - try { - const payload = - this.maybeRedirect(request, route) || - (route.provider.authenticated(request) && this.maybeProxy(request)) || - (await route.provider.handleRequest(route, request)) - if (payload.proxy) { - this.doProxy(route, request, response, payload.proxy) - } else { - write(payload) - } - } catch (error) { - let e = error - if (error.code === "ENOENT" || error.code === "EISDIR") { - e = new HttpError("Not found", HttpCode.NotFound) - } - const code = typeof e.code === "number" ? e.code : HttpCode.ServerError - logger.debug("Request error", field("url", request.url), field("code", code), field("error", error)) - if (code >= HttpCode.ServerError) { - logger.error(error.stack) - } - if (request.headers["content-type"] === "application/json") { - write({ - code, - mime: "application/json", - content: { - error: e.message, - ...(e.details || {}), - }, - }) - } else { - write({ - code, - ...(await route.provider.getErrorRoot(route, code, code, e.message)), - }) - } - } - } - /** - * Return any necessary redirection before delegating to a provider. - */ - private maybeRedirect(request: http.IncomingMessage, route: ProviderRoute): RedirectResponse | undefined { - // If we're handling TLS ensure all requests are redirected to HTTPS. - if (this.options.cert && !(request.connection as tls.TLSSocket).encrypted) { - return { redirect: route.fullPath } - } + // If there are sockets remaining we might need to force close them or + // this promise might never resolve. + if (sockets.size > 0) { + // Give sockets a chance to close up shop. + cleanupTimeout = setTimeout(() => { + cleanupTimeout = undefined - return undefined - } - - /** - * Given a path that goes from the base, construct a relative redirect URL - * that will get you there considering that the app may be served from an - * unknown base path. If handling TLS, also ensure HTTPS. - */ - private constructRedirect(request: http.IncomingMessage, route: ProviderRoute, payload: RedirectResponse): string { - const query = { - ...route.query, - ...(payload.query || {}), - } - - Object.keys(query).forEach((key) => { - if (typeof query[key] === "undefined") { - delete query[key] + for (const socket of sockets.values()) { + console.warn("a socket was left hanging") + socket.destroy() + } + }, 1000) } }) - - const secure = (request.connection as tls.TLSSocket).encrypted - const redirect = - (this.options.cert && !secure ? `${this.protocol}://${request.headers.host}/` : "") + - normalize(`${route.provider.base(route)}/${payload.redirect}`, true) + - (Object.keys(query).length > 0 ? `?${querystring.stringify(query)}` : "") - logger.debug("redirecting", field("secure", !!secure), field("from", request.url), field("to", redirect)) - return redirect } +} - private onUpgrade = async (request: http.IncomingMessage, socket: net.Socket, head: Buffer): Promise => { - try { - this.heart.beat() - socket.on("error", () => socket.destroy()) - - if (this.options.cert && !(socket as tls.TLSSocket).encrypted) { - throw new HttpError("HTTP websocket", HttpCode.BadRequest) - } - - if (!request.headers.upgrade || request.headers.upgrade.toLowerCase() !== "websocket") { - throw new HttpError("HTTP/1.1 400 Bad Request", HttpCode.BadRequest) - } - - const route = this.parseUrl(request) - if (!route.provider) { - throw new HttpError("Not found", HttpCode.NotFound) - } - - // The socket proxy is so we can pass them to child processes (TLS sockets - // can't be transferred so we need an in-between). - const socketProxy = await this.socketProvider.createProxy(socket) - const payload = - this.maybeProxy(request) || (await route.provider.handleWebSocket(route, request, socketProxy, head)) - if (payload && payload.proxy) { - this.doProxy(route, request, { socket: socketProxy, head }, payload.proxy) - } - } catch (error) { - socket.destroy(error) - logger.warn(`discarding socket connection: ${error.message}`) - } +/** + * Get the options for setting a cookie. The options must be identical for + * setting and unsetting cookies otherwise they are considered separate. + */ +export const getCookieOptions = (req: express.Request): express.CookieOptions => { + // Normally we set paths relatively. However browsers do not appear to allow + // cookies to be set relatively which means we need an absolute path. We + // cannot be guaranteed we know the path since a reverse proxy might have + // rewritten it. That means we need to get the path from the frontend. + + // The reason we need to set the path (as opposed to defaulting to /) is to + // avoid code-server instances on different sub-paths clobbering each other or + // from accessing each other's tokens (and to prevent other services from + // accessing code-server's tokens). + + // When logging in or out the request must include the href (the full current + // URL of that page) and the relative path to the root as given to it by the + // backend. Using these two we can determine the true absolute root. + const url = new URL( + req.query.base || req.body?.base || "/", + req.query.href || req.body?.href || "http://" + (req.headers.host || "localhost"), + ) + return { + domain: getCookieDomain(url.host, req.args["proxy-domain"]), + path: normalize(url.pathname) || "/", + sameSite: "lax", } +} - /** - * Parse a request URL so we can route it. - */ - private parseUrl(request: http.IncomingMessage): ProviderRoute { - const parse = (fullPath: string): { base: string; requestPath: string } => { - const match = fullPath.match(/^(\/?[^/]*)(.*)$/) - let [, /* ignore */ base, requestPath] = match ? match.map((p) => p.replace(/\/+$/, "")) : ["", "", ""] - if (base.indexOf(".") !== -1) { - // Assume it's a file at the root. - requestPath = base - base = "/" - } else if (base === "") { - // Happens if it's a plain `domain.com`. - base = "/" - } - return { base, requestPath } - } - - const parsedUrl = request.url ? url.parse(request.url, true) : { query: {}, pathname: "" } - const originalPath = parsedUrl.pathname || "/" - const fullPath = normalize(originalPath, true) - const { base, requestPath } = parse(fullPath) +/** + * Return the full path to the current page, preserving any trailing slash. + */ +export const self = (req: express.Request): string => { + return normalize(`${req.baseUrl}${req.originalUrl.endsWith("/") ? "/" : ""}`, true) +} - // Providers match on the path after their base so we need to account for - // that by shifting the next base out of the request path. - let provider = this.providers.get(base) - if (base !== "/" && provider) { - return { ...parse(requestPath), providerBase: base, fullPath, query: parsedUrl.query, provider, originalPath } - } +function getFirstHeader(req: http.IncomingMessage, headerName: string): string | undefined { + const val = req.headers[headerName] + return Array.isArray(val) ? val[0] : val +} - // Fall back to the top-level provider. - provider = this.providers.get("/") - if (!provider) { - throw new Error(`No provider for ${base}`) +/** + * Throw a forbidden error if origin checks fail. Call `next` if provided. + */ +export function ensureOrigin(req: express.Request, _?: express.Response, next?: express.NextFunction): void { + try { + authenticateOrigin(req) + if (next) { + next() } - return { base, providerBase: "/", fullPath, requestPath, query: parsedUrl.query, provider, originalPath } + } catch (error) { + logger.debug(`${error instanceof Error ? error.message : error}; blocking request to ${req.originalUrl}`) + throw new HttpError("Forbidden", HttpCode.Forbidden) } +} - /** - * Proxy a request to the target. - */ - private doProxy( - route: Route, - request: http.IncomingMessage, - response: http.ServerResponse, - options: ProxyOptions, - ): void - /** - * Proxy a web socket to the target. - */ - private doProxy( - route: Route, - request: http.IncomingMessage, - response: { socket: net.Socket; head: Buffer }, - options: ProxyOptions, - ): void - /** - * Proxy a request or web socket to the target. - */ - private doProxy( - route: Route, - request: http.IncomingMessage, - response: http.ServerResponse | { socket: net.Socket; head: Buffer }, - options: ProxyOptions, - ): void { - const port = parseInt(options.port, 10) - if (isNaN(port)) { - throw new HttpError(`"${options.port}" is not a valid number`, HttpCode.BadRequest) - } - - // REVIEW: Absolute redirects need to be based on the subpath but I'm not - // sure how best to get this information to the `proxyRes` event handler. - // For now I'm sticking it on the request object which is passed through to - // the event. - ;(request as ProxyRequest).base = options.strip - - const isHttp = response instanceof http.ServerResponse - const base = options.strip ? route.fullPath.replace(options.strip, "") : route.fullPath - const path = normalize("/" + (options.prepend || "") + "/" + base, true) - const proxyOptions: proxy.ServerOptions = { - changeOrigin: true, - ignorePath: true, - target: `${isHttp ? "http" : "ws"}://127.0.0.1:${port}${path}${ - Object.keys(route.query).length > 0 ? `?${querystring.stringify(route.query)}` : "" - }`, - ws: !isHttp, - } +/** + * Authenticate the request origin against the host. Throw if invalid. + */ +export function authenticateOrigin(req: express.Request): void { + // A missing origin probably means the source is non-browser. Not sure we + // have a use case for this but let it through. + const originRaw = getFirstHeader(req, "origin") + if (!originRaw) { + return + } - if (response instanceof http.ServerResponse) { - this.proxy.web(request, response, proxyOptions) - } else { - this.proxy.ws(request, response.socket, response.head, proxyOptions) - } + let origin: string + try { + origin = new URL(originRaw).host.trim().toLowerCase() + } catch (error) { + throw new Error(`unable to parse malformed origin "${originRaw}"`) } - /** - * Get the value that should be used for setting a cookie domain. This will - * allow the user to authenticate only once. This will use the highest level - * domain (e.g. `coder.com` over `test.coder.com` if both are specified). - */ - private getCookieDomain(host: string): string | undefined { - const idx = host.lastIndexOf(":") - host = idx !== -1 ? host.substring(0, idx) : host - if ( - // Might be blank/missing, so there's nothing more to do. - !host || - // IP addresses can't have subdomains so there's no value in setting the - // domain for them. Assume anything with a : is ipv6 (valid domain name - // characters are alphanumeric or dashes). - host.includes(":") || - // Assume anything entirely numbers and dots is ipv4 (currently tlds - // cannot be entirely numbers). - !/[^0-9.]/.test(host) || - // localhost subdomains don't seem to work at all (browser bug?). - host.endsWith(".localhost") || - // It might be localhost (or an IP, see above) if it's a proxy and it - // isn't setting the host header to match the access domain. - host === "localhost" - ) { - logger.debug("no valid cookie doman", field("host", host)) - return undefined - } + const trustedOrigins = req.args["trusted-origins"] || [] + if (trustedOrigins.includes(origin) || trustedOrigins.includes("*")) { + return + } - this.proxyDomains.forEach((domain) => { - if (host.endsWith(domain) && domain.length < host.length) { - host = domain - } - }) + const host = getHost(req) + if (typeof host === "undefined") { + // A missing host likely means the reverse proxy has not been configured to + // forward the host which means we cannot perform the check. Emit an error + // so an admin can fix the issue. + logger.error("No host headers found") + logger.error("Are you behind a reverse proxy that does not forward the host?") + throw new Error("no host headers found") + } - logger.debug("got cookie doman", field("host", host)) - return host ? `Domain=${host}` : undefined + if (host !== origin) { + throw new Error(`host "${host}" does not match origin "${origin}"`) } +} - /** - * Return a response if the request should be proxied. Anything that ends in a - * proxy domain and has a *single* subdomain should be proxied. Anything else - * should return `undefined` and will be handled as normal. - * - * For example if `coder.com` is specified `8080.coder.com` will be proxied - * but `8080.test.coder.com` and `test.8080.coder.com` will not. - */ - public maybeProxy(request: http.IncomingMessage): HttpResponse | undefined { - // Split into parts. - const host = request.headers.host || "" - const idx = host.indexOf(":") - const domain = idx !== -1 ? host.substring(0, idx) : host - const parts = domain.split(".") - - // There must be an exact match. - const port = parts.shift() - const proxyDomain = parts.join(".") - if (!port || !this.proxyDomains.has(proxyDomain)) { - return undefined +/** + * Get the host from headers. It will be trimmed and lowercased. + */ +export function getHost(req: express.Request): string | undefined { + // Honor Forwarded if present. + const forwardedRaw = getFirstHeader(req, "forwarded") + if (forwardedRaw) { + const parts = forwardedRaw.split(/[;,]/) + for (let i = 0; i < parts.length; ++i) { + const [key, value] = splitOnFirstEquals(parts[i]) + if (key.trim().toLowerCase() === "host" && value) { + return value.trim().toLowerCase() + } } + } - return { - proxy: { - port, - }, + // Honor X-Forwarded-Host if present. Some reverse proxies will set multiple + // comma-separated hosts. + const xHost = getFirstHeader(req, "x-forwarded-host") + if (xHost) { + const firstXHost = xHost.split(",")[0] + if (firstXHost) { + return firstXHost.trim().toLowerCase() } } + + const host = getFirstHeader(req, "host") + return host ? host.trim().toLowerCase() : undefined } diff --git a/src/node/i18n/index.ts b/src/node/i18n/index.ts new file mode 100644 index 000000000000..e8186067ba98 --- /dev/null +++ b/src/node/i18n/index.ts @@ -0,0 +1,59 @@ +import { promises as fs } from "fs" +import i18next, { init } from "i18next" +import * as en from "./locales/en.json" +import * as ja from "./locales/ja.json" +import * as th from "./locales/th.json" +import * as ur from "./locales/ur.json" +import * as zhCn from "./locales/zh-cn.json" + +const defaultResources = { + en: { + translation: en, + }, + "zh-cn": { + translation: zhCn, + }, + th: { + translation: th, + }, + ja: { + translation: ja, + }, + ur: { + translation: ur, + }, +} + +export async function loadCustomStrings(filePath: string): Promise { + try { + // Read custom strings from file path only + const fileContent = await fs.readFile(filePath, "utf8") + const customStringsData = JSON.parse(fileContent) + + // User-provided strings override all languages. + Object.keys(defaultResources).forEach((locale) => { + i18next.addResourceBundle(locale, "translation", customStringsData) + }) + } catch (error) { + if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") { + throw new Error(`Custom strings file not found: ${filePath}\nPlease ensure the file exists and is readable.`) + } else if (error instanceof SyntaxError) { + throw new Error(`Invalid JSON in custom strings file: ${filePath}\n${error.message}`) + } else { + throw new Error( + `Failed to load custom strings from ${filePath}: ${error instanceof Error ? error.message : String(error)}`, + ) + } + } +} + +init({ + lng: "en", + fallbackLng: "en", // language to use if translations in user language are not available. + returnNull: false, + lowerCaseLng: true, + debug: process.env.NODE_ENV === "development", + resources: defaultResources, +}) + +export default i18next diff --git a/src/node/i18n/locales/en.json b/src/node/i18n/locales/en.json new file mode 100644 index 000000000000..14e8d1525653 --- /dev/null +++ b/src/node/i18n/locales/en.json @@ -0,0 +1,13 @@ +{ + "LOGIN_TITLE": "{{app}} login", + "LOGIN_BELOW": "Please log in below.", + "WELCOME": "Welcome to {{app}}", + "LOGIN_PASSWORD": "Check the config file at {{configFile}} for the password.", + "LOGIN_USING_ENV_PASSWORD": "Password was set from $PASSWORD.", + "LOGIN_USING_HASHED_PASSWORD": "Password was set from $HASHED_PASSWORD.", + "SUBMIT": "SUBMIT", + "PASSWORD_PLACEHOLDER": "PASSWORD", + "LOGIN_RATE_LIMIT": "Login rate limited!", + "MISS_PASSWORD": "Missing password", + "INCORRECT_PASSWORD": "Incorrect password" +} diff --git a/src/node/i18n/locales/ja.json b/src/node/i18n/locales/ja.json new file mode 100644 index 000000000000..6597e07486f6 --- /dev/null +++ b/src/node/i18n/locales/ja.json @@ -0,0 +1,13 @@ +{ + "LOGIN_TITLE": "{{app}} ログイン", + "LOGIN_BELOW": "以下によりログインしてください。", + "WELCOME": "ようこそ {{app}} へ!", + "LOGIN_PASSWORD": "パスワードは設定ファイル( {{configFile}} )を確認してください。", + "LOGIN_USING_ENV_PASSWORD": "パスワードは環境変数 $PASSWORD で設定されています。", + "LOGIN_USING_HASHED_PASSWORD": "パスワードは環境変数 $HASHED_PASSWORD で設定されています。", + "SUBMIT": "実行", + "PASSWORD_PLACEHOLDER": "パスワード", + "LOGIN_RATE_LIMIT": "ログイン制限を超えました!", + "MISS_PASSWORD": "パスワードを入力してください。", + "INCORRECT_PASSWORD": "パスワードが間違っています。" +} diff --git a/src/node/i18n/locales/th.json b/src/node/i18n/locales/th.json new file mode 100644 index 000000000000..e5cd2cf14722 --- /dev/null +++ b/src/node/i18n/locales/th.json @@ -0,0 +1,13 @@ +{ + "LOGIN_TITLE": "เข้าสู่ระบบ {{app}}", + "LOGIN_BELOW": "กรุณาเข้าสู่ระบบด้านล่าง", + "WELCOME": "ยินดีต้อนรับสู่ {{app}}", + "LOGIN_PASSWORD": "ตรวจสอบไฟล์กำหนดค่าที่ {{configFile}} เพื่อดูรหัสผ่าน", + "LOGIN_USING_ENV_PASSWORD": "รหัสผ่านถูกกำหนดเป็น $PASSWORD", + "LOGIN_USING_HASHED_PASSWORD": "รรหัสผ่านถูกกำหนดเป็น $HASHED_PASSWORD", + "SUBMIT": "ส่ง", + "PASSWORD_PLACEHOLDER": "รหัสผ่าน", + "LOGIN_RATE_LIMIT": "ถึงขีดจำกัดอัตราการเข้าสู่ระบบ!", + "MISS_PASSWORD": "รหัสผ่านหายไป", + "INCORRECT_PASSWORD": "รหัสผ่านไม่ถูกต้อง" +} diff --git a/src/node/i18n/locales/ur.json b/src/node/i18n/locales/ur.json new file mode 100644 index 000000000000..1553fa969c42 --- /dev/null +++ b/src/node/i18n/locales/ur.json @@ -0,0 +1,13 @@ +{ + "LOGIN_TITLE": "{{app}} لاگ ان کریں", + "LOGIN_BELOW": "براہ کرم نیچے لاگ ان کریں۔", + "WELCOME": "میں خوش آمدید {{app}}", + "LOGIN_PASSWORD": "پاس ورڈ کے لیے {{configFile}} پر کنفگ فائل چیک کریں۔", + "LOGIN_USING_ENV_PASSWORD": "پاس ورڈ $PASSWORD سے سیٹ کیا گیا تھا۔", + "LOGIN_USING_HASHED_PASSWORD": "پاس ورڈ $HASHED_PASSWORD سے سیٹ کیا گیا تھا۔", + "SUBMIT": "جمع کرائیں", + "PASSWORD_PLACEHOLDER": "پاس ورڈ", + "LOGIN_RATE_LIMIT": "لاگ ان کی شرح محدود!", + "MISS_PASSWORD": "پاس ورڈ غائب ہے۔", + "INCORRECT_PASSWORD": "غلط پاس ورڈ" +} diff --git a/src/node/i18n/locales/zh-cn.json b/src/node/i18n/locales/zh-cn.json new file mode 100644 index 000000000000..9f28b6669b27 --- /dev/null +++ b/src/node/i18n/locales/zh-cn.json @@ -0,0 +1,13 @@ +{ + "LOGIN_TITLE": "{{app}} 登录", + "LOGIN_BELOW": "请在下面登录。", + "WELCOME": "欢迎来到 {{app}}", + "LOGIN_PASSWORD": "查看配置文件 {{configFile}} 中的密码。", + "LOGIN_USING_ENV_PASSWORD": "密码在 $PASSWORD 中设置。", + "LOGIN_USING_HASHED_PASSWORD": "密码在 $HASHED_PASSWORD 中设置。", + "SUBMIT": "提交", + "PASSWORD_PLACEHOLDER": "密码", + "LOGIN_RATE_LIMIT": "登录速率限制!", + "MISS_PASSWORD": "缺少密码", + "INCORRECT_PASSWORD": "密码不正确" +} diff --git a/src/node/main.ts b/src/node/main.ts new file mode 100644 index 000000000000..c2d3bd57852b --- /dev/null +++ b/src/node/main.ts @@ -0,0 +1,245 @@ +import { field, logger } from "@coder/logger" +import http from "http" +import * as os from "os" +import * as path from "path" +import { Disposable } from "../common/emitter" +import { plural } from "../common/util" +import { createApp, ensureAddress } from "./app" +import { AuthType, DefaultedArgs, Feature, toCodeArgs, UserProvidedArgs } from "./cli" +import { commit, version, vsRootPath } from "./constants" +import { loadCustomStrings } from "./i18n" +import { register } from "./routes" +import { VSCodeModule } from "./routes/vscode" +import { isDirectory, open } from "./util" +import { wrapper } from "./wrapper" + +/** + * Return true if the user passed an extension-related VS Code flag. + */ +export const shouldSpawnCliProcess = (args: UserProvidedArgs): boolean => { + return ( + !!args["list-extensions"] || + !!args["install-extension"] || + !!args["uninstall-extension"] || + !!args["locate-extension"] + ) +} + +/** + * This is copy of OpenCommandPipeArgs from + * ../../lib/vscode/src/vs/workbench/api/node/extHostCLIServer.ts:15 + * + * Arguments supported by Code's socket. It can be used to perform actions from + * the CLI in a running instance of Code (for example to open a file). + * + * TODO: Can we import this (and other types) directly? + */ +export interface OpenCommandPipeArgs { + type: "open" + fileURIs?: string[] + folderURIs: string[] + forceNewWindow?: boolean + diffMode?: boolean + addMode?: boolean + gotoLineMode?: boolean + forceReuseWindow?: boolean + waitMarkerFilePath?: string +} + +/** + * Run Code's CLI for things like managing extensions. + */ +export const runCodeCli = async (args: DefaultedArgs): Promise => { + logger.debug("Running Code CLI") + try { + // See vscode.loadVSCode for more on this jank. + process.env.CODE_SERVER_PARENT_PID = process.pid.toString() + let modPath = path.join(vsRootPath, "out/server-main.js") + if (os.platform() === "win32") { + // On Windows, absolute paths of ESM modules must be a valid file URI. + modPath = "file:///" + modPath.replace(/\\/g, "/") + } + const mod = (await eval(`import("${modPath}")`)) as VSCodeModule + const serverModule = await mod.loadCodeWithNls() + await serverModule.spawnCli(await toCodeArgs(args)) + // Rather than have the caller handle errors and exit, spawnCli will exit + // itself. Additionally, it does this on a timeout set to 0. So, try + // waiting for VS Code to exit before giving up and doing it ourselves. + await new Promise((r) => setTimeout(r, 1000)) + logger.warn("Code never exited") + process.exit(0) + } catch (error: any) { + // spawnCli catches all errors, but just in case that changes. + logger.error("Got error from Code", error) + process.exit(1) + } +} + +export const openInExistingInstance = async (args: DefaultedArgs, socketPath: string): Promise => { + const pipeArgs: OpenCommandPipeArgs & { fileURIs: string[] } = { + type: "open", + folderURIs: [], + fileURIs: [], + forceReuseWindow: args["reuse-window"], + forceNewWindow: args["new-window"], + gotoLineMode: true, + } + for (let i = 0; i < args._.length; i++) { + const fp = args._[i] + if (await isDirectory(fp)) { + pipeArgs.folderURIs.push(fp) + } else { + pipeArgs.fileURIs.push(fp) + } + } + if (pipeArgs.forceNewWindow && pipeArgs.fileURIs.length > 0) { + logger.error("--new-window can only be used with folder paths") + process.exit(1) + } + if (pipeArgs.folderURIs.length === 0 && pipeArgs.fileURIs.length === 0) { + logger.error("Please specify at least one file or folder") + process.exit(1) + } + const vscode = http.request( + { + path: "/", + method: "POST", + socketPath, + }, + (response) => { + response.on("data", (message) => { + logger.debug("got message from Code", field("message", message.toString())) + }) + }, + ) + vscode.on("error", (error: unknown) => { + logger.error("got error from Code", field("error", error)) + }) + vscode.write(JSON.stringify(pipeArgs)) + vscode.end() +} + +export const runCodeServer = async ( + args: DefaultedArgs, +): Promise<{ dispose: Disposable["dispose"]; server: http.Server }> => { + logger.info(`code-server ${version} ${commit}`) + + // Load custom strings if provided + if (args.i18n) { + await loadCustomStrings(args.i18n) + logger.info("Loaded custom strings") + } + + logger.info(`Using user-data-dir ${args["user-data-dir"]}`) + logger.debug(`Using extensions-dir ${args["extensions-dir"]}`) + + if (args.auth === AuthType.Password && !args.password && !args["hashed-password"]) { + throw new Error( + "Please pass in a password via the config file or environment variable ($PASSWORD or $HASHED_PASSWORD)", + ) + } + + const app = await createApp(args) + const protocol = args.cert ? "https" : "http" + const serverAddress = ensureAddress(app.server, protocol) + const { disposeRoutes, heart } = await register(app, args) + + logger.info(`Using config file ${args.config}`) + logger.info(`${protocol.toUpperCase()} server listening on ${serverAddress.toString()}`) + if (args.auth === AuthType.Password) { + logger.info(" - Authentication is enabled") + if (args.usingEnvPassword) { + logger.info(" - Using password from $PASSWORD") + } else if (args.usingEnvHashedPassword) { + logger.info(" - Using password from $HASHED_PASSWORD") + } else if (args["hashed-password"]) { + logger.info(` - Using hashed-password from ${args.config}`) + } else { + logger.info(` - Using password from ${args.config}`) + } + } else { + logger.info(" - Authentication is disabled") + } + + if (args.cert) { + logger.info(` - Using certificate for HTTPS: ${args.cert.value}`) + } else { + logger.info(" - Not serving HTTPS") + } + + if (args["idle-timeout-seconds"]) { + logger.info(` - Idle timeout set to ${args["idle-timeout-seconds"]} seconds`) + + let idleShutdownTimer: NodeJS.Timeout | undefined + const startIdleShutdownTimer = () => { + idleShutdownTimer = setTimeout(() => { + logger.warn(`Idle timeout of ${args["idle-timeout-seconds"]} seconds exceeded`) + wrapper.exit(0) + }, args["idle-timeout-seconds"]! * 1000) + } + + startIdleShutdownTimer() + + heart.onChange((state) => { + clearTimeout(idleShutdownTimer) + if (state === "expired") { + startIdleShutdownTimer() + } + }) + } + + if (args["disable-proxy"]) { + logger.info(" - Proxy disabled") + } else if (args["proxy-domain"].length > 0) { + logger.info(` - ${plural(args["proxy-domain"].length, "Proxying the following domain")}:`) + args["proxy-domain"].forEach((domain) => logger.info(` - ${domain}`)) + } + if (args["skip-auth-preflight"]) { + logger.info(" - Skipping authentication for preflight requests") + } + if (process.env.VSCODE_PROXY_URI) { + logger.info(`Using proxy URI in PORTS tab: ${process.env.VSCODE_PROXY_URI}`) + } + + const sessionServerAddress = app.editorSessionManagerServer.address() + if (sessionServerAddress) { + logger.info(`Session server listening on ${sessionServerAddress.toString()}`) + } + + if (process.env.EXTENSIONS_GALLERY) { + logger.info("Using custom extensions gallery") + logger.debug(` - ${process.env.EXTENSIONS_GALLERY}`) + } + + if (args.enable && args.enable.length > 0) { + logger.info("Enabling the following experimental features:") + args.enable.forEach((feature) => { + if (Object.values(Feature).includes(feature as Feature)) { + logger.info(` - "${feature}"`) + } else { + logger.error(` X "${feature}" (unknown feature)`) + } + }) + // TODO: Could be nice to add wrapping to the logger? + logger.info( + " The code-server project does not provide stability guarantees or commit to fixing bugs relating to these experimental features. When filing bug reports, please ensure that you can reproduce the bug with all experimental features turned off.", + ) + } + + if (args.open) { + try { + await open(serverAddress) + logger.info(`Opened ${serverAddress}`) + } catch (error) { + logger.error("Failed to open", field("address", serverAddress.toString()), field("error", error)) + } + } + + return { + server: app.server, + dispose: async () => { + disposeRoutes() + await app.dispose() + }, + } +} diff --git a/src/node/plugin.ts b/src/node/plugin.ts deleted file mode 100644 index 54f7f2b76ed5..000000000000 --- a/src/node/plugin.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { field, logger } from "@coder/logger" -import * as fs from "fs" -import * as path from "path" -import * as util from "util" -import { Args } from "./cli" -import { HttpServer } from "./http" - -/* eslint-disable @typescript-eslint/no-var-requires */ - -export type Activate = (httpServer: HttpServer, args: Args) => void - -export interface Plugin { - activate: Activate -} - -/** - * Intercept imports so we can inject code-server when the plugin tries to - * import it. - */ -const originalLoad = require("module")._load -// eslint-disable-next-line @typescript-eslint/no-explicit-any -require("module")._load = function (request: string, parent: object, isMain: boolean): any { - return originalLoad.apply(this, [request.replace(/^code-server/, path.resolve(__dirname, "../..")), parent, isMain]) -} - -const loadPlugin = async (pluginPath: string, httpServer: HttpServer, args: Args): Promise => { - try { - const plugin: Plugin = require(pluginPath) - plugin.activate(httpServer, args) - logger.debug("Loaded plugin", field("name", path.basename(pluginPath))) - } catch (error) { - if (error.code !== "MODULE_NOT_FOUND") { - logger.warn(error.message) - } else { - logger.error(error.message) - } - } -} - -const _loadPlugins = async (httpServer: HttpServer, args: Args): Promise => { - const pluginPath = path.resolve(__dirname, "../../plugins") - const files = await util.promisify(fs.readdir)(pluginPath, { - withFileTypes: true, - }) - await Promise.all(files.map((file) => loadPlugin(path.join(pluginPath, file.name), httpServer, args))) -} - -export const loadPlugins = async (httpServer: HttpServer, args: Args): Promise => { - try { - await _loadPlugins(httpServer, args) - } catch (error) { - if (error.code !== "ENOENT") { - logger.warn(error.message) - } - } - - if (process.env.PLUGIN_DIR) { - await loadPlugin(process.env.PLUGIN_DIR, httpServer, args) - } -} diff --git a/src/node/proxy.ts b/src/node/proxy.ts new file mode 100644 index 000000000000..afa964ae529b --- /dev/null +++ b/src/node/proxy.ts @@ -0,0 +1,27 @@ +import proxyServer from "http-proxy" +import { HttpCode } from "../common/http" + +export const proxy = proxyServer.createProxyServer({}) + +// The error handler catches when the proxy fails to connect (for example when +// there is nothing running on the target port). +proxy.on("error", (error, _, res) => { + // This could be for either a web socket or a regular request. Despite what + // the types say, writeHead() will not exist on web socket requests (nor will + // status() from Express). But writing out the code manually does not work + // for regular requests thus the branching behavior. + if (typeof res.writeHead !== "undefined") { + res.writeHead(HttpCode.ServerError) + res.end(error.message) + } else { + res.end(`HTTP/1.1 ${HttpCode.ServerError} ${error.message}\r\n\r\n`) + } +}) + +// Intercept the response to rewrite absolute redirects against the base path. +// Is disabled when the request has no base path which means /absproxy is in use. +proxy.on("proxyRes", (res, req) => { + if (res.headers.location && res.headers.location.startsWith("/") && (req as any).base) { + res.headers.location = (req as any).base + res.headers.location + } +}) diff --git a/src/node/routes/domainProxy.ts b/src/node/routes/domainProxy.ts new file mode 100644 index 000000000000..6ffee67fa002 --- /dev/null +++ b/src/node/routes/domainProxy.ts @@ -0,0 +1,118 @@ +import { Request, Router } from "express" +import { HttpCode, HttpError } from "../../common/http" +import { getHost, ensureProxyEnabled, authenticated, ensureAuthenticated, ensureOrigin, redirect, self } from "../http" +import { proxy } from "../proxy" +import { Router as WsRouter } from "../wsRouter" + +export const router = Router() + +const proxyDomainToRegex = (matchString: string): RegExp => { + const escapedMatchString = matchString.replace(/[.*+?^$()|[\]\\]/g, "\\$&") + + // Replace {{port}} with a regex group to capture the port + // Replace {{host}} with .+ to allow any host match (so rely on DNS record here) + let regexString = escapedMatchString.replace("{{port}}", "(\\d+)") + regexString = regexString.replace("{{host}}", ".+") + + regexString = regexString.replace(/[{}]/g, "\\$&") //replace any '{}' that might be left + + return new RegExp("^" + regexString + "$") +} + +let proxyRegexes: RegExp[] = [] +const proxyDomainsToRegex = (proxyDomains: string[]): RegExp[] => { + if (proxyDomains.length !== proxyRegexes.length) { + proxyRegexes = proxyDomains.map(proxyDomainToRegex) + } + return proxyRegexes +} + +/** + * Return the port if the request should be proxied. + * + * The proxy-domain should be of format anyprefix-{{port}}-anysuffix.{{host}}, where {{host}} is optional + * e.g. code-8080.domain.tld would match for code-{{port}}.domain.tld and code-{{port}}.{{host}}. + * + */ +const maybeProxy = (req: Request): string | undefined => { + const reqDomain = getHost(req) + if (reqDomain === undefined) { + return undefined + } + + const regexs = proxyDomainsToRegex(req.args["proxy-domain"]) + + for (const regex of regexs) { + const match = reqDomain.match(regex) + + if (match) { + return match[1] // match[1] contains the port + } + } + + return undefined +} + +router.all(/.*/, async (req, res, next) => { + const port = maybeProxy(req) + if (!port) { + return next() + } + + ensureProxyEnabled(req) + + if (req.method === "OPTIONS" && req.args["skip-auth-preflight"]) { + // Allow preflight requests with `skip-auth-preflight` flag + return next() + } + + // Must be authenticated to use the proxy. + const isAuthenticated = await authenticated(req) + if (!isAuthenticated) { + // Let the assets through since they're used on the login page. + if (req.path.startsWith("/_static/") && req.method === "GET") { + return next() + } + + // Assume anything that explicitly accepts text/html is a user browsing a + // page (as opposed to an xhr request). Don't use `req.accepts()` since + // *every* request that I've seen (in Firefox and Chromium at least) + // includes `*/*` making it always truthy. Even for css/javascript. + if (req.headers.accept && req.headers.accept.includes("text/html")) { + // Let the login through. + if (/\/login\/?/.test(req.path)) { + return next() + } + // Redirect all other pages to the login. + const to = self(req) + return redirect(req, res, "login", { + to: to !== "/" ? to : undefined, + }) + } + + // Everything else gets an unauthorized message. + throw new HttpError("Unauthorized", HttpCode.Unauthorized) + } + + proxy.web(req, res, { + ignorePath: true, + target: `http://0.0.0.0:${port}${req.originalUrl}`, + }) +}) + +export const wsRouter = WsRouter() + +wsRouter.ws(/.*/, async (req, _, next) => { + const port = maybeProxy(req) + if (!port) { + return next() + } + + ensureProxyEnabled(req) + ensureOrigin(req) + await ensureAuthenticated(req) + proxy.ws(req, req.ws, req.head, { + ignorePath: true, + target: `http://0.0.0.0:${port}${req.originalUrl}`, + }) +}) diff --git a/src/node/routes/errors.ts b/src/node/routes/errors.ts new file mode 100644 index 000000000000..da0ee8d7c07f --- /dev/null +++ b/src/node/routes/errors.ts @@ -0,0 +1,77 @@ +import { logger } from "@coder/logger" +import express from "express" +import { promises as fs } from "fs" +import path from "path" +import { HttpCode } from "../../common/http" +import { rootPath } from "../constants" +import { replaceTemplates } from "../http" +import { escapeHtml, getMediaMime } from "../util" +import type { WebsocketRequest } from "../wsRouter" + +interface ErrorWithStatusCode { + statusCode: number +} + +interface ErrorWithCode { + code: string +} + +/** Error is network related. */ +export const errorHasStatusCode = (error: any): error is ErrorWithStatusCode => { + return error && "statusCode" in error +} + +/** Error originates from file system. */ +export const errorHasCode = (error: any): error is ErrorWithCode => { + return error && "code" in error +} + +const notFoundCodes = [404, "ENOENT", "EISDIR"] + +export const errorHandler: express.ErrorRequestHandler = async (err, req, res, next) => { + let statusCode = 500 + + if (errorHasStatusCode(err)) { + statusCode = err.statusCode + } else if (errorHasCode(err) && notFoundCodes.includes(err.code)) { + statusCode = HttpCode.NotFound + } + + res.status(statusCode) + + // Assume anything that explicitly accepts text/html is a user browsing a + // page (as opposed to an xhr request). Don't use `req.accepts()` since + // *every* request that I've seen (in Firefox and Chromium at least) + // includes `*/*` making it always truthy. Even for css/javascript. + if (req.headers.accept && req.headers.accept.includes("text/html")) { + const resourcePath = path.resolve(rootPath, "src/browser/pages/error.html") + res.set("Content-Type", getMediaMime(resourcePath)) + const content = await fs.readFile(resourcePath, "utf8") + res.send( + replaceTemplates(req, content) + .replace(/{{ERROR_TITLE}}/g, statusCode.toString()) + .replace(/{{ERROR_HEADER}}/g, statusCode.toString()) + .replace(/{{ERROR_BODY}}/g, escapeHtml(err.message)), + ) + } else { + res.json({ + error: err.message, + ...(err.details || {}), + }) + } +} + +export const wsErrorHandler: express.ErrorRequestHandler = async (err, req, res, next) => { + let statusCode = 500 + if (errorHasStatusCode(err)) { + statusCode = err.statusCode + } else if (errorHasCode(err) && notFoundCodes.includes(err.code)) { + statusCode = HttpCode.NotFound + } + if (statusCode >= 500) { + logger.error(`${err.message} ${err.stack}`) + } else { + logger.debug(`${err.message} ${err.stack}`) + } + ;(req as WebsocketRequest).ws.end(`HTTP/1.1 ${statusCode} ${err.message}\r\n\r\n`) +} diff --git a/src/node/routes/health.ts b/src/node/routes/health.ts new file mode 100644 index 000000000000..faf1f9c75141 --- /dev/null +++ b/src/node/routes/health.ts @@ -0,0 +1,28 @@ +import { Router } from "express" +import { wss, Router as WsRouter } from "../wsRouter" + +export const router = Router() + +router.get("/", (req, res) => { + res.json({ + status: req.heart.alive() ? "alive" : "expired", + lastHeartbeat: req.heart.lastHeartbeat, + }) +}) + +export const wsRouter = WsRouter() + +wsRouter.ws("/", async (req) => { + wss.handleUpgrade(req, req.ws, req.head, (ws) => { + ws.addEventListener("message", () => { + ws.send( + JSON.stringify({ + event: "health", + status: req.heart.alive() ? "alive" : "expired", + lastHeartbeat: req.heart.lastHeartbeat, + }), + ) + }) + req.ws.resume() + }) +}) diff --git a/src/node/routes/index.ts b/src/node/routes/index.ts new file mode 100644 index 000000000000..28bfc58d3ee7 --- /dev/null +++ b/src/node/routes/index.ts @@ -0,0 +1,186 @@ +import { logger } from "@coder/logger" +import cookieParser from "cookie-parser" +import * as express from "express" +import { promises as fs } from "fs" +import * as path from "path" +import * as tls from "tls" +import { Disposable } from "../../common/emitter" +import { HttpCode, HttpError } from "../../common/http" +import { plural } from "../../common/util" +import { App } from "../app" +import { AuthType, DefaultedArgs } from "../cli" +import { commit, rootPath } from "../constants" +import { Heart } from "../heart" +import { redirect } from "../http" +import { CoderSettings, SettingsProvider } from "../settings" +import { UpdateProvider } from "../update" +import { getMediaMime, paths } from "../util" +import type { WebsocketRequest } from "../wsRouter" +import * as domainProxy from "./domainProxy" +import { errorHandler, wsErrorHandler } from "./errors" +import * as health from "./health" +import * as login from "./login" +import * as logout from "./logout" +import * as pathProxy from "./pathProxy" +import * as update from "./update" +import * as vscode from "./vscode" + +/** + * Register all routes and middleware. + */ +export const register = async ( + app: App, + args: DefaultedArgs, +): Promise<{ disposeRoutes: Disposable["dispose"]; heart: Heart }> => { + const heart = new Heart(path.join(paths.data, "heartbeat"), async () => { + return new Promise((resolve, reject) => { + // getConnections appears to not call the callback when there are no more + // connections. Feels like it must be a bug? For now add a timer to make + // sure we eventually resolve. + const timer = setTimeout(() => { + logger.debug("Node failed to respond with connections; assuming zero") + resolve(false) + }, 5000) + app.server.getConnections((error, count) => { + clearTimeout(timer) + if (error) { + return reject(error) + } + logger.debug(plural(count, `${count} active connection`)) + resolve(count > 0) + }) + }) + }) + + app.router.disable("x-powered-by") + app.wsRouter.disable("x-powered-by") + + app.router.use(cookieParser()) + app.wsRouter.use(cookieParser()) + + const settings = new SettingsProvider(path.join(args["user-data-dir"], "coder.json")) + const updater = new UpdateProvider("https://api.github.com/repos/coder/code-server/releases/latest", settings) + + const common: express.RequestHandler = (req, _, next) => { + // /healthz|/healthz/ needs to be excluded otherwise health checks will make + // it look like code-server is always in use. + if (!/^\/healthz\/?$/.test(req.url)) { + // NOTE@jsjoeio - intentionally not awaiting the .beat() call here because + // we don't want to slow down the request. + heart.beat() + } + + // Add common variables routes can use. + req.args = args + req.heart = heart + req.settings = settings + req.updater = updater + + next() + } + + app.router.use(common) + app.wsRouter.use(common) + + app.router.use(/.*/, async (req, res, next) => { + // If we're handling TLS ensure all requests are redirected to HTTPS. + // TODO: This does *NOT* work if you have a base path since to specify the + // protocol we need to specify the whole path. + if (args.cert && !(req.connection as tls.TLSSocket).encrypted) { + return res.redirect(`https://${req.headers.host}${req.originalUrl}`) + } + next() + }) + + app.router.get(["/security.txt", "/.well-known/security.txt"], async (_, res) => { + const resourcePath = path.resolve(rootPath, "src/browser/security.txt") + res.set("Content-Type", getMediaMime(resourcePath)) + res.send(await fs.readFile(resourcePath)) + }) + + app.router.get("/robots.txt", async (_, res) => { + const resourcePath = path.resolve(rootPath, "src/browser/robots.txt") + res.set("Content-Type", getMediaMime(resourcePath)) + res.send(await fs.readFile(resourcePath)) + }) + + app.router.use("/", domainProxy.router) + app.wsRouter.use("/", domainProxy.wsRouter.router) + + app.router.all("/proxy/:port{/*path}", async (req, res) => { + await pathProxy.proxy(req, res) + }) + app.wsRouter.get("/proxy/:port{/*path}", async (req) => { + await pathProxy.wsProxy(req as unknown as WebsocketRequest) + }) + // These two routes pass through the path directly. + // So the proxied app must be aware it is running + // under /absproxy// + app.router.all("/absproxy/:port{/*path}", async (req, res) => { + await pathProxy.proxy(req, res, { + passthroughPath: true, + proxyBasePath: args["abs-proxy-base-path"], + }) + }) + app.wsRouter.get("/absproxy/:port{/*path}", async (req) => { + await pathProxy.wsProxy(req as unknown as WebsocketRequest, { + passthroughPath: true, + proxyBasePath: args["abs-proxy-base-path"], + }) + }) + + app.router.use(express.json()) + app.router.use(express.urlencoded({ extended: true })) + + app.router.use( + "/_static", + express.static(rootPath, { + cacheControl: commit !== "development", + fallthrough: false, + setHeaders: (res, path, stat) => { + // The service worker is served from a sub-path on the static route so + // this is required to allow it to register a higher scope (by default + // the browser only allows it to register from its own path or lower). + if (path.endsWith("/serviceWorker.js")) { + res.setHeader("Service-Worker-Allowed", "/") + } + }, + }), + ) + + app.router.use("/healthz", health.router) + app.wsRouter.use("/healthz", health.wsRouter.router) + + if (args.auth === AuthType.Password) { + app.router.use("/login", login.router) + app.router.use("/logout", logout.router) + } else { + app.router.all("/login", (req, res) => redirect(req, res, "/", {})) + app.router.all("/logout", (req, res) => redirect(req, res, "/", {})) + } + + app.router.use("/update", update.router) + + // For historic reasons we also load at /vscode because the root was replaced + // by a plugin in v1 of Coder. The plugin system (which was for internal use + // only) has been removed, but leave the additional route for now. + for (const routePrefix of ["/vscode", "/"]) { + app.router.use(routePrefix, vscode.router) + app.wsRouter.use(routePrefix, vscode.wsRouter.router) + } + + app.router.use(() => { + throw new HttpError("Not Found", HttpCode.NotFound) + }) + + app.router.use(errorHandler) + app.wsRouter.use(wsErrorHandler) + + return { + disposeRoutes: () => { + heart.dispose() + vscode.dispose() + }, + heart, + } +} diff --git a/src/node/routes/login.ts b/src/node/routes/login.ts new file mode 100644 index 000000000000..7a8bb5134c68 --- /dev/null +++ b/src/node/routes/login.ts @@ -0,0 +1,123 @@ +import { Router, Request } from "express" +import { promises as fs } from "fs" +import { RateLimiter as Limiter } from "limiter" +import * as path from "path" +import { CookieKeys } from "../../common/http" +import { rootPath } from "../constants" +import { authenticated, getCookieOptions, redirect, replaceTemplates } from "../http" +import i18n from "../i18n" +import { getPasswordMethod, handlePasswordValidation, sanitizeString, escapeHtml } from "../util" + +// RateLimiter wraps around the limiter library for logins. +// It allows 2 logins every minute plus 12 logins every hour. +export class RateLimiter { + private readonly minuteLimiter = new Limiter({ tokensPerInterval: 2, interval: "minute" }) + private readonly hourLimiter = new Limiter({ tokensPerInterval: 12, interval: "hour" }) + + public canTry(): boolean { + // Note: we must check using >= 1 because technically when there are no tokens left + // you get back a number like 0.00013333333333333334 + // which would cause fail if the logic were > 0 + return this.minuteLimiter.getTokensRemaining() >= 1 || this.hourLimiter.getTokensRemaining() >= 1 + } + + public removeToken(): boolean { + return this.minuteLimiter.tryRemoveTokens(1) || this.hourLimiter.tryRemoveTokens(1) + } +} + +const getRoot = async (req: Request, error?: Error): Promise => { + const content = await fs.readFile(path.join(rootPath, "src/browser/pages/login.html"), "utf8") + const locale = req.args["locale"] || "en" + i18n.changeLanguage(locale) + const appName = req.args["app-name"] || "code-server" + const welcomeText = req.args["welcome-text"] || (i18n.t("WELCOME", { app: appName }) as string) + + // Determine password message using i18n + let passwordMsg = i18n.t("LOGIN_PASSWORD", { configFile: req.args.config }) + if (req.args.usingEnvPassword) { + passwordMsg = i18n.t("LOGIN_USING_ENV_PASSWORD") + } else if (req.args.usingEnvHashedPassword) { + passwordMsg = i18n.t("LOGIN_USING_HASHED_PASSWORD") + } + + return replaceTemplates( + req, + content + .replace(/{{I18N_LOGIN_TITLE}}/g, i18n.t("LOGIN_TITLE", { app: appName })) + .replace(/{{WELCOME_TEXT}}/g, welcomeText) + .replace(/{{PASSWORD_MSG}}/g, passwordMsg) + .replace(/{{I18N_LOGIN_BELOW}}/g, i18n.t("LOGIN_BELOW")) + .replace(/{{I18N_PASSWORD_PLACEHOLDER}}/g, i18n.t("PASSWORD_PLACEHOLDER")) + .replace(/{{I18N_SUBMIT}}/g, i18n.t("SUBMIT")) + .replace(/{{ERROR}}/, error ? `
${escapeHtml(error.message)}
` : ""), + ) +} + +const limiter = new RateLimiter() + +export const router = Router() + +router.use(async (req, res, next) => { + const to = (typeof req.query.to === "string" && req.query.to) || "/" + if (await authenticated(req)) { + return redirect(req, res, to, { to: undefined }) + } + next() +}) + +router.get("/", async (req, res) => { + res.send(await getRoot(req)) +}) + +router.post<{}, string, { password?: string; base?: string } | undefined, { to?: string }>("/", async (req, res) => { + const password = sanitizeString(req.body?.password) + const hashedPasswordFromArgs = req.args["hashed-password"] + + try { + // Check to see if they exceeded their login attempts + if (!limiter.canTry()) { + throw new Error(i18n.t("LOGIN_RATE_LIMIT") as string) + } + + if (!password) { + throw new Error(i18n.t("MISS_PASSWORD") as string) + } + + const passwordMethod = getPasswordMethod(hashedPasswordFromArgs) + const { isPasswordValid, hashedPassword } = await handlePasswordValidation({ + passwordMethod, + hashedPasswordFromArgs, + passwordFromRequestBody: password, + passwordFromArgs: req.args.password, + }) + + if (isPasswordValid) { + // The hash does not add any actual security but we do it for + // obfuscation purposes (and as a side effect it handles escaping). + res.cookie(CookieKeys.Session, hashedPassword, getCookieOptions(req)) + + const to = (typeof req.query.to === "string" && req.query.to) || "/" + return redirect(req, res, to, { to: undefined }) + } + + // Note: successful logins should not count against the RateLimiter + // which is why this logic must come after the successful login logic + limiter.removeToken() + + console.error( + "Failed login attempt", + JSON.stringify({ + xForwardedFor: req.headers["x-forwarded-for"], + remoteAddress: req.connection.remoteAddress, + userAgent: req.headers["user-agent"], + timestamp: Math.floor(new Date().getTime() / 1000), + }), + ) + + throw new Error(i18n.t("INCORRECT_PASSWORD") as string) + } catch (error: any) { + const renderedHtml = await getRoot(req, error) + res.send(renderedHtml) + } +}) diff --git a/src/node/routes/logout.ts b/src/node/routes/logout.ts new file mode 100644 index 000000000000..63d8accbcef9 --- /dev/null +++ b/src/node/routes/logout.ts @@ -0,0 +1,14 @@ +import { Router } from "express" +import { CookieKeys } from "../../common/http" +import { getCookieOptions, redirect } from "../http" +import { sanitizeString } from "../util" + +export const router = Router() + +router.get<{}, undefined, undefined, { base?: string; to?: string }>("/", async (req, res) => { + // Must use the *identical* properties used to set the cookie. + res.clearCookie(CookieKeys.Session, getCookieOptions(req)) + + const to = sanitizeString(req.query.to) || "/" + return redirect(req, res, to, { to: undefined, base: undefined, href: undefined }) +}) diff --git a/src/node/routes/pathProxy.ts b/src/node/routes/pathProxy.ts new file mode 100644 index 000000000000..7d4f286f6519 --- /dev/null +++ b/src/node/routes/pathProxy.ts @@ -0,0 +1,77 @@ +import { Request, Response } from "express" +import * as path from "path" +import { HttpCode, HttpError } from "../../common/http" +import { ensureProxyEnabled, authenticated, ensureAuthenticated, ensureOrigin, redirect, self } from "../http" +import { proxy as _proxy } from "../proxy" +import type { WebsocketRequest } from "../wsRouter" + +const getProxyTarget = ( + req: Request, + opts?: { + proxyBasePath?: string + }, +): string => { + // If there is a base path, strip it out. + const base = (req as any).base || "" + const port = parseInt(req.params.port, 10) + if (isNaN(port)) { + throw new HttpError("Invalid port", HttpCode.BadRequest) + } + return `http://0.0.0.0:${port}${opts?.proxyBasePath || ""}/${req.originalUrl.slice(base.length)}` +} + +export async function proxy( + req: Request, + res: Response, + opts?: { + passthroughPath?: boolean + proxyBasePath?: string + }, +): Promise { + ensureProxyEnabled(req) + + if (req.method === "OPTIONS" && req.args["skip-auth-preflight"]) { + // Allow preflight requests with `skip-auth-preflight` flag + } else if (!(await authenticated(req))) { + // If visiting the root (/:port only) redirect to the login page. + if (!req.params.path || req.params.path === "/") { + const to = self(req) + return redirect(req, res, "login", { + to: to !== "/" ? to : undefined, + }) + } + throw new HttpError("Unauthorized", HttpCode.Unauthorized) + } + + // The base is used for rewriting (redirects, target). + if (!opts?.passthroughPath) { + ;(req as any).base = req.path.split(path.sep).slice(0, 3).join(path.sep) + } + + _proxy.web(req, res, { + ignorePath: true, + target: getProxyTarget(req, opts), + }) +} + +export async function wsProxy( + req: WebsocketRequest, + opts?: { + passthroughPath?: boolean + proxyBasePath?: string + }, +): Promise { + ensureProxyEnabled(req) + ensureOrigin(req) + await ensureAuthenticated(req) + + // The base is used for rewriting (redirects, target). + if (!opts?.passthroughPath) { + ;(req as any).base = req.path.split(path.sep).slice(0, 3).join(path.sep) + } + + _proxy.ws(req, req.ws, req.head, { + ignorePath: true, + target: getProxyTarget(req, opts), + }) +} diff --git a/src/node/routes/update.ts b/src/node/routes/update.ts new file mode 100644 index 000000000000..60d2011eae72 --- /dev/null +++ b/src/node/routes/update.ts @@ -0,0 +1,15 @@ +import { Router } from "express" +import { version } from "../constants" +import { ensureAuthenticated } from "../http" + +export const router = Router() + +router.get("/check", ensureAuthenticated, async (req, res) => { + const update = await req.updater.getUpdate(req.query.force === "true") + res.json({ + checked: update.checked, + latest: update.version, + current: version, + isLatest: req.updater.isLatestVersion(update), + }) +}) diff --git a/src/node/routes/vscode.ts b/src/node/routes/vscode.ts new file mode 100644 index 000000000000..33d1287a7892 --- /dev/null +++ b/src/node/routes/vscode.ts @@ -0,0 +1,259 @@ +import { logger } from "@coder/logger" +import * as crypto from "crypto" +import * as express from "express" +import { promises as fs } from "fs" +import * as http from "http" +import * as net from "net" +import * as os from "os" +import * as path from "path" +import { logError } from "../../common/util" +import { CodeArgs, toCodeArgs } from "../cli" +import { isDevMode, vsRootPath } from "../constants" +import { authenticated, ensureAuthenticated, ensureOrigin, redirect, replaceTemplates, self } from "../http" +import { SocketProxyProvider } from "../socket" +import { isFile } from "../util" +import { type WebsocketRequest, Router as WsRouter } from "../wsRouter" + +export const router = express.Router() + +export const wsRouter = WsRouter() + +/** + * The API of VS Code's web client server. code-server delegates requests to VS + * Code here. + * + * @see ../../../lib/vscode/src/vs/server/node/server.main.ts:72 + */ +export interface IVSCodeServerAPI { + handleRequest(req: http.IncomingMessage, res: http.ServerResponse): Promise + handleUpgrade(req: http.IncomingMessage, socket: net.Socket): void + handleServerError(err: Error): void + dispose(): void +} + +/** + * VS Code's CLI entrypoint (../../../lib/vscode/src/server-main.js). + * + * Normally VS Code will run `node server-main.js` which starts either the web + * server or the CLI (for installing extensions, etc) but we patch it so we can + * `require` it and call its functions directly in order to integrate with our + * web server. + */ +export type VSCodeModule = { + // See ../../../lib/vscode/src/server-main.js:339. + loadCodeWithNls(): Promise<{ + // See ../../../lib/vscode/src/vs/server/node/server.main.ts:72. + createServer(address: string | net.AddressInfo | null, args: CodeArgs): Promise + // See ../../../lib/vscode/src/vs/server/node/server.main.ts:65. + spawnCli(args: CodeArgs): Promise + }> +} + +/** + * Load then create the VS Code server. + */ +async function loadVSCode(req: express.Request): Promise { + // Since server-main.js is an ES module, we have to use `import`. However, + // tsc will transpile this to `require` unless we change our module type, + // which will also require that we switch to ESM, since a hybrid approach + // breaks importing `rotating-file-stream` for some reason. To work around + // this, use `eval` for now, but we should consider switching to ESM. + let modPath = path.join(vsRootPath, "out/server-main.js") + if (os.platform() === "win32") { + // On Windows, absolute paths of ESM modules must be a valid file URI. + modPath = "file:///" + modPath.replace(/\\/g, "/") + } + const mod = (await eval(`import("${modPath}")`)) as VSCodeModule + const serverModule = await mod.loadCodeWithNls() + return serverModule.createServer(null, { + ...(await toCodeArgs(req.args)), + "accept-server-license-terms": true, + // This seems to be used to make the connection token flags optional (when + // set to 1.63) but we have always included them. + compatibility: "1.64", + "without-connection-token": true, + }) +} + +// To prevent loading the module more than once at a time. We also have the +// resolved value so you do not need to `await` everywhere. +let vscodeServerPromise: Promise | undefined + +// The resolved value from the dynamically loaded VS Code server. Do not use +// without first calling and awaiting `ensureCodeServerLoaded`. +let vscodeServer: IVSCodeServerAPI | undefined + +/** + * Ensure the VS Code server is loaded. + */ +export const ensureVSCodeLoaded = async ( + req: express.Request, + _: express.Response, + next: express.NextFunction, +): Promise => { + if (vscodeServer) { + return next() + } + if (!vscodeServerPromise) { + vscodeServerPromise = loadVSCode(req) + } + try { + vscodeServer = await vscodeServerPromise + } catch (error) { + vscodeServerPromise = undefined // Unset so we can try again. + logError(logger, "CodeServerRouteWrapper", error) + if (isDevMode) { + return next( + new Error( + (error instanceof Error ? error.message : error) + + " (Have you applied the patches? If so, VS Code may still be compiling)", + ), + ) + } + return next(error) + } + return next() +} + +router.get("/", ensureVSCodeLoaded, async (req, res, next) => { + const isAuthenticated = await authenticated(req) + const NO_FOLDER_OR_WORKSPACE_QUERY = !req.query.folder && !req.query.workspace + // Ew means the workspace was closed so clear the last folder/workspace. + const FOLDER_OR_WORKSPACE_WAS_CLOSED = req.query.ew + + if (!isAuthenticated) { + const to = self(req) + return redirect(req, res, "login", { + to: to !== "/" ? to : undefined, + }) + } + + if (NO_FOLDER_OR_WORKSPACE_QUERY && !FOLDER_OR_WORKSPACE_WAS_CLOSED) { + const settings = await req.settings.read() + const lastOpened = settings.query || {} + // This flag disables the last opened behavior + const IGNORE_LAST_OPENED = req.args["ignore-last-opened"] + const HAS_LAST_OPENED_FOLDER_OR_WORKSPACE = lastOpened.folder || lastOpened.workspace + const HAS_FOLDER_OR_WORKSPACE_FROM_CLI = req.args._.length > 0 + const to = self(req) + + let folder = undefined + let workspace = undefined + + // Redirect to the last folder/workspace if nothing else is opened. + if (HAS_LAST_OPENED_FOLDER_OR_WORKSPACE && !IGNORE_LAST_OPENED) { + folder = lastOpened.folder + workspace = lastOpened.workspace + } else if (HAS_FOLDER_OR_WORKSPACE_FROM_CLI) { + const lastEntry = path.resolve(req.args._[req.args._.length - 1]) + const entryIsFile = await isFile(lastEntry) + const IS_WORKSPACE_FILE = entryIsFile && path.extname(lastEntry) === ".code-workspace" + + if (IS_WORKSPACE_FILE) { + workspace = lastEntry + } else if (!entryIsFile) { + folder = lastEntry + } + } + + if (folder || workspace) { + return redirect(req, res, to, { + folder, + workspace, + }) + } + } + + // Store the query parameters so we can use them on the next load. This + // also allows users to create functionality around query parameters. + await req.settings.write({ query: req.query }) + + next() +}) + +router.get("/manifest.json", async (req, res) => { + const appName = req.args["app-name"] || "code-server" + res.writeHead(200, { "Content-Type": "application/manifest+json" }) + + res.end( + replaceTemplates( + req, + JSON.stringify( + { + name: appName, + short_name: appName, + start_url: ".", + display: "fullscreen", + display_override: ["window-controls-overlay"], + description: "Run Code on a remote server.", + icons: [192, 512] + .map((size) => [ + { + src: `{{BASE}}/_static/src/browser/media/pwa-icon-${size}.png`, + type: "image/png", + sizes: `${size}x${size}`, + purpose: "any", + }, + { + src: `{{BASE}}/_static/src/browser/media/pwa-icon-maskable-${size}.png`, + type: "image/png", + sizes: `${size}x${size}`, + purpose: "maskable", + }, + ]) + .flat(), + }, + null, + 2, + ), + ), + ) +}) + +let mintKeyPromise: Promise | undefined +router.post("/mint-key", async (req, res) => { + if (!mintKeyPromise) { + mintKeyPromise = new Promise(async (resolve) => { + const keyPath = path.join(req.args["user-data-dir"], "serve-web-key-half") + logger.debug(`Reading server web key half from ${keyPath}`) + try { + resolve(await fs.readFile(keyPath)) + return + } catch (error: any) { + if (error.code !== "ENOENT") { + logError(logger, `read ${keyPath}`, error) + } + } + // VS Code wants 256 bits. + const key = crypto.randomBytes(32) + try { + await fs.writeFile(keyPath, key) + } catch (error: any) { + logError(logger, `write ${keyPath}`, error) + } + resolve(key) + }) + } + const key = await mintKeyPromise + res.end(key) +}) + +router.all(/.*/, ensureAuthenticated, ensureVSCodeLoaded, async (req, res) => { + vscodeServer!.handleRequest(req, res) +}) + +const socketProxyProvider = new SocketProxyProvider() +wsRouter.ws(/.*/, ensureOrigin, ensureAuthenticated, ensureVSCodeLoaded, async (req: WebsocketRequest) => { + const wrappedSocket = await socketProxyProvider.createProxy(req.ws) + // This should actually accept a duplex stream but it seems Code has not + // been updated to match the Node 16 types so cast for now. There does not + // appear to be any code specific to sockets so this should be fine. + vscodeServer!.handleUpgrade(req, wrappedSocket as net.Socket) + + req.ws.resume() +}) + +export function dispose() { + vscodeServer?.dispose() + socketProxyProvider.stop() +} diff --git a/src/node/settings.ts b/src/node/settings.ts index d68e8e3bdb6f..cc55dd5f9508 100644 --- a/src/node/settings.ts +++ b/src/node/settings.ts @@ -1,8 +1,6 @@ import { logger } from "@coder/logger" -import * as fs from "fs-extra" -import * as path from "path" -import { Route } from "./http" -import { paths } from "./util" +import type { ParsedQs } from "qs" +import { promises as fs } from "fs" export type Settings = { [key: string]: Settings | string | boolean | number } @@ -19,8 +17,8 @@ export class SettingsProvider { public async read(): Promise { try { const raw = (await fs.readFile(this.settingsPath, "utf8")).trim() - return raw ? JSON.parse(raw) : {} - } catch (error) { + return raw ? JSON.parse(raw) : ({} as T) + } catch (error: any) { if (error.code !== "ENOENT") { logger.warn(error.message) } @@ -37,7 +35,7 @@ export class SettingsProvider { const oldSettings = await this.read() const nextSettings = { ...oldSettings, ...settings } await fs.writeFile(this.settingsPath, JSON.stringify(nextSettings, null, 2)) - } catch (error) { + } catch (error: any) { logger.warn(error.message) } } @@ -54,14 +52,5 @@ export interface UpdateSettings { * Global code-server settings. */ export interface CoderSettings extends UpdateSettings { - lastVisited: { - url: string - workspace: boolean - } - query: Route["query"] + query?: ParsedQs } - -/** - * Global code-server settings file. - */ -export const settings = new SettingsProvider(path.join(paths.data, "coder.json")) diff --git a/src/node/socket.ts b/src/node/socket.ts index e5fe667787ec..7ce2068a7029 100644 --- a/src/node/socket.ts +++ b/src/node/socket.ts @@ -1,10 +1,11 @@ -import * as fs from "fs-extra" +import { promises as fs } from "fs" import * as net from "net" import * as path from "path" +import * as stream from "stream" import * as tls from "tls" import { Emitter } from "../common/emitter" import { generateUuid } from "../common/util" -import { tmpdir } from "./util" +import { canConnect, paths } from "./util" /** * Provides a way to proxy a TLS socket. Can be used when you need to pass a @@ -12,7 +13,7 @@ import { tmpdir } from "./util" */ export class SocketProxyProvider { private readonly onProxyConnect = new Emitter() - private proxyPipe = path.join(tmpdir, "tls-proxy") + private proxyPipe = path.join(paths.runtime, "tls-proxy") private _proxyServer?: Promise private readonly proxyTimeout = 5000 @@ -27,10 +28,13 @@ export class SocketProxyProvider { } /** - * Create a socket proxy for TLS sockets. If it's not a TLS socket the - * original socket is returned. This will spawn a proxy server on demand. + * Create a socket proxy for TLS sockets. If it is not a TLS socket the + * original socket or stream is returned. This will spawn a proxy server on + * demand. */ - public async createProxy(socket: net.Socket): Promise { + public async createProxy(socket: tls.TLSSocket | net.Socket): Promise + public async createProxy(socket: stream.Duplex): Promise + public async createProxy(socket: tls.TLSSocket | net.Socket | stream.Duplex): Promise { if (!(socket instanceof tls.TLSSocket)) { return socket } @@ -43,7 +47,7 @@ export class SocketProxyProvider { proxy.once("connect", () => proxy.write(id)) const timeout = setTimeout(() => { - listener.dispose() // eslint-disable-line @typescript-eslint/no-use-before-define + listener.dispose() socket.destroy() proxy.destroy() reject(new Error("TLS socket proxy timed out")) @@ -75,7 +79,10 @@ export class SocketProxyProvider { this._proxyServer = this.findFreeSocketPath(this.proxyPipe) .then((pipe) => { this.proxyPipe = pipe - return Promise.all([fs.mkdirp(tmpdir), fs.remove(this.proxyPipe)]) + return Promise.all([ + fs.mkdir(path.dirname(this.proxyPipe), { recursive: true }), + fs.rm(this.proxyPipe, { force: true, recursive: true }), + ]) }) .then(() => { return new Promise((resolve) => { @@ -89,17 +96,6 @@ export class SocketProxyProvider { } public async findFreeSocketPath(basePath: string, maxTries = 100): Promise { - const canConnect = (path: string): Promise => { - return new Promise((resolve) => { - const socket = net.connect(path) - socket.once("error", () => resolve(false)) - socket.once("connect", () => { - socket.destroy() - resolve(true) - }) - }) - } - let i = 0 let path = basePath while ((await canConnect(path)) && i < maxTries) { diff --git a/src/node/app/update.ts b/src/node/update.ts similarity index 61% rename from src/node/app/update.ts rename to src/node/update.ts index a83f578e1d3c..4e4a1babe501 100644 --- a/src/node/app/update.ts +++ b/src/node/update.ts @@ -1,12 +1,11 @@ import { field, logger } from "@coder/logger" import * as http from "http" import * as https from "https" -import * as path from "path" +import { ProxyAgent } from "proxy-agent" import * as semver from "semver" import * as url from "url" -import { HttpCode, HttpError } from "../../common/http" -import { HttpProvider, HttpProviderOptions, HttpResponse, Route } from "../http" -import { settings as globalSettings, SettingsProvider, UpdateSettings } from "../settings" +import { httpProxyUri, version } from "./constants" +import { SettingsProvider, UpdateSettings } from "./settings" export interface Update { checked: number @@ -18,56 +17,23 @@ export interface LatestResponse { } /** - * HTTP provider for checking updates (does not download/install them). + * Provide update information. */ -export class UpdateHttpProvider extends HttpProvider { +export class UpdateProvider { private update?: Promise private updateInterval = 1000 * 60 * 60 * 24 // Milliseconds between update checks. public constructor( - options: HttpProviderOptions, - public readonly enabled: boolean, /** * The URL for getting the latest version of code-server. Should return JSON * that fulfills `LatestResponse`. */ - private readonly latestUrl = "https://api.github.com/repos/cdr/code-server/releases/latest", + private readonly latestUrl: string, /** - * Update information will be stored here. If not provided, the global - * settings will be used. + * Update information will be stored here. */ - private readonly settings: SettingsProvider = globalSettings, - ) { - super(options) - } - - public async handleRequest(route: Route, request: http.IncomingMessage): Promise { - this.ensureAuthenticated(request) - this.ensureMethod(request) - - if (!this.isRoot(route)) { - throw new HttpError("Not found", HttpCode.NotFound) - } - - if (!this.enabled) { - throw new Error("update checks are disabled") - } - - switch (route.base) { - case "/check": - case "/": { - const update = await this.getUpdate(route.base === "/check") - return { - content: { - ...update, - isLatest: this.isLatestVersion(update), - }, - } - } - } - - throw new HttpError("Not found", HttpCode.NotFound) - } + private readonly settings: SettingsProvider, + ) {} /** * Query for and return the latest update. @@ -89,12 +55,12 @@ export class UpdateHttpProvider extends HttpProvider { if (!update || update.checked + this.updateInterval < now) { const buffer = await this.request(this.latestUrl) const data = JSON.parse(buffer.toString()) as LatestResponse - update = { checked: now, version: data.name } + update = { checked: now, version: data.name.replace(/^v/, "") } await this.settings.write({ update }) } logger.debug("got latest version", field("latest", update.version)) return update - } catch (error) { + } catch (error: any) { logger.error("Failed to get latest version", field("error", error.message)) return { checked: now, @@ -103,18 +69,13 @@ export class UpdateHttpProvider extends HttpProvider { } } - public get currentVersion(): string { - return require(path.resolve(__dirname, "../../../package.json")).version - } - /** * Return true if the currently installed version is the latest. */ public isLatestVersion(latest: Update): boolean { - const version = this.currentVersion logger.debug("comparing versions", field("current", version), field("latest", latest.version)) try { - return latest.version === version || semver.lt(latest.version, version) + return semver.lte(latest.version, version) } catch (error) { return true } @@ -142,26 +103,30 @@ export class UpdateHttpProvider extends HttpProvider { return new Promise((resolve, reject) => { const request = (uri: string): void => { logger.debug("Making request", field("uri", uri)) - const httpx = uri.startsWith("https") ? https : http - const client = httpx.get(uri, { headers: { "User-Agent": "code-server" } }, (response) => { - if ( - response.statusCode && - response.statusCode >= 300 && - response.statusCode < 400 && - response.headers.location - ) { + const isHttps = uri.startsWith("https") + const agent = new ProxyAgent({ + keepAlive: true, + getProxyForUrl: () => httpProxyUri || "", + }) + const httpx = isHttps ? https : http + const client = httpx.get(uri, { headers: { "User-Agent": "code-server" }, agent }, (response) => { + if (!response.statusCode || response.statusCode < 200 || response.statusCode >= 400) { + response.destroy() + return reject(new Error(`${uri}: ${response.statusCode || "500"}`)) + } + + if (response.statusCode >= 300) { + response.destroy() ++redirects if (redirects > maxRedirects) { return reject(new Error("reached max redirects")) } - response.destroy() + if (!response.headers.location) { + return reject(new Error("received redirect with no location header")) + } return request(url.resolve(uri, response.headers.location)) } - if (!response.statusCode || response.statusCode < 200 || response.statusCode >= 400) { - return reject(new Error(`${uri}: ${response.statusCode || "500"}`)) - } - resolve(response) }) client.on("error", reject) diff --git a/src/node/util.ts b/src/node/util.ts index c0f37f74b47e..b7c0c3fa5339 100644 --- a/src/node/util.ts +++ b/src/node/util.ts @@ -1,77 +1,134 @@ +import * as argon2 from "argon2" import * as cp from "child_process" import * as crypto from "crypto" import envPaths from "env-paths" -import * as fs from "fs-extra" +import { promises as fs } from "fs" +import * as net from "net" import * as os from "os" import * as path from "path" +import safeCompare from "safe-compare" import * as util from "util" import xdgBasedir from "xdg-basedir" -export const tmpdir = path.join(os.tmpdir(), "code-server") - -interface Paths { +export interface Paths { data: string config: string + runtime: string } -export const paths = getEnvPaths() +// From https://github.com/chalk/ansi-regex +const pattern = [ + "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", + "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))", +].join("|") +const re = new RegExp(pattern, "g") +export type OnLineCallback = (strippedLine: string, originalLine: string) => void /** - * Gets the config and data paths for the current platform/configuration. - * On MacOS this function gets the standard XDG directories instead of using the native macOS - * ones. Most CLIs do this as in practice only GUI apps use the standard macOS directories. + * Split stdout on newlines and strip ANSI codes. */ -function getEnvPaths(): Paths { - let paths: Paths - if (process.platform === "win32") { - paths = envPaths("code-server", { - suffix: "", - }) - } else { - if (xdgBasedir.data === undefined || xdgBasedir.config === undefined) { - throw new Error("No home folder?") - } - paths = { - data: path.join(xdgBasedir.data, "code-server"), - config: path.join(xdgBasedir.config, "code-server"), - } +export const onLine = (proc: cp.ChildProcess, callback: OnLineCallback): void => { + let buffer = "" + if (!proc.stdout) { + throw new Error("no stdout") } + proc.stdout.setEncoding("utf8") + proc.stdout.on("data", (d) => { + const data = buffer + d + const split = data.split("\n") + const last = split.length - 1 + + for (let i = 0; i < last; ++i) { + callback(split[i].replace(re, ""), split[i]) + } - return paths + // The last item will either be an empty string (the data ended with a + // newline) or a partial line (did not end with a newline) and we must + // wait to parse it until we get a full line. + buffer = split[last] + }) } +export const paths = getEnvPaths() + /** - * humanPath replaces the home directory in p with ~. - * Makes it more readable. - * - * @param p + * Gets the config and data paths for the current platform/configuration. + * On MacOS this function gets the standard XDG directories instead of using the native macOS + * ones. Most CLIs do this as in practice only GUI apps use the standard macOS directories. */ -export function humanPath(p?: string): string { - if (!p) { - return "" +export function getEnvPaths(platform = process.platform): Paths { + const paths = envPaths("code-server", { suffix: "" }) + const append = (p: string): string => path.join(p, "code-server") + switch (platform) { + case "darwin": + return { + // envPaths uses native directories so force Darwin to use the XDG spec + // to align with other CLI tools. + data: xdgBasedir.data ? append(xdgBasedir.data) : paths.data, + config: xdgBasedir.config ? append(xdgBasedir.config) : paths.config, + // Fall back to temp if there is no runtime dir. + runtime: xdgBasedir.runtime ? append(xdgBasedir.runtime) : paths.temp, + } + case "win32": + return { + data: paths.data, + config: paths.config, + // Windows doesn't have a runtime dir. + runtime: paths.temp, + } + default: + return { + data: paths.data, + config: paths.config, + // Fall back to temp if there is no runtime dir. + runtime: xdgBasedir.runtime ? append(xdgBasedir.runtime) : paths.temp, + } } - return p.replace(os.homedir(), "~") } -export const generateCertificate = async (): Promise<{ cert: string; certKey: string }> => { - const paths = { - cert: path.join(tmpdir, "self-signed.cert"), - certKey: path.join(tmpdir, "self-signed.key"), - } - const checks = await Promise.all([fs.pathExists(paths.cert), fs.pathExists(paths.certKey)]) - if (!checks[0] || !checks[1]) { +export const generateCertificate = async (hostname: string): Promise<{ cert: string; certKey: string }> => { + const certPath = path.join(paths.data, `${hostname.replace(/\./g, "_")}.crt`) + const certKeyPath = path.join(paths.data, `${hostname.replace(/\./g, "_")}.key`) + + // Try generating the certificates if we can't access them (which probably + // means they don't exist). + try { + await Promise.all([fs.access(certPath), fs.access(certKeyPath)]) + } catch (error) { // Require on demand so openssl isn't required if you aren't going to // generate certificates. const pem = require("pem") as typeof import("pem") const certs = await new Promise((resolve, reject): void => { - pem.createCertificate({ selfSigned: true }, (error, result) => { - return error ? reject(error) : resolve(result) - }) + pem.createCertificate( + { + selfSigned: true, + commonName: hostname, + config: ` +[req] +req_extensions = v3_req + +[ v3_req ] +basicConstraints = CA:true +extendedKeyUsage = serverAuth +subjectAltName = @alt_names + +[alt_names] +DNS.1 = ${hostname} +`, + }, + (error, result) => { + return error ? reject(error) : resolve(result) + }, + ) }) - await fs.mkdirp(tmpdir) - await Promise.all([fs.writeFile(paths.cert, certs.certificate), fs.writeFile(paths.certKey, certs.serviceKey)]) + await fs.mkdir(paths.data, { recursive: true }) + await Promise.all([fs.writeFile(certPath, certs.certificate), fs.writeFile(certKeyPath, certs.serviceKey)]) + } + + return { + cert: certPath, + certKey: certKeyPath, } - return paths } export const generatePassword = async (length = 24): Promise => { @@ -80,10 +137,170 @@ export const generatePassword = async (length = 24): Promise => { return buffer.toString("hex").substring(0, length) } -export const hash = (str: string): string => { +/** + * Used to hash the password. + */ +export const hash = async (password: string): Promise => { + return await argon2.hash(password) +} + +/** + * Used to verify if the password matches the hash + */ +export const isHashMatch = async (password: string, hash: string) => { + if (password === "" || hash === "" || !hash.startsWith("$")) { + return false + } + return await argon2.verify(hash, password) +} + +/** + * Used to hash the password using the sha256 + * algorithm. We only use this to for checking + * the hashed-password set in the config. + * + * Kept for legacy reasons. + */ +export const hashLegacy = (str: string): string => { return crypto.createHash("sha256").update(str).digest("hex") } +/** + * Used to check if the password matches the hash using + * the hashLegacy function + */ +export const isHashLegacyMatch = (password: string, hashPassword: string) => { + const hashedWithLegacy = hashLegacy(password) + return safeCompare(hashedWithLegacy, hashPassword) +} + +export type PasswordMethod = "SHA256" | "ARGON2" | "PLAIN_TEXT" + +/** + * Used to determine the password method. + * + * There are three options for the return value: + * 1. "SHA256" -> the legacy hashing algorithm + * 2. "ARGON2" -> the newest hashing algorithm + * 3. "PLAIN_TEXT" -> regular ol' password with no hashing + * + * @returns {PasswordMethod} "SHA256" | "ARGON2" | "PLAIN_TEXT" + */ +export function getPasswordMethod(hashedPassword: string | undefined): PasswordMethod { + if (!hashedPassword) { + return "PLAIN_TEXT" + } + + // This is the new hashing algorithm + if (hashedPassword.includes("$argon")) { + return "ARGON2" + } + + // This is the legacy hashing algorithm + return "SHA256" +} + +type PasswordValidation = { + isPasswordValid: boolean + hashedPassword: string +} + +type HandlePasswordValidationArgs = { + /** The PasswordMethod */ + passwordMethod: PasswordMethod + /** The password provided by the user */ + passwordFromRequestBody: string + /** The password set in PASSWORD or config */ + passwordFromArgs: string | undefined + /** The hashed-password set in HASHED_PASSWORD or config */ + hashedPasswordFromArgs: string | undefined +} + +/** + * Checks if a password is valid and also returns the hash + * using the PasswordMethod + */ +export async function handlePasswordValidation({ + passwordMethod, + passwordFromArgs, + passwordFromRequestBody, + hashedPasswordFromArgs, +}: HandlePasswordValidationArgs): Promise { + const passwordValidation = { + isPasswordValid: false, + hashedPassword: "", + } + + switch (passwordMethod) { + case "PLAIN_TEXT": { + const isValid = passwordFromArgs ? safeCompare(passwordFromRequestBody, passwordFromArgs) : false + passwordValidation.isPasswordValid = isValid + + const hashedPassword = await hash(passwordFromRequestBody) + passwordValidation.hashedPassword = hashedPassword + break + } + case "SHA256": { + const isValid = isHashLegacyMatch(passwordFromRequestBody, hashedPasswordFromArgs || "") + passwordValidation.isPasswordValid = isValid + + passwordValidation.hashedPassword = hashedPasswordFromArgs || (await hashLegacy(passwordFromRequestBody)) + break + } + case "ARGON2": { + const isValid = await isHashMatch(passwordFromRequestBody, hashedPasswordFromArgs || "") + passwordValidation.isPasswordValid = isValid + + passwordValidation.hashedPassword = hashedPasswordFromArgs || "" + break + } + default: + break + } + + return passwordValidation +} + +export type IsCookieValidArgs = { + passwordMethod: PasswordMethod + cookieKey: string + hashedPasswordFromArgs: string | undefined + passwordFromArgs: string | undefined +} + +/** Checks if a req.cookies.key is valid using the PasswordMethod */ +export async function isCookieValid({ + passwordFromArgs = "", + cookieKey, + hashedPasswordFromArgs = "", + passwordMethod, +}: IsCookieValidArgs): Promise { + let isValid = false + switch (passwordMethod) { + case "PLAIN_TEXT": + isValid = await isHashMatch(passwordFromArgs, cookieKey) + break + case "ARGON2": + case "SHA256": + isValid = safeCompare(cookieKey, hashedPasswordFromArgs) + break + default: + break + } + return isValid +} + +/** Ensures that the input is sanitized by checking + * - it's a string + * - greater than 0 characters + * - trims whitespace + */ +export function sanitizeString(str: unknown): string { + // Very basic sanitization of string + // Credit: https://stackoverflow.com/a/46719000/3015595 + return typeof str === "string" ? str.trim() : "" +} + const mimeTypes: { [key: string]: string } = { ".aac": "audio/x-aac", ".avi": "video/x-msvideo", @@ -145,28 +362,81 @@ export const getMediaMime = (filePath?: string): string => { return (filePath && mimeTypes[path.extname(filePath)]) || "text/plain" } -export const isWsl = async (): Promise => { - return ( - (process.platform === "linux" && os.release().toLowerCase().indexOf("microsoft") !== -1) || - (await fs.readFile("/proc/version", "utf8")).toLowerCase().indexOf("microsoft") !== -1 - ) +/** + * A helper function that checks if the platform is Windows Subsystem for Linux + * (WSL) + * + * @see https://github.com/sindresorhus/is-wsl/blob/main/index.js + * @returns {Boolean} boolean if it is WSL + */ +export const isWsl = async ( + platform: NodeJS.Platform, + osRelease: string, + procVersionFilePath: string, +): Promise => { + if (platform !== "linux") { + return false + } + + if (osRelease.toLowerCase().includes("microsoft")) { + return true + } + + try { + return (await fs.readFile(procVersionFilePath, "utf8")).toLowerCase().includes("microsoft") + } catch (_) { + return false + } +} + +interface OpenOptions { + args: string[] + command: string + urlSearch: string } /** - * Try opening a URL using whatever the system has set for opening URLs. + * A helper function to construct options for `open` function. + * + * Extract to make it easier to test. + * + * @param platform - platform on machine + * @param urlSearch - url.search + * @returns an object with args, command, options and urlSearch */ -export const open = async (url: string): Promise => { - const args = [] as string[] - const options = {} as cp.SpawnOptions - const platform = (await isWsl()) ? "wsl" : process.platform +export function constructOpenOptions(platform: NodeJS.Platform | "wsl", urlSearch: string): OpenOptions { + const args: string[] = [] let command = platform === "darwin" ? "open" : "xdg-open" if (platform === "win32" || platform === "wsl") { command = platform === "wsl" ? "cmd.exe" : "cmd" args.push("/c", "start", '""', "/b") - url = url.replace(/&/g, "^&") + urlSearch = urlSearch.replace(/&/g, "^&") + } + + return { + args, + command, + urlSearch, + } +} + +/** + * Try opening an address using whatever the system has set for opening URLs. + */ +export const open = async (address: URL | string): Promise => { + if (typeof address === "string") { + throw new Error("Cannot open socket paths") + } + // Web sockets do not seem to work if browsing with 0.0.0.0. + const url = new URL(address) + if (url.hostname === "0.0.0.0") { + url.hostname = "localhost" } - const proc = cp.spawn(command, [...args, url], options) - await new Promise((resolve, reject) => { + const platform = (await isWsl(process.platform, os.release(), "/proc/version")) ? "wsl" : process.platform + const { command, args, urlSearch } = constructOpenOptions(platform, url.search) + url.search = urlSearch + const proc = cp.spawn(command, [...args, url.toString()], {}) + await new Promise((resolve, reject) => { proc.on("error", reject) proc.on("close", (code) => { return code !== 0 ? reject(new Error(`Failed to open with code ${code}`)) : resolve() @@ -175,74 +445,69 @@ export const open = async (url: string): Promise => { } /** - * For iterating over an enum's values. + * Return a promise that resolves with whether the socket path is active. */ -// eslint-disable-next-line @typescript-eslint/no-explicit-any -export const enumToArray = (t: any): string[] => { - const values = [] as string[] - for (const k in t) { - values.push(t[k]) +export function canConnect(path: string): Promise { + return new Promise((resolve) => { + const socket = net.connect(path) + socket.once("error", () => resolve(false)) + socket.once("connect", () => { + socket.destroy() + resolve(true) + }) + }) +} + +export const isFile = async (path: string): Promise => { + try { + const stat = await fs.stat(path) + return stat.isFile() + } catch (error) { + return false } - return values } -/** - * For displaying all allowed options in an enum. - */ -// eslint-disable-next-line @typescript-eslint/no-explicit-any -export const buildAllowedMessage = (t: any): string => { - const values = enumToArray(t) - return `Allowed value${values.length === 1 ? " is" : "s are"} ${values.map((t) => `'${t}'`).join(", ")}` +export const isDirectory = async (path: string): Promise => { + try { + const stat = await fs.stat(path) + return stat.isDirectory() + } catch (error) { + return false + } } -export const isObject = (obj: T): obj is T => { - return !Array.isArray(obj) && typeof obj === "object" && obj !== null +/** + * Escapes any HTML string special characters, like &, <, >, ", and '. + * + * Source: https://stackoverflow.com/a/6234804/3015595 + **/ +export function escapeHtml(unsafe: string): string { + return unsafe + .replace(/&/g, "&") + .replace(//g, ">") + .replace(/"/g, """) + .replace(/'/g, "'") } /** - * Taken from vs/base/common/charCode.ts. Copied for now instead of importing so - * we don't have to set up a `vs` alias to be able to import with types (since - * the alternative is to directly import from `out`). + * A helper function which returns a boolean indicating whether + * the given error is a NodeJS.ErrnoException by checking if + * it has a .code property. */ -const enum CharCode { - Slash = 47, - A = 65, - Z = 90, - a = 97, - z = 122, - Colon = 58, +export function isNodeJSErrnoException(error: unknown): error is NodeJS.ErrnoException { + return error !== undefined && (error as NodeJS.ErrnoException).code !== undefined } +// TODO: Replace with proper templating system. +export const escapeJSON = (value: cp.Serializable) => JSON.stringify(value).replace(/"/g, """) + /** - * Compute `fsPath` for the given uri. - * Taken from vs/base/common/uri.ts. It's not imported to avoid also importing - * everything that file imports. + * Split a string on the first equals. The result will always be an array with + * two items regardless of how many equals there are. The second item will be + * undefined if empty or missing. */ -export function pathToFsPath(path: string, keepDriveLetterCasing = false): string { - const isWindows = process.platform === "win32" - const uri = { authority: undefined, path, scheme: "file" } - let value: string - if (uri.authority && uri.path.length > 1 && uri.scheme === "file") { - // unc path: file://shares/c$/far/boo - value = `//${uri.authority}${uri.path}` - } else if ( - uri.path.charCodeAt(0) === CharCode.Slash && - ((uri.path.charCodeAt(1) >= CharCode.A && uri.path.charCodeAt(1) <= CharCode.Z) || - (uri.path.charCodeAt(1) >= CharCode.a && uri.path.charCodeAt(1) <= CharCode.z)) && - uri.path.charCodeAt(2) === CharCode.Colon - ) { - if (!keepDriveLetterCasing) { - // windows drive letter: file:///c:/far/boo - value = uri.path[1].toLowerCase() + uri.path.substr(2) - } else { - value = uri.path.substr(1) - } - } else { - // other path - value = uri.path - } - if (isWindows) { - value = value.replace(/\//g, "\\") - } - return value +export function splitOnFirstEquals(str: string): [string, string | undefined] { + const split = str.split(/=(.+)?/, 2) + return [split[0], split[1]] } diff --git a/src/node/vscodeSocket.ts b/src/node/vscodeSocket.ts new file mode 100644 index 000000000000..e01d1a15012b --- /dev/null +++ b/src/node/vscodeSocket.ts @@ -0,0 +1,206 @@ +import { logger } from "@coder/logger" +import express from "express" +import * as http from "http" +import * as path from "path" +import { HttpCode, HttpError } from "../common/http" +import { listen } from "./app" +import { errorHandler } from "./routes/errors" +import { canConnect } from "./util" + +export interface EditorSessionEntry { + workspace: { + id: string + folders: { + uri: { + path: string + } + }[] + } + + socketPath: string +} + +interface DeleteSessionRequest { + socketPath?: string +} + +interface AddSessionRequest { + entry?: EditorSessionEntry +} + +interface GetSessionResponse { + socketPath?: string +} + +export async function makeEditorSessionManagerServer( + codeServerSocketPath: string, + editorSessionManager: EditorSessionManager, +): Promise { + const router = express() + + router.use(express.json()) + + router.get<{}, GetSessionResponse | string | unknown, undefined, { filePath?: string }>( + "/session", + async (req, res) => { + const filePath = req.query.filePath + if (!filePath) { + throw new HttpError("filePath is required", HttpCode.BadRequest) + } + const socketPath = await editorSessionManager.getConnectedSocketPath(filePath) + const response: GetSessionResponse = { socketPath } + res.json(response) + }, + ) + + router.post<{}, string, AddSessionRequest | undefined>("/add-session", async (req, res) => { + const entry = req.body?.entry + if (!entry) { + throw new HttpError("entry is required", HttpCode.BadRequest) + } + editorSessionManager.addSession(entry) + res.status(200).send("session added") + }) + + router.post<{}, string, DeleteSessionRequest | undefined>("/delete-session", async (req, res) => { + const socketPath = req.body?.socketPath + if (!socketPath) { + throw new HttpError("socketPath is required", HttpCode.BadRequest) + } + editorSessionManager.deleteSession(socketPath) + res.status(200).send("session deleted") + }) + + router.use(errorHandler) + + const server = http.createServer(router) + try { + await listen(server, { socket: codeServerSocketPath }) + } catch (e) { + logger.warn(`Could not create socket at ${codeServerSocketPath}`) + } + return server +} + +export class EditorSessionManager { + // Map from socket path to EditorSessionEntry. + private entries = new Map() + + addSession(entry: EditorSessionEntry): void { + logger.debug(`Adding session to session registry: ${entry.socketPath}`) + this.entries.set(entry.socketPath, entry) + } + + getCandidatesForFile(filePath: string): EditorSessionEntry[] { + const matchCheckResults = new Map() + + const checkMatch = (entry: EditorSessionEntry): boolean => { + if (matchCheckResults.has(entry.socketPath)) { + return matchCheckResults.get(entry.socketPath)! + } + const result = entry.workspace.folders.some((folder) => filePath.startsWith(folder.uri.path + path.sep)) + matchCheckResults.set(entry.socketPath, result) + return result + } + + return Array.from(this.entries.values()) + .reverse() // Most recently registered first. + .sort((a, b) => { + // Matches first. + const aMatch = checkMatch(a) + const bMatch = checkMatch(b) + if (aMatch === bMatch) { + return 0 + } + if (aMatch) { + return -1 + } + return 1 + }) + } + + deleteSession(socketPath: string): void { + logger.debug(`Deleting session from session registry: ${socketPath}`) + this.entries.delete(socketPath) + } + + /** + * Returns the best socket path that we can connect to. + * We also delete any sockets that we can't connect to. + */ + async getConnectedSocketPath(filePath: string): Promise { + const candidates = this.getCandidatesForFile(filePath) + let match: EditorSessionEntry | undefined = undefined + + for (const candidate of candidates) { + if (await canConnect(candidate.socketPath)) { + match = candidate + break + } + this.deleteSession(candidate.socketPath) + } + + return match?.socketPath + } +} + +export class EditorSessionManagerClient { + constructor(private codeServerSocketPath: string) {} + + async canConnect() { + return canConnect(this.codeServerSocketPath) + } + + async getConnectedSocketPath(filePath: string): Promise { + const response = await new Promise((resolve, reject) => { + const opts = { + path: "/session?filePath=" + encodeURIComponent(filePath), + socketPath: this.codeServerSocketPath, + method: "GET", + } + const req = http.request(opts, (res) => { + let rawData = "" + res.setEncoding("utf8") + res.on("data", (chunk) => { + rawData += chunk + }) + res.on("end", () => { + try { + const obj = JSON.parse(rawData) + if (res.statusCode === 200) { + resolve(obj) + } else { + reject(new Error("Unexpected status code: " + res.statusCode)) + } + } catch (e: unknown) { + reject(e) + } + }) + }) + req.on("error", reject) + req.end() + }) + return response.socketPath + } + + // Currently only used for tests. + async addSession(request: AddSessionRequest): Promise { + await new Promise((resolve, reject) => { + const opts = { + path: "/add-session", + socketPath: this.codeServerSocketPath, + method: "POST", + headers: { + "content-type": "application/json", + accept: "application/json", + }, + } + const req = http.request(opts, () => { + resolve() + }) + req.on("error", reject) + req.write(JSON.stringify(request)) + req.end() + }) + } +} diff --git a/src/node/wrapper.ts b/src/node/wrapper.ts index ba459efd1e85..607512e2c9fb 100644 --- a/src/node/wrapper.ts +++ b/src/node/wrapper.ts @@ -1,11 +1,71 @@ -import { field, logger } from "@coder/logger" +import { field, Logger, logger } from "@coder/logger" import * as cp from "child_process" import * as path from "path" import * as rfs from "rotating-file-stream" import { Emitter } from "../common/emitter" +import { DefaultedArgs, redactArgs } from "./cli" import { paths } from "./util" -interface HandshakeMessage { +const timeoutInterval = 10000 // 10s, matches VS Code's timeouts. + +/** + * Listen to a single message from a process. Reject if the process errors, + * exits, or times out. + * + * `fn` is a function that determines whether the message is the one we're + * waiting for. + */ +export function onMessage( + proc: cp.ChildProcess | NodeJS.Process, + fn: (message: M) => message is T, + customLogger?: Logger, +): Promise { + return new Promise((resolve, reject) => { + const cleanup = () => { + proc.off("error", onError) + proc.off("exit", onExit) + proc.off("message", onMessage) + clearTimeout(timeout) + } + + const timeout = setTimeout(() => { + cleanup() + reject(new Error("timed out")) + }, timeoutInterval) + + const onError = (error: Error) => { + cleanup() + reject(error) + } + + const onExit = (code: number) => { + cleanup() + reject(new Error(`exited unexpectedly with code ${code}`)) + } + + const onMessage = (message: M) => { + if (fn(message)) { + cleanup() + resolve(message) + } else { + ;(customLogger || logger).debug("got unhandled message", field("message", message)) + } + } + + proc.on("message", onMessage) + // NodeJS.Process doesn't have `error` but binding anyway shouldn't break + // anything. It does have `exit` but the types aren't working. + ;(proc as cp.ChildProcess).on("error", onError) + ;(proc as cp.ChildProcess).on("exit", onExit) + }) +} + +interface ParentHandshakeMessage { + type: "handshake" + args: DefaultedArgs +} + +interface ChildHandshakeMessage { type: "handshake" } @@ -14,10 +74,14 @@ interface RelaunchMessage { version: string } -export type Message = RelaunchMessage | HandshakeMessage +type ChildMessage = RelaunchMessage | ChildHandshakeMessage +type ParentMessage = ParentHandshakeMessage -export class ProcessError extends Error { - public constructor(message: string, public readonly code: number | undefined) { +class ProcessError extends Error { + public constructor( + message: string, + public readonly code: number | undefined, + ) { super(message) this.name = this.constructor.name Error.captureStackTrace(this, this.constructor) @@ -25,52 +89,55 @@ export class ProcessError extends Error { } /** - * Allows the wrapper and inner processes to communicate. + * Wrapper around a process that tries to gracefully exit when a process exits + * and provides a way to prevent `process.exit`. */ -export class IpcMain { - private readonly _onMessage = new Emitter() - public readonly onMessage = this._onMessage.event - private readonly _onDispose = new Emitter() +abstract class Process { + /** + * Emit this to trigger a graceful exit. + */ + protected readonly _onDispose = new Emitter() + + /** + * Emitted when the process is about to be disposed. + */ public readonly onDispose = this._onDispose.event - public readonly processExit: (code?: number) => never - public constructor(public readonly parentPid?: number) { + /** + * Uniquely named logger for the process. + */ + public abstract logger: Logger + + public constructor() { process.on("SIGINT", () => this._onDispose.emit("SIGINT")) process.on("SIGTERM", () => this._onDispose.emit("SIGTERM")) process.on("exit", () => this._onDispose.emit(undefined)) - // Ensure we control when the process exits. - this.processExit = process.exit - process.exit = function (code?: number) { - logger.warn(`process.exit() was prevented: ${code || "unknown code"}.`) - } as (code?: number) => never - - this.onDispose((signal) => { + this.onDispose((signal, wait) => { // Remove listeners to avoid possibly triggering disposal again. process.removeAllListeners() - // Let any other handlers run first then exit. - logger.debug(`${parentPid ? "inner process" : "wrapper"} ${process.pid} disposing`, field("code", signal)) - setTimeout(() => this.exit(0), 0) + // Try waiting for other handlers to run first then exit. + this.logger.debug("disposing", field("code", signal)) + wait.then(() => this.exit(0)) + setTimeout(() => this.exit(0), 5000) }) + } - // Kill the inner process if the parent dies. This is for the case where the - // parent process is forcefully terminated and cannot clean up. - if (parentPid) { - setInterval(() => { - try { - // process.kill throws an exception if the process doesn't exist. - process.kill(parentPid, 0) - } catch (_) { - // Consider this an error since it should have been able to clean up - // the child process unless it was forcefully killed. - logger.error(`parent process ${parentPid} died`) - this._onDispose.emit(undefined) - } - }, 5000) + /** + * Ensure control over when the process exits. + */ + public preventExit(): void { + ;(process.exit as any) = (code?: number) => { + this.logger.warn(`process.exit() was prevented: ${code || "unknown code"}.`) } } + private readonly processExit: (code?: number) => never = process.exit + + /** + * Will always exit even if normal exit is being prevented. + */ public exit(error?: number | ProcessError): never { if (error && typeof error !== "number") { this.processExit(typeof error.code === "number" ? error.code : 1) @@ -78,48 +145,67 @@ export class IpcMain { this.processExit(error) } } +} - public handshake(child?: cp.ChildProcess): Promise { - return new Promise((resolve, reject) => { - const target = child || process - const onMessage = (message: Message): void => { - logger.debug( - `${child ? "wrapper" : "inner process"} ${process.pid} received message from ${ - child ? child.pid : this.parentPid - }`, - field("message", message), - ) - if (message.type === "handshake") { - target.removeListener("message", onMessage) - target.on("message", (msg) => this._onMessage.emit(msg)) - // The wrapper responds once the inner process starts the handshake. - if (child) { - if (!target.send) { - throw new Error("child not spawned with IPC") - } - target.send({ type: "handshake" }) - } - resolve() - } - } - target.on("message", onMessage) - if (child) { - child.once("error", reject) - child.once("exit", (code) => { - reject(new ProcessError(`Unexpected exit with code ${code}`, code !== null ? code : undefined)) - }) - } else { - // The inner process initiates the handshake. - this.send({ type: "handshake" }) +/** + * Child process that will clean up after itself if the parent goes away and can + * perform a handshake with the parent and ask it to relaunch. + */ +export class ChildProcess extends Process { + public logger = logger.named(`child:${process.pid}`) + + public constructor(private readonly parentPid: number) { + super() + + // Kill the inner process if the parent dies. This is for the case where the + // parent process is forcefully terminated and cannot clean up. + setInterval(() => { + try { + // process.kill throws an exception if the process doesn't exist. + process.kill(this.parentPid, 0) + } catch (_) { + // Consider this an error since it should have been able to clean up + // the child process unless it was forcefully killed. + this.logger.error(`parent process ${parentPid} died`) + this._onDispose.emit(undefined) } - }) + }, 5000) } + /** + * Initiate the handshake and wait for a response from the parent. + */ + public async handshake(): Promise { + this.logger.debug("initiating handshake") + this.send({ type: "handshake" }) + const message = await onMessage( + process, + (message): message is ParentHandshakeMessage => { + return message.type === "handshake" + }, + this.logger, + ) + this.logger.debug( + "got message", + field("message", { + type: message.type, + args: redactArgs(message.args), + }), + ) + return message.args + } + + /** + * Notify the parent process that it should relaunch the child. + */ public relaunch(version: string): void { this.send({ type: "relaunch", version }) } - private send(message: Message): void { + /** + * Send a message to the parent. + */ + private send(message: ChildMessage): void { if (!process.send) { throw new Error("not spawned with IPC") } @@ -127,147 +213,185 @@ export class IpcMain { } } -let _ipcMain: IpcMain -export const ipcMain = (): IpcMain => { - if (!_ipcMain) { - _ipcMain = new IpcMain( - typeof process.env.CODE_SERVER_PARENT_PID !== "undefined" - ? parseInt(process.env.CODE_SERVER_PARENT_PID) - : undefined, - ) - } - return _ipcMain -} - -export interface WrapperOptions { - maxMemory?: number - nodeOptions?: string -} - /** - * Provides a way to wrap a process for the purpose of updating the running - * instance. + * Parent process wrapper that spawns the child process and performs a handshake + * with it. Will relaunch the child if it receives a SIGUSR1 or SIGUSR2 or is + * asked to by the child. If the child otherwise exits the parent will also + * exit. */ -export class WrapperProcess { - private process?: cp.ChildProcess +export class ParentProcess extends Process { + public logger = logger.named(`parent:${process.pid}`) + + private child?: cp.ChildProcess private started?: Promise private readonly logStdoutStream: rfs.RotatingFileStream private readonly logStderrStream: rfs.RotatingFileStream - public constructor(private currentVersion: string, private readonly options?: WrapperOptions) { + protected readonly _onChildMessage = new Emitter() + protected readonly onChildMessage = this._onChildMessage.event + + private args?: DefaultedArgs + + public constructor(private currentVersion: string) { + super() + + process.on("SIGUSR1", async () => { + this.logger.info("Received SIGUSR1; hotswapping") + this.relaunch() + }) + + process.on("SIGUSR2", async () => { + this.logger.info("Received SIGUSR2; hotswapping") + this.relaunch() + }) + const opts = { size: "10M", maxFiles: 10, + path: path.join(paths.data, "coder-logs"), } - this.logStdoutStream = rfs.createStream(path.join(paths.data, "coder-logs", "code-server-stdout.log"), opts) - this.logStderrStream = rfs.createStream(path.join(paths.data, "coder-logs", "code-server-stderr.log"), opts) + this.logStdoutStream = rfs.createStream("code-server-stdout.log", opts) + this.logStderrStream = rfs.createStream("code-server-stderr.log", opts) - ipcMain().onDispose(() => { - if (this.process) { - this.process.removeAllListeners() - this.process.kill() - } - }) + this.onDispose(() => this.disposeChild()) - ipcMain().onMessage((message) => { + this.onChildMessage((message) => { switch (message.type) { case "relaunch": - logger.info(`Relaunching: ${this.currentVersion} -> ${message.version}`) + this.logger.info(`Relaunching: ${this.currentVersion} -> ${message.version}`) this.currentVersion = message.version this.relaunch() break default: - logger.error(`Unrecognized message ${message}`) + this.logger.error(`Unrecognized message ${message}`) break } }) - - process.on("SIGUSR1", async () => { - logger.info("Received SIGUSR1; hotswapping") - this.relaunch() - }) } - private async relaunch(): Promise { + private async disposeChild(): Promise { this.started = undefined - if (this.process) { - this.process.removeAllListeners() - this.process.kill() + if (this.child) { + const child = this.child + child.removeAllListeners() + child.kill() + // Wait for the child to exit otherwise its output will be lost which can + // be especially problematic if you're trying to debug why cleanup failed. + await new Promise((r) => child!.on("exit", r)) } + } + + private async relaunch(): Promise { + this.disposeChild() try { - await this.start() - } catch (error) { - logger.error(error.message) - ipcMain().exit(typeof error.code === "number" ? error.code : 1) + this.started = this._start() + await this.started + } catch (error: any) { + this.logger.error(error.message) + this.exit(typeof error.code === "number" ? error.code : 1) } } - public start(): Promise { + public start(args: DefaultedArgs): Promise { + // Our logger was created before we parsed CLI arguments so update the level + // in case it has changed. + this.logger.level = logger.level + + // Store for relaunches. + this.args = args if (!this.started) { - this.started = this.spawn().then((child) => { - // Log both to stdout and to the log directory. - if (child.stdout) { - child.stdout.pipe(this.logStdoutStream) - child.stdout.pipe(process.stdout) - } - if (child.stderr) { - child.stderr.pipe(this.logStderrStream) - child.stderr.pipe(process.stderr) - } - logger.debug(`spawned inner process ${child.pid}`) - ipcMain() - .handshake(child) - .then(() => { - child.once("exit", (code) => { - logger.debug(`inner process ${child.pid} exited unexpectedly`) - ipcMain().exit(code || 0) - }) - }) - this.process = child - }) + this.started = this._start() } return this.started } - private async spawn(): Promise { - // Flags to pass along to the Node binary. - let nodeOptions = `${process.env.NODE_OPTIONS || ""} ${(this.options && this.options.nodeOptions) || ""}` - if (!/max_old_space_size=(\d+)/g.exec(nodeOptions)) { - nodeOptions += ` --max_old_space_size=${(this.options && this.options.maxMemory) || 2048}` + private async _start(): Promise { + const child = this.spawn() + this.child = child + + // Log child output to stdout/stderr and to the log directory. + if (child.stdout) { + child.stdout.on("data", (data) => { + this.logStdoutStream.write(data) + process.stdout.write(data) + }) + } + if (child.stderr) { + child.stderr.on("data", (data) => { + this.logStderrStream.write(data) + process.stderr.write(data) + }) } - // Use spawn (instead of fork) to use the new binary in case it was updated. - return cp.spawn(process.argv[0], process.argv.slice(1), { + this.logger.debug(`spawned child process ${child.pid}`) + + await this.handshake(child) + + child.once("exit", (code) => { + this.logger.debug(`inner process ${child.pid} exited unexpectedly`) + this.exit(code || 0) + }) + } + + private spawn(): cp.ChildProcess { + return cp.fork(path.join(__dirname, "entry"), { env: { ...process.env, CODE_SERVER_PARENT_PID: process.pid.toString(), - NODE_OPTIONS: nodeOptions, + NODE_EXEC_PATH: process.execPath, }, - stdio: ["ipc"], + stdio: ["pipe", "pipe", "pipe", "ipc"], }) } + + /** + * Wait for a handshake from the child then reply. + */ + private async handshake(child: cp.ChildProcess): Promise { + if (!this.args) { + throw new Error("started without args") + } + const message = await onMessage( + child, + (message): message is ChildHandshakeMessage => { + return message.type === "handshake" + }, + this.logger, + ) + this.logger.debug("got message", field("message", message)) + this.send(child, { type: "handshake", args: this.args }) + } + + /** + * Send a message to the child. + */ + private send(child: cp.ChildProcess, message: ParentMessage): void { + child.send(message) + } +} + +/** + * Process wrapper. + */ +export const wrapper = + typeof process.env.CODE_SERVER_PARENT_PID !== "undefined" + ? new ChildProcess(parseInt(process.env.CODE_SERVER_PARENT_PID)) + : new ParentProcess(require("../../package.json").version) + +export function isChild(proc: ChildProcess | ParentProcess): proc is ChildProcess { + return proc instanceof ChildProcess } // It's possible that the pipe has closed (for example if you run code-server // --version | head -1). Assume that means we're done. if (!process.stdout.isTTY) { - process.stdout.on("error", () => ipcMain().exit()) + process.stdout.on("error", () => wrapper.exit()) } -export const wrap = (fn: () => Promise): void => { - if (ipcMain().parentPid) { - ipcMain() - .handshake() - .then(() => fn()) - .catch((error: ProcessError): void => { - logger.error(error.message) - ipcMain().exit(error) - }) - } else { - const wrapper = new WrapperProcess(require("../../package.json").version) - wrapper.start().catch((error) => { - logger.error(error.message) - ipcMain().exit(error) - }) +// Don't let uncaught exceptions crash the process. +process.on("uncaughtException", (error) => { + wrapper.logger.error(`Uncaught exception: ${error.message}`) + if (typeof error.stack !== "undefined") { + wrapper.logger.error(error.stack) } -} +}) diff --git a/src/node/wsRouter.ts b/src/node/wsRouter.ts new file mode 100644 index 000000000000..0f901bb8ad7f --- /dev/null +++ b/src/node/wsRouter.ts @@ -0,0 +1,68 @@ +import * as express from "express" +import * as expressCore from "express-serve-static-core" +import * as http from "http" +import * as stream from "stream" +import Websocket from "ws" + +export interface WebsocketRequest extends express.Request { + ws: stream.Duplex + head: Buffer +} + +interface InternalWebsocketRequest extends WebsocketRequest { + _ws_handled: boolean +} + +export const handleUpgrade = (app: express.Express, server: http.Server): void => { + server.on("upgrade", (req, socket, head) => { + socket.pause() + + const wreq = req as InternalWebsocketRequest + wreq.ws = socket + wreq.head = head + wreq._ws_handled = false + + // Send the request off to be handled by Express. + ;(app as any).handle(wreq, new http.ServerResponse(wreq), () => { + if (!wreq._ws_handled) { + socket.end("HTTP/1.1 404 Not Found\r\n\r\n") + } + }) + }) +} + +export type WebSocketHandler = ( + req: WebsocketRequest, + res: express.Response, + next: express.NextFunction, +) => void | Promise + +export class WebsocketRouter { + public readonly router = express.Router() + + /** + * Handle a websocket at this route. Note that websockets are immediately + * paused when they come in. + * + * If the origin header exists it must match the host or the connection will + * be prevented. + */ + public ws(route: expressCore.PathParams, ...handlers: WebSocketHandler[]): void { + this.router.get( + route, + ...handlers.map((handler) => { + const wrapped: express.Handler = (req, res, next) => { + ;(req as InternalWebsocketRequest)._ws_handled = true + return handler(req as WebsocketRequest, res, next) + } + return wrapped + }), + ) + } +} + +export function Router(): WebsocketRouter { + return new WebsocketRouter() +} + +export const wss = new Websocket.Server({ noServer: true }) diff --git a/test/cli.test.ts b/test/cli.test.ts deleted file mode 100644 index f4f6c884997c..000000000000 --- a/test/cli.test.ts +++ /dev/null @@ -1,204 +0,0 @@ -import { logger, Level } from "@coder/logger" -import * as assert from "assert" -import * as path from "path" -import { parse } from "../src/node/cli" - -describe("cli", () => { - beforeEach(() => { - delete process.env.LOG_LEVEL - }) - - // The parser will always fill these out. - const defaults = { - _: [], - } - - it("should set defaults", () => { - assert.deepEqual(parse([]), defaults) - }) - - it("should parse all available options", () => { - assert.deepEqual( - parse([ - "--bind-addr=192.169.0.1:8080", - "--auth", - "none", - "--extensions-dir", - "foo", - "--builtin-extensions-dir", - "foobar", - "--extra-extensions-dir", - "nozzle", - "1", - "--extra-builtin-extensions-dir", - "bazzle", - "--verbose", - "2", - "--log", - "error", - "--help", - "--open", - "--socket=mumble", - "3", - "--user-data-dir", - "bar", - "--cert=baz", - "--cert-key", - "qux", - "--version", - "--json", - "--port=8081", - "--host", - "0.0.0.0", - "4", - "--", - "-5", - "--6", - ]), - { - _: ["1", "2", "3", "4", "-5", "--6"], - auth: "none", - "builtin-extensions-dir": path.resolve("foobar"), - "cert-key": path.resolve("qux"), - cert: { - value: path.resolve("baz"), - }, - "extensions-dir": path.resolve("foo"), - "extra-builtin-extensions-dir": [path.resolve("bazzle")], - "extra-extensions-dir": [path.resolve("nozzle")], - help: true, - host: "0.0.0.0", - json: true, - log: "trace", - open: true, - port: 8081, - socket: path.resolve("mumble"), - "user-data-dir": path.resolve("bar"), - verbose: true, - version: true, - "bind-addr": "192.169.0.1:8080", - }, - ) - }) - - it("should work with short options", () => { - assert.deepEqual(parse(["-vvv", "-v"]), { - ...defaults, - log: "trace", - verbose: true, - version: true, - }) - assert.equal(process.env.LOG_LEVEL, "trace") - assert.equal(logger.level, Level.Trace) - }) - - it("should use log level env var", () => { - process.env.LOG_LEVEL = "debug" - assert.deepEqual(parse([]), { - ...defaults, - log: "debug", - verbose: false, - }) - assert.equal(process.env.LOG_LEVEL, "debug") - assert.equal(logger.level, Level.Debug) - - process.env.LOG_LEVEL = "trace" - assert.deepEqual(parse([]), { - ...defaults, - log: "trace", - verbose: true, - }) - assert.equal(process.env.LOG_LEVEL, "trace") - assert.equal(logger.level, Level.Trace) - }) - - it("should prefer --log to env var and --verbose to --log", async () => { - process.env.LOG_LEVEL = "debug" - assert.deepEqual(parse(["--log", "info"]), { - ...defaults, - log: "info", - verbose: false, - }) - assert.equal(process.env.LOG_LEVEL, "info") - assert.equal(logger.level, Level.Info) - - process.env.LOG_LEVEL = "trace" - assert.deepEqual(parse(["--log", "info"]), { - ...defaults, - log: "info", - verbose: false, - }) - assert.equal(process.env.LOG_LEVEL, "info") - assert.equal(logger.level, Level.Info) - - process.env.LOG_LEVEL = "warn" - assert.deepEqual(parse(["--log", "info", "--verbose"]), { - ...defaults, - log: "trace", - verbose: true, - }) - assert.equal(process.env.LOG_LEVEL, "trace") - assert.equal(logger.level, Level.Trace) - }) - - it("should ignore invalid log level env var", () => { - process.env.LOG_LEVEL = "bogus" - assert.deepEqual(parse([]), defaults) - }) - - it("should error if value isn't provided", () => { - assert.throws(() => parse(["--auth"]), /--auth requires a value/) - assert.throws(() => parse(["--auth=", "--log=debug"]), /--auth requires a value/) - assert.throws(() => parse(["--auth", "--log"]), /--auth requires a value/) - assert.throws(() => parse(["--auth", "--invalid"]), /--auth requires a value/) - assert.throws(() => parse(["--bind-addr"]), /--bind-addr requires a value/) - }) - - it("should error if value is invalid", () => { - assert.throws(() => parse(["--port", "foo"]), /--port must be a number/) - assert.throws(() => parse(["--auth", "invalid"]), /--auth valid values: \[password, none\]/) - assert.throws(() => parse(["--log", "invalid"]), /--log valid values: \[trace, debug, info, warn, error\]/) - }) - - it("should error if the option doesn't exist", () => { - assert.throws(() => parse(["--foo"]), /Unknown option --foo/) - }) - - it("should not error if the value is optional", () => { - assert.deepEqual(parse(["--cert"]), { - ...defaults, - cert: { - value: undefined, - }, - }) - }) - - it("should not allow option-like values", () => { - assert.throws(() => parse(["--socket", "--socket-path-value"]), /--socket requires a value/) - // If you actually had a path like this you would do this instead: - assert.deepEqual(parse(["--socket", "./--socket-path-value"]), { - ...defaults, - socket: path.resolve("--socket-path-value"), - }) - assert.throws(() => parse(["--cert", "--socket-path-value"]), /Unknown option --socket-path-value/) - }) - - it("should allow positional arguments before options", () => { - assert.deepEqual(parse(["foo", "test", "--auth", "none"]), { - ...defaults, - _: ["foo", "test"], - auth: "none", - }) - }) - - it("should support repeatable flags", () => { - assert.deepEqual(parse(["--proxy-domain", "*.coder.com"]), { - ...defaults, - "proxy-domain": ["*.coder.com"], - }) - assert.deepEqual(parse(["--proxy-domain", "*.coder.com", "--proxy-domain", "test.com"]), { - ...defaults, - "proxy-domain": ["*.coder.com", "test.com"], - }) - }) -}) diff --git a/test/e2e/baseFixture.ts b/test/e2e/baseFixture.ts new file mode 100644 index 000000000000..a1293f061c66 --- /dev/null +++ b/test/e2e/baseFixture.ts @@ -0,0 +1,64 @@ +import { test as base } from "@playwright/test" +import { CodeServer, CodeServerPage } from "./models/CodeServer" + +/** + * Wraps `test.describe` to create and manage an instance of code-server. If you + * don't use this you will need to create your own code-server instance and pass + * it to `test.use`. + * + * If `includeCredentials` is `true` page requests will be authenticated. + */ +export const describe = ( + name: string, + codeServerArgs: string[], + codeServerEnv: NodeJS.ProcessEnv, + fn: (codeServer: CodeServer) => void, +) => { + test.describe(name, () => { + // This will spawn on demand so nothing is necessary on before. + const codeServer = new CodeServer(name, codeServerArgs, codeServerEnv, undefined) + + // Kill code-server after the suite has ended. This may happen even without + // doing it explicitly but it seems prudent to be sure. + test.afterAll(async () => { + await codeServer.close() + }) + + test.use({ + // Makes `codeServer` and `authenticated` available to the extend call + // below. + codeServer, + // NOTE@jsjoeio some tests use --cert which uses a self-signed certificate + // without this option, those tests will fail. + ignoreHTTPSErrors: true, + }) + + fn(codeServer) + }) +} + +interface TestFixtures { + codeServer: CodeServer + codeServerPage: CodeServerPage +} + +/** + * Create a test that spawns code-server if necessary and ensures the page is + * ready. + */ +export const test = base.extend({ + codeServer: undefined, // No default; should be provided through `test.use`. + codeServerPage: async ({ codeServer, page }, use) => { + // It's possible code-server might prevent navigation because of unsaved + // changes (seems to happen based on timing even if no changes have been + // made too). In these cases just accept. + page.on("dialog", (d) => d.accept()) + + const codeServerPage = new CodeServerPage(codeServer, page) + await codeServerPage.navigate() + await use(codeServerPage) + }, +}) + +/** Shorthand for test.expect. */ +export const expect = test.expect diff --git a/test/e2e/codeServer.test.ts b/test/e2e/codeServer.test.ts new file mode 100644 index 000000000000..0e04742ea31a --- /dev/null +++ b/test/e2e/codeServer.test.ts @@ -0,0 +1,44 @@ +import { promises as fs } from "fs" +import * as path from "path" +import { getMaybeProxiedCodeServer } from "../utils/helpers" +import { describe, test, expect } from "./baseFixture" +import { CodeServer } from "./models/CodeServer" + +describe("code-server", ["--disable-workspace-trust"], {}, () => { + // TODO@asher: Generalize this? Could be nice if we were to ever need + // multiple migration tests in other suites. + const instances = new Map() + test.afterAll(async () => { + const procs = Array.from(instances.values()) + instances.clear() + await Promise.all(procs.map((cs) => cs.close())) + }) + + test("should navigate to home page", async ({ codeServerPage }) => { + // We navigate codeServer before each test + // and we start the test with a storage state + // which means we should be logged in + // so it should be on the address + const url = codeServerPage.page.url() + // We use match because there may be a / at the end + // so we don't want it to fail if we expect http://localhost:8080 to match http://localhost:8080/ + const address = await getMaybeProxiedCodeServer(codeServerPage) + expect(url).toMatch(address) + }) + + test("should always see the code-server editor", async ({ codeServerPage }) => { + expect(await codeServerPage.isEditorVisible()).toBe(true) + }) + + test("should show the Integrated Terminal", async ({ codeServerPage }) => { + await codeServerPage.focusTerminal() + expect(await codeServerPage.page.isVisible("#terminal")).toBe(true) + }) + + test("should open a file", async ({ codeServerPage }) => { + const dir = await codeServerPage.workspaceDir + const file = path.join(dir, "foo") + await fs.writeFile(file, "bar") + await codeServerPage.openFile(file) + }) +}) diff --git a/test/e2e/downloads.test.ts b/test/e2e/downloads.test.ts new file mode 100644 index 000000000000..0adcd68ff83d --- /dev/null +++ b/test/e2e/downloads.test.ts @@ -0,0 +1,108 @@ +import { promises as fs } from "fs" +import * as path from "path" +import { clean } from "../utils/helpers" +import { describe, test, expect } from "./baseFixture" + +describe("Downloads (enabled)", ["--disable-workspace-trust"], {}, async () => { + const testName = "downloads-enabled" + test.beforeAll(async () => { + await clean(testName) + }) + + test("should see the 'Download...' option", async ({ codeServerPage }) => { + // Setup + const workspaceDir = await codeServerPage.workspaceDir + const tmpFilePath = path.join(workspaceDir, "unique-file.txt") + await fs.writeFile(tmpFilePath, "hello world") + + // Action + await codeServerPage.openContextMenu("text=unique-file.txt") + + expect(await codeServerPage.page.isVisible("text=Download...")).toBe(true) + }) + + test("should see the 'Show Local' button on Save As", async ({ codeServerPage }) => { + // Setup + const workspaceDir = await codeServerPage.workspaceDir + const fileName = "unique-file-save-as.txt" + const tmpFilePath = path.join(workspaceDir, fileName) + await fs.writeFile(tmpFilePath, "Hello World") + + // Action + await codeServerPage.page.waitForSelector(`text=${fileName}`) + + await codeServerPage.openFile(fileName) + await codeServerPage.page.click(".tab") + await codeServerPage.navigateMenus(["File", "Auto Save"]) + await codeServerPage.page.keyboard.type("Making some edits.") + await codeServerPage.navigateMenus(["File", "Save As..."]) + await codeServerPage.page.waitForSelector(".quick-input-widget") + expect(await codeServerPage.page.isVisible("text=Show Local")).toBe(true) + }) + + test("should see the 'Show Local' button on Save File", async ({ codeServerPage }) => { + // Action + await codeServerPage.navigateMenus(["File", "New Text File"]) + await codeServerPage.waitForTab("Untitled-1") + await codeServerPage.navigateMenus(["File", "Save"]) + await codeServerPage.page.waitForSelector(".quick-input-widget") + expect(await codeServerPage.page.isVisible("text=Show Local")).toBe(true) + }) + + test("should see the 'Show Local' button on Save Workspace As", async ({ codeServerPage }) => { + // Action + await codeServerPage.navigateMenus(["File", "Save Workspace As..."]) + await codeServerPage.page.waitForSelector(".quick-input-widget") + expect(await codeServerPage.page.isVisible("text=Show Local")).toBe(true) + }) +}) + +describe("Downloads (disabled)", ["--disable-workspace-trust", "--disable-file-downloads"], {}, async () => { + const testName = "downloads-disabled" + test.beforeAll(async () => { + await clean(testName) + }) + + test("should not see the 'Download...' option", async ({ codeServerPage }) => { + // Setup + const workspaceDir = await codeServerPage.workspaceDir + const tmpFilePath = path.join(workspaceDir, "unique-file.txt") + await fs.writeFile(tmpFilePath, "Hello World") + + // Action + await codeServerPage.openContextMenu("text=unique-file.txt") + + expect(await codeServerPage.page.isVisible("text=Download...")).toBe(false) + }) + + test("should not see the 'Show Local' button on Save as", async ({ codeServerPage }) => { + // Setup + const workspaceDir = await codeServerPage.workspaceDir + const fileName = "unique-file-save-as.txt" + const tmpFilePath = path.join(workspaceDir, fileName) + await fs.writeFile(tmpFilePath, "Hello World") + + // Action + await codeServerPage.page.waitForSelector(`text=${fileName}`) + await codeServerPage.openFile(fileName) + await codeServerPage.page.click(".tab") + await codeServerPage.navigateMenus(["File", "Save As..."]) + expect(await codeServerPage.page.isVisible("text=Show Local")).toBe(false) + }) + + test("should not see the 'Show Local' button on Save File", async ({ codeServerPage }) => { + // Action + await codeServerPage.navigateMenus(["File", "New Text File"]) + await codeServerPage.waitForTab("Untitled-1") + await codeServerPage.navigateMenus(["File", "Save"]) + await codeServerPage.page.waitForSelector(".quick-input-widget") + expect(await codeServerPage.page.isVisible("text=Show Local")).toBe(false) + }) + + test("should not see the 'Show Local' button on Save Workspace As", async ({ codeServerPage }) => { + // Action + await codeServerPage.navigateMenus(["File", "Save Workspace As..."]) + await codeServerPage.page.waitForSelector(".quick-input-widget") + expect(await codeServerPage.page.isVisible("text=Show Local")).toBe(false) + }) +}) diff --git a/test/e2e/extensions.test.ts b/test/e2e/extensions.test.ts new file mode 100644 index 000000000000..ac56fcfec059 --- /dev/null +++ b/test/e2e/extensions.test.ts @@ -0,0 +1,36 @@ +import { test as base } from "@playwright/test" +import * as path from "path" +import { getMaybeProxiedCodeServer } from "../utils/helpers" +import { describe, test, expect } from "./baseFixture" + +function runTestExtensionTests() { + // This will only work if the test extension is loaded into code-server. + test("should have access to VSCODE_PROXY_URI", async ({ codeServerPage }) => { + const address = await getMaybeProxiedCodeServer(codeServerPage) + + await codeServerPage.waitForTestExtensionLoaded() + await codeServerPage.executeCommandViaMenus("code-server: Get proxy URI") + + // Remove end slash in address. + const normalizedAddress = address.replace(/\/+$/, "") + await codeServerPage.page.getByText(`Info: proxyUri: ${normalizedAddress}/proxy/{{port}}/`) + }) +} + +const flags = ["--disable-workspace-trust", "--extensions-dir", path.join(__dirname, "./extensions")] + +describe("Extensions", flags, {}, () => { + runTestExtensionTests() +}) + +if (process.env.USE_PROXY !== "1") { + describe("Extensions with --cert", [...flags, "--cert"], {}, () => { + runTestExtensionTests() + }) +} else { + base.describe("Extensions with --cert", () => { + base.skip("skipped because USE_PROXY is set", () => { + // Playwright will not show this without a function. + }) + }) +} diff --git a/test/e2e/extensions/test-extension/.gitignore b/test/e2e/extensions/test-extension/.gitignore new file mode 100644 index 000000000000..e7b307d8c4f7 --- /dev/null +++ b/test/e2e/extensions/test-extension/.gitignore @@ -0,0 +1 @@ +/extension.js diff --git a/test/e2e/extensions/test-extension/extension.ts b/test/e2e/extensions/test-extension/extension.ts new file mode 100644 index 000000000000..ea4a1f896ce6 --- /dev/null +++ b/test/e2e/extensions/test-extension/extension.ts @@ -0,0 +1,31 @@ +import * as vscode from "vscode" + +export function activate(context: vscode.ExtensionContext) { + vscode.window.showInformationMessage("test extension loaded") + // Test extension + context.subscriptions.push( + vscode.commands.registerCommand("codeServerTest.proxyUri", () => { + if (process.env.VSCODE_PROXY_URI) { + vscode.window.showInformationMessage(`proxyUri: ${process.env.VSCODE_PROXY_URI}`) + } else { + vscode.window.showErrorMessage("No proxy URI was set") + } + }), + ) + + // asExternalUri extension + context.subscriptions.push( + vscode.commands.registerCommand("codeServerTest.asExternalUri", async () => { + const input = await vscode.window.showInputBox({ + prompt: "URL to pass through to asExternalUri", + }) + + if (input) { + const output = await vscode.env.asExternalUri(vscode.Uri.parse(input)) + vscode.window.showInformationMessage(`input: ${input} output: ${output}`) + } else { + vscode.window.showErrorMessage(`Failed to run test case. No input provided.`) + } + }), + ) +} diff --git a/test/e2e/extensions/test-extension/package-lock.json b/test/e2e/extensions/test-extension/package-lock.json new file mode 100644 index 000000000000..ec9e89af85f3 --- /dev/null +++ b/test/e2e/extensions/test-extension/package-lock.json @@ -0,0 +1,41 @@ +{ + "name": "code-server-extension", + "version": "0.0.1", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "code-server-extension", + "version": "0.0.1", + "license": "MIT", + "devDependencies": { + "@types/vscode": "^1.56.0", + "typescript": "^5.6.2" + }, + "engines": { + "vscode": "^1.56.0" + } + }, + "node_modules/@types/vscode": { + "version": "1.94.0", + "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.94.0.tgz", + "integrity": "sha512-UyQOIUT0pb14XSqJskYnRwD2aG0QrPVefIfrW1djR+/J4KeFQ0i1+hjZoaAmeNf3Z2jleK+R2hv+EboG/m8ruw==", + "dev": true, + "license": "MIT" + }, + "node_modules/typescript": { + "version": "5.6.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz", + "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + } + } +} diff --git a/test/e2e/extensions/test-extension/package.json b/test/e2e/extensions/test-extension/package.json new file mode 100644 index 000000000000..c4a4fcefb6a3 --- /dev/null +++ b/test/e2e/extensions/test-extension/package.json @@ -0,0 +1,35 @@ +{ + "name": "code-server-extension", + "description": "code-server test extension", + "version": "0.0.1", + "publisher": "coder", + "license": "MIT", + "activationEvents": [ + "onStartupFinished" + ], + "engines": { + "vscode": "^1.56.0" + }, + "main": "./extension.js", + "contributes": { + "commands": [ + { + "command": "codeServerTest.proxyUri", + "title": "Get proxy URI", + "category": "code-server" + }, + { + "command": "codeServerTest.asExternalUri", + "title": "asExternalUri test", + "category": "code-server" + } + ] + }, + "devDependencies": { + "@types/vscode": "^1.56.0", + "typescript": "^5.6.2" + }, + "scripts": { + "build": "tsc" + } +} diff --git a/test/e2e/extensions/test-extension/tsconfig.json b/test/e2e/extensions/test-extension/tsconfig.json new file mode 100644 index 000000000000..17c0d751da96 --- /dev/null +++ b/test/e2e/extensions/test-extension/tsconfig.json @@ -0,0 +1,12 @@ +{ + "compilerOptions": { + "target": "es2020", + "module": "commonjs", + "outDir": ".", + "strict": true, + "baseUrl": "./", + "skipLibCheck": true + }, + "include": ["./extension.ts"], + "exclude": ["node_modules"] +} diff --git a/test/e2e/github.test.ts b/test/e2e/github.test.ts new file mode 100644 index 000000000000..403d3161a208 --- /dev/null +++ b/test/e2e/github.test.ts @@ -0,0 +1,38 @@ +import { test as base } from "@playwright/test" +import { describe, expect, test } from "./baseFixture" + +if (process.env.GITHUB_TOKEN) { + describe("GitHub token", ["--disable-workspace-trust"], {}, () => { + test("should be logged in to pull requests extension", async ({ codeServerPage }) => { + await codeServerPage.exec("git init") + await codeServerPage.exec("git remote add origin https://github.com/coder/code-server") + await codeServerPage.installExtension("GitHub.vscode-pull-request-github") + await codeServerPage.executeCommandViaMenus("View: Show Github") + await codeServerPage.page.click("text=Sign in") + await codeServerPage.page.click("text=Allow") + // It should ask to select an account, one of which will be the one we + // pre-injected. + expect(await codeServerPage.page.isVisible("text=Select an account")).toBe(false) + }) + }) + + describe("No GitHub token", ["--disable-workspace-trust"], { GITHUB_TOKEN: "" }, () => { + test("should not be logged in to pull requests extension", async ({ codeServerPage }) => { + await codeServerPage.exec("git init") + await codeServerPage.exec("git remote add origin https://github.com/coder/code-server") + await codeServerPage.installExtension("GitHub.vscode-pull-request-github") + await codeServerPage.executeCommandViaMenus("View: Show Github") + await codeServerPage.page.click("text=Sign in") + await codeServerPage.page.click("text=Allow") + // Since there is no account it will ask directly for the token (because + // we are on localhost; otherwise it would initiate the oauth flow). + expect(await codeServerPage.page.isVisible("text=GitHub Personal Access Token")).toBe(false) + }) + }) +} else { + base.describe("GitHub token", () => { + base.skip("skipped because GITHUB_TOKEN is not set", () => { + // Playwright will not show this without a function. + }) + }) +} diff --git a/test/e2e/login.test.ts b/test/e2e/login.test.ts new file mode 100644 index 000000000000..90ec1b8cdef9 --- /dev/null +++ b/test/e2e/login.test.ts @@ -0,0 +1,61 @@ +import { PASSWORD } from "../utils/constants" +import { describe, test, expect } from "./baseFixture" + +describe("login", ["--disable-workspace-trust", "--auth", "password"], {}, () => { + test("should see the login page", async ({ codeServerPage }) => { + // It should send us to the login page + expect(await codeServerPage.page.title()).toBe("code-server login") + }) + + test("should be able to login", async ({ codeServerPage }) => { + // Type in password + await codeServerPage.page.fill(".password", PASSWORD) + // Click the submit button and login + await codeServerPage.page.click(".submit") + await codeServerPage.page.waitForLoadState("networkidle") + // We do this because occassionally code-server doesn't load on Firefox + // but loads if you reload once or twice + await codeServerPage.reloadUntilEditorIsReady() + // Make sure the editor actually loaded + expect(await codeServerPage.isEditorVisible()).toBe(true) + }) + + test("should see an error message for missing password", async ({ codeServerPage }) => { + // Skip entering password + // Click the submit button and login + await codeServerPage.page.click(".submit") + await codeServerPage.page.waitForLoadState("networkidle") + expect(await codeServerPage.page.isVisible("text=Missing password")) + }) + + test("should see an error message for incorrect password", async ({ codeServerPage }) => { + // Type in password + await codeServerPage.page.fill(".password", "password123") + // Click the submit button and login + await codeServerPage.page.click(".submit") + await codeServerPage.page.waitForLoadState("networkidle") + expect(await codeServerPage.page.isVisible("text=Incorrect password")) + }) + + test("should hit the rate limiter for too many unsuccessful logins", async ({ codeServerPage }) => { + // Type in password + await codeServerPage.page.fill(".password", "password123") + // Click the submit button and login + // The current RateLimiter allows 2 logins per minute plus + // 12 logins per hour for a total of 14 + // See: src/node/routes/login.ts + for (let i = 1; i <= 14; i++) { + await codeServerPage.page.click(".submit") + await codeServerPage.page.waitForLoadState("networkidle") + // We double-check that the correct error message shows + // which should be for incorrect password + expect(await codeServerPage.page.isVisible("text=Incorrect password")) + } + + // The 15th should fail for a different reason: + // login rate + await codeServerPage.page.click(".submit") + await codeServerPage.page.waitForLoadState("networkidle") + expect(await codeServerPage.page.isVisible("text=Login rate limited!")) + }) +}) diff --git a/test/e2e/logout.test.ts b/test/e2e/logout.test.ts new file mode 100644 index 000000000000..eb9d57d659a8 --- /dev/null +++ b/test/e2e/logout.test.ts @@ -0,0 +1,12 @@ +// NOTE@jsjoeio commenting out until we can figure out what's wrong +// import { describe, test, expect } from "./baseFixture" + +// describe("logout", true, ["--disable-workspace-trust"], {}, () => { +// test("should be able logout", async ({ codeServerPage }) => { +// // Recommended by Playwright for async navigation +// // https://github.com/microsoft/playwright/issues/1987#issuecomment-620182151 +// await Promise.all([codeServerPage.page.waitForNavigation(), codeServerPage.navigateMenus(["Log Out"])]) +// const currentUrl = codeServerPage.page.url() +// expect(currentUrl).toBe(`${await codeServerPage.address()}/login`) +// }) +// }) diff --git a/test/e2e/models/CodeServer.ts b/test/e2e/models/CodeServer.ts new file mode 100644 index 000000000000..d7f9a176c94a --- /dev/null +++ b/test/e2e/models/CodeServer.ts @@ -0,0 +1,597 @@ +import { field, Logger, logger } from "@coder/logger" +import * as cp from "child_process" +import { promises as fs } from "fs" +import * as path from "path" +import { Page } from "playwright" +import * as util from "util" +import { logError, normalize, plural } from "../../../src/common/util" +import { onLine } from "../../../src/node/util" +import { PASSWORD, workspaceDir } from "../../utils/constants" +import { getMaybeProxiedCodeServer, idleTimer, tmpdir } from "../../utils/helpers" + +interface CodeServerProcess { + process: cp.ChildProcess + address: string +} + +class Context { + private _canceled = false + private _done = false + public canceled(): boolean { + return this._canceled + } + public finished(): boolean { + return this._done + } + public cancel(): void { + this._canceled = true + } + public finish(): void { + this._done = true + } +} + +/** + * Class for spawning and managing code-server. + */ +export class CodeServer { + private process: Promise | undefined + public readonly logger: Logger + private closed = false + + constructor( + name: string, + private readonly args: string[], + private readonly env: NodeJS.ProcessEnv, + private _workspaceDir: Promise | string | undefined, + private readonly entry = process.env.CODE_SERVER_TEST_ENTRY || ".", + ) { + this.logger = logger.named(name) + } + + /** + * The address at which code-server can be accessed. Spawns code-server if it + * has not yet been spawned. + */ + async address(): Promise { + if (!this.process) { + this.process = this.spawn() + } + const { address } = await this.process + + return address + } + + /** + * The workspace directory code-server opens with. + */ + get workspaceDir(): Promise | string { + if (!this._workspaceDir) { + this._workspaceDir = tmpdir(workspaceDir) + } + return this._workspaceDir + } + + /** + * Create a random workspace and seed it with settings. + */ + private async createWorkspace(): Promise { + const dir = await this.workspaceDir + await fs.mkdir(path.join(dir, "Machine"), { recursive: true }) + await fs.writeFile( + path.join(dir, "Machine/settings.json"), + JSON.stringify({ + "workbench.startupEditor": "none", + }), + "utf8", + ) + + const extensionsDir = path.join(__dirname, "../extensions") + const languagepacksContent = { + es: { + hash: "8d919a946475223861fa0c62665a4c50", + extensions: [ + { + extensionIdentifier: { + id: "ms-ceintl.vscode-language-pack-es", + uuid: "47e020a1-33db-4cc0-a1b4-42f97781749a", + }, + version: "1.70.0", + }, + ], + translations: { + vscode: `${extensionsDir}/ms-ceintl.vscode-language-pack-es-1.70.0/translations/main.i18n.json`, + }, + label: "español", + }, + } + + // NOTE@jsjoeio - code-server should automatically generate the languagepacks.json for + // using different display languages. This is a temporary workaround until we fix that. + await fs.writeFile(path.join(dir, "languagepacks.json"), JSON.stringify(languagepacksContent)) + return dir + } + + /** + * Spawn a new code-server process with its own workspace and data + * directories. + */ + private async spawn(): Promise { + const dir = await this.createWorkspace() + const args = await this.argsWithDefaults([ + "--auth", + "none", + // The workspace to open. + ...(this.args.includes("--ignore-last-opened") ? [] : [dir]), + ...this.args, + // Using port zero will spawn on a random port. + "--bind-addr", + "127.0.0.1:0", + ]) + return new Promise((resolve, reject) => { + this.logger.debug("spawning `node " + args.join(" ") + "`") + const proc = cp.spawn("node", args, { + cwd: path.join(__dirname, "../../.."), + env: { + ...process.env, + ...this.env, + // Prevent code-server from using the existing instance when running + // the e2e tests from an integrated terminal. + VSCODE_IPC_HOOK_CLI: "", + PASSWORD, + }, + }) + + const timer = idleTimer("Failed to extract address; did the format change?", reject) + + proc.on("error", (error) => { + this.logger.error(error.message) + timer.dispose() + reject(error) + }) + + proc.on("close", (code) => { + const error = new Error("code-server closed unexpectedly. Try running with LOG_LEVEL=debug to see more info.") + if (!this.closed) { + this.logger.error(error.message, field("code", code)) + } + timer.dispose() + reject(error) + }) + + // Tracks when the HTTP and session servers are ready. + let httpAddress: string | undefined + let sessionAddress: string | undefined + + let resolved = false + proc.stdout.setEncoding("utf8") + onLine(proc, (line) => { + // As long as we are actively getting input reset the timer. If we stop + // getting input and still have not found the addresses the timer will + // reject. + timer.reset() + + // Log the line without the timestamp. + this.logger.debug(line.replace(/\[.+\]/, "")) + if (resolved) { + return + } + + let match = line.trim().match(/HTTPS? server listening on (https?:\/\/[.:\d]+)\/?$/) + if (match) { + // Cookies don't seem to work on IP addresses so swap to localhost. + // TODO: Investigate whether this is a bug with code-server. + httpAddress = match[1].replace("127.0.0.1", "localhost") + } + + match = line.trim().match(/Session server listening on (.+)$/) + if (match) { + sessionAddress = match[1] + } + + if (typeof httpAddress !== "undefined" && typeof sessionAddress !== "undefined") { + resolved = true + timer.dispose() + this.logger.debug(`code-server is ready: ${httpAddress} ${sessionAddress}`) + resolve({ process: proc, address: httpAddress }) + } + }) + }) + } + + /** + * Execute a short-lived command. + */ + async run(args: string[]): Promise { + args = await this.argsWithDefaults(args) + this.logger.debug("executing `node " + args.join(" ") + "`") + await util.promisify(cp.exec)("node " + args.join(" "), { + cwd: path.join(__dirname, "../../.."), + env: { + ...process.env, + ...this.env, + // Prevent code-server from using the existing instance when running + // the e2e tests from an integrated terminal. + VSCODE_IPC_HOOK_CLI: "", + }, + }) + } + + /** + * Combine arguments with defaults. + */ + private async argsWithDefaults(args: string[]): Promise { + // This will be used both as the workspace and data directory to ensure + // instances don't bleed into each other. + const dir = await this.workspaceDir + return [ + this.entry, + "--extensions-dir", + path.join(dir, "extensions"), + ...args, + // Setting the XDG variables would be easier and more thorough but the + // modules we import ignores those variables for non-Linux operating + // systems so use these flags instead. + "--config", + path.join(dir, "config.yaml"), + "--user-data-dir", + dir, + ] + } + + /** + * Close the code-server process. + */ + async close(): Promise { + logger.debug("closing") + if (this.process) { + const proc = (await this.process).process + this.closed = true // To prevent the close handler from erroring. + proc.kill() + } + } + + /** + * Whether or not authentication is enabled. + */ + authEnabled(): boolean { + return this.args.includes("password") + } +} + +/** + * This is a "Page Object Model" (https://playwright.dev/docs/pom/) meant to + * wrap over a page and represent actions on that page in a more readable way. + * This targets a specific code-server instance which must be passed in. + * Navigation and setup performed by this model will cause the code-server + * process to spawn if it hasn't yet. + */ +export class CodeServerPage { + private readonly editorSelector = "div.monaco-workbench" + + constructor( + private readonly codeServer: CodeServer, + public readonly page: Page, + ) { + this.page.on("console", (message) => { + this.codeServer.logger.debug(message.text()) + }) + this.page.on("pageerror", (error) => { + logError(this.codeServer.logger, "page", error) + }) + } + + address() { + return this.codeServer.address() + } + + /** + * The workspace directory code-server opens with. + */ + get workspaceDir() { + return this.codeServer.workspaceDir + } + + /** + * Navigate to a code-server endpoint (root by default). Then wait for the + * editor to become available. + */ + async navigate(endpoint = "/") { + const address = await getMaybeProxiedCodeServer(this.codeServer) + const noramlizedUrl = normalize(address + endpoint, true) + const to = new URL(noramlizedUrl) + + this.codeServer.logger.info(`navigating to ${to}`) + await this.page.goto(to.toString()) + + // Only reload editor if auth is not enabled. Otherwise we'll get stuck + // reloading the login page. + if (!this.codeServer.authEnabled()) { + await this.reloadUntilEditorIsReady() + } + } + + /** + * Checks if the editor is visible + * and that we are connected to the host + * + * Reload until both checks pass + */ + async reloadUntilEditorIsReady() { + this.codeServer.logger.debug("Waiting for editor to be ready...") + + const editorIsVisible = await this.isEditorVisible() + let reloadCount = 0 + + // Occassionally code-server timeouts in Firefox + // we're not sure why + // but usually a reload or two fixes it + // TODO@jsjoeio @oxy look into Firefox reconnection/timeout issues + while (!editorIsVisible) { + // When a reload happens, we want to wait for all resources to be + // loaded completely. Hence why we use that instead of DOMContentLoaded + // Read more: https://thisthat.dev/dom-content-loaded-vs-load/ + await this.page.waitForLoadState("load") + // Give it an extra second just in case it's feeling extra slow + await this.page.waitForTimeout(1000) + reloadCount += 1 + if (await this.isEditorVisible()) { + this.codeServer.logger.debug(`editor became ready after ${reloadCount} reloads`) + break + } + await this.page.reload() + } + + this.codeServer.logger.debug("Editor is ready!") + } + + /** + * Checks if the editor is visible + */ + async isEditorVisible() { + this.codeServer.logger.debug("Waiting for editor to be visible...") + // Make sure the editor actually loaded + await this.page.waitForSelector(this.editorSelector) + const visible = await this.page.isVisible(this.editorSelector) + + this.codeServer.logger.debug(`Editor is ${visible ? "not visible" : "visible"}!`) + + return visible + } + + /** + * Checks if the test extension loaded + */ + async waitForTestExtensionLoaded(): Promise { + const selector = "text=test extension loaded" + this.codeServer.logger.debug("Waiting for test extension to load...") + + await this.page.waitForSelector(selector) + } + + /** + * Focuses the integrated terminal by navigating through the command palette. + * + * This should focus the terminal no matter if it already has focus and/or is + * or isn't visible already. It will always create a new terminal to avoid + * clobbering parallel tests. + */ + async focusTerminal() { + const doFocus = async (): Promise => { + await this.executeCommandViaMenus("Terminal: Create New Terminal") + try { + await this.page.waitForLoadState("load") + await this.page.waitForSelector("textarea.xterm-helper-textarea:focus-within", { timeout: 5000 }) + return true + } catch (error) { + return false + } + } + + let attempts = 1 + while (!(await doFocus())) { + ++attempts + this.codeServer.logger.debug(`no focused terminal textarea, retrying (${attempts}/∞)`) + } + + this.codeServer.logger.debug(`opening terminal took ${attempts} ${plural(attempts, "attempt")}`) + } + + /** + * Open a file by using menus. + */ + async openFile(file: string) { + await this.navigateMenus(["File", "Open File..."]) + await this.navigateQuickInput([path.basename(file)]) + await this.waitForTab(file) + } + + /** + * Open a file through an external command. + */ + async openFileExternally(file: string) { + await this.codeServer.run(["--reuse-window", file]) + } + + /** + * Wait for a tab to open for the specified file. + */ + async waitForTab(file: string): Promise { + await this.page.waitForSelector(`.tab :text("${path.basename(file)}")`) + } + + /** + * See if the specified tab is open. + */ + async tabIsVisible(file: string): Promise { + return this.page.isVisible(`.tab :text("${path.basename(file)}")`) + } + + /** + * Navigate to the command palette via menus then execute a command by typing + * it then clicking the match from the results. + */ + async executeCommandViaMenus(command: string) { + await this.navigateMenus(["View", "Command Palette..."]) + + await this.page.keyboard.type(command) + + await this.page.hover(`text=${command}`) + await this.page.click(`text=${command}`) + } + + /** + * Navigate through the items in the selector. `open` is a function that will + * open the menu/popup containing the items through which to navigation. + */ + async navigateItems(items: string[], selector: string, open?: (selector: string) => void): Promise { + const logger = this.codeServer.logger.named(selector) + + /** + * If the selector loses focus or gets removed this will resolve with false, + * signaling we need to try again. + */ + const openThenWaitClose = async (ctx: Context) => { + if (open) { + await open(selector) + } + this.codeServer.logger.debug(`watching ${selector}`) + try { + await this.page.waitForSelector(`${selector}:not(:focus-within)`) + } catch (error) { + if (!ctx.finished()) { + this.codeServer.logger.debug(`${selector} navigation: ${(error as any).message || error}`) + } + } + return false + } + + /** + * This will step through each item, aborting and returning false if + * canceled or if any navigation step has an error which signals we need to + * try again. + */ + const navigate = async (ctx: Context) => { + const steps: Array<{ fn: () => Promise; name: string }> = [ + { + fn: () => this.page.waitForSelector(`${selector}:focus-within`), + name: "focus", + }, + ] + + for (const item of items) { + // Normally these will wait for the item to be visible and then execute + // the action. The problem is that if the menu closes these will still + // be waiting and continue to execute once the menu is visible again, + // potentially conflicting with the new set of navigations (for example + // if the old promise clicks logout before the new one can). By + // splitting them into two steps each we can cancel before running the + // action. + steps.push({ + fn: () => this.page.hover(`${selector} :text-is("${item}")`, { trial: true }), + name: `${item}:hover:trial`, + }) + steps.push({ + fn: () => this.page.hover(`${selector} :text-is("${item}")`, { force: true }), + name: `${item}:hover:force`, + }) + steps.push({ + fn: () => this.page.click(`${selector} :text-is("${item}")`, { trial: true }), + name: `${item}:click:trial`, + }) + steps.push({ + fn: () => this.page.click(`${selector} :text-is("${item}")`, { force: true }), + name: `${item}:click:force`, + }) + } + + for (const step of steps) { + try { + logger.debug(`navigation step: ${step.name}`) + await step.fn() + if (ctx.canceled()) { + logger.debug("navigation canceled") + return false + } + } catch (error) { + logger.debug(`navigation: ${(error as any).message || error}`) + return false + } + } + return true + } + + // We are seeing the menu closing after opening if we open it too soon and + // the picker getting recreated in the middle of trying to select an item. + // To counter this we will keep trying to navigate through the items every + // time we lose focus or there is an error. + let attempts = 1 + let context = new Context() + while (!(await Promise.race([openThenWaitClose(context), navigate(context)]))) { + ++attempts + logger.debug(`closed, retrying (${attempts}/∞)`) + context.cancel() + context = new Context() + } + + context.finish() + logger.debug(`navigation took ${attempts} ${plural(attempts, "attempt")}`) + } + + /** + * Navigate through a currently opened "quick input" widget, retrying on + * failure. + */ + async navigateQuickInput(items: string[]): Promise { + await this.navigateItems(items, ".quick-input-widget") + } + + /** + * Navigate through the menu, retrying on failure. + */ + async navigateMenus(menus: string[]): Promise { + await this.navigateItems(menus, '[aria-label="Application Menu"]', async (selector) => { + await this.page.click(selector) + }) + } + + /** + * Open context menu on the specified selector. + */ + async openContextMenu(selector: string): Promise { + const el = await this.page.waitForSelector(selector) + await el.click({ button: "right" }) + await this.page.waitForSelector(".context-view-block") + } + + /** + * Execute a command in the root of the instance's workspace directory. + */ + async exec(command: string): Promise { + await util.promisify(cp.exec)(command, { + cwd: await this.workspaceDir, + }) + } + + /** + * Install an extension by ID to the instance's temporary extension + * directory. + */ + async installExtension(id: string): Promise { + const dir = path.join(await this.workspaceDir, "extensions") + await util.promisify(cp.exec)(`node . --install-extension ${id} --extensions-dir ${dir}`, { + cwd: path.join(__dirname, "../../.."), + }) + } + + /** + * Wait for state to be flushed to the database. + */ + async stateFlush(): Promise { + // If we reload too quickly VS Code will be unable to save the state changes + // so wait until those have been written to the database. It flushes every + // five seconds so we need to wait at least that long. + // TODO@asher: There must be a better way. + await this.page.waitForTimeout(5500) + } +} diff --git a/test/e2e/openHelpAbout.test.ts b/test/e2e/openHelpAbout.test.ts new file mode 100644 index 000000000000..b21fca35ea41 --- /dev/null +++ b/test/e2e/openHelpAbout.test.ts @@ -0,0 +1,17 @@ +import { version } from "../../src/node/constants" +import { describe, test, expect } from "./baseFixture" + +describe("Open Help > About", ["--disable-workspace-trust"], {}, () => { + test("should see code-server version in about dialog", async ({ codeServerPage }) => { + // Open using the menu. + await codeServerPage.navigateMenus(["Help", "About"]) + + const isDevMode = process.env.VSCODE_DEV === "1" + + // Look for code-server info div. + const element = await codeServerPage.page.waitForSelector( + `div[role="dialog"] >> text=code-server: ${isDevMode ? "Unknown" : "v" + version}`, + ) + expect(element).not.toBeNull() + }) +}) diff --git a/test/e2e/routes.test.ts b/test/e2e/routes.test.ts new file mode 100644 index 000000000000..39c19697e9b9 --- /dev/null +++ b/test/e2e/routes.test.ts @@ -0,0 +1,125 @@ +import { clean, getMaybeProxiedPathname } from "../utils/helpers" +import { describe, test, expect } from "./baseFixture" + +const routes = { + "/": [ + /\.\/manifest.json/, + /\.\/_static\//, + /[a-z]+-[0-9a-z]+\/static\//, + /http:\/\/localhost:[0-9]+\/[a-z]+-[0-9a-z]+\/static\//, + ], + "/vscode": [ + /\.\/vscode\/manifest.json/, + /\.\/_static\//, + /vscode\/[a-z]+-[0-9a-z]+\/static\//, + /http:\/\/localhost:[0-9]+\/vscode\/[a-z]+-[0-9a-z]+\/static\//, + ], + "/vscode/": [ + /\.\/manifest.json/, + /\.\/\.\.\/_static\//, + /[a-z]+-[0-9a-z]+\/static\//, + /http:\/\/localhost:[0-9]+\/vscode\/[a-z]+-[0-9a-z]+\/static\//, + ], +} + +describe("VS Code Routes", ["--disable-workspace-trust"], {}, async () => { + const testName = "vscode-routes-default" + test.beforeAll(async () => { + await clean(testName) + }) + + test("should load all route variations", async ({ codeServerPage }) => { + for (const [route, matchers] of Object.entries(routes)) { + await codeServerPage.navigate(route) + + // Check there were no redirections + const url = new URL(codeServerPage.page.url()) + const pathname = getMaybeProxiedPathname(url) + expect(pathname).toBe(route) + + // Check that assets are pointing to the right spot. Some will be + // relative, without a leading dot (VS Code's assets). Some will be + // relative with a leading dot (our assets). Others will have been + // resolved against the origin. + const elements = await codeServerPage.page.locator("[src]").all() + for (const element of elements) { + const src = await element.getAttribute("src") + if (src && !matchers.some((m) => m.test(src))) { + throw new Error(`${src} did not match any validators for route ${route}`) + } + } + } + }) +}) + +const CODE_WORKSPACE_DIR = process.env.CODE_WORKSPACE_DIR || "" +describe("VS Code Routes with code-workspace", ["--disable-workspace-trust", CODE_WORKSPACE_DIR], {}, async () => { + test("should redirect to the passed in workspace using human-readable query", async ({ codeServerPage }) => { + const url = new URL(codeServerPage.page.url()) + const pathname = getMaybeProxiedPathname(url) + expect(pathname).toBe("/") + expect(url.search).toBe(`?workspace=${CODE_WORKSPACE_DIR}`) + }) +}) + +const CODE_FOLDER_DIR = process.env.CODE_FOLDER_DIR || "" +describe("VS Code Routes with code-workspace", ["--disable-workspace-trust", CODE_FOLDER_DIR], {}, async () => { + test("should redirect to the passed in folder using human-readable query", async ({ codeServerPage }) => { + const url = new URL(codeServerPage.page.url()) + const pathname = getMaybeProxiedPathname(url) + expect(pathname).toBe("/") + expect(url.search).toBe(`?folder=${CODE_FOLDER_DIR}`) + }) +}) + +describe( + "VS Code Routes with ignore-last-opened", + ["--disable-workspace-trust", "--ignore-last-opened"], + {}, + async () => { + test("should not redirect", async ({ codeServerPage }) => { + const folder = process.env.CODE_FOLDER_DIR + + await codeServerPage.navigate(`/?folder=${folder}`) + await codeServerPage.navigate(`/`) + + const url = new URL(codeServerPage.page.url()) + const pathname = getMaybeProxiedPathname(url) + expect(pathname).toBe("/") + expect(url.search).toBe("") + }) + }, +) + +describe("VS Code Routes with no workspace or folder", ["--disable-workspace-trust"], {}, async () => { + test("should redirect to last query folder/workspace", async ({ codeServerPage }) => { + const folder = process.env.CODE_FOLDER_DIR + const workspace = process.env.CODE_WORKSPACE_DIR + await codeServerPage.navigate(`/?folder=${folder}&workspace=${workspace}`) + + // If you visit again without query parameters it will re-attach them by + // redirecting. It should always redirect to the same route. + for (const route of Object.keys(routes)) { + await codeServerPage.navigate(route) + const url = new URL(codeServerPage.page.url()) + const pathname = getMaybeProxiedPathname(url) + expect(pathname).toBe(route) + expect(url.search).toBe(`?folder=${folder}&workspace=${workspace}`) + } + }) +}) + +describe("VS Code Routes with no workspace or folder", ["--disable-workspace-trust"], {}, async () => { + test("should not redirect if ew passed in", async ({ codeServerPage }) => { + const folder = process.env.CODE_FOLDER_DIR + const workspace = process.env.CODE_WORKSPACE_DIR + await codeServerPage.navigate(`/?folder=${folder}&workspace=${workspace}`) + + // Closing the folder should stop the redirecting. + await codeServerPage.navigate("/?ew=true") + const url = new URL(codeServerPage.page.url()) + const pathname = getMaybeProxiedPathname(url) + expect(pathname).toBe("/") + expect(url.search).toBe("?ew=true") + }) +}) diff --git a/test/e2e/terminal.test.ts b/test/e2e/terminal.test.ts new file mode 100644 index 000000000000..0de4f222a2a3 --- /dev/null +++ b/test/e2e/terminal.test.ts @@ -0,0 +1,53 @@ +import * as cp from "child_process" +import { promises as fs } from "fs" +import * as path from "path" +import util from "util" +import { clean, getMaybeProxiedCodeServer, tmpdir } from "../utils/helpers" +import { describe, expect, test } from "./baseFixture" + +describe("Integrated Terminal", ["--disable-workspace-trust"], {}, () => { + const testName = "integrated-terminal" + test.beforeAll(async () => { + await clean(testName) + }) + + test("should have access to VSCODE_PROXY_URI", async ({ codeServerPage }) => { + const tmpFolderPath = await tmpdir(testName) + const tmpFile = path.join(tmpFolderPath, "pipe") + + const command = `mkfifo '${tmpFile}' && cat '${tmpFile}'` + const exec = util.promisify(cp.exec) + const output = exec(command, { encoding: "utf8" }) + + // Open terminal and type in value + await codeServerPage.focusTerminal() + + await codeServerPage.page.keyboard.type(`printenv VSCODE_PROXY_URI > ${tmpFile}`) + await codeServerPage.page.keyboard.press("Enter") + + const { stdout } = await output + const address = await getMaybeProxiedCodeServer(codeServerPage) + expect(stdout).toMatch(address) + }) + + // TODO@jsjoeio - add test to make sure full code-server path works + test("should be able to invoke `code-server` to open a file", async ({ codeServerPage }) => { + const tmpFolderPath = await tmpdir(testName) + const tmpFile = path.join(tmpFolderPath, "test-file") + await fs.writeFile(tmpFile, "test") + + await codeServerPage.focusTerminal() + + await codeServerPage.page.keyboard.type(`code-server ${tmpFile}`) + await codeServerPage.page.keyboard.press("Enter") + + await codeServerPage.waitForTab(path.basename(tmpFile)) + + const externalTmpFile = path.join(tmpFolderPath, "test-external-file") + await fs.writeFile(externalTmpFile, "foobar") + + await codeServerPage.openFileExternally(externalTmpFile) + + await codeServerPage.waitForTab(path.basename(externalTmpFile)) + }) +}) diff --git a/test/e2e/uploads.test.ts b/test/e2e/uploads.test.ts new file mode 100644 index 000000000000..80df808a44e4 --- /dev/null +++ b/test/e2e/uploads.test.ts @@ -0,0 +1,56 @@ +import { promises as fs } from "fs" +import * as path from "path" +import { clean } from "../utils/helpers" +import { describe, test, expect } from "./baseFixture" + +describe("Uploads (enabled)", ["--disable-workspace-trust"], {}, () => { + const testName = "uploads-enabled" + test.beforeAll(async () => { + await clean(testName) + }) + + test("should see the 'Upload...' option", async ({ codeServerPage }) => { + // Setup + const workspaceDir = await codeServerPage.workspaceDir + const tmpDirPath = path.join(workspaceDir, "test-directory") + await fs.mkdir(tmpDirPath) + + // Action + await codeServerPage.openContextMenu('span:has-text("test-directory")') + + expect(await codeServerPage.page.isVisible("text=Upload...")).toBe(true) + }) + + test("should see the 'Show Local' button on Open File", async ({ codeServerPage }) => { + // Action + await codeServerPage.navigateMenus(["File", "Open File..."]) + await codeServerPage.page.waitForSelector(".quick-input-widget") + expect(await codeServerPage.page.isVisible("text=Show Local")).toBe(true) + }) +}) + +describe("Uploads (disabled)", ["--disable-workspace-trust", "--disable-file-uploads"], {}, () => { + const testName = "uploads-disabled" + test.beforeAll(async () => { + await clean(testName) + }) + + test("should not see the 'Upload...' option", async ({ codeServerPage }) => { + // Setup + const workspaceDir = await codeServerPage.workspaceDir + const tmpDirPath = path.join(workspaceDir, "test-directory") + await fs.mkdir(tmpDirPath) + + // Action + await codeServerPage.openContextMenu('span:has-text("test-directory")') + + expect(await codeServerPage.page.isVisible("text=Upload...")).toBe(false) + }) + + test("should not see the 'Show Local' button on Open File", async ({ codeServerPage }) => { + // Action + await codeServerPage.navigateMenus(["File", "Open File..."]) + await codeServerPage.page.waitForSelector(".quick-input-widget") + expect(await codeServerPage.page.isVisible("text=Show Local")).toBe(false) + }) +}) diff --git a/test/e2e/webview.test.ts b/test/e2e/webview.test.ts new file mode 100644 index 000000000000..e5a783f37322 --- /dev/null +++ b/test/e2e/webview.test.ts @@ -0,0 +1,25 @@ +import { promises as fs } from "fs" +import * as path from "path" +import { describe, test, expect } from "./baseFixture" + +describe("Webviews", ["--disable-workspace-trust"], {}, () => { + test("should preview a Markdown file", async ({ codeServerPage }) => { + // Create Markdown file + const heading = "Hello world" + const dir = await codeServerPage.workspaceDir + const file = path.join(dir, "text.md") + await fs.writeFile(file, `# ${heading}`) + await codeServerPage.openFile(file) + + // Open Preview + await codeServerPage.executeCommandViaMenus("Markdown: Open Preview to the Side") + // Wait for the iframe to open and load + await codeServerPage.waitForTab(`Preview ${file}`) + + // It's an iframe within an iframe + // so we have to do .frameLocator twice + await expect( + codeServerPage.page.frameLocator("iframe.webview.ready").frameLocator("#active-frame").getByText("Hello world"), + ).toBeVisible() + }) +}) diff --git a/test/integration/help.test.ts b/test/integration/help.test.ts new file mode 100644 index 000000000000..12786f282524 --- /dev/null +++ b/test/integration/help.test.ts @@ -0,0 +1,13 @@ +import { runCodeServerCommand } from "../utils/runCodeServerCommand" + +// NOTE@jsjoeio +// We have this test to ensure that native modules +// work as expected. If this is called on the wrong +// platform, the test will fail. +describe("--help", () => { + it("should list code-server usage", async () => { + const expectedOutput = "Usage: code-server [options] [path]" + const { stdout } = await runCodeServerCommand(["--help"]) + expect(stdout).toMatch(expectedOutput) + }, 20000) +}) diff --git a/test/integration/installExtension.test.ts b/test/integration/installExtension.test.ts new file mode 100644 index 000000000000..5986c964e912 --- /dev/null +++ b/test/integration/installExtension.test.ts @@ -0,0 +1,22 @@ +import { clean, tmpdir } from "../utils/helpers" +import { runCodeServerCommand } from "../utils/runCodeServerCommand" + +describe("--install-extension", () => { + const testName = "installExtension" + let tempDir: string + let setupFlags: string[] + + beforeEach(async () => { + await clean(testName) + tempDir = await tmpdir(testName) + setupFlags = ["--extensions-dir", tempDir] + }) + it("should use EXTENSIONS_GALLERY when set", async () => { + const extName = "author.extension" + await expect( + runCodeServerCommand([...setupFlags, "--install-extension", extName], { + EXTENSIONS_GALLERY: "{}", + }), + ).rejects.toThrow("No extension gallery service configured") + }) +}) diff --git a/test/package-lock.json b/test/package-lock.json new file mode 100644 index 000000000000..4e28618543cd --- /dev/null +++ b/test/package-lock.json @@ -0,0 +1,5376 @@ +{ + "name": "test", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "license": "MIT", + "devDependencies": { + "@jest-mock/express": "^1.4.5", + "@playwright/test": "^1.56.1", + "@types/jest": "^27.0.2", + "@types/jsdom": "^16.2.13", + "@types/node-fetch": "^2.5.8", + "@types/wtfnode": "^0.7.0", + "argon2": "^0.28.0", + "extract-zip": "^2.0.1", + "jest": "^27.3.1", + "jest-fetch-mock": "^3.0.3", + "jsdom": "^16.4.0", + "node-fetch": "^2.6.7", + "playwright": "^1.56.1", + "ts-jest": "^27.0.7", + "wtfnode": "^0.9.1" + } + }, + "node_modules/@ampproject/remapping": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", + "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.25.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.25.7.tgz", + "integrity": "sha512-0xZJFNE5XMpENsgfHYTw8FbX4kv53mFLn2i3XPoq69LyhYSCBJtitaHx9QnsVTrsogI4Z3+HtEfZ2/GFPOtf5g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/highlight": "^7.25.7", + "picocolors": "^1.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.25.7", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.25.7.tgz", + "integrity": "sha512-9ickoLz+hcXCeh7jrcin+/SLWm+GkxE2kTvoYyp38p4WkdFXfQJxDFGWp/YHjiKLPx06z2A7W8XKuqbReXDzsw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.25.7", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.25.7.tgz", + "integrity": "sha512-yJ474Zv3cwiSOO9nXJuqzvwEeM+chDuQ8GJirw+pZ91sCGCyOZ3dJkVE09fTV0VEVzXyLWhh3G/AolYTPX7Mow==", + "dev": true, + "license": "MIT", + "dependencies": { + "@ampproject/remapping": "^2.2.0", + "@babel/code-frame": "^7.25.7", + "@babel/generator": "^7.25.7", + "@babel/helper-compilation-targets": "^7.25.7", + "@babel/helper-module-transforms": "^7.25.7", + "@babel/helpers": "^7.25.7", + "@babel/parser": "^7.25.7", + "@babel/template": "^7.25.7", + "@babel/traverse": "^7.25.7", + "@babel/types": "^7.25.7", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/core/node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@babel/core/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/@babel/generator": { + "version": "7.25.7", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.25.7.tgz", + "integrity": "sha512-5Dqpl5fyV9pIAD62yK9P7fcA768uVPUyrQmqpqstHWgMma4feF1x/oFysBCVZLY5wJ2GkMUCdsNDnGZrPoR6rA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.25.7", + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25", + "jsesc": "^3.0.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.25.7", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.25.7.tgz", + "integrity": "sha512-DniTEax0sv6isaw6qSQSfV4gVRNtw2rte8HHM45t9ZR0xILaufBRNkpMifCRiAPyvL4ACD6v0gfCwCmtOQaV4A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.25.7", + "@babel/helper-validator-option": "^7.25.7", + "browserslist": "^4.24.0", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.25.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.25.7.tgz", + "integrity": "sha512-o0xCgpNmRohmnoWKQ0Ij8IdddjyBFE4T2kagL/x6M3+4zUgc+4qTOUBoNe4XxDskt1HPKO007ZPiMgLDq2s7Kw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.25.7", + "@babel/types": "^7.25.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.25.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.25.7.tgz", + "integrity": "sha512-k/6f8dKG3yDz/qCwSM+RKovjMix563SLxQFo0UhRNo239SP6n9u5/eLtKD6EAjwta2JHJ49CsD8pms2HdNiMMQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-module-imports": "^7.25.7", + "@babel/helper-simple-access": "^7.25.7", + "@babel/helper-validator-identifier": "^7.25.7", + "@babel/traverse": "^7.25.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-plugin-utils": { + "version": "7.25.7", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.25.7.tgz", + "integrity": "sha512-eaPZai0PiqCi09pPs3pAFfl/zYgGaE6IdXtYvmf0qlcDTd3WCtO7JWCcRd64e0EQrcYgiHibEZnOGsSY4QSgaw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-simple-access": { + "version": "7.25.7", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.25.7.tgz", + "integrity": "sha512-FPGAkJmyoChQeM+ruBGIDyrT2tKfZJO8NcxdC+CWNJi7N8/rZpSxK7yvBJ5O/nF1gfu5KzN7VKG3YVSLFfRSxQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.25.7", + "@babel/types": "^7.25.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.25.7", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.7.tgz", + "integrity": "sha512-CbkjYdsJNHFk8uqpEkpCvRs3YRp9tY6FmFY7wLMSYuGYkrdUi7r2lc4/wqsvlHoMznX3WJ9IP8giGPq68T/Y6g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.25.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.7.tgz", + "integrity": "sha512-AM6TzwYqGChO45oiuPqwL2t20/HdMC1rTPAesnBCgPCSF1x3oN9MVUwQV2iyz4xqWrctwK5RNC8LV22kaQCNYg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.25.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.25.7.tgz", + "integrity": "sha512-ytbPLsm+GjArDYXJ8Ydr1c/KJuutjF2besPNbIZnZ6MKUxi/uTA22t2ymmA4WFjZFpjiAMO0xuuJPqK2nvDVfQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.25.7", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.25.7.tgz", + "integrity": "sha512-Sv6pASx7Esm38KQpF/U/OXLwPPrdGHNKoeblRxgZRLXnAtnkEe4ptJPDtAZM7fBLadbc1Q07kQpSiGQ0Jg6tRA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/template": "^7.25.7", + "@babel/types": "^7.25.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight": { + "version": "7.25.7", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.25.7.tgz", + "integrity": "sha512-iYyACpW3iW8Fw+ZybQK+drQre+ns/tKpXbNESfrhNnPLIklLbXr7MYJ6gPEd0iETGLOK+SxMjVvKb/ffmk+FEw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.25.7", + "chalk": "^2.4.2", + "js-tokens": "^4.0.0", + "picocolors": "^1.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/@babel/highlight/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@babel/highlight/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/@babel/highlight/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/parser": { + "version": "7.25.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.25.7.tgz", + "integrity": "sha512-aZn7ETtQsjjGG5HruveUK06cU3Hljuhd9Iojm4M8WWv3wLE6OkE5PWbDUkItmMgegmccaITudyuW5RPYrYlgWw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.25.7" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/plugin-syntax-async-generators": { + "version": "7.8.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", + "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-bigint": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz", + "integrity": "sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-class-properties": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", + "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.12.13" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-class-static-block": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-static-block/-/plugin-syntax-class-static-block-7.14.5.tgz", + "integrity": "sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-import-attributes": { + "version": "7.25.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.25.7.tgz", + "integrity": "sha512-AqVo+dguCgmpi/3mYBdu9lkngOBlQ2w2vnNpa6gfiCxQZLzV4ZbhsXitJ2Yblkoe1VQwtHSaNmIaGll/26YWRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-import-meta": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz", + "integrity": "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-json-strings": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", + "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-logical-assignment-operators": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", + "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-nullish-coalescing-operator": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", + "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-numeric-separator": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz", + "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-object-rest-spread": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", + "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-optional-catch-binding": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", + "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-optional-chaining": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", + "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-private-property-in-object": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-private-property-in-object/-/plugin-syntax-private-property-in-object-7.14.5.tgz", + "integrity": "sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-top-level-await": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", + "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-typescript": { + "version": "7.25.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.25.7.tgz", + "integrity": "sha512-rR+5FDjpCHqqZN2bzZm18bVYGaejGq5ZkpVCJLXor/+zlSrSoc4KWcHI0URVWjl/68Dyr1uwZUz/1njycEAv9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/template": { + "version": "7.25.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.25.7.tgz", + "integrity": "sha512-wRwtAgI3bAS+JGU2upWNL9lSlDcRCqD05BZ1n3X2ONLH1WilFP6O1otQjeMK/1g0pvYcXC7b/qVUB1keofjtZA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.25.7", + "@babel/parser": "^7.25.7", + "@babel/types": "^7.25.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.25.7", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.25.7.tgz", + "integrity": "sha512-jatJPT1Zjqvh/1FyJs6qAHL+Dzb7sTb+xr7Q+gM1b+1oBsMsQQ4FkVKb6dFlJvLlVssqkRzV05Jzervt9yhnzg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.25.7", + "@babel/generator": "^7.25.7", + "@babel/parser": "^7.25.7", + "@babel/template": "^7.25.7", + "@babel/types": "^7.25.7", + "debug": "^4.3.1", + "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.25.7", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.25.7.tgz", + "integrity": "sha512-vwIVdXG+j+FOpkwqHRcBgHLYNL7XMkufrlaFvL9o6Ai9sJn9+PdyIL5qa0XzTZw084c+u9LOls53eoZWP/W5WQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^7.25.7", + "@babel/helper-validator-identifier": "^7.25.7", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@bcoe/v8-coverage": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", + "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@istanbuljs/load-nyc-config": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", + "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "camelcase": "^5.3.1", + "find-up": "^4.1.0", + "get-package-type": "^0.1.0", + "js-yaml": "^3.13.1", + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/schema": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", + "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest-mock/express": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/@jest-mock/express/-/express-1.4.5.tgz", + "integrity": "sha512-bERM1jnutyH7VMahdaOHAKy7lgX47zJ7+RTz2eMz0wlCttd9CkhsKFEyoWmJBSz/ow0nVj3lCuRqLem4QDYFkQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jest/console": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/console/-/console-27.5.1.tgz", + "integrity": "sha512-kZ/tNpS3NXn0mlXXXPNuDZnb4c0oZ20r4K5eemM2k30ZC3G0T02nXUvyhf5YdbXWHPEJLc9qGLxEZ216MdL+Zg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^27.5.1", + "@types/node": "*", + "chalk": "^4.0.0", + "jest-message-util": "^27.5.1", + "jest-util": "^27.5.1", + "slash": "^3.0.0" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/@jest/core": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/core/-/core-27.5.1.tgz", + "integrity": "sha512-AK6/UTrvQD0Cd24NSqmIA6rKsu0tKIxfiCducZvqxYdmMisOYAsdItspT+fQDQYARPf8XgjAFZi0ogW2agH5nQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/console": "^27.5.1", + "@jest/reporters": "^27.5.1", + "@jest/test-result": "^27.5.1", + "@jest/transform": "^27.5.1", + "@jest/types": "^27.5.1", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "emittery": "^0.8.1", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "jest-changed-files": "^27.5.1", + "jest-config": "^27.5.1", + "jest-haste-map": "^27.5.1", + "jest-message-util": "^27.5.1", + "jest-regex-util": "^27.5.1", + "jest-resolve": "^27.5.1", + "jest-resolve-dependencies": "^27.5.1", + "jest-runner": "^27.5.1", + "jest-runtime": "^27.5.1", + "jest-snapshot": "^27.5.1", + "jest-util": "^27.5.1", + "jest-validate": "^27.5.1", + "jest-watcher": "^27.5.1", + "micromatch": "^4.0.4", + "rimraf": "^3.0.0", + "slash": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/@jest/environment": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-27.5.1.tgz", + "integrity": "sha512-/WQjhPJe3/ghaol/4Bq480JKXV/Rfw8nQdN7f41fM8VDHLcxKXou6QyXAh3EFr9/bVG3x74z1NWDkP87EiY8gA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/fake-timers": "^27.5.1", + "@jest/types": "^27.5.1", + "@types/node": "*", + "jest-mock": "^27.5.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/@jest/fake-timers": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-27.5.1.tgz", + "integrity": "sha512-/aPowoolwa07k7/oM3aASneNeBGCmGQsc3ugN4u6s4C/+s5M64MFo/+djTdiwcbQlRfFElGuDXWzaWj6QgKObQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^27.5.1", + "@sinonjs/fake-timers": "^8.0.1", + "@types/node": "*", + "jest-message-util": "^27.5.1", + "jest-mock": "^27.5.1", + "jest-util": "^27.5.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/@jest/globals": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-27.5.1.tgz", + "integrity": "sha512-ZEJNB41OBQQgGzgyInAv0UUfDDj3upmHydjieSxFvTRuZElrx7tXg/uVQ5hYVEwiXs3+aMsAeEc9X7xiSKCm4Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/environment": "^27.5.1", + "@jest/types": "^27.5.1", + "expect": "^27.5.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/@jest/reporters": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-27.5.1.tgz", + "integrity": "sha512-cPXh9hWIlVJMQkVk84aIvXuBB4uQQmFqZiacloFuGiP3ah1sbCxCosidXFDfqG8+6fO1oR2dTJTlsOy4VFmUfw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@bcoe/v8-coverage": "^0.2.3", + "@jest/console": "^27.5.1", + "@jest/test-result": "^27.5.1", + "@jest/transform": "^27.5.1", + "@jest/types": "^27.5.1", + "@types/node": "*", + "chalk": "^4.0.0", + "collect-v8-coverage": "^1.0.0", + "exit": "^0.1.2", + "glob": "^7.1.2", + "graceful-fs": "^4.2.9", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-instrument": "^5.1.0", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.0", + "istanbul-reports": "^3.1.3", + "jest-haste-map": "^27.5.1", + "jest-resolve": "^27.5.1", + "jest-util": "^27.5.1", + "jest-worker": "^27.5.1", + "slash": "^3.0.0", + "source-map": "^0.6.0", + "string-length": "^4.0.1", + "terminal-link": "^2.0.0", + "v8-to-istanbul": "^8.1.0" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/@jest/source-map": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-27.5.1.tgz", + "integrity": "sha512-y9NIHUYF3PJRlHk98NdC/N1gl88BL08aQQgu4k4ZopQkCw9t9cV8mtl3TV8b/YCB8XaVTFrmUTAJvjsntDireg==", + "dev": true, + "license": "MIT", + "dependencies": { + "callsites": "^3.0.0", + "graceful-fs": "^4.2.9", + "source-map": "^0.6.0" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/@jest/test-result": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-27.5.1.tgz", + "integrity": "sha512-EW35l2RYFUcUQxFJz5Cv5MTOxlJIQs4I7gxzi2zVU7PJhOwfYq1MdC5nhSmYjX1gmMmLPvB3sIaC+BkcHRBfag==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/console": "^27.5.1", + "@jest/types": "^27.5.1", + "@types/istanbul-lib-coverage": "^2.0.0", + "collect-v8-coverage": "^1.0.0" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/@jest/test-sequencer": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-27.5.1.tgz", + "integrity": "sha512-LCheJF7WB2+9JuCS7VB/EmGIdQuhtqjRNI9A43idHv3E4KltCTsPsLxvdaubFHSYwY/fNjMWjl6vNRhDiN7vpQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/test-result": "^27.5.1", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^27.5.1", + "jest-runtime": "^27.5.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/@jest/transform": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-27.5.1.tgz", + "integrity": "sha512-ipON6WtYgl/1329g5AIJVbUuEh0wZVbdpGwC99Jw4LwuoBNS95MVphU6zOeD9pDkon+LLbFL7lOQRapbB8SCHw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.1.0", + "@jest/types": "^27.5.1", + "babel-plugin-istanbul": "^6.1.1", + "chalk": "^4.0.0", + "convert-source-map": "^1.4.0", + "fast-json-stable-stringify": "^2.0.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^27.5.1", + "jest-regex-util": "^27.5.1", + "jest-util": "^27.5.1", + "micromatch": "^4.0.4", + "pirates": "^4.0.4", + "slash": "^3.0.0", + "source-map": "^0.6.1", + "write-file-atomic": "^3.0.0" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/@jest/types": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-27.5.1.tgz", + "integrity": "sha512-Cx46iJ9QpwQTjIdq5VJu2QTMMs3QlEjI0x1QbBP5W1+nMzyc2XmimiRR/CbX9TO0cPTeUlxWMOu8mslYsJ8DEw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^16.0.0", + "chalk": "^4.0.0" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", + "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/set-array": "^1.2.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.25", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@mapbox/node-pre-gyp": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.11.tgz", + "integrity": "sha512-Yhlar6v9WQgUp/He7BdgzOz8lqMQ8sU+jkCq7Wx8Myc5YFJLbEe7lgui/V7G1qB1DJykHSGwreceSaD60Y0PUQ==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "detect-libc": "^2.0.0", + "https-proxy-agent": "^5.0.0", + "make-dir": "^3.1.0", + "node-fetch": "^2.6.7", + "nopt": "^5.0.0", + "npmlog": "^5.0.1", + "rimraf": "^3.0.2", + "semver": "^7.3.5", + "tar": "^6.1.11" + }, + "bin": { + "node-pre-gyp": "bin/node-pre-gyp" + } + }, + "node_modules/@phc/format": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@phc/format/-/format-1.0.0.tgz", + "integrity": "sha512-m7X9U6BG2+J+R1lSOdCiITLLrxm+cWlNI3HUFA92oLO77ObGNzaKdh8pMLqdZcshtkKuV84olNNXDfMc4FezBQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/@playwright/test": { + "version": "1.56.1", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.56.1.tgz", + "integrity": "sha512-vSMYtL/zOcFpvJCW71Q/OEGQb7KYBPAdKh35WNSkaZA75JlAO8ED8UN6GUNTm3drWomcbcqRPFqQbLae8yBTdg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "playwright": "1.56.1" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@sinonjs/commons": { + "version": "1.8.6", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.6.tgz", + "integrity": "sha512-Ky+XkAkqPZSm3NLBeUng77EBQl3cmeJhITaGHdYH8kjVB+aun3S4XBRti2zt17mtt0mIUDiNxYeoJm6drVvBJQ==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "type-detect": "4.0.8" + } + }, + "node_modules/@sinonjs/fake-timers": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-8.1.0.tgz", + "integrity": "sha512-OAPJUAtgeINhh/TAlUID4QTs53Njm7xzddaVlEs/SXwgtiD1tW22zAB/W1wdqfrpmikgaWQ9Fw6Ws+hsiRm5Vg==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@sinonjs/commons": "^1.7.0" + } + }, + "node_modules/@tootallnate/once": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", + "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/@types/babel__core": { + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", + "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } + }, + "node_modules/@types/babel__generator": { + "version": "7.6.8", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.8.tgz", + "integrity": "sha512-ASsj+tpEDsEiFr1arWrlN6V3mdfjRMZt6LtK/Vp/kreFLnr5QH5+DhvD5nINYZXzwJvXeGq+05iUXcAzVrqWtw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__template": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", + "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__traverse": { + "version": "7.20.6", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.6.tgz", + "integrity": "sha512-r1bzfrm0tomOI8g1SzvCaQHo6Lcv6zu0EA+W2kHrt8dyrHQxGzBBL4kdkzIS+jBMV+EYcMAEAqXqYaLJq5rOZg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.20.7" + } + }, + "node_modules/@types/graceful-fs": { + "version": "4.1.9", + "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz", + "integrity": "sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/istanbul-lib-coverage": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", + "integrity": "sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/istanbul-lib-report": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.3.tgz", + "integrity": "sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/istanbul-lib-coverage": "*" + } + }, + "node_modules/@types/istanbul-reports": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz", + "integrity": "sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/istanbul-lib-report": "*" + } + }, + "node_modules/@types/jest": { + "version": "27.5.2", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-27.5.2.tgz", + "integrity": "sha512-mpT8LJJ4CMeeahobofYWIjFo0xonRS/HfxnVEPMPFSQdGUt1uHCnoPT7Zhb+sjDU2wz0oKV0OLUR0WzrHNgfeA==", + "dev": true, + "license": "MIT", + "dependencies": { + "jest-matcher-utils": "^27.0.0", + "pretty-format": "^27.0.0" + } + }, + "node_modules/@types/jsdom": { + "version": "16.2.15", + "resolved": "https://registry.npmjs.org/@types/jsdom/-/jsdom-16.2.15.tgz", + "integrity": "sha512-nwF87yjBKuX/roqGYerZZM0Nv1pZDMAT5YhOHYeM/72Fic+VEqJh4nyoqoapzJnW3pUlfxPY5FhgsJtM+dRnQQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "@types/parse5": "^6.0.3", + "@types/tough-cookie": "*" + } + }, + "node_modules/@types/node": { + "version": "22.7.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.7.4.tgz", + "integrity": "sha512-y+NPi1rFzDs1NdQHHToqeiX2TIS79SWEAw9GYhkkx8bD0ChpfqC+n2j5OXOCpzfojBEBt6DnEnnG9MY0zk1XLg==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.19.2" + } + }, + "node_modules/@types/node-fetch": { + "version": "2.6.11", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.11.tgz", + "integrity": "sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "form-data": "^4.0.0" + } + }, + "node_modules/@types/parse5": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/@types/parse5/-/parse5-6.0.3.tgz", + "integrity": "sha512-SuT16Q1K51EAVPz1K29DJ/sXjhSQ0zjvsypYJ6tlwVsRV9jwW5Adq2ch8Dq8kDBCkYnELS7N7VNCSB5nC56t/g==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/prettier": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.3.tgz", + "integrity": "sha512-+68kP9yzs4LMp7VNh8gdzMSPZFL44MLGqiHWvttYJe+6qnuVr4Ek9wSBQoveqY/r+LwjCcU29kNVkidwim+kYA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/stack-utils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz", + "integrity": "sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/tough-cookie": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.5.tgz", + "integrity": "sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/wtfnode": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/@types/wtfnode/-/wtfnode-0.7.3.tgz", + "integrity": "sha512-UMkHpx+o2xRWLJ7PmT3bBzvIA9/0oFw80oPtY/xO4jfdq+Gznn4wP7K9B/JjMxyxy+wF+5oRPIykxeBbEDjwRg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/yargs": { + "version": "16.0.9", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.9.tgz", + "integrity": "sha512-tHhzvkFXZQeTECenFoRljLBYPZJ7jAVxqqtEI0qTLOmuultnFp4I9yKE17vTuhf7BkhCu7I4XuemPgikDVuYqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/yargs-parser": "*" + } + }, + "node_modules/@types/yargs-parser": { + "version": "21.0.3", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.3.tgz", + "integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/yauzl": { + "version": "2.10.3", + "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.3.tgz", + "integrity": "sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/abab": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz", + "integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==", + "deprecated": "Use your platform's native atob() and btoa() methods instead", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "dev": true, + "license": "ISC" + }, + "node_modules/acorn": { + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", + "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-globals": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-6.0.0.tgz", + "integrity": "sha512-ZQl7LOWaF5ePqqcX4hLuv/bLXYQNfNWw2c0/yX/TsPRKamzHcTGQnlCjHT3TsmkOUVEPS3crCxiPfdzE/Trlhg==", + "dev": true, + "license": "MIT", + "dependencies": { + "acorn": "^7.1.1", + "acorn-walk": "^7.1.1" + } + }, + "node_modules/acorn-globals/node_modules/acorn": { + "version": "7.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", + "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-walk": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-7.2.0.tgz", + "integrity": "sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "type-fest": "^0.21.3" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/aproba": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz", + "integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/are-we-there-yet": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-2.0.0.tgz", + "integrity": "sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==", + "deprecated": "This package is no longer supported.", + "dev": true, + "license": "ISC", + "dependencies": { + "delegates": "^1.0.0", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/argon2": { + "version": "0.28.7", + "resolved": "https://registry.npmjs.org/argon2/-/argon2-0.28.7.tgz", + "integrity": "sha512-pvsScM3Fq7b+jolXkZHh8nRQx0uD/WeelnwYPMRpn4pAydoa1gqeL/KRdWAag4Hnu1TJNBTAfqyTjV+ZHwNnYA==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "@mapbox/node-pre-gyp": "^1.0.9", + "@phc/format": "^1.0.0", + "node-addon-api": "^5.0.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "license": "MIT", + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/babel-jest": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-27.5.1.tgz", + "integrity": "sha512-cdQ5dXjGRd0IBRATiQ4mZGlGlRE8kJpjPOixdNRdT+m3UcNqmYWN6rK6nvtXYfY3D76cb8s/O1Ss8ea24PIwcg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/transform": "^27.5.1", + "@jest/types": "^27.5.1", + "@types/babel__core": "^7.1.14", + "babel-plugin-istanbul": "^6.1.1", + "babel-preset-jest": "^27.5.1", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "slash": "^3.0.0" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + }, + "peerDependencies": { + "@babel/core": "^7.8.0" + } + }, + "node_modules/babel-plugin-istanbul": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz", + "integrity": "sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@babel/helper-plugin-utils": "^7.0.0", + "@istanbuljs/load-nyc-config": "^1.0.0", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-instrument": "^5.0.4", + "test-exclude": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/babel-plugin-jest-hoist": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-27.5.1.tgz", + "integrity": "sha512-50wCwD5EMNW4aRpOwtqzyZHIewTYNxLA4nhB+09d8BIssfNfzBRhkBIHiaPv1Si226TQSvp8gxAJm2iY2qs2hQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/template": "^7.3.3", + "@babel/types": "^7.3.3", + "@types/babel__core": "^7.0.0", + "@types/babel__traverse": "^7.0.6" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/babel-preset-current-node-syntax": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.1.0.tgz", + "integrity": "sha512-ldYss8SbBlWva1bs28q78Ju5Zq1F+8BrqBZZ0VFhLBvhh6lCpC2o3gDJi/5DRLs9FgYZCnmPYIVFU4lRXCkyUw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/plugin-syntax-async-generators": "^7.8.4", + "@babel/plugin-syntax-bigint": "^7.8.3", + "@babel/plugin-syntax-class-properties": "^7.12.13", + "@babel/plugin-syntax-class-static-block": "^7.14.5", + "@babel/plugin-syntax-import-attributes": "^7.24.7", + "@babel/plugin-syntax-import-meta": "^7.10.4", + "@babel/plugin-syntax-json-strings": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.10.4", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", + "@babel/plugin-syntax-optional-chaining": "^7.8.3", + "@babel/plugin-syntax-private-property-in-object": "^7.14.5", + "@babel/plugin-syntax-top-level-await": "^7.14.5" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/babel-preset-jest": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-27.5.1.tgz", + "integrity": "sha512-Nptf2FzlPCWYuJg41HBqXVT8ym6bXOevuCTbhxlUpjwtysGaIWFvDEjp4y+G7fl13FgOdjs7P/DmErqH7da0Ag==", + "dev": true, + "license": "MIT", + "dependencies": { + "babel-plugin-jest-hoist": "^27.5.1", + "babel-preset-current-node-syntax": "^1.0.0" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browser-process-hrtime": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz", + "integrity": "sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow==", + "dev": true, + "license": "BSD-2-Clause" + }, + "node_modules/browserslist": { + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.0.tgz", + "integrity": "sha512-Rmb62sR1Zpjql25eSanFGEhAxcFwfA1K0GuQcLoaJBAcENegrQut3hYdhXFF1obQfiDyqIW/cLM5HSJ/9k884A==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "caniuse-lite": "^1.0.30001663", + "electron-to-chromium": "^1.5.28", + "node-releases": "^2.0.18", + "update-browserslist-db": "^1.1.0" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/bs-logger": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz", + "integrity": "sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-json-stable-stringify": "2.x" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/bser": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", + "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "node-int64": "^0.4.0" + } + }, + "node_modules/buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001667", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001667.tgz", + "integrity": "sha512-7LTwJjcRkzKFmtqGsibMeuXmvFDfZq/nzIjnmgCGzKKRVzjD72selLDK1oPF/Oxzmt4fNcPvTDvGqSDG4tCALw==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "CC-BY-4.0" + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/char-regex": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz", + "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/chownr": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", + "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/ci-info": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", + "integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/cjs-module-lexer": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.4.1.tgz", + "integrity": "sha512-cuSVIHi9/9E/+821Qjdvngor+xpnlwnuwIyZOaLmHBVdXL+gP+I6QQB9VkO7RI77YIcTV+S1W9AreJ5eN63JBA==", + "dev": true, + "license": "MIT" + }, + "node_modules/cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "node_modules/co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==", + "dev": true, + "license": "MIT", + "engines": { + "iojs": ">= 1.0.0", + "node": ">= 0.12.0" + } + }, + "node_modules/collect-v8-coverage": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.2.tgz", + "integrity": "sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "license": "MIT" + }, + "node_modules/color-support": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", + "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", + "dev": true, + "license": "ISC", + "bin": { + "color-support": "bin.js" + } + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "license": "MIT", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true, + "license": "MIT" + }, + "node_modules/console-control-strings": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", + "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/convert-source-map": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", + "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", + "dev": true, + "license": "MIT" + }, + "node_modules/cross-fetch": { + "version": "3.1.8", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.8.tgz", + "integrity": "sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg==", + "dev": true, + "license": "MIT", + "dependencies": { + "node-fetch": "^2.6.12" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/cssom": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.4.4.tgz", + "integrity": "sha512-p3pvU7r1MyyqbTk+WbNJIgJjG2VmTIaB10rI93LzVPrmDJKkzKYMtxxyAvQXR/NS6otuzveI7+7BBq3SjBS2mw==", + "dev": true, + "license": "MIT" + }, + "node_modules/cssstyle": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.3.0.tgz", + "integrity": "sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==", + "dev": true, + "license": "MIT", + "dependencies": { + "cssom": "~0.3.6" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cssstyle/node_modules/cssom": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", + "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==", + "dev": true, + "license": "MIT" + }, + "node_modules/data-urls": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-2.0.0.tgz", + "integrity": "sha512-X5eWTSXO/BJmpdIKCRuKUgSCgAN0OwliVK3yPKbwIWU1Tdw5BRajxlzMidvh+gwko9AfQ9zIj52pzF91Q3YAvQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "abab": "^2.0.3", + "whatwg-mimetype": "^2.3.0", + "whatwg-url": "^8.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/debug": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decimal.js": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz", + "integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==", + "dev": true, + "license": "MIT" + }, + "node_modules/dedent": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz", + "integrity": "sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA==", + "dev": true, + "license": "MIT" + }, + "node_modules/deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/delegates": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/detect-libc": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.3.tgz", + "integrity": "sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/detect-newline": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", + "integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/diff-sequences": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-27.5.1.tgz", + "integrity": "sha512-k1gCAXAsNgLwEL+Y8Wvl+M6oEFj5bgazfZULpS5CneoPPXRaCCW7dm+q21Ky2VEE5X+VeRDBVg1Pcvvsr4TtNQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/domexception": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/domexception/-/domexception-2.0.1.tgz", + "integrity": "sha512-yxJ2mFy/sibVQlu5qHjOkf9J3K6zgmCxgJ94u2EdvDOV09H+32LtRswEcUsmUWN72pVLOEnTSRaIVVzVQgS0dg==", + "deprecated": "Use your platform's native DOMException instead", + "dev": true, + "license": "MIT", + "dependencies": { + "webidl-conversions": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/domexception/node_modules/webidl-conversions": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-5.0.0.tgz", + "integrity": "sha512-VlZwKPCkYKxQgeSbH5EyngOmRp7Ww7I9rQLERETtf5ofd9pGeswWiOtogpEO850jziPRarreGxn5QIiTqpb2wA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=8" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/electron-to-chromium": { + "version": "1.5.32", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.32.tgz", + "integrity": "sha512-M+7ph0VGBQqqpTT2YrabjNKSQ2fEl9PVx6AK3N558gDH9NO8O6XN9SXXFWRo9u9PbEg/bWq+tjXQr+eXmxubCw==", + "dev": true, + "license": "ISC" + }, + "node_modules/emittery": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.8.1.tgz", + "integrity": "sha512-uDfvUjVrfGJJhymx/kz6prltenw1u7WrCg1oa94zYY8xxVpLLUu045LAT0dhDZdXG58/EpPL/5kA180fQ/qudg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/emittery?sponsor=1" + } + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/escodegen": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.1.0.tgz", + "integrity": "sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "esprima": "^4.0.1", + "estraverse": "^5.2.0", + "esutils": "^2.0.2" + }, + "bin": { + "escodegen": "bin/escodegen.js", + "esgenerate": "bin/esgenerate.js" + }, + "engines": { + "node": ">=6.0" + }, + "optionalDependencies": { + "source-map": "~0.6.1" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true, + "license": "BSD-2-Clause", + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "dev": true, + "license": "MIT", + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/execa/node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/expect": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/expect/-/expect-27.5.1.tgz", + "integrity": "sha512-E1q5hSUG2AmYQwQJ041nvgpkODHQvB+RKlB4IYdru6uJsyFTRyZAP463M+1lINorwbqAmUggi6+WwkD8lCS/Dw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^27.5.1", + "jest-get-type": "^27.5.1", + "jest-matcher-utils": "^27.5.1", + "jest-message-util": "^27.5.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/extract-zip": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", + "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "debug": "^4.1.1", + "get-stream": "^5.1.0", + "yauzl": "^2.10.0" + }, + "bin": { + "extract-zip": "cli.js" + }, + "engines": { + "node": ">= 10.17.0" + }, + "optionalDependencies": { + "@types/yauzl": "^2.9.1" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fb-watchman": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", + "integrity": "sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "bser": "2.1.1" + } + }, + "node_modules/fd-slicer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "pend": "~1.2.0" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/form-data": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.4.tgz", + "integrity": "sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow==", + "dev": true, + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "es-set-tostringtag": "^2.1.0", + "hasown": "^2.0.2", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fs-minipass": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "dev": true, + "license": "ISC", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/fs-minipass/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fs-minipass/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true, + "license": "ISC" + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true, + "license": "ISC" + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gauge": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-3.0.2.tgz", + "integrity": "sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==", + "deprecated": "This package is no longer supported.", + "dev": true, + "license": "ISC", + "dependencies": { + "aproba": "^1.0.3 || ^2.0.0", + "color-support": "^1.1.2", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.1", + "object-assign": "^4.1.1", + "signal-exit": "^3.0.0", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1", + "wide-align": "^1.1.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-package-type": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", + "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dev": true, + "license": "MIT", + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-unicode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/html-encoding-sniffer": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-2.0.1.tgz", + "integrity": "sha512-D5JbOMBIR/TVZkubHT+OyT2705QvogUW4IBn6nHd756OwieSF9aDYFj4dv6HHEVGYbHaLETa3WggZYWWMyy3ZQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "whatwg-encoding": "^1.0.5" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true, + "license": "MIT" + }, + "node_modules/http-proxy-agent": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz", + "integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@tootallnate/once": "1", + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/human-signals": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=10.17.0" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/import-local": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.2.0.tgz", + "integrity": "sha512-2SPlun1JUPWoM6t3F0dw0FkCF/jWY8kttcY4f599GLTSjh2OCuuhdTkJQsEcZzBqbXZGKMK2OqW1oZsjtf/gQA==", + "dev": true, + "license": "MIT", + "dependencies": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + }, + "bin": { + "import-local-fixture": "fixtures/cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "dev": true, + "license": "ISC", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "dev": true, + "license": "MIT" + }, + "node_modules/is-core-module": { + "version": "2.15.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.15.1.tgz", + "integrity": "sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-generator-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz", + "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-potential-custom-element-name": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", + "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==", + "dev": true, + "license": "MIT" + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, + "license": "ISC" + }, + "node_modules/istanbul-lib-coverage": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", + "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-instrument": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz", + "integrity": "sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-instrument/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/istanbul-lib-report": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", + "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^4.0.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-report/node_modules/make-dir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", + "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/istanbul-lib-source-maps": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", + "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0", + "source-map": "^0.6.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-reports": { + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.7.tgz", + "integrity": "sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest/-/jest-27.5.1.tgz", + "integrity": "sha512-Yn0mADZB89zTtjkPJEXwrac3LHudkQMR+Paqa8uxJHCBr9agxztUifWCyiYrjhMPBoUVBjyny0I7XH6ozDr7QQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/core": "^27.5.1", + "import-local": "^3.0.2", + "jest-cli": "^27.5.1" + }, + "bin": { + "jest": "bin/jest.js" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/jest-changed-files": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-27.5.1.tgz", + "integrity": "sha512-buBLMiByfWGCoMsLLzGUUSpAmIAGnbR2KJoMN10ziLhOLvP4e0SlypHnAel8iqQXTrcbmfEY9sSqae5sgUsTvw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^27.5.1", + "execa": "^5.0.0", + "throat": "^6.0.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/jest-circus": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-27.5.1.tgz", + "integrity": "sha512-D95R7x5UtlMA5iBYsOHFFbMD/GVA4R/Kdq15f7xYWUfWHBto9NYRsOvnSauTgdF+ogCpJ4tyKOXhUifxS65gdw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/environment": "^27.5.1", + "@jest/test-result": "^27.5.1", + "@jest/types": "^27.5.1", + "@types/node": "*", + "chalk": "^4.0.0", + "co": "^4.6.0", + "dedent": "^0.7.0", + "expect": "^27.5.1", + "is-generator-fn": "^2.0.0", + "jest-each": "^27.5.1", + "jest-matcher-utils": "^27.5.1", + "jest-message-util": "^27.5.1", + "jest-runtime": "^27.5.1", + "jest-snapshot": "^27.5.1", + "jest-util": "^27.5.1", + "pretty-format": "^27.5.1", + "slash": "^3.0.0", + "stack-utils": "^2.0.3", + "throat": "^6.0.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/jest-cli": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-27.5.1.tgz", + "integrity": "sha512-Hc6HOOwYq4/74/c62dEE3r5elx8wjYqxY0r0G/nFrLDPMFRu6RA/u8qINOIkvhxG7mMQ5EJsOGfRpI8L6eFUVw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/core": "^27.5.1", + "@jest/test-result": "^27.5.1", + "@jest/types": "^27.5.1", + "chalk": "^4.0.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "import-local": "^3.0.2", + "jest-config": "^27.5.1", + "jest-util": "^27.5.1", + "jest-validate": "^27.5.1", + "prompts": "^2.0.1", + "yargs": "^16.2.0" + }, + "bin": { + "jest": "bin/jest.js" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/jest-config": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-27.5.1.tgz", + "integrity": "sha512-5sAsjm6tGdsVbW9ahcChPAFCk4IlkQUknH5AvKjuLTSlcO/wCZKyFdn7Rg0EkC+OGgWODEy2hDpWB1PgzH0JNA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.8.0", + "@jest/test-sequencer": "^27.5.1", + "@jest/types": "^27.5.1", + "babel-jest": "^27.5.1", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "deepmerge": "^4.2.2", + "glob": "^7.1.1", + "graceful-fs": "^4.2.9", + "jest-circus": "^27.5.1", + "jest-environment-jsdom": "^27.5.1", + "jest-environment-node": "^27.5.1", + "jest-get-type": "^27.5.1", + "jest-jasmine2": "^27.5.1", + "jest-regex-util": "^27.5.1", + "jest-resolve": "^27.5.1", + "jest-runner": "^27.5.1", + "jest-util": "^27.5.1", + "jest-validate": "^27.5.1", + "micromatch": "^4.0.4", + "parse-json": "^5.2.0", + "pretty-format": "^27.5.1", + "slash": "^3.0.0", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + }, + "peerDependencies": { + "ts-node": ">=9.0.0" + }, + "peerDependenciesMeta": { + "ts-node": { + "optional": true + } + } + }, + "node_modules/jest-diff": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-27.5.1.tgz", + "integrity": "sha512-m0NvkX55LDt9T4mctTEgnZk3fmEg3NRYutvMPWM/0iPnkFj2wIeF45O1718cMSOFO1vINkqmxqD8vE37uTEbqw==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.0.0", + "diff-sequences": "^27.5.1", + "jest-get-type": "^27.5.1", + "pretty-format": "^27.5.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/jest-docblock": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-27.5.1.tgz", + "integrity": "sha512-rl7hlABeTsRYxKiUfpHrQrG4e2obOiTQWfMEH3PxPjOtdsfLQO4ReWSZaQ7DETm4xu07rl4q/h4zcKXyU0/OzQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "detect-newline": "^3.0.0" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/jest-each": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-27.5.1.tgz", + "integrity": "sha512-1Ff6p+FbhT/bXQnEouYy00bkNSY7OUpfIcmdl8vZ31A1UUaurOLPA8a8BbJOF2RDUElwJhmeaV7LnagI+5UwNQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^27.5.1", + "chalk": "^4.0.0", + "jest-get-type": "^27.5.1", + "jest-util": "^27.5.1", + "pretty-format": "^27.5.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/jest-environment-jsdom": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-27.5.1.tgz", + "integrity": "sha512-TFBvkTC1Hnnnrka/fUb56atfDtJ9VMZ94JkjTbggl1PEpwrYtUBKMezB3inLmWqQsXYLcMwNoDQwoBTAvFfsfw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/environment": "^27.5.1", + "@jest/fake-timers": "^27.5.1", + "@jest/types": "^27.5.1", + "@types/node": "*", + "jest-mock": "^27.5.1", + "jest-util": "^27.5.1", + "jsdom": "^16.6.0" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/jest-environment-node": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-27.5.1.tgz", + "integrity": "sha512-Jt4ZUnxdOsTGwSRAfKEnE6BcwsSPNOijjwifq5sDFSA2kesnXTvNqKHYgM0hDq3549Uf/KzdXNYn4wMZJPlFLw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/environment": "^27.5.1", + "@jest/fake-timers": "^27.5.1", + "@jest/types": "^27.5.1", + "@types/node": "*", + "jest-mock": "^27.5.1", + "jest-util": "^27.5.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/jest-fetch-mock": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/jest-fetch-mock/-/jest-fetch-mock-3.0.3.tgz", + "integrity": "sha512-Ux1nWprtLrdrH4XwE7O7InRY6psIi3GOsqNESJgMJ+M5cv4A8Lh7SN9d2V2kKRZ8ebAfcd1LNyZguAOb6JiDqw==", + "dev": true, + "license": "MIT", + "dependencies": { + "cross-fetch": "^3.0.4", + "promise-polyfill": "^8.1.3" + } + }, + "node_modules/jest-get-type": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-27.5.1.tgz", + "integrity": "sha512-2KY95ksYSaK7DMBWQn6dQz3kqAf3BB64y2udeG+hv4KfSOb9qwcYQstTJc1KCbsix+wLZWZYN8t7nwX3GOBLRw==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/jest-haste-map": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-27.5.1.tgz", + "integrity": "sha512-7GgkZ4Fw4NFbMSDSpZwXeBiIbx+t/46nJ2QitkOjvwPYyZmqttu2TDSimMHP1EkPOi4xUZAN1doE5Vd25H4Jng==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^27.5.1", + "@types/graceful-fs": "^4.1.2", + "@types/node": "*", + "anymatch": "^3.0.3", + "fb-watchman": "^2.0.0", + "graceful-fs": "^4.2.9", + "jest-regex-util": "^27.5.1", + "jest-serializer": "^27.5.1", + "jest-util": "^27.5.1", + "jest-worker": "^27.5.1", + "micromatch": "^4.0.4", + "walker": "^1.0.7" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + }, + "optionalDependencies": { + "fsevents": "^2.3.2" + } + }, + "node_modules/jest-jasmine2": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-27.5.1.tgz", + "integrity": "sha512-jtq7VVyG8SqAorDpApwiJJImd0V2wv1xzdheGHRGyuT7gZm6gG47QEskOlzsN1PG/6WNaCo5pmwMHDf3AkG2pQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/environment": "^27.5.1", + "@jest/source-map": "^27.5.1", + "@jest/test-result": "^27.5.1", + "@jest/types": "^27.5.1", + "@types/node": "*", + "chalk": "^4.0.0", + "co": "^4.6.0", + "expect": "^27.5.1", + "is-generator-fn": "^2.0.0", + "jest-each": "^27.5.1", + "jest-matcher-utils": "^27.5.1", + "jest-message-util": "^27.5.1", + "jest-runtime": "^27.5.1", + "jest-snapshot": "^27.5.1", + "jest-util": "^27.5.1", + "pretty-format": "^27.5.1", + "throat": "^6.0.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/jest-leak-detector": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-27.5.1.tgz", + "integrity": "sha512-POXfWAMvfU6WMUXftV4HolnJfnPOGEu10fscNCA76KBpRRhcMN2c8d3iT2pxQS3HLbA+5X4sOUPzYO2NUyIlHQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "jest-get-type": "^27.5.1", + "pretty-format": "^27.5.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/jest-matcher-utils": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-27.5.1.tgz", + "integrity": "sha512-z2uTx/T6LBaCoNWNFWwChLBKYxTMcGBRjAt+2SbP929/Fflb9aa5LGma654Rz8z9HLxsrUaYzxE9T/EFIL/PAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.0.0", + "jest-diff": "^27.5.1", + "jest-get-type": "^27.5.1", + "pretty-format": "^27.5.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/jest-message-util": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-27.5.1.tgz", + "integrity": "sha512-rMyFe1+jnyAAf+NHwTclDz0eAaLkVDdKVHHBFWsBWHnnh5YeJMNWWsv7AbFYXfK3oTqvL7VTWkhNLu1jX24D+g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.12.13", + "@jest/types": "^27.5.1", + "@types/stack-utils": "^2.0.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "micromatch": "^4.0.4", + "pretty-format": "^27.5.1", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/jest-mock": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-27.5.1.tgz", + "integrity": "sha512-K4jKbY1d4ENhbrG2zuPWaQBvDly+iZ2yAW+T1fATN78hc0sInwn7wZB8XtlNnvHug5RMwV897Xm4LqmPM4e2Og==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^27.5.1", + "@types/node": "*" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/jest-pnp-resolver": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz", + "integrity": "sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + }, + "peerDependencies": { + "jest-resolve": "*" + }, + "peerDependenciesMeta": { + "jest-resolve": { + "optional": true + } + } + }, + "node_modules/jest-regex-util": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-27.5.1.tgz", + "integrity": "sha512-4bfKq2zie+x16okqDXjXn9ql2B0dScQu+vcwe4TvFVhkVyuWLqpZrZtXxLLWoXYgn0E87I6r6GRYHF7wFZBUvg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/jest-resolve": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-27.5.1.tgz", + "integrity": "sha512-FFDy8/9E6CV83IMbDpcjOhumAQPDyETnU2KZ1O98DwTnz8AOBsW/Xv3GySr1mOZdItLR+zDZ7I/UdTFbgSOVCw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^27.5.1", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^27.5.1", + "jest-pnp-resolver": "^1.2.2", + "jest-util": "^27.5.1", + "jest-validate": "^27.5.1", + "resolve": "^1.20.0", + "resolve.exports": "^1.1.0", + "slash": "^3.0.0" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/jest-resolve-dependencies": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-27.5.1.tgz", + "integrity": "sha512-QQOOdY4PE39iawDn5rzbIePNigfe5B9Z91GDD1ae/xNDlu9kaat8QQ5EKnNmVWPV54hUdxCVwwj6YMgR2O7IOg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^27.5.1", + "jest-regex-util": "^27.5.1", + "jest-snapshot": "^27.5.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/jest-runner": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-27.5.1.tgz", + "integrity": "sha512-g4NPsM4mFCOwFKXO4p/H/kWGdJp9V8kURY2lX8Me2drgXqG7rrZAx5kv+5H7wtt/cdFIjhqYx1HrlqWHaOvDaQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/console": "^27.5.1", + "@jest/environment": "^27.5.1", + "@jest/test-result": "^27.5.1", + "@jest/transform": "^27.5.1", + "@jest/types": "^27.5.1", + "@types/node": "*", + "chalk": "^4.0.0", + "emittery": "^0.8.1", + "graceful-fs": "^4.2.9", + "jest-docblock": "^27.5.1", + "jest-environment-jsdom": "^27.5.1", + "jest-environment-node": "^27.5.1", + "jest-haste-map": "^27.5.1", + "jest-leak-detector": "^27.5.1", + "jest-message-util": "^27.5.1", + "jest-resolve": "^27.5.1", + "jest-runtime": "^27.5.1", + "jest-util": "^27.5.1", + "jest-worker": "^27.5.1", + "source-map-support": "^0.5.6", + "throat": "^6.0.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/jest-runtime": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-27.5.1.tgz", + "integrity": "sha512-o7gxw3Gf+H2IGt8fv0RiyE1+r83FJBRruoA+FXrlHw6xEyBsU8ugA6IPfTdVyA0w8HClpbK+DGJxH59UrNMx8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/environment": "^27.5.1", + "@jest/fake-timers": "^27.5.1", + "@jest/globals": "^27.5.1", + "@jest/source-map": "^27.5.1", + "@jest/test-result": "^27.5.1", + "@jest/transform": "^27.5.1", + "@jest/types": "^27.5.1", + "chalk": "^4.0.0", + "cjs-module-lexer": "^1.0.0", + "collect-v8-coverage": "^1.0.0", + "execa": "^5.0.0", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^27.5.1", + "jest-message-util": "^27.5.1", + "jest-mock": "^27.5.1", + "jest-regex-util": "^27.5.1", + "jest-resolve": "^27.5.1", + "jest-snapshot": "^27.5.1", + "jest-util": "^27.5.1", + "slash": "^3.0.0", + "strip-bom": "^4.0.0" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/jest-serializer": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-serializer/-/jest-serializer-27.5.1.tgz", + "integrity": "sha512-jZCyo6iIxO1aqUxpuBlwTDMkzOAJS4a3eYz3YzgxxVQFwLeSA7Jfq5cbqCY+JLvTDrWirgusI/0KwxKMgrdf7w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "graceful-fs": "^4.2.9" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/jest-snapshot": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-27.5.1.tgz", + "integrity": "sha512-yYykXI5a0I31xX67mgeLw1DZ0bJB+gpq5IpSuCAoyDi0+BhgU/RIrL+RTzDmkNTchvDFWKP8lp+w/42Z3us5sA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.7.2", + "@babel/generator": "^7.7.2", + "@babel/plugin-syntax-typescript": "^7.7.2", + "@babel/traverse": "^7.7.2", + "@babel/types": "^7.0.0", + "@jest/transform": "^27.5.1", + "@jest/types": "^27.5.1", + "@types/babel__traverse": "^7.0.4", + "@types/prettier": "^2.1.5", + "babel-preset-current-node-syntax": "^1.0.0", + "chalk": "^4.0.0", + "expect": "^27.5.1", + "graceful-fs": "^4.2.9", + "jest-diff": "^27.5.1", + "jest-get-type": "^27.5.1", + "jest-haste-map": "^27.5.1", + "jest-matcher-utils": "^27.5.1", + "jest-message-util": "^27.5.1", + "jest-util": "^27.5.1", + "natural-compare": "^1.4.0", + "pretty-format": "^27.5.1", + "semver": "^7.3.2" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/jest-util": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-27.5.1.tgz", + "integrity": "sha512-Kv2o/8jNvX1MQ0KGtw480E/w4fBCDOnH6+6DmeKi6LZUIlKA5kwY0YNdlzaWTiVgxqAqik11QyxDOKk543aKXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^27.5.1", + "@types/node": "*", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "graceful-fs": "^4.2.9", + "picomatch": "^2.2.3" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/jest-validate": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-27.5.1.tgz", + "integrity": "sha512-thkNli0LYTmOI1tDB3FI1S1RTp/Bqyd9pTarJwL87OIBFuqEb5Apv5EaApEudYg4g86e3CT6kM0RowkhtEnCBQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^27.5.1", + "camelcase": "^6.2.0", + "chalk": "^4.0.0", + "jest-get-type": "^27.5.1", + "leven": "^3.1.0", + "pretty-format": "^27.5.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/jest-validate/node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/jest-watcher": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-27.5.1.tgz", + "integrity": "sha512-z676SuD6Z8o8qbmEGhoEUFOM1+jfEiL3DXHK/xgEiG2EyNYfFG60jluWcupY6dATjfEsKQuibReS1djInQnoVw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/test-result": "^27.5.1", + "@jest/types": "^27.5.1", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "jest-util": "^27.5.1", + "string-length": "^4.0.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/jest-worker": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz", + "integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + }, + "engines": { + "node": ">= 10.13.0" + } + }, + "node_modules/jest-worker/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/jsdom": { + "version": "16.7.0", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-16.7.0.tgz", + "integrity": "sha512-u9Smc2G1USStM+s/x1ru5Sxrl6mPYCbByG1U/hUmqaVsm4tbNyS7CicOSRyuGQYZhTu0h84qkZZQ/I+dzizSVw==", + "dev": true, + "license": "MIT", + "dependencies": { + "abab": "^2.0.5", + "acorn": "^8.2.4", + "acorn-globals": "^6.0.0", + "cssom": "^0.4.4", + "cssstyle": "^2.3.0", + "data-urls": "^2.0.0", + "decimal.js": "^10.2.1", + "domexception": "^2.0.1", + "escodegen": "^2.0.0", + "form-data": "^3.0.0", + "html-encoding-sniffer": "^2.0.1", + "http-proxy-agent": "^4.0.1", + "https-proxy-agent": "^5.0.0", + "is-potential-custom-element-name": "^1.0.1", + "nwsapi": "^2.2.0", + "parse5": "6.0.1", + "saxes": "^5.0.1", + "symbol-tree": "^3.2.4", + "tough-cookie": "^4.0.0", + "w3c-hr-time": "^1.0.2", + "w3c-xmlserializer": "^2.0.0", + "webidl-conversions": "^6.1.0", + "whatwg-encoding": "^1.0.5", + "whatwg-mimetype": "^2.3.0", + "whatwg-url": "^8.5.0", + "ws": "^7.4.6", + "xml-name-validator": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "canvas": "^2.5.0" + }, + "peerDependenciesMeta": { + "canvas": { + "optional": true + } + } + }, + "node_modules/jsdom/node_modules/form-data": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.4.tgz", + "integrity": "sha512-f0cRzm6dkyVYV3nPoooP8XlccPQukegwhAnpoLcXy+X+A8KfpGOoXwDr9FLZd3wzgLaBGQBE3lY93Zm/i1JvIQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "es-set-tostringtag": "^2.1.0", + "hasown": "^2.0.2", + "mime-types": "^2.1.35" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/jsesc": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.0.2.tgz", + "integrity": "sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g==", + "dev": true, + "license": "MIT", + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true, + "license": "MIT" + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true, + "license": "MIT", + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/kleur": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", + "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/leven": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", + "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true, + "license": "MIT" + }, + "node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.memoize": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", + "integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==", + "dev": true, + "license": "MIT" + }, + "node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/make-dir/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true, + "license": "ISC" + }, + "node_modules/makeerror": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", + "integrity": "sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "tmpl": "1.0.5" + } + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true, + "license": "MIT" + }, + "node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dev": true, + "license": "MIT", + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dev": true, + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minipass": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=8" + } + }, + "node_modules/minizlib": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", + "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", + "dev": true, + "license": "MIT", + "dependencies": { + "minipass": "^3.0.0", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/minizlib/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minizlib/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true, + "license": "ISC" + }, + "node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true, + "license": "MIT", + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true, + "license": "MIT" + }, + "node_modules/node-addon-api": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-5.1.0.tgz", + "integrity": "sha512-eh0GgfEkpnoWDq+VY8OyvYhFEzBk6jIYbRKdIlyTiAXIVJ8PyBaKb0rp7oDtoddbdoHWhq8wwr+XZ81F1rpNdA==", + "dev": true, + "license": "MIT" + }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/node-fetch/node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "dev": true, + "license": "MIT" + }, + "node_modules/node-fetch/node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "dev": true, + "license": "BSD-2-Clause" + }, + "node_modules/node-fetch/node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dev": true, + "license": "MIT", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/node-int64": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", + "integrity": "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==", + "dev": true, + "license": "MIT" + }, + "node_modules/node-releases": { + "version": "2.0.18", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.18.tgz", + "integrity": "sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==", + "dev": true, + "license": "MIT" + }, + "node_modules/nopt": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz", + "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "abbrev": "1" + }, + "bin": { + "nopt": "bin/nopt.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npmlog": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-5.0.1.tgz", + "integrity": "sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==", + "deprecated": "This package is no longer supported.", + "dev": true, + "license": "ISC", + "dependencies": { + "are-we-there-yet": "^2.0.0", + "console-control-strings": "^1.1.0", + "gauge": "^3.0.0", + "set-blocking": "^2.0.0" + } + }, + "node_modules/nwsapi": { + "version": "2.2.13", + "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.13.tgz", + "integrity": "sha512-cTGB9ptp9dY9A5VbMSe7fQBcl/tt22Vcqdq8+eN93rblOuE0aCFu4aZ2vMwct/2t+lFnosm8RkQW1I0Omb1UtQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/parse5": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz", + "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==", + "dev": true, + "license": "MIT" + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true, + "license": "MIT" + }, + "node_modules/pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", + "dev": true, + "license": "MIT" + }, + "node_modules/picocolors": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.0.tgz", + "integrity": "sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pirates": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz", + "integrity": "sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/playwright": { + "version": "1.56.1", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.56.1.tgz", + "integrity": "sha512-aFi5B0WovBHTEvpM3DzXTUaeN6eN0qWnTkKx4NQaH4Wvcmc153PdaY2UBdSYKaGYw+UyWXSVyxDUg5DoPEttjw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "playwright-core": "1.56.1" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "fsevents": "2.3.2" + } + }, + "node_modules/playwright-core": { + "version": "1.56.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.56.1.tgz", + "integrity": "sha512-hutraynyn31F+Bifme+Ps9Vq59hKuUCz7H1kDOcBs+2oGguKkWTU50bBWrtz34OUWmIwpBTWDxaRPXrIXkgvmQ==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "playwright-core": "cli.js" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/playwright/node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/pretty-format": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", + "integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1", + "ansi-styles": "^5.0.0", + "react-is": "^17.0.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/pretty-format/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/promise-polyfill": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/promise-polyfill/-/promise-polyfill-8.3.0.tgz", + "integrity": "sha512-H5oELycFml5yto/atYqmjyigJoAo3+OXwolYiH7OfQuYlAqhxNvTfiNMbV9hsC6Yp83yE5r2KTVmtrG6R9i6Pg==", + "dev": true, + "license": "MIT" + }, + "node_modules/prompts": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", + "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "kleur": "^3.0.3", + "sisteransi": "^1.0.5" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/psl": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", + "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==", + "dev": true, + "license": "MIT" + }, + "node_modules/pump": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.2.tgz", + "integrity": "sha512-tUPXtzlGM8FE3P0ZL6DVs/3P58k9nk8/jZeQCurTJylQA8qFYzHFfhBJkuqyE0FifOsQ0uKWekiZ5g8wtr28cw==", + "dev": true, + "license": "MIT", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/react-is": { + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", + "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", + "dev": true, + "license": "MIT" + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/resolve": { + "version": "1.22.8", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", + "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-cwd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", + "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve.exports": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-1.1.1.tgz", + "integrity": "sha512-/NtpHNDN7jWhAaQ9BvBUYZ6YTXsRBgfqWFWP7BZBaoMJO/I3G5OFzvTuWNlZC3aPjins1F+TNrLKsGbH4rfsRQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "dev": true, + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true, + "license": "MIT" + }, + "node_modules/saxes": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/saxes/-/saxes-5.0.1.tgz", + "integrity": "sha512-5LBh1Tls8c9xgGjw3QrMwETmTMVk0oFgvrFSvWx62llR2hcEInrKNZ2GZCCuuy2lvWrdl5jhbpeqc5hRYKFOcw==", + "dev": true, + "license": "ISC", + "dependencies": { + "xmlchars": "^2.2.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/semver": { + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", + "dev": true, + "license": "ISC" + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/sisteransi": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", + "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", + "dev": true, + "license": "MIT" + }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/stack-utils": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", + "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "escape-string-regexp": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string-length": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", + "integrity": "sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "char-regex": "^1.0.2", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-bom": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", + "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-hyperlinks": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-2.3.0.tgz", + "integrity": "sha512-RpsAZlpWcDwOPQA22aCH4J0t7L8JmAvsCxfOSEwm7cQs3LshN36QaTkwd70DnBOXDWGssw2eUoc8CaRWT0XunA==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0", + "supports-color": "^7.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/symbol-tree": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", + "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", + "dev": true, + "license": "MIT" + }, + "node_modules/tar": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz", + "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==", + "dev": true, + "license": "ISC", + "dependencies": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^5.0.0", + "minizlib": "^2.1.1", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/tar/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true, + "license": "ISC" + }, + "node_modules/terminal-link": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/terminal-link/-/terminal-link-2.1.1.tgz", + "integrity": "sha512-un0FmiRUQNr5PJqy9kP7c40F5BOfpGlYTrxonDChEZB7pzZxRNp/bt+ymiy9/npwXya9KH99nJ/GXFIiUkYGFQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-escapes": "^4.2.1", + "supports-hyperlinks": "^2.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/test-exclude": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", + "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", + "dev": true, + "license": "ISC", + "dependencies": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/throat": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/throat/-/throat-6.0.2.tgz", + "integrity": "sha512-WKexMoJj3vEuK0yFEapj8y64V0A6xcuPuK9Gt1d0R+dzCSJc0lHqQytAbSB4cDAK0dWh4T0E2ETkoLE2WZ41OQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/tmpl": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", + "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/tough-cookie": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.4.tgz", + "integrity": "sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.2.0", + "url-parse": "^1.5.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/tr46": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-2.1.0.tgz", + "integrity": "sha512-15Ih7phfcdP5YxqiB+iDtLoaTz4Nd35+IiAv0kQ5FNKHzXgdWqPoTIqEDDJmXceQt4JZk6lVPT8lnDlPpGDppw==", + "dev": true, + "license": "MIT", + "dependencies": { + "punycode": "^2.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ts-jest": { + "version": "27.1.5", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-27.1.5.tgz", + "integrity": "sha512-Xv6jBQPoBEvBq/5i2TeSG9tt/nqkbpcurrEG1b+2yfBrcJelOZF9Ml6dmyMh7bcW9JyFbRYpR5rxROSlBLTZHA==", + "dev": true, + "license": "MIT", + "dependencies": { + "bs-logger": "0.x", + "fast-json-stable-stringify": "2.x", + "jest-util": "^27.0.0", + "json5": "2.x", + "lodash.memoize": "4.x", + "make-error": "1.x", + "semver": "7.x", + "yargs-parser": "20.x" + }, + "bin": { + "ts-jest": "cli.js" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + }, + "peerDependencies": { + "@babel/core": ">=7.0.0-beta.0 <8", + "@types/jest": "^27.0.0", + "babel-jest": ">=27.0.0 <28", + "jest": "^27.0.0", + "typescript": ">=3.8 <5.0" + }, + "peerDependenciesMeta": { + "@babel/core": { + "optional": true + }, + "@types/jest": { + "optional": true + }, + "babel-jest": { + "optional": true + }, + "esbuild": { + "optional": true + } + } + }, + "node_modules/type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-typedarray": "^1.0.0" + } + }, + "node_modules/typescript": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "dev": true, + "license": "Apache-2.0", + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/undici-types": { + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", + "dev": true, + "license": "MIT" + }, + "node_modules/universalify": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", + "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/update-browserslist-db": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.1.tgz", + "integrity": "sha512-R8UzCaa9Az+38REPiJ1tXlImTJXlVfgHZsglwBD/k6nj76ctsH1E3q4doGrukiLQd3sGQYu56r5+lo5r94l29A==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "escalade": "^3.2.0", + "picocolors": "^1.1.0" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true, + "license": "MIT" + }, + "node_modules/v8-to-istanbul": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-8.1.1.tgz", + "integrity": "sha512-FGtKtv3xIpR6BYhvgH8MI/y78oT7d8Au3ww4QIxymrCtZEh5b8gCw2siywE+puhEmuWKDtmfrvF5UlB298ut3w==", + "dev": true, + "license": "ISC", + "dependencies": { + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^1.6.0", + "source-map": "^0.7.3" + }, + "engines": { + "node": ">=10.12.0" + } + }, + "node_modules/v8-to-istanbul/node_modules/source-map": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", + "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">= 8" + } + }, + "node_modules/w3c-hr-time": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz", + "integrity": "sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ==", + "deprecated": "Use your platform's native performance.now() and performance.timeOrigin.", + "dev": true, + "license": "MIT", + "dependencies": { + "browser-process-hrtime": "^1.0.0" + } + }, + "node_modules/w3c-xmlserializer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-2.0.0.tgz", + "integrity": "sha512-4tzD0mF8iSiMiNs30BiLO3EpfGLZUT2MSX/G+o7ZywDzliWQ3OPtTZ0PTC3B3ca1UAf4cJMHB+2Bf56EriJuRA==", + "dev": true, + "license": "MIT", + "dependencies": { + "xml-name-validator": "^3.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/walker": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", + "integrity": "sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "makeerror": "1.0.12" + } + }, + "node_modules/webidl-conversions": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-6.1.0.tgz", + "integrity": "sha512-qBIvFLGiBpLjfwmYAaHPXsn+ho5xZnGvyGvsarywGNc8VyQJUMHJ8OBKGGrPER0okBeMDaan4mNBlgBROxuI8w==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=10.4" + } + }, + "node_modules/whatwg-encoding": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz", + "integrity": "sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw==", + "dev": true, + "license": "MIT", + "dependencies": { + "iconv-lite": "0.4.24" + } + }, + "node_modules/whatwg-mimetype": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz", + "integrity": "sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g==", + "dev": true, + "license": "MIT" + }, + "node_modules/whatwg-url": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-8.7.0.tgz", + "integrity": "sha512-gAojqb/m9Q8a5IV96E3fHJM70AzCkgt4uXYX2O7EmuyOnLrViCQlsEBmF9UQIu3/aeAIp2U17rtbpZWNntQqdg==", + "dev": true, + "license": "MIT", + "dependencies": { + "lodash": "^4.7.0", + "tr46": "^2.1.0", + "webidl-conversions": "^6.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wide-align": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz", + "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^1.0.2 || 2 || 3 || 4" + } + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/write-file-atomic": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", + "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", + "dev": true, + "license": "ISC", + "dependencies": { + "imurmurhash": "^0.1.4", + "is-typedarray": "^1.0.0", + "signal-exit": "^3.0.2", + "typedarray-to-buffer": "^3.1.5" + } + }, + "node_modules/ws": { + "version": "7.5.10", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", + "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/wtfnode": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/wtfnode/-/wtfnode-0.9.3.tgz", + "integrity": "sha512-MXjgxJovNVYUkD85JBZTKT5S5ng/e56sNuRZlid7HcGTNrIODa5UPtqE3i0daj7fJ2SGj5Um2VmiphQVyVKK5A==", + "dev": true, + "license": "ISC", + "bin": { + "wtfnode": "proxy.js" + } + }, + "node_modules/xml-name-validator": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz", + "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/xmlchars": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", + "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", + "dev": true, + "license": "MIT" + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true, + "license": "ISC" + }, + "node_modules/yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, + "license": "MIT", + "dependencies": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs-parser": { + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/yauzl": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer-crc32": "~0.2.3", + "fd-slicer": "~1.1.0" + } + } + } +} diff --git a/test/package.json b/test/package.json new file mode 100644 index 000000000000..c8211337a79c --- /dev/null +++ b/test/package.json @@ -0,0 +1,29 @@ +{ + "license": "MIT", + "#": "We must put jest in a sub-directory otherwise VS Code somehow picks up the types and generates conflicts with mocha.", + "devDependencies": { + "@jest-mock/express": "^1.4.5", + "@playwright/test": "^1.56.1", + "@types/jest": "^27.0.2", + "@types/jsdom": "^16.2.13", + "@types/node-fetch": "^2.5.8", + "@types/wtfnode": "^0.7.0", + "argon2": "^0.28.0", + "extract-zip": "^2.0.1", + "jest": "^27.3.1", + "jest-fetch-mock": "^3.0.3", + "jsdom": "^16.4.0", + "node-fetch": "^2.6.7", + "playwright": "^1.56.1", + "ts-jest": "^27.0.7", + "wtfnode": "^0.9.1" + }, + "resolutions": { + "ansi-regex": "^5.0.1", + "argon2/@mapbox/node-pre-gyp/tar": "^6.1.9", + "set-value": "^4.0.1", + "tmpl": "^1.0.5", + "path-parse": "^1.0.7", + "json-schema": "^0.4.0" + } +} diff --git a/test/playwright.config.ts b/test/playwright.config.ts new file mode 100644 index 000000000000..3dea45370c58 --- /dev/null +++ b/test/playwright.config.ts @@ -0,0 +1,43 @@ +import { PlaywrightTestConfig } from "@playwright/test" + +import path from "path" + +// The default configuration runs all tests in three browsers with workers equal +// to half the available threads. See 'npm run test:e2e --help' to customize +// from the command line. For example: +// npm run test:e2e --workers 1 # Run with one worker +// npm run test:e2e --project Chromium # Only run on Chromium +// npm run test:e2e --grep login # Run tests matching "login" +// PWDEBUG=1 npm run test:e2e # Run Playwright inspector +const config: PlaywrightTestConfig = { + testDir: path.join(__dirname, "e2e"), // Search for tests in this directory. + timeout: 60000, // Each test is given 60 seconds. + retries: process.env.CI ? 2 : 1, // Retry in CI due to flakiness. + // Limit the number of failures on CI to save resources + maxFailures: process.env.CI ? 3 : undefined, + globalSetup: require.resolve("./utils/globalE2eSetup.ts"), + reporter: "list", + // Put any shared options on the top level. + use: { + headless: true, // Run tests in headless browsers. + video: "retain-on-failure", + }, + + projects: [ + { + name: "Chromium", + use: { browserName: "chromium" }, + }, + // Firefox seems to have bugs with opening context menus in the file tree. + // { + // name: "Firefox", + // use: { browserName: "firefox" }, + // }, + { + name: "WebKit", + use: { browserName: "webkit" }, + }, + ], +} + +export default config diff --git a/test/scripts/build-lib.bats b/test/scripts/build-lib.bats new file mode 100644 index 000000000000..e855f270a1ff --- /dev/null +++ b/test/scripts/build-lib.bats @@ -0,0 +1,21 @@ +#!/usr/bin/env bats + +SCRIPT_NAME="build-lib.sh" +SCRIPT="$BATS_TEST_DIRNAME/../../ci/build/$SCRIPT_NAME" + +source "$SCRIPT" + +@test "get_nfpm_arch should return armhfp for rpm on armv7l" { + run get_nfpm_arch rpm armv7l + [ "$output" = "armhfp" ] +} + +@test "get_nfpm_arch should return armhf for deb on armv7l" { + run get_nfpm_arch deb armv7l + [ "$output" = "armhf" ] +} + +@test "get_nfpm_arch should return arch if no arch override exists " { + run get_nfpm_arch deb i386 + [ "$output" = "i386" ] +} \ No newline at end of file diff --git a/test/scripts/install.bats b/test/scripts/install.bats new file mode 100644 index 000000000000..67e64c9192a3 --- /dev/null +++ b/test/scripts/install.bats @@ -0,0 +1,163 @@ +#!/usr/bin/env bats + +SCRIPT_NAME="install.sh" +SCRIPT="$BATS_TEST_DIRNAME/../../$SCRIPT_NAME" + +# Override version so it doesn't have to curl and to avoid caching in case the +# user already has the latest version installed. +export VERSION="9999.99.9" + +function should-use-deb() { + DISTRO=$1 ARCH=$2 OS=linux run "$SCRIPT" --dry-run + [ "$status" -eq 0 ] + [ "${lines[1]}" = "Installing v$VERSION of the $2 deb package from GitHub." ] + [ "${lines[-6]}" = "deb package has been installed." ] +} + +function should-use-rpm() { + DISTRO=$1 ARCH=$2 OS=linux run "$SCRIPT" --dry-run + [ "$status" -eq 0 ] + [ "${lines[1]}" = "Installing v$VERSION of the $2 rpm package from GitHub." ] + [ "${lines[-6]}" = "rpm package has been installed." ] +} + +function should-fallback-npm() { + YARN_PATH=true DISTRO=$1 ARCH=$2 OS=linux run "$SCRIPT" --dry-run + [ "$status" -eq 0 ] + [ "${lines[1]}" = "No standalone releases for $2." ] + [ "${lines[2]}" = "Falling back to installation from npm." ] + [ "${lines[3]}" = "Installing v$VERSION from npm." ] + [ "${lines[-6]}" = "npm package has been installed." ] +} + +function should-use-npm() { + YARN_PATH=true DISTRO=$1 ARCH=$2 OS=linux run "$SCRIPT" --dry-run + [ "$status" -eq 0 ] + [ "${lines[1]}" = "Installing v$VERSION from npm." ] + [ "${lines[-6]}" = "npm package has been installed." ] +} + +function should-use-aur() { + DISTRO=$1 ARCH=$2 OS=linux run "$SCRIPT" --dry-run + [ "$status" -eq 0 ] + [ "${lines[1]}" = "Installing latest from the AUR." ] + [ "${lines[-6]}" = "AUR package has been installed." ] +} + +function should-fallback-npm-brew() { + YARN_PATH=true BREW_PATH= OS=macos ARCH=$1 run "$SCRIPT" --dry-run + [ "$status" -eq 0 ] + [ "${lines[1]}" = "Homebrew not installed." ] + [ "${lines[2]}" = "Falling back to standalone installation." ] + [ "${lines[3]}" = "No standalone releases for $1." ] + [ "${lines[4]}" = "Falling back to installation from npm." ] + [ "${lines[5]}" = "Installing v$VERSION from npm." ] + [ "${lines[-6]}" = "npm package has been installed." ] +} + +function should-use-brew() { + BREW_PATH=true OS=macos ARCH=$1 run "$SCRIPT" --dry-run + [ "$status" -eq 0 ] + [ "${lines[1]}" = "Installing latest from Homebrew." ] + [ "${lines[-4]}" = "Brew release has been installed." ] +} + +function should-use-standalone() { + DISTRO=$1 ARCH=$2 OS=$3 run "$SCRIPT" --method standalone --dry-run + [ "$status" -eq 0 ] + [ "${lines[1]}" = "Installing v$VERSION of the $2 release from GitHub." ] + [[ "${lines[-6]}" = "Standalone release has been installed"* ]] +} + +@test "$SCRIPT_NAME: usage with --help" { + run "$SCRIPT" --help + [ "$status" -eq 0 ] + [ "${lines[0]}" = "Installs code-server." ] + [[ "${lines[-1]}" = "More installation docs are at"* ]] +} + +# These use the deb but fall back to npm for unsupported architectures. +@test "$SCRIPT_NAME: debian arm64" { + should-use-deb "debian" "arm64" +} +@test "$SCRIPT_NAME: debian amd64" { + should-use-deb "debian" "amd64" +} +@test "$SCRIPT_NAME: debian i386" { + should-fallback-npm "debian" "i386" +} + +# These use the rpm but fall back to npm for unsupported architectures. +@test "$SCRIPT_NAME: fedora arm64" { + should-use-rpm "fedora" "arm64" +} +@test "$SCRIPT_NAME: fedora amd64" { + should-use-rpm "fedora" "amd64" +} +@test "$SCRIPT_NAME: fedora i386" { + should-fallback-npm "fedora" "i386" +} + +# These always use npm regardless of the architecture. +@test "$SCRIPT_NAME: alpine arm64" { + should-use-npm "alpine" "arm64" +} +@test "$SCRIPT_NAME: alpine amd64" { + should-use-npm "alpine" "amd64" +} +@test "$SCRIPT_NAME: alpine i386" { + should-use-npm "alpine" "i386" +} + +@test "$SCRIPT_NAME: freebsd arm64" { + should-use-npm "freebsd" "arm64" +} +@test "$SCRIPT_NAME: freebsd amd64" { + should-use-npm "freebsd" "amd64" +} +@test "$SCRIPT_NAME: freebsd i386" { + should-use-npm "freebsd" "i386" +} + +# Arch Linux uses AUR but falls back to npm for unsuppported architectures. +@test "$SCRIPT_NAME: arch arm64" { + should-use-aur "arch" "arm64" +} +@test "$SCRIPT_NAME: arch amd64" { + should-use-aur "arch" "amd64" +} +@test "$SCRIPT_NAME: arch i386" { + should-fallback-npm "arch" "i386" +} + +# macOS use homebrew but falls back to standalone when brew is unavailable then +# to npm for unsupported architectures. +@test "$SCRIPT_NAME: macos amd64 (no brew)" { + should-fallback-npm-brew "amd64" +} +@test "$SCRIPT_NAME: macos arm64 (no brew)" { + BREW_PATH= OS=macos ARCH=arm64 run "$SCRIPT" --dry-run + [ "$status" -eq 0 ] + [ "${lines[1]}" = "Homebrew not installed." ] + [ "${lines[2]}" = "Falling back to standalone installation." ] + [ "${lines[3]}" = "Installing v$VERSION of the arm64 release from GitHub." ] + [[ "${lines[-6]}" = "Standalone release has been installed"* ]] +} +@test "$SCRIPT_NAME: macos i386 (no brew)" { + should-fallback-npm-brew "i386" +} + +@test "$SCRIPT_NAME: macos arm64 (brew)" { + should-use-brew "arm64" +} +@test "$SCRIPT_NAME: macos amd64 (brew)" { + should-use-brew "amd64" +} +@test "$SCRIPT_NAME: macos i386 (brew)" { + should-use-brew "i386" +} + +# Force standalone. +@test "$SCRIPT_NAME: debian amd64 --method standalone" { + should-use-standalone "debian" "amd64" "linux" +} diff --git a/test/scripts/steps-lib.bats b/test/scripts/steps-lib.bats new file mode 100644 index 000000000000..2071a062ea9f --- /dev/null +++ b/test/scripts/steps-lib.bats @@ -0,0 +1,46 @@ +#!/usr/bin/env bats + +SCRIPT_NAME="steps-lib.sh" +SCRIPT="$BATS_TEST_DIRNAME/../../ci/steps/$SCRIPT_NAME" + +source "$SCRIPT" + +@test "is_env_var_set should return 1 if env var is not set" { + run is_env_var_set "ASDF_TEST_SET" + [ "$status" = 1 ] +} + +@test "is_env_var_set should return 0 if env var is set" { + ASDF_TEST_SET="test" run is_env_var_set "ASDF_TEST_SET" + [ "$status" = 0 ] +} + +@test "directory_exists should 1 if directory doesn't exist" { + run directory_exists "/tmp/asdfasdfasdf" + [ "$status" = 1 ] +} + +@test "directory_exists should 0 if directory exists" { + run directory_exists "$(pwd)" + [ "$status" = 0 ] +} + +@test "file_exists should 1 if file doesn't exist" { + run file_exists "hello-asfd.sh" + [ "$status" = 1 ] +} + +@test "file_exists should 0 if file exists" { + run file_exists "$SCRIPT" + [ "$status" = 0 ] +} + +@test "is_executable should 1 if file isn't executable" { + run is_executable "hello-asfd.sh" + [ "$status" = 1 ] +} + +@test "is_executable should 0 if file is executable" { + run is_executable "$SCRIPT" + [ "$status" = 0 ] +} \ No newline at end of file diff --git a/test/unit/common/emitter.test.ts b/test/unit/common/emitter.test.ts new file mode 100644 index 000000000000..cec5fa611610 --- /dev/null +++ b/test/unit/common/emitter.test.ts @@ -0,0 +1,84 @@ +import { logger } from "@coder/logger" +import { Emitter } from "../../../src/common/emitter" +import { mockLogger } from "../../utils/helpers" + +describe("emitter", () => { + beforeEach(() => { + mockLogger() + }) + + afterEach(() => { + jest.clearAllMocks() + }) + + it("should run the correct callbacks", async () => { + const HELLO_WORLD = "HELLO_WORLD" + const GOODBYE_WORLD = "GOODBYE_WORLD" + const mockCallback = jest.fn(() => "Mock function called") + const mockSecondCallback = jest.fn(() => undefined) + + const emitter = new Emitter<{ event: string; callback: () => void }>() + + const onHelloWorld = ({ event, callback }: { event: string; callback: () => void }): void => { + if (event === HELLO_WORLD) { + callback() + } + } + + const onGoodbyeWorld = ({ event, callback }: { event: string; callback: () => void }): void => { + if (event === GOODBYE_WORLD) { + callback() + } + } + + // Register the onHelloWorld listener + // and the onGoodbyeWorld + const _onHelloWorld = emitter.event(onHelloWorld) + emitter.event(onGoodbyeWorld) + + await emitter.emit({ event: HELLO_WORLD, callback: mockCallback }) + + // Double-check that our callback is called only once + expect(mockCallback).toHaveBeenCalled() + expect(mockCallback).toHaveBeenCalledTimes(1) + + await emitter.emit({ event: GOODBYE_WORLD, callback: mockSecondCallback }) + + // Check that it works with multiple listeners + expect(mockSecondCallback).toHaveBeenCalled() + expect(mockSecondCallback).toHaveBeenCalledTimes(1) + + // Dispose of individual listener + _onHelloWorld.dispose() + + // Try disposing twice + _onHelloWorld.dispose() + + // Dispose of all the listeners + emitter.dispose() + }) + + it("should log an error if something goes wrong", async () => { + const HELLO_WORLD = "HELLO_WORLD" + const mockCallback = jest.fn(() => "Mock function called") + const message = "You don't have access to that folder." + + const emitter = new Emitter<{ event: string; callback: () => void }>() + + const onHelloWorld = ({ event, callback }: { event: string; callback: () => void }): void => { + if (event === HELLO_WORLD) { + callback() + throw new Error(message) + } + } + + emitter.event(onHelloWorld) + + await emitter.emit({ event: HELLO_WORLD, callback: mockCallback }) + + // Check that error was called + expect(logger.error).toHaveBeenCalled() + expect(logger.error).toHaveBeenCalledTimes(1) + expect(logger.error).toHaveBeenCalledWith(message) + }) +}) diff --git a/test/unit/common/http.test.ts b/test/unit/common/http.test.ts new file mode 100644 index 000000000000..ba4981377498 --- /dev/null +++ b/test/unit/common/http.test.ts @@ -0,0 +1,35 @@ +import { HttpCode, HttpError } from "../../../src/common/http" + +describe("http", () => { + describe("HttpCode", () => { + it("should return the correct HTTP codes", () => { + expect(HttpCode.Ok).toBe(200) + expect(HttpCode.Redirect).toBe(302) + expect(HttpCode.NotFound).toBe(404) + expect(HttpCode.BadRequest).toBe(400) + expect(HttpCode.Unauthorized).toBe(401) + expect(HttpCode.LargePayload).toBe(413) + expect(HttpCode.ServerError).toBe(500) + }) + }) + + describe("HttpError", () => { + it("should work as expected", () => { + const message = "Bad request from client" + const httpError = new HttpError(message, HttpCode.BadRequest) + + expect(httpError.message).toBe(message) + expect(httpError.statusCode).toBe(400) + expect(httpError.details).toBeUndefined() + }) + it("should have details if provided", () => { + const details = { + message: "User needs to be signed-in in order to perform action", + } + const message = "Unauthorized" + const httpError = new HttpError(message, HttpCode.BadRequest, details) + + expect(httpError.details).toStrictEqual(details) + }) + }) +}) diff --git a/test/unit/common/util.test.ts b/test/unit/common/util.test.ts new file mode 100644 index 000000000000..9e17b5734691 --- /dev/null +++ b/test/unit/common/util.test.ts @@ -0,0 +1,76 @@ +import { logger } from "@coder/logger" +import { JSDOM } from "jsdom" +import * as util from "../../../src/common/util" +import { mockLogger } from "../../utils/helpers" + +const dom = new JSDOM() +global.document = dom.window.document + +export type LocationLike = Pick + +describe("util", () => { + describe("normalize", () => { + it("should remove multiple slashes", () => { + expect(util.normalize("//foo//bar//baz///mumble")).toBe("/foo/bar/baz/mumble") + }) + + it("should remove trailing slashes", () => { + expect(util.normalize("qux///")).toBe("qux") + }) + + it("should preserve trailing slash if it exists", () => { + expect(util.normalize("qux///", true)).toBe("qux/") + expect(util.normalize("qux", true)).toBe("qux") + }) + }) + + describe("plural", () => { + it("should add an s if count is greater than 1", () => { + expect(util.plural(2, "dog")).toBe("dogs") + }) + it("should NOT add an s if the count is 1", () => { + expect(util.plural(1, "dog")).toBe("dog") + }) + }) + + describe("generateUuid", () => { + it("should generate a unique uuid", () => { + const uuid = util.generateUuid() + const uuid2 = util.generateUuid() + expect(uuid).toHaveLength(24) + expect(typeof uuid).toBe("string") + expect(uuid).not.toBe(uuid2) + }) + it("should generate a uuid of a specific length", () => { + const uuid = util.generateUuid(10) + expect(uuid).toHaveLength(10) + }) + }) + + describe("logError", () => { + beforeAll(() => { + mockLogger() + }) + + afterEach(() => { + jest.clearAllMocks() + }) + + it("should log an error with the message and stack trace", () => { + const message = "You don't have access to that folder." + const error = new Error(message) + + util.logError(logger, "ui", error) + + expect(logger.error).toHaveBeenCalled() + expect(logger.error).toHaveBeenCalledWith(`ui: ${error.message} ${error.stack}`) + }) + + it("should log an error, even if not an instance of error", () => { + util.logError(logger, "api", "oh no") + + expect(logger.error).toHaveBeenCalled() + expect(logger.error).toHaveBeenCalledWith("api: oh no") + }) + }) +}) diff --git a/test/unit/helpers.test.ts b/test/unit/helpers.test.ts new file mode 100644 index 000000000000..033449e9b160 --- /dev/null +++ b/test/unit/helpers.test.ts @@ -0,0 +1,78 @@ +import { promises as fs } from "fs" +import { clean, getAvailablePort, getMaybeProxiedPathname, tmpdir, useEnv } from "../../test/utils/helpers" +import { REVERSE_PROXY_BASE_PATH } from "../utils/constants" + +/** + * This file is for testing test helpers (not core code). + */ +describe("test helpers", () => { + const testName = "temp-dir" + beforeAll(async () => { + await clean(testName) + }) + + it("should return a temp directory", async () => { + const pathToTempDir = await tmpdir(testName) + expect(pathToTempDir).toContain(testName) + expect(fs.access(pathToTempDir)).resolves.toStrictEqual(undefined) + }) +}) + +describe("useEnv", () => { + beforeAll(() => { + jest.resetModules() + process.env.TEST_USE_ENV = "test environment variable" + }) + afterAll(() => { + delete process.env.TEST_USE_ENV + }) + it("should set and reset the env var", () => { + const envKey = "TEST_ENV_VAR" + const [setValue, resetValue] = useEnv(envKey) + setValue("hello-world") + expect(process.env[envKey]).toEqual("hello-world") + resetValue() + expect(process.env[envKey]).toEqual(undefined) + }) + it("should set and reset the env var where a value was already set", () => { + const envKey = "TEST_USE_ENV" + expect(process.env[envKey]).toEqual("test environment variable") + const [setValue, resetValue] = useEnv(envKey) + setValue("hello there") + expect(process.env[envKey]).toEqual("hello there") + resetValue() + expect(process.env[envKey]).toEqual("test environment variable") + }) +}) + +describe("getAvailablePort", () => { + it("should return a valid port", async () => { + const port = await getAvailablePort() + expect(port).toBeGreaterThan(0) + expect(port).toBeLessThanOrEqual(65535) + }) + it("should return different ports for different calls", async () => { + const portOne = await getAvailablePort() + const portTwo = await getAvailablePort() + expect(portOne).not.toEqual(portTwo) + }) +}) + +describe("getMaybeProxiedPathname", () => { + it("should return the route", () => { + const route = "/vscode" + const url = new URL(`http://localhost:3000${route}`) + const actual = getMaybeProxiedPathname(url) + expect(actual).toBe(route) + }) + it("should strip proxy if env var set", () => { + const envKey = "USE_PROXY" + const [setValue, resetValue] = useEnv(envKey) + setValue("1") + const route = "/vscode" + const url = new URL(`http://localhost:3000/8000/${REVERSE_PROXY_BASE_PATH}${route}`) + const actual = getMaybeProxiedPathname(url) + expect(actual).toBe(route) + resetValue() + }) +}) diff --git a/test/unit/node/app.test.ts b/test/unit/node/app.test.ts new file mode 100644 index 000000000000..e56ed77bda20 --- /dev/null +++ b/test/unit/node/app.test.ts @@ -0,0 +1,263 @@ +import { logger } from "@coder/logger" +import { promises } from "fs" +import * as http from "http" +import * as https from "https" +import * as path from "path" +import { createApp, ensureAddress, handleArgsSocketCatchError, listen } from "../../../src/node/app" +import { OptionalString, setDefaults } from "../../../src/node/cli" +import { generateCertificate } from "../../../src/node/util" +import { clean, mockLogger, getAvailablePort, tmpdir } from "../../utils/helpers" + +describe("createApp", () => { + let unlinkSpy: jest.SpyInstance + let port: number + let tmpDirPath: string + let tmpFilePath: string + + beforeAll(async () => { + mockLogger() + + const testName = "app" + await clean(testName) + tmpDirPath = await tmpdir(testName) + tmpFilePath = path.join(tmpDirPath, "unlink-socket-file") + }) + + beforeEach(async () => { + // NOTE:@jsjoeio + // Be mindful when spying. + // You can't spy on fs functions if you do import * as fs + // You have to import individually, like we do here with promises + // then you can spy on those modules methods, like unlink. + // See: https://github.com/aelbore/esbuild-jest/issues/26#issuecomment-893763840 + unlinkSpy = jest.spyOn(promises, "unlink") + port = await getAvailablePort() + }) + + afterEach(() => { + jest.clearAllMocks() + }) + + it("should return an Express app, a WebSockets Express app and an http server", async () => { + const defaultArgs = await setDefaults({ + port, + }) + const app = await createApp(defaultArgs) + + // This doesn't check much, but it's a good sanity check + // to ensure we actually get back values from createApp + expect(app.router).not.toBeNull() + expect(app.wsRouter).not.toBeNull() + expect(app.server).toBeInstanceOf(http.Server) + + // Cleanup + app.dispose() + }) + + it("should handle error events on the server", async () => { + const defaultArgs = await setDefaults({ + port, + }) + + const app = await createApp(defaultArgs) + + const testError = new Error("Test error") + // We can easily test how the server handles errors + // By emitting an error event + // Ref: https://stackoverflow.com/a/33872506/3015595 + app.server.emit("error", testError) + expect(logger.error).toHaveBeenCalledTimes(1) + expect(logger.error).toHaveBeenCalledWith(`http server error: ${testError.message} ${testError.stack}`) + + // Cleanup + app.dispose() + }) + + it("should reject errors that happen before the server can listen", async () => { + // We listen on an invalid port + // causing the app to reject the Promise called at startup + const port = 2 + const defaultArgs = await setDefaults({ + port, + }) + + async function masterBall() { + const app = await createApp(defaultArgs) + + const testError = new Error("Test error") + + app.server.emit("error", testError) + + // Cleanup + app.dispose() + } + + expect(() => masterBall()).rejects.toThrow("listen EACCES: permission denied") + }) + + it("should unlink a socket before listening on the socket", async () => { + await promises.writeFile(tmpFilePath, "") + const defaultArgs = await setDefaults({ + socket: tmpFilePath, + }) + + const app = await createApp(defaultArgs) + + expect(unlinkSpy).toHaveBeenCalledWith(tmpFilePath) + app.dispose() + }) + + it("should change the file mode of a socket", async () => { + const defaultArgs = await setDefaults({ + socket: tmpFilePath, + "socket-mode": "777", + }) + + const app = await createApp(defaultArgs) + + expect((await promises.stat(tmpFilePath)).mode & 0o777).toBe(0o777) + app.dispose() + }) + + it("should create an https server if args.cert exists", async () => { + const testCertificate = await generateCertificate("localhost") + const cert = new OptionalString(testCertificate.cert) + const defaultArgs = await setDefaults({ + port, + cert, + ["cert-key"]: testCertificate.certKey, + }) + const app = await createApp(defaultArgs) + + // This doesn't check much, but it's a good sanity check + // to ensure we actually get an https.Server + expect(app.server).toBeInstanceOf(https.Server) + + // Cleanup + app.dispose() + }) +}) + +describe("ensureAddress", () => { + let mockServer: http.Server + + beforeEach(() => { + mockServer = http.createServer() + }) + + afterEach(() => { + mockServer.close() + }) + + it("should throw and error if no address", () => { + expect(() => ensureAddress(mockServer, "http")).toThrow("Server has no address") + }) + it("should return the address if it's a string", async () => { + mockServer.address = () => "/path/to/unix.sock" + const address = ensureAddress(mockServer, "http") + expect(address.toString()).toBe(`/path/to/unix.sock`) + }) + it("should construct URL with an IPv4 address", async () => { + mockServer.address = () => ({ address: "1.2.3.4", port: 5678, family: "IPv4" }) + const address = ensureAddress(mockServer, "http") + expect(address.toString()).toBe(`http://1.2.3.4:5678/`) + }) + it("should construct URL with an IPv6 address", async () => { + mockServer.address = () => ({ address: "a:b:c:d::1234", port: 5678, family: "IPv6" }) + const address = ensureAddress(mockServer, "http") + expect(address.toString()).toBe(`http://[a:b:c:d::1234]:5678/`) + }) +}) + +describe("handleArgsSocketCatchError", () => { + beforeAll(() => { + mockLogger() + }) + + afterEach(() => { + jest.clearAllMocks() + }) + + it("should log an error if its not an NodeJS.ErrnoException", () => { + const message = "other message" + const error = new Error(message) + + expect(() => { + handleArgsSocketCatchError(error) + }).toThrowError(error) + }) + + it("should log an error if its not an NodeJS.ErrnoException (and the error has a message)", () => { + const errorMessage = "handleArgsSocketCatchError Error" + const error = new Error(errorMessage) + + expect(() => { + handleArgsSocketCatchError(error) + }).toThrowError(error) + }) + + it("should not log an error if its a NodeJS.ErrnoException", () => { + const code = "ENOENT" + const error: NodeJS.ErrnoException = new Error(code) + error.code = code + + handleArgsSocketCatchError(error) + + expect(() => { + handleArgsSocketCatchError(error) + }).not.toThrowError() + }) + + it("should log an error if the code is not ENOENT (and the error has a message)", () => { + const errorMessage = "no access" + const error: NodeJS.ErrnoException = new Error() + error.code = "EACCESS" + error.message = errorMessage + + expect(() => { + handleArgsSocketCatchError(error) + }).toThrowError(error) + }) + + it("should log an error if the code is not ENOENT", () => { + const code = "EACCESS" + const error: NodeJS.ErrnoException = new Error(code) + error.code = code + + expect(() => { + handleArgsSocketCatchError(error) + }).toThrowError(error) + }) +}) + +describe("listen", () => { + let tmpDirPath: string + let mockServer: http.Server + + const testName = "listen" + + beforeEach(async () => { + await clean(testName) + mockLogger() + tmpDirPath = await tmpdir(testName) + mockServer = http.createServer() + }) + + afterEach(() => { + mockServer.close() + jest.clearAllMocks() + }) + + it("should throw an error if a directory is passed in instead of a file", async () => { + const errorMessage = "EISDIR: illegal operation on a directory, unlink" + const port = await getAvailablePort() + const mockArgs = { port, host: "0.0.0.0", socket: tmpDirPath } + + try { + await listen(mockServer, mockArgs) + } catch (error) { + expect(error).toBeInstanceOf(Error) + expect((error as any).message).toMatch(errorMessage) + } + }) +}) diff --git a/test/unit/node/cli.test.ts b/test/unit/node/cli.test.ts new file mode 100644 index 000000000000..668a3c55776c --- /dev/null +++ b/test/unit/node/cli.test.ts @@ -0,0 +1,1077 @@ +import { Level, logger } from "@coder/logger" +import { promises as fs } from "fs" +import * as path from "path" +import { + UserProvidedArgs, + bindAddrFromArgs, + defaultConfigFile, + parse, + parseConfigFile, + setDefaults, + shouldOpenInExistingInstance, + toCodeArgs, + optionDescriptions, + options, + Options, + AuthType, + OptionalString, +} from "../../../src/node/cli" +import { shouldSpawnCliProcess } from "../../../src/node/main" +import { generatePassword, paths } from "../../../src/node/util" +import { + EditorSessionManager, + EditorSessionManagerClient, + makeEditorSessionManagerServer, +} from "../../../src/node/vscodeSocket" +import { clean, useEnv, tmpdir, listenOn } from "../../utils/helpers" + +// The parser should not set any defaults so the caller can determine what +// values the user actually set. These are only set after explicitly calling +// `setDefaults`. +const defaults = { + auth: "password", + host: "localhost", + port: 8080, + "proxy-domain": [], + usingEnvPassword: false, + usingEnvHashedPassword: false, + "extensions-dir": path.join(paths.data, "extensions"), + "user-data-dir": paths.data, + "session-socket": path.join(paths.data, "code-server-ipc.sock"), + _: [], +} + +describe("parser", () => { + beforeEach(() => { + delete process.env.LOG_LEVEL + delete process.env.PASSWORD + delete process.env.CS_DISABLE_FILE_DOWNLOADS + delete process.env.CS_DISABLE_GETTING_STARTED_OVERRIDE + delete process.env.VSCODE_PROXY_URI + delete process.env.CS_DISABLE_PROXY + console.log = jest.fn() + }) + + it("should parse nothing", async () => { + expect(parse([])).toStrictEqual({}) + }) + + it("should parse all available options", async () => { + expect( + parse( + [ + ["--enable", "feature1"], + ["--enable", "feature2"], + + "--bind-addr=192.169.0.1:8080", + + ["--auth", "none"], + + ["--extensions-dir", "path/to/ext/dir"], + + ["--builtin-extensions-dir", "path/to/builtin/ext/dir"], + + "1", + "--verbose", + ["--app-name", "custom instance name"], + ["--welcome-text", "welcome to code"], + ["--i18n", "path/to/custom-strings.json"], + "2", + + ["--locale", "ja"], + + ["--log", "error"], + + "--help", + + "--open", + + "--socket=mumble", + + "--socket-mode=777", + + "3", + + ["--user-data-dir", "path/to/user/dir"], + + ["--cert=path/to/cert", "--cert-key", "path/to/cert/key"], + + "--version", + + "--json", + + "--port=8081", + + "--disable-file-downloads", + + "--disable-getting-started-override", + + "--disable-proxy", + + ["--abs-proxy-base-path", "/codeserver/app1"], + + "--skip-auth-preflight", + + ["--session-socket", "/tmp/override-code-server-ipc-socket"], + + ["--host", "0.0.0.0"], + "4", + "--", + "--5", + ].flat(), + ), + ).toEqual({ + _: ["1", "2", "3", "4", "--5"], + auth: "none", + "builtin-extensions-dir": path.resolve("path/to/builtin/ext/dir"), + "extensions-dir": path.resolve("path/to/ext/dir"), + "user-data-dir": path.resolve("path/to/user/dir"), + "cert-key": path.resolve("path/to/cert/key"), + cert: { + value: path.resolve("path/to/cert"), + }, + "disable-file-downloads": true, + "disable-getting-started-override": true, + "disable-proxy": true, + enable: ["feature1", "feature2"], + help: true, + host: "0.0.0.0", + json: true, + locale: "ja", + log: "error", + open: true, + port: 8081, + socket: path.resolve("mumble"), + "socket-mode": "777", + verbose: true, + "app-name": "custom instance name", + "welcome-text": "welcome to code", + i18n: path.resolve("path/to/custom-strings.json"), + version: true, + "bind-addr": "192.169.0.1:8080", + "session-socket": "/tmp/override-code-server-ipc-socket", + "abs-proxy-base-path": "/codeserver/app1", + "skip-auth-preflight": true, + }) + }) + + it("should work with short options", async () => { + expect(parse(["-vvv", "-v"])).toEqual({ + verbose: true, + version: true, + }) + }) + + it("should use log level env var", async () => { + const args = parse([]) + expect(args).toEqual({}) + + process.env.LOG_LEVEL = "debug" + const defaults = await setDefaults(args) + expect(defaults).toStrictEqual({ + ...defaults, + log: "debug", + verbose: false, + }) + expect(process.env.LOG_LEVEL).toEqual("debug") + expect(logger.level).toEqual(Level.Debug) + + process.env.LOG_LEVEL = "trace" + const updated = await setDefaults(args) + expect(updated).toStrictEqual({ + ...updated, + log: "trace", + verbose: true, + }) + expect(process.env.LOG_LEVEL).toEqual("trace") + expect(logger.level).toEqual(Level.Trace) + }) + + it("should prefer --log to env var and --verbose to --log", async () => { + let args = parse(["--log", "info"]) + expect(args).toEqual({ + log: "info", + }) + + process.env.LOG_LEVEL = "debug" + const defaults = await setDefaults(args) + expect(defaults).toEqual({ + ...defaults, + log: "info", + verbose: false, + }) + expect(process.env.LOG_LEVEL).toEqual("info") + expect(logger.level).toEqual(Level.Info) + + process.env.LOG_LEVEL = "trace" + const updated = await setDefaults(args) + expect(updated).toEqual({ + ...defaults, + log: "info", + verbose: false, + }) + expect(process.env.LOG_LEVEL).toEqual("info") + expect(logger.level).toEqual(Level.Info) + + args = parse(["--log", "info", "--verbose"]) + expect(args).toEqual({ + log: "info", + verbose: true, + }) + + process.env.LOG_LEVEL = "warn" + const updatedAgain = await setDefaults(args) + expect(updatedAgain).toEqual({ + ...defaults, + log: "trace", + verbose: true, + }) + expect(process.env.LOG_LEVEL).toEqual("trace") + expect(logger.level).toEqual(Level.Trace) + }) + + it("should set valid log level env var", async () => { + process.env.LOG_LEVEL = "error" + const defaults = await setDefaults(parse([])) + expect(defaults).toEqual({ + ...defaults, + log: "error", + }) + }) + + it("should ignore invalid log level env var", async () => { + process.env.LOG_LEVEL = "bogus" + const defaults = await setDefaults(parse([])) + expect(defaults).toEqual({ + ...defaults, + }) + }) + + it("should error if value isn't provided", () => { + expect(() => parse(["--auth"])).toThrowError(/--auth requires a value/) + expect(() => parse(["--auth=", "--log=debug"])).toThrowError(/--auth requires a value/) + expect(() => parse(["--auth", "--log"])).toThrowError(/--auth requires a value/) + expect(() => parse(["--auth", "--invalid"])).toThrowError(/--auth requires a value/) + expect(() => parse(["--bind-addr"])).toThrowError(/--bind-addr requires a value/) + }) + + it("should error if value is invalid", () => { + expect(() => parse(["--port", "foo"])).toThrowError(/--port must be a number/) + expect(() => parse(["--auth", "invalid"])).toThrowError(/--auth valid values: \[password, none\]/) + expect(() => parse(["--log", "invalid"])).toThrowError(/--log valid values: \[trace, debug, info, warn, error\]/) + }) + + it("should error if the option doesn't exist", () => { + expect(() => parse(["--foo"])).toThrowError(/Unknown option --foo/) + }) + + it("should not error if the value is optional", async () => { + expect(parse(["--cert"])).toEqual({ + cert: { + value: undefined, + }, + }) + }) + + it("should not allow option-like values", () => { + expect(() => parse(["--socket", "--socket-path-value"])).toThrowError(/--socket requires a value/) + // If you actually had a path like this you would do this instead: + expect(parse(["--socket", "./--socket-path-value"])).toEqual({ + socket: path.resolve("--socket-path-value"), + }) + expect(() => parse(["--cert", "--socket-path-value"])).toThrowError(/Unknown option --socket-path-value/) + }) + + it("should allow positional arguments before options", async () => { + expect(parse(["test", "--auth", "none"])).toEqual({ + _: ["test"], + auth: "none", + }) + }) + + it("should support repeatable flags", async () => { + expect(() => parse(["--proxy-domain", ""])).toThrowError(/--proxy-domain requires a value/) + expect(parse(["--proxy-domain", "*.coder.com"])).toEqual({ + "proxy-domain": ["*.coder.com"], + }) + expect(parse(["--proxy-domain", "*.coder.com", "--proxy-domain", "test.com"])).toEqual({ + "proxy-domain": ["*.coder.com", "test.com"], + }) + // Commas are literal, at the moment. + expect(parse(["--proxy-domain", "*.coder.com,test.com"])).toEqual({ + "proxy-domain": ["*.coder.com,test.com"], + }) + }) + + it("should enforce cert-key with cert value or otherwise generate one", async () => { + const args = parse(["--cert"]) + expect(args).toEqual({ + cert: { + value: undefined, + }, + }) + expect(() => parse(["--cert", "test"])).toThrowError(/--cert-key is missing/) + const defaultArgs = await setDefaults(args) + expect(defaultArgs).toEqual({ + ...defaults, + cert: { + value: path.join(paths.data, "localhost.crt"), + }, + "cert-key": path.join(paths.data, "localhost.key"), + }) + }) + + it("should use env var password", async () => { + process.env.PASSWORD = "test" + const args = parse([]) + expect(args).toEqual({}) + + const defaultArgs = await setDefaults(args) + expect(defaultArgs).toEqual({ + ...defaults, + password: "test", + usingEnvPassword: true, + }) + }) + + it("should use env var hashed password", async () => { + process.env.HASHED_PASSWORD = + "$argon2i$v=19$m=4096,t=3,p=1$0qR/o+0t00hsbJFQCKSfdQ$oFcM4rL6o+B7oxpuA4qlXubypbBPsf+8L531U7P9HYY" // test + const args = parse([]) + expect(args).toEqual({}) + + const defaultArgs = await setDefaults(args) + expect(defaultArgs).toEqual({ + ...defaults, + "hashed-password": + "$argon2i$v=19$m=4096,t=3,p=1$0qR/o+0t00hsbJFQCKSfdQ$oFcM4rL6o+B7oxpuA4qlXubypbBPsf+8L531U7P9HYY", + usingEnvHashedPassword: true, + }) + }) + + it("should parse i18n flag with file path", async () => { + // Test with file path (no validation at CLI parsing level) + const args = parse(["--i18n", "/path/to/custom-strings.json"]) + expect(args).toEqual({ + i18n: "/path/to/custom-strings.json", + }) + }) + + it("should parse i18n flag with relative file path", async () => { + // Test with relative file path + expect(() => parse(["--i18n", "./custom-strings.json"])).not.toThrow() + expect(() => parse(["--i18n", "strings.json"])).not.toThrow() + }) + + it("should support app-name and deprecated welcome-text flags", async () => { + const args = parse(["--app-name", "My App", "--welcome-text", "Welcome!"]) + expect(args).toEqual({ + "app-name": "My App", + "welcome-text": "Welcome!", + }) + }) + + it("should use env var github token", async () => { + process.env.GITHUB_TOKEN = "ga-foo" + const args = parse([]) + expect(args).toEqual({}) + + const defaultArgs = await setDefaults(args) + expect(defaultArgs).toEqual({ + ...defaults, + "github-auth": "ga-foo", + }) + expect(process.env.GITHUB_TOKEN).toBe(undefined) + }) + + it("should use env var CS_DISABLE_FILE_DOWNLOADS", async () => { + process.env.CS_DISABLE_FILE_DOWNLOADS = "1" + const args = parse([]) + expect(args).toEqual({}) + + const defaultArgs = await setDefaults(args) + expect(defaultArgs).toEqual({ + ...defaults, + "disable-file-downloads": true, + }) + }) + + it("should use env var CS_DISABLE_FILE_DOWNLOADS set to true", async () => { + process.env.CS_DISABLE_FILE_DOWNLOADS = "true" + const args = parse([]) + expect(args).toEqual({}) + + const defaultArgs = await setDefaults(args) + expect(defaultArgs).toEqual({ + ...defaults, + "disable-file-downloads": true, + }) + }) + + it("should use env var CS_DISABLE_GETTING_STARTED_OVERRIDE", async () => { + process.env.CS_DISABLE_GETTING_STARTED_OVERRIDE = "1" + const args = parse([]) + expect(args).toEqual({}) + + const defaultArgs = await setDefaults(args) + expect(defaultArgs).toEqual({ + ...defaults, + "disable-getting-started-override": true, + }) + }) + + it("should use env var CS_DISABLE_GETTING_STARTED_OVERRIDE set to true", async () => { + process.env.CS_DISABLE_GETTING_STARTED_OVERRIDE = "true" + const args = parse([]) + expect(args).toEqual({}) + + const defaultArgs = await setDefaults(args) + expect(defaultArgs).toEqual({ + ...defaults, + "disable-getting-started-override": true, + }) + }) + + it("should use env var CS_DISABLE_PROXY", async () => { + process.env.CS_DISABLE_PROXY = "1" + const args = parse([]) + expect(args).toEqual({}) + + const defaultArgs = await setDefaults(args) + expect(defaultArgs).toEqual({ + ...defaults, + "disable-proxy": true, + }) + }) + + it("should use env var CS_DISABLE_PROXY set to true", async () => { + process.env.CS_DISABLE_PROXY = "true" + const args = parse([]) + expect(args).toEqual({}) + + const defaultArgs = await setDefaults(args) + expect(defaultArgs).toEqual({ + ...defaults, + "disable-proxy": true, + }) + }) + + it("should error if password passed in", () => { + expect(() => parse(["--password", "supersecret123"])).toThrowError( + "--password can only be set in the config file or passed in via $PASSWORD", + ) + }) + + it("should error if hashed-password passed in", () => { + expect(() => parse(["--hashed-password", "fdas423fs8a"])).toThrowError( + "--hashed-password can only be set in the config file or passed in via $HASHED_PASSWORD", + ) + }) + + it("should error if github-auth passed in", () => { + expect(() => parse(["--github-auth", "fdas423fs8a"])).toThrowError( + "--github-auth can only be set in the config file or passed in via $GITHUB_TOKEN", + ) + }) + + it("should filter proxy domains", async () => { + const args = parse(["--proxy-domain", "*.coder.com", "--proxy-domain", "coder.com", "--proxy-domain", "coder.org"]) + expect(args).toEqual({ + "proxy-domain": ["*.coder.com", "coder.com", "coder.org"], + }) + + const defaultArgs = await setDefaults(args) + expect(defaultArgs).toEqual({ + ...defaults, + "proxy-domain": ["{{port}}.coder.com", "{{port}}.coder.org"], + }) + }) + it("should allow '=,$/' in strings", async () => { + const args = parse([ + "--disable-update-check", + "$argon2i$v=19$m=4096,t=3,p=1$0qr/o+0t00hsbjfqcksfdq$ofcm4rl6o+b7oxpua4qlxubypbbpsf+8l531u7p9hyy", + ]) + expect(args).toEqual({ + "disable-update-check": true, + _: ["$argon2i$v=19$m=4096,t=3,p=1$0qr/o+0t00hsbjfqcksfdq$ofcm4rl6o+b7oxpua4qlxubypbbpsf+8l531u7p9hyy"], + }) + }) + it("should parse options with double-dash and multiple equal signs ", async () => { + const args = parse( + [ + "--hashed-password=$argon2i$v=19$m=4096,t=3,p=1$0qr/o+0t00hsbjfqcksfdq$ofcm4rl6o+b7oxpua4qlxubypbbpsf+8l531u7p9hyy", + ], + { + configFile: "/pathtoconfig", + }, + ) + expect(args).toEqual({ + "hashed-password": + "$argon2i$v=19$m=4096,t=3,p=1$0qr/o+0t00hsbjfqcksfdq$ofcm4rl6o+b7oxpua4qlxubypbbpsf+8l531u7p9hyy", + }) + }) + it("should throw an error for invalid config values", async () => { + const fakePath = "/fake-config-path" + const expectedErrMsg = `error reading ${fakePath}: ` + + expect(() => + parse(["--foo"], { + configFile: fakePath, + }), + ).toThrowError(expectedErrMsg) + }) + it("should fail to parse invalid config", () => { + expect(() => parseConfigFile("test", "/fake-config-path")).toThrowError("invalid config: test") + }) + it("should parse repeatable options", () => { + const configContents = ` + install-extension: + - extension.number1 + - extension.number2 + ` + expect(parseConfigFile(configContents, "/fake-config-path")).toEqual({ + config: "/fake-config-path", + "install-extension": ["extension.number1", "extension.number2"], + }) + }) + it("should ignore optional strings set to false", async () => { + expect(parse(["--cert=false"])).toEqual({}) + }) + it("should use last flag", async () => { + expect(parse(["--port", "8081", "--port", "8082"])).toEqual({ + port: 8082, + }) + }) + + it("should not set proxy uri", async () => { + await setDefaults(parse([])) + expect(process.env.VSCODE_PROXY_URI).toBeUndefined() + }) + + it("should set proxy uri", async () => { + await setDefaults(parse(["--proxy-domain", "coder.org"])) + expect(process.env.VSCODE_PROXY_URI).toEqual("//{{port}}.coder.org") + }) + + it("should set proxy uri to first domain", async () => { + await setDefaults( + parse(["--proxy-domain", "*.coder.com", "--proxy-domain", "coder.com", "--proxy-domain", "coder.org"]), + ) + expect(process.env.VSCODE_PROXY_URI).toEqual("//{{port}}.coder.com") + }) + + it("should not override existing proxy uri", async () => { + process.env.VSCODE_PROXY_URI = "foo" + await setDefaults( + parse(["--proxy-domain", "*.coder.com", "--proxy-domain", "coder.com", "--proxy-domain", "coder.org"]), + ) + expect(process.env.VSCODE_PROXY_URI).toEqual("foo") + }) +}) + +describe("cli", () => { + const testName = "cli" + let tmpDirPath: string + + beforeAll(async () => { + await clean(testName) + }) + + beforeEach(async () => { + delete process.env.VSCODE_IPC_HOOK_CLI + tmpDirPath = await tmpdir(testName) + }) + + it("should use existing if inside code-server", async () => { + process.env.VSCODE_IPC_HOOK_CLI = "test" + const args: UserProvidedArgs = {} + expect(await shouldOpenInExistingInstance(args, "")).toStrictEqual("test") + + args.port = 8081 + args._ = ["./file"] + expect(await shouldOpenInExistingInstance(args, "")).toStrictEqual("test") + }) + + it("should use existing if --reuse-window is set", async () => { + const sessionSocket = path.join(tmpDirPath, "session-socket") + const server = await makeEditorSessionManagerServer(sessionSocket, new EditorSessionManager()) + + const args: UserProvidedArgs = {} + args["reuse-window"] = true + await expect(shouldOpenInExistingInstance(args, sessionSocket)).rejects.toThrow() + + const socketPath = path.join(tmpDirPath, "socket") + const client = new EditorSessionManagerClient(sessionSocket) + await client.addSession({ + entry: { + workspace: { + id: "aaa", + folders: [ + { + uri: { + path: "/aaa", + }, + }, + ], + }, + socketPath, + }, + }) + const vscodeSockets = listenOn(socketPath) + + await expect(shouldOpenInExistingInstance(args, sessionSocket)).resolves.toStrictEqual(socketPath) + + args.port = 8081 + await expect(shouldOpenInExistingInstance(args, sessionSocket)).resolves.toStrictEqual(socketPath) + + server.close() + vscodeSockets.close() + }) + + it("should use existing if --new-window is set", async () => { + const sessionSocket = path.join(tmpDirPath, "session-socket") + const server = await makeEditorSessionManagerServer(sessionSocket, new EditorSessionManager()) + + const args: UserProvidedArgs = {} + args["new-window"] = true + await expect(shouldOpenInExistingInstance(args, sessionSocket)).rejects.toThrow() + + const socketPath = path.join(tmpDirPath, "socket") + const client = new EditorSessionManagerClient(sessionSocket) + await client.addSession({ + entry: { + workspace: { + id: "aaa", + folders: [ + { + uri: { + path: "/aaa", + }, + }, + ], + }, + socketPath, + }, + }) + const vscodeSockets = listenOn(socketPath) + + expect(await shouldOpenInExistingInstance(args, sessionSocket)).toStrictEqual(socketPath) + + args.port = 8081 + expect(await shouldOpenInExistingInstance(args, sessionSocket)).toStrictEqual(socketPath) + + server.close() + vscodeSockets.close() + }) + + it("should use existing if no unrelated flags are set, has positional, and socket is active", async () => { + const sessionSocket = path.join(tmpDirPath, "session-socket") + const server = await makeEditorSessionManagerServer(sessionSocket, new EditorSessionManager()) + + const args: UserProvidedArgs = {} + expect(await shouldOpenInExistingInstance(args, sessionSocket)).toStrictEqual(undefined) + + args._ = ["./file"] + expect(await shouldOpenInExistingInstance(args, sessionSocket)).toStrictEqual(undefined) + + const client = new EditorSessionManagerClient(sessionSocket) + const socketPath = path.join(tmpDirPath, "socket") + await client.addSession({ + entry: { + workspace: { + id: "aaa", + folders: [ + { + uri: { + path: "/aaa", + }, + }, + ], + }, + socketPath, + }, + }) + const vscodeSockets = listenOn(socketPath) + + expect(await shouldOpenInExistingInstance(args, sessionSocket)).toStrictEqual(socketPath) + + args.port = 8081 + expect(await shouldOpenInExistingInstance(args, sessionSocket)).toStrictEqual(undefined) + + server.close() + vscodeSockets.close() + }) + + it("should prefer matching sessions for only the first path", async () => { + const sessionSocket = path.join(tmpDirPath, "session-socket") + const server = await makeEditorSessionManagerServer(sessionSocket, new EditorSessionManager()) + const client = new EditorSessionManagerClient(sessionSocket) + await client.addSession({ + entry: { + workspace: { + id: "aaa", + folders: [ + { + uri: { + path: "/aaa", + }, + }, + ], + }, + socketPath: `${tmpDirPath}/vscode-ipc-aaa.sock`, + }, + }) + await client.addSession({ + entry: { + workspace: { + id: "bbb", + folders: [ + { + uri: { + path: "/bbb", + }, + }, + ], + }, + socketPath: `${tmpDirPath}/vscode-ipc-bbb.sock`, + }, + }) + listenOn(`${tmpDirPath}/vscode-ipc-aaa.sock`, `${tmpDirPath}/vscode-ipc-bbb.sock`) + + const args: UserProvidedArgs = {} + args._ = ["/aaa/file", "/bbb/file"] + expect(await shouldOpenInExistingInstance(args, sessionSocket)).toStrictEqual(`${tmpDirPath}/vscode-ipc-aaa.sock`) + + server.close() + }) +}) + +describe("shouldSpawnCliProcess", () => { + it("should return false if no 'extension' related args passed in", async () => { + const args = {} + const actual = await shouldSpawnCliProcess(args) + const expected = false + + expect(actual).toBe(expected) + }) + + it("should return true if 'list-extensions' passed in", async () => { + const args = { + ["list-extensions"]: true, + } + const actual = await shouldSpawnCliProcess(args) + const expected = true + + expect(actual).toBe(expected) + }) + + it("should return true if 'install-extension' passed in", async () => { + const args = { + ["install-extension"]: ["hello.world"], + } + const actual = await shouldSpawnCliProcess(args) + const expected = true + + expect(actual).toBe(expected) + }) + + it("should return true if 'uninstall-extension' passed in", async () => { + const args: UserProvidedArgs = { + ["uninstall-extension"]: ["hello.world"], + } + const actual = await shouldSpawnCliProcess(args) + const expected = true + + expect(actual).toBe(expected) + }) +}) + +describe("bindAddrFromArgs", () => { + it("should return the bind address", () => { + const args: UserProvidedArgs = {} + + const addr = { + host: "localhost", + port: 8080, + } + + const actual = bindAddrFromArgs(addr, args) + const expected = addr + + expect(actual).toStrictEqual(expected) + }) + + it("should use the bind-address if set in args", () => { + const args: UserProvidedArgs = { + ["bind-addr"]: "localhost:3000", + } + + const addr = { + host: "localhost", + port: 8080, + } + + const actual = bindAddrFromArgs(addr, args) + const expected = { + host: "localhost", + port: 3000, + } + + expect(actual).toStrictEqual(expected) + }) + + it("should use the host if set in args", () => { + const args: UserProvidedArgs = { + ["host"]: "coder", + } + + const addr = { + host: "localhost", + port: 8080, + } + + const actual = bindAddrFromArgs(addr, args) + const expected = { + host: "coder", + port: 8080, + } + + expect(actual).toStrictEqual(expected) + }) + + it("should use process.env.CODE_SERVER_HOST if set", () => { + const [setValue, resetValue] = useEnv("CODE_SERVER_HOST") + setValue("coder") + + const args: UserProvidedArgs = {} + + const addr = { + host: "localhost", + port: 8080, + } + + const actual = bindAddrFromArgs(addr, args) + const expected = { + host: "coder", + port: 8080, + } + + expect(actual).toStrictEqual(expected) + resetValue() + }) + + it("should use the args.host over process.env.CODE_SERVER_HOST if both set", () => { + const [setValue, resetValue] = useEnv("CODE_SERVER_HOST") + setValue("coder") + + const args: UserProvidedArgs = { + host: "123.123.123.123", + } + + const addr = { + host: "localhost", + port: 8080, + } + + const actual = bindAddrFromArgs(addr, args) + const expected = { + host: "123.123.123.123", + port: 8080, + } + + expect(actual).toStrictEqual(expected) + resetValue() + }) + + it("should use process.env.PORT if set", () => { + const [setValue, resetValue] = useEnv("PORT") + setValue("8000") + + const args: UserProvidedArgs = {} + + const addr = { + host: "localhost", + port: 8080, + } + + const actual = bindAddrFromArgs(addr, args) + const expected = { + host: "localhost", + port: 8000, + } + + expect(actual).toStrictEqual(expected) + resetValue() + }) + + it("should set port if in args", () => { + const args: UserProvidedArgs = { + port: 3000, + } + + const addr = { + host: "localhost", + port: 8080, + } + + const actual = bindAddrFromArgs(addr, args) + const expected = { + host: "localhost", + port: 3000, + } + + expect(actual).toStrictEqual(expected) + }) + + it("should use the args.port over process.env.PORT if both set", () => { + const [setValue, resetValue] = useEnv("PORT") + setValue("8000") + + const args: UserProvidedArgs = { + port: 3000, + } + + const addr = { + host: "localhost", + port: 8080, + } + + const actual = bindAddrFromArgs(addr, args) + const expected = { + host: "localhost", + port: 3000, + } + + expect(actual).toStrictEqual(expected) + resetValue() + }) +}) + +describe("defaultConfigFile", () => { + it("should return the default config file as a string", async () => { + const password = await generatePassword() + const actual = defaultConfigFile(password) + + expect(actual).toMatch(`bind-addr: 127.0.0.1:8080 +auth: password +password: ${password} +cert: false`) + }) +}) + +describe("toCodeArgs", () => { + const vscodeDefaults = { + ...defaults, + help: false, + port: "8080", + version: false, + log: undefined, + } + + const testName = "vscode-args" + beforeAll(async () => { + // Clean up temporary directories from the previous run. + await clean(testName) + }) + + it("should convert empty args", async () => { + expect(await toCodeArgs(await setDefaults(parse([])))).toStrictEqual({ + ...vscodeDefaults, + }) + }) + + it("should ignore regular file", async () => { + const file = path.join(await tmpdir(testName), "file") + await fs.writeFile(file, "foobar") + expect(await toCodeArgs(await setDefaults(parse([file])))).toStrictEqual({ + ...vscodeDefaults, + _: [file], + }) + }) +}) + +describe("optionDescriptions", () => { + it("should return the descriptions of all the available options", () => { + const expectedOptionDescriptions = Object.entries(options) + .flat() + .filter((item: any) => { + if (item.description) { + return item.description + } + }) + .map((item: any) => item.description) + const actualOptionDescriptions = optionDescriptions() + // We need both the expected and the actual + // Both of these are string[] + // We then loop through the expectedOptionDescriptions + // and check that this expectedDescription exists in the + // actualOptionDescriptions + + // To do that we need to loop through actualOptionDescriptions + // and make sure we have a substring match + expectedOptionDescriptions.forEach((expectedDescription) => { + const exists = actualOptionDescriptions.find((desc) => { + if ( + desc.replace(/\n/g, " ").replace(/ /g, "").includes(expectedDescription.replace(/\n/g, " ").replace(/ /g, "")) + ) { + return true + } + return false + }) + expect(exists).toBeTruthy() + }) + }) + it("should visually align multiple options", () => { + const opts: Partial>> = { + "cert-key": { type: "string", path: true, description: "Path to certificate key when using non-generated cert." }, + "cert-host": { + type: "string", + description: "Hostname to use when generating a self signed certificate.", + }, + "disable-update-check": { + type: "boolean", + description: + "Disable update check. Without this flag, code-server checks every 6 hours against the latest github release and \n" + + "then notifies you once every week that a new release is available.", + }, + } + expect(optionDescriptions(opts)).toStrictEqual([ + " --cert-key Path to certificate key when using non-generated cert.", + " --cert-host Hostname to use when generating a self signed certificate.", + ` --disable-update-check Disable update check. Without this flag, code-server checks every 6 hours against the latest github release and + then notifies you once every week that a new release is available.`, + ]) + }) + it("should add all valid options for enumerated types", () => { + const opts: Partial>> = { + auth: { type: AuthType, description: "The type of authentication to use." }, + } + expect(optionDescriptions(opts)).toStrictEqual([" --auth The type of authentication to use. [password, none]"]) + }) + + it("should show if an option is deprecated", () => { + const opts: Partial>> = { + cert: { + type: OptionalString, + description: "foo", + deprecated: true, + }, + } + expect(optionDescriptions(opts)).toStrictEqual([" --cert (deprecated) foo"]) + }) + + it("should show newlines in description", () => { + const opts: Partial>> = { + "install-extension": { + type: "string[]", + description: + "Install or update a VS Code extension by id or vsix. The identifier of an extension is `${publisher}.${name}`.\n" + + "To install a specific version provide `@${version}`. For example: 'vscode.csharp@1.2.3'.", + }, + } + expect(optionDescriptions(opts)).toStrictEqual([ + ` --install-extension Install or update a VS Code extension by id or vsix. The identifier of an extension is \`\${publisher}.\${name}\`. + To install a specific version provide \`@\${version}\`. For example: 'vscode.csharp@1.2.3'.`, + ]) + }) +}) diff --git a/test/unit/node/constants.test.ts b/test/unit/node/constants.test.ts new file mode 100644 index 000000000000..2ed963f87ba3 --- /dev/null +++ b/test/unit/node/constants.test.ts @@ -0,0 +1,143 @@ +import { logger } from "@coder/logger" +import path from "path" +import * as semver from "semver" +import { mockLogger } from "../../utils/helpers" + +describe("constants", () => { + let constants: typeof import("../../../src/node/constants") + + describe("with package.json defined", () => { + const mockPackageJson = { + name: "mock-code-server", + description: "Run VS Code on a remote server.", + repository: "https://github.com/coder/code-server", + version: "1.0.0", + commit: "f6b2be2838f4afb217c2fd8f03eafedd8d55ef9b", + } + + const mockCodePackageJson = { + name: "mock-vscode", + version: "1.2.3", + } + + beforeAll(() => { + jest.clearAllMocks() + mockLogger() + jest.mock(path.resolve(__dirname, "../../../package.json"), () => mockPackageJson, { virtual: true }) + jest.mock(path.resolve(__dirname, "../../../lib/vscode/package.json"), () => mockCodePackageJson, { + virtual: true, + }) + constants = require("../../../src/node/constants") + }) + + afterAll(() => { + jest.resetModules() + }) + + it("should provide the commit", () => { + expect(constants.commit).toBe(mockPackageJson.commit) + }) + + it("should return the package.json version", () => { + expect(constants.version).toBe(mockPackageJson.version) + + // Ensure the version is parseable as semver and equal + const actual = semver.parse(constants.version) + const expected = semver.parse(mockPackageJson.version) + expect(actual).toBeTruthy() + expect(actual).toStrictEqual(expected) + }) + + it("should include embedded Code version information", () => { + expect(constants.codeVersion).toBe(mockCodePackageJson.version) + + // Ensure the version is parseable as semver and equal + const actual = semver.parse(constants.codeVersion) + const expected = semver.parse(mockCodePackageJson.version) + expect(actual).toBeTruthy() + expect(actual).toStrictEqual(expected) + }) + + it("should return a human-readable version string", () => { + expect(constants.getVersionString()).toStrictEqual( + `${mockPackageJson.version} ${mockPackageJson.commit} with Code ${mockCodePackageJson.version}`, + ) + }) + + it("should return a machine-readable version string", () => { + expect(constants.getVersionJsonString()).toStrictEqual( + JSON.stringify({ + codeServer: mockPackageJson.version, + commit: mockPackageJson.commit, + vscode: mockCodePackageJson.version, + }), + ) + }) + + describe("getPackageJson", () => { + it("should log a warning if package.json not found", () => { + const expectedErrorMessage = "Cannot find module './package.json' from 'src/node/constants.ts'" + + constants.getPackageJson("./package.json") + + expect(logger.warn).toHaveBeenCalled() + expect(logger.warn).toHaveBeenCalledWith(expectedErrorMessage) + }) + + it("should find the package.json", () => { + // the function calls require from src/node/constants + // so to get the root package.json we need to use ../../ + const packageJson = constants.getPackageJson("../../package.json") + expect(packageJson).toStrictEqual(mockPackageJson) + + const codePackageJson = constants.getPackageJson("../../lib/vscode/package.json") + expect(codePackageJson).toStrictEqual(mockCodePackageJson) + }) + }) + }) + + describe("with incomplete package.json", () => { + const mockPackageJson = { + name: "mock-code-server", + } + const mockCodePackageJson = { + name: "mock-vscode", + } + + beforeAll(() => { + jest.clearAllMocks() + jest.mock(path.resolve(__dirname, "../../../package.json"), () => mockPackageJson, { virtual: true }) + jest.mock(path.resolve(__dirname, "../../../lib/vscode/package.json"), () => mockCodePackageJson, { + virtual: true, + }) + constants = require("../../../src/node/constants") + }) + + afterAll(() => { + jest.resetModules() + }) + + it("version should return 'development'", () => { + expect(constants.version).toBe("development") + }) + + it("commit should return 'development'", () => { + expect(constants.commit).toBe("development") + }) + + it("should return a human-readable version string", () => { + // this string is not super useful + expect(constants.getVersionString()).toStrictEqual("development development with Code development") + }) + + it("should return a machine-readable version string", () => { + expect(constants.getVersionJsonString()).toStrictEqual( + JSON.stringify({ + codeServer: "development", + commit: "development", + vscode: "development", + }), + ) + }) + }) +}) diff --git a/test/unit/node/heart.test.ts b/test/unit/node/heart.test.ts new file mode 100644 index 000000000000..7ad0d21752f2 --- /dev/null +++ b/test/unit/node/heart.test.ts @@ -0,0 +1,162 @@ +import { logger } from "@coder/logger" +import { readFile, writeFile, stat, utimes } from "fs/promises" +import { Heart } from "../../../src/node/heart" +import { clean, mockLogger, tmpdir } from "../../utils/helpers" + +const mockIsActive = (resolveTo: boolean) => jest.fn().mockResolvedValue(resolveTo) + +describe("Heart", () => { + const testName = "heartTests" + let testDir = "" + let heart: Heart + + beforeAll(async () => { + mockLogger() + await clean(testName) + testDir = await tmpdir(testName) + }) + beforeEach(() => { + heart = new Heart(`${testDir}/shutdown.txt`, mockIsActive(true)) + }) + afterAll(() => { + jest.restoreAllMocks() + }) + afterEach(() => { + jest.resetAllMocks() + jest.useRealTimers() + if (heart) { + heart.dispose() + } + }) + it("should write to a file when given a valid file path", async () => { + // Set up heartbeat file with contents + const text = "test" + const pathToFile = `${testDir}/file.txt` + await writeFile(pathToFile, text) + const fileContents = await readFile(pathToFile, { encoding: "utf8" }) + // Explicitly set the modified time to 0 so that we can check + // that the file was indeed modified after calling heart.beat(). + // This works around any potential race conditions. + // Docs: https://nodejs.org/api/fs.html#fspromisesutimespath-atime-mtime + await utimes(pathToFile, 0, 0) + + expect(fileContents).toBe(text) + + heart = new Heart(pathToFile, mockIsActive(true)) + await heart.beat() + // Check that the heart wrote to the heartbeatFilePath and overwrote our text + const fileContentsAfterBeat = await readFile(pathToFile, { encoding: "utf8" }) + expect(fileContentsAfterBeat).not.toBe(text) + // Make sure the modified timestamp was updated. + const fileStatusAfterEdit = await stat(pathToFile) + expect(fileStatusAfterEdit.mtimeMs).toBeGreaterThan(0) + }) + it("should log a warning when given an invalid file path", async () => { + heart = new Heart(`fakeDir/fake.txt`, mockIsActive(false)) + await heart.beat() + expect(logger.warn).toHaveBeenCalled() + }) + it("should be active after calling beat", async () => { + await heart.beat() + + const isAlive = heart.alive() + expect(isAlive).toBe(true) + }) + it("should not be active after dispose is called", () => { + heart.dispose() + + const isAlive = heart.alive() + expect(isAlive).toBe(false) + }) + it("should beat twice without warnings", async () => { + // Use fake timers so we can speed up setTimeout + jest.useFakeTimers() + heart = new Heart(`${testDir}/hello.txt`, mockIsActive(true)) + await heart.beat() + // we need to speed up clocks, timeouts + // call heartbeat again (and it won't be alive I think) + // then assert no warnings were called + jest.runAllTimers() + expect(logger.warn).not.toHaveBeenCalled() + }) +}) + +describe("heartbeatTimer", () => { + const testName = "heartbeatTimer" + let testDir = "" + beforeAll(async () => { + await clean(testName) + testDir = await tmpdir(testName) + mockLogger() + }) + afterAll(() => { + jest.restoreAllMocks() + }) + beforeEach(() => { + jest.useFakeTimers() + }) + afterEach(() => { + jest.resetAllMocks() + jest.clearAllTimers() + jest.useRealTimers() + }) + it("should call isActive when timeout expires", async () => { + const isActive = true + const mockIsActive = jest.fn().mockResolvedValue(isActive) + const heart = new Heart(`${testDir}/shutdown.txt`, mockIsActive) + await heart.beat() + jest.advanceTimersByTime(60 * 1000) + expect(mockIsActive).toHaveBeenCalled() + }) + it("should log a warning when isActive rejects", async () => { + const errorMsg = "oh no" + const error = new Error(errorMsg) + const mockIsActive = jest.fn().mockRejectedValue(error) + const heart = new Heart(`${testDir}/shutdown.txt`, mockIsActive) + await heart.beat() + jest.advanceTimersByTime(60 * 1000) + + expect(mockIsActive).toHaveBeenCalled() + expect(logger.warn).toHaveBeenCalledWith(errorMsg) + }) +}) + +describe("stateChange", () => { + const testName = "stateChange" + let testDir = "" + let heart: Heart + beforeAll(async () => { + await clean(testName) + testDir = await tmpdir(testName) + mockLogger() + }) + afterAll(() => { + jest.restoreAllMocks() + }) + afterEach(() => { + jest.resetAllMocks() + if (heart) { + heart.dispose() + } + }) + it("should change to alive after a beat", async () => { + heart = new Heart(`${testDir}/shutdown.txt`, mockIsActive(true)) + const mockOnChange = jest.fn() + heart.onChange(mockOnChange) + await heart.beat() + + expect(mockOnChange.mock.calls[0][0]).toBe("alive") + }) + it.only("should change to expired when not active", async () => { + jest.useFakeTimers() + heart = new Heart(`${testDir}/shutdown.txt`, () => new Promise((resolve) => resolve(false))) + const mockOnChange = jest.fn() + heart.onChange(mockOnChange) + await heart.beat() + + await jest.advanceTimersByTime(60 * 1000) + expect(mockOnChange.mock.calls[1][0]).toBe("expired") + jest.clearAllTimers() + jest.useRealTimers() + }) +}) diff --git a/test/unit/node/http.test.ts b/test/unit/node/http.test.ts new file mode 100644 index 000000000000..d15633a28329 --- /dev/null +++ b/test/unit/node/http.test.ts @@ -0,0 +1,127 @@ +import { getMockReq } from "@jest-mock/express" +import * as http from "../../../src/node/http" +import { mockLogger } from "../../utils/helpers" + +describe("http", () => { + beforeEach(() => { + mockLogger() + }) + + afterEach(() => { + jest.clearAllMocks() + }) + + it("should construct a relative path to the root", () => { + expect(http.relativeRoot("/")).toStrictEqual(".") + expect(http.relativeRoot("/foo")).toStrictEqual(".") + expect(http.relativeRoot("/foo/")).toStrictEqual("./..") + expect(http.relativeRoot("/foo/bar ")).toStrictEqual("./..") + expect(http.relativeRoot("/foo/bar/")).toStrictEqual("./../..") + }) + + describe("origin", () => { + ;[ + { + origin: "", + host: "", + }, + { + origin: "http://localhost:8080/", + host: "", + expected: "no host headers", + }, + { + origin: "http://localhost:8080/", + host: " ", + expected: "does not match", + }, + { + origin: "http://localhost:8080/", + host: "localhost:8080", + }, + { + origin: "http://localhost:8080/", + host: "localhost:8081", + expected: "does not match", + }, + { + origin: "localhost:8080", + host: "localhost:8080", + expected: "does not match", // Gets parsed as host: localhost and path: 8080. + }, + { + origin: "test.org", + host: "localhost:8080", + expected: "malformed", // Parsing fails completely. + }, + ].forEach((test) => { + ;[ + ["host", test.host], + ["x-forwarded-host", test.host], + ["x-forwarded-host", `${test.host}, ${test.host}`], + ["forwarded", `for=127.0.0.1, host=${test.host}, proto=http`], + ["forwarded", `for=127.0.0.1;proto=http;host=${test.host}`], + ["forwarded", `proto=http;host=${test.host}, for=127.0.0.1`], + ].forEach(([key, value]) => { + it(`${test.origin} -> [${key}: ${value}]`, () => { + const req = getMockReq({ + originalUrl: "localhost:8080", + headers: { + origin: test.origin, + [key]: value, + }, + args: {}, + }) + if (typeof test.expected === "string") { + expect(() => http.authenticateOrigin(req)).toThrow(test.expected) + } else { + expect(() => http.authenticateOrigin(req)).not.toThrow() + } + }) + }) + }) + }) + + describe("constructRedirectPath", () => { + it("should preserve slashes in queryString so they are human-readable", () => { + const mockReq = getMockReq({ + originalUrl: "localhost:8080", + }) + const mockQueryParams = { folder: "/Users/jp/dev/coder" } + const mockTo = "" + const actual = http.constructRedirectPath(mockReq, mockQueryParams, mockTo) + const expected = "./?folder=/Users/jp/dev/coder" + expect(actual).toBe(expected) + }) + it("should use an empty string if no query params", () => { + const mockReq = getMockReq({ + originalUrl: "localhost:8080", + }) + const mockQueryParams = {} + const mockTo = "" + const actual = http.constructRedirectPath(mockReq, mockQueryParams, mockTo) + const expected = "./" + expect(actual).toBe(expected) + }) + it("should append the 'to' path relative to the originalUrl", () => { + const mockReq = getMockReq({ + originalUrl: "localhost:8080", + }) + const mockQueryParams = {} + const mockTo = "vscode" + const actual = http.constructRedirectPath(mockReq, mockQueryParams, mockTo) + const expected = "./vscode" + expect(actual).toBe(expected) + }) + it("should append append queryParams after 'to' path", () => { + const mockReq = getMockReq({ + originalUrl: "localhost:8080", + }) + const mockQueryParams = { folder: "/Users/jp/dev/coder" } + const mockTo = "vscode" + const actual = http.constructRedirectPath(mockReq, mockQueryParams, mockTo) + const expected = "./vscode?folder=/Users/jp/dev/coder" + expect(actual).toBe(expected) + }) + }) +}) diff --git a/test/unit/node/i18n.test.ts b/test/unit/node/i18n.test.ts new file mode 100644 index 000000000000..90b10d04822c --- /dev/null +++ b/test/unit/node/i18n.test.ts @@ -0,0 +1,154 @@ +import { promises as fs } from "fs" +import * as os from "os" +import * as path from "path" +import { loadCustomStrings } from "../../../src/node/i18n" + +describe("i18n", () => { + let tempDir: string + let validJsonFile: string + let invalidJsonFile: string + let nonExistentFile: string + + beforeEach(async () => { + // Create temporary directory for test files + tempDir = await fs.mkdtemp(path.join(os.tmpdir(), "code-server-i18n-test-")) + + // Create test files + validJsonFile = path.join(tempDir, "valid.json") + invalidJsonFile = path.join(tempDir, "invalid.json") + nonExistentFile = path.join(tempDir, "does-not-exist.json") + + // Write valid JSON file + await fs.writeFile( + validJsonFile, + JSON.stringify({ + WELCOME: "Custom Welcome", + LOGIN_TITLE: "My Custom App", + LOGIN_BELOW: "Please log in to continue", + }), + ) + + // Write invalid JSON file + await fs.writeFile(invalidJsonFile, '{"WELCOME": "Missing closing quote}') + }) + + afterEach(async () => { + // Clean up temporary directory + await fs.rmdir(tempDir, { recursive: true }) + }) + + describe("loadCustomStrings", () => { + it("should load valid JSON file successfully", async () => { + // Should not throw an error + await expect(loadCustomStrings(validJsonFile)).resolves.toBeUndefined() + }) + + it("should throw clear error for non-existent file", async () => { + await expect(loadCustomStrings(nonExistentFile)).rejects.toThrow( + `Custom strings file not found: ${nonExistentFile}\nPlease ensure the file exists and is readable.`, + ) + }) + + it("should throw clear error for invalid JSON", async () => { + await expect(loadCustomStrings(invalidJsonFile)).rejects.toThrow( + `Invalid JSON in custom strings file: ${invalidJsonFile}`, + ) + }) + + it("should handle empty JSON object", async () => { + const emptyJsonFile = path.join(tempDir, "empty.json") + await fs.writeFile(emptyJsonFile, "{}") + + await expect(loadCustomStrings(emptyJsonFile)).resolves.toBeUndefined() + }) + + it("should handle nested JSON objects", async () => { + const nestedJsonFile = path.join(tempDir, "nested.json") + await fs.writeFile( + nestedJsonFile, + JSON.stringify({ + WELCOME: "Hello World", + NESTED: { + KEY: "Value", + }, + }), + ) + + await expect(loadCustomStrings(nestedJsonFile)).resolves.toBeUndefined() + }) + + it("should handle special characters and unicode", async () => { + const unicodeJsonFile = path.join(tempDir, "unicode.json") + await fs.writeFile( + unicodeJsonFile, + JSON.stringify({ + WELCOME: "欢迎来到 code-server", + LOGIN_TITLE: "Willkommen bei {{app}}", + SPECIAL: "Special chars: àáâãäåæçèéêë 🚀 ♠️ ∆", + }), + "utf8", + ) + + await expect(loadCustomStrings(unicodeJsonFile)).resolves.toBeUndefined() + }) + + it("should handle generic errors that are not ENOENT or SyntaxError", async () => { + const testFile = path.join(tempDir, "test.json") + await fs.writeFile(testFile, "{}") + + // Mock fs.readFile to throw a generic error + const originalReadFile = fs.readFile + const mockError = new Error("Permission denied") + fs.readFile = jest.fn().mockRejectedValue(mockError) + + await expect(loadCustomStrings(testFile)).rejects.toThrow( + `Failed to load custom strings from ${testFile}: Permission denied`, + ) + + // Restore original function + fs.readFile = originalReadFile + }) + + it("should handle errors that are not Error instances", async () => { + const testFile = path.join(tempDir, "test.json") + await fs.writeFile(testFile, "{}") + + // Mock fs.readFile to throw a non-Error object + const originalReadFile = fs.readFile + fs.readFile = jest.fn().mockRejectedValue("String error") + + await expect(loadCustomStrings(testFile)).rejects.toThrow( + `Failed to load custom strings from ${testFile}: String error`, + ) + + // Restore original function + fs.readFile = originalReadFile + }) + + it("should handle null/undefined errors", async () => { + const testFile = path.join(tempDir, "test.json") + await fs.writeFile(testFile, "{}") + + // Mock fs.readFile to throw null + const originalReadFile = fs.readFile + fs.readFile = jest.fn().mockRejectedValue(null) + + await expect(loadCustomStrings(testFile)).rejects.toThrow(`Failed to load custom strings from ${testFile}: null`) + + // Restore original function + fs.readFile = originalReadFile + }) + + it("should complete without errors for valid input", async () => { + const testFile = path.join(tempDir, "resource-test.json") + const customStrings = { + WELCOME: "Custom Welcome Message", + LOGIN_TITLE: "Custom Login Title", + } + await fs.writeFile(testFile, JSON.stringify(customStrings)) + + // Should not throw any errors + await expect(loadCustomStrings(testFile)).resolves.toBeUndefined() + }) + }) +}) diff --git a/test/unit/node/main.test.ts b/test/unit/node/main.test.ts new file mode 100644 index 000000000000..39ba2ca8bf9b --- /dev/null +++ b/test/unit/node/main.test.ts @@ -0,0 +1,176 @@ +import { promises as fs } from "fs" +import * as path from "path" +import { setDefaults, parse } from "../../../src/node/cli" +import { loadCustomStrings } from "../../../src/node/i18n" +import { tmpdir } from "../../utils/helpers" + +// Mock the i18n module +jest.mock("../../../src/node/i18n", () => ({ + loadCustomStrings: jest.fn(), +})) + +// Mock logger to avoid console output during tests +jest.mock("@coder/logger", () => ({ + logger: { + info: jest.fn(), + debug: jest.fn(), + warn: jest.fn(), + error: jest.fn(), + named: jest.fn(), + level: 0, + }, + field: jest.fn(), + Level: { + Trace: 0, + Debug: 1, + Info: 2, + Warn: 3, + Error: 4, + }, +})) + +const mockedLoadCustomStrings = loadCustomStrings as jest.MockedFunction + +describe("main", () => { + let tempDir: string + let mockServer: any + + beforeEach(async () => { + tempDir = await tmpdir("code-server-main-test") + + // Reset mocks + jest.clearAllMocks() + + // Mock the server creation to avoid actually starting a server + mockServer = { + server: { + listen: jest.fn(), + address: jest.fn(() => ({ address: "127.0.0.1", port: 8080 })), + close: jest.fn(), + }, + editorSessionManagerServer: { + address: jest.fn(() => null), + }, + dispose: jest.fn(), + } + }) + + afterEach(async () => { + // Clean up temp directory + try { + await fs.rmdir(tempDir, { recursive: true }) + } catch (error) { + // Ignore cleanup errors + } + }) + + describe("runCodeServer", () => { + it("should load custom strings when i18n flag is provided", async () => { + // Create a test custom strings file + const customStringsFile = path.join(tempDir, "custom-strings.json") + await fs.writeFile( + customStringsFile, + JSON.stringify({ + WELCOME: "Custom Welcome", + LOGIN_TITLE: "My App", + }), + ) + + // Create args with i18n flag + const cliArgs = parse([ + `--config=${path.join(tempDir, "config.yaml")}`, + `--user-data-dir=${tempDir}`, + "--bind-addr=localhost:0", + "--log=warn", + "--auth=none", + `--i18n=${customStringsFile}`, + ]) + const args = await setDefaults(cliArgs) + + // Mock the app module + jest.doMock("../../../src/node/app", () => ({ + createApp: jest.fn().mockResolvedValue(mockServer), + ensureAddress: jest.fn().mockReturnValue(new URL("http://localhost:8080/")), + })) + + // Mock routes module + jest.doMock("../../../src/node/routes", () => ({ + register: jest.fn().mockResolvedValue({ disposeRoutes: jest.fn() }), + })) + + // Mock loadCustomStrings to succeed + mockedLoadCustomStrings.mockResolvedValue(undefined) + + // Import runCodeServer after mocking + const mainModule = await import("../../../src/node/main") + const result = await mainModule.runCodeServer(args) + + // Verify that loadCustomStrings was called with the correct file path + expect(mockedLoadCustomStrings).toHaveBeenCalledWith(customStringsFile) + expect(mockedLoadCustomStrings).toHaveBeenCalledTimes(1) + + // Clean up + await result.dispose() + }) + + it("should not load custom strings when i18n flag is not provided", async () => { + // Create args without i18n flag + const cliArgs = parse([ + `--config=${path.join(tempDir, "config.yaml")}`, + `--user-data-dir=${tempDir}`, + "--bind-addr=localhost:0", + "--log=warn", + "--auth=none", + ]) + const args = await setDefaults(cliArgs) + + // Mock the app module + jest.doMock("../../../src/node/app", () => ({ + createApp: jest.fn().mockResolvedValue(mockServer), + ensureAddress: jest.fn().mockReturnValue(new URL("http://localhost:8080/")), + })) + + // Mock routes module + jest.doMock("../../../src/node/routes", () => ({ + register: jest.fn().mockResolvedValue({ disposeRoutes: jest.fn() }), + })) + + // Import runCodeServer after mocking + const mainModule = await import("../../../src/node/main") + const result = await mainModule.runCodeServer(args) + + // Verify that loadCustomStrings was NOT called + expect(mockedLoadCustomStrings).not.toHaveBeenCalled() + + // Clean up + await result.dispose() + }) + + it("should handle errors when loadCustomStrings fails", async () => { + // Create args with i18n flag pointing to non-existent file + const nonExistentFile = path.join(tempDir, "does-not-exist.json") + const cliArgs = parse([ + `--config=${path.join(tempDir, "config.yaml")}`, + `--user-data-dir=${tempDir}`, + "--bind-addr=localhost:0", + "--log=warn", + "--auth=none", + `--i18n=${nonExistentFile}`, + ]) + const args = await setDefaults(cliArgs) + + // Mock loadCustomStrings to throw an error + const mockError = new Error("Custom strings file not found") + mockedLoadCustomStrings.mockRejectedValue(mockError) + + // Import runCodeServer after mocking + const mainModule = await import("../../../src/node/main") + + // Verify that runCodeServer throws the error from loadCustomStrings + await expect(mainModule.runCodeServer(args)).rejects.toThrow("Custom strings file not found") + + // Verify that loadCustomStrings was called + expect(mockedLoadCustomStrings).toHaveBeenCalledWith(nonExistentFile) + }) + }) +}) diff --git a/test/unit/node/proxy.test.ts b/test/unit/node/proxy.test.ts new file mode 100644 index 000000000000..b3509ed640df --- /dev/null +++ b/test/unit/node/proxy.test.ts @@ -0,0 +1,347 @@ +import * as express from "express" +import * as http from "http" +import nodeFetch from "node-fetch" +import { HttpCode } from "../../../src/common/http" +import { proxy } from "../../../src/node/proxy" +import { wss, Router as WsRouter } from "../../../src/node/wsRouter" +import { getAvailablePort, mockLogger } from "../../utils/helpers" +import * as httpserver from "../../utils/httpserver" +import * as integration from "../../utils/integration" + +describe("proxy", () => { + const nhooyrDevServer = new httpserver.HttpServer() + const wsApp = express.default() + const wsRouter = WsRouter() + let codeServer: httpserver.HttpServer | undefined + let proxyPath: string + let absProxyPath: string + let e: express.Express + + beforeAll(async () => { + wsApp.use("/", wsRouter.router) + await nhooyrDevServer.listen((req, res) => { + e(req, res) + }) + nhooyrDevServer.listenUpgrade(wsApp) + proxyPath = `/proxy/${nhooyrDevServer.port()}/wsup` + absProxyPath = proxyPath.replace("/proxy/", "/absproxy/") + }) + + afterAll(async () => { + await nhooyrDevServer.dispose() + }) + + beforeEach(() => { + e = express.default() + mockLogger() + }) + + afterEach(async () => { + if (codeServer) { + await codeServer.dispose() + codeServer = undefined + } + jest.clearAllMocks() + }) + + it("should return 403 Forbidden if proxy is disabled", async () => { + e.get("/wsup", (req, res) => { + res.json("you cannot see this") + }) + codeServer = await integration.setup(["--auth=none", "--disable-proxy"], "") + const resp = await codeServer.fetch(proxyPath) + expect(resp.status).toBe(403) + const json = await resp.json() + expect(json).toEqual({ error: "Forbidden" }) + }) + + it("should rewrite the base path", async () => { + e.get("/wsup", (req, res) => { + res.json("asher is the best") + }) + codeServer = await integration.setup(["--auth=none"], "") + const resp = await codeServer.fetch(proxyPath) + expect(resp.status).toBe(200) + const json = await resp.json() + expect(json).toBe("asher is the best") + }) + + it("should not rewrite the base path", async () => { + e.get(absProxyPath, (req, res) => { + res.json("joe is the best") + }) + codeServer = await integration.setup(["--auth=none"], "") + const resp = await codeServer.fetch(absProxyPath) + expect(resp.status).toBe(200) + const json = await resp.json() + expect(json).toBe("joe is the best") + }) + + it("should rewrite redirects", async () => { + e.post("/wsup", (req, res) => { + res.redirect(307, "/finale") + }) + e.post("/finale", (req, res) => { + res.json("redirect success") + }) + codeServer = await integration.setup(["--auth=none"], "") + const resp = await codeServer.fetch(proxyPath, { + method: "POST", + }) + expect(resp.status).toBe(200) + expect(await resp.json()).toBe("redirect success") + }) + + it("should not rewrite redirects", async () => { + const finalePath = absProxyPath.replace("/wsup", "/finale") + e.post(absProxyPath, (req, res) => { + res.redirect(307, finalePath) + }) + e.post(finalePath, (req, res) => { + res.json("redirect success") + }) + codeServer = await integration.setup(["--auth=none"], "") + const resp = await codeServer.fetch(absProxyPath, { + method: "POST", + }) + expect(resp.status).toBe(200) + expect(await resp.json()).toBe("redirect success") + }) + + it("should allow post bodies", async () => { + e.use(express.json({ strict: false })) + e.post("/wsup", (req, res) => { + res.json(req.body) + }) + codeServer = await integration.setup(["--auth=none"], "") + const resp = await codeServer.fetch(proxyPath, { + method: "post", + body: JSON.stringify("coder is the best"), + headers: { + "Content-Type": "application/json", + }, + }) + expect(resp.status).toBe(200) + expect(await resp.json()).toBe("coder is the best") + }) + + it("should handle bad requests", async () => { + e.use(express.json({ strict: false })) + e.post("/wsup", (req, res) => { + res.json(req.body) + }) + codeServer = await integration.setup(["--auth=none"], "") + const resp = await codeServer.fetch(proxyPath, { + method: "post", + body: "coder is the best", + headers: { + "Content-Type": "application/json", + }, + }) + expect(resp.status).toBe(400) + expect(resp.statusText).toMatch("Bad Request") + }) + + it("should handle invalid routes", async () => { + e.post("/wsup", (req, res) => { + res.json(req.body) + }) + codeServer = await integration.setup(["--auth=none"], "") + const resp = await codeServer.fetch(`${proxyPath}/hello`) + expect(resp.status).toBe(404) + expect(resp.statusText).toMatch("Not Found") + }) + + it("should handle errors", async () => { + e.use(express.json({ strict: false })) + e.post("/wsup", (req, res) => { + throw new Error("BROKEN") + }) + codeServer = await integration.setup(["--auth=none"], "") + const resp = await codeServer.fetch(proxyPath, { + method: "post", + body: JSON.stringify("coder is the best"), + headers: { + "Content-Type": "application/json", + }, + }) + expect(resp.status).toBe(500) + expect(resp.statusText).toMatch("Internal Server Error") + }) + + it("should pass origin check", async () => { + wsRouter.ws("/wsup", async (req) => { + wss.handleUpgrade(req, req.ws, req.head, (ws) => { + ws.send("hello") + req.ws.resume() + }) + }) + codeServer = await integration.setup(["--auth=none"], "") + const ws = await codeServer.wsWait(proxyPath, { + headers: { + host: "localhost:8080", + origin: "https://localhost:8080/", + }, + }) + ws.terminate() + }) + + it("should fail origin check", async () => { + await expect(async () => { + codeServer = await integration.setup(["--auth=none"], "") + await codeServer.wsWait(proxyPath, { + headers: { + host: "localhost:8080", + origin: "https://evil.org/", + }, + }) + }).rejects.toThrow() + }) + + it("should proxy non-ASCII", async () => { + e.get(/.*/, (req, res) => { + res.json("ほげ") + }) + codeServer = await integration.setup(["--auth=none"], "") + const resp = await codeServer.fetch(proxyPath.replace("wsup", "ほげ")) + expect(resp.status).toBe(200) + const json = await resp.json() + expect(json).toBe("ほげ") + }) + + it("should not double-encode query variables", async () => { + const spy = jest.fn() + e.get(/.*/, (req, res) => { + spy([req.originalUrl, req.query]) + res.end() + }) + codeServer = await integration.setup(["--auth=none"], "") + for (const test of [ + { + endpoint: proxyPath, + query: { foo: "bar with spaces" }, + expected: "/wsup?foo=bar+with+spaces", + }, + { + endpoint: absProxyPath, + query: { foo: "bar with spaces" }, + expected: absProxyPath + "?foo=bar+with+spaces", + }, + { + endpoint: proxyPath, + query: { foo: "with-&-ampersand" }, + expected: "/wsup?foo=with-%26-ampersand", + }, + { + endpoint: absProxyPath, + query: { foo: "with-&-ampersand" }, + expected: absProxyPath + "?foo=with-%26-ampersand", + }, + { + endpoint: absProxyPath, + query: { foo: "ほげ ほげ" }, + expected: absProxyPath + "?foo=%E3%81%BB%E3%81%92+%E3%81%BB%E3%81%92", + }, + { + endpoint: proxyPath, + query: { foo: "ほげ ほげ" }, + expected: "/wsup?foo=%E3%81%BB%E3%81%92+%E3%81%BB%E3%81%92", + }, + ]) { + spy.mockClear() + const resp = await codeServer.fetch(test.endpoint, undefined, test.query) + expect(resp.status).toBe(200) + await resp.text() + expect(spy).toHaveBeenCalledTimes(1) + expect(spy).toHaveBeenCalledWith([test.expected, test.query]) + } + }) + + it("should allow specifying an absproxy path", async () => { + const prefixedPath = `/codeserver/app1${absProxyPath}` + e.get(prefixedPath, (req, res) => { + res.send("app being served behind a prefixed path") + }) + codeServer = await integration.setup(["--auth=none", "--abs-proxy-base-path=/codeserver/app1"], "") + const resp = await codeServer.fetch(absProxyPath) + expect(resp.status).toBe(200) + const text = await resp.text() + expect(text).toBe("app being served behind a prefixed path") + }) + + it("should not allow OPTIONS without authentication by default", async () => { + process.env.PASSWORD = "test" + codeServer = await integration.setup(["--auth=password"]) + const resp = await codeServer.fetch(proxyPath, { method: "OPTIONS" }) + expect(resp.status).toBe(401) + }) + + it("should allow OPTIONS with `skip-auth-preflight` flag", async () => { + process.env.PASSWORD = "test" + codeServer = await integration.setup(["--auth=password", "--skip-auth-preflight"]) + e.post("/wsup", (req, res) => {}) + const resp = await codeServer.fetch(proxyPath, { method: "OPTIONS" }) + expect(resp.status).toBe(200) + }) +}) + +// NOTE@jsjoeio +// Both this test suite and the one above it are very similar +// The main difference is this one uses http and node-fetch +// and specifically tests the proxy in isolation vs. using +// the httpserver abstraction we've built. +// +// Leaving this as a separate test suite for now because +// we may consider refactoring the httpserver abstraction +// in the future. +// +// If you're writing a test specifically for code in +// src/node/proxy.ts, you should probably add it to +// this test suite. +describe("proxy (standalone)", () => { + let URL = "" + let PROXY_URL = "" + let testServer: http.Server + let proxyTarget: http.Server + + beforeEach(async () => { + const PORT = await getAvailablePort() + const PROXY_PORT = await getAvailablePort() + URL = `http://localhost:${PORT}` + PROXY_URL = `http://localhost:${PROXY_PORT}` + // Define server and a proxy server + testServer = http.createServer((req, res) => { + proxy.web(req, res, { + target: PROXY_URL, + }) + }) + + proxyTarget = http.createServer((req, res) => { + res.writeHead(200, { "Content-Type": "text/plain" }) + res.end() + }) + + // Start both servers + proxyTarget.listen(PROXY_PORT) + testServer.listen(PORT) + }) + + afterEach(async () => { + testServer.close() + proxyTarget.close() + }) + + it("should return a 500 when proxy target errors ", async () => { + // Close the proxy target so that proxy errors + proxyTarget.close() + const errorResp = await nodeFetch(`${URL}/error`) + expect(errorResp.status).toBe(HttpCode.ServerError) + expect(errorResp.statusText).toBe("Internal Server Error") + }) + + it("should proxy correctly", async () => { + const resp = await nodeFetch(`${URL}/route`) + expect(resp.status).toBe(200) + expect(resp.statusText).toBe("OK") + }) +}) diff --git a/test/unit/node/routes/errors.test.ts b/test/unit/node/routes/errors.test.ts new file mode 100644 index 000000000000..ffa8f479111c --- /dev/null +++ b/test/unit/node/routes/errors.test.ts @@ -0,0 +1,35 @@ +import express from "express" +import { errorHandler } from "../../../../src/node/routes/errors" + +describe("error page is rendered for text/html requests", () => { + it("escapes any html in the error messages", async () => { + const next = jest.fn() + const err = { + code: "ENOENT", + statusCode: 404, + message: ";>hello", + } + const req = createRequest() + const res = { + status: jest.fn().mockReturnValue(this), + send: jest.fn().mockReturnValue(this), + set: jest.fn().mockReturnValue(this), + } as unknown as express.Response + + await errorHandler(err, req, res, next) + expect(res.status).toHaveBeenCalledWith(404) + expect(res.send).toHaveBeenCalledWith(expect.not.stringContaining("