feat(DEP0210,DEP0211): migrate SQLite class names to `Database` and `Statement`

Aperta
#560 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
node.js, sqlite, typescript
Ambito
devtools, tooling

Direzione di ricerca

Start by reading the repository's existing codemods and their fixture/test conventions; the issue does not name specific files. Then trace how they resolve imports and update bound references before implementing the node:sqlite rename. Done means fixtures cover the listed import forms, aliases, collisions, shadowing, and re-exports, while unrelated identifiers remain unchanged and running the transform twice makes no further changes.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

good first issue human help wanted

Node.js 26.11.0 renamed two public classes exported by node:sqlite:

  • DatabaseSync became Database (DEP0210).
  • StatementSync became Statement (DEP0211).

The previous names remain available as documentation-deprecated aliases. The rename does not make the APIs asynchronous.

Add one codemod that migrates imports and references for both deprecated names. Support CommonJS destructuring and property access, ESM named and namespace imports, aliases, and statically resolvable dynamic imports.

Additional Information

  • Target projects whose supported Node.js versions provide the replacement exports. The Node.js 26 baseline for this migration is 26.11.0.
  • Resolve imports from node:sqlite; do not rewrite unrelated identifiers with the same names or third-party SQLite packages.
  • Update constructor references, instanceof checks, namespace accesses, and TypeScript references tied to the imported binding where supported.
  • Statement instances are normally returned by database methods. Do not introduce a new Statement() call as part of this migration.
  • Preserve explicit local aliases. For example, DatabaseSync as DB becomes Database as DB.
  • If the replacement binding name conflicts with an existing variable, preserve a local alias rather than introducing a collision.
  • Preserve public export names unless the user explicitly selects an API rename. Replacing an imported symbol must not silently rename an application's own exported API.
  • Leave replacement names and unrelated SQLite APIs unchanged. The transform must be idempotent.
  • Include fixtures for both classes, ESM/CJS imports, namespace access, aliases, binding collisions, shadowed identifiers, and re-export handling.

Examples

Named imports and local references:

-import { DatabaseSync, StatementSync } from 'node:sqlite';
+import { Database, Statement } from 'node:sqlite';

-const db = new DatabaseSync(':memory:');
+const db = new Database(':memory:');
 const statement = db.prepare('SELECT 1');
-console.log(statement instanceof StatementSync);
+console.log(statement instanceof Statement);

Preserve an explicit alias:

-const { DatabaseSync: DB } = require('node:sqlite');
+const { Database: DB } = require('node:sqlite');

 const db = new DB(':memory:');

Preserve an application's existing export name:

-export { DatabaseSync } from 'node:sqlite';
+export { Database as DatabaseSync } from 'node:sqlite';

Refs

Lingua principale
TypeScript
Stelle
85
Fork
58
Merge medio
1g 21h
PR unite (30g)
8

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di nodejs/userland-migrations

Tutte le issue di nodejs/userland-migrations

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.