firebase-tools 11.25.1 → 11.25.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -77,7 +77,9 @@ function transUserToArray(user) {
77
77
  arr[24] = user.lastLoginAt;
78
78
  arr[25] = user.phoneNumber;
79
79
  arr[26] = user.disabled;
80
- arr[27] = user.customAttributes;
80
+ arr[27] = user.customAttributes
81
+ ? `"${user.customAttributes.replace(/(?<!\\)"/g, '""')}"`
82
+ : user.customAttributes;
81
83
  return arr;
82
84
  }
83
85
  function transUserJson(user) {
@@ -23,9 +23,9 @@ const EMULATOR_UPDATE_DETAILS = {
23
23
  expectedChecksum: "311609538bd65666eb724ef47c2e6466",
24
24
  },
25
25
  firestore: {
26
- version: "1.16.0",
27
- expectedSize: 63422812,
28
- expectedChecksum: "6c1a43c1b327d534f83f7386c595d7ff",
26
+ version: "1.16.2",
27
+ expectedSize: 64601019,
28
+ expectedChecksum: "83f379a5b3d367503a860497fea3a936",
29
29
  },
30
30
  storage: {
31
31
  version: "1.1.3",
@@ -35,9 +35,9 @@ const EMULATOR_UPDATE_DETAILS = {
35
35
  ui: experiments.isEnabled("emulatoruisnapshot")
36
36
  ? { version: "SNAPSHOT", expectedSize: -1, expectedChecksum: "" }
37
37
  : {
38
- version: "1.11.4",
39
- expectedSize: 3062916,
40
- expectedChecksum: "1773926323b07fdb9602d882a7682882",
38
+ version: "1.11.5",
39
+ expectedSize: 3063444,
40
+ expectedChecksum: "4045fef65cf71fb9d83b01fb8b160141",
41
41
  },
42
42
  pubsub: {
43
43
  version: "0.7.1",
@@ -8,7 +8,6 @@ const fs_extra_1 = require("fs-extra");
8
8
  const promises_1 = require("fs/promises");
9
9
  const __1 = require("..");
10
10
  const prompt_1 = require("../../prompt");
11
- const proxy_1 = require("../../hosting/proxy");
12
11
  const utils_1 = require("../utils");
13
12
  exports.name = "Angular";
14
13
  exports.support = "experimental";
@@ -87,7 +86,7 @@ async function getDevModeHandle(dir) {
87
86
  process.stderr.write(data);
88
87
  });
89
88
  });
90
- return (0, proxy_1.proxyRequestHandler)(await host, "Angular Live Development Server", { forceCascade: true });
89
+ return (0, utils_1.simpleProxy)(await host);
91
90
  }
92
91
  exports.getDevModeHandle = getDevModeHandle;
93
92
  async function ɵcodegenPublicDirectory(sourceDir, destDir) {
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,13 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createServerResponseProxy = exports.prepareFrameworks = exports.findDependency = exports.discover = exports.relativeRequire = exports.WebFrameworks = exports.ALLOWED_SSR_REGIONS = exports.DEFAULT_REGION = exports.NODE_VERSION = exports.FIREBASE_ADMIN_VERSION = exports.FIREBASE_FUNCTIONS_VERSION = exports.FIREBASE_FRAMEWORKS_VERSION = void 0;
3
+ exports.prepareFrameworks = exports.findDependency = exports.discover = exports.relativeRequire = exports.WebFrameworks = exports.ALLOWED_SSR_REGIONS = exports.DEFAULT_REGION = exports.NODE_VERSION = exports.FIREBASE_ADMIN_VERSION = exports.FIREBASE_FUNCTIONS_VERSION = exports.FIREBASE_FRAMEWORKS_VERSION = void 0;
4
4
  const path_1 = require("path");
5
5
  const process_1 = require("process");
6
6
  const child_process_1 = require("child_process");
7
7
  const cross_spawn_1 = require("cross-spawn");
8
8
  const fs_1 = require("fs");
9
9
  const url_1 = require("url");
10
- const http_1 = require("http");
11
10
  const promises_1 = require("fs/promises");
12
11
  const fs_extra_1 = require("fs-extra");
13
12
  const clc = require("colorette");
@@ -236,8 +235,9 @@ async function prepareFrameworks(targetNames, context, options, emulators = [])
236
235
  }
237
236
  }
238
237
  }
