firebase-tools 13.7.2 → 13.7.4

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.
Files changed (39) hide show
  1. package/lib/api.js +10 -8
  2. package/lib/apphosting/app.js +92 -0
  3. package/lib/apphosting/config.js +76 -10
  4. package/lib/apphosting/constants.js +2 -2
  5. package/lib/apphosting/githubConnections.js +2 -2
  6. package/lib/apphosting/index.js +36 -27
  7. package/lib/apphosting/repo.js +2 -2
  8. package/lib/apphosting/secrets/dialogs.js +15 -14
  9. package/lib/apphosting/secrets/index.js +7 -1
  10. package/lib/commands/apphosting-backends-create.js +5 -3
  11. package/lib/commands/apphosting-backends-delete.js +7 -17
  12. package/lib/commands/apphosting-backends-get.js +8 -8
  13. package/lib/commands/apphosting-backends-list.js +4 -5
  14. package/lib/commands/apphosting-builds-create.js +32 -0
  15. package/lib/commands/apphosting-builds-get.js +18 -0
  16. package/lib/commands/apphosting-rollouts-create.js +26 -0
  17. package/lib/commands/apphosting-rollouts-list.js +21 -0
  18. package/lib/commands/apphosting-secrets-access.js +1 -1
  19. package/lib/commands/apphosting-secrets-grantaccess.js +7 -7
  20. package/lib/commands/apphosting-secrets-set.js +10 -59
  21. package/lib/commands/functions-secrets-set.js +1 -17
  22. package/lib/commands/index.js +8 -0
  23. package/lib/deploy/functions/runtimes/discovery/index.js +3 -3
  24. package/lib/deploy/functions/runtimes/{supported.js → supported/index.js} +26 -81
  25. package/lib/deploy/functions/runtimes/supported/types.js +74 -0
  26. package/lib/emulator/downloadableEmulators.js +15 -5
  27. package/lib/extensions/emulator/specHelper.js +3 -3
  28. package/lib/extensions/extensionsApi.js +2 -2
  29. package/lib/extensions/localHelper.js +3 -3
  30. package/lib/frameworks/flutter/index.js +2 -2
  31. package/lib/frameworks/next/index.js +3 -3
  32. package/lib/frameworks/next/utils.js +1 -0
  33. package/lib/functions/python.js +4 -3
  34. package/lib/gcp/apphosting.js +6 -1
  35. package/lib/gcp/devConnect.js +1 -1
  36. package/lib/init/features/hosting/github.js +4 -5
  37. package/lib/utils.js +17 -0
  38. package/package.json +3 -3
  39. package/templates/init/functions/typescript/_eslintrc +1 -0
@@ -23,9 +23,9 @@ const EMULATOR_UPDATE_DETAILS = {
23
23
  expectedChecksum: "2fd771101c0e1f7898c04c9204f2ce63",
24
24
  },
25
25
  firestore: {
26
- version: "1.19.4",
27
- expectedSize: 65913000,
28
- expectedChecksum: "a861bfa9d12ef69645b41e2f3bd8db8d",
26
+ version: "1.19.5",
27
+ expectedSize: 66204670,
28
+ expectedChecksum: "6d9fb826605701668af722f25048ad95",
29
29
  },
30
30
  storage: {
31
31
  version: "1.1.3",
@@ -147,6 +147,7 @@ const Commands = {
147
147
  "single_project_mode",
148
148
  ],
149
149
  joinArgs: false,
150
+ shell: false,
150
151
  },
151
152
  firestore: {
152
153
  binary: "java",
@@ -168,6 +169,7 @@ const Commands = {
168
169
  "single_project_mode",
169
170
  ],
170
171
  joinArgs: false,
172
+ shell: false,
171
173
  },
172
174
  storage: {
173
175
  binary: "java",
@@ -179,18 +181,21 @@ const Commands = {
179
181
  ],
180
182
  optionalArgs: [],
181
183
  joinArgs: false,
184
+ shell: false,
182
185
  },
183
186
  pubsub: {
184
187
  binary: getExecPath(types_1.Emulators.PUBSUB),
185
188
  args: [],
186
189
  optionalArgs: ["port", "host"],
187
190
  joinArgs: true,
191
+ shell: true,
188
192
  },
