Commit 0a318dc
authored
[v8] Add dynamic import wrapper for jose to support Node.js 20.15-20.18 (#1371)
The jose library is ESM-only and cannot be loaded via require() in
Node.js versions before 20.19.0. This adds a dynamic import wrapper that
works across all Node.js 20+ versions using import() which is supported
in both ESM and CJS.
Breaking changes:
- UserManagement.jwks getter changed to async UserManagement.getJWKS()
method
- CookieSession.jwks property removed (uses UserManagement.getJWKS()
instead)
The wrapper enables:
- Lazy loading of jose (only when JWT methods are called)
- Support for all Node.js 20.x versions
- Smaller bundle size (no jose bundling needed)
- Clean migration path when Node 20 reaches EOL (April 2026)
Also updates:
- Minimum Node version to 20.15.0 (conservative choice within 20.x)
- tsup config: removes redundant external arrays (not needed with
bundle: false)
## Description
## Documentation
Does this require changes to the WorkOS Docs? E.g. the [API
Reference](https://workos.com/docs/reference) or code snippets need
updates.
```
[ ] Yes
```
If yes, link a related docs PR and add a docs maintainer as a reviewer.
Their approval is required.1 parent b7b67fb commit 0a318dc
File tree
6 files changed
+52
-26
lines changed- src
- user-management
- utils
6 files changed
+52
-26
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | 1 | | |
3 | 2 | | |
4 | 3 | | |
| |||
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | 22 | | |
24 | 23 | | |
25 | 24 | | |
| |||
36 | 35 | | |
37 | 36 | | |
38 | 37 | | |
39 | | - | |
40 | | - | |
41 | 38 | | |
42 | 39 | | |
43 | 40 | | |
| |||
86 | 83 | | |
87 | 84 | | |
88 | 85 | | |
| 86 | + | |
| 87 | + | |
89 | 88 | | |
90 | 89 | | |
91 | 90 | | |
| |||
120 | 119 | | |
121 | 120 | | |
122 | 121 | | |
| 122 | + | |
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
| |||
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
227 | | - | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
228 | 230 | | |
229 | 231 | | |
230 | 232 | | |
231 | 233 | | |
232 | 234 | | |
233 | 235 | | |
234 | | - | |
| 236 | + | |
235 | 237 | | |
236 | 238 | | |
237 | 239 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | 2 | | |
4 | 3 | | |
5 | 4 | | |
| |||
152 | 151 | | |
153 | 152 | | |
154 | 153 | | |
| 154 | + | |
155 | 155 | | |
156 | 156 | | |
157 | | - | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
158 | 160 | | |
159 | 161 | | |
160 | 162 | | |
| |||
163 | 165 | | |
164 | 166 | | |
165 | 167 | | |
166 | | - | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
167 | 172 | | |
168 | 173 | | |
169 | 174 | | |
| |||
421 | 426 | | |
422 | 427 | | |
423 | 428 | | |
424 | | - | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
425 | 432 | | |
426 | 433 | | |
427 | 434 | | |
| 435 | + | |
| 436 | + | |
428 | 437 | | |
429 | 438 | | |
430 | 439 | | |
| |||
477 | 486 | | |
478 | 487 | | |
479 | 488 | | |
480 | | - | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
481 | 492 | | |
482 | 493 | | |
483 | 494 | | |
484 | 495 | | |
485 | | - | |
| 496 | + | |
486 | 497 | | |
487 | 498 | | |
488 | 499 | | |
| |||
520 | 531 | | |
521 | 532 | | |
522 | 533 | | |
| 534 | + | |
| 535 | + | |
523 | 536 | | |
524 | 537 | | |
525 | 538 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | 29 | | |
31 | 30 | | |
32 | 31 | | |
33 | 32 | | |
34 | 33 | | |
35 | 34 | | |
36 | | - | |
37 | | - | |
38 | | - | |
| 35 | + | |
39 | 36 | | |
40 | 37 | | |
41 | 38 | | |
| |||
53 | 50 | | |
54 | 51 | | |
55 | 52 | | |
56 | | - | |
| 53 | + | |
57 | 54 | | |
58 | 55 | | |
59 | 56 | | |
60 | 57 | | |
61 | 58 | | |
62 | 59 | | |
63 | 60 | | |
64 | | - | |
65 | 61 | | |
66 | 62 | | |
67 | 63 | | |
68 | 64 | | |
69 | 65 | | |
70 | 66 | | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
0 commit comments