change: Remove Deprecated Legacy Namespace Support#3164
Conversation
There was a problem hiding this comment.
Code Review
This pull request removes the legacy namespaced API (firebase-admin namespace, default-namespace.d.ts, firebase-namespace.ts, etc.) and transitions the codebase entirely to the modular API. This includes removing the copyTypings gulp task, updating entrypoints, deleting legacy namespace declaration files, removing legacy integration and unit tests, and updating the main entrypoint src/index.ts to export only modular APIs.
jonathanedey
left a comment
There was a problem hiding this comment.
LGTM with one comment, Thanks!
| @@ -35,4 +35,14 @@ https://firebase.google.com/docs/web/setup | |||
| console.error(message); | |||
| } | |||
There was a problem hiding this comment.
src/index.ts is now a mirror copy of src/app/index.ts except for this extra environment check.
- Should we also have this warning in
src/app/index.ts? - Is there a way we can de-duplicate this while keeping the same functionalty?
There was a problem hiding this comment.
Good question. Let me look into this. I think with this way both root and submodules (for app) will work, which I think is reasonable.
import { initializeApp, App } from 'firebase-admin';
// OR
import { initializeApp, App } from 'firebase-admin/app';
This PR removes the legacy, deprecated namespaces support from the SDK. Namespaces have been replaced by modular imports (since v10), and this completes the transition of the Firebase Admin Node.js SDK into a purely modular SDK for
v14.All legacy files have been deleted, the main entry points and build systems have been modernized, and the test suites have been fully cleaned up and verified.
This is a breaking change
Key Changes
1. Deleted Legacy Namespace Implementation & Test Files
Removed all
*namespace.ts,*namespace.d.ts, and obsolete test files:src/):src/default-namespace.ts/src/default-namespace.d.tssrc/index.d.tssrc/firebase-namespace-api.tssrc/app/firebase-namespace.tssrc/app-check/app-check-namespace.tssrc/auth/auth-namespace.tssrc/database/database-namespace.tssrc/firestore/firestore-namespace.tssrc/instance-id/instance-id-namespace.tssrc/installations/installations-namespace.tssrc/machine-learning/machine-learning-namespace.tssrc/messaging/messaging-namespace.tssrc/project-management/project-management-namespace.tssrc/remote-config/remote-config-namespace.tssrc/security-rules/security-rules-namespace.tssrc/storage/storage-namespace.tstest/unit/app/firebase-namespace.spec.tstest/unit/firebase.spec.tstest/integration/postcheck/typescript/example.test.tstest/integration/postcheck/typescript/example.ts2. Modernized Root Entry Point & Build Configuration
src/index.ts: Rewritten to directly export the core modularAppAPIs (such asinitializeApp,getApp,getApps,deleteApp,cert,refreshToken,SDK_VERSION, etc.) while retaining the environment compatibility check.entrypoints.json: Removed the"legacy": trueflag for"firebase-admin"and redirected the root"typings"to./lib/index.d.ts.gulpfile.js: Removed the obsoletecopyTypingsgulp task and updatedbuildandcompile_alltask dependency pipelines.tsconfig.json: Addedts-nodeconfiguration block definingmoduleTypesto enforce CommonJS compilation for all.tsfiles during execution. This prevents Node's native TypeScript loader (--experimental-strip-types) in Node 23.6.0+ from resolving extension-less imports as ES modules, ensuring a robust and compatible test runner setup.3. Refactored and Cleaned Up Test Suites
test/integration/): Removed legacy namespace assertions fromapp.spec.ts,firestore.spec.ts, anddatabase.spec.ts. Updated assertions to verify modular APIs and modular service bindings.test/unit/):app/firebase-app.spec.ts(preserving core state and token verification logic).test/unit/index.spec.tsto remove deleted legacy spec imports.test/resources/mocks.tsandtest/unit/utils.tsto importAppOptionsfrom modular locations.