firebase-tools 15.19.0 → 15.19.1

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.
@@ -17,11 +17,12 @@ async function installAgentSkills(options) {
17
17
  if (!utils.commandExistsSync("npx")) {
18
18
  return;
19
19
  }
20
+ const skillPackage = options.skillPackage || "firebase/agent-skills";
20
21
  const args = [
21
22
  "-y",
22
23
  "skills",
23
24
  "add",
24
- "firebase/agent-skills",
25
+ skillPackage,
25
26
  "--skill",
26
27
  "*",
27
28
  "-y",
package/lib/api.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.hostingApiOrigin = exports.firebaseStorageOrigin = exports.storageOrigin = exports.runtimeconfigOrigin = exports.rulesOrigin = exports.resourceManagerOrigin = exports.crashlyticsApiOrigin = exports.messagingApiOrigin = exports.remoteConfigApiOrigin = exports.rtdbMetadataOrigin = exports.rtdbManagementOrigin = exports.realtimeOrigin = exports.extensionsTOSOrigin = exports.extensionsPublisherOrigin = exports.extensionsOrigin = exports.iamOrigin = exports.identityOrigin = exports.hostingOrigin = exports.googleOrigin = exports.pubsubOrigin = exports.cloudTasksOrigin = exports.cloudschedulerOrigin = exports.cloudbuildOrigin = exports.functionsDefaultRegion = exports.runOrigin = exports.functionsV2Origin = exports.functionsOrigin = exports.firestoreOrigin = exports.firestoreOriginOrEmulator = exports.firedataOrigin = exports.firebaseExtensionsRegistryOrigin = exports.firebaseApiOrigin = exports.eventarcOrigin = exports.consoleOrigin = exports.authManagementOrigin = exports.authOrigin = exports.apphostingGitHubAppInstallationURL = exports.apphostingP4SADomain = exports.apphostingOrigin = exports.appDistributionOrigin = exports.artifactRegistryDomain = exports.developerConnectP4SADomain = exports.developerConnectOrigin = exports.containerRegistryDomain = exports.cloudMonitoringOrigin = exports.cloudloggingOrigin = exports.cloudbillingOrigin = exports.clientSecret = exports.clientId = exports.authProxyOrigin = void 0;
4
- exports.developerKnowledgeOrigin = exports.cloudTestingOrigin = exports.appTestingOrigin = exports.cloudAiCompanionOrigin = exports.aiLogicProxyOrigin = exports.vertexAIOrigin = exports.cloudSQLAdminOrigin = exports.dataConnectLocalConnString = exports.dataconnectP4SADomain = exports.dataconnectOrigin = exports.githubClientSecret = exports.githubClientId = exports.computeOrigin = exports.secretManagerOrigin = exports.githubApiOrigin = exports.githubOrigin = exports.studioApiOrigin = exports.serviceUsageOrigin = exports.cloudRunApiOrigin = void 0;
4
+ exports.developerKnowledgeOrigin = exports.cloudTestingOrigin = exports.appTestingOrigin = exports.aiLogicProxyOrigin = exports.vertexAIOrigin = exports.cloudSQLAdminOrigin = exports.dataConnectLocalConnString = exports.dataconnectP4SADomain = exports.dataconnectOrigin = exports.githubClientSecret = exports.githubClientId = exports.computeOrigin = exports.secretManagerOrigin = exports.githubApiOrigin = exports.githubOrigin = exports.studioApiOrigin = exports.serviceUsageOrigin = exports.cloudRunApiOrigin = void 0;
5
5
  exports.getScopes = getScopes;
6
6
  exports.setScopes = setScopes;
7
7
  const constants_1 = require("./emulator/constants");
@@ -144,8 +144,6 @@ const vertexAIOrigin = () => utils.envOverride("VERTEX_AI_URL", "https://aiplatf
144
144
  exports.vertexAIOrigin = vertexAIOrigin;
145
145
  const aiLogicProxyOrigin = () => utils.envOverride("AI_LOGIC_PROXY_URL", "https://firebasevertexai.googleapis.com");
146
146
  exports.aiLogicProxyOrigin = aiLogicProxyOrigin;
147
- const cloudAiCompanionOrigin = () => utils.envOverride("CLOUD_AI_COMPANION_URL", "https://cloudaicompanion.googleapis.com");
148
- exports.cloudAiCompanionOrigin = cloudAiCompanionOrigin;
149
147
  const appTestingOrigin = () => utils.envOverride("FIREBASE_APP_TESTING_URL", "https://firebaseapptesting.googleapis.com");
150
148
  exports.appTestingOrigin = appTestingOrigin;
151
149
  const cloudTestingOrigin = () => utils.envOverride("CLOUD_TESTING_URL", "https://testing.googleapis.com");
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.archiveFile = archiveFile;
4
+ const archiver = require("archiver");
5
+ const fs = require("fs");
6
+ const path = require("path");
7
+ const tmp = require("tmp");
8
+ async function archiveFile(filePath, options) {
9
+ const tmpFileObj = tmp.fileSync({ postfix: ".zip" });
10
+ const tmpFile = tmpFileObj.name;
11
+ fs.closeSync(tmpFileObj.fd);
12
+ const fileStream = fs.createWriteStream(tmpFile, {
13
+ flags: "w",
14
+ encoding: "binary",
15
+ });
16
+ const archive = archiver("zip");
17
+ const name = options?.archivedFileName ?? path.basename(filePath);
18
+ archive.file(filePath, { name });
19
+ await pipeAsync(archive, fileStream);
20
+ return tmpFile;
21
+ }
22
+ async function pipeAsync(from, to) {
23
+ return new Promise((resolve, reject) => {
24
+ to.on("finish", resolve);
25
+ to.on("error", reject);
26
+ from.on("error", reject);
27
+ from.pipe(to);
28
+ from.finalize().catch(reject);
29
+ });
30
+ }
package/lib/command.js CHANGED
@@ -185,6 +185,13 @@ class Command {
185
185
  .filter(Boolean)
186
186
  .join(",");
187
187
  }
188
+ const exceptOption = (0, utils_1.getInheritedOption)(options, "except");
189
+ if (exceptOption) {
190
+ options.except = exceptOption
191
+ .split(/[\s,]+/)
192
+ .filter(Boolean)
193
+ .join(",");
194
+ }
188
195
  try {
189
196
  options.config = config_1.Config.load(options);
190
197
  }
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.command = void 0;
4
+ const path = require("path");
5
+ const fs_extra_1 = require("fs-extra");
6
+ const fsAsync_1 = require("../fsAsync");
7
+ const command_1 = require("../command");
8
+ const error_1 = require("../error");
9
+ const utils_1 = require("../utils");
10
+ const projectUtils_1 = require("../projectUtils");
11
+ const getProjectNumber_1 = require("../getProjectNumber");
12
+ const requireAuth_1 = require("../requireAuth");
13
+ const sourcemap_1 = require("../crashlytics/sourcemap");
14
+ exports.command = new command_1.Command("crashlytics:sourcemap:upload [mappingFiles]")
15
+ .description("upload javascript source maps to de-minify stack traces")
16
+ .option("--app <appID>", "the app id of your Firebase app")
17
+ .option("--bucket-location <bucketLocation>", 'the location of the Google Cloud Storage bucket (default: "US-CENTRAL1"')
18
+ .option("--app-version <appVersion>", "the version of your Firebase app (defaults to Git commit hash, if available)")
19
+ .before(requireAuth_1.requireAuth)
20
+ .action(async (mappingFiles, options) => {
21
+ (0, sourcemap_1.checkGoogleAppID)(options);
22
+ const appVersion = (0, sourcemap_1.getAppVersion)(options);
23
+ const projectId = (0, projectUtils_1.needProjectId)(options);
24
+ const projectNumber = await (0, getProjectNumber_1.getProjectNumber)(options);
25
+ const bucketName = await (0, sourcemap_1.upsertBucket)(projectId, projectNumber, options);
26
+ const rootDir = path.resolve(options.projectRoot ?? process.cwd());
27
+ const filePath = mappingFiles ? path.resolve(mappingFiles) : rootDir;
28
+ let fstat;
29
+ try {
30
+ fstat = (0, fs_extra_1.statSync)(filePath);
31
+ }
32
+ catch (e) {
33
+ throw new error_1.FirebaseError("provide a valid directory to mapping file(s), e.g. app/build/outputs");
34
+ }
35
+ let successCount = 0;
36
+ const failedFiles = [];
37
+ if (fstat.isDirectory()) {
38
+ (0, utils_1.logLabeledBullet)("crashlytics", "Looking for mapping files in your directory...");
39
+ const files = await (0, fsAsync_1.readdirRecursive)({
40
+ path: filePath,
41
+ ignoreStrings: ["node_modules", ".git"],
42
+ maxDepth: 20,
43
+ });
44
+ const mappings = await (0, sourcemap_1.findSourceMapMappings)(files, rootDir);
45
+ const result = await (0, sourcemap_1.uploadSourceMaps)(mappings, {
46
+ projectId,
47
+ bucketName,
48
+ appVersion,
49
+ options,
50
+ });
51
+ successCount = result.successCount;
52
+ failedFiles.push(...result.failedFiles);
53
+ }
54
+ else {
55
+ throw new error_1.FirebaseError("provide a valid directory to mapping file(s), e.g. app/build/outputs");
56
+ }
57
+ (0, utils_1.logLabeledBullet)("crashlytics", `Uploaded ${successCount} (${failedFiles.length} failed) mapping files to ${bucketName}`);
58
+ if (failedFiles.length > 0) {
59
+ (0, utils_1.logLabeledBullet)("crashlytics", `Could not upload the following files:\n${failedFiles.join("\n")}`);
60
+ }
61
+ });
@@ -57,6 +57,10 @@ function load(client) {
57
57
  client.crashlytics.mappingfile = {};
58
58
  client.crashlytics.mappingfile.generateid = loadCommand("crashlytics-mappingfile-generateid");
59
59
  client.crashlytics.mappingfile.upload = loadCommand("crashlytics-mappingfile-upload");
60
+ if (experiments.isEnabled("crashlyticsWeb")) {
61
+ client.crashlytics.sourcemap = {};
62
+ client.crashlytics.sourcemap.upload = loadCommand("crashlytics-sourcemap-upload");
63
+ }
60
64
  client.database = {};
61
65
  client.database.get = loadCommand("database-get");
62
66
  client.database.import = loadCommand("database-import");
@@ -0,0 +1,270 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CONCURRENCY = void 0;
4
+ exports.checkGoogleAppID = checkGoogleAppID;
5
+ exports.getAppVersion = getAppVersion;
6
+ exports.getGitCommit = getGitCommit;
7
+ exports.getPackageVersion = getPackageVersion;
8
+ exports.upsertBucket = upsertBucket;
9
+ exports.findSourceMapMappings = findSourceMapMappings;
10
+ exports.getLinkedSourceMapPath = getLinkedSourceMapPath;
11
+ exports.uploadSourceMaps = uploadSourceMaps;
12
+ exports.uploadMap = uploadMap;
13
+ exports.normalizeFileName = normalizeFileName;
14
+ exports.registerSourceMap = registerSourceMap;
15
+ const fs = require("fs");
16
+ const path = require("path");
17
+ const node_child_process_1 = require("node:child_process");
18
+ const pLimit = require("p-limit");
19
+ const apiv2_1 = require("../apiv2");
20
+ const error_1 = require("../error");
21
+ const logger_1 = require("../logger");
22
+ const utils_1 = require("../utils");
23
+ const gcs = require("../gcp/storage");
24
+ const archiveFile_1 = require("../archiveFile");
25
+ exports.CONCURRENCY = 25;
26
+ function checkGoogleAppID(options) {
27
+ if (!options.app) {
28
+ throw new error_1.FirebaseError("set --app <appId> to a valid Firebase application id, e.g. 1:00000000:android:0000000");
29
+ }
30
+ }
31
+ function getAppVersion(options) {
32
+ if (options.appVersion) {
33
+ return options.appVersion;
34
+ }
35
+ const gitCommit = getGitCommit();
36
+ if (gitCommit) {
37
+ (0, utils_1.logLabeledBullet)("crashlytics", `Using git commit as app version: ${gitCommit}`);
38
+ return gitCommit;
39
+ }
40
+ const packageVersion = getPackageVersion();
41
+ if (packageVersion) {
42
+ (0, utils_1.logLabeledBullet)("crashlytics", `Using package version as app version: ${packageVersion}`);
43
+ return packageVersion;
44
+ }
45
+ return "unset";
46
+ }
47
+ function getGitCommit() {
48
+ if (!(0, utils_1.commandExistsSync)("git")) {
49
+ return undefined;
50
+ }
51
+ try {
52
+ return (0, node_child_process_1.execSync)("git rev-parse HEAD").toString().trim();
53
+ }
54
+ catch (error) {
55
+ return undefined;
56
+ }
57
+ }
58
+ function getPackageVersion() {
59
+ if (!(0, utils_1.commandExistsSync)("npm")) {
60
+ return undefined;
61
+ }
62
+ try {
63
+ return (0, node_child_process_1.execSync)("npm pkg get version").toString().trim().replaceAll('"', "");
64
+ }
65
+ catch (error) {
66
+ return undefined;
67
+ }
68
+ }
69
+ async function upsertBucket(projectId, projectNumber, options) {
70
+ let loc = "US-CENTRAL1";
71
+ if (options.bucketLocation) {
72
+ loc = options.bucketLocation.toUpperCase();
73
+ }
74
+ else {
75
+ (0, utils_1.logLabeledBullet)("crashlytics", "No Google Cloud Storage bucket location specified. Defaulting to US-CENTRAL1.");
76
+ }
77
+ const baseName = `firebasecrashlytics-sourcemaps-${projectNumber}-${loc.toLowerCase()}`;
78
+ return await gcs.upsertBucket({
79
+ product: "crashlytics",
80
+ createMessage: `Creating Cloud Storage bucket in ${loc} to store Crashlytics source maps at ${baseName}...`,
81
+ projectId,
82
+ req: {
83
+ baseName,
84
+ purposeLabel: `crashlytics-sourcemaps-${loc.toLowerCase()}`,
85
+ location: loc,
86
+ lifecycle: {
87
+ rule: [
88
+ {
89
+ action: {
90
+ type: "Delete",
91
+ },
92
+ condition: {
93
+ age: 30,
94
+ },
95
+ },
96
+ ],
97
+ },
98
+ },
99
+ });
100
+ }
101
+ async function findSourceMapMappings(files, rootDir) {
102
+ const jsFiles = files.filter((f) => f.name.endsWith(".js"));
103
+ const mapFiles = files.filter((f) => f.name.endsWith(".js.map"));
104
+ const mappings = [];
105
+ const mapFilePathsSet = new Set(mapFiles.map((f) => f.name));
106
+ const mapFilesLinkedInJsComment = new Set();
107
+ const limit = pLimit(exports.CONCURRENCY);
108
+ const results = await Promise.all(jsFiles.map((jsFile) => limit(async () => {
109
+ const mapFilePath = await getLinkedSourceMapPath(jsFile.name);
110
+ return { jsFile, mapFilePath };
111
+ })));
112
+ for (const { jsFile, mapFilePath } of results) {
113
+ if (mapFilePath && mapFilePathsSet.has(mapFilePath)) {
114
+ mappings.push({
115
+ mapFilePath,
116
+ obfuscatedFilePath: path.relative(rootDir, path.resolve(jsFile.name)),
117
+ });
118
+ mapFilesLinkedInJsComment.add(mapFilePath);
119
+ }
120
+ }
121
+ for (const mapFile of mapFiles) {
122
+ if (!mapFilesLinkedInJsComment.has(mapFile.name)) {
123
+ mappings.push({
124
+ mapFilePath: mapFile.name,
125
+ obfuscatedFilePath: path.relative(rootDir, path.resolve(mapFile.name)),
126
+ });
127
+ }
128
+ }
129
+ return mappings;
130
+ }
131
+ async function getLinkedSourceMapPath(jsFilePath) {
132
+ let fileHandle;
133
+ try {
134
+ const stat = await fs.promises.stat(jsFilePath);
135
+ const size = stat.size;
136
+ const bufferSize = Math.min(size, 4096);
137
+ if (bufferSize === 0) {
138
+ return undefined;
139
+ }
140
+ fileHandle = await fs.promises.open(jsFilePath, "r");
141
+ const buffer = Buffer.alloc(bufferSize);
142
+ const { bytesRead } = await fileHandle.read(buffer, 0, bufferSize, size - bufferSize);
143
+ const tail = buffer.toString("utf-8", 0, bytesRead);
144
+ const regex = /^\/\/\s*[#@]\s*sourceMappingURL=(?<sourceMappingURL>.+)\s*$/m;
145
+ const match = regex.exec(tail);
146
+ const sourceMappingURL = match?.groups?.sourceMappingURL?.trim();
147
+ if (sourceMappingURL) {
148
+ return path.join(path.dirname(jsFilePath), sourceMappingURL);
149
+ }
150
+ }
151
+ catch (e) {
152
+ logger_1.logger.debug(`Error reading sourceMappingURL from ${jsFilePath}: ${e instanceof Error ? e.message : String(e)}`);
153
+ }
154
+ finally {
155
+ if (fileHandle) {
156
+ try {
157
+ await fileHandle.close();
158
+ }
159
+ catch (e) {
160
+ }
161
+ }
162
+ }
163
+ return undefined;
164
+ }
165
+ async function uploadSourceMaps(mappings, request) {
166
+ const { projectId, bucketName, appVersion, options } = request;
167
+ const limit = pLimit(exports.CONCURRENCY);
168
+ const results = await Promise.all(mappings.map((mapping) => limit(async () => {
169
+ const uploadRequest = {
170
+ projectId,
171
+ mappingFile: mapping.mapFilePath,
172
+ obfuscatedFilePath: mapping.obfuscatedFilePath,
173
+ bucketName,
174
+ appVersion,
175
+ options,
176
+ };
177
+ let success = await uploadMap(uploadRequest, 1);
178
+ if (!success) {
179
+ await new Promise((res) => setTimeout(res, options.retryDelay || 5000));
180
+ success = await uploadMap(uploadRequest);
181
+ }
182
+ return success;
183
+ })));
184
+ let successCount = 0;
185
+ const failedFiles = [];
186
+ for (const [i, success] of results.entries()) {
187
+ if (success) {
188
+ successCount++;
189
+ }
190
+ else {
191
+ failedFiles.push(mappings[i].mapFilePath);
192
+ }
193
+ }
194
+ return {
195
+ successCount,
196
+ failedFiles,
197
+ };
198
+ }
199
+ async function uploadMap(request, attemptsRemaining = 0) {
200
+ const { projectId, mappingFile, obfuscatedFilePath, bucketName, appVersion, options } = request;
201
+ const filePath = path.relative(options.projectRoot ?? process.cwd(), mappingFile);
202
+ const obfuscatedPath = obfuscatedFilePath
203
+ .split(path.sep)
204
+ .map((p) => (p === ".next" ? "_next" : p))
205
+ .filter((p) => p !== "dev")
206
+ .join("/");
207
+ const tmpArchive = await (0, archiveFile_1.archiveFile)(filePath, { archivedFileName: "mapping.js.map" });
208
+ const appId = options.app || "";
209
+ const gcsFile = `${appId}-${appVersion}-${normalizeFileName(obfuscatedPath)}.zip`;
210
+ const uid = (0, utils_1.murmurHashV3)(`${appId}-${appVersion}-${obfuscatedPath}`);
211
+ const name = `projects/${projectId}/locations/global/mappingFiles/${uid}`;
212
+ const stream = fs.createReadStream(tmpArchive);
213
+ stream.on("error", (err) => {
214
+ logger_1.logger.debug(`Stream error on tmpArchive: ${err instanceof Error ? err.message : String(err)}`);
215
+ });
216
+ try {
217
+ const { bucket, object } = await gcs.uploadObject({
218
+ file: gcsFile,
219
+ stream,
220
+ }, bucketName);
221
+ const fileUri = `gs://${bucket}/${object}`;
222
+ logger_1.logger.debug(`Uploaded mapping file ${filePath} to ${fileUri}`);
223
+ await registerSourceMap({
224
+ name,
225
+ appId,
226
+ version: appVersion,
227
+ obfuscatedFilePath: `/${obfuscatedPath}`,
228
+ fileUri,
229
+ });
230
+ logger_1.logger.debug(`Registered mapping file ${filePath}`);
231
+ return true;
232
+ }
233
+ catch (e) {
234
+ if (attemptsRemaining === 0) {
235
+ (0, utils_1.logLabeledWarning)("crashlytics", `Failed to upload mapping file ${filePath}:\n${e instanceof Error ? e.message : String(e)}`);
236
+ }
237
+ return false;
238
+ }
239
+ finally {
240
+ stream.destroy();
241
+ try {
242
+ fs.rmSync(tmpArchive, { force: true });
243
+ }
244
+ catch (err) {
245
+ logger_1.logger.debug(`Failed to delete temporary archive ${tmpArchive}: ${err instanceof Error ? err.message : String(err)}`);
246
+ }
247
+ }
248
+ }
249
+ function normalizeFileName(fileName) {
250
+ return fileName.replaceAll(/\//g, "-");
251
+ }
252
+ async function registerSourceMap(sourceMap) {
253
+ const client = new apiv2_1.Client({
254
+ urlPrefix: "https://firebasetelemetryadmin.googleapis.com",
255
+ auth: true,
256
+ apiVersion: "v1",
257
+ });
258
+ try {
259
+ await client.patch(sourceMap.name, sourceMap, { queryParams: { allowMissing: "true" } });
260
+ logger_1.logger.debug(`Registered source map ${sourceMap.obfuscatedFilePath} with Firebase Telemetry service`);
261
+ }
262
+ catch (e) {
263
+ if (e instanceof error_1.FirebaseError) {
264
+ if (e.status === 409) {
265
+ return;
266
+ }
267
+ }
268
+ throw new error_1.FirebaseError(`Failed to register source map ${sourceMap.obfuscatedFilePath} with Firebase Telemetry service:\n${e instanceof Error ? e.message : String(e)}`);
269
+ }
270
+ }
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ensureApis = ensureApis;
4
- exports.ensureGIFApiTos = ensureGIFApiTos;
5
4
  const api = require("../api");
6
- const configstore_1 = require("../configstore");
7
5
  const ensureApiEnabled_1 = require("../ensureApiEnabled");
8
6
  const prefix = "dataconnect";
9
7
  async function ensureApis(projectId, silent = false) {
@@ -12,14 +10,3 @@ async function ensureApis(projectId, silent = false) {
12
10
  (0, ensureApiEnabled_1.ensure)(projectId, api.cloudSQLAdminOrigin(), prefix, silent),
13
11
  ]);
14
12
  }
15
- async function ensureGIFApiTos(projectId) {
16
- if (configstore_1.configstore.get("gemini")) {
17
- await (0, ensureApiEnabled_1.ensure)(projectId, api.cloudAiCompanionOrigin(), "");
18
- }
19
- else {
20
- if (!(await (0, ensureApiEnabled_1.check)(projectId, api.cloudAiCompanionOrigin(), ""))) {
21
- return false;
22
- }
23
- }
24
- return true;
25
- }
@@ -4,7 +4,9 @@ exports.default = default_1;
4
4
  exports.injectEnvVarsFromApphostingConfig = injectEnvVarsFromApphostingConfig;
5
5
  exports.injectAutoInitEnvVars = injectAutoInitEnvVars;
6
6
  exports.getBackendConfigs = getBackendConfigs;
7
+ const crypto = require("crypto");
7
8
  const fs = require("fs");
9
+ const os = require("os");
8
10
  const path = require("path");
9
11
  const fsAsync = require("../../fsAsync");
10
12
  const util_1 = require("./util");
@@ -19,7 +21,6 @@ const getProjectNumber_1 = require("../../getProjectNumber");
19
21
  const prompt_1 = require("../../prompt");
20
22
  const utils_1 = require("../../utils");
21
23
  const localbuilds_1 = require("../../apphosting/localbuilds");
22
- const constants_1 = require("../../apphosting/constants");
23
24
  const error_1 = require("../../error");
24
25
  const managementApps = require("../../management/apps");
25
26
  const utils_2 = require("../../apphosting/utils");
@@ -136,8 +137,9 @@ async function default_1(context, options) {
136
137
  (0, utils_1.logLabeledBullet)("apphosting", `Starting local build for backend ${cfg.backendId}`);
137
138
  await injectEnvVarsFromApphostingConfig(configs.filter((c) => c.backendId === cfg.backendId), options, buildEnv, runtimeEnv);
138
139
  await injectAutoInitEnvVars(cfg, backends, buildEnv, runtimeEnv);
139
- const rootDir = options.projectRoot || process.cwd();
140
- const localBuildScratchDir = path.join(rootDir, `${constants_1.LOCAL_BUILD_DIR_NAME}_${cfg.backendId}`);
140
+ const rootDir = path.resolve(options.projectRoot || process.cwd());
141
+ const pathHash = crypto.createHash("md5").update(rootDir).digest("hex").substring(0, 8);
142
+ const localBuildScratchDir = path.join(os.tmpdir(), `apphosting-local-build-${cfg.backendId}-${pathHash}`);
141
143
  try {
142
144
  await prepareLocalBuildScratchDirectory(rootDir, localBuildScratchDir, cfg);
143
145
  const { outputFiles, buildConfig } = await (0, localbuilds_1.localBuild)(projectId, localBuildScratchDir, buildEnv[cfg.backendId] || {}, {
@@ -250,9 +252,7 @@ async function ensureAppHostingServiceAgentRoles(projectId, projectNumber) {
250
252
  }
251
253
  async function prepareLocalBuildScratchDirectory(rootDir, localBuildScratchDir, cfg) {
252
254
  const ignore = (0, util_1.resolveIgnorePatterns)(cfg);
253
- if (fs.existsSync(localBuildScratchDir)) {
254
- throw new error_1.FirebaseError(`The local build scratch directory '${localBuildScratchDir}' already exists. Please delete it and try again.`);
255
- }
255
+ fs.rmSync(localBuildScratchDir, { recursive: true, force: true });
256
256
  fs.mkdirSync(localBuildScratchDir, { recursive: true });
257
257
  const filesToCopy = await fsAsync.readdirRecursive({
258
258
  path: rootDir,
@@ -54,36 +54,36 @@
54
54
  },
55
55
  "dataconnect": {
56
56
  "darwin": {
57
- "version": "3.4.9",
58
- "expectedSize": 32423488,
59
- "expectedChecksum": "75788cfdb69c2762ac9f78e37714d364",
60
- "expectedChecksumSHA256": "af26c22a6fe131b111b4e71eb4c179b2b42a9cf8d334d50e4c2c419bbbb54416",
61
- "remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-macos-amd64-v3.4.9",
62
- "downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.9"
57
+ "version": "3.4.10",
58
+ "expectedSize": 32439760,
59
+ "expectedChecksum": "c3609b01993c1f66d340eda59fa31467",
60
+ "expectedChecksumSHA256": "257419922a81b4856b1ce7c1ac0684b4690a380072fe132d1960070f7d00941a",
61
+ "remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-macos-amd64-v3.4.10",
62
+ "downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.10"
63
63
  },
64
64
  "darwin_arm64": {
65
- "version": "3.4.9",
66
- "expectedSize": 30554802,
67
- "expectedChecksum": "7e64aba6ffc071ef60b8f2a51b3f5683",
68
- "expectedChecksumSHA256": "49ba258954b3568e93ef75b4c7e9a50c708a7e15ba9a22697ff967e195a907aa",
69
- "remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-macos-arm64-v3.4.9",
70
- "downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.9"
65
+ "version": "3.4.10",
66
+ "expectedSize": 30571186,
67
+ "expectedChecksum": "fd17de6fb356a5e0c1c67ae7f4adfa08",
68
+ "expectedChecksumSHA256": "9c6da9eea98ee85b16b6e0c5075d1c757aaa252526470fbe63cfb915e3585361",
69
+ "remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-macos-arm64-v3.4.10",
70
+ "downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.10"
71
71
  },
72
72
  "win32": {
73
- "version": "3.4.9",
74
- "expectedSize": 32464896,
75
- "expectedChecksum": "1bc40de5be6bab9280904ee68f849594",
76
- "expectedChecksumSHA256": "b0b277ed1efd374099b90a74ebb2994ffa5755c185d8d9d2cf667f49c0c31139",
77
- "remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-windows-amd64-v3.4.9",
78
- "downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.9.exe"
73
+ "version": "3.4.10",
74
+ "expectedSize": 32479744,
75
+ "expectedChecksum": "3ed78e5d74da96e89f385a64fa6151fc",
76
+ "expectedChecksumSHA256": "bc4bb887b5adbba5b916fa41a091f544aac70f35d5209c483fac90f89abb2c93",
77
+ "remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-windows-amd64-v3.4.10",
78
+ "downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.10.exe"
79
79
  },
80
80
  "linux": {
81
- "version": "3.4.9",
82
- "expectedSize": 31580344,
83
- "expectedChecksum": "4de2d7d37652d652d059335a43dc02b4",
84
- "expectedChecksumSHA256": "803ec59b5ec1590ed4521df70864a46808f3ec8008756206bf210852e2298291",
85
- "remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-linux-amd64-v3.4.9",
86
- "downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.9"
81
+ "version": "3.4.10",
82
+ "expectedSize": 31592632,
83
+ "expectedChecksum": "a003103017717ddc4ea9967d5820ea51",
84
+ "expectedChecksumSHA256": "50b22fdaf7bf1c30b5f331ef07a7f19c51309ca9c9897be426e86254e02b514c",
85
+ "remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-linux-amd64-v3.4.10",
86
+ "downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.10"
87
87
  }
88
88
  }
89
89
  }
@@ -127,9 +127,9 @@ exports.ALL_EXPERIMENTS = experiments({
127
127
  public: false,
128
128
  },
129
129
  abiu: {
130
- shortDescription: "Enable App Hosting ABIU and runtime selection",
131
- default: false,
132
- public: false,
130
+ shortDescription: "Enable Automatic Base Image Updates (ABIU) and runtime selection for App Hosting",
131
+ default: true,
132
+ public: true,
133
133
  },
134
134
  dataconnect: {
135
135
  shortDescription: "Deprecated. Previosuly, enabled SQL Connect related features.",
@@ -182,6 +182,11 @@ exports.ALL_EXPERIMENTS = experiments({
182
182
  default: true,
183
183
  public: false,
184
184
  },
185
+ crashlyticsWeb: {
186
+ shortDescription: "Enable the ability to upload source maps for web apps to Crashlytics.",
187
+ default: false,
188
+ public: true,
189
+ },
185
190
  });
186
191
  function isValidExperiment(name) {
187
192
  return Object.keys(exports.ALL_EXPERIMENTS).includes(name);
@@ -242,6 +242,14 @@ async function injectAntigravityContext(rootPath, projectId, appName, nonInterac
242
242
  global: installLocation === "global",
243
243
  background: false,
244
244
  agentName: "gemini-cli",
245
+ skillPackage: "firebase/agent-skills",
246
+ });
247
+ await (0, agentSkills_1.installAgentSkills)({
248
+ cwd: rootPath,
249
+ global: installLocation === "global",
250
+ background: false,
251
+ agentName: "gemini-cli",
252
+ skillPackage: "genkit-ai/skills",
245
253
  });
246
254
  const systemInstructionsTemplate = await (0, templates_1.readTemplate)("firebase-studio-export/system_instructions_template.md");
247
255
  const systemInstructions = systemInstructionsTemplate.replace("${appName}", appName);