239
- if (firebaseDefaults)
238
+ if (firebaseDefaults) {
240
239
  process.env.__FIREBASE_DEFAULTS__ = JSON.stringify(firebaseDefaults);
240
+ }
241
241
  const results = await discover(getProjectPath());
242
242
  if (!results)
243
243
  throw new Error("Epic fail.");
@@ -273,8 +273,10 @@ async function prepareFrameworks(targetNames, context, options, emulators = [])
273
273
  }
274
274
  config.webFramework = `${framework}${codegenFunctionsDirectory ? "_ssr" : ""}`;
275
275
  if (codegenFunctionsDirectory) {
276
- if (firebaseDefaults)
276
+ if (firebaseDefaults) {
277
277
  firebaseDefaults._authTokenSyncURL = "/__session";
278
+ process.env.__FIREBASE_DEFAULTS__ = JSON.stringify(firebaseDefaults);
279
+ }
278
280
  const rewrite = {
279
281
  source: "**",
280
282
  function: {
@@ -416,47 +418,3 @@ function codegenDevModeFunctionsDirectory() {
416
418
  const packageJson = {};
417
419
  return Promise.resolve({ packageJson, frameworksEntry: "_devMode" });
418
420
  }
419
- function createServerResponseProxy(req, res, next) {
420
- const proxiedRes = new http_1.ServerResponse(req);
421
- const buffer = [];
422
- proxiedRes.write = new Proxy(proxiedRes.write.bind(proxiedRes), {
423
- apply: (target, thisArg, args) => {
424
- target.call(thisArg, ...args);
425
- buffer.push(["write", args]);
426
- },
427
- });
428
- proxiedRes.setHeader = new Proxy(proxiedRes.setHeader.bind(proxiedRes), {
429
- apply: (target, thisArg, args) => {
430
- target.call(thisArg, ...args);
431
- buffer.push(["setHeader", args]);
432
- },
433
- });
434
- proxiedRes.removeHeader = new Proxy(proxiedRes.removeHeader.bind(proxiedRes), {
435
- apply: (target, thisArg, args) => {
436
- target.call(thisArg, ...args);
437
- buffer.push(["removeHeader", args]);
438
- },
439
- });
440
- proxiedRes.writeHead = new Proxy(proxiedRes.writeHead.bind(proxiedRes), {
441
- apply: (target, thisArg, args) => {
442
- target.call(thisArg, ...args);
443
- buffer.push(["writeHead", args]);
444
- },
445
- });
446
- proxiedRes.end = new Proxy(proxiedRes.end.bind(proxiedRes), {
447
- apply: (target, thisArg, args) => {
448
- target.call(thisArg, ...args);
449
- if (proxiedRes.statusCode === 404) {
450
- next();
451
- }
452
- else {
453
- for (const [fn, args] of buffer) {
454
- res[fn](...args);
455
- }
456
- res.end(...args);
457
- }
458
- },
459
- });
460
- return proxiedRes;
461
- }
462
- exports.createServerResponseProxy = createServerResponseProxy;
@@ -284,11 +284,10 @@ async function getDevModeHandle(dir, hostingEmulatorInfo) {
284
284
  });
285
285
  const handler = nextApp.getRequestHandler();
286
286
  await nextApp.prepare();
287
- return (req, res, next) => {
287
+ return (0, utils_2.simpleProxy)(async (req, res) => {
288
288
  const parsedUrl = (0, url_1.parse)(req.url, true);
289
- const proxy = (0, __1.createServerResponseProxy)(req, res, next);
290
- handler(req, proxy, parsedUrl);
291
- };
289
+ await handler(req, res, parsedUrl);
290
+ });
292
291
  }
293
292
  exports.getDevModeHandle = getDevModeHandle;
294
293
  async function getConfig(dir) {
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.warnIfCustomBuildScript = exports.readJSON = exports.isUrl = void 0;
3
+ exports.simpleProxy = exports.warnIfCustomBuildScript = exports.readJSON = exports.isUrl = void 0;
4
4
  const fs_extra_1 = require("fs-extra");
5
5
  const path_1 = require("path");
6
6
  const promises_1 = require("fs/promises");
7
+ const http_1 = require("http");
8
+ const logger_1 = require("../logger");
7
9
  function isUrl(url) {
8
10
  return /^https?:\/\//.test(url);
9
11
  }
@@ -22,3 +24,46 @@ async function warnIfCustomBuildScript(dir, framework, defaultBuildScripts) {
22
24
  }
23
25
  }
24
26
  exports.warnIfCustomBuildScript = warnIfCustomBuildScript;
27
+ function simpleProxy(hostOrRequestHandler) {
28
+ const agent = new http_1.Agent({ keepAlive: true });
29
+ return async (originalReq, originalRes, next) => {
30
+ const { method, headers, url: path } = originalReq;
31
+ if (!method || !path) {
32
+ return originalRes.end();
33
+ }
34
+ const firebaseDefaultsJSON = process.env.__FIREBASE_DEFAULTS__;
35
+ const authTokenSyncURL = firebaseDefaultsJSON && JSON.parse(firebaseDefaultsJSON)._authTokenSyncURL;
36
+ if (path === authTokenSyncURL) {
37
+ return next();
38
+ }
39
+ if (typeof hostOrRequestHandler === "string") {
40
+ const host = hostOrRequestHandler;
41
+ const { hostname, port, protocol, username, password } = new URL(host);
42
+ const auth = username || password ? `${username}:${password}` : undefined;
43
+ const opts = {
44
+ agent,
45
+ auth,
46
+ protocol,
47
+ hostname,
48
+ port,
49
+ path,
50
+ method,
51
+ headers: Object.assign(Object.assign({}, headers), { host, "X-Forwarded-Host": headers.host }),
52
+ };
53
+ const req = (0, http_1.request)(opts, (response) => {
54
+ const { statusCode, statusMessage, headers } = response;
55
+ originalRes.writeHead(statusCode, statusMessage, headers);
56
+ response.pipe(originalRes);
57
+ });
58
+ originalReq.pipe(req);
59
+ req.on("error", (err) => {
60
+ logger_1.logger.debug("Error encountered while proxying request:", method, path, err);
61
+ originalRes.end();
62
+ });
63
+ }
64
+ else {
65
+ await hostOrRequestHandler(originalReq, originalRes);
66
+ }
67
+ };
68
+ }
69
+ exports.simpleProxy = simpleProxy;
@@ -7,7 +7,6 @@ const fs_1 = require("fs");
7
7
  const fs_extra_1 = require("fs-extra");
8
8
  const path_1 = require("path");
9
9
  const __1 = require("..");
10
- const proxy_1 = require("../../hosting/proxy");
11
10
  const prompt_1 = require("../../prompt");
12
11
  const utils_1 = require("../utils");
13
12
  exports.name = "Vite";
@@ -83,7 +82,7 @@ async function getDevModeHandle(dir) {
83
82
  process.stderr.write(data);
84
83
  });
