@lenne.tech/nest-server 12.8.2 → 12.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/rules/architecture.md +14 -4
- package/.claude/rules/configurable-features.md +1 -0
- package/.claude/rules/testing.md +3 -3
- package/FRAMEWORK-API.md +2 -1
- package/dist/core/common/interfaces/server-options.interface.d.ts +1 -0
- package/dist/core/modules/better-auth/core-better-auth-email-verification.service.d.ts +1 -1
- package/dist/core/modules/better-auth/core-better-auth-email-verification.service.js +7 -0
- package/dist/core/modules/better-auth/core-better-auth-email-verification.service.js.map +1 -1
- package/dist/core/modules/migrate/helpers/ts-compiler-hooks.mjs +4 -55
- package/dist/core/modules/migrate/helpers/ts-compiler-hooks.mjs.map +1 -1
- package/dist/core/modules/migrate/helpers/ts-compiler.cjs +100 -5
- package/dist/core/modules/migrate/helpers/ts-compiler.cjs.map +1 -1
- package/dist/core/modules/migrate/helpers/ts-compiler.d.cts +12 -1
- package/migration-guides/12.8.2-to-12.8.3.md +111 -0
- package/package.json +1 -1
- package/src/core/common/interfaces/server-options.interface.ts +21 -0
- package/src/core/modules/better-auth/README.md +4 -1
- package/src/core/modules/better-auth/core-better-auth-email-verification.service.ts +18 -3
- package/src/core/modules/migrate/README.md +5 -3
- package/src/core/modules/migrate/helpers/ts-compiler-hooks.mjs +14 -65
- package/src/core/modules/migrate/helpers/ts-compiler.cjs +157 -12
|
@@ -137,10 +137,20 @@ vendor project receives into a temporary `"type": "module"` package, compiles it
|
|
|
137
137
|
module plus the barrel in one process. It catches what no other step can — a named import Node cannot see, a type
|
|
138
138
|
imported as a value, a missing extension — and reports each distinct cause once.
|
|
139
139
|
|
|
140
|
-
**The TypeScript loader is three files.** `helpers/ts-compiler.cjs` is the implementation
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
140
|
+
**The TypeScript loader is three files.** `helpers/ts-compiler.cjs` is the implementation: the `require` hook and the
|
|
141
|
+
module hooks for `import` (resolve `.js` → `.ts`, compile ESM-scoped `.ts` with SWC — import attributes kept — and hand
|
|
142
|
+
CommonJS-scoped files back to the CommonJS loader without a source). It registers them in-thread through
|
|
143
|
+
`module.registerHooks()` where Node takes that hand-back (24.12+, 26+; `registerHooksHandsBackCommonJs()`), and through
|
|
144
|
+
`module.register()` with `ts-compiler-hooks.mjs`, an async adapter over the same functions, on 22.x, 24.0–24.11 and
|
|
145
|
+
25.x — Node 26 deprecates `module.register()` at runtime (DEP0205), the older lines refuse a CommonJS `load` result
|
|
146
|
+
without a source in synchronous hooks, and a source compiled for them crashes Node 22 and runs without `require.cache`
|
|
147
|
+
on 24.0–24.11 (12.8.3, DEV-4134; mutation `ts-loader-uses-module-register`; the hand-back itself is pinned by the
|
|
148
|
+
`legacy.cts` case, which build.yml's loader job runs on 22.15.0). The loader also routes a `.ts` / `.cts` file that reaches the `.js`
|
|
149
|
+
extension handler to SWC: Node 24.22+ and 26 choose the handler by the format a load hook named (`commonjs` → `.js`),
|
|
150
|
+
which happens for a CommonJS entry as soon as a second, asynchronous loader runs next to this one (an instrumentation
|
|
151
|
+
preload through `--import`) — mutation `ts-loader-typescript-reaches-js-handler`.
|
|
152
|
+
`ts-compiler.js` is the established entry path, a one-line CommonJS shim that `helpers/package.json` keeps CommonJS in
|
|
153
|
+
every project. The SWC build (`check:swc-tdz`) does not
|
|
144
154
|
emit `.cjs` / `.mjs` sources; its guard places them like `tsc` does. That guard also pins the SWC build to CommonJS
|
|
145
155
|
(`tsconfig.swc-tdz.json`), because it checks what a CommonJS project runs under `nest start -b swc`; `@nestjs/cli` would
|
|
146
156
|
otherwise emit ES modules for this `"type": "module"` package.
|
|
@@ -302,6 +302,7 @@ This pattern is currently applied to:
|
|
|
302
302
|
| Legacy Password-Reset Link | `email.passwordResetLink` | Explicit Value with derived default | **`<appUrl>/auth/reset-password?token={token}` since 11.38.0.** Two conventions live here and which applies depends on whether the option is set AT ALL: unset yields `?token=`, the same string written out yields a PATH segment. That is deliberate — a project that configures such a value has a page built for a path parameter, and moving it silently would break the flow this release repairs — and because it is not guessable, `CoreUserService` **warns once at boot** when a configured value carries no `{token}`. The warning names a precondition: `{token}` is substituted by `buildPasswordResetLink()` and nothing else, so a caller still concatenating by hand must switch FIRST or it mails the placeholder verbatim. Returns `null` rather than a string containing `undefined`; resolves `appUrl` through `resolveServerUrls` (localhost defaults, host-split `baseUrl`) and honours `cors.deriveAppUrl` |
|
|
303
303
|
| SMTP TLS Mode | `email.smtp.secure` + `SMTP_REQUIRE_TLS` | Derived from the port | **`secure` follows `SMTP_PORT` unless set to `'true'`/`'false'`.** It is not an independent setting: 465 negotiates TLS immediately, everything else upgrades via STARTTLS. The production profile shipped 587 + `secure: true` — a pair that cannot connect — so a deployment configuring only host and credentials sent NO mail, invisibly, because authentication mail is not awaited. Only the two canonical values override; anything else defers to the port, which is the only rule under which no input produces an unconnectable pair. `requireTLS` defaults to **true**: `secure: false` alone means opportunistic STARTTLS, and an on-path attacker stripping the capability line gets credentials and a live reset link in plaintext. `EmailService` warns once when the resolved pair cannot connect — reported, not overruled. Implementation: `config.helper.ts` → `resolveSmtpSecure()` / `isImpossibleSmtpTlsCombination()` |
|
|
304
304
|
| Mail Reply-To | `email.defaultReplyTo` | Explicit Value — absent = no header | **Absent → no `Reply-To` header, exactly as before (12.3.2+).** A string (an address, or `"Name" <address>`) becomes the Reply-To of every mail `EmailService.sendMail()` sends; a call overrides it with `replyTo`, and `replyTo: false` (or `''`) sends that one mail without it. Env: `NSC__EMAIL__DEFAULT_REPLY_TO`. A value that is not a string is ignored with one warning — a misconfigured default must not stop password-reset or verification mail. SMTP path only (`email.smtp`, nodemailer, Hub capture unaffected): Brevo and Mailjet templates carry their own reply-to. Pinned by `tests/unit/email-smtp-roundtrip.spec.ts` (Reply-To block, real SMTP). Implementation: `common/services/email.service.ts` → `resolveReplyTo()` |
|
|
305
|
+
| Auth Mail App Name | `betterAuth.emailVerification.appName` | Explicit Value — absent = the `package.json` name | **Absent or empty → the formatted `name` of the working directory's `package.json` (`my-app` → `My App`, `'Nest Server'` without one), exactly as before (12.8.3+).** A string becomes the application name in the verification and password-reset mails: the subject (`<appName> - Verify your email address`, `<appName> - Reset your password`), the EJS variable `appName` and the Brevo parameter `appName`; trimmed. Env: `NSC__BETTER_AUTH__EMAIL_VERIFICATION__APP_NAME`. Exists because in a monorepo the working directory is the API package, whose name (`api`) became the subject of every auth mail; before, only an override of `getAppName()` changed it, which still works and wins. A value that is not a string is ignored with one warning — a misconfigured name must not stop an auth mail. Mails only: authenticator apps read `twoFactor.appName`, passkey prompts `passkey.rpName`. **With verification switched off it needs `enabled: false` beside it** (`{ enabled: false, appName }`, or `NSC__BETTER_AUTH__EMAIL_VERIFICATION__ENABLED=false` next to the variable): `emailVerification: false` keeps no settings, and an object without `enabled: false` — what the variable alone makes of `false` — switches verification on, so every unverified user's sign-in answers 401. The reset mail goes through this service with verification off too. Pinned by `tests/unit/better-auth-mail-app-name.spec.ts` (mutation `mail-app-name-config-ignored`). Implementation: `core-better-auth-email-verification.service.ts` → `resolveAppName()` |
|
|
305
306
|
| Legacy Auth Rate Limiting | `auth.rateLimit` | Presence Implies Enabled | `max: 10`, `windowSeconds: 60`. Counters live in a `RateLimitStore`: `RedisRateLimitStore` when `redis` is configured (limit enforced EXACTLY across replicas instead of `max × replicas`), else `InMemoryRateLimitStore` (previous behavior). On a Redis outage it degrades to the in-memory counter and logs once per transition — never a 500, never "allowed". `check()` / `reset()` / `clear()` are ASYNC since 11.33.0; `getStats().activeEntries` is `-1` on the Redis store |
|
|
306
307
|
| BetterAuth Rate Limiting | `betterAuth.rateLimit` | Presence Implies Enabled | `max: 10`, `windowSeconds: 60`. Same `RateLimitStore` selection, degradation and async signatures as the Legacy Auth row (namespace `better-auth`) |
|
|
307
308
|
| BetterAuth JWT Plugin | `betterAuth.jwt` | Boolean Shorthand | `expiresIn: '15m'` |
|
package/.claude/rules/testing.md
CHANGED
|
@@ -412,7 +412,7 @@ pnpm run check:mutations -- --id=<id> # one mutation
|
|
|
412
412
|
pnpm run check:mutations -- --list # the registry, without running anything
|
|
413
413
|
pnpm run check:mutations -- --allow-dirty # when the fix and its evidence share a working tree
|
|
414
414
|
pnpm run check:mutations -- --jobs=4 # N mutations at a time (default: 2, or 4 on >=12 cores)
|
|
415
|
-
pnpm run check:mutations -- --no-infra # only the
|
|
415
|
+
pnpm run check:mutations -- --no-infra # only the 405 that need no MongoDB
|
|
416
416
|
pnpm run check:mutations -- --since=<ref> # only mutations touching files changed since <ref>
|
|
417
417
|
pnpm run check:mutations -- --shard=2/4 # this job's quarter of the selection (CI splits the full run)
|
|
418
418
|
```
|
|
@@ -432,7 +432,7 @@ when the registry, a vitest config or a setup file changed, since those can move
|
|
|
432
432
|
commit, and in CI alongside the publish without blocking it. The price of caching is a cache that
|
|
433
433
|
has to model each spec's full dependency closure correctly, and getting that wrong produces a stale
|
|
434
434
|
PASS for a test that has since gone vacuous — exactly what the gate is there to prevent. Bad trade
|
|
435
|
-
at
|
|
435
|
+
at 640 mutations.
|
|
436
436
|
|
|
437
437
|
**Decided 2026-10-03 (repo owner): keep the full run.** Measured at 128 mutations, the CI job for
|
|
438
438
|
11.41.6 took **14 minutes**. The trigger to revisit is that wall time, not the mutation count —
|
|
@@ -505,7 +505,7 @@ exactly the environment where the answer matters.
|
|
|
505
505
|
|
|
506
506
|
Worth knowing before optimising the wrong thing: the specs behind all 235 e2e mutations add up to
|
|
507
507
|
**~40 seconds**. The step takes ~740s. The remaining ~700s is paying vitest's startup — process
|
|
508
|
-
spawn, transform, module graph, mongod connect, DB create and drop — once per mutation,
|
|
508
|
+
spawn, transform, module graph, mongod connect, DB create and drop — once per mutation, 640 times.
|
|
509
509
|
That work is largely single-threaded I/O and barely scales with cores: the full registry measures
|
|
510
510
|
**744s on a 12-core laptop and 777s on a 4-vCPU CI runner**.
|
|
511
511
|
|
package/FRAMEWORK-API.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @lenne.tech/nest-server — Framework API Reference
|
|
2
2
|
|
|
3
|
-
> Auto-generated from source code as of 2026-11-
|
|
3
|
+
> Auto-generated from source code as of 2026-11-09 (v12.8.3)
|
|
4
4
|
> File: `FRAMEWORK-API.md` — compact, machine-readable API surface for Claude Code
|
|
5
5
|
|
|
6
6
|
## CoreModule.forRoot()
|
|
@@ -250,6 +250,7 @@ When `passkey` is enabled, `trustedOrigins` is required (compile-time enforcemen
|
|
|
250
250
|
|
|
251
251
|
### IBetterAuthEmailVerificationConfig
|
|
252
252
|
|
|
253
|
+
- `appName?`: `string` (default: `undefined (the formatted package.json name, 'Nest Server' without one)`) — The application name in the verification and password-reset mails: the subject (`<appName> - Verify your email
|
|
253
254
|
- `autoSignInAfterVerification?`: `boolean` (default: `false`) — Whether `GET /iam/verify-email` signs in the browser that opens the verification link.
|
|
254
255
|
- `brevoTemplateId?`: `number` (default: `undefined (uses SMTP/EJS templates)`) — Brevo template ID for verification emails.
|
|
255
256
|
- `callbackURL?`: `string` (default: `'/auth/verify-email'`) — Frontend callback URL for email verification.
|
|
@@ -62,6 +62,7 @@ export interface IAuthRateLimit {
|
|
|
62
62
|
}
|
|
63
63
|
export type IBetterAuth = IBetterAuthWithoutPasskey | IBetterAuthWithPasskey;
|
|
64
64
|
export interface IBetterAuthEmailVerificationConfig {
|
|
65
|
+
appName?: string;
|
|
65
66
|
autoSignInAfterVerification?: boolean;
|
|
66
67
|
brevoTemplateId?: number;
|
|
67
68
|
callbackURL?: string;
|
|
@@ -8,7 +8,7 @@ import { type RateLimitStore } from '../../common/services/rate-limit-store.js';
|
|
|
8
8
|
import { EmailService } from '../../common/services/email.service.js';
|
|
9
9
|
import { TemplateService } from '../../common/services/template.service.js';
|
|
10
10
|
import { AuthEmailCallbackOptions } from './better-auth.config.js';
|
|
11
|
-
type ResolvedEmailVerificationConfig = Pick<IBetterAuthEmailVerificationConfig, 'brevoTemplateId' | 'callbackURL' | 'passwordResetBrevoTemplateId' | 'passwordResetLink'> & Required<Omit<IBetterAuthEmailVerificationConfig, 'brevoTemplateId' | 'callbackURL' | 'passwordResetBrevoTemplateId' | 'passwordResetLink' | 'resendCooldownSeconds'>> & {
|
|
11
|
+
type ResolvedEmailVerificationConfig = Pick<IBetterAuthEmailVerificationConfig, 'appName' | 'brevoTemplateId' | 'callbackURL' | 'passwordResetBrevoTemplateId' | 'passwordResetLink'> & Required<Omit<IBetterAuthEmailVerificationConfig, 'appName' | 'brevoTemplateId' | 'callbackURL' | 'passwordResetBrevoTemplateId' | 'passwordResetLink' | 'resendCooldownSeconds'>> & {
|
|
12
12
|
resendCooldownSeconds: number;
|
|
13
13
|
};
|
|
14
14
|
export interface SendVerificationEmailOptions {
|
|
@@ -527,6 +527,13 @@ let CoreBetterAuthEmailVerificationService = class CoreBetterAuthEmailVerificati
|
|
|
527
527
|
return this.cachedAppName;
|
|
528
528
|
}
|
|
529
529
|
resolveAppName() {
|
|
530
|
+
const configured = this.config.appName;
|
|
531
|
+
if (typeof configured === 'string' && configured.trim()) {
|
|
532
|
+
return configured.trim();
|
|
533
|
+
}
|
|
534
|
+
if (configured !== undefined && configured !== null && typeof configured !== 'string') {
|
|
535
|
+
this.logger.warn(`betterAuth.emailVerification.appName must be a string and is ignored (got ${typeof configured}); the mails use the package.json name`);
|
|
536
|
+
}
|
|
530
537
|
try {
|
|
531
538
|
const packageJsonPath = path.join(process.cwd(), 'package.json');
|
|
532
539
|
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-better-auth-email-verification.service.js","sourceRoot":"","sources":["../../../../src/core/modules/better-auth/core-better-auth-email-verification.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACjG,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OA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AAC,GAAG,EAAE;gBAC5B,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBAC/B,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC9B,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC,CAAC;YACpB,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC;YAChB,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;IAMS,SAAS,CAAC,KAAa;QAC/B,OAAO,SAAS,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;;AAlpCU,sCAAsC;IADlD,UAAU,EAAE;IAmCR,WAAA,QAAQ,EAAE,CAAA;IACV,WAAA,QAAQ,EAAE,CAAA;IACV,WAAA,QAAQ,EAAE,CAAA;IACV,WAAA,MAAM,CAAC,sCAAsC,CAAC,mBAAmB,CAAC,CAAA;IAElE,WAAA,QAAQ,EAAE,CAAA;qCANuB,aAAa;QACD,YAAY;QACT,eAAe;QAG9B,YAAY;QACI,gBAAgB;GAvCzD,sCAAsC,CAmpClD"}
|
|
1
|
+
{"version":3,"file":"core-better-auth-email-verification.service.js","sourceRoot":"","sources":["../../../../src/core/modules/better-auth/core-better-auth-email-verification.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACjG,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC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AqB,CAAC;QACnD,IAAI,QAAQ,GAAG,CAAC,EAAE,CAAC;YACjB,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;YACvC,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;gBAC5B,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBAC/B,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC9B,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC,CAAC;YACpB,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC;YAChB,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;IAMS,SAAS,CAAC,KAAa;QAC/B,OAAO,SAAS,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;;AA5pCU,sCAAsC;IADlD,UAAU,EAAE;IAmCR,WAAA,QAAQ,EAAE,CAAA;IACV,WAAA,QAAQ,EAAE,CAAA;IACV,WAAA,QAAQ,EAAE,CAAA;IACV,WAAA,MAAM,CAAC,sCAAsC,CAAC,mBAAmB,CAAC,CAAA;IAElE,WAAA,QAAQ,EAAE,CAAA;qCANuB,aAAa;QACD,YAAY;QACT,eAAe;QAG9B,YAAY;QACI,gBAAgB;GAvCzD,sCAAsC,CA6pClD"}
|
|
@@ -1,51 +1,14 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
2
1
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { dirname, join } from 'node:path';
|
|
4
|
-
import { fileURLToPath } from 'node:url';
|
|
5
2
|
const require = createRequire(import.meta.url);
|
|
6
|
-
const {
|
|
7
|
-
const TYPESCRIPT = /\.(c|m)?ts$/;
|
|
8
|
-
const packageTypes = new Map();
|
|
9
|
-
let swc;
|
|
10
|
-
function packageType(directory) {
|
|
11
|
-
if (packageTypes.has(directory)) {
|
|
12
|
-
return packageTypes.get(directory);
|
|
13
|
-
}
|
|
14
|
-
let type = 'commonjs';
|
|
15
|
-
try {
|
|
16
|
-
type = JSON.parse(readFileSync(join(directory, 'package.json'), 'utf8')).type === 'module' ? 'module' : 'commonjs';
|
|
17
|
-
}
|
|
18
|
-
catch {
|
|
19
|
-
const parent = dirname(directory);
|
|
20
|
-
type = parent === directory ? 'commonjs' : packageType(parent);
|
|
21
|
-
}
|
|
22
|
-
packageTypes.set(directory, type);
|
|
23
|
-
return type;
|
|
24
|
-
}
|
|
25
|
-
function formatOf(filename) {
|
|
26
|
-
if (filename.endsWith('.mts')) {
|
|
27
|
-
return 'module';
|
|
28
|
-
}
|
|
29
|
-
if (filename.endsWith('.cts')) {
|
|
30
|
-
return 'commonjs';
|
|
31
|
-
}
|
|
32
|
-
return packageType(dirname(filename));
|
|
33
|
-
}
|
|
3
|
+
const { loadTypeScript, typeScriptSpecifiers } = require('./ts-compiler.cjs');
|
|
34
4
|
export async function resolve(specifier, context, nextResolve) {
|
|
35
5
|
try {
|
|
36
6
|
return await nextResolve(specifier, context);
|
|
37
7
|
}
|
|
38
8
|
catch (error) {
|
|
39
|
-
const
|
|
40
|
-
const fromTypeScript = TYPESCRIPT.test(context.parentURL ?? '');
|
|
41
|
-
const pathLike = /^\.{0,2}\//.test(specifier) || specifier.startsWith('file:');
|
|
42
|
-
if (error?.code !== 'ERR_MODULE_NOT_FOUND' || !extension || !fromTypeScript || !pathLike) {
|
|
43
|
-
throw error;
|
|
44
|
-
}
|
|
45
|
-
const sources = { ...SOURCE_EXTENSIONS, '.mjs': ['.mts'] }[extension] ?? [];
|
|
46
|
-
for (const sourceExtension of sources) {
|
|
9
|
+
for (const candidate of typeScriptSpecifiers(specifier, context, error) ?? []) {
|
|
47
10
|
try {
|
|
48
|
-
return await nextResolve(
|
|
11
|
+
return await nextResolve(candidate, context);
|
|
49
12
|
}
|
|
50
13
|
catch {
|
|
51
14
|
}
|
|
@@ -54,20 +17,6 @@ export async function resolve(specifier, context, nextResolve) {
|
|
|
54
17
|
}
|
|
55
18
|
}
|
|
56
19
|
export async function load(url, context, nextLoad) {
|
|
57
|
-
|
|
58
|
-
return nextLoad(url, context);
|
|
59
|
-
}
|
|
60
|
-
const filename = fileURLToPath(url);
|
|
61
|
-
if (formatOf(filename) === 'commonjs') {
|
|
62
|
-
return { format: 'commonjs', shortCircuit: true };
|
|
63
|
-
}
|
|
64
|
-
swc ??= loadSwc();
|
|
65
|
-
const { code } = swc.transformSync(readFileSync(filename, 'utf8'), {
|
|
66
|
-
...SWC_OPTIONS,
|
|
67
|
-
filename,
|
|
68
|
-
jsc: { ...SWC_OPTIONS.jsc, experimental: { keepImportAssertions: true } },
|
|
69
|
-
module: { type: 'es6' },
|
|
70
|
-
});
|
|
71
|
-
return { format: 'module', shortCircuit: true, source: code };
|
|
20
|
+
return loadTypeScript(url) ?? nextLoad(url, context);
|
|
72
21
|
}
|
|
73
22
|
//# sourceMappingURL=ts-compiler-hooks.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ts-compiler-hooks.mjs","sourceRoot":"","sources":["../../../../../src/core/modules/migrate/helpers/ts-compiler-hooks.mjs"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ts-compiler-hooks.mjs","sourceRoot":"","sources":["../../../../../src/core/modules/migrate/helpers/ts-compiler-hooks.mjs"],"names":[],"mappings":"AAgBA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,EAAE,cAAc,EAAE,oBAAoB,EAAE,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAE9E,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,SAAS,EAAE,OAAO,EAAE,WAAW;IAC3D,IAAI,CAAC;QACH,OAAO,MAAM,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,KAAK,MAAM,SAAS,IAAI,oBAAoB,CAAC,SAAS,EAAE,OAAO,EAAE,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC;YAC9E,IAAI,CAAC;gBACH,OAAO,MAAM,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;YAC/C,CAAC;YAAC,MAAM,CAAC;YAET,CAAC;QACH,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ;IAC/C,OAAO,cAAc,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AACvD,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
const fs = require('node:fs');
|
|
3
3
|
const Module = require('node:module');
|
|
4
4
|
const path = require('node:path');
|
|
5
|
-
const { pathToFileURL } = require('node:url');
|
|
5
|
+
const { fileURLToPath, pathToFileURL } = require('node:url');
|
|
6
6
|
const { isMainThread } = require('node:worker_threads');
|
|
7
7
|
const extensionHandlers = Module._extensions;
|
|
8
8
|
const MARKER = Symbol.for('lenne.tech/nest-server/ts-compiler');
|
|
@@ -50,6 +50,7 @@ function patchResolver() {
|
|
|
50
50
|
resolveTypeScriptSource[RESOLVE_MARKER] = true;
|
|
51
51
|
Module._resolveFilename = resolveTypeScriptSource;
|
|
52
52
|
}
|
|
53
|
+
let swc;
|
|
53
54
|
function loadSwc(paths = [process.cwd(), __dirname]) {
|
|
54
55
|
let resolved;
|
|
55
56
|
try {
|
|
@@ -67,7 +68,7 @@ function register() {
|
|
|
67
68
|
if (extensionHandlers['.ts']?.[MARKER]) {
|
|
68
69
|
return;
|
|
69
70
|
}
|
|
70
|
-
|
|
71
|
+
swc ??= loadSwc();
|
|
71
72
|
process.setSourceMapsEnabled(true);
|
|
72
73
|
function compileTypeScript(module, filename) {
|
|
73
74
|
const { code } = swc.transformSync(fs.readFileSync(filename, 'utf8'), { ...SWC_OPTIONS, filename });
|
|
@@ -77,20 +78,114 @@ function register() {
|
|
|
77
78
|
for (const extension of EXTENSIONS) {
|
|
78
79
|
extensionHandlers[extension] = compileTypeScript;
|
|
79
80
|
}
|
|
81
|
+
const javaScriptHandler = extensionHandlers['.js'];
|
|
82
|
+
function compileTypeScriptReachingJavaScriptHandler(module, filename) {
|
|
83
|
+
return /\.c?ts$/.test(filename)
|
|
84
|
+
? compileTypeScript(module, filename)
|
|
85
|
+
: javaScriptHandler.call(this, module, filename);
|
|
86
|
+
}
|
|
87
|
+
extensionHandlers['.js'] = compileTypeScriptReachingJavaScriptHandler;
|
|
80
88
|
patchResolver();
|
|
81
89
|
registerEsmHooks();
|
|
82
90
|
}
|
|
83
91
|
const ESM_MARKER = Symbol.for('lenne.tech/nest-server/ts-compiler/esm');
|
|
92
|
+
const TYPESCRIPT = /\.(c|m)?ts$/;
|
|
93
|
+
const packageTypes = new Map();
|
|
94
|
+
function packageType(directory) {
|
|
95
|
+
if (packageTypes.has(directory)) {
|
|
96
|
+
return packageTypes.get(directory);
|
|
97
|
+
}
|
|
98
|
+
let type = 'commonjs';
|
|
99
|
+
try {
|
|
100
|
+
type =
|
|
101
|
+
JSON.parse(fs.readFileSync(path.join(directory, 'package.json'), 'utf8')).type === 'module'
|
|
102
|
+
? 'module'
|
|
103
|
+
: 'commonjs';
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
const parent = path.dirname(directory);
|
|
107
|
+
type = parent === directory ? 'commonjs' : packageType(parent);
|
|
108
|
+
}
|
|
109
|
+
packageTypes.set(directory, type);
|
|
110
|
+
return type;
|
|
111
|
+
}
|
|
112
|
+
function formatOf(filename) {
|
|
113
|
+
if (filename.endsWith('.mts')) {
|
|
114
|
+
return 'module';
|
|
115
|
+
}
|
|
116
|
+
if (filename.endsWith('.cts')) {
|
|
117
|
+
return 'commonjs';
|
|
118
|
+
}
|
|
119
|
+
return packageType(path.dirname(filename));
|
|
120
|
+
}
|
|
121
|
+
function typeScriptSpecifiers(specifier, context, error) {
|
|
122
|
+
const extension = specifier.match(/\.(c|m)?js$/)?.[0];
|
|
123
|
+
const fromTypeScript = TYPESCRIPT.test(context.parentURL ?? '');
|
|
124
|
+
const pathLike = /^\.{0,2}\//.test(specifier) || specifier.startsWith('file:');
|
|
125
|
+
if (error?.code !== 'ERR_MODULE_NOT_FOUND' || !extension || !fromTypeScript || !pathLike) {
|
|
126
|
+
return undefined;
|
|
127
|
+
}
|
|
128
|
+
const sources = { ...SOURCE_EXTENSIONS, '.mjs': ['.mts'] }[extension] ?? [];
|
|
129
|
+
return sources.map((sourceExtension) => specifier.slice(0, -extension.length) + sourceExtension);
|
|
130
|
+
}
|
|
131
|
+
function loadTypeScript(url) {
|
|
132
|
+
if (!url.startsWith('file:') || !TYPESCRIPT.test(new URL(url).pathname)) {
|
|
133
|
+
return undefined;
|
|
134
|
+
}
|
|
135
|
+
const filename = fileURLToPath(url);
|
|
136
|
+
if (formatOf(filename) === 'commonjs') {
|
|
137
|
+
return { format: 'commonjs', shortCircuit: true };
|
|
138
|
+
}
|
|
139
|
+
swc ??= loadSwc();
|
|
140
|
+
const { code } = swc.transformSync(fs.readFileSync(filename, 'utf8'), {
|
|
141
|
+
...SWC_OPTIONS,
|
|
142
|
+
filename,
|
|
143
|
+
jsc: { ...SWC_OPTIONS.jsc, experimental: { keepImportAssertions: true } },
|
|
144
|
+
module: { type: 'es6' },
|
|
145
|
+
});
|
|
146
|
+
return { format: 'module', shortCircuit: true, source: code };
|
|
147
|
+
}
|
|
148
|
+
function resolveHook(specifier, context, nextResolve) {
|
|
149
|
+
try {
|
|
150
|
+
return nextResolve(specifier, context);
|
|
151
|
+
}
|
|
152
|
+
catch (error) {
|
|
153
|
+
for (const candidate of typeScriptSpecifiers(specifier, context, error) ?? []) {
|
|
154
|
+
try {
|
|
155
|
+
return nextResolve(candidate, context);
|
|
156
|
+
}
|
|
157
|
+
catch {
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
throw error;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
function loadHook(url, context, nextLoad) {
|
|
164
|
+
return loadTypeScript(url) ?? nextLoad(url, context);
|
|
165
|
+
}
|
|
166
|
+
function registerHooksHandsBackCommonJs(version = process.versions.node) {
|
|
167
|
+
const [major, minor] = version.split('.').map(Number);
|
|
168
|
+
return major >= 26 || (major === 24 && minor >= 12);
|
|
169
|
+
}
|
|
84
170
|
function registerEsmHooks() {
|
|
85
|
-
if (!isMainThread ||
|
|
171
|
+
if (!isMainThread || globalThis[ESM_MARKER]) {
|
|
86
172
|
return;
|
|
87
173
|
}
|
|
88
|
-
|
|
89
|
-
|
|
174
|
+
if (typeof Module.registerHooks === 'function' && registerHooksHandsBackCommonJs()) {
|
|
175
|
+
globalThis[ESM_MARKER] = true;
|
|
176
|
+
Module.registerHooks({ load: loadHook, resolve: resolveHook });
|
|
177
|
+
}
|
|
178
|
+
else if (typeof Module.register === 'function') {
|
|
179
|
+
globalThis[ESM_MARKER] = true;
|
|
180
|
+
Module.register(pathToFileURL(path.join(__dirname, 'ts-compiler-hooks.mjs')).href);
|
|
181
|
+
}
|
|
90
182
|
}
|
|
91
183
|
register();
|
|
92
184
|
module.exports = register;
|
|
93
185
|
module.exports.loadSwc = loadSwc;
|
|
94
186
|
module.exports.SWC_OPTIONS = SWC_OPTIONS;
|
|
95
187
|
module.exports.SOURCE_EXTENSIONS = SOURCE_EXTENSIONS;
|
|
188
|
+
module.exports.loadTypeScript = loadTypeScript;
|
|
189
|
+
module.exports.registerHooksHandsBackCommonJs = registerHooksHandsBackCommonJs;
|
|
190
|
+
module.exports.typeScriptSpecifiers = typeScriptSpecifiers;
|
|
96
191
|
//# sourceMappingURL=ts-compiler.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ts-compiler.cjs","sourceRoot":"","sources":["../../../../../src/core/modules/migrate/helpers/ts-compiler.cjs"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ts-compiler.cjs","sourceRoot":"","sources":["../../../../../src/core/modules/migrate/helpers/ts-compiler.cjs"],"names":[],"mappings":"AA0BA,YAAY,CAAC;AAEb,MAAM,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AAC9B,MAAM,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AACtC,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAClC,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAC7D,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAIxD,MAAM,iBAAiB,GAAG,MAAM,CAAC,WAAW,CAAC;AAK7C,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;AAehE,MAAM,WAAW,GAAG;IAClB,UAAU,EAAE,KAAK;IACjB,GAAG,EAAE;QACH,cAAc,EAAE,IAAI;QACpB,MAAM,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE;QACvE,MAAM,EAAE,QAAQ;QAChB,SAAS,EAAE,EAAE,iBAAiB,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,uBAAuB,EAAE,IAAI,EAAE;KAC7F;IACD,MAAM,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE;IAC5B,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,KAAK;CACb,CAAC;AAGF,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAOnC,MAAM,iBAAiB,GAAG,EAAE,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC;AAGvE,MAAM,cAAc,GAAG,MAAM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CAAC,iBAAiB,GAAG,iBAAiB,CAAC;AACrD,MAAM,CAAC,OAAO,CAAC,cAAc,GAAG,cAAc,CAAC;AAC/C,MAAM,CAAC,OAAO,CAAC,8BAA8B,GAAG,8BAA8B,CAAC;AAC/E,MAAM,CAAC,OAAO,CAAC,oBAAoB,GAAG,oBAAoB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export = register;
|
|
2
2
|
declare function register(): void;
|
|
3
3
|
declare namespace register {
|
|
4
|
-
export { loadSwc, SWC_OPTIONS, SOURCE_EXTENSIONS };
|
|
4
|
+
export { loadSwc, SWC_OPTIONS, SOURCE_EXTENSIONS, loadTypeScript, registerHooksHandsBackCommonJs, typeScriptSpecifiers };
|
|
5
5
|
}
|
|
6
6
|
declare function loadSwc(paths?: string[]): any;
|
|
7
7
|
declare namespace SWC_OPTIONS {
|
|
@@ -30,3 +30,14 @@ declare const SOURCE_EXTENSIONS: {
|
|
|
30
30
|
'.cjs': string[];
|
|
31
31
|
'.js': string[];
|
|
32
32
|
};
|
|
33
|
+
declare function loadTypeScript(url: any): {
|
|
34
|
+
format: string;
|
|
35
|
+
shortCircuit: boolean;
|
|
36
|
+
source?: undefined;
|
|
37
|
+
} | {
|
|
38
|
+
format: string;
|
|
39
|
+
shortCircuit: boolean;
|
|
40
|
+
source: any;
|
|
41
|
+
};
|
|
42
|
+
declare function registerHooksHandsBackCommonJs(version?: string): boolean;
|
|
43
|
+
declare function typeScriptSpecifiers(specifier: any, context: any, error: any): any;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# Migration Guide: 12.8.2 → 12.8.3
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
| Category | Details |
|
|
6
|
+
|---|---|
|
|
7
|
+
| **Breaking Changes** | None |
|
|
8
|
+
| **New Features** | `betterAuth.emailVerification.appName`: the application name in the verification and password-reset mails, independent of `package.json` (§2) |
|
|
9
|
+
| **Bugfixes** | Under Node 26 every start and every migration run from source printed `[DEP0205] DeprecationWarning: module.register() is deprecated`. The TypeScript loader now registers its import hooks with `module.registerHooks()` where Node supports it (§1) |
|
|
10
|
+
| **Migration Effort** | None. Optional: set `appName` when the mails should not carry the `package.json` name (§2) |
|
|
11
|
+
|
|
12
|
+
12.8.3 is a patch for 12.8.2. Nothing has to change in a project.
|
|
13
|
+
|
|
14
|
+
## Quick Migration
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pnpm add @lenne.tech/nest-server@12.8.3
|
|
18
|
+
pnpm run update # nest-server-starter based projects
|
|
19
|
+
pnpm run build
|
|
20
|
+
pnpm test
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**Vendor mode**: run `/lt-dev:backend:update-nest-server-core` as usual.
|
|
24
|
+
|
|
25
|
+
## 1. The TypeScript loader without `module.register()` on Node 26
|
|
26
|
+
|
|
27
|
+
**Why:** the framework's TypeScript loader (`migrate/helpers/ts-compiler.js`) runs the dev server from source
|
|
28
|
+
(`node -r …/ts-compiler.js src/main.ts`), the migrate CLI (`--compiler ts:…/ts-compiler.js`) and `config.env.ts`. For
|
|
29
|
+
`import`ed TypeScript (an ESM project, a `.mts` file) it registered Node module hooks through `module.register()`.
|
|
30
|
+
Node 26 deprecates that function at runtime, so every one of those runs printed DEP0205, in npm and vendor projects
|
|
31
|
+
alike.
|
|
32
|
+
|
|
33
|
+
**What changed:** the loader picks the hook API per Node line:
|
|
34
|
+
|
|
35
|
+
| Node | API | Why |
|
|
36
|
+
|---|---|---|
|
|
37
|
+
| 24.12+ and 26+ | `module.registerHooks()`, in-thread | hands a CommonJS module imported from ESM back to the CommonJS loader, as the loader needs |
|
|
38
|
+
| 22.x, 24.0–24.11, 25.x | `module.register()` with `ts-compiler-hooks.mjs`, as before | these lines refuse that hand-back in synchronous hooks; none of them deprecates `module.register()` |
|
|
39
|
+
|
|
40
|
+
Both paths share one implementation in `ts-compiler.cjs`. The behaviour is the same on every line: decorators with
|
|
41
|
+
metadata, `./x.js` specifiers resolving to `x.ts`, JSON imports with attributes, CommonJS-scoped `.ts` / `.cts` files
|
|
42
|
+
compiled by the `require` hook with a real `require` (`require.cache`, `require.extensions`). The CommonJS path
|
|
43
|
+
(`require()` of a `.ts` file, every migration) is unchanged.
|
|
44
|
+
|
|
45
|
+
`engines.node` stays `>= 22.15`. Nothing to do: the loader path, its function export and `--compiler ts:…` are the same.
|
|
46
|
+
|
|
47
|
+
## 2. `betterAuth.emailVerification.appName`
|
|
48
|
+
|
|
49
|
+
**Why:** the verification and password-reset mails name the application in the subject
|
|
50
|
+
(`<appName> - Verify your email address`), in the EJS templates (`appName`) and in the Brevo parameters (`appName`).
|
|
51
|
+
That name came from the `name` of the `package.json` in the working directory, formatted (`my-app` → `My App`). In a
|
|
52
|
+
monorepo the working directory is the API package: one named `api` sent `Api - Verify your email address`. Changing it
|
|
53
|
+
needed an override of `getAppName()`.
|
|
54
|
+
|
|
55
|
+
**What changed:** an optional setting:
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
// config.env.ts
|
|
59
|
+
betterAuth: {
|
|
60
|
+
emailVerification: {
|
|
61
|
+
appName: 'Kundenportal',
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
or `NSC__BETTER_AUTH__EMAIL_VERIFICATION__APP_NAME=Kundenportal`. The value is trimmed. Unset or empty, the mails keep
|
|
67
|
+
the `package.json` name. A value that is not a string is ignored with one warning. An override of `getAppName()` or
|
|
68
|
+
`resolveAppName()` still wins.
|
|
69
|
+
|
|
70
|
+
**A project with email verification switched off** (`emailVerification: false`) still sends password-reset mails, so
|
|
71
|
+
the name matters there too. Write it with `enabled: false`:
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
betterAuth: {
|
|
75
|
+
emailVerification: { enabled: false, appName: 'Kundenportal' },
|
|
76
|
+
},
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
With environment variables, set `NSC__BETTER_AUTH__EMAIL_VERIFICATION__ENABLED=false` next to
|
|
80
|
+
`NSC__BETTER_AUTH__EMAIL_VERIFICATION__APP_NAME`. `false` keeps no settings, so `appName` would be ignored; an object
|
|
81
|
+
without `enabled: false` (which is what the variable alone turns `false` into) switches verification ON, and every
|
|
82
|
+
sign-in of a user whose address was never verified is then answered with 401 `EMAIL_VERIFICATION_REQUIRED`.
|
|
83
|
+
|
|
84
|
+
Authenticator apps and passkey prompts are not affected: they read `betterAuth.twoFactor.appName` and
|
|
85
|
+
`betterAuth.passkey.rpName`, as before.
|
|
86
|
+
|
|
87
|
+
## Compatibility Notes
|
|
88
|
+
|
|
89
|
+
| Pattern | Status |
|
|
90
|
+
|---|---|
|
|
91
|
+
| `node -r …/ts-compiler.js src/main.ts`, `migrate … --compiler ts:…` | unchanged, without DEP0205 on Node 26 |
|
|
92
|
+
| A project calling `require('…/ts-compiler.js')()` itself | unchanged (idempotent function export) |
|
|
93
|
+
| A subclass overriding `getAppName()` / `resolveAppName()` | unchanged, still wins over the setting |
|
|
94
|
+
| Own email templates using `appName` | receive the configured name when it is set |
|
|
95
|
+
|
|
96
|
+
## Troubleshooting
|
|
97
|
+
|
|
98
|
+
| Symptom | Cause | Fix |
|
|
99
|
+
|---|---|---|
|
|
100
|
+
| `[DEP0205] DeprecationWarning: module.register() is deprecated` after the update | a second loader in the project (`tsx`, `ts-node/esm`, a `--loader` / `--import` flag) still calls `module.register()` | remove or update that loader; the framework's own no longer calls it on Node 26 |
|
|
101
|
+
| The mail subject still shows the package name | `appName` is set at the wrong level, or empty, or `emailVerification` is `false` (keeps no settings) | it belongs under `betterAuth.emailVerification`; with verification off write `{ enabled: false, appName }`; check the boot log for the "must be a string" warning |
|
|
102
|
+
| After setting `appName`, unverified users get 401 `EMAIL_VERIFICATION_REQUIRED` at sign-in | the project had `emailVerification: false`; the object (or `NSC__…__APP_NAME` alone) switched verification on | add `enabled: false` (`NSC__BETTER_AUTH__EMAIL_VERIFICATION__ENABLED=false`) |
|
|
103
|
+
|
|
104
|
+
## References
|
|
105
|
+
|
|
106
|
+
- `src/core/modules/migrate/helpers/ts-compiler.cjs`: `registerEsmHooks()`, `registerHooksHandsBackCommonJs()`,
|
|
107
|
+
`loadTypeScript()`
|
|
108
|
+
- `src/core/modules/migrate/README.md`: the TypeScript loader
|
|
109
|
+
- `src/core/modules/better-auth/core-better-auth-email-verification.service.ts`: `resolveAppName()`
|
|
110
|
+
- `src/core/modules/better-auth/README.md`: email verification
|
|
111
|
+
- `tests/unit/ts-compiler.spec.ts`, `tests/unit/better-auth-mail-app-name.spec.ts`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lenne.tech/nest-server",
|
|
3
|
-
"version": "12.8.
|
|
3
|
+
"version": "12.8.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Server framework in TypeScript on top of NestJS: GraphQL and REST APIs on MongoDB, PostgreSQL, MySQL or MariaDB, with authentication, field-level permissions, multi-tenancy, offline sync and an AI assistant.",
|
|
6
6
|
"keywords": [
|
|
@@ -509,6 +509,27 @@ export type IBetterAuth = IBetterAuthWithoutPasskey | IBetterAuthWithPasskey;
|
|
|
509
509
|
* ```
|
|
510
510
|
*/
|
|
511
511
|
export interface IBetterAuthEmailVerificationConfig {
|
|
512
|
+
/**
|
|
513
|
+
* The application name in the verification and password-reset mails: the subject (`<appName> - Verify your email
|
|
514
|
+
* address`), the `appName` variable of the EJS templates and the `appName` parameter of the Brevo templates.
|
|
515
|
+
*
|
|
516
|
+
* Unset (or empty), the name comes from the `name` of the `package.json` in the working directory, formatted
|
|
517
|
+
* (`my-app` → `My App`), as before 12.8.3 — in a monorepo that is the API package (`api`). A value that is not a
|
|
518
|
+
* string is ignored with a warning. `twoFactor.appName` and `passkey.rpName` name the application in authenticator
|
|
519
|
+
* apps and passkey prompts; they are separate settings.
|
|
520
|
+
*
|
|
521
|
+
* With email verification switched off, write `emailVerification: { enabled: false, appName }`
|
|
522
|
+
* (`NSC__BETTER_AUTH__EMAIL_VERIFICATION__ENABLED=false` next to the variable): `false` keeps no settings, and an
|
|
523
|
+
* object without `enabled: false` switches verification on — every sign-in of an unverified user then answers 401.
|
|
524
|
+
*
|
|
525
|
+
* **Environment Variable:** `NSC__BETTER_AUTH__EMAIL_VERIFICATION__APP_NAME`
|
|
526
|
+
*
|
|
527
|
+
* @default undefined (the formatted package.json name, 'Nest Server' without one)
|
|
528
|
+
* @example 'Kundenportal'
|
|
529
|
+
* @since 12.8.3
|
|
530
|
+
*/
|
|
531
|
+
appName?: string;
|
|
532
|
+
|
|
512
533
|
/**
|
|
513
534
|
* Whether `GET /iam/verify-email` signs in the browser that opens the verification link.
|
|
514
535
|
*
|
|
@@ -539,6 +539,7 @@ const config = {
|
|
|
539
539
|
template: 'custom-verify', // Custom template name
|
|
540
540
|
locale: 'en', // Template locale (default: 'de')
|
|
541
541
|
brevoTemplateId: 42, // Send via Brevo transactional API (optional)
|
|
542
|
+
appName: 'Kundenportal', // Name in the mails (12.8.3+; default: the formatted package.json name)
|
|
542
543
|
},
|
|
543
544
|
// To disable:
|
|
544
545
|
emailVerification: false,
|
|
@@ -548,6 +549,8 @@ const config = {
|
|
|
548
549
|
|
|
549
550
|
**Custom Templates:** Create `templates/email-verification-{locale}.ejs` in your project. Available variables: `name`, `link`, `expiresIn`, `appName`.
|
|
550
551
|
|
|
552
|
+
**Application name:** `appName` in the verification and password-reset mails (subject, EJS variable, Brevo parameter) is `emailVerification.appName` when set (12.8.3+, `NSC__BETTER_AUTH__EMAIL_VERIFICATION__APP_NAME`), otherwise the `name` of the `package.json` in the working directory, formatted (`my-app` → `My App`). In a monorepo that is the API package, so set it there. Authenticator apps and passkey prompts read `twoFactor.appName` and `passkey.rpName`. With email verification switched off, write `emailVerification: { enabled: false, appName: '…' }` (`NSC__BETTER_AUTH__EMAIL_VERIFICATION__ENABLED=false` next to the variable): `false` keeps no settings, and an object without `enabled: false` switches verification on, which answers every sign-in of an unverified user with 401.
|
|
553
|
+
|
|
551
554
|
**Brevo Integration:** When `brevoTemplateId` is set and Brevo is configured (`config.brevo`), verification emails are sent via Brevo's transactional API instead of SMTP/EJS templates. The same template variables (`name`, `link`, `appName`, `expiresIn`) are passed to the Brevo template.
|
|
552
555
|
|
|
553
556
|
**Auto sign-in after verification (`autoSignInAfterVerification`, default `false` since 12.3.0):** with it on,
|
|
@@ -1988,7 +1991,7 @@ src/assets/templates/password-reset-de.ejs # or -en, or plain password-reset.e
|
|
|
1988
1991
|
| --------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1989
1992
|
| `name` | yes | `user.name`, falling back to the local part of the address |
|
|
1990
1993
|
| `link` | yes | the ready-made reset URL |
|
|
1991
|
-
| `appName` | yes | derived from `package.json` `name`
|
|
1994
|
+
| `appName` | yes | `emailVerification.appName`, else derived from `package.json` `name` |
|
|
1992
1995
|
| `logoSrc` | **no** | optional. The shipped templates render an `<img>` when it is present and the app name as text otherwise. Nothing in the framework supplies it — pass it from a subclass that overrides `sendPasswordResetEmail()`, or reference it from your own template. |
|
|
1993
1996
|
|
|
1994
1997
|
> **Keep the un-suffixed `password-reset.ejs` renderable from `{ link, name }` alone.**
|
|
@@ -32,12 +32,17 @@ import { callerDirectory } from '../../common/helpers/module-location.helper.js'
|
|
|
32
32
|
*/
|
|
33
33
|
type ResolvedEmailVerificationConfig = Pick<
|
|
34
34
|
IBetterAuthEmailVerificationConfig,
|
|
35
|
-
'brevoTemplateId' | 'callbackURL' | 'passwordResetBrevoTemplateId' | 'passwordResetLink'
|
|
35
|
+
'appName' | 'brevoTemplateId' | 'callbackURL' | 'passwordResetBrevoTemplateId' | 'passwordResetLink'
|
|
36
36
|
> &
|
|
37
37
|
Required<
|
|
38
38
|
Omit<
|
|
39
39
|
IBetterAuthEmailVerificationConfig,
|
|
40
|
-
|
|
40
|
+
| 'appName'
|
|
41
|
+
| 'brevoTemplateId'
|
|
42
|
+
| 'callbackURL'
|
|
43
|
+
| 'passwordResetBrevoTemplateId'
|
|
44
|
+
| 'passwordResetLink'
|
|
45
|
+
| 'resendCooldownSeconds'
|
|
41
46
|
>
|
|
42
47
|
> & {
|
|
43
48
|
resendCooldownSeconds: number;
|
|
@@ -1175,9 +1180,19 @@ export class CoreBetterAuthEmailVerificationService {
|
|
|
1175
1180
|
}
|
|
1176
1181
|
|
|
1177
1182
|
/**
|
|
1178
|
-
* Resolve the application name
|
|
1183
|
+
* Resolve the application name: `betterAuth.emailVerification.appName` when set (12.8.3), otherwise the formatted
|
|
1184
|
+
* `name` of the working directory's package.json, otherwise a framework default.
|
|
1179
1185
|
*/
|
|
1180
1186
|
protected resolveAppName(): string {
|
|
1187
|
+
const configured: unknown = this.config.appName;
|
|
1188
|
+
if (typeof configured === 'string' && configured.trim()) {
|
|
1189
|
+
return configured.trim();
|
|
1190
|
+
}
|
|
1191
|
+
if (configured !== undefined && configured !== null && typeof configured !== 'string') {
|
|
1192
|
+
this.logger.warn(
|
|
1193
|
+
`betterAuth.emailVerification.appName must be a string and is ignored (got ${typeof configured}); the mails use the package.json name`,
|
|
1194
|
+
);
|
|
1195
|
+
}
|
|
1181
1196
|
// Try to get from package.json name
|
|
1182
1197
|
try {
|
|
1183
1198
|
const packageJsonPath = path.join(process.cwd(), 'package.json');
|
|
@@ -545,9 +545,11 @@ semantics for class fields), and type-checks nothing — `tsc` and the IDE do th
|
|
|
545
545
|
(`pnpm add -D @swc/core`; starter-based projects have it), resolved from the working directory. The same file runs
|
|
546
546
|
the dev server from source: `node -r <path>/ts-compiler.js src/main.ts`.
|
|
547
547
|
|
|
548
|
-
It covers both module systems: a `require` hook for CommonJS, and Node module hooks
|
|
549
|
-
|
|
550
|
-
|
|
548
|
+
It covers both module systems: a `require` hook for CommonJS, and Node module hooks, registered on load, for ES
|
|
549
|
+
modules — an ESM project's entry and everything it imports. Both map a `./x.js` specifier to `./x.ts` when only the
|
|
550
|
+
source exists. The module hooks run through `module.registerHooks()` on Node 24.12+ and 26+, so Node 26 prints no
|
|
551
|
+
`module.register()` deprecation (DEP0205) on every start and migration (12.8.3); Node 22, 24.0–24.11 and 25 keep
|
|
552
|
+
`module.register()` with `ts-compiler-hooks.mjs`, which none of them deprecates. The implementation is `ts-compiler.cjs`; `ts-compiler.js` is the established
|
|
551
553
|
entry path and forwards to it. `helpers/package.json` declares `"type": "commonjs"`, so that path works in CommonJS and
|
|
552
554
|
ESM projects, in npm and vendor mode.
|
|
553
555
|
|
|
@@ -1,65 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Asynchronous module hooks of the framework's TypeScript loader, registered by `ts-compiler.cjs` through
|
|
3
|
+
* `module.register()` on the Node lines whose `module.registerHooks()` cannot hand CommonJS back to the CommonJS loader
|
|
4
|
+
* (22.x, 24.0–24.11, 25.x; see `registerHooksHandsBackCommonJs()`). Newer lines run the synchronous twins in
|
|
5
|
+
* `ts-compiler.cjs` in-thread instead, and this file is not loaded there.
|
|
6
|
+
*
|
|
7
|
+
* Both share one implementation in `ts-compiler.cjs`, so the two paths cannot drift:
|
|
3
8
|
*
|
|
4
9
|
* - `resolve`: a relative `./x.js` from a TypeScript file finds `x.ts` when no `x.js` exists (ESM requires the
|
|
5
10
|
* extension of the EMITTED file, so sources written for both module systems name files that exist only after a
|
|
6
11
|
* build). A real `.js` file always wins.
|
|
7
|
-
* - `load`: a TypeScript file in ESM scope (`.mts`, or `.ts` under `"type": "module"`) is compiled with SWC to ESM
|
|
8
|
-
*
|
|
9
|
-
*
|
|
12
|
+
* - `load`: a TypeScript file in ESM scope (`.mts`, or `.ts` under `"type": "module"`) is compiled with SWC to ESM. One
|
|
13
|
+
* in CommonJS scope is handed back to the CommonJS loader, where the `require` hook compiles it.
|
|
14
|
+
*
|
|
15
|
+
* Runs on the hooks thread `module.register()` creates; loading `ts-compiler.cjs` there registers no hooks again.
|
|
10
16
|
*/
|
|
11
|
-
import { readFileSync } from 'node:fs';
|
|
12
17
|
import { createRequire } from 'node:module';
|
|
13
|
-
import { dirname, join } from 'node:path';
|
|
14
|
-
import { fileURLToPath } from 'node:url';
|
|
15
18
|
|
|
16
19
|
const require = createRequire(import.meta.url);
|
|
17
|
-
const {
|
|
18
|
-
|
|
19
|
-
const TYPESCRIPT = /\.(c|m)?ts$/;
|
|
20
|
-
const packageTypes = new Map();
|
|
21
|
-
let swc;
|
|
22
|
-
|
|
23
|
-
/** `"module"` or `"commonjs"`, from the nearest package.json — how Node itself decides a `.ts` file's format. */
|
|
24
|
-
function packageType(directory) {
|
|
25
|
-
if (packageTypes.has(directory)) {
|
|
26
|
-
return packageTypes.get(directory);
|
|
27
|
-
}
|
|
28
|
-
let type = 'commonjs';
|
|
29
|
-
try {
|
|
30
|
-
type = JSON.parse(readFileSync(join(directory, 'package.json'), 'utf8')).type === 'module' ? 'module' : 'commonjs';
|
|
31
|
-
} catch {
|
|
32
|
-
const parent = dirname(directory);
|
|
33
|
-
type = parent === directory ? 'commonjs' : packageType(parent);
|
|
34
|
-
}
|
|
35
|
-
packageTypes.set(directory, type);
|
|
36
|
-
return type;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function formatOf(filename) {
|
|
40
|
-
if (filename.endsWith('.mts')) {
|
|
41
|
-
return 'module';
|
|
42
|
-
}
|
|
43
|
-
if (filename.endsWith('.cts')) {
|
|
44
|
-
return 'commonjs';
|
|
45
|
-
}
|
|
46
|
-
return packageType(dirname(filename));
|
|
47
|
-
}
|
|
20
|
+
const { loadTypeScript, typeScriptSpecifiers } = require('./ts-compiler.cjs');
|
|
48
21
|
|
|
49
22
|
export async function resolve(specifier, context, nextResolve) {
|
|
50
23
|
try {
|
|
51
24
|
return await nextResolve(specifier, context);
|
|
52
25
|
} catch (error) {
|
|
53
|
-
const
|
|
54
|
-
const fromTypeScript = TYPESCRIPT.test(context.parentURL ?? '');
|
|
55
|
-
const pathLike = /^\.{0,2}\//.test(specifier) || specifier.startsWith('file:');
|
|
56
|
-
if (error?.code !== 'ERR_MODULE_NOT_FOUND' || !extension || !fromTypeScript || !pathLike) {
|
|
57
|
-
throw error;
|
|
58
|
-
}
|
|
59
|
-
const sources = { ...SOURCE_EXTENSIONS, '.mjs': ['.mts'] }[extension] ?? [];
|
|
60
|
-
for (const sourceExtension of sources) {
|
|
26
|
+
for (const candidate of typeScriptSpecifiers(specifier, context, error) ?? []) {
|
|
61
27
|
try {
|
|
62
|
-
return await nextResolve(
|
|
28
|
+
return await nextResolve(candidate, context);
|
|
63
29
|
} catch {
|
|
64
30
|
// try the next one; the original error is the one worth reporting
|
|
65
31
|
}
|
|
@@ -69,22 +35,5 @@ export async function resolve(specifier, context, nextResolve) {
|
|
|
69
35
|
}
|
|
70
36
|
|
|
71
37
|
export async function load(url, context, nextLoad) {
|
|
72
|
-
|
|
73
|
-
return nextLoad(url, context);
|
|
74
|
-
}
|
|
75
|
-
const filename = fileURLToPath(url);
|
|
76
|
-
if (formatOf(filename) === 'commonjs') {
|
|
77
|
-
// No source: Node loads it with the CommonJS loader, i.e. through the `require` hook.
|
|
78
|
-
return { format: 'commonjs', shortCircuit: true };
|
|
79
|
-
}
|
|
80
|
-
swc ??= loadSwc();
|
|
81
|
-
const { code } = swc.transformSync(readFileSync(filename, 'utf8'), {
|
|
82
|
-
...SWC_OPTIONS,
|
|
83
|
-
filename,
|
|
84
|
-
// SWC drops import attributes unless told to keep them, and Node refuses a JSON import without
|
|
85
|
-
// `with { type: 'json' }` (ERR_IMPORT_ATTRIBUTE_MISSING) — `import pkg from '../package.json' with { type: 'json' }`.
|
|
86
|
-
jsc: { ...SWC_OPTIONS.jsc, experimental: { keepImportAssertions: true } },
|
|
87
|
-
module: { type: 'es6' },
|
|
88
|
-
});
|
|
89
|
-
return { format: 'module', shortCircuit: true, source: code };
|
|
38
|
+
return loadTypeScript(url) ?? nextLoad(url, context);
|
|
90
39
|
}
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
* TypeScript loader for running sources without a build — the migrate CLI, the dev server and scripts.
|
|
3
3
|
*
|
|
4
4
|
* Registers a CommonJS `require` hook that compiles `.ts` / `.cts` files with SWC (`@swc/core`) on load, and — for
|
|
5
|
-
* ESM projects (`"type": "module"`, what `nest new` creates since NestJS 12) — the matching
|
|
6
|
-
*
|
|
5
|
+
* ESM projects (`"type": "module"`, what `nest new` creates since NestJS 12) — the matching module hooks, so `import`
|
|
6
|
+
* reaches TypeScript sources the same way: in-thread through `module.registerHooks()` where Node supports what the
|
|
7
|
+
* loader needs (24.12+, 26+), otherwise through `module.register()` and `ts-compiler-hooks.mjs` (see
|
|
8
|
+
* `registerHooksHandsBackCommonJs()`).
|
|
7
9
|
* It is the framework's replacement for ts-node (12.0.0): ts-node is unmaintained, needed TypeScript-6
|
|
8
10
|
* workarounds (TS5011 / TS5107 / TS5110 from inherited compiler options), type-checked what it
|
|
9
11
|
* loaded on every start, and — like `@swc-node/register`, whose peer range ends below TypeScript 7 —
|
|
@@ -27,7 +29,7 @@
|
|
|
27
29
|
const fs = require('node:fs');
|
|
28
30
|
const Module = require('node:module');
|
|
29
31
|
const path = require('node:path');
|
|
30
|
-
const { pathToFileURL } = require('node:url');
|
|
32
|
+
const { fileURLToPath, pathToFileURL } = require('node:url');
|
|
31
33
|
const { isMainThread } = require('node:worker_threads');
|
|
32
34
|
|
|
33
35
|
// The loader table Node's CommonJS `require` dispatches on by extension — what every require hook patches.
|
|
@@ -114,6 +116,9 @@ function patchResolver() {
|
|
|
114
116
|
Module._resolveFilename = resolveTypeScriptSource;
|
|
115
117
|
}
|
|
116
118
|
|
|
119
|
+
/** `@swc/core`, loaded once per thread by `register()` or by the first ESM file compiled. */
|
|
120
|
+
let swc;
|
|
121
|
+
|
|
117
122
|
/**
|
|
118
123
|
* Load `@swc/core`, or fail with the one instruction that fixes it.
|
|
119
124
|
*
|
|
@@ -141,7 +146,7 @@ function register() {
|
|
|
141
146
|
if (extensionHandlers['.ts']?.[MARKER]) {
|
|
142
147
|
return;
|
|
143
148
|
}
|
|
144
|
-
|
|
149
|
+
swc ??= loadSwc();
|
|
145
150
|
// Stack traces point at the TypeScript lines (the code carries inline source maps).
|
|
146
151
|
process.setSourceMapsEnabled(true);
|
|
147
152
|
|
|
@@ -154,25 +159,162 @@ function register() {
|
|
|
154
159
|
for (const extension of EXTENSIONS) {
|
|
155
160
|
extensionHandlers[extension] = compileTypeScript;
|
|
156
161
|
}
|
|
162
|
+
// Node 24.22+ and 26 pick the handler of a module whose load hook named its format BY THAT FORMAT, not by the file's
|
|
163
|
+
// extension: `commonjs` means `.js`. That happens when the ESM loader hands a CommonJS-scoped `.ts` / `.cts` file
|
|
164
|
+
// back (`loadTypeScript()`), which it does for a CommonJS entry as soon as a second, asynchronous loader runs next to
|
|
165
|
+
// this one (an instrumentation preload through `--import`), and for an ESM project's `.cts` import. Without this,
|
|
166
|
+
// the file would be compiled as plain JavaScript. Any other file keeps Node's own handler.
|
|
167
|
+
const javaScriptHandler = extensionHandlers['.js'];
|
|
168
|
+
function compileTypeScriptReachingJavaScriptHandler(module, filename) {
|
|
169
|
+
return /\.c?ts$/.test(filename)
|
|
170
|
+
? compileTypeScript(module, filename)
|
|
171
|
+
: javaScriptHandler.call(this, module, filename);
|
|
172
|
+
}
|
|
173
|
+
extensionHandlers['.js'] = compileTypeScriptReachingJavaScriptHandler;
|
|
157
174
|
patchResolver();
|
|
158
175
|
registerEsmHooks();
|
|
159
176
|
}
|
|
160
177
|
|
|
161
|
-
/** Marks the
|
|
178
|
+
/** Marks the thread once the module hooks are registered. */
|
|
162
179
|
const ESM_MARKER = Symbol.for('lenne.tech/nest-server/ts-compiler/esm');
|
|
163
180
|
|
|
181
|
+
const TYPESCRIPT = /\.(c|m)?ts$/;
|
|
182
|
+
const packageTypes = new Map();
|
|
183
|
+
|
|
184
|
+
/** `"module"` or `"commonjs"`, from the nearest package.json — how Node itself decides a `.ts` file's format. */
|
|
185
|
+
function packageType(directory) {
|
|
186
|
+
if (packageTypes.has(directory)) {
|
|
187
|
+
return packageTypes.get(directory);
|
|
188
|
+
}
|
|
189
|
+
let type = 'commonjs';
|
|
190
|
+
try {
|
|
191
|
+
type =
|
|
192
|
+
JSON.parse(fs.readFileSync(path.join(directory, 'package.json'), 'utf8')).type === 'module'
|
|
193
|
+
? 'module'
|
|
194
|
+
: 'commonjs';
|
|
195
|
+
} catch {
|
|
196
|
+
const parent = path.dirname(directory);
|
|
197
|
+
type = parent === directory ? 'commonjs' : packageType(parent);
|
|
198
|
+
}
|
|
199
|
+
packageTypes.set(directory, type);
|
|
200
|
+
return type;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/** The module format Node gives a TypeScript file: `.mts` / `.cts` by extension, `.ts` by the nearest package.json. */
|
|
204
|
+
function formatOf(filename) {
|
|
205
|
+
if (filename.endsWith('.mts')) {
|
|
206
|
+
return 'module';
|
|
207
|
+
}
|
|
208
|
+
if (filename.endsWith('.cts')) {
|
|
209
|
+
return 'commonjs';
|
|
210
|
+
}
|
|
211
|
+
return packageType(path.dirname(filename));
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* The specifiers to try after an `import` of `./x.js` from a TypeScript file failed: `./x.ts`, `./x.cts` (`./x.mjs`:
|
|
216
|
+
* `./x.mts`). `undefined` when the failure is not of that kind — a real `.js` file always wins, because this is asked
|
|
217
|
+
* only after Node's own resolution failed, and package specifiers are never touched.
|
|
218
|
+
*/
|
|
219
|
+
function typeScriptSpecifiers(specifier, context, error) {
|
|
220
|
+
const extension = specifier.match(/\.(c|m)?js$/)?.[0];
|
|
221
|
+
const fromTypeScript = TYPESCRIPT.test(context.parentURL ?? '');
|
|
222
|
+
const pathLike = /^\.{0,2}\//.test(specifier) || specifier.startsWith('file:');
|
|
223
|
+
if (error?.code !== 'ERR_MODULE_NOT_FOUND' || !extension || !fromTypeScript || !pathLike) {
|
|
224
|
+
return undefined;
|
|
225
|
+
}
|
|
226
|
+
const sources = { ...SOURCE_EXTENSIONS, '.mjs': ['.mts'] }[extension] ?? [];
|
|
227
|
+
return sources.map((sourceExtension) => specifier.slice(0, -extension.length) + sourceExtension);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* What the `load` hook answers for a URL, or `undefined` for anything that is not a TypeScript file (Node loads it).
|
|
232
|
+
*
|
|
233
|
+
* A TypeScript file in ESM scope (`.mts`, or `.ts` under `"type": "module"`) is compiled with SWC to ESM, with the
|
|
234
|
+
* options of the CommonJS hook. One in CommonJS scope is handed back to the CommonJS loader WITHOUT a source, where the
|
|
235
|
+
* `require` hook compiles it: the same file must not be compiled two different ways, and only the CommonJS loader gives
|
|
236
|
+
* it a real `require` (`require.cache`, `require.extensions`) — a CommonJS source returned from here crashes Node
|
|
237
|
+
* 22's CommonJS translator and runs with the reduced `require` Node builds for it on 24.13 and earlier.
|
|
238
|
+
*/
|
|
239
|
+
function loadTypeScript(url) {
|
|
240
|
+
if (!url.startsWith('file:') || !TYPESCRIPT.test(new URL(url).pathname)) {
|
|
241
|
+
return undefined;
|
|
242
|
+
}
|
|
243
|
+
const filename = fileURLToPath(url);
|
|
244
|
+
if (formatOf(filename) === 'commonjs') {
|
|
245
|
+
return { format: 'commonjs', shortCircuit: true };
|
|
246
|
+
}
|
|
247
|
+
swc ??= loadSwc();
|
|
248
|
+
const { code } = swc.transformSync(fs.readFileSync(filename, 'utf8'), {
|
|
249
|
+
...SWC_OPTIONS,
|
|
250
|
+
filename,
|
|
251
|
+
// SWC drops import attributes unless told to keep them, and Node refuses a JSON import without
|
|
252
|
+
// `with { type: 'json' }` (ERR_IMPORT_ATTRIBUTE_MISSING) — `import pkg from '../package.json' with { type: 'json' }`.
|
|
253
|
+
jsc: { ...SWC_OPTIONS.jsc, experimental: { keepImportAssertions: true } },
|
|
254
|
+
module: { type: 'es6' },
|
|
255
|
+
});
|
|
256
|
+
return { format: 'module', shortCircuit: true, source: code };
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/** The synchronous `resolve` hook for `module.registerHooks()`; `ts-compiler-hooks.mjs` is its asynchronous twin. */
|
|
260
|
+
function resolveHook(specifier, context, nextResolve) {
|
|
261
|
+
try {
|
|
262
|
+
return nextResolve(specifier, context);
|
|
263
|
+
} catch (error) {
|
|
264
|
+
for (const candidate of typeScriptSpecifiers(specifier, context, error) ?? []) {
|
|
265
|
+
try {
|
|
266
|
+
return nextResolve(candidate, context);
|
|
267
|
+
} catch {
|
|
268
|
+
// try the next one; the original error is the one worth reporting
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
throw error;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/** The synchronous `load` hook for `module.registerHooks()`; `ts-compiler-hooks.mjs` is its asynchronous twin. */
|
|
276
|
+
function loadHook(url, context, nextLoad) {
|
|
277
|
+
return loadTypeScript(url) ?? nextLoad(url, context);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Whether this Node's `module.registerHooks()` takes a `load` result for a CommonJS module without `source`, i.e. hands
|
|
282
|
+
* it back to the CommonJS loader — what `loadTypeScript()` answers for CommonJS-scoped TypeScript imported from ESM.
|
|
283
|
+
* Measured (tests/unit/ts-compiler.spec.ts): 24.12.0 and 26.0.0 take it; 22.x, 23.x, 24.0–24.11 and 25.0 refuse it
|
|
284
|
+
* with ERR_INVALID_RETURN_PROPERTY_VALUE, and a source compiled for them crashes Node 22 and runs on 24.0–24.11
|
|
285
|
+
* without `require.cache`. Those lines keep `module.register()`, which no Node before 26 deprecates at runtime. 25.x is
|
|
286
|
+
* end-of-life and stays on the older path.
|
|
287
|
+
*
|
|
288
|
+
* @param {string} [version] - A Node version, `process.versions.node` by default.
|
|
289
|
+
*/
|
|
290
|
+
function registerHooksHandsBackCommonJs(version = process.versions.node) {
|
|
291
|
+
const [major, minor] = version.split('.').map(Number);
|
|
292
|
+
return major >= 26 || (major === 24 && minor >= 12);
|
|
293
|
+
}
|
|
294
|
+
|
|
164
295
|
/**
|
|
165
|
-
* Register the
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
296
|
+
* Register the module hooks for `import`ed TypeScript: an ESM project's entry and everything it imports. Without them
|
|
297
|
+
* Node would hand a `.ts` entry to its own type stripping, which cannot lower decorators or emit their metadata —
|
|
298
|
+
* NestJS needs both.
|
|
299
|
+
*
|
|
300
|
+
* `module.registerHooks()` (in-thread, synchronous) where it hands CommonJS back; there it replaces `module.register()`,
|
|
301
|
+
* which Node 26 deprecates at runtime (DEP0205, printed on every start). The CommonJS path needs neither: `require()`
|
|
302
|
+
* of a `.ts` file reaches the extension handler above, which does not consult module hooks.
|
|
303
|
+
*
|
|
304
|
+
* Only on the main thread: `module.register()` runs `ts-compiler-hooks.mjs` on a thread of its own, which loads this
|
|
305
|
+
* file for its helpers and must not register itself again.
|
|
169
306
|
*/
|
|
170
307
|
function registerEsmHooks() {
|
|
171
|
-
if (!isMainThread ||
|
|
308
|
+
if (!isMainThread || globalThis[ESM_MARKER]) {
|
|
172
309
|
return;
|
|
173
310
|
}
|
|
174
|
-
|
|
175
|
-
|
|
311
|
+
if (typeof Module.registerHooks === 'function' && registerHooksHandsBackCommonJs()) {
|
|
312
|
+
globalThis[ESM_MARKER] = true;
|
|
313
|
+
Module.registerHooks({ load: loadHook, resolve: resolveHook });
|
|
314
|
+
} else if (typeof Module.register === 'function') {
|
|
315
|
+
globalThis[ESM_MARKER] = true;
|
|
316
|
+
Module.register(pathToFileURL(path.join(__dirname, 'ts-compiler-hooks.mjs')).href);
|
|
317
|
+
}
|
|
176
318
|
}
|
|
177
319
|
|
|
178
320
|
register();
|
|
@@ -181,3 +323,6 @@ module.exports = register;
|
|
|
181
323
|
module.exports.loadSwc = loadSwc;
|
|
182
324
|
module.exports.SWC_OPTIONS = SWC_OPTIONS;
|
|
183
325
|
module.exports.SOURCE_EXTENSIONS = SOURCE_EXTENSIONS;
|
|
326
|
+
module.exports.loadTypeScript = loadTypeScript;
|
|
327
|
+
module.exports.registerHooksHandsBackCommonJs = registerHooksHandsBackCommonJs;
|
|
328
|
+
module.exports.typeScriptSpecifiers = typeScriptSpecifiers;
|