189
193
  ui: {
190
194
  binary: "node",
191
195
  args: [getExecPath(types_1.Emulators.UI)],
192
196
  optionalArgs: [],
193
197
  joinArgs: false,
198
+ shell: false,
194
199
  },
195
200
  };
196
201
  function getExecPath(name) {
@@ -237,6 +242,7 @@ function _getCommand(emulator, args) {
237
242
  args: cmdLineArgs,
238
243
  optionalArgs: baseCmd.optionalArgs,
239
244
  joinArgs: baseCmd.joinArgs,
245
+ shell: baseCmd.shell,
240
246
  };
241
247
  }
242
248
  exports._getCommand = _getCommand;
@@ -273,11 +279,15 @@ async function _runBinary(emulator, command, extraEnv) {
273
279
  const logger = emulatorLogger_1.EmulatorLogger.forEmulator(emulator.name);
274
280
  emulator.stdout = fs.createWriteStream(getLogFileName(emulator.name));
275
281
  try {
276
- emulator.instance = childProcess.spawn(command.binary, command.args, {
282
+ const opts = {
277
283
  env: Object.assign(Object.assign({}, process.env), extraEnv),
278
284
  detached: true,
279
285
  stdio: ["inherit", "pipe", "pipe"],
280
- });
286
+ };
287
+ if (command.shell && utils.IS_WINDOWS) {
288
+ opts.shell = true;
289
+ }
290
+ emulator.instance = childProcess.spawn(command.binary, command.args, opts);
281
291
  }
282
292
  catch (e) {
283
293
  if (e.code === "EACCES") {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getRuntime = exports.DEFAULT_RUNTIME = exports.getFunctionProperties = exports.getFunctionResourcesWithParamSubstitution = exports.readFileFromDirectory = exports.readPostinstall = exports.readExtensionYaml = void 0;
4
- const yaml = require("js-yaml");
4
+ const yaml = require("yaml");
5
5
  const path = require("path");
6
6
  const fs = require("fs-extra");
7
7
  const supported = require("../../deploy/functions/runtimes/supported");
@@ -17,10 +17,10 @@ const validFunctionTypes = [
17
17
  ];
18
18
  function wrappedSafeLoad(source) {
19
19
  try {
20
- return yaml.safeLoad(source);
20
+ return yaml.parse(source);
21
21
  }
22
22
  catch (err) {
23
- if (err instanceof yaml.YAMLException) {
23
+ if (err instanceof yaml.YAMLParseError) {
24
24
  throw new error_1.FirebaseError(`YAML Error: ${err.message}`, { original: err });
25
25
  }
26
26
  throw err;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.refNotFoundError = exports.getExtension = exports.listExtensionVersions = exports.listExtensions = exports.getExtensionVersion = exports.getSource = exports.createSource = exports.populateSpec = exports.updateInstanceFromRegistry = exports.updateInstance = exports.configureInstance = exports.listInstances = exports.getInstance = exports.deleteInstance = exports.createInstance = void 0;
4
- const yaml = require("js-yaml");
4
+ const yaml = require("yaml");
5
5
  const clc = require("colorette");
6
6
  const apiv2_1 = require("../apiv2");
7
7
  const api_1 = require("../api");
@@ -230,7 +230,7 @@ function populateSpec(spec) {
230
230
  for (const r of spec.resources) {
231
231
  try {
232
232
  if (r.propertiesYaml) {
233
- r.properties = yaml.safeLoad(r.propertiesYaml);
233
+ r.properties = yaml.parse(r.propertiesYaml);
234
234
  }
235
235
  }
236
236
  catch (err) {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isLocalExtension = exports.readFile = exports.findExtensionYaml = exports.getLocalExtensionSpec = exports.EXTENSIONS_SPEC_FILE = void 0;
4
4
  const fs = require("fs-extra");
5
5
  const path = require("path");
6
- const yaml = require("js-yaml");
6
+ const yaml = require("yaml");
7
7
  const fsutils_1 = require("../fsutils");
8
8
  const error_1 = require("../error");
9
9
  const logger_1 = require("../logger");
@@ -56,10 +56,10 @@ function isLocalExtension(extensionName) {
56
56
  exports.isLocalExtension = isLocalExtension;
57
57
  function parseYAML(source) {
58
58
  try {
59
- return yaml.safeLoad(source);
59
+ return yaml.parse(source);
60
60
  }
61
61
  catch (err) {
62
- if (err instanceof yaml.YAMLException) {
62
+ if (err instanceof yaml.YAMLParseError) {
63
63
  throw new error_1.FirebaseError(`YAML Error: ${err.message}`, { original: err });
64
64
  }
65
65
  throw new error_1.FirebaseError(err.message);
@@ -4,7 +4,7 @@ exports.ɵcodegenPublicDirectory = exports.build = exports.init = exports.discov
4
4
  const cross_spawn_1 = require("cross-spawn");
5
5
  const fs_extra_1 = require("fs-extra");
6
6
  const path_1 = require("path");
7
- const js_yaml_1 = require("js-yaml");
7
+ const yaml = require("yaml");
8
8
  const promises_1 = require("fs/promises");
9
9
  const error_1 = require("../../error");
10
10
  const utils_1 = require("./utils");
@@ -19,7 +19,7 @@ async function discover(dir) {
19
19
  if (!(await (0, fs_extra_1.pathExists)((0, path_1.join)(dir, "web"))))
20
20
  return;
21
21
  const pubSpecBuffer = await (0, promises_1.readFile)((0, path_1.join)(dir, "pubspec.yaml"));
22
- const pubSpec = (0, js_yaml_1.load)(pubSpecBuffer.toString());
22
+ const pubSpec = yaml.parse(pubSpecBuffer.toString());
23
23
  const usingFlutter = (_a = pubSpec.dependencies) === null || _a === void 0 ? void 0 : _a.flutter;
24
24
  if (!usingFlutter)
25
25
  return;
@@ -123,9 +123,9 @@ async function build(dir, target, context) {
123
123
  headers.push(...headersFromMetaFiles);
124
124
  if (appPathsManifest) {
125
125
  const unrenderedServerComponents = (0, utils_2.getNonStaticServerComponents)(appPathsManifest, appPathRoutesManifest, prerenderedRoutes, dynamicRoutes);
126
- if (unrenderedServerComponents.has("/_not-found") &&
127
- (await (0, utils_2.hasStaticAppNotFoundComponent)(dir, distDir))) {
128
- unrenderedServerComponents.delete("/_not-found");
126
+ const notFoundPageKey = ["/_not-found", "/_not-found/page"].find((key) => unrenderedServerComponents.has(key));
127
+ if (notFoundPageKey && (await (0, utils_2.hasStaticAppNotFoundComponent)(dir, distDir))) {
128
+ unrenderedServerComponents.delete(notFoundPageKey);
129
129
  }
130
130
  for (const key of unrenderedServerComponents) {
131
131
  reasonsForBackend.add(`non-static component ${key}`);
@@ -231,6 +231,7 @@ async function getProductionDistDirFiles(sourceDir, distDir) {
231
231
  cwd: (0, path_1.join)(sourceDir, distDir),
232
232
  nodir: true,
233
233
  absolute: true,
234
+ realpath: utils_2.IS_WINDOWS,
234
235
  }, (err, matches) => {
235
236
  if (err)
236
237
  reject(err);
@@ -4,13 +4,14 @@ exports.runWithVirtualEnv = exports.virtualEnvCmd = exports.DEFAULT_VENV_DIR = v
4
4
  const path = require("path");
5
5
  const spawn = require("cross-spawn");
6
6
  const logger_1 = require("../logger");
7
+ const utils_1 = require("../utils");
7
8
  exports.DEFAULT_VENV_DIR = "venv";
8
9
  function virtualEnvCmd(cwd, venvDir) {
9
- const activateScriptPath = process.platform === "win32" ? ["Scripts", "activate.bat"] : ["bin", "activate"];
10
+ const activateScriptPath = utils_1.IS_WINDOWS ? ["Scripts", "activate.bat"] : ["bin", "activate"];
10
11
  const venvActivate = `"${path.join(cwd, venvDir, ...activateScriptPath)}"`;
11
12
  return {
12
- command: process.platform === "win32" ? venvActivate : ".",
13
- args: [process.platform === "win32" ? "" : venvActivate],
13
+ command: utils_1.IS_WINDOWS ? venvActivate : ".",
14
+ args: [utils_1.IS_WINDOWS ? "" : venvActivate],
14
15
  };
15
16
  }
16
17
  exports.virtualEnvCmd = virtualEnvCmd;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getNextRolloutId = exports.ensureApiEnabled = exports.listLocations = exports.updateTraffic = exports.listRollouts = exports.createRollout = exports.createBuild = exports.listBuilds = exports.getBuild = exports.deleteBackend = exports.listBackends = exports.getBackend = exports.createBackend = exports.client = exports.API_VERSION = void 0;
3
+ exports.getNextRolloutId = exports.ensureApiEnabled = exports.listLocations = exports.updateTraffic = exports.listRollouts = exports.createRollout = exports.createBuild = exports.listBuilds = exports.getBuild = exports.deleteBackend = exports.listBackends = exports.getBackend = exports.createBackend = exports.serviceAgentEmail = exports.client = exports.API_VERSION = void 0;
4
4
  const proto = require("../gcp/proto");
5
5
  const apiv2_1 = require("../apiv2");
6
6
  const projectUtils_1 = require("../projectUtils");
@@ -19,6 +19,11 @@ exports.client = new apiv2_1.Client({
19
19
  (0, metaprogramming_1.assertImplements)();
20
20
  (0, metaprogramming_1.assertImplements)();
21
21
  (0, metaprogramming_1.assertImplements)();
22
+ const P4SA_DOMAIN = (0, api_1.apphostingP4SADomain)();
23
+ function serviceAgentEmail(projectNumber) {
24
+ return `service-${projectNumber}@${P4SA_DOMAIN}`;
25
+ }
26
+ exports.serviceAgentEmail = serviceAgentEmail;
22
27
  async function createBackend(projectId, location, backendReqBoby, backendId) {
23
28
  const res = await exports.client.post(`projects/${projectId}/locations/${location}/backends`, Object.assign(Object.assign({}, backendReqBoby), { labels: Object.assign(Object.assign({}, backendReqBoby.labels), deploymentTool.labels()) }), { queryParams: { backendId } });
24
29
  return res.body;
@@ -84,7 +84,7 @@ async function getGitRepositoryLink(projectId, location, connectionId, gitReposi
84
84
  }
85
85
  exports.getGitRepositoryLink = getGitRepositoryLink;
86
86
  function serviceAgentEmail(projectNumber) {
87
- return `service-${projectNumber}@${(0, api_1.developerConnectP4SAOrigin)()}`;
87
+ return `service-${projectNumber}@${(0, api_1.developerConnectP4SADomain)()}`;
88
88
  }
89
89
  exports.serviceAgentEmail = serviceAgentEmail;
90
90
  async function generateP4SA(projectNumber) {
@@ -3,8 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isRunningInGithubAction = exports.initGitHub = void 0;
4
4
  const colorette_1 = require("colorette");
5
5
  const fs = require("fs");
6
- const yaml = require("js-yaml");
7
- const js_yaml_1 = require("js-yaml");
6
+ const yaml = require("yaml");
8
7
  const ora = require("ora");
9
8
  const path = require("path");
10
9
  const libsodium = require("libsodium-wrappers");
@@ -149,7 +148,7 @@ function loadYMLDeploy() {
149
148
  }
150
149
  }
151
150
  function loadYML(ymlPath) {
152
- return (0, js_yaml_1.safeLoad)(fs.readFileSync(ymlPath, "utf8"));
151
+ return yaml.parse(fs.readFileSync(ymlPath, "utf8"));
153
152
  }
154
153
  function mkdirNotExists(dir) {
155
154
  if (!(0, fsutils_1.dirExistsSync)(dir)) {
@@ -189,7 +188,7 @@ function writeChannelActionYMLFile(ymlPath, secretName, projectId, script) {
189
188
  const ymlContents = `# This file was auto-generated by the Firebase CLI
190
189
  # https://github.com/firebase/firebase-tools
191
190
 
192
- ${yaml.safeDump(workflowConfig)}`;
191
+ ${yaml.stringify(workflowConfig)}`;
193
192
  mkdirNotExists(GITHUB_DIR);
194
193
  mkdirNotExists(WORKFLOW_DIR);
195
194
  fs.writeFileSync(ymlPath, ymlContents, "utf8");
@@ -222,7 +221,7 @@ function writeDeployToProdActionYMLFile(ymlPath, branch, secretName, projectId,
222
221
  const ymlContents = `# This file was auto-generated by the Firebase CLI
223
222
  # https://github.com/firebase/firebase-tools
224
223
 
225
- ${yaml.safeDump(workflowConfig)}`;
224
+ ${yaml.stringify(workflowConfig)}`;
226
225
  mkdirNotExists(GITHUB_DIR);
227
226
  mkdirNotExists(WORKFLOW_DIR);
228
227
  fs.writeFileSync(ymlPath, ymlContents, "utf8");
package/lib/utils.js CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getHostnameFromUrl = exports.openInBrowserPopup = exports.openInBrowser = exports.connectableHostname = exports.randomInt = exports.debounce = exports.last = exports.cloneDeep = exports.groupBy = exports.assertIsStringOrUndefined = exports.assertIsNumber = exports.assertIsString = exports.thirtyDaysFromNow = exports.isRunningInWSL = exports.isVSCodeExtension = exports.isCloudEnvironment = exports.datetimeString = exports.createDestroyer = exports.promiseWithSpinner = exports.setupLoggers = exports.tryParse = exports.tryStringify = exports.promiseProps = exports.withTimeout = exports.promiseWhile = exports.promiseAllSettled = exports.getFunctionsEventProvider = exports.endpoint = exports.makeActiveProject = exports.streamToString = exports.stringToStream = exports.explainStdin = exports.allSettled = exports.reject = exports.logLabeledError = exports.logLabeledWarning = exports.logWarning = exports.logLabeledBullet = exports.logBullet = exports.logLabeledSuccess = exports.logSuccess = exports.addSubdomain = exports.addDatabaseNamespace = exports.getDatabaseViewDataUrl = exports.getDatabaseUrl = exports.envOverride = exports.getInheritedOption = exports.consoleUrl = exports.envOverrides = exports.IS_WINDOWS = void 0;
4
+ exports.readSecretValue = void 0;
4
5
  const fs = require("node:fs");
6
+ const tty = require("tty");
5
7
  const path = require("node:path");
6
8
  const _ = require("lodash");
7
9
  const url = require("url");
@@ -19,6 +21,7 @@ const portfinder_1 = require("portfinder");
19
21
  const configstore_1 = require("./configstore");
20
22
  const error_1 = require("./error");
21
23
  const logger_1 = require("./logger");
24
+ const prompt_1 = require("./prompt");
22
25
  exports.IS_WINDOWS = process.platform === "win32";
23
26
  const SUCCESS_CHAR = exports.IS_WINDOWS ? "+" : "✔";
24
27
  const WARNING_CHAR = exports.IS_WINDOWS ? "!" : "⚠";
@@ -524,3 +527,17 @@ function getHostnameFromUrl(url) {
524
527
  }
525
528
  }
526
529
  exports.getHostnameFromUrl = getHostnameFromUrl;
530
+ function readSecretValue(prompt, dataFile) {
531
+ if ((!dataFile || dataFile === "-") && tty.isatty(0)) {
532
+ return (0, prompt_1.promptOnce)({
533
+ type: "password",
534
+ message: prompt,
535
+ });
536
+ }
537
+ let input = 0;
538
+ if (dataFile && dataFile !== "-") {
539
+ input = dataFile;
540
+ }
541
+ return Promise.resolve(fs.readFileSync(input, "utf-8"));
542
+ }
543
+ exports.readSecretValue = readSecretValue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "firebase-tools",
3
- "version": "13.7.2",
3
+ "version": "13.7.4",
4
4
  "description": "Command-Line Interface for Firebase",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {
@@ -86,7 +86,6 @@
86
86
  "google-auth-library": "^7.11.0",
87
87
  "inquirer": "^8.2.6",
88
88
  "inquirer-autocomplete-prompt": "^2.0.1",
89
- "js-yaml": "^3.13.1",
90
89
  "jsonwebtoken": "^9.0.0",
91
90
  "leven": "^3.1.0",
92
91
  "libsodium-wrappers": "^0.7.10",
@@ -119,6 +118,7 @@
119
118
  "uuid": "^8.3.2",
120
119
  "winston": "^3.0.0",
121
120
  "winston-transport": "^4.4.0",
122
- "ws": "^7.2.3"
121
+ "ws": "^7.2.3",
122
+ "yaml": "^2.4.1"
123
123
  }
124
124
  }
@@ -19,6 +19,7 @@ module.exports = {
19
19
  },
20
20
  ignorePatterns: [
21
21
  "/lib/**/*", // Ignore built files.
22
+ "/generated/**/*", // Ignore generated files.
22
23
  ],
23
24
  plugins: [
24
25
  "@typescript-eslint",