From 200cfc4b874c6140d447fd6c1c580501f1a03b88 Mon Sep 17 00:00:00 2001 From: Christina Holland Date: Wed, 2 Jul 2025 14:24:31 -0700 Subject: [PATCH 1/6] New internal builds for google3 --- packages/app-check-interop-types/index.d.ts | 4 +- packages/firebase/.gitignore | 4 +- .../custom/analytics-remote-config.cdn.ts | 23 +++++++ packages/firebase/custom/index.all.cdn.ts | 34 ++++++++++ packages/firebase/package.json | 3 +- packages/firebase/rollup-internal.config.js | 62 ++++++++++++++++++- packages/firebase/rollup.config.js | 4 +- 7 files changed, 126 insertions(+), 8 deletions(-) create mode 100644 packages/firebase/custom/analytics-remote-config.cdn.ts create mode 100644 packages/firebase/custom/index.all.cdn.ts diff --git a/packages/app-check-interop-types/index.d.ts b/packages/app-check-interop-types/index.d.ts index cc16c5e4680..504c63c5819 100644 --- a/packages/app-check-interop-types/index.d.ts +++ b/packages/app-check-interop-types/index.d.ts @@ -34,10 +34,10 @@ export interface FirebaseAppCheckInternal { removeTokenListener(listener: AppCheckTokenListener): void; } -type AppCheckTokenListener = (token: AppCheckTokenResult) => void; +export type AppCheckTokenListener = (token: AppCheckTokenResult) => void; // If the error field is defined, the token field will be populated with a dummy token -interface AppCheckTokenResult { +export interface AppCheckTokenResult { readonly token: string; readonly error?: Error; } diff --git a/packages/firebase/.gitignore b/packages/firebase/.gitignore index 228443ec909..ea616f7f428 100644 --- a/packages/firebase/.gitignore +++ b/packages/firebase/.gitignore @@ -1,4 +1,6 @@ /firebase*.js /firebase*.map /firebase*.gz -/firebase*.tgz \ No newline at end of file +/firebase*.tgz +/custom/*.d.ts +/packages \ No newline at end of file diff --git a/packages/firebase/custom/analytics-remote-config.cdn.ts b/packages/firebase/custom/analytics-remote-config.cdn.ts new file mode 100644 index 00000000000..db11a53fd3f --- /dev/null +++ b/packages/firebase/custom/analytics-remote-config.cdn.ts @@ -0,0 +1,23 @@ +/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { registerVersion } from '@firebase/app'; +import { version } from '../package.json'; + +export * as app from '@firebase/app'; +export * as analytics from '@firebase/analytics'; +export * as remoteConfig from '@firebase/remote-config'; diff --git a/packages/firebase/custom/index.all.cdn.ts b/packages/firebase/custom/index.all.cdn.ts new file mode 100644 index 00000000000..2ad81407664 --- /dev/null +++ b/packages/firebase/custom/index.all.cdn.ts @@ -0,0 +1,34 @@ +/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { registerVersion } from '@firebase/app'; +import { version } from '../package.json'; + +registerVersion('fire-js-all', version, 'cdn'); +export * as app from '@firebase/app'; +export * as ai from '@firebase/ai'; +export * as analytics from '@firebase/analytics'; +export * as appCheck from '@firebase/app-check'; +export * as auth from '@firebase/auth'; +export * as dataConnect from '@firebase/data-connect'; +export * as database from '@firebase/database'; +export * as firestore from '@firebase/firestore'; +export * as functions from '@firebase/functions'; +export * as installations from '@firebase/installations'; +export * as messaging from '@firebase/messaging'; +export * as performance from '@firebase/performance'; +export * as remoteConfig from '@firebase/remote-config'; diff --git a/packages/firebase/package.json b/packages/firebase/package.json index 4f785d15c8c..aa107876e57 100644 --- a/packages/firebase/package.json +++ b/packages/firebase/package.json @@ -403,7 +403,7 @@ }, "scripts": { "build": "rollup -c && gulp cdn-type-module-path && yarn build:compat", - "build:internal": "rollup -c && gulp cdn-type-module-path-internal && yarn build:compat", + "build:internal": "rollup -c rollup-internal.config.js && gulp cdn-type-module-path-internal && yarn build:compat", "build:compat": "rollup -c compat/rollup.config.js", "dev": "rollup -c -w", "test": "echo 'No test suite for firebase wrapper'", @@ -446,6 +446,7 @@ "@rollup/plugin-node-resolve": "16.0.0", "rollup-plugin-sourcemaps": "0.6.3", "@rollup/plugin-terser": "0.4.4", + "rollup-plugin-dts": "5.3.1", "rollup-plugin-typescript2": "0.36.0", "rollup-plugin-uglify": "6.0.4", "gulp": "4.0.2", diff --git a/packages/firebase/rollup-internal.config.js b/packages/firebase/rollup-internal.config.js index 7511a41a502..de636c62eb5 100644 --- a/packages/firebase/rollup-internal.config.js +++ b/packages/firebase/rollup-internal.config.js @@ -21,8 +21,23 @@ */ // When run in google3, original rollup.config.js will have been renamed to rollup-main.config.js. -import baseBuilds from './rollup-main.config.js'; +import { cdnBuilds, plugins } from './rollup.config.js'; import license from 'rollup-plugin-license'; +import typescript from 'typescript'; +import rollupTypescriptPlugin from 'rollup-plugin-typescript2'; +import dts from 'rollup-plugin-dts'; +import { parse } from 'path'; + +const typescriptPluginCustom = rollupTypescriptPlugin({ + typescript, + allowJs: true, + include: ['*.ts', '**/*.ts', '*.js', '**/*.js'], + tsconfigOverride: { + compilerOptions: { + declaration: true + } + } +}); const firebaseLicense = license({ banner: `@license @@ -30,10 +45,51 @@ const firebaseLicense = license({ SPDX-License-Identifier: Apache-2.0` }); -const buildsWithLicense = baseBuilds.map(build => { +const buildsWithLicense = cdnBuilds.map(build => { return Object.assign({}, build, { plugins: build.plugins.concat(firebaseLicense) }); }); -export default buildsWithLicense; +/** + * Custom builds that include combinations of multiple products. + */ +const customBuilds = [ + { inputFile: 'custom/index.all.cdn.ts', outputFile: 'firebase.js' }, + { + inputFile: 'custom/analytics-remote-config.cdn.ts', + outputFile: 'firebase-analytics-rc.js' + } +] + .map(build => { + const { dir, name } = parse(build.inputFile); + console.log(`${dir}/${name}.d.ts`); + console.log(`dist/${name}.global.d.ts`); + return [ + { + input: build.inputFile, + output: { + file: build.outputFile, + sourcemap: true, + format: 'es' + }, + plugins: [...plugins, typescriptPluginCustom, firebaseLicense] + }, + { + input: `${dir}/${name}.d.ts`, + output: { + file: `dist/${name}.global.d.ts`, + format: 'es' + }, + plugins: [ + dts({ + respectExternal: true + }) + ] + } + ]; + }).flat(); + + console.log(customBuilds.length); + +export default [/*...buildsWithLicense,*/ ...customBuilds]; diff --git a/packages/firebase/rollup.config.js b/packages/firebase/rollup.config.js index f96ff01666c..849bb394ef1 100644 --- a/packages/firebase/rollup.config.js +++ b/packages/firebase/rollup.config.js @@ -134,7 +134,7 @@ const componentBuilds = pkg.components /** * CDN script builds */ -const cdnBuilds = [ +export const cdnBuilds = [ { input: 'app/index.cdn.ts', output: { @@ -175,4 +175,6 @@ const cdnBuilds = [ }) ]; +export { plugins }; + export default [...appBuilds, ...componentBuilds, ...cdnBuilds]; From e4dcf82b75e99b1478328e9e43cb9f7b15872075 Mon Sep 17 00:00:00 2001 From: Christina Holland Date: Wed, 2 Jul 2025 14:27:10 -0700 Subject: [PATCH 2/6] remove "cdn" from file names --- ...lytics-remote-config.cdn.ts => analytics-remote-config.ts} | 0 packages/firebase/custom/{index.all.cdn.ts => index.all.ts} | 0 packages/firebase/rollup-internal.config.js | 4 ++-- 3 files changed, 2 insertions(+), 2 deletions(-) rename packages/firebase/custom/{analytics-remote-config.cdn.ts => analytics-remote-config.ts} (100%) rename packages/firebase/custom/{index.all.cdn.ts => index.all.ts} (100%) diff --git a/packages/firebase/custom/analytics-remote-config.cdn.ts b/packages/firebase/custom/analytics-remote-config.ts similarity index 100% rename from packages/firebase/custom/analytics-remote-config.cdn.ts rename to packages/firebase/custom/analytics-remote-config.ts diff --git a/packages/firebase/custom/index.all.cdn.ts b/packages/firebase/custom/index.all.ts similarity index 100% rename from packages/firebase/custom/index.all.cdn.ts rename to packages/firebase/custom/index.all.ts diff --git a/packages/firebase/rollup-internal.config.js b/packages/firebase/rollup-internal.config.js index de636c62eb5..d602d0e3610 100644 --- a/packages/firebase/rollup-internal.config.js +++ b/packages/firebase/rollup-internal.config.js @@ -55,9 +55,9 @@ const buildsWithLicense = cdnBuilds.map(build => { * Custom builds that include combinations of multiple products. */ const customBuilds = [ - { inputFile: 'custom/index.all.cdn.ts', outputFile: 'firebase.js' }, + { inputFile: 'custom/index.all.ts', outputFile: 'firebase.js' }, { - inputFile: 'custom/analytics-remote-config.cdn.ts', + inputFile: 'custom/analytics-remote-config.ts', outputFile: 'firebase-analytics-rc.js' } ] From 99003124e272de6934db559d0c0439f6429e0bfc Mon Sep 17 00:00:00 2001 From: Christina Holland Date: Wed, 2 Jul 2025 14:27:43 -0700 Subject: [PATCH 3/6] format --- packages/firebase/rollup-internal.config.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/firebase/rollup-internal.config.js b/packages/firebase/rollup-internal.config.js index d602d0e3610..cba458bae92 100644 --- a/packages/firebase/rollup-internal.config.js +++ b/packages/firebase/rollup-internal.config.js @@ -88,8 +88,9 @@ const customBuilds = [ ] } ]; - }).flat(); + }) + .flat(); - console.log(customBuilds.length); +console.log(customBuilds.length); export default [/*...buildsWithLicense,*/ ...customBuilds]; From 608c71ea6cbe6af8cc35a401a9a2874d5fb4d200 Mon Sep 17 00:00:00 2001 From: Christina Holland Date: Tue, 8 Jul 2025 15:31:34 -0700 Subject: [PATCH 4/6] add internal build setup to compat --- docs-devsite/ai.objectschemarequest.md | 45 +++++++++++++++++++ .../firebase/compat/rollup-internal.config.js | 39 ++++++++++++++++ packages/firebase/package.json | 3 +- packages/firebase/rollup-internal.config.js | 2 +- 4 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 docs-devsite/ai.objectschemarequest.md create mode 100644 packages/firebase/compat/rollup-internal.config.js diff --git a/docs-devsite/ai.objectschemarequest.md b/docs-devsite/ai.objectschemarequest.md new file mode 100644 index 00000000000..ccc554ab42f --- /dev/null +++ b/docs-devsite/ai.objectschemarequest.md @@ -0,0 +1,45 @@ +Project: /docs/reference/js/_project.yaml +Book: /docs/reference/_book.yaml +page_type: reference + +{% comment %} +DO NOT EDIT THIS FILE! +This is generated by the JS SDK team, and any local changes will be +overwritten. Changes should be made in the source code at +https://github.com/firebase/firebase-js-sdk +{% endcomment %} + +# ObjectSchemaRequest interface +Interface for JSON parameters in [SchemaType.OBJECT](./ai.md#schematypeobject_enummember) format when not using the [ObjectSchema](./ai.objectschema.md#objectschema_class) helper. + +Signature: + +```typescript +export interface ObjectSchemaRequest extends SchemaRequest +``` +Extends: [SchemaRequest](./ai.schemarequest.md#schemarequest_interface) + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [optionalProperties](./ai.objectschemarequest.md#objectschemarequestoptionalproperties) | never | This is not a property accepted in the final request to the backend, but is a client-side convenience property that is only usable by constructing a schema through the Schema.object() helper method. Populating this property will cause response errors if the object is not wrapped with Schema.object(). | +| [type](./ai.objectschemarequest.md#objectschemarequesttype) | [SchemaType.OBJECT](./ai.md#schematypeobject_enummember) | | + +## ObjectSchemaRequest.optionalProperties + +This is not a property accepted in the final request to the backend, but is a client-side convenience property that is only usable by constructing a schema through the `Schema.object()` helper method. Populating this property will cause response errors if the object is not wrapped with `Schema.object()`. + +Signature: + +```typescript +optionalProperties?: never; +``` + +## ObjectSchemaRequest.type + +Signature: + +```typescript +type: SchemaType.OBJECT; +``` diff --git a/packages/firebase/compat/rollup-internal.config.js b/packages/firebase/compat/rollup-internal.config.js new file mode 100644 index 00000000000..e512d6b036d --- /dev/null +++ b/packages/firebase/compat/rollup-internal.config.js @@ -0,0 +1,39 @@ +/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Specialized config only for internal deployment to google3 repo, adds required license header to + * generated code. + */ + +// When run in google3, original rollup.config.js will have been renamed to rollup-main.config.js. +import * as baseBuilds from './rollup.config.js'; +import license from 'rollup-plugin-license'; + +const firebaseLicense = license({ + banner: `@license + Copyright ${new Date().getFullYear()} Google LLC. + SPDX-License-Identifier: Apache-2.0` +}); + +const buildsWithLicense = baseBuilds.map(build => { + return Object.assign({}, build, { + plugins: build.plugins.concat(firebaseLicense) + }); +}); + +export default buildsWithLicense; diff --git a/packages/firebase/package.json b/packages/firebase/package.json index aa107876e57..e82e55738c7 100644 --- a/packages/firebase/package.json +++ b/packages/firebase/package.json @@ -403,8 +403,9 @@ }, "scripts": { "build": "rollup -c && gulp cdn-type-module-path && yarn build:compat", - "build:internal": "rollup -c rollup-internal.config.js && gulp cdn-type-module-path-internal && yarn build:compat", + "build:internal": "rollup -c rollup-internal.config.js && gulp cdn-type-module-path-internal && yarn build:compat:internal", "build:compat": "rollup -c compat/rollup.config.js", + "build:compat:internal": "rollup -c compat/rollup-internal.config.js", "dev": "rollup -c -w", "test": "echo 'No test suite for firebase wrapper'", "test:ci": "echo 'No test suite for firebase wrapper'", diff --git a/packages/firebase/rollup-internal.config.js b/packages/firebase/rollup-internal.config.js index cba458bae92..9adb0ebfef2 100644 --- a/packages/firebase/rollup-internal.config.js +++ b/packages/firebase/rollup-internal.config.js @@ -93,4 +93,4 @@ const customBuilds = [ console.log(customBuilds.length); -export default [/*...buildsWithLicense,*/ ...customBuilds]; +export default [...buildsWithLicense, ...customBuilds]; From b32530dd65037117ebeba746f0ec5f2fc9ff91fe Mon Sep 17 00:00:00 2001 From: Christina Holland Date: Tue, 8 Jul 2025 15:37:43 -0700 Subject: [PATCH 5/6] fix baseBuilds import --- packages/firebase/compat/rollup-internal.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/firebase/compat/rollup-internal.config.js b/packages/firebase/compat/rollup-internal.config.js index e512d6b036d..2dfc4d1f29c 100644 --- a/packages/firebase/compat/rollup-internal.config.js +++ b/packages/firebase/compat/rollup-internal.config.js @@ -21,7 +21,7 @@ */ // When run in google3, original rollup.config.js will have been renamed to rollup-main.config.js. -import * as baseBuilds from './rollup.config.js'; +import baseBuilds from './rollup.config.js'; import license from 'rollup-plugin-license'; const firebaseLicense = license({ From 91c709b56470b95039259189930d37e3b4e1d65a Mon Sep 17 00:00:00 2001 From: Christina Holland Date: Tue, 8 Jul 2025 16:36:52 -0700 Subject: [PATCH 6/6] remove console logs --- packages/firebase/rollup-internal.config.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/packages/firebase/rollup-internal.config.js b/packages/firebase/rollup-internal.config.js index 9adb0ebfef2..512004e4499 100644 --- a/packages/firebase/rollup-internal.config.js +++ b/packages/firebase/rollup-internal.config.js @@ -63,8 +63,6 @@ const customBuilds = [ ] .map(build => { const { dir, name } = parse(build.inputFile); - console.log(`${dir}/${name}.d.ts`); - console.log(`dist/${name}.global.d.ts`); return [ { input: build.inputFile, @@ -91,6 +89,4 @@ const customBuilds = [ }) .flat(); -console.log(customBuilds.length); - export default [...buildsWithLicense, ...customBuilds];