From d37d3fba7891c3029f2def12f26e03214367ac4a Mon Sep 17 00:00:00 2001 From: tmphost-dev Date: Fri, 23 Oct 2026 00:58:19 +0000 Subject: [PATCH] Add CI: tests, coverage gate, lint and Docker images GitHub Actions workflows: - Backend: go vet, a CGO-free build, and race tests against a Postgres service seeded from testdata/shop.sql, so the driver tests run too. - Coverage: scripts/coverage.sh fails a PR on any added Go line no test runs, or on a backend total below COVER_MIN (95%). - Frontend: vitest with its coverage thresholds, then the Vite build. - Lint: golangci-lint v2.15.0 and ESLint, warnings included. - Docker: multi-arch images, latest and sha tags on main, semver tags on v*, and a build-only check on pull requests. - Case collisions: scripts/check-case.sh on every PR. Fixes needed for the tree to pass them: - TestRunHTTPS read the certificate without holding the lock, a data race. - Toast ids came from Date.now() + Math.random() and could collide, so dismissing one toast removed another. They now come from a counter. - The Postgres fixture existed only on a dev machine; it is now committed. - Four golangci-lint and five ESLint findings (Toast.vue is ToastStack.vue). Co-Authored-By: Claude Opus 5.5 --- .dockerignore | 13 + .github/workflows/backend.yml | 94 ++ .github/workflows/case.yml | 26 + .github/workflows/docker-publish.yml | 51 + .github/workflows/docker-release.yml | 51 + .github/workflows/docker.yml | 40 + .github/workflows/frontend.yml | 49 + .github/workflows/lint.yml | 71 ++ .gitignore | 1 + AGENTS.md | 8 +- Makefile | 15 +- README.md | 20 +- backend/.golangci.yml | 14 + backend/internal/app/app_test.go | 4 +- backend/internal/controller/crud/crud_test.go | 2 +- backend/internal/controller/crud/query.go | 6 +- backend/internal/service/dbdriver/postgres.go | 3 +- .../service/dbdriver/testdata/shop.sql | 38 + .../internal/service/server/server_test.go | 8 +- frontend/eslint.config.js | 24 + frontend/package-lock.json | 1052 ++++++++++++++++- frontend/package.json | 7 +- frontend/src/App.vue | 4 +- frontend/src/bootstrap.js | 4 +- .../components/{Toast.vue => ToastStack.vue} | 0 frontend/src/composables/useToasts.js | 6 +- frontend/test/composables.test.js | 7 + scripts/coverage.sh | 63 + 28 files changed, 1655 insertions(+), 26 deletions(-) create mode 100644 .dockerignore create mode 100644 .github/workflows/backend.yml create mode 100644 .github/workflows/case.yml create mode 100644 .github/workflows/docker-publish.yml create mode 100644 .github/workflows/docker-release.yml create mode 100644 .github/workflows/docker.yml create mode 100644 .github/workflows/frontend.yml create mode 100644 .github/workflows/lint.yml create mode 100644 backend/.golangci.yml create mode 100644 backend/internal/service/dbdriver/testdata/shop.sql create mode 100644 frontend/eslint.config.js rename frontend/src/components/{Toast.vue => ToastStack.vue} (100%) create mode 100755 scripts/coverage.sh diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..b6778a6 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,13 @@ +# Local state that must not reach the build: secrets, dependencies the image +# installs itself, and build output it rebuilds. +.git +.claude +.mcp.json +**/.env +backend/_data +backend/public +backend/bin +backend/coverage.out +frontend/node_modules +frontend/dist +frontend/coverage diff --git a/.github/workflows/backend.yml b/.github/workflows/backend.yml new file mode 100644 index 0000000..c75a9a9 --- /dev/null +++ b/.github/workflows/backend.yml @@ -0,0 +1,94 @@ +name: Backend + +on: + push: + branches: + - main + paths: + - 'backend/**' + - 'scripts/coverage.sh' + - '.github/workflows/backend.yml' + pull_request: + paths: + - 'backend/**' + - 'scripts/coverage.sh' + - '.github/workflows/backend.yml' + workflow_dispatch: + +env: + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true + # The total may not drop below this. Raise it as coverage grows; new lines + # are held to 100% on pull requests regardless. + COVER_MIN: '95' + +jobs: + test: + name: Test and build + runs-on: ubuntu-latest + permissions: + contents: read + + # The Postgres driver's tests are skipped without a database; CI runs them. + services: + postgres: + image: postgres:18 + env: + POSTGRES_PASSWORD: secret + POSTGRES_DB: shop + ports: + - 5432:5432 + options: >- + --health-cmd pg_isready + --health-interval 5s + --health-timeout 5s + --health-retries 10 + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + # The base branch's history, to find the lines a pull request adds. + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + # Tracks the toolchain the module declares rather than a second copy + # of the version that would quietly drift from it. + go-version-file: backend/go.mod + cache-dependency-path: backend/go.sum + + - name: Seed the test database + # The driver's tests count the rows this fixture inserts. + run: psql "$SQLMCP_TEST_PG_DSN" -v ON_ERROR_STOP=1 -q -f internal/service/dbdriver/testdata/shop.sql + env: + SQLMCP_TEST_PG_DSN: postgres://postgres:secret@localhost:5432/shop?sslmode=disable + working-directory: backend + + - name: Vet + run: go vet ./... + working-directory: backend + + - name: Build + # As the Dockerfile builds it: Postgres is parsed by WASM, not cgo. + run: CGO_ENABLED=0 go build ./... + working-directory: backend + + - name: Test with coverage + # -coverpkg credits a handler with the lines the app's HTTP tests run + # through it. testutil is test support and cmd/server only wires main. + env: + SQLMCP_TEST_PG_DSN: postgres://postgres:secret@localhost:5432/shop?sslmode=disable + run: | + pkgs=$(go list ./... | grep -v -e /testutil -e /cmd/ | paste -sd, -) + go test -race -coverpkg="$pkgs" -coverprofile=coverage.out ./... + working-directory: backend + + - name: Enforce coverage + run: | + base= + if [ "${{ github.event_name }}" = pull_request ]; then + base=origin/${{ github.base_ref }} + fi + ./scripts/coverage.sh backend/coverage.out "$COVER_MIN" $base + echo "Backend coverage: $(cd backend && go tool cover -func=coverage.out | tail -1 | awk '{ print $NF }')" >> "$GITHUB_STEP_SUMMARY" diff --git a/.github/workflows/case.yml b/.github/workflows/case.yml new file mode 100644 index 0000000..4ae2691 --- /dev/null +++ b/.github/workflows/case.yml @@ -0,0 +1,26 @@ +name: Case collisions + +# Deliberately not filtered by path: any added file can collide with another. +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + +env: + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true + +jobs: + check: + name: No two paths differ only by case + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Check paths + run: ./scripts/check-case.sh diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..c58b6af --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,51 @@ +name: Build and Push Docker Image + +on: + push: + branches: + - main + +env: + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true + +jobs: + build-and-push: + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ secrets.DOCKERHUB_USERNAME }}/sql-mcp + tags: | + type=raw,value=latest + type=sha,prefix=,format=short + + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflows/docker-release.yml b/.github/workflows/docker-release.yml new file mode 100644 index 0000000..27cef4b --- /dev/null +++ b/.github/workflows/docker-release.yml @@ -0,0 +1,51 @@ +name: Release Docker Image on Tag + +on: + push: + tags: + - 'v*' + +env: + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true + +jobs: + release: + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ secrets.DOCKERHUB_USERNAME }}/sql-mcp + tags: | + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..486d46a --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,40 @@ +name: Docker + +# Builds the image on pull requests without pushing it, so a change that +# breaks the Dockerfile fails here rather than on main. +on: + pull_request: + paths: + - 'Dockerfile' + - '.dockerignore' + - 'backend/**' + - 'frontend/**' + - '.github/workflows/docker.yml' + workflow_dispatch: + +env: + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true + +jobs: + build: + name: Build the image + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build + # One platform: the Dockerfile is the same for both, and QEMU would + # make every pull request several minutes slower. + uses: docker/build-push-action@v6 + with: + context: . + platforms: linux/amd64 + push: false + cache-from: type=gha diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml new file mode 100644 index 0000000..b5dd1a1 --- /dev/null +++ b/.github/workflows/frontend.yml @@ -0,0 +1,49 @@ +name: Frontend + +on: + push: + branches: + - main + paths: + - 'frontend/**' + - '.github/workflows/frontend.yml' + pull_request: + paths: + - 'frontend/**' + - '.github/workflows/frontend.yml' + workflow_dispatch: + +env: + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true + +defaults: + run: + working-directory: frontend + +jobs: + test: + name: Test and build + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '26' + cache: npm + cache-dependency-path: frontend/package-lock.json + + - name: Install dependencies + run: npm ci + + - name: Test with coverage + # The thresholds live in vitest.config.js and fail the run. + run: npm run test:coverage + + - name: Build + run: npm run build diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..9654dc7 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,71 @@ +name: Lint + +on: + push: + branches: + - main + paths: + - 'backend/**' + - 'frontend/**' + - '.github/workflows/lint.yml' + pull_request: + paths: + - 'backend/**' + - 'frontend/**' + - '.github/workflows/lint.yml' + workflow_dispatch: + +env: + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true + +jobs: + go: + name: golangci-lint + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: backend/go.mod + cache-dependency-path: backend/go.sum + + - name: golangci-lint + # Rules live in backend/.golangci.yml. Pinned so a new release cannot + # fail an unchanged tree. + uses: golangci/golangci-lint-action@v9 + with: + version: v2.15.0 + working-directory: backend + + frontend: + name: ESLint + runs-on: ubuntu-latest + permissions: + contents: read + defaults: + run: + working-directory: frontend + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '26' + cache: npm + cache-dependency-path: frontend/package-lock.json + + - name: Install dependencies + run: npm ci + + - name: ESLint + # Rules live in frontend/eslint.config.js; warnings fail the run too. + run: npm run lint diff --git a/.gitignore b/.gitignore index d6365ae..52bfad5 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ backend/_data/ backend/public/ backend/bin/ +backend/coverage.out frontend/node_modules/ frontend/dist/ diff --git a/AGENTS.md b/AGENTS.md index 644d666..f56cd4e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -64,5 +64,9 @@ app state). A handler never calls the repository directly. - Cover each change with tests on both sides. The target is 100% unit coverage of new lines. `internal/testutil` has a fake engine and a fake tmphost, and `internal/app/app_test.go` drives the whole stack over HTTP. -- On this project's dev machine, Go needs `export GOPATH=$HOME/go` because - GOROOT is `~/go`. +- CI (`.github/workflows`) fails a PR on any added Go line no test runs + (`scripts/coverage.sh`), on a backend total below `COVER_MIN`, and on any + golangci-lint or ESLint finding, warnings included. Run `make lint` and + `make cover BASE=main` before pushing. Raise `COVER_MIN`, never lower it. +- On this project's dev machine Go is `/usr/local/go/bin`, not on `PATH`; + `golangci-lint` is in `~/go/bin`. diff --git a/Makefile b/Makefile index dab738c..20e6593 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: dev backend frontend build test test-backend test-frontend check-case fmt stop +.PHONY: dev backend frontend build test test-backend test-frontend check-case cover lint fmt stop # The backend, then the Vite dev server on :5173 once the backend is up. # A missing backend/.env is created with development secrets (scripts/dev-env.sh). @@ -32,6 +32,19 @@ test-backend: test-frontend: @cd frontend && npm test +# What CI enforces: the backend coverage floor (and, with BASE=, 100% of +# lines added since it), then the frontend thresholds in vitest.config.js. +# CI's floor (backend.yml) is higher because it runs the Postgres tests too. +COVER_MIN ?= 92.5 +cover: + @cd backend && go test -coverpkg=$$(go list ./... | grep -v -e /testutil -e /cmd/ | paste -sd, -) -coverprofile=coverage.out ./... + @./scripts/coverage.sh backend/coverage.out $(COVER_MIN) $(BASE) + @cd frontend && npm run test:coverage + +lint: + @cd backend && golangci-lint run ./... + @cd frontend && npm run lint + fmt: @cd backend && gofmt -w . diff --git a/README.md b/README.md index f9b0541..29bd9cc 100644 --- a/README.md +++ b/README.md @@ -147,15 +147,33 @@ GRANT SELECT (id, created_at, country) ON public.users TO sqlmcp; ```sh make test # go vet + go test, and vitest +make lint # golangci-lint (backend/.golangci.yml) and ESLint +make cover # the coverage gates CI enforces; BASE=main also checks new lines ``` -The PostgreSQL driver's tests need a database. Without one they are skipped: +The PostgreSQL driver's tests need a database seeded with +`backend/internal/service/dbdriver/testdata/shop.sql`. Without one they are +skipped: ```sh docker run -d --name sqlmcp-pg -e POSTGRES_PASSWORD=secret -e POSTGRES_DB=shop -p 55432:5432 postgres:18 +docker exec -i sqlmcp-pg psql -U postgres -d shop -v ON_ERROR_STOP=1 -q < backend/internal/service/dbdriver/testdata/shop.sql SQLMCP_TEST_PG_DSN='postgres://postgres:secret@localhost:55432/shop?sslmode=disable' make test-backend ``` +### CI + +GitHub Actions run on every pull request: Backend (vet, race tests against a +Postgres service, coverage), Frontend (vitest thresholds, build), Lint, a +Docker build, and the case-collision check. Backend coverage may not fall below +`COVER_MIN` in `.github/workflows/backend.yml` (95%; today 95.8%), and every Go line a pull +request adds must be run by a test. + +A push to `main` publishes `/sql-mcp:latest` and `:` to Docker Hub +for `linux/amd64` and `linux/arm64`; a `v*` tag publishes `:` and +`:.`. Both need the repository secrets `DOCKERHUB_USERNAME` and +`DOCKERHUB_TOKEN` (a Docker Hub access token with write scope). + The REST API is documented in [`docs/API.md`](docs/API.md). Read [`AGENTS.md`](AGENTS.md) before changing code. diff --git a/backend/.golangci.yml b/backend/.golangci.yml new file mode 100644 index 0000000..c7f8bf8 --- /dev/null +++ b/backend/.golangci.yml @@ -0,0 +1,14 @@ +version: "2" + +linters: + # The standard set: errcheck, govet, ineffassign, staticcheck, unused. + default: standard + exclusions: + # Unchecked Close, Flush and fmt.Fprint*: errors with nothing useful to do + # on failure (closing a response body, writing to a terminal). + presets: + - std-error-handling + +formatters: + enable: + - gofmt diff --git a/backend/internal/app/app_test.go b/backend/internal/app/app_test.go index 372478c..2409c45 100644 --- a/backend/internal/app/app_test.go +++ b/backend/internal/app/app_test.go @@ -296,7 +296,7 @@ func TestTmphostSettings(t *testing.T) { require.Equal(t, http.StatusFound, res.status) u, _ := url.Parse(res.header.Get("Location")) assert.Equal(t, s.tmphost.URL+"/oauth2/authorize", u.Scheme+"://"+u.Host+u.Path) - state := u.Query().Get("state") + assert.NotEmpty(t, u.Query().Get("state")) res = s.do(c, "GET", "/api/v1/settings/tmphost/callback?state=wrong&code=good-code", nil) assert.Contains(t, res.header.Get("Location"), "&tmphost=error") @@ -304,7 +304,7 @@ func TestTmphostSettings(t *testing.T) { // The flow cookie was spent by the failed attempt; start over. res = s.do(c, "GET", "/api/v1/settings/tmphost/connect", nil) u, _ = url.Parse(res.header.Get("Location")) - state = u.Query().Get("state") + state := u.Query().Get("state") res = s.do(c, "GET", "/api/v1/settings/tmphost/callback?state="+url.QueryEscape(state)+"&code=good-code", nil) assert.Equal(t, "/settings?tmphost=connected", res.header.Get("Location")) diff --git a/backend/internal/controller/crud/crud_test.go b/backend/internal/controller/crud/crud_test.go index 24dd95e..f163da1 100644 --- a/backend/internal/controller/crud/crud_test.go +++ b/backend/internal/controller/crud/crud_test.go @@ -85,7 +85,7 @@ func TestDatabaseLifecycle(t *testing.T) { for name, tc := range map[string]struct{ name, driver, dsn, want string }{ "no name": {"", "postgres", testutil.GoodDSN, "name is required"}, "long name": {strings.Repeat("x", 81), "postgres", testutil.GoodDSN, "at most 80"}, - "control char": {"a‮b", "postgres", testutil.GoodDSN, "control characters"}, + "control char": {"a\u202eb", "postgres", testutil.GoodDSN, "control characters"}, "mysql": {"m", "mysql", "x", "not available yet"}, "unknown": {"m", "oracle", "x", "unknown database engine"}, "bad dsn": {"m", "postgres", "mysql://x", "not a valid"}, diff --git a/backend/internal/controller/crud/query.go b/backend/internal/controller/crud/query.go index e36d9c4..9707392 100644 --- a/backend/internal/controller/crud/query.go +++ b/backend/internal/controller/crud/query.go @@ -69,10 +69,10 @@ func (c *Controller) RunQuery(ctx context.Context, rq QueryRequest) (*entity.Que } if rq.Source == model.SourceMCP && (rq.Store || len(res.Rows) > setup.QueryInlineRows) { url, expiresAt, err := c.storeResult(ctx, rq.UserID, row.Name, res.Columns, res.Rows) - switch { - case err == nil: + switch err { + case nil: out.ResultURL, out.ResultExpiresAt = url, expiresAt - case err == errTmphostNotConnected: + case errTmphostNotConnected: out.StoreError = "tmphost is not connected; connect it in SQL MCP settings to receive every row" default: log.Warn().Err(err).Msg("could not store a query result on tmphost") diff --git a/backend/internal/service/dbdriver/postgres.go b/backend/internal/service/dbdriver/postgres.go index 4ebb0ab..1653eb2 100644 --- a/backend/internal/service/dbdriver/postgres.go +++ b/backend/internal/service/dbdriver/postgres.go @@ -179,7 +179,8 @@ func (d *postgresDriver) Query(ctx context.Context, dsn, sql string, maxRows int if err != nil { return nil, fmt.Errorf("could not start a read-only transaction: %w", err) } - defer tx.Rollback(context.Background()) + // Read-only, so rolling back is how every transaction ends. + defer func() { _ = tx.Rollback(context.Background()) }() if _, err := tx.Exec(ctx, "select set_config('statement_timeout', $1, true)", strconv.FormatInt(timeout.Milliseconds(), 10)); err != nil { return nil, err } diff --git a/backend/internal/service/dbdriver/testdata/shop.sql b/backend/internal/service/dbdriver/testdata/shop.sql new file mode 100644 index 0000000..8c42c19 --- /dev/null +++ b/backend/internal/service/dbdriver/testdata/shop.sql @@ -0,0 +1,38 @@ +-- The database the Postgres driver's tests run against (SQLMCP_TEST_PG_DSN). +-- The tests count these rows: 120 users and 400 orders. +create table public.users ( + id integer primary key, + email text not null, + full_name text not null, + country text not null, + created_at timestamptz not null default now() +); +insert into public.users (id, email, full_name, country) +select i, 'user' || i || '@example.com', 'User ' || i, (array['DE', 'FR', 'TR', 'US'])[1 + i % 4] +from generate_series(1, 120) i; + +create table public.orders ( + id integer primary key, + user_id integer references public.users (id), + total numeric(10, 2), + created_at timestamptz not null default now() +); +insert into public.orders (id, user_id, total) +select i, 1 + i % 120, (i % 97) * 1.25 +from generate_series(1, 400) i; + +-- A second schema, so the schema listing is seen to span more than public. +create schema billing; +create table billing.cards ( + id integer primary key, + user_id integer references public.users (id), + card_number text not null +); +insert into billing.cards (id, user_id, card_number) +select i, i, '4000-0000-0000-' || lpad(i::text, 4, '0') +from generate_series(1, 10) i; + +-- The least-privileged login the README recommends. +create role reader login password 'reader'; +grant usage on schema public to reader; +grant select on public.users, public.orders to reader; diff --git a/backend/internal/service/server/server_test.go b/backend/internal/service/server/server_test.go index 63c6055..06a68aa 100644 --- a/backend/internal/service/server/server_test.go +++ b/backend/internal/service/server/server_test.go @@ -314,8 +314,14 @@ func TestRunHTTPS(t *testing.T) { s := New(Config{SSLEnabled: true, Domain: domain, SSLCacheDir: filepath.Join(t.TempDir(), "certs")}, http.NotFoundHandler()) s.obtainer = &fakeObtainer{t: t} done := run(s) + // The certificate is obtained in its own goroutine, so wait for it under + // the lock rather than racing it. + assert.Eventually(t, func() bool { + s.mu.RLock() + defer s.mu.RUnlock() + return s.usable(s.cert) + }, 5*time.Second, 10*time.Millisecond, "the managed certificate was obtained") shutdownWhenUp(t, s, done) - assert.True(t, s.usable(s.cert), "the managed certificate was obtained") } func TestRunHTTPSUsesCertificateOnDisk(t *testing.T) { diff --git a/frontend/eslint.config.js b/frontend/eslint.config.js new file mode 100644 index 0000000..972c13d --- /dev/null +++ b/frontend/eslint.config.js @@ -0,0 +1,24 @@ +import js from '@eslint/js' +import pluginVue from 'eslint-plugin-vue' +import globals from 'globals' + +export default [ + { ignores: ['dist/', 'coverage/', 'node_modules/'] }, + js.configs.recommended, + // essential: the correctness rules only. The stylistic tiers would reflow + // every template for no change in behavior. + ...pluginVue.configs['flat/essential'], + { + languageOptions: { + ecmaVersion: 'latest', + sourceType: 'module', + globals: { ...globals.browser, __APP_VERSION__: 'readonly' }, + }, + // Destructuring a key away to keep the rest is how a query param is dropped. + rules: { 'no-unused-vars': ['error', { ignoreRestSiblings: true }] }, + }, + { + files: ['test/**/*.js', '*.config.js'], + languageOptions: { globals: { ...globals.node } }, + }, +] diff --git a/frontend/package-lock.json b/frontend/package-lock.json index eb2b247..fea7009 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -14,10 +14,14 @@ "vue-router": "^5.4.0" }, "devDependencies": { + "@eslint/js": "^10.0.1", "@tailwindcss/vite": "^4.3.3", "@vitejs/plugin-vue": "^6.0.10", "@vitest/coverage-v8": "^5.0.5", "@vue/test-utils": "^2.5.1", + "eslint": "^10.13.0", + "eslint-plugin-vue": "^10.11.1", + "globals": "^17.13.0", "jsdom": "^30.1.3", "tailwindcss": "^4.3.3", "vite": "^8.3.5", @@ -126,6 +130,30 @@ "specificity": "bin/cli.js" } }, + "node_modules/@cacheable/memory": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@cacheable/memory/-/memory-2.2.0.tgz", + "integrity": "sha512-CTLKqLItRCEixEAewD3/j9DB3/o96gpTPD4eJ1v+DGOlxZRZncRQkGYqqnAGCscYd6RNeXfGeiuCphsPtqyIfQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@cacheable/utils": "^2.5.0", + "@keyv/bigmap": "^1.3.1", + "hookified": "^1.15.1", + "keyv": "^5.6.0" + } + }, + "node_modules/@cacheable/utils": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@cacheable/utils/-/utils-2.5.0.tgz", + "integrity": "sha512-buipgOVDkkPXNR5+xBpDw7Zk2n1EvU7qBJCNUcL7rhQ//kfpOXPAvQ511Os0vpLYJ1pZnvudNytkQt2hst3wqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "hashery": "^1.5.1", + "keyv": "^5.6.0" + } + }, "node_modules/@csstools/color-helpers": { "version": "6.1.2", "resolved": "https://registry.npmjs.org/@csstools/color-helpers/-/color-helpers-6.1.2.tgz", @@ -266,6 +294,134 @@ "node": ">=20.19.0" } }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.10.1.tgz", + "integrity": "sha512-cuadcxVFE8sDK6iWJbs8Sn0av2Nrh2QSGQhVlBW9AaAHqHwjWsZHT8LJ4hFGPh7ASBV2deFdM7H/DPjulmh8rg==", + "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/eslint-utils/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, + "license": "Apache-2.0", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.12.2", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.2.tgz", + "integrity": "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/config-array": { + "version": "0.23.5", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.23.5.tgz", + "integrity": "sha512-Y3kKLvC1dvTOT+oGlqNQ1XLqK6D1HU2YXPc52NmAlJZbMMWDzGYXMiPRJ8TYD39muD/OTjlZmNJ4ib7dvSrMBA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/object-schema": "^3.0.5", + "debug": "^4.3.1", + "minimatch": "^10.2.4" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/config-helpers": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.7.0.tgz", + "integrity": "sha512-DObd/KKUsU+FaFv4PLxSRenpXfQWmPXXP3pPZ6/K1PCrMu2vQpMDMuQe/BqYeoLcz8ro0bVDF1RxOJgfVEdhUw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^1.2.1" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/core": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-1.2.1.tgz", + "integrity": "sha512-MwcE1P+AZ4C6DWlpin/OmOA54mmIZ/+xZuJiQd4SyB29oAJjN30UW9wkKNptW2ctp4cEsvhlLY/CsQ1uoHDloQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@types/json-schema": "^7.0.15" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/js": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-10.0.1.tgz", + "integrity": "sha512-zeR9k5pd4gxjZ0abRoIaxdc7I3nDktoXZk2qOv9gCNWx3mVwEn32VRhyLaRsDiJjTs0xq/T8mfPtyuXu7GWBcA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "eslint": "^10.0.0" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + } + } + }, + "node_modules/@eslint/object-schema": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-3.0.5.tgz", + "integrity": "sha512-vqTaUEgxzm+YDSdElad6PiRoX4t8VGDjCtt05zn4nU810UIx/uNEV7/lZJ6KwFThKZOzOxzXy48da+No7HZaMw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/plugin-kit": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.7.3.tgz", + "integrity": "sha512-IkO+/KEUvwbVpiURZg+P7zF74z5Jxe0UgJxVni+RtoHQ6IZieXaO02kmadomap/q+l6bc/jdPGGqTjhuZnuz1Q==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^1.2.1", + "levn": "^0.4.1" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, "node_modules/@exodus/bytes": { "version": "1.16.0", "resolved": "https://registry.npmjs.org/@exodus/bytes/-/bytes-1.16.0.tgz", @@ -293,6 +449,72 @@ "url": "https://github.com/sponsors/ayuhito" } }, + "node_modules/@humanfs/core": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.2.tgz", + "integrity": "sha512-UhXNm+CFMWcbChXywFwkmhqjs3PRCmcSa/hfBgLIb7oQ5HNb1wS0icWsGtSAUNgefHeI+eBrA8I1fxmbHsGdvA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanfs/types": "^0.15.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node": { + "version": "0.16.8", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.8.tgz", + "integrity": "sha512-gE1eQNZ3R++kTzFUpdGlpmy8kDZD/MLyHqDwqjkVQI0JMdI1D51sy1H958PNXYkM2rAac7e5/CnIKZrHtPh3BQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanfs/core": "^0.19.2", + "@humanfs/types": "^0.15.0", + "@humanwhocodes/retry": "^0.4.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/types": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/@humanfs/types/-/types-0.15.0.tgz", + "integrity": "sha512-ZZ1w0aoQkwuUuC7Yf+7sdeaNfqQiiLcSRbfI08oAxqLtpXQr9AIVX7Ay7HLDuiLYAaFPu8oBYNq/QIi9URHJ3Q==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18.0" + } + }, + "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, + "license": "Apache-2.0", + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/retry": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz", + "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.13", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", @@ -338,6 +560,30 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@keyv/bigmap": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@keyv/bigmap/-/bigmap-1.3.1.tgz", + "integrity": "sha512-WbzE9sdmQtKy8vrNPa9BRnwZh5UF4s1KTmSK0KUVLo3eff5BlQNNWDnFOouNpKfPKDnms9xynJjsMYjMaT/aFQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "hashery": "^1.4.0", + "hookified": "^1.15.0" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "keyv": "^5.6.0" + } + }, + "node_modules/@keyv/serialize": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@keyv/serialize/-/serialize-1.1.1.tgz", + "integrity": "sha512-dXn3FZhPv0US+7dtJsIi2R+c7qWYiReoEh5zUntWCf4oSpMNib8FDhSoed6m3QyZdx5hK7iLFkYk3rNxwt8vTA==", + "dev": true, + "license": "MIT" + }, "node_modules/@one-ini/wasm": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/@one-ini/wasm/-/wasm-0.2.1.tgz", @@ -922,12 +1168,26 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/esrecurse": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/@types/esrecurse/-/esrecurse-4.3.1.tgz", + "integrity": "sha512-xJBAbDifo5hpffDBuHl0Y8ywswbiAp/Wi7Y/GtAgSlZyIABppyurxVueOPE8LUQOxdlgi6Zqce7uoEpqNTeiUw==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/estree": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", "license": "MIT" }, + "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/@vitejs/plugin-vue": { "version": "6.0.10", "resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-6.0.10.tgz", @@ -1250,6 +1510,33 @@ "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/ajv": { + "version": "6.15.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz", + "integrity": "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==", + "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/assertion-error": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", @@ -1416,6 +1703,13 @@ "url": "https://github.com/sponsors/antfu" } }, + "node_modules/boolbase": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", + "dev": true, + "license": "ISC" + }, "node_modules/brace-expansion": { "version": "5.0.12", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.12.tgz", @@ -1429,6 +1723,20 @@ "node": "20 || >=22" } }, + "node_modules/cacheable": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/cacheable/-/cacheable-2.5.0.tgz", + "integrity": "sha512-60cyAOytib/OzBw1JNSoSV/boK1AtHryDIjvVBk7XbN4ugfkM3+Sry7fEjNgPMGgOjuaZPAp8ruZ0Cxafwyq9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@cacheable/memory": "^2.2.0", + "@cacheable/utils": "^2.5.0", + "hookified": "^1.15.0", + "keyv": "^5.6.0", + "qified": "^0.10.1" + } + }, "node_modules/chai": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/chai/-/chai-6.3.0.tgz", @@ -1481,6 +1789,21 @@ "proto-list": "~1.2.1" } }, + "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/css-tree": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-3.2.1.tgz", @@ -1495,6 +1818,19 @@ "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0" } }, + "node_modules/cssesc": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", + "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", + "dev": true, + "license": "MIT", + "bin": { + "cssesc": "bin/cssesc" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/csstype": { "version": "3.2.3", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", @@ -1515,6 +1851,24 @@ "node": "^22.14.0 || >=24.0.0" } }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, "node_modules/decimal.js": { "version": "10.6.0", "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.6.0.tgz", @@ -1522,6 +1876,13 @@ "dev": true, "license": "MIT" }, + "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, + "license": "MIT" + }, "node_modules/detect-libc": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", @@ -1584,12 +1945,212 @@ "dev": true, "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, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint": { + "version": "10.13.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-10.13.0.tgz", + "integrity": "sha512-UohDjD4zSzEwhf58M3O7vc/ycc8O1I7dNlhtD0WxE8Px8EHNJKtUwzBqrzeGhisRuv2ag4sAYswszCJRgKXYUg==", + "dev": true, + "license": "MIT", + "workspaces": [ + "packages/*" + ], + "dependencies": { + "@eslint-community/eslint-utils": "^4.8.0", + "@eslint-community/regexpp": "^4.12.2", + "@eslint/config-array": "^0.23.5", + "@eslint/config-helpers": "^0.7.0", + "@eslint/core": "^1.2.1", + "@eslint/plugin-kit": "^0.7.3", + "@humanfs/node": "^0.16.6", + "@humanwhocodes/module-importer": "^1.0.1", + "@humanwhocodes/retry": "^0.4.2", + "@types/estree": "^1.0.6", + "ajv": "^6.14.0", + "cross-spawn": "^7.0.6", + "debug": "^4.3.2", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^9.1.2", + "eslint-visitor-keys": "^5.0.1", + "espree": "^11.2.0", + "esquery": "^1.7.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "11.1.5 || >11.1.6 <12", + "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", + "minimatch": "^10.2.5", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } + } + }, + "node_modules/eslint-plugin-vue": { + "version": "10.11.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-vue/-/eslint-plugin-vue-10.11.1.tgz", + "integrity": "sha512-pasVXhl7wUmIvhujoqs/m0mJ9r59QW1IR9XXYKGR0FETzSM+Hhlf4qKIYgWiDDP+9YKv4YfbwskD7LqIdVcgQw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.9.1", + "natural-compare": "^1.4.0", + "nth-check": "^2.1.1", + "postcss-selector-parser": "^7.1.4", + "semver": "^7.8.5", + "xml-name-validator": "^5.0.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "peerDependencies": { + "@stylistic/eslint-plugin": "^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0", + "@typescript-eslint/parser": "^7.0.0 || ^8.0.0", + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "vue-eslint-parser": "^10.3.0" + }, + "peerDependenciesMeta": { + "@stylistic/eslint-plugin": { + "optional": true + }, + "@typescript-eslint/parser": { + "optional": true + } + } + }, + "node_modules/eslint-scope": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-9.1.2.tgz", + "integrity": "sha512-xS90H51cKw0jltxmvmHy2Iai1LIqrfbw57b79w/J7MfvDfkIkFZ+kj6zC3BjtUwh150HsSSdxXZcsuv72miDFQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "@types/esrecurse": "^4.3.1", + "@types/estree": "^1.0.8", + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz", + "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/espree": { + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-11.2.0.tgz", + "integrity": "sha512-7p3DrVEIopW1B1avAGLuCSh1jubc01H2JHc8B4qqGblmg5gI9yumBgACjWo4JlIc04ufug4xJ3SQI8HkS/Rgzw==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^8.16.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^5.0.1" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esquery": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.7.0.tgz", + "integrity": "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==", + "dev": true, + "license": "BSD-3-Clause", + "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==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, "node_modules/estree-walker": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", "license": "MIT" }, + "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/expect-type": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.4.0.tgz", @@ -1606,23 +2167,90 @@ "integrity": "sha512-kuzL9zherLQoqDeQaS55AiiIg1kb4KYXaSusTtgZTPlvKP2gGCI82LNmBNh5RjDVUXIcmgx+/Mx7vPwRzBbhJA==", "license": "MIT" }, + "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-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, + "license": "MIT" + }, "node_modules/fdir": { "version": "6.5.0", "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", "license": "MIT", - "engines": { - "node": ">=12.0.0" + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/file-entry-cache": { + "version": "11.1.5", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-11.1.5.tgz", + "integrity": "sha512-+PFTHITI08JIGhnNpGNI8T8inUpgZfk3GNEqfT9R2zZV2iFXg3CvqzSl/uEhs7TSGujYRELEANyDvS8Fj7+S7Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "flat-cache": "^6.1.23" + } + }, + "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, + "license": "MIT", + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" }, - "peerDependencies": { - "picomatch": "^3 || ^4" + "engines": { + "node": ">=10" }, - "peerDependenciesMeta": { - "picomatch": { - "optional": true - } + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat-cache": { + "version": "6.1.23", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-6.1.23.tgz", + "integrity": "sha512-f++BY9pTk+983xK1FLzlLpmM0i0z+jHmx3QESGkURMXujQZz1k5wzwX6hjnQ8goaD0B+sYnDK1yZ6MTyZfUaqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "cacheable": "^2.5.0", + "flatted": "^3.4.2", + "hookified": "^1.15.0" } }, + "node_modules/flatted": { + "version": "3.4.4", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.4.tgz", + "integrity": "sha512-5+ybhBZANEJxaH3X5evAFatUxLfEHSr7n6kYJ+1Qd0mUqr4eu9gIf6GDbWHf8RJijHrjjO8G+la14SlL2SeS1Q==", + "dev": true, + "license": "ISC" + }, "node_modules/fsevents": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", @@ -1655,6 +2283,32 @@ "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, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/globals": { + "version": "17.13.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-17.13.0.tgz", + "integrity": "sha512-RwMTC61u7hrG3ZJMkZQOK4JLJrKS8QtoTii63EmWvFXHqycY9FObBJQCbsLxSO8kjKhWE5kV1GC+Vb1g3RI0Zg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", @@ -1662,12 +2316,32 @@ "dev": true, "license": "ISC" }, + "node_modules/hashery": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/hashery/-/hashery-1.5.1.tgz", + "integrity": "sha512-iZyKG96/JwPz1N55vj2Ie2vXbhu440zfUfJvSwEqEbeLluk7NnapfGqa7LH0mOsnDxTF85Mx8/dyR6HfqcbmbQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "hookified": "^1.15.0" + }, + "engines": { + "node": ">=20" + } + }, "node_modules/hookable": { "version": "5.5.3", "resolved": "https://registry.npmjs.org/hookable/-/hookable-5.5.3.tgz", "integrity": "sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ==", "license": "MIT" }, + "node_modules/hookified": { + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/hookified/-/hookified-1.15.1.tgz", + "integrity": "sha512-MvG/clsADq1GPM2KGo2nyfaWVyn9naPiXrqIe4jYjXNZQt238kWyOGrsyc/DmRAQ+Re6yeo6yX/yoNCG5KAEVg==", + "dev": true, + "license": "MIT" + }, "node_modules/html-encoding-sniffer": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-7.0.0.tgz", @@ -1681,6 +2355,26 @@ "node": "^22.13.0 || >=24.0.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/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/ini": { "version": "1.3.8", "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", @@ -1688,6 +2382,29 @@ "dev": true, "license": "ISC" }, + "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, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "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, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.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", @@ -1695,6 +2412,13 @@ "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/jiti": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/jiti/-/jiti-2.7.0.tgz", @@ -1781,6 +2505,44 @@ } } }, + "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, + "license": "MIT" + }, + "node_modules/keyv": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-5.6.0.tgz", + "integrity": "sha512-CYDD3SOtsHtyXeEORYRx2qBtpDJFjRTGXUtmNEMGyzYOKj1TE3tycdlho7kA1Ufx9OYWZzg52QFBGALTirzDSw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@keyv/serialize": "^1.1.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, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/lightningcss": { "version": "1.32.0", "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.32.0.tgz", @@ -2071,6 +2833,22 @@ "url": "https://github.com/sponsors/antfu" } }, + "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, + "license": "MIT", + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/lru-cache": { "version": "11.5.3", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.3.tgz", @@ -2179,6 +2957,13 @@ "pathe": "^2.0.1" } }, + "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/muggle-string": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/muggle-string/-/muggle-string-0.4.1.tgz", @@ -2203,6 +2988,13 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, + "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/nopt": { "version": "10.0.1", "resolved": "https://registry.npmjs.org/nopt/-/nopt-10.0.1.tgz", @@ -2225,6 +3017,19 @@ "integrity": "sha512-wzRsrJwNlFbqIRQt8aCeL2WE8USip/uuvGSOZV1D02CxX8ABTMbw8IywKjH7yWHETMXbWJI4OBpihg9rmz2Vyg==", "license": "MIT" }, + "node_modules/nth-check": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", + "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "boolbase": "^1.0.0" + }, + "funding": { + "url": "https://github.com/fb55/nth-check?sponsor=1" + } + }, "node_modules/obug": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/obug/-/obug-3.0.0.tgz", @@ -2239,6 +3044,56 @@ "node": ">=12.20.0" } }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "license": "MIT", + "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/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, + "license": "MIT", + "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, + "license": "MIT", + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/parse5": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/parse5/-/parse5-8.0.1.tgz", @@ -2265,6 +3120,26 @@ "url": "https://github.com/fb55/entities?sponsor=1" } }, + "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-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-scurry": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.2.tgz", @@ -2376,6 +3251,30 @@ "node": "^10 || ^12 || >=14" } }, + "node_modules/postcss-selector-parser": { + "version": "7.1.7", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-7.1.7.tgz", + "integrity": "sha512-wWBro/7hJ40ye6TPiXkUQoXKCw23xSsjriUvqd7Uls9Sso3oLiON1flc18cCdnjgCRXw4fBVqUJJeOdDTh3P3g==", + "dev": true, + "license": "MIT", + "dependencies": { + "cssesc": "^3.0.0", + "util-deprecate": "^1.0.2" + }, + "engines": { + "node": ">=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, + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/proto-list": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz", @@ -2393,6 +3292,26 @@ "node": ">=6" } }, + "node_modules/qified": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/qified/-/qified-0.10.1.tgz", + "integrity": "sha512-+Owyggi9IxT1ePKGafcI87ubSmxol6smwJ+RAHDQlx9+9cPwFWDiKFFCPuWhr9ignlGpZ9vDQLw67N4dcTVFEA==", + "dev": true, + "license": "MIT", + "dependencies": { + "hookified": "^2.1.1" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/qified/node_modules/hookified": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/hookified/-/hookified-2.2.0.tgz", + "integrity": "sha512-p/LgFzRN5FeoD3DLS6bkUapeye6E4SI6yJs6KetENd18S+FBthqYq2amJUWpt5z0EQwwHemidjY5OqJGEKm5uA==", + "dev": true, + "license": "MIT" + }, "node_modules/quansync": { "version": "0.2.11", "resolved": "https://registry.npmjs.org/quansync/-/quansync-0.2.11.tgz", @@ -2498,6 +3417,29 @@ "node": ">=10" } }, + "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/source-map-js": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz", @@ -2627,6 +3569,19 @@ "node": "^22.14.0 || >=24.0.0" } }, + "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, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/ufo": { "version": "1.6.4", "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.4.tgz", @@ -2717,6 +3672,23 @@ "url": "https://github.com/sponsors/sxzz" } }, + "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==", + "dev": true, + "license": "MIT" + }, "node_modules/vite": { "version": "8.3.5", "resolved": "https://registry.npmjs.org/vite/-/vite-8.3.5.tgz", @@ -3178,6 +4150,31 @@ "dev": true, "license": "MIT" }, + "node_modules/vue-eslint-parser": { + "version": "10.4.1", + "resolved": "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-10.4.1.tgz", + "integrity": "sha512-Gk6gRDj0n/fkRa3C3l0bBheoBckUq/Rs0F/TvMWIS6nzzx67amAViMe9CkNgsP2tXyQONvGiHQESHwFtZ3aYDA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "debug": "^4.4.0", + "eslint-scope": "^8.2.0 || ^9.0.0", + "eslint-visitor-keys": "^4.2.0 || ^5.0.0", + "espree": "^10.3.0 || ^11.0.0", + "esquery": "^1.6.0", + "semver": "^7.6.3" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0" + } + }, "node_modules/vue-router": { "version": "5.4.0", "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-5.4.0.tgz", @@ -3289,6 +4286,22 @@ "node": "^22.14.0 || >=24.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==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/why-is-node-running": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-3.2.1.tgz", @@ -3302,6 +4315,16 @@ "node": ">=20.11" } }, + "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, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/xml-name-validator": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz", @@ -3318,6 +4341,19 @@ "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", "dev": true, "license": "MIT" + }, + "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, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } } } } diff --git a/frontend/package.json b/frontend/package.json index c8974a4..6b58959 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -8,7 +8,8 @@ "build": "vite build", "preview": "vite preview", "test": "vitest run", - "test:coverage": "vitest run --coverage" + "test:coverage": "vitest run --coverage", + "lint": "eslint . --max-warnings 0" }, "dependencies": { "@fontsource-variable/inter": "^5.3.0", @@ -17,10 +18,14 @@ "vue-router": "^5.4.0" }, "devDependencies": { + "@eslint/js": "^10.0.1", "@tailwindcss/vite": "^4.3.3", "@vitejs/plugin-vue": "^6.0.10", "@vitest/coverage-v8": "^5.0.5", "@vue/test-utils": "^2.5.1", + "eslint": "^10.13.0", + "eslint-plugin-vue": "^10.11.1", + "globals": "^17.13.0", "jsdom": "^30.1.3", "tailwindcss": "^4.3.3", "vite": "^8.3.5", diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 6a556d8..271ec27 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -153,7 +153,7 @@ class="fixed z-[100] px-3 py-1.5 text-xs font-semibold text-black dark:text-white bg-white dark:bg-zinc-800 border border-gray-200 dark:border-zinc-700 rounded-md shadow-lg pointer-events-none whitespace-pre" :style="tooltipStore.style">{{ tooltipStore.text }} - + @@ -163,7 +163,7 @@ import { useRoute, useRouter } from 'vue-router' import { pageKey } from './bootstrap' import AppLogo from './components/AppLogo.vue' import SidebarDatabases from './components/SidebarDatabases.vue' -import Toast from './components/Toast.vue' +import ToastStack from './components/ToastStack.vue' import { useAdminStore } from './stores/adminStore' import { useAuthStore } from './stores/authStore' import { useDatabaseStore } from './stores/databaseStore' diff --git a/frontend/src/bootstrap.js b/frontend/src/bootstrap.js index ffd0360..2b9f587 100644 --- a/frontend/src/bootstrap.js +++ b/frontend/src/bootstrap.js @@ -49,7 +49,7 @@ export const clickOutside = { export function createAuthGuard(loadUser, hrefOf = (to) => to.fullPath) { return async function authGuard(to) { if (to.meta?.public) return true - let user = null + let user try { user = await loadUser() } catch { @@ -70,7 +70,7 @@ export function createAuthGuard(loadUser, hrefOf = (to) => to.fullPath) { export function createAdminGuard(loadSession) { return async function adminGuard(to) { if (!to.meta?.admin || to.meta?.public) return true - let session = null + let session try { session = await loadSession() } catch { diff --git a/frontend/src/components/Toast.vue b/frontend/src/components/ToastStack.vue similarity index 100% rename from frontend/src/components/Toast.vue rename to frontend/src/components/ToastStack.vue diff --git a/frontend/src/composables/useToasts.js b/frontend/src/composables/useToasts.js index a8b369f..531e401 100644 --- a/frontend/src/composables/useToasts.js +++ b/frontend/src/composables/useToasts.js @@ -1,6 +1,10 @@ import { ref } from 'vue' const toasts = ref([]) +// A counter, not Date.now() + Math.random(): at today's timestamps a double +// keeps only ~4096 distinct fractions per millisecond, so two toasts could +// share an id and one dismissal would remove both. +let lastId = 0 const DURATION = 4000 const ERROR_DURATION = 10000 @@ -13,7 +17,7 @@ export function useToasts() { const addToast = (message, type = 'info', title = null, duration = null) => { if (duration === null) duration = type === 'error' ? ERROR_DURATION : DURATION - const id = Date.now() + Math.random() + const id = ++lastId toasts.value = [...toasts.value, { id, message, type, title, duration, persistent: duration <= 0 }].slice(-MAX_VISIBLE) if (duration > 0) setTimeout(() => removeToast(id), duration) return id diff --git a/frontend/test/composables.test.js b/frontend/test/composables.test.js index 754f0e5..0ab678d 100644 --- a/frontend/test/composables.test.js +++ b/frontend/test/composables.test.js @@ -25,6 +25,13 @@ describe('useToasts', () => { vi.advanceTimersByTime(4001) expect(t.toasts.value.map((x) => x.message)).toEqual(['d']) }) + + it('gives toasts added in the same millisecond distinct ids', () => { + vi.useFakeTimers() + const t = useToasts() + const ids = Array.from({ length: 50 }, () => t.addToast('x', 'info', null, 0)) + expect(new Set(ids).size).toBe(50) + }) }) describe('copyToClipboard', () => { diff --git a/scripts/coverage.sh b/scripts/coverage.sh new file mode 100755 index 0000000..b06cc11 --- /dev/null +++ b/scripts/coverage.sh @@ -0,0 +1,63 @@ +#!/bin/sh +# Checks a Go cover profile written by `go test -coverpkg=... -coverprofile`. +# +# scripts/coverage.sh [] +# +# Fails when the total is below the floor. With a base ref it also fails on +# any line added since that ref (backend non-test Go files) that no test runs: +# new code is held to 100%, the AGENTS.md target, while older code is held to +# the floor until it catches up. +set -eu +profile=$(cd "$(dirname "$1")" && pwd)/$(basename "$1") +min=$2 +base=${3:-} +cd "$(dirname "$0")/.." + +total=$(cd backend && go tool cover -func="$profile" | awk '/^total:/ { sub("%", "", $3); print $3 }') +[ -n "$total" ] || { echo "::error::no total in $1"; exit 1; } +echo "backend coverage: ${total}% (floor ${min}%)" +if awk -v t="$total" -v m="$min" 'BEGIN { exit !(t < m) }'; then + echo "::error::backend coverage ${total}% is below the ${min}% floor" + exit 1 +fi + +[ -n "$base" ] || exit 0 + +module=$(awk '/^module / { print $2; exit }' backend/go.mod) +# With -coverpkg a block is listed once per test binary; it is covered when +# any of them ran it. +uncovered=$( + git diff -U0 --no-color "$base"...HEAD -- 'backend/*.go' ':(exclude)backend/*_test.go' | + awk -v module="$module" -v profile="$profile" ' + /^\+\+\+ b\// { file = substr($2, 3); next } + /^@@/ { + split($3, r, ",") + start = substr(r[1], 2); n = (2 in r) ? r[2] : 1 + for (i = 0; i < n; i++) added[file, start + i] = 1 + next + } + END { + while ((getline line < profile) > 0) { + if (line ~ /^mode:/) continue + split(line, f, " ") + if (!(f[1] in hits) || f[3] > hits[f[1]]) hits[f[1]] = f[3] + } + for (b in hits) { + if (hits[b] > 0) continue + colon = index(b, ":") + file = "backend" substr(b, length(module) + 1, colon - length(module) - 1) + split(substr(b, colon + 1), pos, /[.,]/) + for (l = pos[1]; l <= pos[3]; l++) + if ((file, l) in added && !seen[file, l]++) print file ":" l + } + }' | sort -t: -k1,1 -k2,2n +) +if [ -n "$uncovered" ]; then + for loc in $uncovered; do + echo "::error file=${loc%:*},line=${loc##*:}::line added since $base is not covered by any test" + done + echo "lines added since $base without test coverage:" + echo "$uncovered" + exit 1 +fi +echo "every line added since $base is covered"