diff --git a/.eslintrc.js b/.eslintrc.js index 8f82fc73..45d5dde8 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -4,42 +4,36 @@ module.exports = { browser: true, es6: true, node: true, - webextensions: true + webextensions: true, }, parser: '@typescript-eslint/parser', extends: 'standard-with-typescript', parserOptions: { sourceType: 'module', project: './tsconfig.json', - extraFileExtensions: ['.svelte'] + extraFileExtensions: ['.svelte'], }, - plugins: [ - 'svelte3', - '@typescript-eslint' - ], + plugins: ['svelte3', '@typescript-eslint'], overrides: [ { files: ['*.js', 'utils/*.js'], rules: { '@typescript-eslint/no-var-requires': 'off', - } + }, }, { files: ['*.svelte'], processor: 'svelte3/svelte3', rules: { 'import/first': 'off', - 'no-multiple-empty-lines': [ - 'error', - { max: 2 } - ], + 'no-multiple-empty-lines': ['error', { max: 2 }], // Causes false positives with reactive and auto subscriptions '@typescript-eslint/strict-boolean-expressions': 'off', '@typescript-eslint/no-unsafe-argument': 'off', 'no-sequences': 'off', 'svelte/missing-declaration': 'off', - } - } + }, + }, ], rules: { // TODO: probably want to enable some of these @@ -49,27 +43,21 @@ module.exports = { '@typescript-eslint/no-non-null-assertion': 'off', '@typescript-eslint/no-unused-expressions': 'off', - 'linebreak-style': [ - 'error', - 'unix' - ], - '@typescript-eslint/semi': [ - 'error', - 'always' - ], + 'linebreak-style': ['error', 'unix'], + '@typescript-eslint/semi': ['error', 'always'], '@typescript-eslint/no-extra-semi': 'error', '@typescript-eslint/no-unused-vars': [ 'error', { varsIgnorePattern: '^_', - argsIgnorePattern: '^_' - } + argsIgnorePattern: '^_', + }, ], '@typescript-eslint/space-before-function-paren': [ 'error', { - named: 'never' - } + named: 'never', + }, ], '@typescript-eslint/strict-boolean-expressions': [ 'error', @@ -80,22 +68,22 @@ module.exports = { allowNullableBoolean: false, allowNullableString: false, allowNullableNumber: false, - allowAny: true - } + allowAny: true, + }, ], '@typescript-eslint/prefer-nullish-coalescing': [ 'error', { ignoreConditionalTests: true, - ignoreMixedLogicalExpressions: false - } + ignoreMixedLogicalExpressions: false, + }, ], '@typescript-eslint/member-delimiter-style': [ 'error', { multiline: { delimiter: 'semi', requireLast: true }, - singleline: { delimiter: 'comma', requireLast: false } - } + singleline: { delimiter: 'comma', requireLast: false }, + }, ], }, settings: { diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml index 58f3834a..f2ec7962 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yml +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -1,7 +1,7 @@ name: Bug Report description: File a bug report -title: "[Bug]: " -labels: ["bug"] +title: '[Bug]: ' +labels: ['bug'] body: - type: checkboxes attributes: @@ -12,7 +12,7 @@ body: required: true - label: This issue is not a matter of opinion. If it is, I will use the feature suggestion issue template. required: true - - label: I have checked for a duplicate or similar issue. I made sure to check closed issues as well. + - label: I have checked for a duplicate or similar issue. I made sure to check closed issues as well. required: true - label: I am still able to reproduce the issue after I reinstall the extension. required: true @@ -25,7 +25,7 @@ body: - type: textarea attributes: label: Describe the bug - description: A clear and concise description of what the bug is. + description: A clear and concise description of what the bug is. placeholder: What's wrong? validations: required: true @@ -35,12 +35,12 @@ body: description: Step-by-step instructions to reproduce the unexpected behavior placeholder: | 1. Go to '...' - + 2. Click on '...' - + 3. Scroll down to '...' - - 4. The error looks like '...' + + 4. The error looks like '...' validations: required: true - type: textarea diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index cf2193e0..c23f6743 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -2,4 +2,4 @@ blank_issues_enabled: false contact_links: - name: LiveTL Discord url: https://discord.gg/BVpdvt7weG - about: "Not sure how to use the extension? Not sure if something is a bug? Just want to get some simple tech support? Join our discord server and ask your burning questions in the #bug-reports channel." + about: 'Not sure how to use the extension? Not sure if something is a bug? Just want to get some simple tech support? Join our discord server and ask your burning questions in the #bug-reports channel.' diff --git a/.github/ISSUE_TEMPLATE/suggestion.yml b/.github/ISSUE_TEMPLATE/suggestion.yml index 4066962b..03efe927 100644 --- a/.github/ISSUE_TEMPLATE/suggestion.yml +++ b/.github/ISSUE_TEMPLATE/suggestion.yml @@ -1,7 +1,7 @@ name: Feature request description: Suggest an idea for HyperChat -title: "[Feature]: " -labels: ["enhancement"] +title: '[Feature]: ' +labels: ['enhancement'] body: - type: checkboxes attributes: @@ -10,7 +10,7 @@ body: options: - label: This is an issue for Hyperchat, not LiveTL. I will go to [the LiveTL repo](https://github.com/LiveTL/LiveTL) to report an issue for LiveTL. required: true - - label: I have checked for a duplicate or similar issue. I made sure to check closed issues as well. + - label: I have checked for a duplicate or similar issue. I made sure to check closed issues as well. required: true - label: I am not reporting a bug. If I am, I will use the bug report issue template. required: true diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f3ffb747..5c17b223 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,14 @@ jobs: with: node-version: '24' - - run: | - npm ci - npm run lint:check - npm run build + - name: Install dependencies + run: npm ci + + - name: Lint check + run: npm run lint:check + + - name: Format check + run: npm run format:check + + - name: Build + run: npm run build diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index f8312ddc..c6763bea 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -9,14 +9,14 @@ # the `language` matrix defined below to confirm you have the correct set of # supported CodeQL languages. # -name: "CodeQL" +name: 'CodeQL' on: push: - branches: [ main ] + branches: [main] pull_request: # The branches below must be a subset of the branches above - branches: [ main ] + branches: [main] jobs: analyze: @@ -30,40 +30,40 @@ jobs: strategy: fail-fast: false matrix: - language: [ 'javascript' ] + language: ['javascript'] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] # Learn more: # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed steps: - - name: Checkout repository - uses: actions/checkout@v6 + - name: Checkout repository + uses: actions/checkout@v6 - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v1 + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v1 - # â„šī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl + # â„šī¸ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl - # âœī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language + # âœī¸ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language - #- run: | - # make bootstrap - # make release + #- run: | + # make bootstrap + # make release - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/AGENTS.md b/AGENTS.md index 954bbd57..7bc6a29e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -42,11 +42,11 @@ `src/` depends on three bare globals, declared in `src/ts/typings/vite-env.d.ts` and supplied by `vite.config.ts` for our own builds: -| Constant | Emitted literal | Meaning | -| --- | --- | --- | -| `__BROWSER__` | string — `"chrome"` / `"firefox"` | target browser | -| `__VERSION__` | string — `"3.3.0"` | version written into the manifest | -| `__MV__` | **number** — `2` / `3` | target manifest version | +| Constant | Emitted literal | Meaning | +| ------------- | --------------------------------- | --------------------------------- | +| `__BROWSER__` | string — `"chrome"` / `"firefox"` | target browser | +| `__VERSION__` | string — `"3.3.0"` | version written into the manifest | +| `__MV__` | **number** — `2` / `3` | target manifest version | `__MV__` is compared with strict equality (`__MV__ === 2`), so it must emit a **number literal**. Defining it as the string `"2"` makes every check silently diff --git a/README.md b/README.md index 53c711b6..a1f7aa89 100644 --- a/README.md +++ b/README.md @@ -7,14 +7,12 @@ [![Commit Activity](https://img.shields.io/github/commit-activity/w/LiveTL/HyperChat)](https://github.com/LiveTL/HyperChat/commits/) [![Discord](https://img.shields.io/discord/780938154437640232.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/uJrV3tmthg) - ## Install HyperChat is available in the Chrome and Firefox stores. See https://livetl.app/hyperchat/install - ## Building from Source ### Build targets diff --git a/docs/YOUTUBE_ACTIONS.md b/docs/YOUTUBE_ACTIONS.md index b7b2e5dc..2139f2d1 100644 --- a/docs/YOUTUBE_ACTIONS.md +++ b/docs/YOUTUBE_ACTIONS.md @@ -54,7 +54,7 @@ YouTube reorders context menu items. Never assume "block is item 3". Instead: - request `get_item_context_menu` -- search the response tree for endpoint *types* +- search the response tree for endpoint _types_ - prefer endpoint/type checks over label checks Examples: diff --git a/oxfmt.config.ts b/oxfmt.config.ts new file mode 100644 index 00000000..c3c7d6a0 --- /dev/null +++ b/oxfmt.config.ts @@ -0,0 +1,15 @@ +import { defineConfig } from 'oxfmt'; + +export default defineConfig({ + singleQuote: true, + tabWidth: 2, + printWidth: 120, + experimentalSortImports: { + enabled: true, + groups: [['side_effect'], ['builtin'], ['external'], ['subpath', 'internal'], ['parent'], ['sibling']], + }, + jsdoc: { + preferCodeFences: true, + separateReturnsFromParam: true, + }, +}); diff --git a/package-lock.json b/package-lock.json index 9aab66cf..d3686040 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,6 +28,7 @@ "eslint-config-standard-with-typescript": "^43.0.1", "eslint-plugin-svelte3": "^3.2.0", "npm-run-all": "^4.1.5", + "oxfmt": "^0.61.0", "patch-package": "^8.0.0", "postcss": "^8.5.18", "postcss-extend": "^1.0.5", @@ -467,6 +468,353 @@ "node": ">= 8" } }, + "node_modules/@oxfmt/binding-android-arm-eabi": { + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-android-arm-eabi/-/binding-android-arm-eabi-0.61.0.tgz", + "integrity": "sha512-BaS+1OVvg9sr+Xav0+KdWedQRcAzrdoEcwMZeqoc2F6ieC1s/t5eM35YQoRPQ7vAqkZ+p3tbQb1r9I9mrV5oGA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-android-arm64": { + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-android-arm64/-/binding-android-arm64-0.61.0.tgz", + "integrity": "sha512-of8atAV0M1egGcVOMbgZCvc10sFOP3ayQBNQV5h5G3fNq8gACdEswfFk9bzGrdbM23rtg0Coxi7np7oPLcueNw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-darwin-arm64": { + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-darwin-arm64/-/binding-darwin-arm64-0.61.0.tgz", + "integrity": "sha512-7l8+5ov4BGwtAcmpzvEik/TG3bciwyw/S3e6j5GKH7pcQqcgCVxD3AuJeP6upto+SOTBKQ4wrrdbMt0gq8fHSQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-darwin-x64": { + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-darwin-x64/-/binding-darwin-x64-0.61.0.tgz", + "integrity": "sha512-Fnz4dDDXBb7udk+DmwelNjxbD6yptyxwCqwCH2ebo4RVLxVsRfFsn/AHJC49KIltPrVokamGv4SSOsiV50DTxQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-freebsd-x64": { + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-freebsd-x64/-/binding-freebsd-x64-0.61.0.tgz", + "integrity": "sha512-mddOebKNCP+AucmzfNsk3jgbr681qAUvgMqi865GW5gWLJ/AnzXbvjQRrny0e++NAN8aphav/aRSrfFxNsNjpA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-arm-gnueabihf": { + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-0.61.0.tgz", + "integrity": "sha512-svx59iYL+DbaZGZUIoice4W0CjRXGExnbz7Re+awIb60rVxBS2KrU7Hnlx+nZYanLGLpjneUEgo/VFEKkSZAyQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-arm-musleabihf": { + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-arm-musleabihf/-/binding-linux-arm-musleabihf-0.61.0.tgz", + "integrity": "sha512-BYK9MPJPCf6d+fLKMTruThmEyCtHzQ1zLcsrTlUVkmnoXIaHAbfpeLYQwX1tkjs7W11dyzoi6HFvKcdnvX1zNg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-arm64-gnu": { + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-0.61.0.tgz", + "integrity": "sha512-QUaCNLq2/EC6G5ljOuFanl9Lgw6ZWp4co7rs4+KOMUzbGfA4Lq58FHRjjF9sVIG+93XSbo343MxFATrOU1qctA==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-arm64-musl": { + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-arm64-musl/-/binding-linux-arm64-musl-0.61.0.tgz", + "integrity": "sha512-S6uvJ6MXnRXl+zTs0CARNDvkE+cymj0EVWEKKsyKnlLlqTyQJBjw5s4D2pSIOZc+S46cy4STefzcr/sm0VzVPA==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-ppc64-gnu": { + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-0.61.0.tgz", + "integrity": "sha512-6VDlRcytvZG6UlSIdAFKDLbppo9tvPxrWzle6vHldYFMeuDPQEfMKrkwezp7FaBq1wik9ra554ZZeRPsyIkFpg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-riscv64-gnu": { + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-0.61.0.tgz", + "integrity": "sha512-KkBTYbzExpbmn15XjKPLu2fRV2PVlq+KWt+brad5rwIa03vdYoaDRWiS7raHII/dCTR6Ro4UpYUCH4t6lif4WQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-riscv64-musl": { + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-riscv64-musl/-/binding-linux-riscv64-musl-0.61.0.tgz", + "integrity": "sha512-69tzIq7sJLVB9dxYYtvMzcSSsnZHSO+U2U19O2RqDqgj6+Q4O7HjSXdaszbcgqzhsUwzSH7z5kWvk8nmf6BHTg==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-s390x-gnu": { + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-0.61.0.tgz", + "integrity": "sha512-Oqi/N0OvtOVXsPKAOOhKgGH3msRYF8BLJaNBbWiupRiKoKVyc8JRKPCfarkQJC+RgP9U8raUKLe+bNwd0HUMiA==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-x64-gnu": { + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-x64-gnu/-/binding-linux-x64-gnu-0.61.0.tgz", + "integrity": "sha512-3TKwv/ed4uwJSemAA8P9XcoqETpjQI4waquF9UilhA9Mn/dhr1PdUEXWlL74mtc6ZNfmKPA9+NEJm01nRF8CVA==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-x64-musl": { + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-x64-musl/-/binding-linux-x64-musl-0.61.0.tgz", + "integrity": "sha512-uFso4u4nLkVSlMCpgjyvWV60Gt7GvDQHnk1mmRxHIkZTMB0ljpUKwCD9FYGgN9H97x2wYl0UwEjgRZaPIuhEhw==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-openharmony-arm64": { + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-openharmony-arm64/-/binding-openharmony-arm64-0.61.0.tgz", + "integrity": "sha512-keGLkzeOvkMpNmPp4hffXWpfoSsY6e1K8++KXD4mSSfxdvM8q9QUDsYY689TB1k6Co832DZn1MnaaVx6cIBMWQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-win32-arm64-msvc": { + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-0.61.0.tgz", + "integrity": "sha512-VzsAISkFxmNhJ5LBDEL9VuH6tJsVJMtqYit2LyIUf/HLnsCe4Pg9SMOjjVQzGWt0bnpyfJ94CrqTqcpNZzK+ug==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-win32-ia32-msvc": { + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-0.61.0.tgz", + "integrity": "sha512-xv4t7yzwJoYaLB6Zv28B3W+j7brEjsyv50rLTAQgmxJzddce9fAMCxed8dSAkbWES0zz2J29nYK5FaTuD2YBHg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-win32-x64-msvc": { + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-win32-x64-msvc/-/binding-win32-x64-msvc-0.61.0.tgz", + "integrity": "sha512-6EZXFkqOwxdDYjIn3TSNnPk3ST5E5GiYd4FiM6UF/mCL/LZSfr6D6UygTfW3R1PCQP2quCKpCEGRlij8E3VYbg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, "node_modules/@rollup/pluginutils": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-4.2.1.tgz", @@ -9161,6 +9509,58 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/oxfmt": { + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/oxfmt/-/oxfmt-0.61.0.tgz", + "integrity": "sha512-DxdHBEMYpcEnHoUHjjOigUqV2TYKsvxLwUPXnVYBjgFdqrcQ/91OtwubtZ2PUodCs3sStI8R5Qw3fKNGK4e8wQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "tinypool": "2.1.0" + }, + "bin": { + "oxfmt": "bin/oxfmt" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/sponsors/Boshen" + }, + "optionalDependencies": { + "@oxfmt/binding-android-arm-eabi": "0.61.0", + "@oxfmt/binding-android-arm64": "0.61.0", + "@oxfmt/binding-darwin-arm64": "0.61.0", + "@oxfmt/binding-darwin-x64": "0.61.0", + "@oxfmt/binding-freebsd-x64": "0.61.0", + "@oxfmt/binding-linux-arm-gnueabihf": "0.61.0", + "@oxfmt/binding-linux-arm-musleabihf": "0.61.0", + "@oxfmt/binding-linux-arm64-gnu": "0.61.0", + "@oxfmt/binding-linux-arm64-musl": "0.61.0", + "@oxfmt/binding-linux-ppc64-gnu": "0.61.0", + "@oxfmt/binding-linux-riscv64-gnu": "0.61.0", + "@oxfmt/binding-linux-riscv64-musl": "0.61.0", + "@oxfmt/binding-linux-s390x-gnu": "0.61.0", + "@oxfmt/binding-linux-x64-gnu": "0.61.0", + "@oxfmt/binding-linux-x64-musl": "0.61.0", + "@oxfmt/binding-openharmony-arm64": "0.61.0", + "@oxfmt/binding-win32-arm64-msvc": "0.61.0", + "@oxfmt/binding-win32-ia32-msvc": "0.61.0", + "@oxfmt/binding-win32-x64-msvc": "0.61.0" + }, + "peerDependencies": { + "svelte": "^5.0.0", + "vite-plus": "*" + }, + "peerDependenciesMeta": { + "svelte": { + "optional": true + }, + "vite-plus": { + "optional": true + } + } + }, "node_modules/p-cancelable": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-0.4.1.tgz", @@ -14607,6 +15007,16 @@ "integrity": "sha512-XPaBkWQJdsf3pLKJV9p4qN/S+fm2Oj8AIPo1BTUhg5oxkvm9+SVEGFdhyOz7tTdUTfvxMiAs4sp6/eZO2Ew+pw==", "license": "MIT" }, + "node_modules/tinypool": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-2.1.0.tgz", + "integrity": "sha512-Pugqs6M0m7Lv1I7FtxN4aoyToKg1C4tu+/381vH35y8oENM/Ai7f7C4StcoK4/+BSw9ebcS8jRiVrORFKCALLw==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^20.0.0 || >=22.0.0" + } + }, "node_modules/tmp": { "version": "0.2.5", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.5.tgz", diff --git a/package.json b/package.json index d9cbad35..2b8e0f00 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,8 @@ "start:none": "npm run dev:chrome", "start:chrome": "cross-env AUTOLAUNCH=true npm run dev:chrome", "start:firefox": "cross-env AUTOLAUNCH=true npm run dev:firefox", + "format:check": "npm run format -- --check", + "format": "oxfmt", "lint": "npm run lint:check -- --fix", "lint:check": "eslint . --max-warnings=0", "postinstall": "patch-package" @@ -40,6 +42,7 @@ "eslint-config-standard-with-typescript": "^43.0.1", "eslint-plugin-svelte3": "^3.2.0", "npm-run-all": "^4.1.5", + "oxfmt": "^0.61.0", "patch-package": "^8.0.0", "postcss": "^8.5.18", "postcss-extend": "^1.0.5", diff --git a/postcss.config.js b/postcss.config.js index 95e263d3..b87ad146 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -9,7 +9,7 @@ const safelistSelectors = [ 'line-through', // Components with custom color prop might need its color to be whitelisted too 'bg-blue-500', - 'hover:bg-blue-400' + 'hover:bg-blue-400', ]; const safelistPatterns = [ @@ -18,7 +18,7 @@ const safelistPatterns = [ // date picker /w-.\/7/, // I'm guessing it doesn't correlate p-2.5 with p-2\.5 - /^[mphw]\w?-\d\.5$/ + /^[mphw]\w?-\d\.5$/, ]; module.exports = { @@ -33,13 +33,13 @@ module.exports = { extractors: [ { extractor, - extensions: ['svelte'] - } + extensions: ['svelte'], + }, ], safelist: { standard: safelistSelectors, - deep: safelistPatterns - } - } - } + deep: safelistPatterns, + }, + }, + }, }; diff --git a/scripts/resolve-manifest.ts b/scripts/resolve-manifest.ts index 711b4f43..1fc1d804 100644 --- a/scripts/resolve-manifest.ts +++ b/scripts/resolve-manifest.ts @@ -1,19 +1,18 @@ /** - * Resolves `{{mv2}}.` / `{{mv3}}.` key prefixes in the manifest against the - * target manifest version, dropping keys tagged for the other one. + * Resolves `{{mv2}}.` / `{{mv3}}.` key prefixes in the manifest against the target manifest version, dropping keys + * tagged for the other one. * - * Browser tags (`{{chrome}}.` / `{{firefox}}.`) are deliberately left in place: - * vite-plugin-web-extension resolves those itself from its `browser` option. + * Browser tags (`{{chrome}}.` / `{{firefox}}.`) are deliberately left in place: vite-plugin-web-extension resolves + * those itself from its `browser` option. * - * Both resolvers only match a *leading* prefix, so the MV tag has to come first - * — `{{mv3}}.{{firefox}}.background`, never `{{firefox}}.{{mv3}}.background`. - * The reverse order leaves a literal `{{mv3}}.` key in the emitted manifest. + * Both resolvers only match a _leading_ prefix, so the MV tag has to come first — `{{mv3}}.{{firefox}}.background`, + * never `{{firefox}}.{{mv3}}.background`. The reverse order leaves a literal `{{mv3}}.` key in the emitted manifest. */ const mvTag = /^\{\{mv([23])\}\}\./; export const resolveMv = (value: any, mv: 2 | 3): any => { - if (Array.isArray(value)) return value.map(item => resolveMv(item, mv)); + if (Array.isArray(value)) return value.map((item) => resolveMv(item, mv)); if (typeof value !== 'object' || value === null) return value; const resolved: Record = {}; diff --git a/scripts/verify-build.mjs b/scripts/verify-build.mjs index 80975638..c404ecf5 100644 --- a/scripts/verify-build.mjs +++ b/scripts/verify-build.mjs @@ -7,18 +7,18 @@ const hostPermissions = [ 'https://www.youtube.com/live_chat*', 'https://www.youtube.com/live_chat_replay*', 'https://studio.youtube.com/live_chat*', - 'https://studio.youtube.com/live_chat_replay*' + 'https://studio.youtube.com/live_chat_replay*', ]; const firefoxSettings = { gecko: { id: '{14a15c41-13f4-498e-986c-7f00435c4d00}', - strict_min_version: '115.0' - } + strict_min_version: '115.0', + }, }; const unresolvedKeys = (value, result = []) => { if (Array.isArray(value)) { - value.forEach(child => unresolvedKeys(child, result)); + value.forEach((child) => unresolvedKeys(child, result)); } else if (value !== null && typeof value === 'object') { for (const [key, child] of Object.entries(value)) { if (/\{\{[^}]+\}\}\./.test(key)) result.push(key); @@ -65,14 +65,14 @@ for (const target of ['chrome', 'firefox', 'mv2']) { } const files = [ - ...manifest.content_scripts.flatMap(script => [...(script.js ?? []), ...(script.css ?? [])]), + ...manifest.content_scripts.flatMap((script) => [...(script.js ?? []), ...(script.css ?? [])]), ...(manifest.background.scripts ?? []), manifest.background.service_worker, manifest.options_page, manifest.options_ui?.page, manifest.action?.default_popup, - manifest.browser_action?.default_popup - ].filter(file => typeof file === 'string'); + manifest.browser_action?.default_popup, + ].filter((file) => typeof file === 'string'); for (const file of files) { await assert.doesNotReject(access(path.join(buildDir, file)), `${target}: missing ${file}`); diff --git a/src/hyperchat.html b/src/hyperchat.html index 50ab522c..611c8469 100644 --- a/src/hyperchat.html +++ b/src/hyperchat.html @@ -1,8 +1,11 @@ - + - - + +