From ca8b58fb2b759f9aa41b227d0bfb534366748804 Mon Sep 17 00:00:00 2001 From: Vitalij Ryndin Date: Mon, 7 Sep 2026 18:45:26 +0300 Subject: [PATCH 1/8] feat: 2.4.0 --- .github/workflows/ci.yaml | 26 ++++ README.md | 22 ++- package.json | 2 +- scripts/tsconfig.json | 9 -- src/build/apply.ts | 126 ++++++---------- src/build/bundle.ts | 1 + src/build/css.ts | 19 +-- src/build/external.ts | 176 ++++++++++++++++++++++ src/build/graph.ts | 117 ++++++++++++++ src/build/iife.ts | 12 +- src/build/index.ts | 14 ++ src/build/proxy.ts | 3 +- src/grants/policy.ts | 4 +- src/grants/scan.ts | 4 +- src/header.ts | 11 -- src/index.ts | 3 + src/plugin.ts | 93 ++++++++---- src/resolve.ts | 5 +- src/serve/index.ts | 5 +- src/serve/watch-queue.ts | 56 +++++++ src/serve/wrapper.ts | 14 +- src/types.ts | 30 +++- test/__snapshots__/grants.test.ts.snap | 17 --- test/build.integration.test.ts | 70 ++++++--- test/client.test.ts | 102 +++++-------- test/external.test.ts | 66 ++++++++ test/fixtures/dynamic-import/src/lazy.css | 3 + test/fixtures/dynamic-import/src/lazy.ts | 3 + test/fixtures/dynamic-import/src/main.ts | 3 + test/fixtures/env.d.ts | 9 ++ test/fixtures/external/src/main.ts | 5 + test/fixtures/grant-none/src/main.ts | 1 - test/grants.test.ts | 110 ++++++-------- test/graph.test.ts | 91 +++++++++++ test/header.test.ts | 27 +++- test/helpers/vlq.ts | 53 +++++++ test/iife.test.ts | 71 +++++++++ test/proxy.test.ts | 22 +++ test/resolve.test.ts | 26 +++- test/serve-html.integration.test.ts | 32 ---- test/serve-react.integration.test.ts | 51 +++++++ test/serve-sourcemap.integration.test.ts | 54 +------ test/serve.test.ts | 63 ++++++++ test/sourcemap.test.ts | 55 +------ test/watch-queue.test.ts | 55 +++++++ tsconfig.json | 2 + vitest.config.ts | 27 +++- 47 files changed, 1297 insertions(+), 473 deletions(-) create mode 100644 .github/workflows/ci.yaml delete mode 100644 scripts/tsconfig.json create mode 100644 src/build/external.ts create mode 100644 src/build/graph.ts create mode 100644 src/serve/watch-queue.ts delete mode 100644 test/__snapshots__/grants.test.ts.snap create mode 100644 test/external.test.ts create mode 100644 test/fixtures/dynamic-import/src/lazy.css create mode 100644 test/fixtures/dynamic-import/src/lazy.ts create mode 100644 test/fixtures/dynamic-import/src/main.ts create mode 100644 test/fixtures/external/src/main.ts delete mode 100644 test/fixtures/grant-none/src/main.ts create mode 100644 test/graph.test.ts create mode 100644 test/helpers/vlq.ts create mode 100644 test/iife.test.ts create mode 100644 test/serve-react.integration.test.ts create mode 100644 test/watch-queue.test.ts diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..2c9a90b --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,26 @@ +name: CI + +on: + push: + branches: + - master + pull_request: + +jobs: + ci: + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - uses: actions/checkout@v7 + + - uses: pnpm/setup@v2 + with: + runtime: node@22 + cache: true + + - run: pnpm type-check + - run: pnpm test + - run: pnpm lint + - run: pnpm build diff --git a/README.md b/README.md index 7df8e5a..8ab8aba 100644 --- a/README.md +++ b/README.md @@ -111,6 +111,8 @@ import './style.css' `index.html` is a normal Vite app next to the userscript. `vite` serves it at `/`. `vite build` writes it to `dist/` beside `{fileName}.user.js`. +The plugin sets `build.assetsInlineLimit` very high so userscript assets become data URLs. The HTML app’s assets will too, unless you set `build.assetsInlineLimit` yourself. + > [!WARNING] > Keep the page's `