mirror of
https://github.com/readest/readest.git
synced 2026-11-29 19:02:28 +00:00
* fix(build): repair the Docker and Nix builds after #6368
Two main-branch builds broke on 8750c310 and both are fallout from that PR.
**Docker** (`pnpm build-web`: "Can't resolve '@pdfjs/pdf.min.mjs'",
"Can't resolve '@simplecc/simplecc_wasm'"). `setup-vendors` runs in the
`dependencies` stage and its output is not in the build context, so every
directory it creates needs an explicit `COPY --from=dependencies`. Splitting
the bundler-imported modules out of `public/vendor` into `vendor/` left the
new directory with no COPY line. The test derives the expected roots from the
`prepare-vendor` script, so adding another one fails until the Dockerfile
copies it.
**Nix** ("no matching package named `sentry-debug-images` found"). The Linux
CEF build vendors from `Cargo.cef.lock`, which `nix/package.nix` copies over
`Cargo.lock`, and that second lock never learned about the two crates the
sentry `debug-images` feature pulls in. Added `findshlibs` and
`sentry-debug-images` there, plus the dependency entry on `sentry`; both need
only packages the lock already had.
This is also why `nix-deps-check` stayed green on #6368: it hashes
`Cargo.cef.lock`, which that PR did not touch, so the stale vendor set only
surfaced when the full Nix build ran on main.
`cargoHash` is updated in a follow-up commit from the hash the deps-check
prints, since the vendor contents change.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* style: format the vendor-root docker test
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(nix): update cargoHash for the new sentry debug-images crates
The vendor set gained findshlibs and sentry-debug-images, so the pinned
hash moved. Value taken from the nix-deps-check run on this PR:
specified: sha256-EPNbiv0YJ79rqBHFCO5gjQwt9Vn1v9HV0ZfH7f2Eo/E=
got: sha256-8MIkn2N65P87tG0RncOQtH01SYfRUM4qB6rOzd+fwwQ=
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* refactor: one vendor dir, with the bundler importing from packages
#6368 split the vendored modules into a second `vendor/` directory to stop
them shipping twice (Tauri embeds every published file, and `public/` is
published whole). Two vendor directories is the wrong shape, and the copies
were never needed: the aliases can resolve straight at the sources, which is
how `jieba-wasm` has always been imported.
@pdfjs/* -> packages/foliate-js/node_modules/pdfjs-dist/legacy/build/*
@simplecc/* -> packages/simplecc-wasm/dist/web/*
`public/vendor/pdfjs` now holds only what the reader fetches by URL at
runtime — the worker, the WASM decoders, cmaps, standard fonts and the layer
CSS — and `vendor/` is gone, along with `copy-pdfjs-lib`, `copy-simplecc`,
`setup-simplecc`, its Dockerfile COPY and its worktree copy.
Two details this turned up:
- The @pdfjs alias needs an explicit `declare module`. TypeScript inferred
types for the minified JS while it sat inside the app, but skips JavaScript
under node_modules, and pdfjs-dist ships `pdf.d.mts`, not the
`pdf.min.d.mts` that would sit beside the minified build. Only the import's
side effect is used, so the declaration is bare.
- `packages/simplecc-wasm` is a submodule the worktree script skips, so the
script now copies its committed `dist/web` into a new worktree instead of a
vendor directory.
A true `import ... from 'simplecc-wasm'`, matching jieba exactly, would need a
change in that submodule: its `exports` map points at `pkg/`, which is build
output and not committed (only `dist/web` is), and the map forbids other
subpaths.
Verified with a real build: modules resolve with no `vendor/` present,
`out/vendor` holds only pdfjs, `pdf.min.mjs` is bundled into a chunk and not
published, and both jieba and simplecc WASM are emitted once each.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* docs: say why the @pdfjs alias points at the package, not public/
The comments still described a vendored copy. Record the constraint
instead: a module the bundler imports must not also be published, or
Tauri embeds it twice.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* test: drop the vendor/docker config assertions
These assert on config files rather than behaviour: the alias-target test,
the Dockerfile vendor-COPY test, and the pdfjs wasm copy-script test.
The SELF_HOSTED default check in docker-image-defaults.test.ts stays; it
predates this work (#6100) and guards runtime behaviour of the published
image rather than a config shape.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
45 lines
1.2 KiB
JSON
45 lines
1.2 KiB
JSON
{
|
|
"extends": "@sindresorhus/tsconfig",
|
|
"compilerOptions": {
|
|
"target": "ES2022",
|
|
"lib": ["dom", "dom.iterable", "webworker", "esnext"],
|
|
"allowJs": true,
|
|
"skipLibCheck": true,
|
|
"strict": true,
|
|
"noEmit": true,
|
|
"rootDir": "../..",
|
|
"esModuleInterop": true,
|
|
"module": "preserve",
|
|
"moduleResolution": "bundler",
|
|
"resolveJsonModule": true,
|
|
"isolatedModules": true,
|
|
"allowImportingTsExtensions": true,
|
|
"jsx": "preserve",
|
|
"incremental": true,
|
|
"plugins": [
|
|
{
|
|
"name": "next"
|
|
}
|
|
],
|
|
"paths": {
|
|
"@/*": ["./src/*"],
|
|
"@/components/ui/*": ["./src/components/primitives/*"],
|
|
"@pdfjs/*": ["../../packages/foliate-js/node_modules/pdfjs-dist/legacy/build/*"],
|
|
"@simplecc/*": ["../../packages/simplecc-wasm/dist/web/*"],
|
|
"js-mdict": ["../../packages/js-mdict/src/index.ts"],
|
|
"fflate": ["./node_modules/fflate"],
|
|
"tauri-plugin-turso": ["./src-tauri/plugins/tauri-plugin-turso/guest-js"]
|
|
}
|
|
},
|
|
"include": [
|
|
"next-env.d.ts",
|
|
"src/**/*.ts",
|
|
"src/**/*.tsx",
|
|
"raw-loader.d.ts",
|
|
"pdfjs.d.ts",
|
|
".next/types/**/*.ts",
|
|
"scripts/**/*.ts",
|
|
"bench/**/*.ts"
|
|
],
|
|
"exclude": ["node_modules", "out"]
|
|
}
|