Lines 1-34javascript
1import * as path from 'path';
2import * as fs from 'fs';
3import { execFileSync } from 'child_process';
4import { createRequire } from 'module';
HighChild Process
Package source references child process execution.
dist/generator/node-build.jsView on unpkg · L2 6 * Absolute path to this package's own pinned native TypeScript 7 `tsc`
7 * binary, resolved via the `@typescript/native` dependency (an alias for the
8 * real `typescript` package — the plain `typescript` dependency is itself
9 * aliased to the `@typescript/typescript6` compatibility shim so this
10 * package's own code/tests can still use the classic Program API) rather
11 * than shelled out to via `npx`. The Node build must always compile with the
12 * version `@opensaas/stack-cli` ships, not whatever (if anything) happens to
13 * be on `PATH`/installed in the target project.
15const tscBin = path.join(path.dirname(createRequire(import.meta.url).resolve('@typescript/native/package.json')), 'bin', 'tsc');
16/**
MediumDynamic Require
Package source references dynamic require/import behavior.
dist/generator/node-build.jsView on unpkg · L14 17 * The **Node build** (ADR-0011): an opt-in, plain-Node-loadable form of the
18 * Generated bundle, compiled to `<opensaasDir>/dist/` alongside the default
19 * `.ts` bundler form (ADR-0008).
23 * The default `.opensaas/` bundle ships as TypeScript with explicit `.ts`
24 * import extensions so the host's bundler traces and transpiles it. That form
25 * cannot execute under plain Node (`Cannot use import statement outside a
26 * module`, and `.ts` specifiers don't resolve). A live module that must run in
27 * BOTH a bundled and a bundler-less runtime — better-auth's Prisma adapter,
28 * imported by the Next server AND by a Playwright e2e helper / build-time
29 * script — therefore has no Node-loadable entry to point at. Setting
30 * `output: { buildTarget: 'node' }` emits one.
34 * A compiled ESM build under `<opensaasDir>/dist/`: