Commit 268e0c6
authored
fix(core): stop bundling vitest into public entry points (#17)
* fix(core): stop bundling vitest into public entry points
`src/index.ts` re-exported the generic test helpers via
`export * as tests from "./tests/index.js"`. A re-exported namespace cannot be
tree-shaken, so the helpers and their top-level `import { expect } from "vitest"`
were bundled into every public entry (dist/index.js, dist/index.cjs,
dist/index.iife.js). Because vitest is only a devDependency, importing
`@frosts/core` — or any `@frosts/<curve>` that depends on it — crashed at module
load with ERR_MODULE_NOT_FOUND for consumers without vitest installed.
The test helpers are now published under a dedicated `@frosts/core/tests`
subpath instead of the main entry. The build uses code splitting so the subpath
shares the same core runtime chunks as the main entry, preserving the
`instanceof` checks in the helpers (avoiding a dual-package hazard). IIFE, which
cannot be split, is built separately for the public entry only.
Consumers of the generic test functions update their imports:
-import { tests } from "@frosts/core";
+import * as tests from "@frosts/core/tests";
Verified: public entries and shared chunks contain no vitest import; importing
`@frosts/core` and `@frosts/ed25519` succeeds in a sandbox without vitest; full
test suite and typecheck pass across all packages.
Fixes the published 0.2.2-alpha.1 / 0.2.2-alpha.3 crash reported on GitHub.
* chore(deps): update all dependencies to their latest versions
Bump dev tooling and runtime dependencies across the workspace:
- typescript 5.9 -> 6.0
- eslint 9 -> 10, @eslint/js 9 -> 10
- @types/node 25 -> 26
- tsdown 0.20 -> 0.22, typedoc 0.28.5 -> 0.28.19, vitest 4.0 -> 4.1
- @typescript-eslint/* 8.53 -> 8.61, eslint-config-turbo 2.7 -> 2.9
- @noble/curves & @noble/hashes 2.0 -> 2.2
- prettier, turbo and @changesets/cli to latest
Adjustments required by the upgrades:
- tsconfig: add the DOM lib (TextEncoder / Web Crypto globals are no longer
provided as Node globals by @types/node 26); widen core's rootDir so
TypeScript 6 accepts the interop test's cross-package source imports (TS6059).
- tsdown: migrate the deprecated `external` option to `deps.neverBundle`, and
disable the ineffective-dynamic-import check in core (intentional pattern
under code splitting).
- source: cast getRandomValues buffers to Uint8Array<ArrayBuffer> for the
stricter lib.dom signature, attach `cause` to a re-thrown error, and drop
type assertions now flagged as unnecessary by TS 6's improved inference.
format, lint, typecheck, build and tests all pass with no warnings.
* chore: release v0.2.2-alpha.4 and drop changesets
- Bump all packages and the workspace root to 0.2.2-alpha.4 via
scripts/bump-version.ts.
- Add a CHANGELOG.md to every published package documenting alpha.4 (the
@frosts/core vitest-at-import fix and the dependency refresh), and include
CHANGELOG.md in each package's published `files`.
- Remove changesets, which the project does not use for versioning (versions
are managed by scripts/bump-version.ts): delete the .changeset directory and
the @changesets/cli devDependency, and replace the `changeset publish` step
in the release workflow with a direct `npm publish --provenance` over the
public packages.
- Update the README version and TypeScript badges (0.2.2-alpha.4, TS 6.0).
* ci(links): ignore bot-blocked npm and IACR links in markdown link check
The npm package pages (npmjs.com) and IACR ePrint archive (eprint.iacr.org)
return HTTP 403 to the link checker's automated requests even though the links
are valid. Add a markdown-link-check config that ignores those two hosts and
wire it into the Link Checker workflow via `config-file`.1 parent 06fcae7 commit 268e0c6
74 files changed
Lines changed: 422 additions & 276 deletions
File tree
- .changeset
- .github
- workflows
- packages
- core
- src
- tests
- tests
- helpers
- ed25519
- src
- tests
- ed448
- src
- tests
- p256
- src
- tests
- rerandomized
- ristretto255
- src
- tests
- secp256k1-tr
- src
- keys
- tests
- secp256k1
- src
- tests
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
63 | 69 | | |
64 | 70 | | |
65 | | - | |
| 71 | + | |
66 | 72 | | |
67 | 73 | | |
68 | 74 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
| 3 | + | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
48 | 47 | | |
49 | 48 | | |
50 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
28 | 35 | | |
29 | 36 | | |
30 | 37 | | |
31 | 38 | | |
32 | | - | |
| 39 | + | |
| 40 | + | |
33 | 41 | | |
34 | 42 | | |
35 | 43 | | |
| |||
56 | 64 | | |
57 | 65 | | |
58 | 66 | | |
59 | | - | |
| 67 | + | |
60 | 68 | | |
61 | 69 | | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
70 | 78 | | |
71 | 79 | | |
0 commit comments