From 6975f8ae26351e0c9acaa8410b8bfc3d489c5f1b Mon Sep 17 00:00:00 2001 From: Ehsan Nasiri Date: Fri, 19 Apr 2024 13:14:53 -0700 Subject: [PATCH 01/16] Add closure library blobs as Firestore dependency. --- packages/firestore/externs.json | 3 ++- packages/firestore/package.json | 2 +- .../platform/browser/webchannel_connection.ts | 2 +- packages/firestore/src/remote/bloom_filter.ts | 3 ++- .../test/unit/core/webchannel_wrapper.test.ts | 4 ++-- .../bloom-blob/package.json | 8 ++++++++ packages/webchannel-wrapper/gulpfile.js | 20 ++++++++++++++++++- packages/webchannel-wrapper/package.json | 15 ++++++++++++-- .../webchannel-blob/package.json | 8 ++++++++ 9 files changed, 56 insertions(+), 9 deletions(-) create mode 100644 packages/webchannel-wrapper/bloom-blob/package.json create mode 100644 packages/webchannel-wrapper/webchannel-blob/package.json diff --git a/packages/firestore/externs.json b/packages/firestore/externs.json index a1746227316..f7fbbabeb14 100644 --- a/packages/firestore/externs.json +++ b/packages/firestore/externs.json @@ -24,7 +24,8 @@ "packages/component/dist/src/provider.d.ts", "packages/component/dist/src/component_container.d.ts", "packages/logger/dist/src/logger.d.ts", - "packages/webchannel-wrapper/src/index.d.ts", + "packages/webchannel-wrapper/dist/bloom-blob/bloom_blob_types.d.ts", + "packages/webchannel-wrapper/dist/webchannel-blob/webchannel_blob_types.d.ts", "packages/util/dist/src/crypt.d.ts", "packages/util/dist/src/defaults.d.ts", "packages/util/dist/src/emulator.d.ts", diff --git a/packages/firestore/package.json b/packages/firestore/package.json index 6e4f08f7d0b..2a9f06442c5 100644 --- a/packages/firestore/package.json +++ b/packages/firestore/package.json @@ -99,7 +99,7 @@ "@firebase/component": "0.6.6", "@firebase/logger": "0.4.1", "@firebase/util": "1.9.5", - "@firebase/webchannel-wrapper": "0.10.6", + "@firebase/webchannel-wrapper": "0.10.7", "@grpc/grpc-js": "~1.9.0", "@grpc/proto-loader": "^0.7.8", "undici": "5.28.4", diff --git a/packages/firestore/src/platform/browser/webchannel_connection.ts b/packages/firestore/src/platform/browser/webchannel_connection.ts index 05cd79ecf9e..f709612092f 100644 --- a/packages/firestore/src/platform/browser/webchannel_connection.ts +++ b/packages/firestore/src/platform/browser/webchannel_connection.ts @@ -28,7 +28,7 @@ import { StatEvent, Event, Stat -} from '@firebase/webchannel-wrapper'; +} from '@firebase/webchannel-wrapper/webchannel-blob'; import { Token } from '../../api/credentials'; import { ExperimentalLongPollingOptions } from '../../api/long_polling_options'; diff --git a/packages/firestore/src/remote/bloom_filter.ts b/packages/firestore/src/remote/bloom_filter.ts index 4c0e4ef6b7e..afb8d731211 100644 --- a/packages/firestore/src/remote/bloom_filter.ts +++ b/packages/firestore/src/remote/bloom_filter.ts @@ -14,7 +14,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { Md5, Integer } from '@firebase/webchannel-wrapper'; + +import { Md5, Integer } from '@firebase/webchannel-wrapper/bloom-blob'; import { newTextEncoder } from '../platform/text_serializer'; diff --git a/packages/firestore/test/unit/core/webchannel_wrapper.test.ts b/packages/firestore/test/unit/core/webchannel_wrapper.test.ts index 3f3272aea48..4db46e4f9af 100644 --- a/packages/firestore/test/unit/core/webchannel_wrapper.test.ts +++ b/packages/firestore/test/unit/core/webchannel_wrapper.test.ts @@ -19,12 +19,12 @@ // These tests are mostly to ensure that the exported classes correctly map to // underlying functionality from google-closure-library. -import { Md5, Integer } from '@firebase/webchannel-wrapper'; +import { Md5, Integer } from '@firebase/webchannel-wrapper/bloom-blob'; import { expect } from 'chai'; import { newTextEncoder } from '../../../src/platform/text_serializer'; -describe('Md5', () => { +describe.only('Md5', () => { // The precomputed MD5 digests of the 3-character strings "abc" and "def". const DIGEST_OF_ABC = Object.freeze([ 144, 1, 80, 152, 60, 210, 79, 176, 214, 150, 63, 125, 40, 225, 127, 114 diff --git a/packages/webchannel-wrapper/bloom-blob/package.json b/packages/webchannel-wrapper/bloom-blob/package.json new file mode 100644 index 00000000000..9bb95f7bb48 --- /dev/null +++ b/packages/webchannel-wrapper/bloom-blob/package.json @@ -0,0 +1,8 @@ +{ + "name": "@firebase/webchannel-wrapper/bloom-blob", + "description": "Bloom filter related code from the Closure library.", + "browser": "../dist/bloom-blob/bloom_blob_es2018.js", + "module": "../dist/bloom-blob/bloom_blob_es2018.js", + "esm5": "../dist/bloom-blob/bloom_blob_es5.js", + "typings": "../dist/bloom-blob/bloom_blob_types.d.ts" +} diff --git a/packages/webchannel-wrapper/gulpfile.js b/packages/webchannel-wrapper/gulpfile.js index 820f7ea537e..ba3320b63b2 100644 --- a/packages/webchannel-wrapper/gulpfile.js +++ b/packages/webchannel-wrapper/gulpfile.js @@ -16,6 +16,7 @@ */ const gulp = require('gulp'); +const rename = require("gulp-rename"); const rollup = require('rollup'); const closureCompiler = require('google-closure-compiler').gulp(); const del = require('del'); @@ -215,4 +216,21 @@ gulp.task( gulp.task('buildAll', gulp.parallel('cjs', 'allEsm')); -gulp.task('default', gulp.series('buildAll', deleteIntermediateFiles)); +// A task to distribute bloom blobs into 'dist' +gulp.task('distributeBloomBlobs', () => { + return gulp.src('closure-net/firebase/bloom_blob_*') + // .pipe(rename(function (path) { + // path.basename += "index"; + // path.extname = ".md"; + // })) + .pipe(gulp.dest('dist/bloom-blob/')); +}); + +// A task to distribute bloom blobs into 'dist' +gulp.task('distributeWebchannelBlobs', () => { + return gulp.src('closure-net/firebase/webchannel_blob_*') + .pipe(gulp.dest('dist/webchannel-blob/')); +}); + +gulp.task('default', gulp.series('buildAll', 'distributeBloomBlobs', 'distributeWebchannelBlobs', deleteIntermediateFiles)); +//gulp.task('default', gulp.series('buildAll', deleteIntermediateFiles)); diff --git a/packages/webchannel-wrapper/package.json b/packages/webchannel-wrapper/package.json index 7efcd02a555..db5939c8d9a 100644 --- a/packages/webchannel-wrapper/package.json +++ b/packages/webchannel-wrapper/package.json @@ -1,6 +1,6 @@ { "name": "@firebase/webchannel-wrapper", - "version": "0.10.6", + "version": "0.10.7", "description": "A wrapper of the webchannel packages from closure-library for use outside of a closure compiled application", "author": "Firebase (https://firebase.google.com/)", "main": "dist/index.js", @@ -13,10 +13,20 @@ "esm5": "./dist/esm/index.esm.js", "default": "./dist/esm/index.esm2017.js" }, + "./webchannel-blob": { + "types": "./dist/webchannel-blob/webchannel_blob_types.d.ts", + "default": "./dist/webchannel-blob/webchannel_blob_es2018.js" + }, + "./bloom-blob": { + "types": "./dist/bloom-blob/bloom_blob_types.d.ts", + "default": "./dist/bloom-blob/bloom_blob_es2018.js" + }, "./package.json": "./package.json" }, "files": [ - "dist" + "dist", + "bloom-blob/package.json", + "webchannel-blob/package.json" ], "scripts": { "dev": "watch 'yarn build' src", @@ -30,6 +40,7 @@ "google-closure-compiler": "20230228.0.0", "google-closure-library": "git+https://github.com/google/closure-library.git#7818ff7", "gulp": "4.0.2", + "gulp-rename": "2.0.0", "gulp-sourcemaps": "3.0.0", "rollup": "2.79.1", "rollup-plugin-sourcemaps": "0.6.3", diff --git a/packages/webchannel-wrapper/webchannel-blob/package.json b/packages/webchannel-wrapper/webchannel-blob/package.json new file mode 100644 index 00000000000..8b7a532ed03 --- /dev/null +++ b/packages/webchannel-wrapper/webchannel-blob/package.json @@ -0,0 +1,8 @@ +{ + "name": "@firebase/webchannel-wrapper/webchannel-blob", + "description": "Webchannel related code from the Closure library.", + "browser": "../dist/webchannel-blob/webchannel_blob_es2018.js", + "module": "../dist/webchannel-blob/webchannel_blob_es2018.js", + "esm5": "../dist/webchannel-blob/webchannel_blob_es5.js", + "typings": "../dist/webchannel-blob/webchannel_blob_types.d.ts" +} From c514a7ac097150d64cf49afbe686bd8c5f83064a Mon Sep 17 00:00:00 2001 From: Ehsan Nasiri Date: Fri, 19 Apr 2024 14:15:17 -0700 Subject: [PATCH 02/16] Remove our compilation of Closure. --- packages/webchannel-wrapper/CHANGELOG.md | 4 + packages/webchannel-wrapper/externs/module.js | 19 -- .../webchannel-wrapper/externs/overrides.js | 86 -------- packages/webchannel-wrapper/gulpfile.js | 207 +----------------- packages/webchannel-wrapper/package.json | 13 -- packages/webchannel-wrapper/src/index.d.ts | 165 -------------- packages/webchannel-wrapper/src/index.js | 109 --------- 7 files changed, 6 insertions(+), 597 deletions(-) delete mode 100644 packages/webchannel-wrapper/externs/module.js delete mode 100644 packages/webchannel-wrapper/externs/overrides.js delete mode 100644 packages/webchannel-wrapper/src/index.d.ts delete mode 100644 packages/webchannel-wrapper/src/index.js diff --git a/packages/webchannel-wrapper/CHANGELOG.md b/packages/webchannel-wrapper/CHANGELOG.md index 07eb7707aed..b1fd55970e7 100644 --- a/packages/webchannel-wrapper/CHANGELOG.md +++ b/packages/webchannel-wrapper/CHANGELOG.md @@ -1,5 +1,9 @@ # @firebase/webchannel-wrapper +## 0.10.7 + +- Change the Closure library dependency to closure-net. + ## 0.10.6 ### Patch Changes diff --git a/packages/webchannel-wrapper/externs/module.js b/packages/webchannel-wrapper/externs/module.js deleted file mode 100644 index 37e045fc23a..00000000000 --- a/packages/webchannel-wrapper/externs/module.js +++ /dev/null @@ -1,19 +0,0 @@ -/** - * @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. - */ - -/** @type {!Object} */ -const module = {}; diff --git a/packages/webchannel-wrapper/externs/overrides.js b/packages/webchannel-wrapper/externs/overrides.js deleted file mode 100644 index 8aa01e2ae5d..00000000000 --- a/packages/webchannel-wrapper/externs/overrides.js +++ /dev/null @@ -1,86 +0,0 @@ -/** - * @license - * Copyright 2017 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. - */ - -/** - * Overrides for the goog.net.WebChannel.Options object provided - * by closure-library. This prevents the mangling of these properties - * so downstream clients can properly leverage the API - */ - -/** @record @suppress {duplicate} */ -goog.net.WebChannel.Options = {}; - -/** @type {Object|undefined} */ -goog.net.WebChannel.Options.messageHeaders; - -/** @type {Object|undefined} */ -goog.net.WebChannel.Options.initMessageHeaders; - -/** @type {string|boolean|undefined} */ -goog.net.WebChannel.Options.messageContentType; - -/** @type {Object|undefined|undefined} */ -goog.net.WebChannel.Options.messageUrlParams; - -/** @type {boolean|undefined} */ -goog.net.WebChannel.Options.clientProtocolHeaderRequired; - -/** @type {number|undefined} */ -goog.net.WebChannel.Options.concurrentRequestLimit; - -/** @type {boolean|undefined} */ -goog.net.WebChannel.Options.supportsCrossDomainXhr; - -/** @type {boolean|undefined} */ -goog.net.WebChannel.Options.sendRawJson; - -/** @type {string|undefined} */ -goog.net.WebChannel.Options.httpSessionIdParam; - -/** @type {boolean|undefined} */ -goog.net.WebChannel.Options.encodeInitMessageHeaders; - -/** @type {boolean|undefined} */ -goog.net.WebChannel.Options.fastHandshake; - -/** @type {!Object|undefined} */ -goog.net.WebChannel.Options.internalChannelParams; - -/** @type {boolean|undefined} */ -goog.net.WebChannel.Options.forceLongPolling; - -/** @type {boolean|undefined} */ -goog.net.WebChannel.Options.detectBufferingProxy; - -/** @type {boolean|undefined} */ -goog.net.WebChannel.Options.useFetchStreams; - -/** @type {unknown} */ -goog.net.WebChannel.Options.xmlHttpFactory; - -/** @type {number|undefined} */ -goog.net.WebChannel.Options.longPollingTimeout; - -goog.labs.net.webChannel.requestStats.Event = {}; -goog.labs.net.webChannel.requestStats.Event.STAT_EVENT; - -goog.labs.net.webChannel.requestStats.StatEvent = {}; -goog.labs.net.webChannel.requestStats.StatEvent.stat; - -goog.labs.net.webChannel.requestStats.Stat = {}; -goog.labs.net.webChannel.requestStats.Stat.PROXY; -goog.labs.net.webChannel.requestStats.Stat.NOPROXY; diff --git a/packages/webchannel-wrapper/gulpfile.js b/packages/webchannel-wrapper/gulpfile.js index ba3320b63b2..95b860612e4 100644 --- a/packages/webchannel-wrapper/gulpfile.js +++ b/packages/webchannel-wrapper/gulpfile.js @@ -16,213 +16,10 @@ */ const gulp = require('gulp'); -const rename = require("gulp-rename"); -const rollup = require('rollup'); -const closureCompiler = require('google-closure-compiler').gulp(); -const del = require('del'); -const path = require('path'); -const sourcemaps = require('gulp-sourcemaps'); -const { resolve } = require('path'); -const commonjs = require('@rollup/plugin-commonjs'); -const rollupSourcemaps = require('rollup-plugin-sourcemaps'); -const typescriptPlugin = require('rollup-plugin-typescript2'); -const typescript = require('typescript'); -const pkg = require('./package.json'); - -// Copied from "../../scripts/build/rollup_emit_module_package_file" which is ESM -// and would require converting this file to MJS to use -function emitModulePackageFile() { - return { - generateBundle() { - this.emitFile({ - fileName: 'package.json', - source: `{"type":"module"}`, - type: 'asset' - }); - }, - name: 'emit-module-package-file' - }; -} - -// The optimization level for the JS compiler. -// Valid levels: WHITESPACE_ONLY, SIMPLE_OPTIMIZATIONS, ADVANCED_OPTIMIZATIONS. -const OPTIMIZATION_LEVEL = 'ADVANCED_OPTIMIZATIONS'; - -// For minified builds, wrap the output so we avoid leaking global variables. -const CJS_WRAPPER_PREFIX = `(function() {`; -const CJS_WRAPPER_SUFFIX = - `}).apply(typeof global !== 'undefined' ? ` + - `global : typeof self !== 'undefined' ? ` + - `self : typeof window !== 'undefined' ? window : {});`; - -const closureLibRoot = path.dirname( - require.resolve('google-closure-library/package.json') -); - -const closureDefines = [ - // Avoid unsafe eval() calls (https://github.com/firebase/firebase-js-sdk/issues/798) - 'goog.json.USE_NATIVE_JSON=true', - // Disable debug logging (saves 8780 bytes). - 'goog.DEBUG=false', - // Disable fallbacks for running async code (saves 1472 bytes). - 'goog.ASSUME_NATIVE_PROMISE=true', - // Disables IE8-specific event fallback code (saves 523 bytes). - 'goog.events.CAPTURE_SIMULATION_MODE=0', - // Disable IE-Specific ActiveX fallback for XHRs (saves 524 bytes). - 'goog.net.XmlHttpDefines.ASSUME_NATIVE_XHR=true', - // Disable Origin Trials code for WebChannel (saves 1786 bytes). - 'goog.net.webChannel.ALLOW_ORIGIN_TRIAL_FEATURES=false' -]; - -/** - * Generates a closure compiler build of webchannel-wrapper. - * @param {string} filename name of the generated file - * @param {string} prefix prefix to the compiled code - * @param {string} suffix suffix to the compiled code - */ -function createBuildTask(filename, prefix, suffix, languageout) { - return function closureBuild() { - return gulp - .src( - [ - `${closureLibRoot}/closure/goog/**/*.js`, - `${closureLibRoot}/third_party/closure/goog/**/*.js`, - 'src/**/*.js' - ], - { base: '.' } - ) - .pipe(sourcemaps.init()) - .pipe( - closureCompiler({ - js_output_file: filename, - output_wrapper: `${prefix}%output%${suffix}`, - entry_point: 'firebase.webchannel.wrapper', - compilation_level: OPTIMIZATION_LEVEL, - externs: [ - resolve(__dirname, './externs/overrides.js'), - resolve(__dirname, './externs/module.js') - ], - language_out: languageout, - dependency_mode: 'PRUNE', - define: closureDefines - }) - ) - .pipe(sourcemaps.write('.')) - .pipe(gulp.dest('dist')); - }; -} - -function createRollupTask({ - inputPath, - outputExtension, - compileToES5 = false, - format = 'es' -}) { - return async function rollupBuild() { - const plugins = [rollupSourcemaps(), commonjs()]; - if (compileToES5) { - plugins.push( - typescriptPlugin({ - typescript, - // Uncomment for development only. Prevents caching between builds. - // clean: true, - compilerOptions: { allowJs: true }, - include: ['dist/**/*.js'] - }) - ); - } - if (format === 'es') { - plugins.push(emitModulePackageFile()); - } - const inputOptions = { - input: inputPath, - plugins - }; - - let outputFilename; - if (format === 'es') { - if (compileToES5) { - // ESM5 - outputFilename = pkg.esm5; - } else { - // ESM2017 - outputFilename = pkg.module; - } - } else { - // CJS - outputFilename = pkg.main; - } - const outputOptions = { - file: outputFilename, - format, - sourcemap: true, - // Prevents warning when compiling CJS that there are named and default exports together. - exports: 'named' - }; - - const bundle = await rollup.rollup(inputOptions); - return bundle.write(outputOptions); - }; -} - -async function deleteIntermediateFiles() { - await del('dist/temp'); -} - -// Closure-generated ES2017 intermediate file (no wrapper text) -const intermediateEsmFile = 'temp/esm.js'; -const intermediateEsmPath = resolve(__dirname, 'dist/', intermediateEsmFile); -const esmBuild = createBuildTask( - intermediateEsmFile, - '', - '', - 'ECMASCRIPT_2017' -); - -// cjs output -// Closure-generated ES5 CJS build -const cjsBuildOutput = 'index.js'; -const cjsBuild = createBuildTask( - cjsBuildOutput, - CJS_WRAPPER_PREFIX, - CJS_WRAPPER_SUFFIX, - 'ECMASCRIPT5' -); - -gulp.task('cjs', cjsBuild); - -// esm intermediateEsmPath -const rollupEsmTask = createRollupTask({ - inputPath: intermediateEsmPath, - outputExtension: 'esm', - compileToES5: true, - format: 'es' -}); -gulp.task('esm', gulp.series(esmBuild, rollupEsmTask)); - -// esm2017 output -const rollup2017Task = createRollupTask({ - inputPath: intermediateEsmPath, - outputExtension: 'esm2017', - compileToES5: false, - format: 'es' -}); -gulp.task('esm2017', gulp.series(esmBuild, rollup2017Task)); - -gulp.task( - 'allEsm', - gulp.series(esmBuild, gulp.parallel(rollupEsmTask, rollup2017Task)) -); - -gulp.task('buildAll', gulp.parallel('cjs', 'allEsm')); // A task to distribute bloom blobs into 'dist' gulp.task('distributeBloomBlobs', () => { return gulp.src('closure-net/firebase/bloom_blob_*') - // .pipe(rename(function (path) { - // path.basename += "index"; - // path.extname = ".md"; - // })) .pipe(gulp.dest('dist/bloom-blob/')); }); @@ -232,5 +29,5 @@ gulp.task('distributeWebchannelBlobs', () => { .pipe(gulp.dest('dist/webchannel-blob/')); }); -gulp.task('default', gulp.series('buildAll', 'distributeBloomBlobs', 'distributeWebchannelBlobs', deleteIntermediateFiles)); -//gulp.task('default', gulp.series('buildAll', deleteIntermediateFiles)); +gulp.task('default', + gulp.series('distributeBloomBlobs','distributeWebchannelBlobs')); diff --git a/packages/webchannel-wrapper/package.json b/packages/webchannel-wrapper/package.json index db5939c8d9a..d03f5ab5e27 100644 --- a/packages/webchannel-wrapper/package.json +++ b/packages/webchannel-wrapper/package.json @@ -3,16 +3,7 @@ "version": "0.10.7", "description": "A wrapper of the webchannel packages from closure-library for use outside of a closure compiled application", "author": "Firebase (https://firebase.google.com/)", - "main": "dist/index.js", - "module": "dist/esm/index.esm2017.js", - "esm5": "dist/esm/index.esm.js", "exports": { - ".": { - "types": "./src/index.d.ts", - "require": "./dist/index.js", - "esm5": "./dist/esm/index.esm.js", - "default": "./dist/esm/index.esm2017.js" - }, "./webchannel-blob": { "types": "./dist/webchannel-blob/webchannel_blob_types.d.ts", "default": "./dist/webchannel-blob/webchannel_blob_es2018.js" @@ -37,10 +28,7 @@ "license": "Apache-2.0", "devDependencies": { "@rollup/plugin-commonjs": "21.1.0", - "google-closure-compiler": "20230228.0.0", - "google-closure-library": "git+https://github.com/google/closure-library.git#7818ff7", "gulp": "4.0.2", - "gulp-rename": "2.0.0", "gulp-sourcemaps": "3.0.0", "rollup": "2.79.1", "rollup-plugin-sourcemaps": "0.6.3", @@ -52,7 +40,6 @@ "type": "git", "url": "git+https://github.com/firebase/firebase-js-sdk.git" }, - "typings": "src/index.d.ts", "bugs": { "url": "https://github.com/firebase/firebase-js-sdk/issues" } diff --git a/packages/webchannel-wrapper/src/index.d.ts b/packages/webchannel-wrapper/src/index.d.ts deleted file mode 100644 index 776bb8e8634..00000000000 --- a/packages/webchannel-wrapper/src/index.d.ts +++ /dev/null @@ -1,165 +0,0 @@ -/** - * @license - * Copyright 2019 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. - */ - -// WARNING: This is not a complete set of types exported by WebChannelWrapper. -// It is merely meant to support the usage patterns of the Firestore SDK. - -export var EventType: { - COMPLETE: string; -}; - -export namespace WebChannel { - export var EventType: { - OPEN: string; - CLOSE: string; - ERROR: string; - MESSAGE: string; - }; -} - -export var Event: { - STAT_EVENT: string; -}; - -export var Stat: { - PROXY: number; - NOPROXY: number; -}; - -export var ErrorCode: { - NO_ERROR: number; - HTTP_ERROR: number; - TIMEOUT: number; -}; - -export interface Headers { - [name: string]: string | number; -} - -export interface WebChannelError { - error?: { status: string; message: string }; -} - -export class XhrIo { - send( - url: string, - method?: string, - body?: string, - headers?: Headers, - timeoutInterval?: number - ): void; - - getLastErrorCode(): number; - - getLastError(): string; - - getStatus(): number; - - getResponseText(): string; - - getResponseJson(): WebChannelError | object; - - listenOnce(type: string, cb: (param: unknown) => void): void; - - setWithCredentials(withCredentials: boolean): void; -} - -export interface WebChannelOptions { - messageHeaders?: { - // To ensure compatibility with property minifcation tools, keys need to - // be listed explicity. - [k: string]: never; - }; - initMessageHeaders?: { - // To ensure compatibility with property minifcation tools, keys need to - // be listed explicity. - [k: string]: never; - }; - messageContentType?: string; - messageUrlParams?: { - database?: string; - }; - clientProtocolHeaderRequired?: boolean; - concurrentRequestLimit?: number; - supportsCrossDomainXhr?: boolean; - sendRawJson?: boolean; - httpSessionIdParam?: string; - encodeInitMessageHeaders?: boolean; - forceLongPolling?: boolean; - detectBufferingProxy?: boolean; - longPollingTimeout?: number; - fastHandshake?: boolean; - disableRedac?: boolean; - clientProfile?: string; - internalChannelParams?: { - forwardChannelRequestTimeoutMs?: number; - }; - useFetchStreams?: boolean; - xmlHttpFactory?: unknown; - requestRefreshThresholds?: { [key: string]: number }; -} - -export interface EventTarget { - listen(type: string | number, cb: (param: unknown) => void): void; -} - -export interface WebChannel extends EventTarget { - open(): void; - close(): void; - send(msg: unknown): void; -} - -export interface StatEvent { - stat: number; -} - -export interface WebChannelTransport { - createWebChannel(url: string, options: WebChannelOptions): WebChannel; -} - -export function createWebChannelTransport(): WebChannelTransport; - -export function getStatEventTarget(): EventTarget; - -export class FetchXmlHttpFactory { - constructor(options: {}); -} - -// See https://google.github.io/closure-library/api/goog.crypt.Md5.html -// Unit test are written in -// packages/firestore/test/unit/core/webchannel_wrapper.test.ts -export class Md5 { - reset(): void; - digest(): Array; - update(bytes: Array | Uint8Array | string, opt_length?: number): void; -} - -// See https://google.github.io/closure-library/api/goog.math.Integer.html -// Unit test are written in -// packages/firestore/test/unit/core/webchannel_wrapper.test.ts -export class Integer { - constructor(bits: Array, sign: number); - add(other: Integer): Integer; - multiply(other: Integer): Integer; - modulo(other: Integer): Integer; - compare(other: Integer): number; - toNumber(): number; - toString(opt_radix?: number): string; - getBits(index: number): number; - static fromNumber(value: number): Integer; - static fromString(str: string, opt_radix?: number): Integer; -} diff --git a/packages/webchannel-wrapper/src/index.js b/packages/webchannel-wrapper/src/index.js deleted file mode 100644 index 7346b0acaa4..00000000000 --- a/packages/webchannel-wrapper/src/index.js +++ /dev/null @@ -1,109 +0,0 @@ -/** - * @license - * Copyright 2017 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. - */ - -/** - * Bring in closure-library dependencies - */ - -goog.provide('firebase.webchannel.wrapper'); - -// goog.net.WebChannelTransport -goog.require('goog.net.createWebChannelTransport'); -goog.require('goog.net.FetchXmlHttpFactory'); -goog.require('goog.labs.net.webChannel.requestStats'); -goog.require('goog.labs.net.webChannel.WebChannelBaseTransport'); - -/** - * NOTE: The `createWebChannel` function takes an options object as a second param - * whose properties are typically mangled. We override these in externs/overrides.js - * Without those externs, this does not function properly. - */ -goog.labs.net.webChannel.WebChannelBaseTransport.prototype['createWebChannel'] = - goog.labs.net.webChannel.WebChannelBaseTransport.prototype.createWebChannel; -goog.labs.net.webChannel.WebChannelBaseTransport.Channel.prototype['send'] = - goog.labs.net.webChannel.WebChannelBaseTransport.Channel.prototype.send; -goog.labs.net.webChannel.WebChannelBaseTransport.Channel.prototype['open'] = - goog.labs.net.webChannel.WebChannelBaseTransport.Channel.prototype.open; -goog.labs.net.webChannel.WebChannelBaseTransport.Channel.prototype['close'] = - goog.labs.net.webChannel.WebChannelBaseTransport.Channel.prototype.close; - -// goog.net.ErrorCode -goog.require('goog.net.ErrorCode'); -goog.net.ErrorCode['NO_ERROR'] = goog.net.ErrorCode.NO_ERROR; -goog.net.ErrorCode['TIMEOUT'] = goog.net.ErrorCode.TIMEOUT; -goog.net.ErrorCode['HTTP_ERROR'] = goog.net.ErrorCode.HTTP_ERROR; - -// goog.net.ErrorType -goog.require('goog.net.EventType'); -goog.net.EventType['COMPLETE'] = goog.net.EventType.COMPLETE; - -// goog.net.WebChannel -goog.require('goog.net.WebChannel'); -goog.require('goog.events.EventTarget'); -goog.net.WebChannel['EventType'] = goog.net.WebChannel.EventType; -goog.net.WebChannel.EventType['OPEN'] = goog.net.WebChannel.EventType.OPEN; -goog.net.WebChannel.EventType['CLOSE'] = goog.net.WebChannel.EventType.CLOSE; -goog.net.WebChannel.EventType['ERROR'] = goog.net.WebChannel.EventType.ERROR; -goog.net.WebChannel.EventType['MESSAGE'] = - goog.net.WebChannel.EventType.MESSAGE; -goog.events.EventTarget.prototype['listen'] = - goog.events.EventTarget.prototype.listen; - -goog.require('goog.net.XhrIo'); -goog.net.XhrIo.prototype['listenOnce'] = goog.net.XhrIo.prototype.listenOnce; -goog.net.XhrIo.prototype['getLastError'] = - goog.net.XhrIo.prototype.getLastError; -goog.net.XhrIo.prototype['getLastErrorCode'] = - goog.net.XhrIo.prototype.getLastErrorCode; -goog.net.XhrIo.prototype['getStatus'] = goog.net.XhrIo.prototype.getStatus; -goog.net.XhrIo.prototype['getResponseJson'] = - goog.net.XhrIo.prototype.getResponseJson; -goog.net.XhrIo.prototype['getResponseText'] = - goog.net.XhrIo.prototype.getResponseText; -goog.net.XhrIo.prototype['send'] = goog.net.XhrIo.prototype.send; -goog.net.XhrIo.prototype['setWithCredentials'] = - goog.net.XhrIo.prototype.setWithCredentials; - -goog.require('goog.crypt.Md5'); -goog.crypt.Md5.prototype['digest'] = goog.crypt.Md5.prototype.digest; -goog.crypt.Md5.prototype['reset'] = goog.crypt.Md5.prototype.reset; -goog.crypt.Md5.prototype['update'] = goog.crypt.Md5.prototype.update; - -goog.require('goog.math.Integer'); -goog.math.Integer.prototype['add'] = goog.math.Integer.prototype.add; -goog.math.Integer.prototype['multiply'] = goog.math.Integer.prototype.multiply; -goog.math.Integer.prototype['modulo'] = goog.math.Integer.prototype.modulo; -goog.math.Integer.prototype['compare'] = goog.math.Integer.prototype.compare; -goog.math.Integer.prototype['toNumber'] = goog.math.Integer.prototype.toNumber; -goog.math.Integer.prototype['toString'] = goog.math.Integer.prototype.toString; -goog.math.Integer.prototype['getBits'] = goog.math.Integer.prototype.getBits; -goog.math.Integer['fromNumber'] = goog.math.Integer.fromNumber; -goog.math.Integer['fromString'] = goog.math.Integer.fromString; - -module['exports']['createWebChannelTransport'] = - goog.net.createWebChannelTransport; -module['exports']['getStatEventTarget'] = - goog.labs.net.webChannel.requestStats.getStatEventTarget; -module['exports']['ErrorCode'] = goog.net.ErrorCode; -module['exports']['EventType'] = goog.net.EventType; -module['exports']['Event'] = goog.labs.net.webChannel.requestStats.Event; -module['exports']['Stat'] = goog.labs.net.webChannel.requestStats.Stat; -module['exports']['FetchXmlHttpFactory'] = goog.net.FetchXmlHttpFactory; -module['exports']['WebChannel'] = goog.net.WebChannel; -module['exports']['XhrIo'] = goog.net.XhrIo; -module['exports']['Md5'] = goog.crypt.Md5; -module['exports']['Integer'] = goog.math.Integer; From 796b4dbb6a905b5364330018e84662051ffff630 Mon Sep 17 00:00:00 2001 From: Ehsan Nasiri Date: Fri, 19 Apr 2024 14:53:44 -0700 Subject: [PATCH 03/16] Add closure-net as a git submodule. --- .github/workflows/canary-deploy.yml | 3 ++- .github/workflows/check-changeset.yml | 3 ++- .github/workflows/check-docs.yml | 3 ++- .github/workflows/check-pkg-paths.yml | 3 ++- .github/workflows/deploy-config.yml | 1 + .github/workflows/e2e-test.yml | 2 ++ .github/workflows/format.yml | 3 ++- .github/workflows/health-metrics-pull-request.yml | 4 ++++ .github/workflows/lint.yml | 2 ++ .github/workflows/merge-release-branch.yml | 1 + .github/workflows/prerelease-manual-deploy.yml | 2 +- .github/workflows/release-log.yml | 2 ++ .github/workflows/release-pr.yml | 1 + .github/workflows/release-prod.yml | 1 + .github/workflows/release-staging.yml | 1 + .github/workflows/release-tweet.yml | 4 +++- .github/workflows/test-all.yml | 2 ++ .github/workflows/test-changed-auth.yml | 2 ++ .github/workflows/test-changed-fcm-integration.yml | 1 + .github/workflows/test-changed-firestore-integration.yml | 1 + .github/workflows/test-changed-firestore.yml | 1 + .github/workflows/test-changed-misc.yml | 3 ++- .github/workflows/test-changed.yml | 2 ++ .github/workflows/test-firebase-integration.yml | 3 ++- .github/workflows/update-api-reports.yml | 3 ++- .gitmodules | 3 +++ packages/webchannel-wrapper/closure-net | 1 + 27 files changed, 48 insertions(+), 10 deletions(-) create mode 100644 .gitmodules create mode 160000 packages/webchannel-wrapper/closure-net diff --git a/.github/workflows/canary-deploy.yml b/.github/workflows/canary-deploy.yml index 73ce0044c1a..7bd524b407e 100644 --- a/.github/workflows/canary-deploy.yml +++ b/.github/workflows/canary-deploy.yml @@ -31,6 +31,7 @@ jobs: with: # Canary release script requires git history and tags. fetch-depth: 0 + submodules: true - name: Set up Node (20) uses: actions/setup-node@v3 with: @@ -101,4 +102,4 @@ jobs: -H "Accept:application/vnd.github.v3+json" \ -H "Authorization:Bearer $OSS_BOT_GITHUB_TOKEN" \ -d "{\"event_type\":\"canary-tests\", \"client_payload\":{\"versionOrTag\":\"$VERSION_OR_TAG\"}}" \ - https://api.github.com/repos/firebase/firebase-js-sdk/dispatches \ No newline at end of file + https://api.github.com/repos/firebase/firebase-js-sdk/dispatches diff --git a/.github/workflows/check-changeset.yml b/.github/workflows/check-changeset.yml index ca76fe7a76b..547278d2978 100644 --- a/.github/workflows/check-changeset.yml +++ b/.github/workflows/check-changeset.yml @@ -34,6 +34,7 @@ jobs: with: # This makes Actions fetch all Git history so check_changeset script can diff properly. fetch-depth: 0 + submodules: true - name: Set up Node (20) uses: actions/setup-node@v3 with: @@ -89,4 +90,4 @@ jobs: # Don't want it to throw before editing the comment. - name: Fail if checker script logged a blocking failure if: ${{steps.check-changeset.outputs.BLOCKING_FAILURE == 'true'}} - run: exit 1 \ No newline at end of file + run: exit 1 diff --git a/.github/workflows/check-docs.yml b/.github/workflows/check-docs.yml index aefab2506e3..20e4cb25339 100644 --- a/.github/workflows/check-docs.yml +++ b/.github/workflows/check-docs.yml @@ -27,6 +27,7 @@ jobs: with: # get all history for the diff fetch-depth: 0 + submodules: true - name: Set up Node (20) uses: actions/setup-node@v3 with: @@ -39,4 +40,4 @@ jobs: run: git diff --exit-code docs-devsite - name: Reference documentation needs to be updated. See message below. if: ${{ failure() }} - run: echo "Changes in this PR affect the reference docs. Run \`yarn docgen devsite\` locally to regenerate docs and add them to this PR." \ No newline at end of file + run: echo "Changes in this PR affect the reference docs. Run \`yarn docgen devsite\` locally to regenerate docs and add them to this PR." diff --git a/.github/workflows/check-pkg-paths.yml b/.github/workflows/check-pkg-paths.yml index 8ca54225e10..75fe465c78b 100644 --- a/.github/workflows/check-pkg-paths.yml +++ b/.github/workflows/check-pkg-paths.yml @@ -27,6 +27,7 @@ jobs: with: # This makes Actions fetch all Git history so run-changed script can diff properly. fetch-depth: 0 + submodules: true - name: Set up Node (20) uses: actions/setup-node@v3 with: @@ -38,4 +39,4 @@ jobs: - name: Swap in public typings run: yarn release:prepare - name: Check paths - run: yarn ts-node scripts/ci-test/check-paths.ts \ No newline at end of file + run: yarn ts-node scripts/ci-test/check-paths.ts diff --git a/.github/workflows/deploy-config.yml b/.github/workflows/deploy-config.yml index 3a2d935dd28..748db3bcce4 100644 --- a/.github/workflows/deploy-config.yml +++ b/.github/workflows/deploy-config.yml @@ -35,6 +35,7 @@ jobs: with: # This makes Actions fetch all Git history so run-changed script can diff properly. fetch-depth: 0 + submodules: true - name: Set up node (20) uses: actions/setup-node@v3 with: diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index 80a555f7840..1c798bbd502 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -36,6 +36,8 @@ jobs: steps: - name: Checkout Repo uses: actions/checkout@master + with: + submodules: true - name: Set up Node (20) uses: actions/setup-node@master with: diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 7434a9cab4c..f512eac2cc7 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -31,6 +31,7 @@ jobs: with: # get all history for the diff fetch-depth: 0 + submodules: true - name: Set up node (20) uses: actions/setup-node@v3 with: @@ -43,4 +44,4 @@ jobs: run: git diff --exit-code - name: Formatting needs to be updated. See message below. if: ${{ failure() }} - run: echo "Something was changed by formatting. Run \`yarn format\` locally to do a prettier/license pass. Use \`yarn format --help\` to see options." \ No newline at end of file + run: echo "Something was changed by formatting. Run \`yarn format\` locally to do a prettier/license pass. Use \`yarn format --help\` to see options." diff --git a/.github/workflows/health-metrics-pull-request.yml b/.github/workflows/health-metrics-pull-request.yml index 2148c6d5abf..708ccc3ebcf 100644 --- a/.github/workflows/health-metrics-pull-request.yml +++ b/.github/workflows/health-metrics-pull-request.yml @@ -39,6 +39,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + with: + submodules: true - uses: actions/setup-node@v3 with: node-version: 20.x @@ -56,6 +58,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + with: + submodules: true - uses: actions/setup-node@v3 with: node-version: 20.x diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 80851d9834a..74f0a3a7301 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -23,6 +23,8 @@ jobs: steps: - uses: actions/checkout@v3 + with: + submodules: true - name: Set up node (20) uses: actions/setup-node@v3 with: diff --git a/.github/workflows/merge-release-branch.yml b/.github/workflows/merge-release-branch.yml index 06f4f15a119..45d719a2986 100644 --- a/.github/workflows/merge-release-branch.yml +++ b/.github/workflows/merge-release-branch.yml @@ -27,6 +27,7 @@ jobs: uses: actions/checkout@master with: ref: release + submodules: true - name: Get release version id: get-version run: | diff --git a/.github/workflows/prerelease-manual-deploy.yml b/.github/workflows/prerelease-manual-deploy.yml index 54f75383f95..201ecdd34e8 100644 --- a/.github/workflows/prerelease-manual-deploy.yml +++ b/.github/workflows/prerelease-manual-deploy.yml @@ -34,6 +34,7 @@ jobs: with: # Canary release script requires git history and tags. fetch-depth: 0 + submodules: true - name: Set up node (20) uses: actions/setup-node@v3 with: @@ -93,4 +94,3 @@ jobs: NPM_TOKEN_APP_CHECK_COMPAT: ${{ secrets.NPM_TOKEN_APP_CHECK_COMPAT }} NPM_TOKEN_API_DOCUMENTER: ${{ secrets.NPM_TOKEN_API_DOCUMENTER }} CI: true - \ No newline at end of file diff --git a/.github/workflows/release-log.yml b/.github/workflows/release-log.yml index 780e3e97b52..c7fdfb368e8 100644 --- a/.github/workflows/release-log.yml +++ b/.github/workflows/release-log.yml @@ -27,6 +27,8 @@ jobs: steps: - name: Checkout Repo uses: actions/checkout@master + with: + submodules: true - name: Setup Node.js 20.x uses: actions/setup-node@master diff --git a/.github/workflows/release-pr.yml b/.github/workflows/release-pr.yml index 04ebbd8b926..11d2fb1d5f5 100644 --- a/.github/workflows/release-pr.yml +++ b/.github/workflows/release-pr.yml @@ -31,6 +31,7 @@ jobs: with: # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits fetch-depth: 0 + submodules: true - name: Setup Node.js 20.x uses: actions/setup-node@master diff --git a/.github/workflows/release-prod.yml b/.github/workflows/release-prod.yml index 09d1797ec4c..9427f434a71 100644 --- a/.github/workflows/release-prod.yml +++ b/.github/workflows/release-prod.yml @@ -43,6 +43,7 @@ jobs: fetch-depth: 0 ref: ${{ github.event.inputs.release-branch }} token: ${{ secrets.OSS_BOT_GITHUB_TOKEN }} + submodules: true - name: Yarn install run: yarn - name: Publish to NPM diff --git a/.github/workflows/release-staging.yml b/.github/workflows/release-staging.yml index 6a687ed5ee2..57d3c269034 100644 --- a/.github/workflows/release-staging.yml +++ b/.github/workflows/release-staging.yml @@ -68,6 +68,7 @@ jobs: # Release script requires git history and tags. fetch-depth: 0 ref: ${{ github.event.inputs.release-branch }} + submodules: true - name: Yarn install run: yarn - name: Publish to NPM diff --git a/.github/workflows/release-tweet.yml b/.github/workflows/release-tweet.yml index edd2634637b..8dabe18cabe 100644 --- a/.github/workflows/release-tweet.yml +++ b/.github/workflows/release-tweet.yml @@ -34,6 +34,8 @@ jobs: steps: - name: Checkout Repo uses: actions/checkout@master + with: + submodules: true - name: Setup Node.js 20.x uses: actions/setup-node@master with: @@ -52,4 +54,4 @@ jobs: consumer-key: ${{ secrets.TWITTER_CONSUMER_KEY }} consumer-secret: ${{ secrets.TWITTER_CONSUMER_SECRET }} access-token: ${{ secrets.TWITTER_ACCESS_TOKEN }} - access-token-secret: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }} \ No newline at end of file + access-token-secret: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }} diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index 1a5cc20a2ef..99f84d86176 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -42,6 +42,8 @@ jobs: run: | npx @puppeteer/browsers install chrome@stable - uses: actions/checkout@v3 + with: + submodules: true - name: Set up Node (20) uses: actions/setup-node@v3 with: diff --git a/.github/workflows/test-changed-auth.yml b/.github/workflows/test-changed-auth.yml index d2f11f2bf2f..dbb5fdd9884 100644 --- a/.github/workflows/test-changed-auth.yml +++ b/.github/workflows/test-changed-auth.yml @@ -56,6 +56,7 @@ jobs: with: # This makes Actions fetch all Git history so run-changed script can diff properly. fetch-depth: 0 + submodules: true - name: Set up Node (20) uses: actions/setup-node@v3 with: @@ -88,6 +89,7 @@ jobs: with: # This makes Actions fetch all Git history so run-changed script can diff properly. fetch-depth: 0 + submodules: true - name: Set up Node (20) uses: actions/setup-node@v3 with: diff --git a/.github/workflows/test-changed-fcm-integration.yml b/.github/workflows/test-changed-fcm-integration.yml index affb4639b1b..1f3ebbe1250 100644 --- a/.github/workflows/test-changed-fcm-integration.yml +++ b/.github/workflows/test-changed-fcm-integration.yml @@ -38,6 +38,7 @@ jobs: with: # This makes Actions fetch all Git history so run-changed script can diff properly. fetch-depth: 0 + submodules: true - name: Set up Node (20) uses: actions/setup-node@v3 with: diff --git a/.github/workflows/test-changed-firestore-integration.yml b/.github/workflows/test-changed-firestore-integration.yml index 85e9c7e3eaa..01552f59060 100644 --- a/.github/workflows/test-changed-firestore-integration.yml +++ b/.github/workflows/test-changed-firestore-integration.yml @@ -33,6 +33,7 @@ jobs: with: # This makes Actions fetch all Git history so run-changed script can diff properly. fetch-depth: 0 + submodules: true - uses: 'google-github-actions/auth@v0' if: ${{ fromJSON(env.run_terraform_steps) }} with: diff --git a/.github/workflows/test-changed-firestore.yml b/.github/workflows/test-changed-firestore.yml index 9f241898e0e..2ac7e3964c8 100644 --- a/.github/workflows/test-changed-firestore.yml +++ b/.github/workflows/test-changed-firestore.yml @@ -37,6 +37,7 @@ jobs: with: # This makes Actions fetch all Git history so run-changed script can diff properly. fetch-depth: 0 + submodules: true - name: Set up Node (20) uses: actions/setup-node@v3 with: diff --git a/.github/workflows/test-changed-misc.yml b/.github/workflows/test-changed-misc.yml index e189ff4fecf..446809031d4 100644 --- a/.github/workflows/test-changed-misc.yml +++ b/.github/workflows/test-changed-misc.yml @@ -31,6 +31,7 @@ jobs: with: # This makes Actions fetch all Git history so run-changed script can diff properly. fetch-depth: 0 + submodules: true - name: Set up Node (20) uses: actions/setup-node@v3 with: @@ -48,4 +49,4 @@ jobs: - name: Run tests run: yarn test:changed misc env: - FIREBASE_TOKEN: ${{ secrets.FIREBASE_CLI_TOKEN }} \ No newline at end of file + FIREBASE_TOKEN: ${{ secrets.FIREBASE_CLI_TOKEN }} diff --git a/.github/workflows/test-changed.yml b/.github/workflows/test-changed.yml index ac45286b0c8..2ab73e52ec4 100644 --- a/.github/workflows/test-changed.yml +++ b/.github/workflows/test-changed.yml @@ -31,6 +31,7 @@ jobs: with: # This makes Actions fetch all Git history so run-changed script can diff properly. fetch-depth: 0 + submodules: true - name: Set up Node (20) uses: actions/setup-node@v3 with: @@ -60,6 +61,7 @@ jobs: uses: actions/checkout@master with: fetch-depth: 0 + submodules: true - name: Set up Node (20) uses: actions/setup-node@v3 with: diff --git a/.github/workflows/test-firebase-integration.yml b/.github/workflows/test-firebase-integration.yml index f6b1eb3c4b3..a2b0fde0a2c 100644 --- a/.github/workflows/test-firebase-integration.yml +++ b/.github/workflows/test-firebase-integration.yml @@ -31,6 +31,7 @@ jobs: with: # This makes Actions fetch all Git history so run-changed script can diff properly. fetch-depth: 0 + submodules: true - name: Set up Node (20) uses: actions/setup-node@v3 with: @@ -46,4 +47,4 @@ jobs: - name: build run: yarn build:changed firebase-integration - name: Run tests on changed packages - run: yarn test:changed firebase-integration \ No newline at end of file + run: yarn test:changed firebase-integration diff --git a/.github/workflows/update-api-reports.yml b/.github/workflows/update-api-reports.yml index f49c548e3cc..31065b585ef 100644 --- a/.github/workflows/update-api-reports.yml +++ b/.github/workflows/update-api-reports.yml @@ -30,6 +30,7 @@ jobs: # checkout HEAD commit instead of merge commit ref: ${{ github.event.pull_request.head.ref }} token: ${{ github.token }} + submodules: true - name: Set up node (20) uses: actions/setup-node@v3 with: @@ -45,4 +46,4 @@ jobs: with: add: 'common/api-review/*' message: 'Update API reports' - default_author: github_actor \ No newline at end of file + default_author: github_actor diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000000..ea2ded3d18e --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "packages/webchannel-wrapper/closure-net"] + path = packages/webchannel-wrapper/closure-net + url = https://github.com/google/closure-net.git diff --git a/packages/webchannel-wrapper/closure-net b/packages/webchannel-wrapper/closure-net new file mode 160000 index 00000000000..9844d605191 --- /dev/null +++ b/packages/webchannel-wrapper/closure-net @@ -0,0 +1 @@ +Subproject commit 9844d605191623eaba4b184775610fe875e78ac4 From cd7ef7897a13c7797dc471c811ef23d2c9e18abe Mon Sep 17 00:00:00 2001 From: Ehsan Nasiri Date: Fri, 19 Apr 2024 15:01:09 -0700 Subject: [PATCH 04/16] remove temporary .only in test. --- packages/firestore/test/unit/core/webchannel_wrapper.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/firestore/test/unit/core/webchannel_wrapper.test.ts b/packages/firestore/test/unit/core/webchannel_wrapper.test.ts index 4db46e4f9af..c5e597f4216 100644 --- a/packages/firestore/test/unit/core/webchannel_wrapper.test.ts +++ b/packages/firestore/test/unit/core/webchannel_wrapper.test.ts @@ -24,7 +24,7 @@ import { expect } from 'chai'; import { newTextEncoder } from '../../../src/platform/text_serializer'; -describe.only('Md5', () => { +describe('Md5', () => { // The precomputed MD5 digests of the 3-character strings "abc" and "def". const DIGEST_OF_ABC = Object.freeze([ 144, 1, 80, 152, 60, 210, 79, 176, 214, 150, 63, 125, 40, 225, 127, 114 From 06a6ea1a36c54aa1912c7586ae5f526d81ec7aa0 Mon Sep 17 00:00:00 2001 From: Ehsan Nasiri Date: Fri, 19 Apr 2024 15:10:12 -0700 Subject: [PATCH 05/16] prettier. --- packages/webchannel-wrapper/gulpfile.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/webchannel-wrapper/gulpfile.js b/packages/webchannel-wrapper/gulpfile.js index 95b860612e4..b4918989851 100644 --- a/packages/webchannel-wrapper/gulpfile.js +++ b/packages/webchannel-wrapper/gulpfile.js @@ -19,15 +19,19 @@ const gulp = require('gulp'); // A task to distribute bloom blobs into 'dist' gulp.task('distributeBloomBlobs', () => { - return gulp.src('closure-net/firebase/bloom_blob_*') + return gulp + .src('closure-net/firebase/bloom_blob_*') .pipe(gulp.dest('dist/bloom-blob/')); }); // A task to distribute bloom blobs into 'dist' gulp.task('distributeWebchannelBlobs', () => { - return gulp.src('closure-net/firebase/webchannel_blob_*') + return gulp + .src('closure-net/firebase/webchannel_blob_*') .pipe(gulp.dest('dist/webchannel-blob/')); }); -gulp.task('default', - gulp.series('distributeBloomBlobs','distributeWebchannelBlobs')); +gulp.task( + 'default', + gulp.series('distributeBloomBlobs', 'distributeWebchannelBlobs') +); From 5297574194601e616bc9668d3c3366f1db2b0f6e Mon Sep 17 00:00:00 2001 From: Ehsan Nasiri Date: Fri, 19 Apr 2024 15:25:09 -0700 Subject: [PATCH 06/16] add yarn.lock differences. --- yarn.lock | 72 +++++++------------------------------------------------ 1 file changed, 8 insertions(+), 64 deletions(-) diff --git a/yarn.lock b/yarn.lock index 38c8a5c9b27..b4a4e27dd84 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5518,20 +5518,10 @@ camelcase@^6.0.0, camelcase@^6.2.0: resolved "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz" integrity sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg== -caniuse-lite@^1.0.30001259: - version "1.0.30001429" - resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001429.tgz" - integrity sha512-511ThLu1hF+5RRRt0zYCf2U2yRr9GPF6m5y90SBCWsvSoYoW7yAGlv/elyPaNfvGCkp6kj/KFZWU0BMA69Prsg== - -caniuse-lite@^1.0.30001517: - version "1.0.30001524" - resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001524.tgz" - integrity sha512-Jj917pJtYg9HSJBF95HVX3Cdr89JUyLT4IZ8SvM5aDRni95swKgYi3TgYLH5hnGfPE/U1dg6IfZ50UsIlLkwSA== - -caniuse-lite@^1.0.30001587: - version "1.0.30001600" - resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001600.tgz#93a3ee17a35aa6a9f0c6ef1b2ab49507d1ab9079" - integrity sha512-+2S9/2JFhYmYaDpZvo0lKkfvuKIglrx68MwOBqMGHhQsNkLjB5xtc/TGoEPs+MxjSyN/72qer2g97nzR641mOQ== +caniuse-lite@^1.0.30001259, caniuse-lite@^1.0.30001517, caniuse-lite@^1.0.30001587: + version "1.0.30001611" + resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001611.tgz" + integrity sha512-19NuN1/3PjA3QI8Eki55N8my4LzfkMCRLgCVfrl/slbSAchQfV0+GwjPrK3rq37As4UCLlM/DHajbKkAqbv92Q== cardinal@^2.1.1: version "2.1.1" @@ -5573,7 +5563,7 @@ chai@4.4.1: pathval "^1.1.1" type-detect "^4.0.8" -chalk@4.1.2, chalk@4.x, chalk@^4.0.0, chalk@^4.1.0, chalk@^4.1.1, chalk@^4.1.2: +chalk@4.1.2, chalk@^4.0.0, chalk@^4.1.0, chalk@^4.1.1, chalk@^4.1.2: version "4.1.2" resolved "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz" integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== @@ -9195,45 +9185,6 @@ google-auth-library@^8.0.2: jws "^4.0.0" lru-cache "^6.0.0" -google-closure-compiler-java@^20230228.0.0: - version "20230228.0.0" - resolved "https://registry.npmjs.org/google-closure-compiler-java/-/google-closure-compiler-java-20230228.0.0.tgz" - integrity sha512-t0sXYJbhfkuNTF6zniwrTv4gLap620D32v6GwBJQzlYUg0lb7yQHN9KswwqBsuuO917cPNwW4okI0O40G7GrMQ== - -google-closure-compiler-linux@^20230228.0.0: - version "20230228.0.0" - resolved "https://registry.npmjs.org/google-closure-compiler-linux/-/google-closure-compiler-linux-20230228.0.0.tgz#17cb6187015e0e2ae8c2dd5b560228fdf5625818" - integrity sha512-5YLxfWS8lvHkD/a0+pitTuDV1X9QPBToGQ5mnLFg7HcbBR1w6I5ZKHjl7FAsAOHEXYwIrStwwaLzrNzbolrZLg== - -google-closure-compiler-osx@^20230228.0.0: - version "20230228.0.0" - resolved "https://registry.npmjs.org/google-closure-compiler-osx/-/google-closure-compiler-osx-20230228.0.0.tgz" - integrity sha512-ORveHpHuNhJEJIGir35+xP4UuBOldSO8XeOwJV5yunUhZAPzR4aixdTdtm6i0GsqW4/Eu2cjcHrkIR3eFCcwSg== - -google-closure-compiler-windows@^20230228.0.0: - version "20230228.0.0" - resolved "https://registry.npmjs.org/google-closure-compiler-windows/-/google-closure-compiler-windows-20230228.0.0.tgz#dff4afcd6d21a831b38a9bdb873eed0daca79807" - integrity sha512-xKMjUq6JwEOFqS97S86TWkn+BMiDHjP85mMgAmR8vRmKxgfHIyxMcr+RlMz0msgY9jedgj119KXyOe32lIQTjA== - -google-closure-compiler@20230228.0.0: - version "20230228.0.0" - resolved "https://registry.npmjs.org/google-closure-compiler/-/google-closure-compiler-20230228.0.0.tgz" - integrity sha512-jFI4QNZgM4WhNIoaRNwA5kHq6n6NKSWZj3N9HgRsJE9bN4LUrkIURI+svChbEp/WmGh3Bt3o3/5kUlOOWyCo3Q== - dependencies: - chalk "4.x" - google-closure-compiler-java "^20230228.0.0" - minimist "1.x" - vinyl "2.x" - vinyl-sourcemaps-apply "^0.2.0" - optionalDependencies: - google-closure-compiler-linux "^20230228.0.0" - google-closure-compiler-osx "^20230228.0.0" - google-closure-compiler-windows "^20230228.0.0" - -"google-closure-library@git+https://github.com/google/closure-library.git#7818ff7": - version "20230802.0.0" - resolved "git+https://git@github.com/google/closure-library.git#7818ff7dc0b53555a7fb3c3427e6761e88bde3a2" - google-gax@^3.0.1: version "3.1.3" resolved "https://registry.npmjs.org/google-gax/-/google-gax-3.1.3.tgz" @@ -12541,7 +12492,7 @@ minimist-options@4.1.0, minimist-options@^4.0.2: is-plain-obj "^1.1.0" kind-of "^6.0.3" -minimist@1.x, minimist@^1.2.0, minimist@^1.2.3, minimist@^1.2.5: +minimist@^1.2.0, minimist@^1.2.3, minimist@^1.2.5: version "1.2.5" resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz" integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== @@ -16087,7 +16038,7 @@ source-map-url@^0.4.0: resolved "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.1.tgz" integrity sha512-cPiFOTLUKvJFIg4SKVScy4ilPPW6rFgMgfuZJPNoDuMs3nC1HbMUycBoJw77xFIp6z1UJQJOfx6C9GMH80DiTw== -source-map@^0.5.0, source-map@^0.5.1, source-map@^0.5.6, source-map@^0.5.7, source-map@~0.5.3: +source-map@^0.5.0, source-map@^0.5.6, source-map@^0.5.7, source-map@~0.5.3: version "0.5.7" resolved "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz" integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= @@ -17838,14 +17789,7 @@ vinyl-sourcemap@^1.1.0: remove-bom-buffer "^3.0.0" vinyl "^2.0.0" -vinyl-sourcemaps-apply@^0.2.0: - version "0.2.1" - resolved "https://registry.npmjs.org/vinyl-sourcemaps-apply/-/vinyl-sourcemaps-apply-0.2.1.tgz" - integrity sha1-q2VJ1h0XLCsbh75cUI0jnI74dwU= - dependencies: - source-map "^0.5.1" - -vinyl@2.x, vinyl@^2.0.0, vinyl@^2.1.0, vinyl@^2.2.1: +vinyl@^2.0.0, vinyl@^2.1.0, vinyl@^2.2.1: version "2.2.1" resolved "https://registry.npmjs.org/vinyl/-/vinyl-2.2.1.tgz" integrity sha512-LII3bXRFBZLlezoG5FfZVcXflZgWP/4dCwKtxd5ky9+LOtM4CS3bIRQsmR1KMnMW07jpE8fqR2lcxPZ+8sJIcw== From ce715d6b0f06a70c415ac99b3b58f62775d59732 Mon Sep 17 00:00:00 2001 From: Ehsan Nasiri Date: Fri, 19 Apr 2024 16:26:23 -0700 Subject: [PATCH 07/16] create a types.d.ts for the webchannel-wrapper package. --- packages/webchannel-wrapper/gulpfile.js | 20 ++++++++++++++++++-- packages/webchannel-wrapper/package.json | 2 ++ yarn.lock | 16 ++++++++++++++++ 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/packages/webchannel-wrapper/gulpfile.js b/packages/webchannel-wrapper/gulpfile.js index b4918989851..229ab3776dd 100644 --- a/packages/webchannel-wrapper/gulpfile.js +++ b/packages/webchannel-wrapper/gulpfile.js @@ -16,6 +16,7 @@ */ const gulp = require('gulp'); +const concat = require('gulp-concat'); // A task to distribute bloom blobs into 'dist' gulp.task('distributeBloomBlobs', () => { @@ -25,13 +26,28 @@ gulp.task('distributeBloomBlobs', () => { }); // A task to distribute bloom blobs into 'dist' -gulp.task('distributeWebchannelBlobs', () => { +gulp.task('distributeWebChannelBlobs', () => { return gulp .src('closure-net/firebase/webchannel_blob_*') .pipe(gulp.dest('dist/webchannel-blob/')); }); +// A task to concatenate typings of all blobs into 'dist' +gulp.task('createAllTypings', () => { + return gulp + .src([ + 'closure-net/firebase/bloom_blob_types.d.ts', + 'closure-net/firebase/webchannel_blob_types.d.ts' + ]) + .pipe(concat('types.d.ts')) + .pipe(gulp.dest('dist/')); +}); + gulp.task( 'default', - gulp.series('distributeBloomBlobs', 'distributeWebchannelBlobs') + gulp.series( + 'distributeBloomBlobs', + 'distributeWebChannelBlobs', + 'createAllTypings' + ) ); diff --git a/packages/webchannel-wrapper/package.json b/packages/webchannel-wrapper/package.json index d03f5ab5e27..00046df79dc 100644 --- a/packages/webchannel-wrapper/package.json +++ b/packages/webchannel-wrapper/package.json @@ -29,6 +29,7 @@ "devDependencies": { "@rollup/plugin-commonjs": "21.1.0", "gulp": "4.0.2", + "gulp-concat": "2.6.1", "gulp-sourcemaps": "3.0.0", "rollup": "2.79.1", "rollup-plugin-sourcemaps": "0.6.3", @@ -40,6 +41,7 @@ "type": "git", "url": "git+https://github.com/firebase/firebase-js-sdk.git" }, + "typings": "./dist/types.d.ts", "bugs": { "url": "https://github.com/firebase/firebase-js-sdk/issues" } diff --git a/yarn.lock b/yarn.lock index b4a4e27dd84..c79343b5818 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6123,6 +6123,13 @@ concat-stream@^2.0.0: readable-stream "^3.0.2" typedarray "^0.0.6" +concat-with-sourcemaps@^1.0.0: + version "1.1.0" + resolved "https://registry.npmjs.org/concat-with-sourcemaps/-/concat-with-sourcemaps-1.1.0.tgz#d4ea93f05ae25790951b99e7b3b09e3908a4082e" + integrity sha512-4gEjHJFT9e+2W/77h/DS5SGUgwDaOwprX8L/gl5+3ixnzkVJJsZWDSelmN3Oilw3LNDZjZV0yqH1hLG3k6nghg== + dependencies: + source-map "^0.6.1" + config-chain@^1.1.11, config-chain@^1.1.12: version "1.1.13" resolved "https://registry.npmjs.org/config-chain/-/config-chain-1.1.13.tgz" @@ -9319,6 +9326,15 @@ gulp-cli@^2.2.0: v8flags "^3.2.0" yargs "^7.1.0" +gulp-concat@2.6.1: + version "2.6.1" + resolved "https://registry.npmjs.org/gulp-concat/-/gulp-concat-2.6.1.tgz#633d16c95d88504628ad02665663cee5a4793353" + integrity sha512-a2scActrQrDBpBbR3WUZGyGS1JEPLg5PZJdIa7/Bi3GuKAmPYDK6SFhy/NZq5R8KsKKFvtfR0fakbUCcKGCCjg== + dependencies: + concat-with-sourcemaps "^1.0.0" + through2 "^2.0.0" + vinyl "^2.0.0" + gulp-filter@7.0.0: version "7.0.0" resolved "https://registry.npmjs.org/gulp-filter/-/gulp-filter-7.0.0.tgz" From d95ded59f1a6eb3955678da9c61f42c064ae2247 Mon Sep 17 00:00:00 2001 From: Ehsan Nasiri Date: Mon, 22 Apr 2024 13:03:21 -0700 Subject: [PATCH 08/16] Bring back the aggregated types and implementations for size report. --- packages/webchannel-wrapper/gulpfile.js | 31 +++++++++++++++++-- packages/webchannel-wrapper/package.json | 3 ++ repo-scripts/size-analysis/analysis-helper.ts | 2 +- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/packages/webchannel-wrapper/gulpfile.js b/packages/webchannel-wrapper/gulpfile.js index 229ab3776dd..deacc7387ab 100644 --- a/packages/webchannel-wrapper/gulpfile.js +++ b/packages/webchannel-wrapper/gulpfile.js @@ -33,7 +33,7 @@ gulp.task('distributeWebChannelBlobs', () => { }); // A task to concatenate typings of all blobs into 'dist' -gulp.task('createAllTypings', () => { +gulp.task('aggregateTypings', () => { return gulp .src([ 'closure-net/firebase/bloom_blob_types.d.ts', @@ -43,11 +43,38 @@ gulp.task('createAllTypings', () => { .pipe(gulp.dest('dist/')); }); +// A task to concatenate all blobs into one file in 'dist'. +// This is only used to report the total size of this package. +gulp.task( + 'aggregateBlobs', + gulp.parallel( + function () { + return gulp + .src([ + 'closure-net/firebase/bloom_blob_es2018.js', + 'closure-net/firebase/webchannel_blob_es2018.js' + ]) + .pipe(concat('index.js')) + .pipe(gulp.dest('dist/')); + }, + function () { + return gulp + .src([ + 'closure-net/firebase/bloom_blob_es5.js', + 'closure-net/firebase/webchannel_blob_es5.js' + ]) + .pipe(concat('index.esm.js')) + .pipe(gulp.dest('dist/')); + } + ) +); + gulp.task( 'default', gulp.series( 'distributeBloomBlobs', 'distributeWebChannelBlobs', - 'createAllTypings' + 'aggregateTypings', + 'aggregateBlobs' ) ); diff --git a/packages/webchannel-wrapper/package.json b/packages/webchannel-wrapper/package.json index 00046df79dc..8bdf9e3116e 100644 --- a/packages/webchannel-wrapper/package.json +++ b/packages/webchannel-wrapper/package.json @@ -3,6 +3,9 @@ "version": "0.10.7", "description": "A wrapper of the webchannel packages from closure-library for use outside of a closure compiled application", "author": "Firebase (https://firebase.google.com/)", + "main": "dist/index.js", + "module": "dist/index.js", + "esm5": "dist/index.esm.js", "exports": { "./webchannel-blob": { "types": "./dist/webchannel-blob/webchannel_blob_types.d.ts", diff --git a/repo-scripts/size-analysis/analysis-helper.ts b/repo-scripts/size-analysis/analysis-helper.ts index 11dc499aedc..9507bfe253c 100644 --- a/repo-scripts/size-analysis/analysis-helper.ts +++ b/repo-scripts/size-analysis/analysis-helper.ts @@ -498,7 +498,7 @@ export async function generateReportForModule( * * @param pkgJson package.json of the module. * - * This function implements a fallback of locating module's budle file. + * This function implements a fallback of locating module's bundle file. * It first looks at esm2017 field of package.json, then module field. Main * field at the last. * From 433aee14e215dc8528faa92694db5c1f7cb3d913 Mon Sep 17 00:00:00 2001 From: Ehsan Nasiri Date: Tue, 23 Apr 2024 15:47:23 -0700 Subject: [PATCH 09/16] Undo CI changes for git submodules. --- .github/workflows/canary-deploy.yml | 3 +-- .github/workflows/check-changeset.yml | 3 +-- .github/workflows/check-docs.yml | 3 +-- .github/workflows/check-pkg-paths.yml | 3 +-- .github/workflows/deploy-config.yml | 1 - .github/workflows/e2e-test.yml | 2 -- .github/workflows/format.yml | 3 +-- .github/workflows/health-metrics-pull-request.yml | 4 ---- .github/workflows/lint.yml | 2 -- .github/workflows/merge-release-branch.yml | 1 - .github/workflows/prerelease-manual-deploy.yml | 2 +- .github/workflows/release-log.yml | 2 -- .github/workflows/release-pr.yml | 1 - .github/workflows/release-prod.yml | 1 - .github/workflows/release-staging.yml | 1 - .github/workflows/release-tweet.yml | 4 +--- .github/workflows/test-all.yml | 2 -- .github/workflows/test-changed-auth.yml | 2 -- .github/workflows/test-changed-fcm-integration.yml | 1 - .github/workflows/test-changed-firestore-integration.yml | 1 - .github/workflows/test-changed-firestore.yml | 1 - .github/workflows/test-changed-misc.yml | 3 +-- .github/workflows/test-changed.yml | 2 -- .github/workflows/test-firebase-integration.yml | 3 +-- .github/workflows/update-api-reports.yml | 3 +-- 25 files changed, 10 insertions(+), 44 deletions(-) diff --git a/.github/workflows/canary-deploy.yml b/.github/workflows/canary-deploy.yml index 7bd524b407e..73ce0044c1a 100644 --- a/.github/workflows/canary-deploy.yml +++ b/.github/workflows/canary-deploy.yml @@ -31,7 +31,6 @@ jobs: with: # Canary release script requires git history and tags. fetch-depth: 0 - submodules: true - name: Set up Node (20) uses: actions/setup-node@v3 with: @@ -102,4 +101,4 @@ jobs: -H "Accept:application/vnd.github.v3+json" \ -H "Authorization:Bearer $OSS_BOT_GITHUB_TOKEN" \ -d "{\"event_type\":\"canary-tests\", \"client_payload\":{\"versionOrTag\":\"$VERSION_OR_TAG\"}}" \ - https://api.github.com/repos/firebase/firebase-js-sdk/dispatches + https://api.github.com/repos/firebase/firebase-js-sdk/dispatches \ No newline at end of file diff --git a/.github/workflows/check-changeset.yml b/.github/workflows/check-changeset.yml index 547278d2978..ca76fe7a76b 100644 --- a/.github/workflows/check-changeset.yml +++ b/.github/workflows/check-changeset.yml @@ -34,7 +34,6 @@ jobs: with: # This makes Actions fetch all Git history so check_changeset script can diff properly. fetch-depth: 0 - submodules: true - name: Set up Node (20) uses: actions/setup-node@v3 with: @@ -90,4 +89,4 @@ jobs: # Don't want it to throw before editing the comment. - name: Fail if checker script logged a blocking failure if: ${{steps.check-changeset.outputs.BLOCKING_FAILURE == 'true'}} - run: exit 1 + run: exit 1 \ No newline at end of file diff --git a/.github/workflows/check-docs.yml b/.github/workflows/check-docs.yml index 20e4cb25339..aefab2506e3 100644 --- a/.github/workflows/check-docs.yml +++ b/.github/workflows/check-docs.yml @@ -27,7 +27,6 @@ jobs: with: # get all history for the diff fetch-depth: 0 - submodules: true - name: Set up Node (20) uses: actions/setup-node@v3 with: @@ -40,4 +39,4 @@ jobs: run: git diff --exit-code docs-devsite - name: Reference documentation needs to be updated. See message below. if: ${{ failure() }} - run: echo "Changes in this PR affect the reference docs. Run \`yarn docgen devsite\` locally to regenerate docs and add them to this PR." + run: echo "Changes in this PR affect the reference docs. Run \`yarn docgen devsite\` locally to regenerate docs and add them to this PR." \ No newline at end of file diff --git a/.github/workflows/check-pkg-paths.yml b/.github/workflows/check-pkg-paths.yml index 75fe465c78b..8ca54225e10 100644 --- a/.github/workflows/check-pkg-paths.yml +++ b/.github/workflows/check-pkg-paths.yml @@ -27,7 +27,6 @@ jobs: with: # This makes Actions fetch all Git history so run-changed script can diff properly. fetch-depth: 0 - submodules: true - name: Set up Node (20) uses: actions/setup-node@v3 with: @@ -39,4 +38,4 @@ jobs: - name: Swap in public typings run: yarn release:prepare - name: Check paths - run: yarn ts-node scripts/ci-test/check-paths.ts + run: yarn ts-node scripts/ci-test/check-paths.ts \ No newline at end of file diff --git a/.github/workflows/deploy-config.yml b/.github/workflows/deploy-config.yml index 748db3bcce4..3a2d935dd28 100644 --- a/.github/workflows/deploy-config.yml +++ b/.github/workflows/deploy-config.yml @@ -35,7 +35,6 @@ jobs: with: # This makes Actions fetch all Git history so run-changed script can diff properly. fetch-depth: 0 - submodules: true - name: Set up node (20) uses: actions/setup-node@v3 with: diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index 1c798bbd502..80a555f7840 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -36,8 +36,6 @@ jobs: steps: - name: Checkout Repo uses: actions/checkout@master - with: - submodules: true - name: Set up Node (20) uses: actions/setup-node@master with: diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index f512eac2cc7..7434a9cab4c 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -31,7 +31,6 @@ jobs: with: # get all history for the diff fetch-depth: 0 - submodules: true - name: Set up node (20) uses: actions/setup-node@v3 with: @@ -44,4 +43,4 @@ jobs: run: git diff --exit-code - name: Formatting needs to be updated. See message below. if: ${{ failure() }} - run: echo "Something was changed by formatting. Run \`yarn format\` locally to do a prettier/license pass. Use \`yarn format --help\` to see options." + run: echo "Something was changed by formatting. Run \`yarn format\` locally to do a prettier/license pass. Use \`yarn format --help\` to see options." \ No newline at end of file diff --git a/.github/workflows/health-metrics-pull-request.yml b/.github/workflows/health-metrics-pull-request.yml index 708ccc3ebcf..2148c6d5abf 100644 --- a/.github/workflows/health-metrics-pull-request.yml +++ b/.github/workflows/health-metrics-pull-request.yml @@ -39,8 +39,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - with: - submodules: true - uses: actions/setup-node@v3 with: node-version: 20.x @@ -58,8 +56,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - with: - submodules: true - uses: actions/setup-node@v3 with: node-version: 20.x diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 74f0a3a7301..80851d9834a 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -23,8 +23,6 @@ jobs: steps: - uses: actions/checkout@v3 - with: - submodules: true - name: Set up node (20) uses: actions/setup-node@v3 with: diff --git a/.github/workflows/merge-release-branch.yml b/.github/workflows/merge-release-branch.yml index 45d719a2986..06f4f15a119 100644 --- a/.github/workflows/merge-release-branch.yml +++ b/.github/workflows/merge-release-branch.yml @@ -27,7 +27,6 @@ jobs: uses: actions/checkout@master with: ref: release - submodules: true - name: Get release version id: get-version run: | diff --git a/.github/workflows/prerelease-manual-deploy.yml b/.github/workflows/prerelease-manual-deploy.yml index 201ecdd34e8..54f75383f95 100644 --- a/.github/workflows/prerelease-manual-deploy.yml +++ b/.github/workflows/prerelease-manual-deploy.yml @@ -34,7 +34,6 @@ jobs: with: # Canary release script requires git history and tags. fetch-depth: 0 - submodules: true - name: Set up node (20) uses: actions/setup-node@v3 with: @@ -94,3 +93,4 @@ jobs: NPM_TOKEN_APP_CHECK_COMPAT: ${{ secrets.NPM_TOKEN_APP_CHECK_COMPAT }} NPM_TOKEN_API_DOCUMENTER: ${{ secrets.NPM_TOKEN_API_DOCUMENTER }} CI: true + \ No newline at end of file diff --git a/.github/workflows/release-log.yml b/.github/workflows/release-log.yml index c7fdfb368e8..780e3e97b52 100644 --- a/.github/workflows/release-log.yml +++ b/.github/workflows/release-log.yml @@ -27,8 +27,6 @@ jobs: steps: - name: Checkout Repo uses: actions/checkout@master - with: - submodules: true - name: Setup Node.js 20.x uses: actions/setup-node@master diff --git a/.github/workflows/release-pr.yml b/.github/workflows/release-pr.yml index 11d2fb1d5f5..04ebbd8b926 100644 --- a/.github/workflows/release-pr.yml +++ b/.github/workflows/release-pr.yml @@ -31,7 +31,6 @@ jobs: with: # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits fetch-depth: 0 - submodules: true - name: Setup Node.js 20.x uses: actions/setup-node@master diff --git a/.github/workflows/release-prod.yml b/.github/workflows/release-prod.yml index 9427f434a71..09d1797ec4c 100644 --- a/.github/workflows/release-prod.yml +++ b/.github/workflows/release-prod.yml @@ -43,7 +43,6 @@ jobs: fetch-depth: 0 ref: ${{ github.event.inputs.release-branch }} token: ${{ secrets.OSS_BOT_GITHUB_TOKEN }} - submodules: true - name: Yarn install run: yarn - name: Publish to NPM diff --git a/.github/workflows/release-staging.yml b/.github/workflows/release-staging.yml index 57d3c269034..6a687ed5ee2 100644 --- a/.github/workflows/release-staging.yml +++ b/.github/workflows/release-staging.yml @@ -68,7 +68,6 @@ jobs: # Release script requires git history and tags. fetch-depth: 0 ref: ${{ github.event.inputs.release-branch }} - submodules: true - name: Yarn install run: yarn - name: Publish to NPM diff --git a/.github/workflows/release-tweet.yml b/.github/workflows/release-tweet.yml index 8dabe18cabe..edd2634637b 100644 --- a/.github/workflows/release-tweet.yml +++ b/.github/workflows/release-tweet.yml @@ -34,8 +34,6 @@ jobs: steps: - name: Checkout Repo uses: actions/checkout@master - with: - submodules: true - name: Setup Node.js 20.x uses: actions/setup-node@master with: @@ -54,4 +52,4 @@ jobs: consumer-key: ${{ secrets.TWITTER_CONSUMER_KEY }} consumer-secret: ${{ secrets.TWITTER_CONSUMER_SECRET }} access-token: ${{ secrets.TWITTER_ACCESS_TOKEN }} - access-token-secret: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }} + access-token-secret: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }} \ No newline at end of file diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index 99f84d86176..1a5cc20a2ef 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -42,8 +42,6 @@ jobs: run: | npx @puppeteer/browsers install chrome@stable - uses: actions/checkout@v3 - with: - submodules: true - name: Set up Node (20) uses: actions/setup-node@v3 with: diff --git a/.github/workflows/test-changed-auth.yml b/.github/workflows/test-changed-auth.yml index dbb5fdd9884..d2f11f2bf2f 100644 --- a/.github/workflows/test-changed-auth.yml +++ b/.github/workflows/test-changed-auth.yml @@ -56,7 +56,6 @@ jobs: with: # This makes Actions fetch all Git history so run-changed script can diff properly. fetch-depth: 0 - submodules: true - name: Set up Node (20) uses: actions/setup-node@v3 with: @@ -89,7 +88,6 @@ jobs: with: # This makes Actions fetch all Git history so run-changed script can diff properly. fetch-depth: 0 - submodules: true - name: Set up Node (20) uses: actions/setup-node@v3 with: diff --git a/.github/workflows/test-changed-fcm-integration.yml b/.github/workflows/test-changed-fcm-integration.yml index 1f3ebbe1250..affb4639b1b 100644 --- a/.github/workflows/test-changed-fcm-integration.yml +++ b/.github/workflows/test-changed-fcm-integration.yml @@ -38,7 +38,6 @@ jobs: with: # This makes Actions fetch all Git history so run-changed script can diff properly. fetch-depth: 0 - submodules: true - name: Set up Node (20) uses: actions/setup-node@v3 with: diff --git a/.github/workflows/test-changed-firestore-integration.yml b/.github/workflows/test-changed-firestore-integration.yml index 01552f59060..85e9c7e3eaa 100644 --- a/.github/workflows/test-changed-firestore-integration.yml +++ b/.github/workflows/test-changed-firestore-integration.yml @@ -33,7 +33,6 @@ jobs: with: # This makes Actions fetch all Git history so run-changed script can diff properly. fetch-depth: 0 - submodules: true - uses: 'google-github-actions/auth@v0' if: ${{ fromJSON(env.run_terraform_steps) }} with: diff --git a/.github/workflows/test-changed-firestore.yml b/.github/workflows/test-changed-firestore.yml index 2ac7e3964c8..9f241898e0e 100644 --- a/.github/workflows/test-changed-firestore.yml +++ b/.github/workflows/test-changed-firestore.yml @@ -37,7 +37,6 @@ jobs: with: # This makes Actions fetch all Git history so run-changed script can diff properly. fetch-depth: 0 - submodules: true - name: Set up Node (20) uses: actions/setup-node@v3 with: diff --git a/.github/workflows/test-changed-misc.yml b/.github/workflows/test-changed-misc.yml index 446809031d4..e189ff4fecf 100644 --- a/.github/workflows/test-changed-misc.yml +++ b/.github/workflows/test-changed-misc.yml @@ -31,7 +31,6 @@ jobs: with: # This makes Actions fetch all Git history so run-changed script can diff properly. fetch-depth: 0 - submodules: true - name: Set up Node (20) uses: actions/setup-node@v3 with: @@ -49,4 +48,4 @@ jobs: - name: Run tests run: yarn test:changed misc env: - FIREBASE_TOKEN: ${{ secrets.FIREBASE_CLI_TOKEN }} + FIREBASE_TOKEN: ${{ secrets.FIREBASE_CLI_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/test-changed.yml b/.github/workflows/test-changed.yml index 2ab73e52ec4..ac45286b0c8 100644 --- a/.github/workflows/test-changed.yml +++ b/.github/workflows/test-changed.yml @@ -31,7 +31,6 @@ jobs: with: # This makes Actions fetch all Git history so run-changed script can diff properly. fetch-depth: 0 - submodules: true - name: Set up Node (20) uses: actions/setup-node@v3 with: @@ -61,7 +60,6 @@ jobs: uses: actions/checkout@master with: fetch-depth: 0 - submodules: true - name: Set up Node (20) uses: actions/setup-node@v3 with: diff --git a/.github/workflows/test-firebase-integration.yml b/.github/workflows/test-firebase-integration.yml index a2b0fde0a2c..f6b1eb3c4b3 100644 --- a/.github/workflows/test-firebase-integration.yml +++ b/.github/workflows/test-firebase-integration.yml @@ -31,7 +31,6 @@ jobs: with: # This makes Actions fetch all Git history so run-changed script can diff properly. fetch-depth: 0 - submodules: true - name: Set up Node (20) uses: actions/setup-node@v3 with: @@ -47,4 +46,4 @@ jobs: - name: build run: yarn build:changed firebase-integration - name: Run tests on changed packages - run: yarn test:changed firebase-integration + run: yarn test:changed firebase-integration \ No newline at end of file diff --git a/.github/workflows/update-api-reports.yml b/.github/workflows/update-api-reports.yml index 31065b585ef..f49c548e3cc 100644 --- a/.github/workflows/update-api-reports.yml +++ b/.github/workflows/update-api-reports.yml @@ -30,7 +30,6 @@ jobs: # checkout HEAD commit instead of merge commit ref: ${{ github.event.pull_request.head.ref }} token: ${{ github.token }} - submodules: true - name: Set up node (20) uses: actions/setup-node@v3 with: @@ -46,4 +45,4 @@ jobs: with: add: 'common/api-review/*' message: 'Update API reports' - default_author: github_actor + default_author: github_actor \ No newline at end of file From 4d11e1ccd875318d0212d716ff6aa8e00cdfba4a Mon Sep 17 00:00:00 2001 From: Ehsan Nasiri Date: Tue, 23 Apr 2024 15:50:25 -0700 Subject: [PATCH 10/16] Remove the git submodule. --- .gitmodules | 3 --- packages/webchannel-wrapper/closure-net | 1 - 2 files changed, 4 deletions(-) delete mode 160000 packages/webchannel-wrapper/closure-net diff --git a/.gitmodules b/.gitmodules index ea2ded3d18e..e69de29bb2d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "packages/webchannel-wrapper/closure-net"] - path = packages/webchannel-wrapper/closure-net - url = https://github.com/google/closure-net.git diff --git a/packages/webchannel-wrapper/closure-net b/packages/webchannel-wrapper/closure-net deleted file mode 160000 index 9844d605191..00000000000 --- a/packages/webchannel-wrapper/closure-net +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9844d605191623eaba4b184775610fe875e78ac4 From 7c2f071efa5ca6fbd98d4530f9b8989b5d19a16e Mon Sep 17 00:00:00 2001 From: Ehsan Nasiri Date: Tue, 23 Apr 2024 16:14:32 -0700 Subject: [PATCH 11/16] Use git+https in package.json devDependencies. --- packages/webchannel-wrapper/gulpfile.js | 17 +++++++++-------- packages/webchannel-wrapper/package.json | 1 + yarn.lock | 4 ++++ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/packages/webchannel-wrapper/gulpfile.js b/packages/webchannel-wrapper/gulpfile.js index deacc7387ab..284c131f0dc 100644 --- a/packages/webchannel-wrapper/gulpfile.js +++ b/packages/webchannel-wrapper/gulpfile.js @@ -17,18 +17,19 @@ const gulp = require('gulp'); const concat = require('gulp-concat'); +const closureBlobsDir = '../../node_modules/closure-net/firebase/' // A task to distribute bloom blobs into 'dist' gulp.task('distributeBloomBlobs', () => { return gulp - .src('closure-net/firebase/bloom_blob_*') + .src(closureBlobsDir + 'bloom_blob_*') .pipe(gulp.dest('dist/bloom-blob/')); }); // A task to distribute bloom blobs into 'dist' gulp.task('distributeWebChannelBlobs', () => { return gulp - .src('closure-net/firebase/webchannel_blob_*') + .src(closureBlobsDir + 'webchannel_blob_*') .pipe(gulp.dest('dist/webchannel-blob/')); }); @@ -36,8 +37,8 @@ gulp.task('distributeWebChannelBlobs', () => { gulp.task('aggregateTypings', () => { return gulp .src([ - 'closure-net/firebase/bloom_blob_types.d.ts', - 'closure-net/firebase/webchannel_blob_types.d.ts' + closureBlobsDir + 'bloom_blob_types.d.ts', + closureBlobsDir + 'webchannel_blob_types.d.ts' ]) .pipe(concat('types.d.ts')) .pipe(gulp.dest('dist/')); @@ -51,8 +52,8 @@ gulp.task( function () { return gulp .src([ - 'closure-net/firebase/bloom_blob_es2018.js', - 'closure-net/firebase/webchannel_blob_es2018.js' + closureBlobsDir + 'bloom_blob_es2018.js', + closureBlobsDir + 'webchannel_blob_es2018.js' ]) .pipe(concat('index.js')) .pipe(gulp.dest('dist/')); @@ -60,8 +61,8 @@ gulp.task( function () { return gulp .src([ - 'closure-net/firebase/bloom_blob_es5.js', - 'closure-net/firebase/webchannel_blob_es5.js' + closureBlobsDir + 'bloom_blob_es5.js', + closureBlobsDir + 'webchannel_blob_es5.js' ]) .pipe(concat('index.esm.js')) .pipe(gulp.dest('dist/')); diff --git a/packages/webchannel-wrapper/package.json b/packages/webchannel-wrapper/package.json index 8bdf9e3116e..8793efeee20 100644 --- a/packages/webchannel-wrapper/package.json +++ b/packages/webchannel-wrapper/package.json @@ -30,6 +30,7 @@ }, "license": "Apache-2.0", "devDependencies": { + "closure-net": "git+https://github.com/google/closure-net.git#9844d60", "@rollup/plugin-commonjs": "21.1.0", "gulp": "4.0.2", "gulp-concat": "2.6.1", diff --git a/yarn.lock b/yarn.lock index c79343b5818..4a49e13cf05 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5883,6 +5883,10 @@ cloneable-readable@^1.0.0: process-nextick-args "^2.0.0" readable-stream "^2.3.5" +"closure-net@git+https://github.com/google/closure-net.git#9844d60": + version "0.0.0" + resolved "git+https://github.com/google/closure-net.git#9844d605191623eaba4b184775610fe875e78ac4" + cmd-shim@^4.1.0: version "4.1.0" resolved "https://registry.npmjs.org/cmd-shim/-/cmd-shim-4.1.0.tgz" From f3bc8f557539c278071c25719734d82472313f73 Mon Sep 17 00:00:00 2001 From: Ehsan Nasiri Date: Tue, 23 Apr 2024 16:20:40 -0700 Subject: [PATCH 12/16] prettier. --- packages/webchannel-wrapper/gulpfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/webchannel-wrapper/gulpfile.js b/packages/webchannel-wrapper/gulpfile.js index 284c131f0dc..0d392331059 100644 --- a/packages/webchannel-wrapper/gulpfile.js +++ b/packages/webchannel-wrapper/gulpfile.js @@ -17,7 +17,7 @@ const gulp = require('gulp'); const concat = require('gulp-concat'); -const closureBlobsDir = '../../node_modules/closure-net/firebase/' +const closureBlobsDir = '../../node_modules/closure-net/firebase/'; // A task to distribute bloom blobs into 'dist' gulp.task('distributeBloomBlobs', () => { From 6834524b624212330e584b6b8630ad8eee609449 Mon Sep 17 00:00:00 2001 From: Christina Holland Date: Fri, 26 Apr 2024 14:30:50 -0700 Subject: [PATCH 13/16] Set up rollup for webchannel-wrapper (#8203) * convert webchannel-wrapper package to use rollup * clean up rollup config * formatting --- .../bloom-blob/package.json | 5 +- packages/webchannel-wrapper/empty.js | 24 ++++++ packages/webchannel-wrapper/gulpfile.js | 81 ------------------- packages/webchannel-wrapper/package.json | 20 ++--- packages/webchannel-wrapper/rollup.config.js | 73 +++++++++++++++++ packages/webchannel-wrapper/tsconfig.json | 3 +- .../webchannel-blob/package.json | 5 +- yarn.lock | 16 ---- 8 files changed, 115 insertions(+), 112 deletions(-) create mode 100644 packages/webchannel-wrapper/empty.js delete mode 100644 packages/webchannel-wrapper/gulpfile.js create mode 100644 packages/webchannel-wrapper/rollup.config.js diff --git a/packages/webchannel-wrapper/bloom-blob/package.json b/packages/webchannel-wrapper/bloom-blob/package.json index 9bb95f7bb48..956333e7cf2 100644 --- a/packages/webchannel-wrapper/bloom-blob/package.json +++ b/packages/webchannel-wrapper/bloom-blob/package.json @@ -1,8 +1,9 @@ { "name": "@firebase/webchannel-wrapper/bloom-blob", "description": "Bloom filter related code from the Closure library.", - "browser": "../dist/bloom-blob/bloom_blob_es2018.js", - "module": "../dist/bloom-blob/bloom_blob_es2018.js", + "main": "../dist/bloom-blob/bloom_blob_es2018.js", + "browser": "../dist/bloom-blob/esm/bloom_blob_es2018.js", + "module": "../dist/bloom-blob/esm/bloom_blob_es2018.js", "esm5": "../dist/bloom-blob/bloom_blob_es5.js", "typings": "../dist/bloom-blob/bloom_blob_types.d.ts" } diff --git a/packages/webchannel-wrapper/empty.js b/packages/webchannel-wrapper/empty.js new file mode 100644 index 00000000000..0a92763191f --- /dev/null +++ b/packages/webchannel-wrapper/empty.js @@ -0,0 +1,24 @@ +/** + * @license + * Copyright 2024 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. + */ + +/** + * This package has no main entry point and only allows imports from its + * two subpaths. This file is provided for the top-level package.json + * "main" field to point to. + */ + +export default {}; diff --git a/packages/webchannel-wrapper/gulpfile.js b/packages/webchannel-wrapper/gulpfile.js deleted file mode 100644 index 0d392331059..00000000000 --- a/packages/webchannel-wrapper/gulpfile.js +++ /dev/null @@ -1,81 +0,0 @@ -/** - * @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. - */ - -const gulp = require('gulp'); -const concat = require('gulp-concat'); -const closureBlobsDir = '../../node_modules/closure-net/firebase/'; - -// A task to distribute bloom blobs into 'dist' -gulp.task('distributeBloomBlobs', () => { - return gulp - .src(closureBlobsDir + 'bloom_blob_*') - .pipe(gulp.dest('dist/bloom-blob/')); -}); - -// A task to distribute bloom blobs into 'dist' -gulp.task('distributeWebChannelBlobs', () => { - return gulp - .src(closureBlobsDir + 'webchannel_blob_*') - .pipe(gulp.dest('dist/webchannel-blob/')); -}); - -// A task to concatenate typings of all blobs into 'dist' -gulp.task('aggregateTypings', () => { - return gulp - .src([ - closureBlobsDir + 'bloom_blob_types.d.ts', - closureBlobsDir + 'webchannel_blob_types.d.ts' - ]) - .pipe(concat('types.d.ts')) - .pipe(gulp.dest('dist/')); -}); - -// A task to concatenate all blobs into one file in 'dist'. -// This is only used to report the total size of this package. -gulp.task( - 'aggregateBlobs', - gulp.parallel( - function () { - return gulp - .src([ - closureBlobsDir + 'bloom_blob_es2018.js', - closureBlobsDir + 'webchannel_blob_es2018.js' - ]) - .pipe(concat('index.js')) - .pipe(gulp.dest('dist/')); - }, - function () { - return gulp - .src([ - closureBlobsDir + 'bloom_blob_es5.js', - closureBlobsDir + 'webchannel_blob_es5.js' - ]) - .pipe(concat('index.esm.js')) - .pipe(gulp.dest('dist/')); - } - ) -); - -gulp.task( - 'default', - gulp.series( - 'distributeBloomBlobs', - 'distributeWebChannelBlobs', - 'aggregateTypings', - 'aggregateBlobs' - ) -); diff --git a/packages/webchannel-wrapper/package.json b/packages/webchannel-wrapper/package.json index 8793efeee20..6ee1f5867b1 100644 --- a/packages/webchannel-wrapper/package.json +++ b/packages/webchannel-wrapper/package.json @@ -3,17 +3,19 @@ "version": "0.10.7", "description": "A wrapper of the webchannel packages from closure-library for use outside of a closure compiled application", "author": "Firebase (https://firebase.google.com/)", - "main": "dist/index.js", - "module": "dist/index.js", - "esm5": "dist/index.esm.js", + "main": "empty.js", "exports": { "./webchannel-blob": { "types": "./dist/webchannel-blob/webchannel_blob_types.d.ts", - "default": "./dist/webchannel-blob/webchannel_blob_es2018.js" + "require": "./dist/webchannel-blob/webchannel_blob_es2018.js", + "esm5": "./dist/webchannel-blob/webchannel_blob_es5.js", + "default": "./dist/webchannel-blob/esm/webchannel_blob_es2018.js" }, "./bloom-blob": { "types": "./dist/bloom-blob/bloom_blob_types.d.ts", - "default": "./dist/bloom-blob/bloom_blob_es2018.js" + "require": "./dist/bloom-blob/bloom_blob_es2018.js", + "es5": "./dist/bloom-blob/bloom_blob_es5.js", + "default": "./dist/bloom-blob/esm/bloom_blob_es2018.js" }, "./package.json": "./package.json" }, @@ -24,7 +26,7 @@ ], "scripts": { "dev": "watch 'yarn build' src", - "build": "gulp", + "build": "rollup -c", "test": "echo 'No test suite for webchannel-wrapper'", "test:ci": "echo 'No test suite for webchannel-wrapper'" }, @@ -32,10 +34,8 @@ "devDependencies": { "closure-net": "git+https://github.com/google/closure-net.git#9844d60", "@rollup/plugin-commonjs": "21.1.0", - "gulp": "4.0.2", - "gulp-concat": "2.6.1", - "gulp-sourcemaps": "3.0.0", "rollup": "2.79.1", + "rollup-plugin-copy": "3.5.0", "rollup-plugin-sourcemaps": "0.6.3", "rollup-plugin-typescript2": "0.31.2", "typescript": "4.7.4" @@ -45,7 +45,7 @@ "type": "git", "url": "git+https://github.com/firebase/firebase-js-sdk.git" }, - "typings": "./dist/types.d.ts", + "typings": "./dist/webchannel-blob/webchannel_blob_types.d.ts", "bugs": { "url": "https://github.com/firebase/firebase-js-sdk/issues" } diff --git a/packages/webchannel-wrapper/rollup.config.js b/packages/webchannel-wrapper/rollup.config.js new file mode 100644 index 00000000000..77c29ecb4ac --- /dev/null +++ b/packages/webchannel-wrapper/rollup.config.js @@ -0,0 +1,73 @@ +/** + * @license + * Copyright 2024 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 { join } from 'path'; +import copy from 'rollup-plugin-copy'; +import commonjs from '@rollup/plugin-commonjs'; +import typescriptPlugin from 'rollup-plugin-typescript2'; +import typescript from 'typescript'; +import { emitModulePackageFile } from '../../scripts/build/rollup_emit_module_package_file'; +import pkg from './package.json'; + +const closureBlobsDir = '../../node_modules/closure-net/firebase/'; + +const es2017BuildPlugins = [ + copy({ + targets: [ + { + src: join(closureBlobsDir, 'webchannel_blob_*.*'), + dest: 'dist/webchannel-blob' + }, + { src: join(closureBlobsDir, 'bloom_blob_*.*'), dest: 'dist/bloom-blob' } + ] + }), + typescriptPlugin({ + typescript, + tsconfigOverride: { + compilerOptions: { + target: 'es2017' + } + } + }), + commonjs() +]; + +/** + * ESM builds + */ +const esm2017Builds = [ + { + input: join(closureBlobsDir, 'webchannel_blob_es2018.js'), + output: { + file: pkg.exports['./webchannel-blob'].default, + format: 'es', + sourcemap: true + }, + plugins: [...es2017BuildPlugins, emitModulePackageFile()] + }, + { + input: join(closureBlobsDir, 'bloom_blob_es2018.js'), + output: { + file: pkg.exports['./bloom-blob'].default, + format: 'es', + sourcemap: true + }, + plugins: [...es2017BuildPlugins, emitModulePackageFile()] + } +]; + +export default esm2017Builds; diff --git a/packages/webchannel-wrapper/tsconfig.json b/packages/webchannel-wrapper/tsconfig.json index a777c9d54b7..23e05a91330 100644 --- a/packages/webchannel-wrapper/tsconfig.json +++ b/packages/webchannel-wrapper/tsconfig.json @@ -4,5 +4,6 @@ "declaration": false, "outDir": "dist", "downlevelIteration": true, - } + }, + "include": ["../../node_modules/closure-net/firebase"] } diff --git a/packages/webchannel-wrapper/webchannel-blob/package.json b/packages/webchannel-wrapper/webchannel-blob/package.json index 8b7a532ed03..cb339b82557 100644 --- a/packages/webchannel-wrapper/webchannel-blob/package.json +++ b/packages/webchannel-wrapper/webchannel-blob/package.json @@ -1,8 +1,9 @@ { "name": "@firebase/webchannel-wrapper/webchannel-blob", "description": "Webchannel related code from the Closure library.", - "browser": "../dist/webchannel-blob/webchannel_blob_es2018.js", - "module": "../dist/webchannel-blob/webchannel_blob_es2018.js", + "main": "../dist/webchannel-blob/webchannel_blob_es2018.js", + "browser": "../dist/webchannel-blob/esm/webchannel_blob_es2018.js", + "module": "../dist/webchannel-blob/esm/webchannel_blob_es2018.js", "esm5": "../dist/webchannel-blob/webchannel_blob_es5.js", "typings": "../dist/webchannel-blob/webchannel_blob_types.d.ts" } diff --git a/yarn.lock b/yarn.lock index 4a49e13cf05..1163a54fdb9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6127,13 +6127,6 @@ concat-stream@^2.0.0: readable-stream "^3.0.2" typedarray "^0.0.6" -concat-with-sourcemaps@^1.0.0: - version "1.1.0" - resolved "https://registry.npmjs.org/concat-with-sourcemaps/-/concat-with-sourcemaps-1.1.0.tgz#d4ea93f05ae25790951b99e7b3b09e3908a4082e" - integrity sha512-4gEjHJFT9e+2W/77h/DS5SGUgwDaOwprX8L/gl5+3ixnzkVJJsZWDSelmN3Oilw3LNDZjZV0yqH1hLG3k6nghg== - dependencies: - source-map "^0.6.1" - config-chain@^1.1.11, config-chain@^1.1.12: version "1.1.13" resolved "https://registry.npmjs.org/config-chain/-/config-chain-1.1.13.tgz" @@ -9330,15 +9323,6 @@ gulp-cli@^2.2.0: v8flags "^3.2.0" yargs "^7.1.0" -gulp-concat@2.6.1: - version "2.6.1" - resolved "https://registry.npmjs.org/gulp-concat/-/gulp-concat-2.6.1.tgz#633d16c95d88504628ad02665663cee5a4793353" - integrity sha512-a2scActrQrDBpBbR3WUZGyGS1JEPLg5PZJdIa7/Bi3GuKAmPYDK6SFhy/NZq5R8KsKKFvtfR0fakbUCcKGCCjg== - dependencies: - concat-with-sourcemaps "^1.0.0" - through2 "^2.0.0" - vinyl "^2.0.0" - gulp-filter@7.0.0: version "7.0.0" resolved "https://registry.npmjs.org/gulp-filter/-/gulp-filter-7.0.0.tgz" From 726fc7c441653aeb162d82856131a3ea80e2c35a Mon Sep 17 00:00:00 2001 From: Ehsan Date: Fri, 26 Apr 2024 15:09:43 -0700 Subject: [PATCH 14/16] Create thick-spoons-check.md --- .changeset/thick-spoons-check.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changeset/thick-spoons-check.md diff --git a/.changeset/thick-spoons-check.md b/.changeset/thick-spoons-check.md new file mode 100644 index 00000000000..6ba0699910d --- /dev/null +++ b/.changeset/thick-spoons-check.md @@ -0,0 +1,7 @@ +--- +"@firebase/firestore": patch +"@firebase/webchannel-wrapper": patch +"firebase-size-analysis": patch +--- + +Use closure-net as a dependency of Firestore From 1a2c458ae8b2fa2135ad236eea77d4f9388fcea7 Mon Sep 17 00:00:00 2001 From: Ehsan Nasiri Date: Fri, 26 Apr 2024 15:16:12 -0700 Subject: [PATCH 15/16] Better changeset. --- .changeset/thick-spoons-check.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.changeset/thick-spoons-check.md b/.changeset/thick-spoons-check.md index 6ba0699910d..3ff1c1a1cea 100644 --- a/.changeset/thick-spoons-check.md +++ b/.changeset/thick-spoons-check.md @@ -1,7 +1,6 @@ --- "@firebase/firestore": patch "@firebase/webchannel-wrapper": patch -"firebase-size-analysis": patch --- -Use closure-net as a dependency of Firestore +Use closure-net as a dependency of webchannel-wrapper and Firestore. From d46e014cd6777277c0035ac5f3a46c7ab9ce1f65 Mon Sep 17 00:00:00 2001 From: Ehsan Nasiri Date: Tue, 30 Apr 2024 09:53:14 -0700 Subject: [PATCH 16/16] Address feedback on versioning. --- .changeset/thick-spoons-check.md | 2 +- packages/firestore/package.json | 2 +- packages/webchannel-wrapper/CHANGELOG.md | 4 ---- packages/webchannel-wrapper/package.json | 2 +- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.changeset/thick-spoons-check.md b/.changeset/thick-spoons-check.md index 3ff1c1a1cea..dce3dcdd8ab 100644 --- a/.changeset/thick-spoons-check.md +++ b/.changeset/thick-spoons-check.md @@ -1,6 +1,6 @@ --- "@firebase/firestore": patch -"@firebase/webchannel-wrapper": patch +"@firebase/webchannel-wrapper": major --- Use closure-net as a dependency of webchannel-wrapper and Firestore. diff --git a/packages/firestore/package.json b/packages/firestore/package.json index bd5684c692a..36f55ee5165 100644 --- a/packages/firestore/package.json +++ b/packages/firestore/package.json @@ -99,7 +99,7 @@ "@firebase/component": "0.6.6", "@firebase/logger": "0.4.1", "@firebase/util": "1.9.5", - "@firebase/webchannel-wrapper": "0.10.7", + "@firebase/webchannel-wrapper": "0.10.6", "@grpc/grpc-js": "~1.9.0", "@grpc/proto-loader": "^0.7.8", "undici": "5.28.4", diff --git a/packages/webchannel-wrapper/CHANGELOG.md b/packages/webchannel-wrapper/CHANGELOG.md index b1fd55970e7..07eb7707aed 100644 --- a/packages/webchannel-wrapper/CHANGELOG.md +++ b/packages/webchannel-wrapper/CHANGELOG.md @@ -1,9 +1,5 @@ # @firebase/webchannel-wrapper -## 0.10.7 - -- Change the Closure library dependency to closure-net. - ## 0.10.6 ### Patch Changes diff --git a/packages/webchannel-wrapper/package.json b/packages/webchannel-wrapper/package.json index 6ee1f5867b1..ad2a8df0bdb 100644 --- a/packages/webchannel-wrapper/package.json +++ b/packages/webchannel-wrapper/package.json @@ -1,6 +1,6 @@ { "name": "@firebase/webchannel-wrapper", - "version": "0.10.7", + "version": "0.10.6", "description": "A wrapper of the webchannel packages from closure-library for use outside of a closure compiled application", "author": "Firebase (https://firebase.google.com/)", "main": "empty.js",