firebase-tools 15.35.0 → 15.36.1-main.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/accountExporter.js +1 -1
- package/lib/accountImporter.js +7 -6
- package/lib/apiv2.js +0 -1
- package/lib/appcheck/debugTokens.js +293 -0
- package/lib/appcheck/localConfig.js +191 -0
- package/lib/appdistribution/options-parser-util.js +1 -1
- package/lib/apphosting/githubConnections.js +1 -1
- package/lib/apptesting/parseTestFiles.js +1 -1
- package/lib/auth.js +9 -3
- package/lib/bin/progressiveHelp.js +1 -1
- package/lib/command.js +1 -2
- package/lib/commands/appcheck-debugtokens-create.js +60 -35
- package/lib/commands/appcheck-debugtokens-delete.js +21 -7
- package/lib/commands/appcheck-debugtokens-list.js +37 -8
- package/lib/commands/appcheck-debugtokens-prune.js +59 -0
- package/lib/commands/crashlytics-events-get.js +48 -0
- package/lib/commands/crashlytics-events-list.js +70 -0
- package/lib/commands/crashlytics-heapdumps-enable.js +3 -4
- package/lib/commands/crashlytics-heapdumps-status.js +5 -3
- package/lib/commands/crashlytics-issues-get.js +61 -0
- package/lib/commands/crashlytics-reports-get.js +179 -0
- package/lib/commands/crashlytics-reports-list.js +42 -0
- package/lib/commands/deploy.js +1 -3
- package/lib/commands/ext-dev-init.js +1 -1
- package/lib/commands/hosting-channel-create.js +1 -3
- package/lib/commands/hosting-channel-delete.js +1 -3
- package/lib/commands/hosting-channel-deploy.js +1 -3
- package/lib/commands/hosting-channel-list.js +1 -3
- package/lib/commands/hosting-channel-open.js +5 -4
- package/lib/commands/hosting-clone.js +3 -5
- package/lib/commands/hosting-disable.js +2 -2
- package/lib/commands/hosting-sites-create.js +1 -3
- package/lib/commands/hosting-sites-delete.js +1 -3
- package/lib/commands/hosting-sites-get.js +1 -3
- package/lib/commands/hosting-sites-list.js +1 -3
- package/lib/commands/index.js +11 -0
- package/lib/commands/open.js +3 -1
- package/lib/commands/serve.js +1 -1
- package/lib/commands/use.js +1 -1
- package/lib/config.js +1 -1
- package/lib/crashlytics/commandUtils.js +194 -0
- package/lib/crashlytics/events.js +122 -1
- package/lib/crashlytics/filters.js +12 -6
- package/lib/crashlytics/profilingManager.js +77 -50
- package/lib/crashlytics/reports.js +5 -1
- package/lib/crashlytics/utils.js +14 -0
- package/lib/database/import.js +5 -4
- package/lib/dataconnect/names.js +3 -3
- package/lib/dataconnect/schemaMigration.js +1 -1
- package/lib/deploy/firestore/prepare.js +21 -3
- package/lib/deploy/functions/backend.js +0 -10
- package/lib/deploy/functions/cel.js +2 -2
- package/lib/deploy/functions/deploy.js +2 -1
- package/lib/deploy/functions/release/fabricator.js +9 -2
- package/lib/deploy/functions/release/planner.js +3 -0
- package/lib/deploy/functions/release/reporter.js +0 -26
- package/lib/deploy/functions/runtimes/discovery/index.js +4 -1
- package/lib/deploy/functions/runtimes/discovery/parsing.js +1 -1
- package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +1 -1
- package/lib/deploy/functions/services/index.js +13 -11
- package/lib/deploy/hosting/prepare.js +1 -3
- package/lib/deploy/lifecycleHooks.js +1 -1
- package/lib/emulator/auth/operations.js +2 -2
- package/lib/emulator/auth/server.js +4 -2
- package/lib/emulator/auth/widget_ui.js +1 -1
- package/lib/emulator/commandUtils.js +4 -1
- package/lib/emulator/databaseEmulator.js +16 -11
- package/lib/emulator/dataconnect/pgliteServer.js +30 -24
- package/lib/emulator/downloadableEmulatorInfo.json +31 -31
- package/lib/emulator/downloadableEmulators.js +2 -2
- package/lib/emulator/extensions/postinstall.js +6 -6
- package/lib/emulator/firestoreEmulator.js +21 -15
- package/lib/emulator/functionsEmulator.js +11 -7
- package/lib/emulator/functionsEmulatorRuntime.js +9 -4
- package/lib/emulator/hub.js +12 -8
- package/lib/emulator/shared/express.js +30 -0
- package/lib/emulator/storage/apis/firebase.js +11 -10
- package/lib/emulator/storage/apis/gcloud.js +21 -20
- package/lib/emulator/storage/files.js +1 -1
- package/lib/emulator/storage/rules/manager.js +15 -12
- package/lib/emulator/storage/server.js +10 -5
- package/lib/experiments.js +5 -0
- package/lib/extensions/extensionsHelper.js +2 -2
- package/lib/extensions/listExtensions.js +1 -1
- package/lib/extensions/paramHelper.js +1 -1
- package/lib/extensions/provisioningHelper.js +1 -6
- package/lib/firestore/delete.js +2 -3
- package/lib/firestore/util.js +3 -3
- package/lib/frameworks/angular/utils.js +1 -1
- package/lib/frameworks/next/constants.js +17 -14
- package/lib/frameworks/next/index.js +25 -3
- package/lib/frameworks/next/utils.js +7 -9
- package/lib/functions/kits/install.js +221 -316
- package/lib/functions/kits/sources/directory.js +32 -0
- package/lib/functions/kits/sources/npm.js +55 -5
- package/lib/functionsConfig.js +0 -4
- package/lib/functionsShellCommandAction.js +1 -1
- package/lib/gcp/cloudbilling.js +2 -2
- package/lib/gcp/cloudbuild.js +0 -77
- package/lib/gcp/cloudfunctionsv2.js +0 -6
- package/lib/gcp/cloudtasks.js +0 -4
- package/lib/gcp/devConnect.js +2 -8
- package/lib/gcp/iam.js +15 -1
- package/lib/gcp/resourceManager.js +1 -14
- package/lib/gcp/storage.js +87 -4
- package/lib/hosting/api.js +79 -7
- package/lib/hosting/implicitInit.js +1 -1
- package/lib/hosting/proxy.js +5 -2
- package/lib/init/features/firestore/rules.js +1 -1
- package/lib/init/features/functions/index.js +2 -2
- package/lib/init/features/functions/npm-dependencies.js +1 -1
- package/lib/init/features/hosting/github.js +6 -4
- package/lib/init/features/hosting/index.js +4 -0
- package/lib/init/features/storage/rules.js +1 -1
- package/lib/localFunction.js +3 -3
- package/lib/management/database.js +1 -1
- package/lib/mcp/apps/init/mcp-app.js +5 -2
- package/lib/mcp/apps/update_environment/mcp-app.js +1 -1
- package/lib/mcp/index.js +14 -4
- package/lib/mcp/prompts/apptesting/run_test.js +3 -3
- package/lib/mcp/prompts/core/deploy.js +3 -3
- package/lib/mcp/resources/guides/init_ai.js +10 -10
- package/lib/mcp/tools/crashlytics/events.js +18 -93
- package/lib/mcp/tools/crashlytics/index.js +2 -0
- package/lib/mcp/tools/crashlytics/reports.js +3 -3
- package/lib/mcp/tools/crashlytics/setup.js +392 -0
- package/lib/mcp/util/dataconnect/converter.js +1 -1
- package/lib/profileReport.js +1 -1
- package/lib/profiler.js +1 -1
- package/lib/rulesDeploy.js +0 -1
- package/lib/throttler/throttler.js +1 -1
- package/lib/tsconfig.compile.tsbuildinfo +1 -1
- package/lib/tsconfig.publish.tsbuildinfo +1 -1
- package/lib/utils.js +5 -11
- package/package.json +4 -4
- package/lib/functions/kits/sources/index.js +0 -19
|
@@ -32,6 +32,19 @@ class DefaultStorageRulesManager {
|
|
|
32
32
|
await this._watcher.close();
|
|
33
33
|
}
|
|
34
34
|
updateWatcher(rulesFile) {
|
|
35
|
+
const handleFileChange = async () => {
|
|
36
|
+
await new Promise((res) => setTimeout(res, WATCHER_CHANGE_DELAY_MS));
|
|
37
|
+
try {
|
|
38
|
+
const content = (0, fsutils_1.readFile)(rulesFile);
|
|
39
|
+
this._rules.content = content;
|
|
40
|
+
this._logger.logLabeled("BULLET", "storage", "Change detected, updating rules for Cloud Storage...");
|
|
41
|
+
await this.loadRuleset();
|
|
42
|
+
}
|
|
43
|
+
catch (e) {
|
|
44
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
45
|
+
this._logger.logLabeled("DEBUG", "storage", `A rule file change was detected, but there was an error reading it: ${message}`);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
35
48
|
return new Promise((resolve) => {
|
|
36
49
|
const timer = setTimeout(resolve, WATCHER_READY_TIMEOUT_MS);
|
|
37
50
|
timer.unref?.();
|
|
@@ -47,18 +60,8 @@ class DefaultStorageRulesManager {
|
|
|
47
60
|
this._logger.logLabeled("DEBUG", "storage", `A storage rules file watcher error occurred: ${message}`);
|
|
48
61
|
resolve();
|
|
49
62
|
})
|
|
50
|
-
.on("change",
|
|
51
|
-
|
|
52
|
-
try {
|
|
53
|
-
const content = (0, fsutils_1.readFile)(rulesFile);
|
|
54
|
-
this._rules.content = content;
|
|
55
|
-
this._logger.logLabeled("BULLET", "storage", "Change detected, updating rules for Cloud Storage...");
|
|
56
|
-
await this.loadRuleset();
|
|
57
|
-
}
|
|
58
|
-
catch (e) {
|
|
59
|
-
const message = e instanceof Error ? e.message : String(e);
|
|
60
|
-
this._logger.logLabeled("DEBUG", "storage", `A rule file change was detected, but there was an error reading it: ${message}`);
|
|
61
|
-
}
|
|
63
|
+
.on("change", () => {
|
|
64
|
+
void handleFileChange();
|
|
62
65
|
});
|
|
63
66
|
});
|
|
64
67
|
}
|
|
@@ -9,6 +9,7 @@ const bodyParser = require("body-parser");
|
|
|
9
9
|
const gcloud_1 = require("./apis/gcloud");
|
|
10
10
|
const firebase_1 = require("./apis/firebase");
|
|
11
11
|
const errors_1 = require("../auth/errors");
|
|
12
|
+
const express_1 = require("../shared/express");
|
|
12
13
|
function createApp(defaultProjectId, emulator) {
|
|
13
14
|
const { storageLayer } = emulator;
|
|
14
15
|
const app = express();
|
|
@@ -38,7 +39,7 @@ function createApp(defaultProjectId, emulator) {
|
|
|
38
39
|
}));
|
|
39
40
|
app.use(bodyParser.raw({ limit: "130mb", type: "application/x-www-form-urlencoded" }));
|
|
40
41
|
app.use(bodyParser.raw({ limit: "130mb", type: "multipart/related" }));
|
|
41
|
-
app.post("/internal/export", express.json({ limit: "130mb" }), async (req, res) => {
|
|
42
|
+
app.post("/internal/export", express.json({ limit: "130mb" }), (0, express_1.asyncHandler)(async (req, res) => {
|
|
42
43
|
const initiatedBy = req.body.initiatedBy || "unknown";
|
|
43
44
|
const path = req.body.path;
|
|
44
45
|
if (!path) {
|
|
@@ -47,8 +48,8 @@ function createApp(defaultProjectId, emulator) {
|
|
|
47
48
|
}
|
|
48
49
|
await storageLayer.export(path, { initiatedBy });
|
|
49
50
|
res.sendStatus(200);
|
|
50
|
-
});
|
|
51
|
-
app.put("/internal/setRules", express.json({ limit: "130mb" }), async (req, res) => {
|
|
51
|
+
}));
|
|
52
|
+
app.put("/internal/setRules", express.json({ limit: "130mb" }), (0, express_1.asyncHandler)(async (req, res) => {
|
|
52
53
|
const rulesRaw = req.body.rules;
|
|
53
54
|
if (!(rulesRaw && Array.isArray(rulesRaw.files) && rulesRaw.files.length > 0)) {
|
|
54
55
|
res.status(400).json({
|
|
@@ -70,7 +71,10 @@ function createApp(defaultProjectId, emulator) {
|
|
|
70
71
|
if (!isRulesFile(file) || !file.resource) {
|
|
71
72
|
throw new errors_1.InvalidArgumentError("Each member of 'rules.files' array must contain 'name', 'content', and 'resource'");
|
|
72
73
|
}
|
|
73
|
-
rules.push({
|
|
74
|
+
rules.push({
|
|
75
|
+
resource: file.resource,
|
|
76
|
+
rules: { name: file.name, content: file.content },
|
|
77
|
+
});
|
|
74
78
|
}
|
|
75
79
|
return rules;
|
|
76
80
|
}
|
|
@@ -95,13 +99,14 @@ function createApp(defaultProjectId, emulator) {
|
|
|
95
99
|
res.status(200).json({
|
|
96
100
|
message: "Rules updated successfully",
|
|
97
101
|
});
|
|
98
|
-
});
|
|
102
|
+
}));
|
|
99
103
|
app.post("/internal/reset", (req, res) => {
|
|
100
104
|
emulator.reset();
|
|
101
105
|
res.sendStatus(200);
|
|
102
106
|
});
|
|
103
107
|
app.use("/v0", (0, firebase_1.createFirebaseEndpoints)(emulator));
|
|
104
108
|
app.use("/", (0, gcloud_1.createCloudEndpoints)(emulator));
|
|
109
|
+
app.use((0, express_1.jsonErrorHandler)(types_1.Emulators.STORAGE));
|
|
105
110
|
return Promise.resolve(app);
|
|
106
111
|
}
|
|
107
112
|
function isRulesFile(file) {
|
package/lib/experiments.js
CHANGED
|
@@ -228,6 +228,11 @@ exports.ALL_EXPERIMENTS = experiments({
|
|
|
228
228
|
default: false,
|
|
229
229
|
public: false,
|
|
230
230
|
},
|
|
231
|
+
crashlyticscli: {
|
|
232
|
+
shortDescription: "Enable read-only Crashlytics commands for issues, events, and reports.",
|
|
233
|
+
default: false,
|
|
234
|
+
public: false,
|
|
235
|
+
},
|
|
231
236
|
});
|
|
232
237
|
function isValidExperiment(name) {
|
|
233
238
|
return Object.keys(exports.ALL_EXPERIMENTS).includes(name);
|
|
@@ -86,7 +86,7 @@ exports.AUTOPOPULATED_PARAM_PLACEHOLDERS = {
|
|
|
86
86
|
exports.resourceTypeToNiceName = {
|
|
87
87
|
"firebaseextensions.v1beta.function": "Cloud Function",
|
|
88
88
|
};
|
|
89
|
-
const repoRegex = new RegExp(`^https
|
|
89
|
+
const repoRegex = new RegExp(`^https://github.com/[^/]+/[^/]+$`);
|
|
90
90
|
const stageOptions = ["rc", "alpha", "beta", "stable"];
|
|
91
91
|
function getDBInstanceFromURL(databaseUrl = "") {
|
|
92
92
|
const instanceRegex = new RegExp("(?:https://)(.*)(?:.firebaseio.com)");
|
|
@@ -268,7 +268,7 @@ function validateSpec(spec) {
|
|
|
268
268
|
async function promptForValidInstanceId(instanceId) {
|
|
269
269
|
let instanceIdIsValid = false;
|
|
270
270
|
let newInstanceId = "";
|
|
271
|
-
const instanceIdRegex = /^[a-z][a-z\d
|
|
271
|
+
const instanceIdRegex = /^[a-z][a-z\d-]*[a-z\d]$/;
|
|
272
272
|
while (!instanceIdIsValid) {
|
|
273
273
|
newInstanceId = await (0, prompt_1.input)({
|
|
274
274
|
default: instanceId,
|
|
@@ -48,7 +48,7 @@ async function listExtensions(projectId) {
|
|
|
48
48
|
publisher = extension.split("/")[0];
|
|
49
49
|
}
|
|
50
50
|
const instanceId = (0, utils_1.last)(instance.name.split("/")) ?? "";
|
|
51
|
-
const state = instance.state +
|
|
51
|
+
const state = String(instance.state) +
|
|
52
52
|
((instance.config.source.state || "ACTIVE") === "DELETED" ? " (UNPUBLISHED)" : "");
|
|
53
53
|
const version = instance?.config?.source?.spec?.version;
|
|
54
54
|
const updateTime = extensionsUtils.formatTimestamp(instance.updateTime);
|
|
@@ -181,7 +181,7 @@ function readEnvFile(envPath) {
|
|
|
181
181
|
return result.envs;
|
|
182
182
|
}
|
|
183
183
|
function isSystemParam(paramName) {
|
|
184
|
-
const regex = /^firebaseextensions\.[a-zA-Z0-9
|
|
184
|
+
const regex = /^firebaseextensions\.[a-zA-Z0-9.]*\//;
|
|
185
185
|
return regex.test(paramName);
|
|
186
186
|
}
|
|
187
187
|
function partitionParams(params) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DeferredProduct = void 0;
|
|
4
|
-
exports.checkProductsProvisioned = checkProductsProvisioned;
|
|
5
4
|
exports.bulkCheckProductsProvisioned = bulkCheckProductsProvisioned;
|
|
6
5
|
exports.getUsedProducts = getUsedProducts;
|
|
7
6
|
const marked_1 = require("marked");
|
|
@@ -16,10 +15,6 @@ var DeferredProduct;
|
|
|
16
15
|
DeferredProduct[DeferredProduct["STORAGE"] = 0] = "STORAGE";
|
|
17
16
|
DeferredProduct[DeferredProduct["AUTH"] = 1] = "AUTH";
|
|
18
17
|
})(DeferredProduct || (exports.DeferredProduct = DeferredProduct = {}));
|
|
19
|
-
async function checkProductsProvisioned(projectId, spec) {
|
|
20
|
-
const usedProducts = getUsedProducts(spec);
|
|
21
|
-
await checkProducts(projectId, usedProducts);
|
|
22
|
-
}
|
|
23
18
|
async function bulkCheckProductsProvisioned(projectId, instanceSpecs) {
|
|
24
19
|
const usedProducts = await Promise.all(instanceSpecs.map(async (i) => {
|
|
25
20
|
const extensionSpec = await (0, planner_1.getExtensionSpec)(i);
|
|
@@ -86,7 +81,7 @@ function getUsedProducts(spec) {
|
|
|
86
81
|
return usedProducts;
|
|
87
82
|
}
|
|
88
83
|
function getTriggerType(propertiesYaml) {
|
|
89
|
-
return propertiesYaml?.match(/eventType
|
|
84
|
+
return propertiesYaml?.match(/eventType: ([\S]+)/)?.[1];
|
|
90
85
|
}
|
|
91
86
|
async function isStorageProvisioned(projectId) {
|
|
92
87
|
const client = new apiv2_1.Client({ urlPrefix: (0, api_1.firebaseStorageOrigin)(), apiVersion: "v1beta" });
|
package/lib/firestore/delete.js
CHANGED
|
@@ -16,7 +16,6 @@ class FirestoreDelete {
|
|
|
16
16
|
this.path = path || "";
|
|
17
17
|
this.recursive = Boolean(options.recursive);
|
|
18
18
|
this.shallow = Boolean(options.shallow);
|
|
19
|
-
this.allCollections = Boolean(options.allCollections);
|
|
20
19
|
this.databaseId = options.databaseId;
|
|
21
20
|
this.urlPrefix = options.urlPrefix ?? (0, api_1.firestoreOriginOrEmulator)();
|
|
22
21
|
this.readBatchSize = 7500;
|
|
@@ -176,7 +175,7 @@ class FirestoreDelete {
|
|
|
176
175
|
return true;
|
|
177
176
|
}
|
|
178
177
|
if (failures.length > 0) {
|
|
179
|
-
logger_1.logger.debug(
|
|
178
|
+
logger_1.logger.debug(`Found ${failures.length} failed operations, failing.`);
|
|
180
179
|
return true;
|
|
181
180
|
}
|
|
182
181
|
if (queue.length <= this.maxQueueSize && pagesRemaining && !pageIncoming) {
|
|
@@ -193,7 +192,7 @@ class FirestoreDelete {
|
|
|
193
192
|
lastDocName = docs[docs.length - 1].name;
|
|
194
193
|
})
|
|
195
194
|
.catch((e) => {
|
|
196
|
-
logger_1.logger.debug(
|
|
195
|
+
logger_1.logger.debug(`Failed to fetch page after ${String(lastDocName)}`, e);
|
|
197
196
|
pageIncoming = false;
|
|
198
197
|
fetchFailures++;
|
|
199
198
|
if (fetchFailures >= 3) {
|
package/lib/firestore/util.js
CHANGED
|
@@ -6,9 +6,9 @@ exports.parseFieldName = parseFieldName;
|
|
|
6
6
|
exports.booleanXOR = booleanXOR;
|
|
7
7
|
exports.getCurrentMinuteAsIsoString = getCurrentMinuteAsIsoString;
|
|
8
8
|
const error_1 = require("../error");
|
|
9
|
-
const DATABASE_NAME_REGEX = /projects\/([
|
|
10
|
-
const INDEX_NAME_REGEX = /projects\/([
|
|
11
|
-
const FIELD_NAME_REGEX = /projects\/([
|
|
9
|
+
const DATABASE_NAME_REGEX = /projects\/([^/]+?)\/databases\/([^/]+)/;
|
|
10
|
+
const INDEX_NAME_REGEX = /projects\/([^/]+?)\/databases\/([^/]+?)\/collectionGroups\/([^/]+?)\/indexes\/([^/]*)/;
|
|
11
|
+
const FIELD_NAME_REGEX = /projects\/([^/]+?)\/databases\/([^/]+?)\/collectionGroups\/([^/]+?)\/fields\/([^/]*)/;
|
|
12
12
|
function parseDatabaseName(name) {
|
|
13
13
|
if (!name) {
|
|
14
14
|
throw new error_1.FirebaseError(`Cannot parse undefined database name.`);
|
|
@@ -52,7 +52,7 @@ async function localesForTarget(dir, architectHost, target, workspaceProject) {
|
|
|
52
52
|
locales = [defaultLocale];
|
|
53
53
|
for (const [locale, { baseHref }] of Object.entries(i18n.locales)) {
|
|
54
54
|
if (baseHref !== "")
|
|
55
|
-
throw new error_1.FirebaseError(`All your i18n locales must have a baseHref of
|
|
55
|
+
throw new error_1.FirebaseError(`All your i18n locales must have a baseHref of "" on Firebase, errored on ${locale}.`);
|
|
56
56
|
locales.push(locale);
|
|
57
57
|
}
|
|
58
58
|
}
|
|
@@ -23,42 +23,45 @@ const WEBPACK_LAYERS_NAMES = {
|
|
|
23
23
|
reactServerComponents: "rsc",
|
|
24
24
|
serverSideRendering: "ssr",
|
|
25
25
|
actionBrowser: "action-browser",
|
|
26
|
-
|
|
27
|
-
apiEdge: "api-edge",
|
|
26
|
+
api: "api",
|
|
28
27
|
middleware: "middleware",
|
|
29
|
-
instrument: "instrument",
|
|
30
28
|
edgeAsset: "edge-asset",
|
|
31
29
|
appPagesBrowser: "app-pages-browser",
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
pagesDirNode: "pages-dir-node",
|
|
30
|
+
appMetadataRoute: "app-metadata-route",
|
|
31
|
+
appRouteHandler: "app-route-handler",
|
|
35
32
|
};
|
|
36
33
|
exports.WEBPACK_LAYERS = {
|
|
37
34
|
...WEBPACK_LAYERS_NAMES,
|
|
35
|
+
pagesDirBrowser: "pages-dir-browser",
|
|
36
|
+
pagesDirEdge: "pages-dir-edge",
|
|
37
|
+
pagesDirNode: "pages-dir-node",
|
|
38
|
+
apiNode: "api-node",
|
|
39
|
+
apiEdge: "api-edge",
|
|
40
|
+
instrument: "instrument",
|
|
38
41
|
GROUP: {
|
|
39
42
|
builtinReact: [WEBPACK_LAYERS_NAMES.reactServerComponents, WEBPACK_LAYERS_NAMES.actionBrowser],
|
|
40
43
|
serverOnly: [
|
|
44
|
+
WEBPACK_LAYERS_NAMES.middleware,
|
|
41
45
|
WEBPACK_LAYERS_NAMES.reactServerComponents,
|
|
42
46
|
WEBPACK_LAYERS_NAMES.actionBrowser,
|
|
43
|
-
|
|
44
|
-
WEBPACK_LAYERS_NAMES.middleware,
|
|
47
|
+
"instrument",
|
|
45
48
|
],
|
|
46
|
-
neutralTarget: [
|
|
49
|
+
neutralTarget: ["api-node", "api-edge"],
|
|
47
50
|
clientOnly: [WEBPACK_LAYERS_NAMES.serverSideRendering, WEBPACK_LAYERS_NAMES.appPagesBrowser],
|
|
48
51
|
bundled: [
|
|
52
|
+
WEBPACK_LAYERS_NAMES.shared,
|
|
53
|
+
WEBPACK_LAYERS_NAMES.middleware,
|
|
49
54
|
WEBPACK_LAYERS_NAMES.reactServerComponents,
|
|
50
|
-
WEBPACK_LAYERS_NAMES.actionBrowser,
|
|
51
55
|
WEBPACK_LAYERS_NAMES.serverSideRendering,
|
|
56
|
+
WEBPACK_LAYERS_NAMES.actionBrowser,
|
|
57
|
+
"instrument",
|
|
52
58
|
WEBPACK_LAYERS_NAMES.appPagesBrowser,
|
|
53
|
-
WEBPACK_LAYERS_NAMES.shared,
|
|
54
|
-
WEBPACK_LAYERS_NAMES.instrument,
|
|
55
|
-
WEBPACK_LAYERS_NAMES.middleware,
|
|
56
59
|
],
|
|
57
60
|
appPages: [
|
|
58
61
|
WEBPACK_LAYERS_NAMES.reactServerComponents,
|
|
59
62
|
WEBPACK_LAYERS_NAMES.serverSideRendering,
|
|
60
|
-
WEBPACK_LAYERS_NAMES.appPagesBrowser,
|
|
61
63
|
WEBPACK_LAYERS_NAMES.actionBrowser,
|
|
64
|
+
WEBPACK_LAYERS_NAMES.appPagesBrowser,
|
|
62
65
|
],
|
|
63
66
|
},
|
|
64
67
|
};
|
|
@@ -16,6 +16,7 @@ const url_1 = require("url");
|
|
|
16
16
|
const semver_1 = require("semver");
|
|
17
17
|
const clc = require("colorette");
|
|
18
18
|
const fsutils_1 = require("../../fsutils");
|
|
19
|
+
const streamJson_1 = require("../../streamJson");
|
|
19
20
|
const prompt_1 = require("../../prompt");
|
|
20
21
|
const error_1 = require("../../error");
|
|
21
22
|
const utils_1 = require("../utils");
|
|
@@ -290,11 +291,11 @@ async function ɵcodegenPublicDirectory(sourceDir, destDir, _, context) {
|
|
|
290
291
|
{
|
|
291
292
|
srcRoute: null,
|
|
292
293
|
initialRevalidateSeconds: false,
|
|
293
|
-
initialExpireSeconds: undefined,
|
|
294
294
|
dataRoute: "",
|
|
295
295
|
experimentalPPR: false,
|
|
296
|
-
renderingMode: undefined,
|
|
297
296
|
prefetchDataRoute: "",
|
|
297
|
+
initialExpireSeconds: undefined,
|
|
298
|
+
renderingMode: undefined,
|
|
298
299
|
allowHeader: [],
|
|
299
300
|
},
|
|
300
301
|
];
|
|
@@ -394,7 +395,28 @@ async function ɵcodegenFunctionsDirectory(sourceDir, destDir, target, context)
|
|
|
394
395
|
if (!esbuild) {
|
|
395
396
|
throw new error_1.FirebaseError(`Failed to load esbuild from path: ${esbuildPath}`);
|
|
396
397
|
}
|
|
397
|
-
const
|
|
398
|
+
const { chain, parser, pick, streamObject } = await (0, streamJson_1.loadStreamJson)();
|
|
399
|
+
const productionDeps = await new Promise((resolve) => {
|
|
400
|
+
const dependencies = [];
|
|
401
|
+
const npmLs = (0, cross_spawn_1.spawn)("npm", ["ls", "--omit=dev", "--all", "--json=true"], {
|
|
402
|
+
cwd: sourceDir,
|
|
403
|
+
timeout: constants_1.NPM_COMMAND_TIMEOUT_MILLIES,
|
|
404
|
+
});
|
|
405
|
+
const pipeline = chain([
|
|
406
|
+
npmLs.stdout,
|
|
407
|
+
parser({ packValues: false, packKeys: true, streamValues: false }),
|
|
408
|
+
pick({ filter: "dependencies" }),
|
|
409
|
+
streamObject(),
|
|
410
|
+
({ key, value }) => [
|
|
411
|
+
key,
|
|
412
|
+
...(0, utils_2.allDependencyNames)(value),
|
|
413
|
+
],
|
|
414
|
+
]);
|
|
415
|
+
pipeline.on("data", (it) => dependencies.push(it));
|
|
416
|
+
pipeline.on("end", () => {
|
|
417
|
+
resolve([...new Set(dependencies)]);
|
|
418
|
+
});
|
|
419
|
+
});
|
|
398
420
|
const esbuildArgs = {
|
|
399
421
|
entryPoints: [(0, path_1.join)(sourceDir, configFile)],
|
|
400
422
|
outfile: (0, path_1.join)(destDir, configFile),
|
|
@@ -46,7 +46,7 @@ const streamJson_1 = require("../../streamJson");
|
|
|
46
46
|
const constants_2 = require("../constants");
|
|
47
47
|
const child_process_1 = require("child_process");
|
|
48
48
|
const error_1 = require("../../error");
|
|
49
|
-
exports.I18N_SOURCE = /\/:nextInternalLocale(\([
|
|
49
|
+
exports.I18N_SOURCE = /\/:nextInternalLocale(\([^)]+\))?/;
|
|
50
50
|
function cleanEscapedChars(path) {
|
|
51
51
|
return path.replace(/\\([(){}:+?*])/g, (a, b) => b);
|
|
52
52
|
}
|
|
@@ -193,26 +193,24 @@ async function getProductionDependencyNames(sourceDir) {
|
|
|
193
193
|
});
|
|
194
194
|
}
|
|
195
195
|
function getMiddlewareMatcherRegexes(middlewareManifest, functionsConfigManifest) {
|
|
196
|
-
const middlewareObjectValues = Object.values(middlewareManifest.middleware);
|
|
197
196
|
const middlewareMatchers = [];
|
|
198
197
|
if (middlewareManifest.version === 1) {
|
|
199
|
-
|
|
198
|
+
const values = Object.values(middlewareManifest.middleware);
|
|
199
|
+
middlewareMatchers.push(...values.map((page) => ({
|
|
200
200
|
regexp: page.regexp,
|
|
201
201
|
})));
|
|
202
202
|
}
|
|
203
203
|
else if (middlewareManifest.version === 2) {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
.flat());
|
|
204
|
+
const values = Object.values(middlewareManifest.middleware);
|
|
205
|
+
middlewareMatchers.push(...values.map((page) => page.matchers || []).flat());
|
|
207
206
|
}
|
|
208
207
|
else if (middlewareManifest.version === 3) {
|
|
209
208
|
if (functionsConfigManifest?.functions?.["/_middleware"]) {
|
|
210
209
|
middlewareMatchers.push(...(functionsConfigManifest.functions["/_middleware"].matchers || []));
|
|
211
210
|
}
|
|
212
211
|
else {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
.flat());
|
|
212
|
+
const values = Object.values(middlewareManifest.middleware);
|
|
213
|
+
middlewareMatchers.push(...values.map((page) => page.matchers || []).flat());
|
|
216
214
|
}
|
|
217
215
|
}
|
|
218
216
|
return middlewareMatchers.map((matcher) => new RegExp(matcher.regexp));
|