firebase-tools-with-isolate 13.15.0-0 → 13.26.0
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.
- package/lib/api.js +3 -1
- package/lib/apiv2.js +10 -3
- package/lib/appdistribution/client.js +62 -8
- package/lib/appdistribution/distribution.js +1 -1
- package/lib/apphosting/backend.js +299 -0
- package/lib/apphosting/config.js +31 -8
- package/lib/apphosting/githubConnections.js +70 -22
- package/lib/apphosting/index.js +3 -312
- package/lib/apphosting/rollout.js +138 -0
- package/lib/apphosting/secrets/index.js +70 -5
- package/lib/apphosting/utils.js +41 -0
- package/lib/apphosting/yaml.js +82 -0
- package/lib/archiveDirectory.js +1 -1
- package/lib/auth.js +31 -5
- package/lib/bin/firebase.js +2 -2
- package/lib/command.js +18 -4
- package/lib/commands/appdistribution-distribute.js +4 -4
- package/lib/commands/{appdistribution-group-create.js → appdistribution-groups-create.js} +2 -1
- package/lib/commands/{appdistribution-group-delete.js → appdistribution-groups-delete.js} +3 -2
- package/lib/commands/appdistribution-groups-list.js +55 -0
- package/lib/commands/appdistribution-testers-list.js +52 -0
- package/lib/commands/appdistribution-testers-remove.js +1 -1
- package/lib/commands/apphosting-backends-create.js +4 -4
- package/lib/commands/apphosting-backends-delete.js +7 -15
- package/lib/commands/apphosting-backends-get.js +1 -1
- package/lib/commands/apphosting-config-export.js +51 -0
- package/lib/commands/apphosting-repos-create.js +23 -0
- package/lib/commands/apphosting-rollouts-create.js +14 -15
- package/lib/commands/apphosting-secrets-grantaccess.js +2 -2
- package/lib/commands/database-import.js +4 -2
- package/lib/commands/database-push.js +4 -2
- package/lib/commands/database-set.js +4 -2
- package/lib/commands/database-settings-get.js +1 -1
- package/lib/commands/database-settings-set.js +1 -1
- package/lib/commands/dataconnect-sdk-generate.js +4 -1
- package/lib/commands/dataconnect-services-list.js +4 -3
- package/lib/commands/dataconnect-sql-diff.js +1 -1
- package/lib/commands/dataconnect-sql-grant.js +37 -0
- package/lib/commands/dataconnect-sql-migrate.js +1 -1
- package/lib/commands/dataconnect-sql-shell.js +115 -0
- package/lib/commands/deploy.js +5 -1
- package/lib/commands/emulators-start.js +4 -1
- package/lib/commands/ext-dev-init.js +2 -2
- package/lib/commands/ext-dev-list.js +1 -1
- package/lib/commands/ext-dev-register.js +2 -2
- package/lib/commands/ext-dev-upload.js +2 -2
- package/lib/commands/ext-dev-usage.js +2 -2
- package/lib/commands/ext-info.js +3 -1
- package/lib/commands/ext-install.js +2 -2
- package/lib/commands/ext-sdk-install.js +88 -0
- package/lib/commands/ext.js +1 -0
- package/lib/commands/firestore-databases-restore.js +39 -1
- package/lib/commands/functions-secrets-access.js +2 -4
- package/lib/commands/index.js +15 -2
- package/lib/commands/init.js +25 -15
- package/lib/commands/setup-emulators-dataconnect.js +0 -13
- package/lib/commands/use.js +1 -1
- package/lib/config.js +14 -4
- package/lib/crashlytics/buildToolsJarHelper.js +2 -2
- package/lib/dataconnect/client.js +3 -2
- package/lib/dataconnect/dataplaneClient.js +12 -9
- package/lib/dataconnect/ensureApis.js +6 -1
- package/lib/dataconnect/fileUtils.js +29 -12
- package/lib/dataconnect/freeTrial.js +45 -9
- package/lib/dataconnect/load.js +3 -1
- package/lib/dataconnect/provisionCloudSql.js +41 -24
- package/lib/dataconnect/schemaMigration.js +215 -74
- package/lib/dataconnect/types.js +4 -1
- package/lib/dataconnect/webhook.js +32 -0
- package/lib/deploy/dataconnect/deploy.js +18 -15
- package/lib/deploy/dataconnect/prepare.js +41 -0
- package/lib/deploy/dataconnect/release.js +16 -7
- package/lib/deploy/extensions/deploy.js +3 -1
- package/lib/deploy/extensions/deploymentSummary.js +7 -3
- package/lib/deploy/extensions/planner.js +95 -5
- package/lib/deploy/extensions/prepare.js +89 -42
- package/lib/deploy/extensions/release.js +17 -10
- package/lib/deploy/extensions/tasks.js +32 -21
- package/lib/deploy/firestore/prepare.js +9 -0
- package/lib/deploy/firestore/release.js +3 -6
- package/lib/deploy/functions/build.js +5 -5
- package/lib/deploy/functions/checkIam.js +7 -2
- package/lib/deploy/functions/deploy.js +12 -12
- package/lib/deploy/functions/ensure.js +11 -3
- package/lib/deploy/functions/params.js +5 -3
- package/lib/deploy/functions/prepare.js +18 -3
- package/lib/deploy/functions/release/index.js +4 -0
- package/lib/deploy/functions/release/planner.js +2 -1
- package/lib/deploy/functions/runtimes/discovery/index.js +6 -2
- package/lib/deploy/functions/runtimes/discovery/parsing.js +1 -1
- package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +46 -0
- package/lib/deploy/functions/runtimes/node/index.js +5 -0
- package/lib/deploy/functions/services/auth.js +34 -3
- package/lib/deploy/functions/services/index.js +2 -0
- package/lib/deploy/index.js +8 -5
- package/lib/deploy/lifecycleHooks.js +2 -1
- package/lib/emulator/apphosting/config.js +27 -0
- package/lib/emulator/apphosting/index.js +38 -0
- package/lib/emulator/apphosting/serve.js +50 -0
- package/lib/emulator/apphosting/utils.js +18 -0
- package/lib/emulator/auth/handlers.js +27 -0
- package/lib/emulator/auth/operations.js +41 -2
- package/lib/emulator/auth/state.js +2 -1
- package/lib/emulator/commandUtils.js +8 -3
- package/lib/emulator/constants.js +11 -1
- package/lib/emulator/controller.js +59 -6
- package/lib/emulator/dataconnect/pg-gateway/auth/base-auth-flow.js +11 -0
- package/lib/emulator/dataconnect/pg-gateway/auth/cert.js +58 -0
- package/lib/emulator/dataconnect/pg-gateway/auth/index.js +22 -0
- package/lib/emulator/dataconnect/pg-gateway/auth/md5.js +124 -0
- package/lib/emulator/dataconnect/pg-gateway/auth/password.js +54 -0
- package/lib/emulator/dataconnect/pg-gateway/auth/sasl/sasl-mechanism.js +34 -0
- package/lib/emulator/dataconnect/pg-gateway/auth/sasl/scram-sha-256.js +270 -0
- package/lib/emulator/dataconnect/pg-gateway/auth/trust.js +2 -0
- package/lib/emulator/dataconnect/pg-gateway/backend-error.js +75 -0
- package/lib/emulator/dataconnect/pg-gateway/buffer-reader.js +54 -0
- package/lib/emulator/dataconnect/pg-gateway/buffer-writer.js +79 -0
- package/lib/emulator/dataconnect/pg-gateway/connection.js +315 -0
- package/lib/emulator/dataconnect/pg-gateway/connection.types.js +8 -0
- package/lib/emulator/dataconnect/pg-gateway/crypto.js +40 -0
- package/lib/emulator/dataconnect/pg-gateway/duplex.js +53 -0
- package/lib/emulator/dataconnect/pg-gateway/index.js +27 -0
- package/lib/emulator/dataconnect/pg-gateway/message-buffer.js +82 -0
- package/lib/emulator/dataconnect/pg-gateway/message-codes.js +52 -0
- package/lib/emulator/dataconnect/pg-gateway/platforms/node/index.js +16 -0
- package/lib/emulator/dataconnect/pg-gateway/polyfills/readable-stream-async-iterator.js +35 -0
- package/lib/emulator/dataconnect/pg-gateway/utils.js +40 -0
- package/lib/emulator/dataconnect/pgliteServer.js +95 -0
- package/lib/emulator/dataconnectEmulator.js +58 -75
- package/lib/emulator/dataconnectToolkitController.js +44 -0
- package/lib/emulator/downloadableEmulators.js +30 -19
- package/lib/emulator/emulatorLogger.js +3 -0
- package/lib/emulator/env.js +3 -0
- package/lib/emulator/eventarcEmulator.js +1 -1
- package/lib/emulator/extensionsEmulator.js +38 -6
- package/lib/emulator/functionsEmulator.js +115 -42
- package/lib/emulator/functionsEmulatorShared.js +18 -1
- package/lib/emulator/functionsRuntimeWorker.js +2 -1
- package/lib/emulator/hub.js +13 -9
- package/lib/emulator/hubExport.js +10 -3
- package/lib/emulator/loggingEmulator.js +2 -2
- package/lib/emulator/portUtils.js +11 -11
- package/lib/emulator/registry.js +2 -0
- package/lib/emulator/storage/persistence.js +2 -2
- package/lib/emulator/storage/rules/runtime.js +1 -1
- package/lib/emulator/taskQueue.js +348 -0
- package/lib/emulator/tasksEmulator.js +240 -0
- package/lib/emulator/types.js +6 -0
- package/lib/emulator/ui.js +51 -25
- package/lib/error.js +31 -1
- package/lib/experiments.js +5 -0
- package/lib/extensions/askUserForEventsConfig.js +18 -8
- package/lib/extensions/askUserForParam.js +2 -1
- package/lib/extensions/displayExtensionInfo.js +5 -5
- package/lib/extensions/emulator/triggerHelper.js +1 -1
- package/lib/extensions/extensionsApi.js +15 -11
- package/lib/extensions/extensionsHelper.js +39 -8
- package/lib/extensions/localHelper.js +32 -1
- package/lib/extensions/refs.js +26 -11
- package/lib/extensions/runtimes/common.js +215 -0
- package/lib/extensions/runtimes/node.js +401 -0
- package/lib/extensions/types.js +67 -1
- package/lib/extensions/warnings.js +5 -2
- package/lib/firestore/api.js +2 -1
- package/lib/firestore/checkDatabaseType.js +10 -3
- package/lib/firestore/delete.js +11 -0
- package/lib/firestore/options.js +7 -0
- package/lib/frameworks/angular/index.js +15 -3
- package/lib/frameworks/constants.js +2 -2
- package/lib/frameworks/flutter/index.js +6 -6
- package/lib/frameworks/flutter/utils.js +34 -1
- package/lib/frameworks/next/constants.js +1 -1
- package/lib/frameworks/next/index.js +45 -17
- package/lib/frameworks/next/utils.js +57 -4
- package/lib/frameworks/vite/index.js +2 -2
- package/lib/fsutils.js +13 -1
- package/lib/functions/constants.js +4 -0
- package/lib/functions/events/v1.js +9 -2
- package/lib/gcp/apphosting.js +1 -1
- package/lib/gcp/cloudmonitoring.js +3 -3
- package/lib/gcp/cloudsql/cloudsqladmin.js +32 -20
- package/lib/gcp/cloudsql/connect.js +49 -37
- package/lib/gcp/cloudsql/interactive.js +49 -0
- package/lib/gcp/cloudsql/permissions.js +165 -0
- package/lib/gcp/devConnect.js +38 -1
- package/lib/gcp/firestore.js +5 -1
- package/lib/gcp/secretManager.js +12 -5
- package/lib/getProjectNumber.js +1 -1
- package/lib/init/features/apphosting.js +15 -0
- package/lib/init/features/dataconnect/index.js +166 -121
- package/lib/init/features/dataconnect/sdk.js +90 -81
- package/lib/init/features/emulators.js +2 -15
- package/lib/init/features/firestore/index.js +20 -1
- package/lib/init/features/firestore/indexes.js +4 -4
- package/lib/init/features/genkit/index.js +444 -0
- package/lib/init/features/hosting/index.js +2 -2
- package/lib/init/features/index.js +1 -1
- package/lib/init/features/project.js +6 -6
- package/lib/init/features/storage.js +0 -2
- package/lib/init/index.js +1 -0
- package/lib/init/spawn.js +23 -2
- package/lib/logger.js +2 -2
- package/lib/management/projects.js +24 -4
- package/lib/projectUtils.js +1 -1
- package/lib/prompt.js +22 -1
- package/lib/rc.js +1 -8
- package/lib/requireAuth.js +19 -5
- package/lib/requireDatabaseInstance.js +1 -1
- package/lib/requirePermissions.js +1 -1
- package/lib/responseToError.js +5 -2
- package/lib/rulesDeploy.js +1 -1
- package/lib/templates.js +2 -2
- package/lib/utils.js +16 -11
- package/lib/vsCodeUtils.js +8 -0
- package/package.json +8 -7
- package/schema/connector-yaml.json +57 -17
- package/schema/firebase-config.json +36 -0
- package/templates/extensions/javascript/package.lint.json +2 -2
- package/templates/extensions/javascript/package.nolint.json +2 -2
- package/templates/extensions/typescript/package.lint.json +2 -2
- package/templates/extensions/typescript/package.nolint.json +2 -2
- package/templates/genkit/firebase.0.9.0.template +57 -0
- package/templates/init/apphosting/apphosting.yaml +23 -0
- package/templates/init/dataconnect/connector.yaml +4 -3
- package/templates/init/dataconnect/dataconnect-fdccompatiblemode.yaml +12 -0
- package/templates/init/dataconnect/dataconnect.yaml +6 -6
- package/templates/init/dataconnect/mutations.gql +44 -29
- package/templates/init/dataconnect/queries.gql +65 -38
- package/templates/init/dataconnect/schema.gql +38 -21
- package/templates/init/functions/javascript/package.lint.json +2 -2
- package/templates/init/functions/javascript/package.nolint.json +2 -2
- package/templates/init/functions/typescript/package.lint.json +2 -2
- package/templates/init/functions/typescript/package.nolint.json +2 -2
- package/lib/ensureCloudResourceLocation.js +0 -12
- package/lib/init/features/genkit.js +0 -53
package/lib/extensions/types.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ParamType = exports.FUNCTIONS_V2_RESOURCE_TYPE = exports.FUNCTIONS_RESOURCE_TYPE = exports.Visibility = exports.RegistryLaunchStage = void 0;
|
|
3
|
+
exports.isExtensionSpec = exports.isResource = exports.isParam = exports.isObject = exports.ParamType = exports.FUNCTIONS_V2_RESOURCE_TYPE = exports.FUNCTIONS_RESOURCE_TYPE = exports.isExtensionInstance = exports.Visibility = exports.RegistryLaunchStage = void 0;
|
|
4
4
|
var RegistryLaunchStage;
|
|
5
5
|
(function (RegistryLaunchStage) {
|
|
6
6
|
RegistryLaunchStage["EXPERIMENTAL"] = "EXPERIMENTAL";
|
|
@@ -14,6 +14,22 @@ var Visibility;
|
|
|
14
14
|
Visibility["UNLISTED"] = "unlisted";
|
|
15
15
|
Visibility["PUBLIC"] = "public";
|
|
16
16
|
})(Visibility = exports.Visibility || (exports.Visibility = {}));
|
|
17
|
+
const extensionInstanceState = [
|
|
18
|
+
"STATE_UNSPECIFIED",
|
|
19
|
+
"DEPLOYING",
|
|
20
|
+
"UNINSTALLING",
|
|
21
|
+
"ACTIVE",
|
|
22
|
+
"ERRORED",
|
|
23
|
+
"PAUSED",
|
|
24
|
+
];
|
|
25
|
+
const isExtensionInstance = (value) => {
|
|
26
|
+
if (!isObject(value) || typeof value.name !== "string") {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
return true;
|
|
30
|
+
};
|
|
31
|
+
exports.isExtensionInstance = isExtensionInstance;
|
|
32
|
+
const lifecycleStages = ["STAGE_UNSPECIFIED", "ON_INSTALL", "ON_UPDATE", "ON_CONFIGURE"];
|
|
17
33
|
exports.FUNCTIONS_RESOURCE_TYPE = "firebaseextensions.v1beta.function";
|
|
18
34
|
exports.FUNCTIONS_V2_RESOURCE_TYPE = "firebaseextensions.v1beta.v2function";
|
|
19
35
|
var ParamType;
|
|
@@ -21,5 +37,55 @@ var ParamType;
|
|
|
21
37
|
ParamType["STRING"] = "STRING";
|
|
22
38
|
ParamType["SELECT"] = "SELECT";
|
|
23
39
|
ParamType["MULTISELECT"] = "MULTISELECT";
|
|
40
|
+
ParamType["SELECT_RESOURCE"] = "SELECT_RESOURCE";
|
|
24
41
|
ParamType["SECRET"] = "SECRET";
|
|
25
42
|
})(ParamType = exports.ParamType || (exports.ParamType = {}));
|
|
43
|
+
function isObject(value) {
|
|
44
|
+
return typeof value === "object" && value !== null;
|
|
45
|
+
}
|
|
46
|
+
exports.isObject = isObject;
|
|
47
|
+
const isParam = (param) => {
|
|
48
|
+
return (isObject(param) && typeof param["param"] === "string" && typeof param["label"] === "string");
|
|
49
|
+
};
|
|
50
|
+
exports.isParam = isParam;
|
|
51
|
+
const isResource = (res) => {
|
|
52
|
+
return isObject(res) && typeof res["name"] === "string";
|
|
53
|
+
};
|
|
54
|
+
exports.isResource = isResource;
|
|
55
|
+
const isExtensionSpec = (spec) => {
|
|
56
|
+
if (!isObject(spec) || typeof spec.name !== "string" || typeof spec.version !== "string") {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
if (spec.resources && Array.isArray(spec.resources)) {
|
|
60
|
+
for (const res of spec.resources) {
|
|
61
|
+
if (!(0, exports.isResource)(res)) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
if (spec.params && Array.isArray(spec.params)) {
|
|
70
|
+
for (const param of spec.params) {
|
|
71
|
+
if (!(0, exports.isParam)(param)) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
if (spec.systemParams && Array.isArray(spec.systemParams)) {
|
|
80
|
+
for (const param of spec.systemParams) {
|
|
81
|
+
if (!(0, exports.isParam)(param)) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
return !spec.systemParams;
|
|
88
|
+
}
|
|
89
|
+
return true;
|
|
90
|
+
};
|
|
91
|
+
exports.isExtensionSpec = isExtensionSpec;
|
|
@@ -30,9 +30,12 @@ async function displayWarningsForDeploy(instancesToCreate) {
|
|
|
30
30
|
return unpublishedExtensions.length > 0;
|
|
31
31
|
}
|
|
32
32
|
exports.displayWarningsForDeploy = displayWarningsForDeploy;
|
|
33
|
-
function outOfBandChangesWarning(instanceIds) {
|
|
33
|
+
function outOfBandChangesWarning(instanceIds, isDynamic) {
|
|
34
|
+
const extra = isDynamic
|
|
35
|
+
? ""
|
|
36
|
+
: " To avoid this, run `firebase ext:export` to sync these changes to your local extensions manifest.";
|
|
34
37
|
logger_1.logger.warn("The following instances may have been changed in the Firebase console or by another machine since the last deploy from this machine.\n\t" +
|
|
35
38
|
clc.bold(instanceIds.join("\n\t")) +
|
|
36
|
-
|
|
39
|
+
`\nIf you proceed with this deployment, those changes will be overwritten.${extra}`);
|
|
37
40
|
}
|
|
38
41
|
exports.outOfBandChangesWarning = outOfBandChangesWarning;
|
package/lib/firestore/api.js
CHANGED
|
@@ -459,11 +459,12 @@ class FirestoreApi {
|
|
|
459
459
|
}
|
|
460
460
|
return database;
|
|
461
461
|
}
|
|
462
|
-
async restoreDatabase(project, databaseId, backupName) {
|
|
462
|
+
async restoreDatabase(project, databaseId, backupName, encryptionConfig) {
|
|
463
463
|
const url = `/projects/${project}/databases:restore`;
|
|
464
464
|
const payload = {
|
|
465
465
|
databaseId,
|
|
466
466
|
backup: backupName,
|
|
467
|
+
encryptionConfig: encryptionConfig,
|
|
467
468
|
};
|
|
468
469
|
const options = { queryParams: { databaseId: databaseId } };
|
|
469
470
|
const res = await this.apiClient.post(url, payload, options);
|
|
@@ -4,14 +4,21 @@ exports.checkDatabaseType = void 0;
|
|
|
4
4
|
const api_1 = require("../api");
|
|
5
5
|
const apiv2_1 = require("../apiv2");
|
|
6
6
|
const logger_1 = require("../logger");
|
|
7
|
-
|
|
7
|
+
const error_1 = require("../error");
|
|
8
|
+
async function checkDatabaseType(projectId, databaseId = "(default)") {
|
|
8
9
|
try {
|
|
9
10
|
const client = new apiv2_1.Client({ urlPrefix: (0, api_1.firestoreOrigin)(), apiVersion: "v1" });
|
|
10
|
-
const resp = await client.get(`/projects/${projectId}/databases
|
|
11
|
+
const resp = await client.get(`/projects/${projectId}/databases/${databaseId}`);
|
|
11
12
|
return resp.body.type;
|
|
12
13
|
}
|
|
13
14
|
catch (err) {
|
|
14
|
-
logger_1.logger.debug("error getting database type", err);
|
|
15
|
+
logger_1.logger.debug("error getting database type: ", err);
|
|
16
|
+
if (err instanceof error_1.FirebaseError) {
|
|
17
|
+
if (err.status === 404) {
|
|
18
|
+
logger_1.logger.info(`${databaseId} does not exist in project ${projectId}.`);
|
|
19
|
+
return "DATABASE_DOES_NOT_EXIST";
|
|
20
|
+
}
|
|
21
|
+
}
|
|
15
22
|
return undefined;
|
|
16
23
|
}
|
|
17
24
|
}
|
package/lib/firestore/delete.js
CHANGED
|
@@ -237,6 +237,17 @@ class FirestoreDelete {
|
|
|
237
237
|
}
|
|
238
238
|
queue.unshift(...toDelete);
|
|
239
239
|
}
|
|
240
|
+
else if (e.status === 429 &&
|
|
241
|
+
this.deleteBatchSize >= 10 &&
|
|
242
|
+
e.message.includes("database has exceeded their maximum bandwidth")) {
|
|
243
|
+
logger_1.logger.debug("Database has exceeded maximum write bandwidth", e);
|
|
244
|
+
const newBatchSize = Math.floor(toDelete.length / 2);
|
|
245
|
+
if (newBatchSize < this.deleteBatchSize) {
|
|
246
|
+
utils.logLabeledWarning("firestore", `delete rate exceeding maximum bandwidth, reducing batch size from ${this.deleteBatchSize} to ${newBatchSize}`);
|
|
247
|
+
this.setDeleteBatchSize(newBatchSize);
|
|
248
|
+
}
|
|
249
|
+
queue.unshift(...toDelete);
|
|
250
|
+
}
|
|
240
251
|
else if (e.status >= 500 && e.status < 600) {
|
|
241
252
|
logger_1.logger.debug("Server error deleting doc batch", e);
|
|
242
253
|
toDelete.forEach((doc) => {
|
package/lib/firestore/options.js
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EncryptionType = void 0;
|
|
4
|
+
var EncryptionType;
|
|
5
|
+
(function (EncryptionType) {
|
|
6
|
+
EncryptionType["CUSTOMER_MANAGED_ENCRYPTION"] = "CUSTOMER_MANAGED_ENCRYPTION";
|
|
7
|
+
EncryptionType["USE_SOURCE_ENCRYPTION"] = "USE_SOURCE_ENCRYPTION";
|
|
8
|
+
EncryptionType["GOOGLE_DEFAULT_ENCRYPTION"] = "GOOGLE_DEFAULT_ENCRYPTION";
|
|
9
|
+
})(EncryptionType = exports.EncryptionType || (exports.EncryptionType = {}));
|
|
@@ -15,7 +15,7 @@ exports.support = "preview";
|
|
|
15
15
|
exports.type = 3;
|
|
16
16
|
exports.docsUrl = "https://firebase.google.com/docs/hosting/frameworks/angular";
|
|
17
17
|
const DEFAULT_BUILD_SCRIPT = ["ng build"];
|
|
18
|
-
exports.supportedRange = "
|
|
18
|
+
exports.supportedRange = "16 - 18";
|
|
19
19
|
async function discover(dir) {
|
|
20
20
|
if (!(await (0, fs_extra_1.pathExists)((0, path_1.join)(dir, "package.json"))))
|
|
21
21
|
return;
|
|
@@ -180,9 +180,21 @@ exports.handle = function(req,res) {
|
|
|
180
180
|
};\n`;
|
|
181
181
|
}
|
|
182
182
|
else if (serverOutputPath) {
|
|
183
|
-
bootstrapScript = `
|
|
183
|
+
bootstrapScript = `
|
|
184
|
+
const app = new Promise((resolve) => {
|
|
185
|
+
setTimeout(() => {
|
|
186
|
+
const port = process.env.PORT;
|
|
187
|
+
const socket = 'express.sock';
|
|
188
|
+
process.env.PORT = socket;
|
|
189
|
+
|
|
190
|
+
${serverEntry?.endsWith(".mjs")
|
|
184
191
|
? `import(\`./${serverOutputPath}/${serverEntry}\`)`
|
|
185
|
-
: `Promise.resolve(require('./${serverOutputPath}/${serverEntry}'))`}.then(
|
|
192
|
+
: `Promise.resolve(require('./${serverOutputPath}/${serverEntry}'))`}.then(({ app }) => {
|
|
193
|
+
process.env.PORT = port;
|
|
194
|
+
resolve(app());
|
|
195
|
+
});
|
|
196
|
+
}, 0);
|
|
197
|
+
});
|
|
186
198
|
exports.handle = (req,res) => app.then(it => it(req,res));\n`;
|
|
187
199
|
}
|
|
188
200
|
else {
|
|
@@ -18,9 +18,9 @@ exports.MAILING_LIST_URL = "https://goo.gle/41enW5X";
|
|
|
18
18
|
const DEFAULT_FIREBASE_FRAMEWORKS_VERSION = "^0.11.0";
|
|
19
19
|
exports.FIREBASE_FRAMEWORKS_VERSION = (experiments.isEnabled("internaltesting") && process.env.FIREBASE_FRAMEWORKS_VERSION) ||
|
|
20
20
|
DEFAULT_FIREBASE_FRAMEWORKS_VERSION;
|
|
21
|
-
exports.FIREBASE_FUNCTIONS_VERSION = "^
|
|
21
|
+
exports.FIREBASE_FUNCTIONS_VERSION = "^6.0.1";
|
|
22
22
|
exports.FIREBASE_ADMIN_VERSION = "^11.11.1";
|
|
23
|
-
exports.SHARP_VERSION = "^0.32.
|
|
23
|
+
exports.SHARP_VERSION = "^0.32 || ^0.33";
|
|
24
24
|
exports.NODE_VERSION = parseInt(process.versions.node, 10);
|
|
25
25
|
exports.VALID_ENGINES = { node: [16, 18, 20] };
|
|
26
26
|
exports.VALID_LOCALE_FORMATS = [/^ALL_[a-z]+$/, /^[a-z]+_ALL$/, /^[a-z]+(_[a-z]+)?$/];
|
|
@@ -4,8 +4,6 @@ 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 yaml = require("yaml");
|
|
8
|
-
const promises_1 = require("fs/promises");
|
|
9
7
|
const error_1 = require("../../error");
|
|
10
8
|
const utils_1 = require("./utils");
|
|
11
9
|
const constants_1 = require("./constants");
|
|
@@ -17,8 +15,7 @@ async function discover(dir) {
|
|
|
17
15
|
return;
|
|
18
16
|
if (!(await (0, fs_extra_1.pathExists)((0, path_1.join)(dir, "web"))))
|
|
19
17
|
return;
|
|
20
|
-
const
|
|
21
|
-
const pubSpec = yaml.parse(pubSpecBuffer.toString());
|
|
18
|
+
const pubSpec = await (0, utils_1.getPubSpec)(dir);
|
|
22
19
|
const usingFlutter = pubSpec.dependencies?.flutter;
|
|
23
20
|
if (!usingFlutter)
|
|
24
21
|
return;
|
|
@@ -43,9 +40,12 @@ function init(setup, config) {
|
|
|
43
40
|
return Promise.resolve();
|
|
44
41
|
}
|
|
45
42
|
exports.init = init;
|
|
46
|
-
function build(cwd) {
|
|
43
|
+
async function build(cwd) {
|
|
47
44
|
(0, utils_1.assertFlutterCliExists)();
|
|
48
|
-
const
|
|
45
|
+
const pubSpec = await (0, utils_1.getPubSpec)(cwd);
|
|
46
|
+
const otherArgs = (0, utils_1.getAdditionalBuildArgs)(pubSpec);
|
|
47
|
+
const buildArgs = ["build", "web", ...otherArgs].filter(Boolean);
|
|
48
|
+
const build = (0, cross_spawn_1.sync)("flutter", buildArgs, { cwd, stdio: "inherit" });
|
|
49
49
|
if (build.status !== 0)
|
|
50
50
|
throw new error_1.FirebaseError("Unable to build your Flutter app");
|
|
51
51
|
return Promise.resolve({ wantsBackend: false });
|
|
@@ -1,11 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.assertFlutterCliExists = void 0;
|
|
3
|
+
exports.getPubSpec = exports.getAdditionalBuildArgs = exports.assertFlutterCliExists = void 0;
|
|
4
4
|
const cross_spawn_1 = require("cross-spawn");
|
|
5
5
|
const error_1 = require("../../error");
|
|
6
|
+
const promises_1 = require("fs/promises");
|
|
7
|
+
const fs_extra_1 = require("fs-extra");
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
const yaml = require("yaml");
|
|
6
10
|
function assertFlutterCliExists() {
|
|
7
11
|
const process = (0, cross_spawn_1.sync)("flutter", ["--version"], { stdio: "ignore" });
|
|
8
12
|
if (process.status !== 0)
|
|
9
13
|
throw new error_1.FirebaseError("Flutter CLI not found, follow the instructions here https://docs.flutter.dev/get-started/install before trying again.");
|
|
10
14
|
}
|
|
11
15
|
exports.assertFlutterCliExists = assertFlutterCliExists;
|
|
16
|
+
function getAdditionalBuildArgs(pubSpec) {
|
|
17
|
+
const treeShakePackages = [
|
|
18
|
+
"material_icons_named",
|
|
19
|
+
"material_symbols_icons",
|
|
20
|
+
"material_design_icons_flutter",
|
|
21
|
+
"flutter_iconpicker",
|
|
22
|
+
"font_awesome_flutter",
|
|
23
|
+
"ionicons_named",
|
|
24
|
+
];
|
|
25
|
+
const hasTreeShakePackage = treeShakePackages.some((pkg) => pubSpec.dependencies?.[pkg]);
|
|
26
|
+
const treeShakeFlags = hasTreeShakePackage ? ["--no-tree-shake-icons"] : [];
|
|
27
|
+
return [...treeShakeFlags];
|
|
28
|
+
}
|
|
29
|
+
exports.getAdditionalBuildArgs = getAdditionalBuildArgs;
|
|
30
|
+
async function getPubSpec(dir) {
|
|
31
|
+
if (!(await (0, fs_extra_1.pathExists)((0, path_1.join)(dir, "pubspec.yaml"))))
|
|
32
|
+
return {};
|
|
33
|
+
if (!(await (0, fs_extra_1.pathExists)((0, path_1.join)(dir, "web"))))
|
|
34
|
+
return {};
|
|
35
|
+
try {
|
|
36
|
+
const pubSpecBuffer = await (0, promises_1.readFile)((0, path_1.join)(dir, "pubspec.yaml"));
|
|
37
|
+
return yaml.parse(pubSpecBuffer.toString());
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
console.info("Failed to read pubspec.yaml");
|
|
41
|
+
return {};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.getPubSpec = getPubSpec;
|
|
@@ -11,7 +11,7 @@ exports.ROUTES_MANIFEST = "routes-manifest.json";
|
|
|
11
11
|
exports.APP_PATHS_MANIFEST = "app-paths-manifest.json";
|
|
12
12
|
exports.SERVER_REFERENCE_MANIFEST = "server-reference-manifest.json";
|
|
13
13
|
exports.CONFIG_FILES = ["next.config.js", "next.config.mjs"];
|
|
14
|
-
exports.ESBUILD_VERSION = "0.19.2";
|
|
14
|
+
exports.ESBUILD_VERSION = "^0.19.2";
|
|
15
15
|
const WEBPACK_LAYERS_NAMES = {
|
|
16
16
|
shared: "shared",
|
|
17
17
|
reactServerComponents: "rsc",
|
|
@@ -22,14 +22,14 @@ const constants_1 = require("../constants");
|
|
|
22
22
|
const constants_2 = require("./constants");
|
|
23
23
|
const api_1 = require("../../hosting/api");
|
|
24
24
|
const logger_1 = require("../../logger");
|
|
25
|
+
const env_1 = require("../../functions/env");
|
|
25
26
|
const DEFAULT_BUILD_SCRIPT = ["next build"];
|
|
26
27
|
const PUBLIC_DIR = "public";
|
|
27
|
-
exports.supportedRange = "12 -
|
|
28
|
+
exports.supportedRange = "12 - 15.0";
|
|
28
29
|
exports.name = "Next.js";
|
|
29
30
|
exports.support = "preview";
|
|
30
31
|
exports.type = 2;
|
|
31
32
|
exports.docsUrl = "https://firebase.google.com/docs/hosting/frameworks/nextjs";
|
|
32
|
-
const BUNDLE_NEXT_CONFIG_TIMEOUT = 60000;
|
|
33
33
|
const DEFAULT_NUMBER_OF_REASONS_TO_LIST = 5;
|
|
34
34
|
function getReactVersion(cwd) {
|
|
35
35
|
return (0, utils_1.findDependency)("react-dom", { cwd, omitDev: false })?.version;
|
|
@@ -49,7 +49,14 @@ async function build(dir, target, context) {
|
|
|
49
49
|
if (reactVersion && (0, semver_1.gte)(reactVersion, "18.0.0")) {
|
|
50
50
|
process.env.__NEXT_REACT_ROOT = "true";
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
let env = { ...process.env };
|
|
53
|
+
if (context?.projectId) {
|
|
54
|
+
const projectEnvPath = (0, path_1.join)(dir, `.env.${context.projectId}`);
|
|
55
|
+
if (await (0, fs_extra_1.pathExists)(projectEnvPath)) {
|
|
56
|
+
const projectEnvVars = (0, env_1.parseStrict)((await (0, fs_extra_1.readFile)(projectEnvPath)).toString());
|
|
57
|
+
env = { ...projectEnvVars, ...env };
|
|
58
|
+
}
|
|
59
|
+
}
|
|
53
60
|
if (context?.projectId && context?.site) {
|
|
54
61
|
const deploymentDomain = await (0, api_1.getDeploymentDomain)(context.projectId, context.site, context.hostingChannel);
|
|
55
62
|
if (deploymentDomain) {
|
|
@@ -116,8 +123,11 @@ async function build(dir, target, context) {
|
|
|
116
123
|
(0, utils_1.readJSON)((0, path_1.join)(dir, distDir, "server", constants_2.SERVER_REFERENCE_MANIFEST)).catch(() => undefined),
|
|
117
124
|
]);
|
|
118
125
|
if (appPathRoutesManifest) {
|
|
119
|
-
const headersFromMetaFiles = await (0, utils_2.
|
|
126
|
+
const { headers: headersFromMetaFiles, pprRoutes } = await (0, utils_2.getAppMetadataFromMetaFiles)(dir, distDir, baseUrl, appPathRoutesManifest);
|
|
120
127
|
headers.push(...headersFromMetaFiles);
|
|
128
|
+
for (const route of pprRoutes) {
|
|
129
|
+
reasonsForBackend.add(`route with PPR ${route}`);
|
|
130
|
+
}
|
|
121
131
|
if (appPathsManifest) {
|
|
122
132
|
const unrenderedServerComponents = (0, utils_2.getNonStaticServerComponents)(appPathsManifest, appPathRoutesManifest, prerenderedRoutes, dynamicRoutes);
|
|
123
133
|
const notFoundPageKey = ["/_not-found", "/_not-found/page"].find((key) => unrenderedServerComponents.has(key));
|
|
@@ -263,6 +273,7 @@ async function ɵcodegenPublicDirectory(sourceDir, destDir, _, context) {
|
|
|
263
273
|
...prerenderManifest.routes,
|
|
264
274
|
...pagesManifestLikePrerender,
|
|
265
275
|
};
|
|
276
|
+
const { pprRoutes } = await (0, utils_2.getAppMetadataFromMetaFiles)(sourceDir, distDir, basePath, appPathRoutesManifest);
|
|
266
277
|
await Promise.all(Object.entries(routesToCopy).map(async ([path, route]) => {
|
|
267
278
|
if (route.initialRevalidateSeconds) {
|
|
268
279
|
logger_1.logger.debug(`skipping ${path} due to revalidate`);
|
|
@@ -300,6 +311,10 @@ async function ɵcodegenPublicDirectory(sourceDir, destDir, _, context) {
|
|
|
300
311
|
let defaultDestPath = isDefaultLocale && (0, path_1.join)(destDir, basePath, ...destPartsOrIndex);
|
|
301
312
|
if (!(0, fsutils_1.fileExistsSync)(sourcePath) && (0, fsutils_1.fileExistsSync)(`${sourcePath}.html`)) {
|
|
302
313
|
sourcePath += ".html";
|
|
314
|
+
if (pprRoutes.includes(path)) {
|
|
315
|
+
logger_1.logger.debug(`skipping ${path} due to ppr`);
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
303
318
|
if (localizedDestPath)
|
|
304
319
|
localizedDestPath += ".html";
|
|
305
320
|
if (defaultDestPath)
|
|
@@ -337,6 +352,19 @@ async function ɵcodegenFunctionsDirectory(sourceDir, destDir, target, context)
|
|
|
337
352
|
const configFile = await (0, utils_2.whichNextConfigFile)(sourceDir);
|
|
338
353
|
if (configFile) {
|
|
339
354
|
try {
|
|
355
|
+
let esbuildPath = (0, utils_2.findEsbuildPath)();
|
|
356
|
+
if (!esbuildPath || !(0, fs_extra_1.pathExistsSync)(esbuildPath)) {
|
|
357
|
+
console.warn("esbuild not found, installing...");
|
|
358
|
+
(0, utils_2.installEsbuild)(constants_2.ESBUILD_VERSION);
|
|
359
|
+
esbuildPath = (0, utils_2.findEsbuildPath)();
|
|
360
|
+
if (!esbuildPath || !(0, fs_extra_1.pathExistsSync)(esbuildPath)) {
|
|
361
|
+
throw new error_1.FirebaseError("Failed to locate esbuild after installation.");
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
const esbuild = require(esbuildPath);
|
|
365
|
+
if (!esbuild) {
|
|
366
|
+
throw new error_1.FirebaseError(`Failed to load esbuild from path: ${esbuildPath}`);
|
|
367
|
+
}
|
|
340
368
|
const productionDeps = await new Promise((resolve) => {
|
|
341
369
|
const dependencies = [];
|
|
342
370
|
const npmLs = (0, cross_spawn_1.spawn)("npm", ["ls", "--omit=dev", "--all", "--json=true"], {
|
|
@@ -358,21 +386,21 @@ async function ɵcodegenFunctionsDirectory(sourceDir, destDir, target, context)
|
|
|
358
386
|
resolve([...new Set(dependencies)]);
|
|
359
387
|
});
|
|
360
388
|
});
|
|
361
|
-
const esbuildArgs =
|
|
362
|
-
.
|
|
363
|
-
|
|
389
|
+
const esbuildArgs = {
|
|
390
|
+
entryPoints: [(0, path_1.join)(sourceDir, configFile)],
|
|
391
|
+
outfile: (0, path_1.join)(destDir, configFile),
|
|
392
|
+
bundle: true,
|
|
393
|
+
platform: "node",
|
|
394
|
+
target: `node${constants_1.NODE_VERSION}`,
|
|
395
|
+
logLevel: "error",
|
|
396
|
+
external: productionDeps,
|
|
397
|
+
};
|
|
364
398
|
if (configFile === "next.config.mjs") {
|
|
365
|
-
esbuildArgs.
|
|
399
|
+
esbuildArgs.format = "esm";
|
|
366
400
|
}
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
const bundle = (0, cross_spawn_1.sync)("npx", ["--yes", `esbuild@${constants_2.ESBUILD_VERSION}`, configFile, ...esbuildArgs], {
|
|
371
|
-
cwd: sourceDir,
|
|
372
|
-
timeout: BUNDLE_NEXT_CONFIG_TIMEOUT,
|
|
373
|
-
});
|
|
374
|
-
if (bundle.status !== 0) {
|
|
375
|
-
throw new error_1.FirebaseError(bundle.stderr.toString());
|
|
401
|
+
const bundle = await esbuild.build(esbuildArgs);
|
|
402
|
+
if (bundle.errors && bundle.errors.length > 0) {
|
|
403
|
+
throw new error_1.FirebaseError(bundle.errors.toString());
|
|
376
404
|
}
|
|
377
405
|
}
|
|
378
406
|
catch (e) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.whichNextConfigFile = exports.getProductionDistDirFiles = exports.getRoutesWithServerAction = exports.hasStaticAppNotFoundComponent = exports.getNextVersion = exports.getBuildId = exports.
|
|
3
|
+
exports.installEsbuild = exports.getGlobalEsbuildVersion = exports.findEsbuildPath = exports.whichNextConfigFile = exports.getProductionDistDirFiles = exports.getRoutesWithServerAction = exports.hasStaticAppNotFoundComponent = exports.getNextVersion = exports.getBuildId = exports.getAppMetadataFromMetaFiles = exports.getNonStaticServerComponents = exports.getNonStaticRoutes = exports.getMiddlewareMatcherRegexes = exports.allDependencyNames = exports.isUsingAppDirectory = exports.isUsingNextImageInAppDirectory = exports.isUsingImageOptimization = exports.isUsingMiddleware = exports.hasUnoptimizedImage = exports.usesNextImage = exports.usesAppDirRouter = exports.getNextjsRewritesToUse = exports.isHeaderSupportedByHosting = exports.isRedirectSupportedByHosting = exports.isRewriteSupportedByHosting = exports.cleanI18n = exports.cleanCustomRouteI18n = exports.cleanEscapedChars = exports.I18N_SOURCE = void 0;
|
|
4
4
|
const fs_1 = require("fs");
|
|
5
5
|
const fs_extra_1 = require("fs-extra");
|
|
6
6
|
const path_1 = require("path");
|
|
@@ -11,6 +11,8 @@ const utils_1 = require("../utils");
|
|
|
11
11
|
const constants_1 = require("./constants");
|
|
12
12
|
const fsutils_1 = require("../../fsutils");
|
|
13
13
|
const utils_2 = require("../../utils");
|
|
14
|
+
const child_process_1 = require("child_process");
|
|
15
|
+
const error_1 = require("../../error");
|
|
14
16
|
exports.I18N_SOURCE = /\/:nextInternalLocale(\([^\)]+\))?/;
|
|
15
17
|
function cleanEscapedChars(path) {
|
|
16
18
|
return path.replace(/\\([(){}:+?*])/g, (a, b) => b);
|
|
@@ -168,8 +170,9 @@ function getNonStaticServerComponents(appPathsManifest, appPathRoutesManifest, p
|
|
|
168
170
|
return new Set(nonStaticServerComponents);
|
|
169
171
|
}
|
|
170
172
|
exports.getNonStaticServerComponents = getNonStaticServerComponents;
|
|
171
|
-
async function
|
|
173
|
+
async function getAppMetadataFromMetaFiles(sourceDir, distDir, basePath, appPathRoutesManifest) {
|
|
172
174
|
const headers = [];
|
|
175
|
+
const pprRoutes = [];
|
|
173
176
|
await Promise.all(Object.entries(appPathRoutesManifest).map(async ([key, source]) => {
|
|
174
177
|
if (!["route", "page"].includes((0, path_1.basename)(key)))
|
|
175
178
|
return;
|
|
@@ -184,11 +187,13 @@ async function getHeadersFromMetaFiles(sourceDir, distDir, basePath, appPathRout
|
|
|
184
187
|
source: path_1.posix.join(basePath, source),
|
|
185
188
|
headers: Object.entries(meta.headers).map(([key, value]) => ({ key, value })),
|
|
186
189
|
});
|
|
190
|
+
if (meta.postponed)
|
|
191
|
+
pprRoutes.push(source);
|
|
187
192
|
}
|
|
188
193
|
}));
|
|
189
|
-
return headers;
|
|
194
|
+
return { headers, pprRoutes };
|
|
190
195
|
}
|
|
191
|
-
exports.
|
|
196
|
+
exports.getAppMetadataFromMetaFiles = getAppMetadataFromMetaFiles;
|
|
192
197
|
async function getBuildId(distDir) {
|
|
193
198
|
const buildId = await (0, promises_1.readFile)((0, path_1.join)(distDir, "BUILD_ID"));
|
|
194
199
|
return buildId.toString();
|
|
@@ -244,3 +249,51 @@ async function whichNextConfigFile(dir) {
|
|
|
244
249
|
return null;
|
|
245
250
|
}
|
|
246
251
|
exports.whichNextConfigFile = whichNextConfigFile;
|
|
252
|
+
function findEsbuildPath() {
|
|
253
|
+
try {
|
|
254
|
+
const esbuildBinPath = (0, child_process_1.execSync)("npx which esbuild", { encoding: "utf8" })?.trim();
|
|
255
|
+
if (!esbuildBinPath) {
|
|
256
|
+
return null;
|
|
257
|
+
}
|
|
258
|
+
const globalVersion = getGlobalEsbuildVersion(esbuildBinPath);
|
|
259
|
+
if (globalVersion && !(0, semver_1.satisfies)(globalVersion, constants_1.ESBUILD_VERSION)) {
|
|
260
|
+
console.warn(`Warning: Global esbuild version (${globalVersion}) does not match the required version (${constants_1.ESBUILD_VERSION}).`);
|
|
261
|
+
}
|
|
262
|
+
return (0, path_1.resolve)((0, path_1.dirname)(esbuildBinPath), "../esbuild");
|
|
263
|
+
}
|
|
264
|
+
catch (error) {
|
|
265
|
+
console.error(`Failed to find esbuild with npx which: ${error}`);
|
|
266
|
+
return null;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
exports.findEsbuildPath = findEsbuildPath;
|
|
270
|
+
function getGlobalEsbuildVersion(binPath) {
|
|
271
|
+
try {
|
|
272
|
+
const versionOutput = (0, child_process_1.execSync)(`"${binPath}" --version`, { encoding: "utf8" })?.trim();
|
|
273
|
+
if (!versionOutput) {
|
|
274
|
+
return null;
|
|
275
|
+
}
|
|
276
|
+
const versionMatch = versionOutput.match(/(\d+\.\d+\.\d+)/);
|
|
277
|
+
return versionMatch ? versionMatch[0] : null;
|
|
278
|
+
}
|
|
279
|
+
catch (error) {
|
|
280
|
+
console.error(`Failed to get global esbuild version: ${error}`);
|
|
281
|
+
return null;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
exports.getGlobalEsbuildVersion = getGlobalEsbuildVersion;
|
|
285
|
+
function installEsbuild(version) {
|
|
286
|
+
const installCommand = `npm install esbuild@${version} --no-save`;
|
|
287
|
+
try {
|
|
288
|
+
(0, child_process_1.execSync)(installCommand, { stdio: "inherit" });
|
|
289
|
+
}
|
|
290
|
+
catch (error) {
|
|
291
|
+
if (error instanceof error_1.FirebaseError) {
|
|
292
|
+
throw error;
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
throw new error_1.FirebaseError(`Failed to install esbuild: ${error}`, { original: error });
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
exports.installEsbuild = installEsbuild;
|
|
@@ -6,7 +6,7 @@ const cross_spawn_1 = require("cross-spawn");
|
|
|
6
6
|
const fs_1 = require("fs");
|
|
7
7
|
const fs_extra_1 = require("fs-extra");
|
|
8
8
|
const path_1 = require("path");
|
|
9
|
-
const
|
|
9
|
+
const node_util_1 = require("node:util");
|
|
10
10
|
const prompt_1 = require("../../prompt");
|
|
11
11
|
const utils_1 = require("../utils");
|
|
12
12
|
exports.name = "Vite";
|
|
@@ -93,7 +93,7 @@ async function getDevModeHandle(dir) {
|
|
|
93
93
|
const serve = (0, cross_spawn_1.spawn)(cli, [], { cwd: dir });
|
|
94
94
|
serve.stdout.on("data", (data) => {
|
|
95
95
|
process.stdout.write(data);
|
|
96
|
-
const dataWithoutAnsiCodes =
|
|
96
|
+
const dataWithoutAnsiCodes = (0, node_util_1.stripVTControlCharacters)(data.toString());
|
|
97
97
|
const match = dataWithoutAnsiCodes.match(/(http:\/\/.+:\d+)/);
|
|
98
98
|
if (match)
|
|
99
99
|
resolve(match[1]);
|
package/lib/fsutils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.readFile = exports.dirExistsSync = exports.fileExistsSync = void 0;
|
|
3
|
+
exports.listFiles = exports.readFile = exports.dirExistsSync = exports.fileExistsSync = void 0;
|
|
4
4
|
const fs_1 = require("fs");
|
|
5
5
|
const error_1 = require("./error");
|
|
6
6
|
function fileExistsSync(path) {
|
|
@@ -33,3 +33,15 @@ function readFile(path) {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
exports.readFile = readFile;
|
|
36
|
+
function listFiles(path) {
|
|
37
|
+
try {
|
|
38
|
+
return (0, fs_1.readdirSync)(path);
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
if (e.code === "ENOENT") {
|
|
42
|
+
throw new error_1.FirebaseError(`Directory not found: ${path}`);
|
|
43
|
+
}
|
|
44
|
+
throw e;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.listFiles = listFiles;
|
|
@@ -7,8 +7,12 @@ exports.BLOCKING_LABEL = "deployment-blocking";
|
|
|
7
7
|
exports.BLOCKING_LABEL_KEY_TO_EVENT = {
|
|
8
8
|
"before-create": "providers/cloud.auth/eventTypes/user.beforeCreate",
|
|
9
9
|
"before-sign-in": "providers/cloud.auth/eventTypes/user.beforeSignIn",
|
|
10
|
+
"before-send-email": "providers/cloud.auth/eventTypes/user.beforeSendEmail",
|
|
11
|
+
"before-send-sms": "providers/cloud.auth/eventTypes/user.beforeSendSms",
|
|
10
12
|
};
|
|
11
13
|
exports.BLOCKING_EVENT_TO_LABEL_KEY = {
|
|
12
14
|
"providers/cloud.auth/eventTypes/user.beforeCreate": "before-create",
|
|
13
15
|
"providers/cloud.auth/eventTypes/user.beforeSignIn": "before-sign-in",
|
|
16
|
+
"providers/cloud.auth/eventTypes/user.beforeSendEmail": "before-send-email",
|
|
17
|
+
"providers/cloud.auth/eventTypes/user.beforeSendSms": "before-send-sms",
|
|
14
18
|
};
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AUTH_BLOCKING_EVENTS = exports.BEFORE_SIGN_IN_EVENT = exports.BEFORE_CREATE_EVENT = void 0;
|
|
3
|
+
exports.AUTH_BLOCKING_EVENTS = exports.BEFORE_SEND_SMS_EVENT = exports.BEFORE_SEND_EMAIL_EVENT = exports.BEFORE_SIGN_IN_EVENT = exports.BEFORE_CREATE_EVENT = void 0;
|
|
4
4
|
exports.BEFORE_CREATE_EVENT = "providers/cloud.auth/eventTypes/user.beforeCreate";
|
|
5
5
|
exports.BEFORE_SIGN_IN_EVENT = "providers/cloud.auth/eventTypes/user.beforeSignIn";
|
|
6
|
-
exports.
|
|
6
|
+
exports.BEFORE_SEND_EMAIL_EVENT = "providers/cloud.auth/eventTypes/user.beforeSendEmail";
|
|
7
|
+
exports.BEFORE_SEND_SMS_EVENT = "providers/cloud.auth/eventTypes/user.beforeSendSms";
|
|
8
|
+
exports.AUTH_BLOCKING_EVENTS = [
|
|
9
|
+
exports.BEFORE_CREATE_EVENT,
|
|
10
|
+
exports.BEFORE_SIGN_IN_EVENT,
|
|
11
|
+
exports.BEFORE_SEND_EMAIL_EVENT,
|
|
12
|
+
exports.BEFORE_SEND_SMS_EVENT,
|
|
13
|
+
];
|
package/lib/gcp/apphosting.js
CHANGED
|
@@ -9,7 +9,7 @@ const ensureApiEnabled_1 = require("../ensureApiEnabled");
|
|
|
9
9
|
const deploymentTool = require("../deploymentTool");
|
|
10
10
|
const error_1 = require("../error");
|
|
11
11
|
const metaprogramming_1 = require("../metaprogramming");
|
|
12
|
-
exports.API_VERSION = "
|
|
12
|
+
exports.API_VERSION = "v1beta";
|
|
13
13
|
exports.client = new apiv2_1.Client({
|
|
14
14
|
urlPrefix: (0, api_1.apphostingOrigin)(),
|
|
15
15
|
auth: true,
|
|
@@ -57,19 +57,19 @@ var ValueType;
|
|
|
57
57
|
ValueType["DOUBLE"] = "DOUBLE";
|
|
58
58
|
ValueType["STRING"] = "STRING";
|
|
59
59
|
})(ValueType = exports.ValueType || (exports.ValueType = {}));
|
|
60
|
-
async function queryTimeSeries(query,
|
|
60
|
+
async function queryTimeSeries(query, project) {
|
|
61
61
|
const client = new apiv2_1.Client({
|
|
62
62
|
urlPrefix: (0, api_1.cloudMonitoringOrigin)(),
|
|
63
63
|
apiVersion: exports.CLOUD_MONITORING_VERSION,
|
|
64
64
|
});
|
|
65
65
|
try {
|
|
66
|
-
const res = await client.get(`/projects/${
|
|
66
|
+
const res = await client.get(`/projects/${project}/timeSeries/`, {
|
|
67
67
|
queryParams: query,
|
|
68
68
|
});
|
|
69
69
|
return res.body.timeSeries;
|
|
70
70
|
}
|
|
71
71
|
catch (err) {
|
|
72
|
-
throw new error_1.FirebaseError(`Failed to get
|
|
72
|
+
throw new error_1.FirebaseError(`Failed to get Cloud Monitoring metric: ${err}`, {
|
|
73
73
|
status: err.status,
|
|
74
74
|
});
|
|
75
75
|
}
|