0bd06d86d2
Supersedes #1516 (same modernization at TypeScript 6.0). Rebased onto `main` now that the build runs on **tsdown** (#1515). ## What & why Adopt **TypeScript 7** for both packages and modernize the compiler config. TypeScript 7.0's native compiler [ships no programmatic API yet](https://devblogs.microsoft.com/typescript/announcing-typescript-7-0/#running-side-by-side-with-typescript-6.0) (it lands in 7.1), so anything built on the TS compiler API breaks on it — here that's tsdown's `.d.ts` generation and the codegen scripts (`openapi-typescript`, `json-schema-to-typescript`). Per the official guidance, TS 7 is installed **side-by-side** with TS 6: ```json "@typescript/native": "npm:typescript@^7.0.2", // native tsc — used for type-checking "typescript": "npm:@typescript/typescript6@^6.0.2" // TS6 w/ compiler API — used by tooling ``` - `tsc --noEmit` (typecheck) → **native TypeScript 7.0.2** (verified: `tsc --version` → 7.0.2) - `import 'typescript'` → **TypeScript 6.0** *with* the compiler API → tsdown dts + codegen keep working - Bonus: tsdown's dts no longer prints the "TypeScript 7.0 does not yet have a stable API and is experimental" warning (it's on the 6.0 API now) **Internal build-config change only — no public API or runtime behavior changes.** ## Compiler options: before → after ### `packages/js-sdk/tsconfig.json` | option | before | after | |---|---|---| | `target` | `es6` | `es2022` | | `lib` | `["dom","ESNext"]` | `["dom","es2022"]` | | `module` | _(unset)_ | `esnext` | | `moduleResolution` | `node` | `bundler` | | `allowJs` | `true` | **removed** (no `.js` sources) | | `allowSyntheticDefaultImports` | `true` | **removed** (implied by `esModuleInterop`) | | `useDefineForClassFields` | _(false, implied by es6)_ | **`false` (now explicit)** — see note | ### `packages/cli/tsconfig.json` | option | before | after | |---|---|---| | `moduleResolution` | `node` | `bundler` | | `strictNullChecks`, `strictFunctionTypes`, `strictBindCallApply`, `strictPropertyInitialization`, `noImplicitThis`, `alwaysStrict` | `true` | **removed** (implied by `strict`) | | `downlevelIteration` | `true` | **removed** (removed in TS 7; no-op at `es2022`) | | `baseUrl` | `"."` | **removed** (removed in TS 7) | | `paths` | `{ e2b }` | `{ src, "src/*", e2b }` (replaces `baseUrl` for the existing `src/...` import style) | | `outDir` | `"dist"` | **removed** (unused under `tsc --noEmit`) | | `exclude` | _(none)_ | `["dist","node_modules"]` (so the built bundle is never type-checked) | `target`/`lib` for the CLI were already `es2022`. ## Notes / decisions - **Why side-by-side, not a plain `typescript@7` bump:** TS 7.0 is the native (Go) compiler rewrite — feature-identical to 6.0 for type-checking, no programmatic API until 7.1. A plain bump crashed both codegen tools (`Cannot read properties of undefined (reading 'createKeywordTypeNode')`). Side-by-side gives native-TS-7 checking while keeping the TS-6 API for tooling. Once 7.1 ships the API and the tools update, this collapses back to a single `typescript@7` dep. - **`useDefineForClassFields: false` is pinned explicitly.** Raising js-sdk's `target` to `es2022` flips this default to `true`, changing class-field emit and shifting stack frames. The template builder resolves the caller's directory and per-step traces via **fixed-depth** stack walking (`getCallerDirectory` in `src/template/index.ts`), so the extra frames threw it off by one — resolving `.copy('folder/*', …)` against the wrong base dir and mis-attributing build steps (`tests/template/build.test.ts` + `stacktrace.test.ts`). Pinning `false` keeps the exact pre-existing field semantics (es6 already implied `false`); adopting `define` semantics should be a separate, deliberately tested change. - **Target stays at `es2022`, not `es2023`.** `engines` still allow Node 20 (`>=20.18.1 <21 || >=22`). - **`moduleResolution: "bundler"`** typechecks + builds cleanly in both packages. The CLI's `baseUrl`-based bare imports (`from 'src/user'`, `from 'src'`) are preserved via `paths`; the bundled output still resolves them (build verified, binary smoke-tested). ## Not done (intentionally) - **`verbatimModuleSyntax`** — ~177 `import type` conversions; left as a follow-up. - **Shared `tsconfig.base.json`** — the two configs diverge too much to factor out cleanly. ## Verification - `pnpm run typecheck` ✅ both packages, on **native TS 7.0.2** - `pnpm run build` ✅ both packages (js-sdk ESM + CJS + **DTS**; cli CJS; binary smoke-tested) - codegen ✅ `openapi-typescript` + `json2ts` run and produce identical output (idempotent) - `pnpm run lint` ✅ both packages - `pnpm run test` — `template/build` + `template/stacktrace` now pass (`stacktrace` verified locally 30/30); remaining local failures are all `E2B_API_KEY`-gated live tests, unaffected by this change 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
95 lines
2.3 KiB
JSON
95 lines
2.3 KiB
JSON
{
|
|
"name": "@e2b/cli",
|
|
"version": "2.13.1",
|
|
"description": "CLI for managing e2b sandbox templates",
|
|
"homepage": "https://e2b.dev",
|
|
"license": "MIT",
|
|
"author": {
|
|
"name": "FoundryLabs, Inc.",
|
|
"email": "hello@e2b.dev",
|
|
"url": "https://e2b.dev"
|
|
},
|
|
"bugs": "https://github.com/e2b-dev/e2b/issues",
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "https://github.com/e2b-dev/e2b",
|
|
"directory": "packages/cli"
|
|
},
|
|
"publishConfig": {
|
|
"access": "public"
|
|
},
|
|
"keywords": [
|
|
"e2b",
|
|
"ai-agents",
|
|
"agents",
|
|
"ai",
|
|
"code-interpreter",
|
|
"sandbox",
|
|
"code",
|
|
"cli",
|
|
"runtime",
|
|
"vm",
|
|
"nodejs",
|
|
"javascript",
|
|
"typescript"
|
|
],
|
|
"sideEffects": false,
|
|
"scripts": {
|
|
"prepublishOnly": "pnpm build",
|
|
"build": "tsc --noEmit --skipLibCheck && tsdown --minify",
|
|
"dev": "tsdown --watch",
|
|
"typecheck": "tsc --noEmit --skipLibCheck",
|
|
"lint": "oxlint --config ../../.oxlintrc.json src",
|
|
"format": "prettier --write src",
|
|
"test:interactive": "pnpm build && ./dist/index.js",
|
|
"test": "vitest run",
|
|
"test:watch": "vitest watch",
|
|
"test:coverage": "vitest run --coverage",
|
|
"check-deps": "knip"
|
|
},
|
|
"devDependencies": {
|
|
"@types/handlebars": "^4.1.0",
|
|
"@types/inquirer": "^9.0.7",
|
|
"@types/json2md": "^1.5.4",
|
|
"@types/node": "^20.19.19",
|
|
"@types/npmcli__package-json": "^4.0.4",
|
|
"@types/statuses": "^2.0.5",
|
|
"@typescript/native": "npm:typescript@^7.0.2",
|
|
"@vitest/coverage-v8": "^4.1.0",
|
|
"json2md": "^2.0.1",
|
|
"knip": "^5.43.6",
|
|
"tsdown": "^0.22.3",
|
|
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
"vitest": "^4.1.8"
|
|
},
|
|
"files": [
|
|
"dist",
|
|
"LICENSE",
|
|
"README",
|
|
"package.json"
|
|
],
|
|
"bin": {
|
|
"e2b": "dist/index.js"
|
|
},
|
|
"dependencies": {
|
|
"@iarna/toml": "^2.2.5",
|
|
"@inquirer/prompts": "^7.9.0",
|
|
"@npmcli/package-json": "^5.2.1",
|
|
"async-listen": "^3.0.1",
|
|
"boxen": "^7.1.1",
|
|
"chalk": "^5.3.0",
|
|
"cli-highlight": "^2.1.11",
|
|
"commander": "^11.1.0",
|
|
"console-table-printer": "^2.11.2",
|
|
"e2b": "^2.32.0",
|
|
"handlebars": "^4.7.9",
|
|
"inquirer": "^12.10.0",
|
|
"simple-update-notifier": "^2.0.0",
|
|
"statuses": "^2.0.1",
|
|
"yup": "^1.3.2"
|
|
},
|
|
"engines": {
|
|
"node": ">=20.18.1 <21 || >=22"
|
|
}
|
|
}
|