85
84
  });
86
- return (0, proxy_1.proxyRequestHandler)(await host, "Vite Development Server", { forceCascade: true });
85
+ return (0, utils_1.simpleProxy)(await host);
87
86
  }
88
87
  exports.getDevModeHandle = getDevModeHandle;
89
88
  async function getConfig(root) {
@@ -247,7 +247,7 @@ async function promptForRepo(options, ghAccessToken) {
247
247
  keyId = body.key_id;
248
248
  }
249
249
  catch (e) {
250
- if (e.status === 403) {
250
+ if ([403, 404].includes(e.status)) {
251
251
  logger_1.logger.info();
252
252
  logger_1.logger.info();
253
253
  (0, utils_1.logWarning)("The provided authorization cannot be used with this repository. If this repository is in an organization, did you remember to grant access?", "error");
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "firebase-tools",
3
- "version": "11.25.1",
3
+ "version": "11.25.3",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "firebase-tools",
9
- "version": "11.25.1",
9
+ "version": "11.25.3",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@google-cloud/pubsub": "^3.0.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "firebase-tools",
3
- "version": "11.25.1",
3
+ "version": "11.25.3",
4
4
  "description": "Command-Line Interface for Firebase",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {
@@ -1,4 +1,4 @@
1
- This directory now contains the source files for a simple extension called **greet-the-world**. You can try it out right away in the Firebase Emulator suite - just naviagte to the integration-test directory and run:
1
+ This directory now contains the source files for a simple extension called **greet-the-world**. You can try it out right away in the Firebase Emulator suite - just navigate to the integration-test directory and run:
2
2
 
3
3
  `firebase emulators:start --project=<project-id>`
4
4