firebase-tools-with-isolate 15.13.0 → 15.14.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/README.md +17 -17
- package/lib/apphosting/constants.js +1 -1
- package/lib/command.js +36 -23
- package/lib/deploy/functions/prepare.js +6 -1
- package/lib/deploy/functions/prepareFunctionsUpload.js +25 -9
- package/lib/deploy/functions/release/index.js +5 -0
- package/lib/deploy/functions/runtimes/supported/index.js +0 -4
- package/lib/deploy/functions/services/ailogic.js +5 -4
- package/lib/deploy/functions/services/index.js +2 -2
- package/lib/deploy/functions/validate.js +7 -1
- package/lib/emulator/controller.js +11 -0
- package/lib/emulator/downloadableEmulatorInfo.json +24 -24
- package/lib/emulator/downloadableEmulators.js +1 -0
- package/lib/emulator/functionsEmulator.js +5 -6
- package/lib/emulator/functionsRuntimeWorker.js +1 -1
- package/lib/experiments.js +1 -1
- package/lib/frameworks/next/constants.js +2 -1
- package/lib/frameworks/next/index.js +3 -2
- package/lib/frameworks/next/utils.js +50 -12
- package/lib/functions/events/v2.js +10 -1
- package/lib/gcp/ailogic.js +7 -6
- package/lib/mcp/index.js +1 -0
- package/lib/tsconfig.publish.tsbuildinfo +1 -1
- package/package.json +3 -2
- package/schema/firebase-config.json +3 -0
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Firebase CLI with monorepo support
|
|
2
2
|
|
|
3
|
-
This is a fork of [firebase-tools](https://github.com/firebase/firebase-tools) that integrates [isolate-package](https://github.com/0x80/isolate-package/) into the functions `deploy` command to [support monorepo setups](https://thijs-koerselman.medium.com/deploy-to-firebase-without-the-hacks-e685de39025e).
|
|
3
|
+
This is a fork of [firebase-tools](https://github.com/firebase/firebase-tools) that integrates [isolate-package](https://github.com/0x80/isolate-package/) into the functions `deploy` command to [support monorepo setups](https://thijs-koerselman.medium.com/deploy-to-firebase-without-the-hacks-e685de39025e). Whether to run isolation is decided by [detect-monorepo](https://github.com/0x80/detect-monorepo), so standalone projects are untouched.
|
|
4
4
|
|
|
5
|
-
The integration is minimal — roughly 50 lines of code across
|
|
5
|
+
The integration is minimal — roughly 50 lines of code across 3 files — and does not affect any existing functionality. Isolation runs **automatically** whenever your functions source directory sits inside a detected monorepo (pnpm / npm / yarn / bun workspaces, or Rush). Standalone projects are left untouched and behave exactly like upstream.
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
@@ -28,15 +28,14 @@ In package.json scripts, `npx` is not required — scripts already prefer locall
|
|
|
28
28
|
|
|
29
29
|
## Configuration
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
No configuration is required. When you run `firebase deploy`, the fork calls `detectMonorepo` from `detect-monorepo` on the functions source directory. If a workspace root is found (pnpm-workspace.yaml, a parent `package.json` with a `workspaces` field, or `rush.json`), isolation runs automatically. Otherwise the deploy proceeds exactly as in upstream firebase-tools.
|
|
32
32
|
|
|
33
33
|
```json
|
|
34
34
|
{
|
|
35
35
|
"functions": {
|
|
36
36
|
"source": ".",
|
|
37
37
|
"runtime": "nodejs22",
|
|
38
|
-
"predeploy": ["turbo build"]
|
|
39
|
-
"isolate": true
|
|
38
|
+
"predeploy": ["turbo build"]
|
|
40
39
|
}
|
|
41
40
|
}
|
|
42
41
|
```
|
|
@@ -50,15 +49,13 @@ For a monorepo with multiple function packages, place `firebase.json` at the roo
|
|
|
50
49
|
"source": "services/api",
|
|
51
50
|
"predeploy": ["pnpm build:api"],
|
|
52
51
|
"runtime": "nodejs22",
|
|
53
|
-
"codebase": "api"
|
|
54
|
-
"isolate": true
|
|
52
|
+
"codebase": "api"
|
|
55
53
|
},
|
|
56
54
|
{
|
|
57
55
|
"source": "services/fns",
|
|
58
56
|
"predeploy": ["pnpm build:fns"],
|
|
59
57
|
"runtime": "nodejs22",
|
|
60
|
-
"codebase": "fns"
|
|
61
|
-
"isolate": true
|
|
58
|
+
"codebase": "fns"
|
|
62
59
|
}
|
|
63
60
|
]
|
|
64
61
|
}
|
|
@@ -70,11 +67,11 @@ For a complete working example of a modern monorepo setup, check out [mono-ts](h
|
|
|
70
67
|
|
|
71
68
|
## How this fork stays in sync
|
|
72
69
|
|
|
73
|
-
Fork versions match upstream firebase-tools versions (e.g. `15.13.0
|
|
70
|
+
Fork versions match upstream firebase-tools versions (e.g. `15.13.0` corresponds to upstream `v15.13.0`). The fork is kept in sync using automated tooling:
|
|
74
71
|
|
|
75
72
|
### Scripts (`scripts/sync/`)
|
|
76
73
|
|
|
77
|
-
- **`apply-isolate-changes.mjs`** — Applies the isolate integration on top of any clean upstream release. Patches
|
|
74
|
+
- **`apply-isolate-changes.mjs`** — Applies the isolate integration on top of any clean upstream release. Patches 2 source files plus `package.json` and the README, using anchor-based string matching verified to be stable across upstream releases from v15.4.0 through v15.13.0.
|
|
78
75
|
|
|
79
76
|
- **`sync-upstream.sh`** — Orchestrates the full sync: fetches upstream, merges a release tag, re-applies the isolate changes, installs dependencies, and verifies the build compiles.
|
|
80
77
|
|
|
@@ -95,17 +92,20 @@ The sync can also be triggered manually:
|
|
|
95
92
|
|
|
96
93
|
All workflows use Node 24 and npm OIDC trusted publishing (provenance).
|
|
97
94
|
|
|
98
|
-
- **[`sync-upstream.yml`](.github/workflows/sync-upstream.yml)** — Runs daily (09:00 UTC) and on manual dispatch. Checks for new upstream firebase-tools releases
|
|
95
|
+
- **[`sync-upstream.yml`](.github/workflows/sync-upstream.yml)** — Runs daily (09:00 UTC) and on manual dispatch. Checks for new upstream firebase-tools releases, merges to main, and triggers the publish workflow automatically. Can target a specific version.
|
|
99
96
|
|
|
100
|
-
- **[`update-isolate.yml`](.github/workflows/update-isolate.yml)** — Updates the `isolate-package` dependency to a given version, bumps the fork's pre-release number (e.g. `15.13.0
|
|
97
|
+
- **[`update-isolate.yml`](.github/workflows/update-isolate.yml)** — Updates the `isolate-package` dependency to a given version, bumps the fork's pre-release number (e.g. `15.13.0` → `15.13.0-1`), and opens a PR targeting `main`. Follow up with the publish workflow to release to npm.
|
|
101
98
|
|
|
102
|
-
- **[`publish.yml`](.github/workflows/publish.yml)** — Publishes the fork to npm.
|
|
99
|
+
- **[`publish.yml`](.github/workflows/publish.yml)** — Publishes the fork to npm. Called automatically by the sync workflow, or can be triggered manually. Creates a git tag and GitHub release.
|
|
103
100
|
|
|
104
101
|
### Versioning
|
|
105
102
|
|
|
106
|
-
-
|
|
107
|
-
-
|
|
108
|
-
|
|
103
|
+
- The daily sync automatically publishes version `X.Y.Z` matching upstream `vX.Y.Z`
|
|
104
|
+
- Isolate-package updates use pre-release versions (`X.Y.Z-1`, `X.Y.Z-2`, ...) published under the `next` dist-tag
|
|
105
|
+
|
|
106
|
+
## Issues
|
|
107
|
+
|
|
108
|
+
Issues on this repository are disabled. For problems with the isolation step itself, submit them at [isolate-package](https://github.com/0x80/isolate-package/issues). For problems with how the fork decides whether a project is a monorepo, submit them at [detect-monorepo](https://github.com/0x80/detect-monorepo/issues). For anything unrelated to the isolate integration, refer to the upstream [firebase-tools](https://github.com/firebase/firebase-tools/issues).
|
|
109
109
|
|
|
110
110
|
## Documentation
|
|
111
111
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ALLOWED_DEPLOY_METHODS = exports.DEFAULT_DEPLOY_METHOD = exports.DEFAULT_LOCATION = void 0;
|
|
4
|
-
exports.DEFAULT_LOCATION = "us-
|
|
4
|
+
exports.DEFAULT_LOCATION = "us-east4";
|
|
5
5
|
exports.DEFAULT_DEPLOY_METHOD = "github";
|
|
6
6
|
exports.ALLOWED_DEPLOY_METHODS = [{ name: "Deploy using github", value: "github" }];
|
package/lib/command.js
CHANGED
|
@@ -111,22 +111,23 @@ class Command {
|
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
113
|
const duration = Math.floor((process.uptime() - start) * 1000);
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
await (0, utils_1.withTimeout)(5000, Promise.all([
|
|
124
|
-
trackSuccess,
|
|
125
|
-
(0, track_1.trackEmulator)("command_success", {
|
|
114
|
+
try {
|
|
115
|
+
const trackSuccess = (0, track_1.trackGA4)("command_execution", {
|
|
116
|
+
command_name: this.name,
|
|
117
|
+
result: "success",
|
|
118
|
+
interactive: (0, utils_1.getInheritedOption)(options, "nonInteractive") ? "false" : "true",
|
|
119
|
+
}, duration);
|
|
120
|
+
const tracks = [trackSuccess];
|
|
121
|
+
if (isEmulator) {
|
|
122
|
+
tracks.push((0, track_1.trackEmulator)("command_success", {
|
|
126
123
|
command_name: this.name,
|
|
127
124
|
duration,
|
|
128
|
-
})
|
|
129
|
-
|
|
125
|
+
}));
|
|
126
|
+
}
|
|
127
|
+
await (0, utils_1.withTimeout)(1000, Promise.all(tracks));
|
|
128
|
+
}
|
|
129
|
+
catch (gaErr) {
|
|
130
|
+
logger_1.logger.debug("Analytics tracking failed during success path:", gaErr);
|
|
130
131
|
}
|
|
131
132
|
process.exit();
|
|
132
133
|
})
|
|
@@ -140,20 +141,25 @@ class Command {
|
|
|
140
141
|
});
|
|
141
142
|
}
|
|
142
143
|
const duration = Math.floor((process.uptime() - start) * 1000);
|
|
143
|
-
|
|
144
|
-
(0, track_1.trackGA4)("command_execution", {
|
|
144
|
+
try {
|
|
145
|
+
const trackError = (0, track_1.trackGA4)("command_execution", {
|
|
145
146
|
command_name: this.name,
|
|
146
147
|
result: "error",
|
|
147
148
|
interactive: (0, utils_1.getInheritedOption)(options, "nonInteractive") ? "false" : "true",
|
|
148
|
-
}, duration)
|
|
149
|
-
|
|
150
|
-
|
|
149
|
+
}, duration);
|
|
150
|
+
const tracks = [trackError];
|
|
151
|
+
if (isEmulator) {
|
|
152
|
+
tracks.push((0, track_1.trackEmulator)("command_error", {
|
|
151
153
|
command_name: this.name,
|
|
152
154
|
duration,
|
|
153
|
-
error_type: err
|
|
154
|
-
})
|
|
155
|
-
|
|
156
|
-
|
|
155
|
+
error_type: err?.exit === 1 ? "user" : "unexpected",
|
|
156
|
+
}));
|
|
157
|
+
}
|
|
158
|
+
await (0, utils_1.withTimeout)(1000, Promise.all(tracks));
|
|
159
|
+
}
|
|
160
|
+
catch (gaErr) {
|
|
161
|
+
logger_1.logger.debug("Analytics tracking failed during error path:", gaErr);
|
|
162
|
+
}
|
|
157
163
|
client.errorOut(err);
|
|
158
164
|
});
|
|
159
165
|
});
|
|
@@ -178,6 +184,13 @@ class Command {
|
|
|
178
184
|
if ((0, utils_1.getInheritedOption)(options, "config")) {
|
|
179
185
|
options.configPath = (0, utils_1.getInheritedOption)(options, "config");
|
|
180
186
|
}
|
|
187
|
+
const onlyOption = (0, utils_1.getInheritedOption)(options, "only");
|
|
188
|
+
if (onlyOption) {
|
|
189
|
+
options.only = onlyOption
|
|
190
|
+
.split(/[\s,]+/)
|
|
191
|
+
.filter(Boolean)
|
|
192
|
+
.join(",");
|
|
193
|
+
}
|
|
181
194
|
try {
|
|
182
195
|
options.config = config_1.Config.load(options);
|
|
183
196
|
}
|
|
@@ -159,6 +159,9 @@ async function prepare(context, options, payload) {
|
|
|
159
159
|
(0, utils_1.logLabeledBullet)("functions", `preparing ${clc.bold(sourceDirName)} directory for uploading...`);
|
|
160
160
|
}
|
|
161
161
|
if (localCfg.isolate === true) {
|
|
162
|
+
(0, utils_1.logLabeledWarning)("functions", "The 'isolate' flag in firebase.json is deprecated and no longer needed — monorepo detection is now automatic. Please remove 'isolate' from your functions config.");
|
|
163
|
+
}
|
|
164
|
+
if ((0, prepareFunctionsUpload_1.isMonorepoSource)(sourceDir)) {
|
|
162
165
|
sourceDir = await (0, prepareFunctionsUpload_1.runIsolate)(sourceDirName);
|
|
163
166
|
}
|
|
164
167
|
if (backend.someEndpoint(wantBackend, (e) => e.platform === "gcfv2" || e.platform === "run")) {
|
|
@@ -172,7 +175,9 @@ async function prepare(context, options, payload) {
|
|
|
172
175
|
const exportType = backend.someEndpoint(wantBackend, (e) => e.platform === "run")
|
|
173
176
|
? "tar.gz"
|
|
174
177
|
: "zip";
|
|
175
|
-
const
|
|
178
|
+
const isDart = supported.runtimeIsLanguage(wantBuilds[codebase].runtime, "dart");
|
|
179
|
+
const executablePaths = isDart ? ["bin/server"] : [];
|
|
180
|
+
const packagedSource = await (0, prepareFunctionsUpload_1.prepareFunctionsUpload)(options.config.projectDir, sourceDir, localCfg, [...schPathSet], undefined, { exportType, executablePaths });
|
|
176
181
|
source.functionsSourceV2 = packagedSource?.pathToSource;
|
|
177
182
|
source.functionsSourceV2Hash = packagedSource?.hash;
|
|
178
183
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getFunctionsConfig = getFunctionsConfig;
|
|
4
|
+
exports.addFilesToArchive = addFilesToArchive;
|
|
4
5
|
exports.prepareFunctionsUpload = prepareFunctionsUpload;
|
|
6
|
+
exports.isMonorepoSource = isMonorepoSource;
|
|
5
7
|
exports.runIsolate = runIsolate;
|
|
6
8
|
exports.convertToSortedKeyValueArray = convertToSortedKeyValueArray;
|
|
7
9
|
const archiver = require("archiver");
|
|
@@ -11,6 +13,7 @@ const fs = require("fs");
|
|
|
11
13
|
const path = require("path");
|
|
12
14
|
const tmp = require("tmp");
|
|
13
15
|
const crypto = require("crypto");
|
|
16
|
+
const detect_monorepo_1 = require("detect-monorepo");
|
|
14
17
|
const dynamicImport_1 = require("../../dynamicImport");
|
|
15
18
|
const error_1 = require("../../error");
|
|
16
19
|
const logger_1 = require("../../logger");
|
|
@@ -47,6 +50,24 @@ async function pipeAsync(from, to) {
|
|
|
47
50
|
to.on("error", reject);
|
|
48
51
|
});
|
|
49
52
|
}
|
|
53
|
+
async function addFilesToArchive(archive, files, sourceDir, executablePaths) {
|
|
54
|
+
const hashes = [];
|
|
55
|
+
for (const file of files) {
|
|
56
|
+
const name = path.relative(sourceDir, file.name);
|
|
57
|
+
const normalizedName = name.split(path.sep).join("/");
|
|
58
|
+
const fileHash = await (0, hash_1.getSourceHash)(file.name);
|
|
59
|
+
hashes.push(fileHash);
|
|
60
|
+
let mode = file.mode;
|
|
61
|
+
if (executablePaths?.includes(normalizedName)) {
|
|
62
|
+
mode = 0o755;
|
|
63
|
+
}
|
|
64
|
+
archive.file(file.name, {
|
|
65
|
+
name: normalizedName,
|
|
66
|
+
mode,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
return hashes;
|
|
70
|
+
}
|
|
50
71
|
async function packageSource(projectDir, sourceDir, config, additionalSources, runtimeConfig, options) {
|
|
51
72
|
const exportType = options?.exportType || "zip";
|
|
52
73
|
const postfix = `.${exportType}`;
|
|
@@ -62,15 +83,7 @@ async function packageSource(projectDir, sourceDir, config, additionalSources, r
|
|
|
62
83
|
ignore.push("firebase-debug.log", "firebase-debug.*.log", CONFIG_DEST_FILE);
|
|
63
84
|
try {
|
|
64
85
|
const files = await fsAsync.readdirRecursive({ path: sourceDir, ignore: ignore });
|
|
65
|
-
|
|
66
|
-
const name = path.relative(sourceDir, file.name);
|
|
67
|
-
const fileHash = await (0, hash_1.getSourceHash)(file.name);
|
|
68
|
-
hashes.push(fileHash);
|
|
69
|
-
archive.file(file.name, {
|
|
70
|
-
name,
|
|
71
|
-
mode: file.mode,
|
|
72
|
-
});
|
|
73
|
-
}
|
|
86
|
+
hashes.push(...(await addFilesToArchive(archive, files, sourceDir, options?.executablePaths)));
|
|
74
87
|
for (const name of additionalSources) {
|
|
75
88
|
const absPath = utils.resolveWithin(projectDir, name);
|
|
76
89
|
if (!fs.existsSync(absPath)) {
|
|
@@ -120,6 +133,9 @@ async function packageSource(projectDir, sourceDir, config, additionalSources, r
|
|
|
120
133
|
async function prepareFunctionsUpload(projectDir, sourceDir, config, additionalSources, runtimeConfig, options) {
|
|
121
134
|
return packageSource(projectDir, sourceDir, config, additionalSources, runtimeConfig, options);
|
|
122
135
|
}
|
|
136
|
+
function isMonorepoSource(absoluteSourceDir) {
|
|
137
|
+
return (0, detect_monorepo_1.detectMonorepo)(absoluteSourceDir) !== null;
|
|
138
|
+
}
|
|
123
139
|
async function runIsolate(sourceDirName) {
|
|
124
140
|
try {
|
|
125
141
|
utils.logLabeledBullet("isolate", "Isolating the source");
|
|
@@ -18,6 +18,7 @@ const error_1 = require("../../../error");
|
|
|
18
18
|
const getProjectNumber_1 = require("../../../getProjectNumber");
|
|
19
19
|
const extensions_1 = require("../../extensions");
|
|
20
20
|
const artifacts = require("../../../functions/artifacts");
|
|
21
|
+
const supported_1 = require("../runtimes/supported");
|
|
21
22
|
async function release(context, options, payload) {
|
|
22
23
|
if (context.extensions && payload.extensions) {
|
|
23
24
|
await (0, extensions_1.release)(context.extensions, options, payload.extensions);
|
|
@@ -88,6 +89,10 @@ async function release(context, options, payload) {
|
|
|
88
89
|
reporter.printErrors(summary);
|
|
89
90
|
const wantBackend = backend.merge(...Object.values(payload.functions).map((p) => p.wantBackend));
|
|
90
91
|
printTriggerUrls(wantBackend, projectNumber);
|
|
92
|
+
if (backend.someEndpoint(wantBackend, (endpoint) => (0, supported_1.runtimeIsLanguage)(endpoint.runtime, "dart"))) {
|
|
93
|
+
utils.logLabeledBullet("functions", "Dart functions may not yet be visible in the Firebase Console. " +
|
|
94
|
+
`View them in the Cloud Console at https://console.cloud.google.com/run/services?project=${context.projectId}`);
|
|
95
|
+
}
|
|
91
96
|
await setupArtifactCleanupPolicies(options, options.projectId, Object.keys(wantBackend.endpoints));
|
|
92
97
|
const allErrors = summary.results.filter((r) => r.error).map((r) => r.error);
|
|
93
98
|
if (allErrors.length) {
|
|
@@ -16,7 +16,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.isRuntime = isRuntime;
|
|
18
18
|
exports.runtimeIsLanguage = runtimeIsLanguage;
|
|
19
|
-
exports.isLanguageRuntime = isLanguageRuntime;
|
|
20
19
|
exports.latest = latest;
|
|
21
20
|
exports.isDecommissioned = isDecommissioned;
|
|
22
21
|
exports.guardVersionSupport = guardVersionSupport;
|
|
@@ -28,9 +27,6 @@ function isRuntime(maybe) {
|
|
|
28
27
|
return maybe in types_1.RUNTIMES;
|
|
29
28
|
}
|
|
30
29
|
function runtimeIsLanguage(runtime, language) {
|
|
31
|
-
return runtime.startsWith(language);
|
|
32
|
-
}
|
|
33
|
-
function isLanguageRuntime(runtime, language) {
|
|
34
30
|
return !!runtime && runtime.startsWith(language);
|
|
35
31
|
}
|
|
36
32
|
function latest(language, runtimes = Object.keys(types_1.RUNTIMES)) {
|
|
@@ -5,11 +5,12 @@ exports.isAILogicEvent = isAILogicEvent;
|
|
|
5
5
|
const backend = require("../backend");
|
|
6
6
|
const error_1 = require("../../../error");
|
|
7
7
|
const ailogicApi = require("../../../gcp/ailogic");
|
|
8
|
-
|
|
9
|
-
exports
|
|
8
|
+
const ailogic_1 = require("../../../gcp/ailogic");
|
|
9
|
+
Object.defineProperty(exports, "AI_LOGIC_BEFORE_GENERATE_CONTENT", { enumerable: true, get: function () { return ailogic_1.AI_LOGIC_BEFORE_GENERATE_CONTENT; } });
|
|
10
|
+
Object.defineProperty(exports, "AI_LOGIC_AFTER_GENERATE_CONTENT", { enumerable: true, get: function () { return ailogic_1.AI_LOGIC_AFTER_GENERATE_CONTENT; } });
|
|
10
11
|
exports.AI_LOGIC_EVENTS = [
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
ailogic_1.AI_LOGIC_BEFORE_GENERATE_CONTENT,
|
|
13
|
+
ailogic_1.AI_LOGIC_AFTER_GENERATE_CONTENT,
|
|
13
14
|
];
|
|
14
15
|
function isAILogicEvent(endpoint) {
|
|
15
16
|
if (!backend.isBlockingTriggered(endpoint)) {
|
|
@@ -124,8 +124,8 @@ const EVENT_SERVICE_MAPPING = {
|
|
|
124
124
|
"google.cloud.firestore.document.v1.updated.withAuthContext": firestoreService,
|
|
125
125
|
"google.cloud.firestore.document.v1.deleted.withAuthContext": firestoreService,
|
|
126
126
|
"google.firebase.dataconnect.connector.v1.mutationExecuted": dataconnectService,
|
|
127
|
-
"firebase.
|
|
128
|
-
"firebase.
|
|
127
|
+
"google.firebase.ailogic.v1.beforeGenerate": aiLogicService,
|
|
128
|
+
"google.firebase.ailogic.v1.afterGenerate": aiLogicService,
|
|
129
129
|
};
|
|
130
130
|
function serviceForEndpoint(endpoint) {
|
|
131
131
|
if (backend.isEventTriggered(endpoint)) {
|
|
@@ -55,7 +55,13 @@ function endpointsAreValid(wantBackend) {
|
|
|
55
55
|
validateTimeoutConfig(endpoints);
|
|
56
56
|
for (const ep of endpoints) {
|
|
57
57
|
validateScheduledTimeout(ep);
|
|
58
|
-
(0, services_1.serviceForEndpoint)(ep)
|
|
58
|
+
const service = (0, services_1.serviceForEndpoint)(ep);
|
|
59
|
+
if (backend.isBlockingTriggered(ep)) {
|
|
60
|
+
if (service.name === "noop") {
|
|
61
|
+
throw new error_1.FirebaseError(`Unrecognized blocking trigger type: ${ep.blockingTrigger.eventType}. Please update your CLI with ${clc.bold("npm install -g firebase-tools@latest")}.`, { exit: 1 });
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
service.validateTrigger(ep, wantBackend);
|
|
59
65
|
}
|
|
60
66
|
const gcfV1WithConcurrency = matchingIds(endpoints, (endpoint) => (endpoint.concurrency || 1) !== 1 && endpoint.platform === "gcfv1");
|
|
61
67
|
if (gcfV1WithConcurrency.length) {
|
|
@@ -419,10 +419,20 @@ async function startAll(options, showUI = true, runningTestScript = false) {
|
|
|
419
419
|
const firestoreLogger = emulatorLogger_1.EmulatorLogger.forEmulator(types_1.Emulators.FIRESTORE);
|
|
420
420
|
const firestoreAddr = legacyGetFirstAddr(types_1.Emulators.FIRESTORE);
|
|
421
421
|
const websocketPort = legacyGetFirstAddr("firestore.websocket").port;
|
|
422
|
+
const prodEdition = options.config.data.firestore?.edition;
|
|
423
|
+
const emulatorEdition = options.config.src.emulators?.firestore?.edition;
|
|
424
|
+
if (prodEdition !== emulatorEdition) {
|
|
425
|
+
firestoreLogger.logLabeled("WARN", "firestore", `The edition configured in your firebase.json#firestore and firebase.json#emulators.firestore do not match. The latter will be used to start up the Firestore emulator.`);
|
|
426
|
+
}
|
|
427
|
+
const edition = (emulatorEdition || prodEdition || "standard").toLowerCase();
|
|
428
|
+
if (edition !== "standard" && edition !== "enterprise") {
|
|
429
|
+
throw new error_1.FirebaseError("The Firestore emulator edition must be either 'standard' or 'enterprise'.", { exit: 1 });
|
|
430
|
+
}
|
|
422
431
|
const args = {
|
|
423
432
|
host: firestoreAddr.host,
|
|
424
433
|
port: firestoreAddr.port,
|
|
425
434
|
websocket_port: websocketPort,
|
|
435
|
+
"database-edition": edition,
|
|
426
436
|
project_id: projectId,
|
|
427
437
|
auto_download: true,
|
|
428
438
|
};
|
|
@@ -472,6 +482,7 @@ async function startAll(options, showUI = true, runningTestScript = false) {
|
|
|
472
482
|
}
|
|
473
483
|
const firestoreEmulator = new firestoreEmulator_1.FirestoreEmulator(args);
|
|
474
484
|
await startEmulator(firestoreEmulator);
|
|
485
|
+
firestoreLogger.logLabeled("SUCCESS", types_1.Emulators.FIRESTORE, `Firestore Emulator was started in ${edition} edition.`);
|
|
475
486
|
firestoreLogger.logLabeled("SUCCESS", types_1.Emulators.FIRESTORE, `Firestore Emulator UI websocket is running on ${websocketPort}.`);
|
|
476
487
|
}
|
|
477
488
|
if (listenForEmulator.database) {
|
|
@@ -54,36 +54,36 @@
|
|
|
54
54
|
},
|
|
55
55
|
"dataconnect": {
|
|
56
56
|
"darwin": {
|
|
57
|
-
"version": "3.
|
|
58
|
-
"expectedSize":
|
|
59
|
-
"expectedChecksum": "
|
|
60
|
-
"expectedChecksumSHA256": "
|
|
61
|
-
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-macos-amd64-v3.
|
|
62
|
-
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.
|
|
57
|
+
"version": "3.4.1",
|
|
58
|
+
"expectedSize": 32274112,
|
|
59
|
+
"expectedChecksum": "ccd7e0be14784f6ac6f6b2102180e062",
|
|
60
|
+
"expectedChecksumSHA256": "2ae6cb5c5da239d272f29b1f14c4630a45ed8e841f8eadd330189dc821fb93bd",
|
|
61
|
+
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-macos-amd64-v3.4.1",
|
|
62
|
+
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.1"
|
|
63
63
|
},
|
|
64
64
|
"darwin_arm64": {
|
|
65
|
-
"version": "3.
|
|
66
|
-
"expectedSize":
|
|
67
|
-
"expectedChecksum": "
|
|
68
|
-
"expectedChecksumSHA256": "
|
|
69
|
-
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-macos-arm64-v3.
|
|
70
|
-
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.
|
|
65
|
+
"version": "3.4.1",
|
|
66
|
+
"expectedSize": 30437282,
|
|
67
|
+
"expectedChecksum": "ea76099299d6f50862d9a0bb194bb921",
|
|
68
|
+
"expectedChecksumSHA256": "ec51f9bcc0668ca25713c57385d2f12a2776ee64170dcdd861968be30925c7be",
|
|
69
|
+
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-macos-arm64-v3.4.1",
|
|
70
|
+
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.1"
|
|
71
71
|
},
|
|
72
72
|
"win32": {
|
|
73
|
-
"version": "3.
|
|
74
|
-
"expectedSize":
|
|
75
|
-
"expectedChecksum": "
|
|
76
|
-
"expectedChecksumSHA256": "
|
|
77
|
-
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-windows-amd64-v3.
|
|
78
|
-
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.
|
|
73
|
+
"version": "3.4.1",
|
|
74
|
+
"expectedSize": 32315904,
|
|
75
|
+
"expectedChecksum": "2d433690efb1e7931d0d5ab4fe5a6d25",
|
|
76
|
+
"expectedChecksumSHA256": "7d8ecff49ac0492569c855badbabd5b1600a2ff63814900a1bbea8b16d96d76a",
|
|
77
|
+
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-windows-amd64-v3.4.1",
|
|
78
|
+
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.1.exe"
|
|
79
79
|
},
|
|
80
80
|
"linux": {
|
|
81
|
-
"version": "3.
|
|
82
|
-
"expectedSize":
|
|
83
|
-
"expectedChecksum": "
|
|
84
|
-
"expectedChecksumSHA256": "
|
|
85
|
-
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-linux-amd64-v3.
|
|
86
|
-
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.
|
|
81
|
+
"version": "3.4.1",
|
|
82
|
+
"expectedSize": 31432888,
|
|
83
|
+
"expectedChecksum": "8e11775e6df3d5dbe583f1f346f299f6",
|
|
84
|
+
"expectedChecksumSHA256": "7124f38854f72c7aa0daff91439825725cb31db138bc1c15976ca97aa27837c4",
|
|
85
|
+
"remoteUrl": "https://storage.googleapis.com/firemat-preview-drop/emulator/dataconnect-emulator-linux-amd64-v3.4.1",
|
|
86
|
+
"downloadPathRelativeToCacheDir": "dataconnect-emulator-3.4.1"
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
}
|
|
@@ -232,7 +232,7 @@ class FunctionsEmulator {
|
|
|
232
232
|
"Content-Type": "application/json",
|
|
233
233
|
"Content-Length": `${reqBody.length}`,
|
|
234
234
|
};
|
|
235
|
-
const isDart = (0, supported_1.
|
|
235
|
+
const isDart = (0, supported_1.runtimeIsLanguage)(record.backend.runtime, "dart");
|
|
236
236
|
const path = isDart ? `/${trigger.entryPoint}` : `/`;
|
|
237
237
|
return new Promise((resolve, reject) => {
|
|
238
238
|
const req = http.request({
|
|
@@ -271,7 +271,7 @@ class FunctionsEmulator {
|
|
|
271
271
|
for (const backend of this.staticBackends) {
|
|
272
272
|
this.logger.logLabeled("BULLET", "functions", `Watching "${backend.functionsDir}" for Cloud Functions...`);
|
|
273
273
|
await this.loadTriggers(backend, true);
|
|
274
|
-
const isDart = (0, supported_1.
|
|
274
|
+
const isDart = (0, supported_1.runtimeIsLanguage)(backend.runtime, "dart");
|
|
275
275
|
if (isDart) {
|
|
276
276
|
const runtimeDelegateContext = {
|
|
277
277
|
projectId: this.args.projectId,
|
|
@@ -1168,10 +1168,10 @@ class FunctionsEmulator {
|
|
|
1168
1168
|
const runtimeEnv = this.getRuntimeEnvs(backend, trigger);
|
|
1169
1169
|
const secretEnvs = await this.resolveSecretEnvs(backend, trigger);
|
|
1170
1170
|
let runtime;
|
|
1171
|
-
if ((0, supported_1.
|
|
1171
|
+
if ((0, supported_1.runtimeIsLanguage)(backend.runtime, "python")) {
|
|
1172
1172
|
runtime = await this.startPython(backend, { ...runtimeEnv, ...secretEnvs });
|
|
1173
1173
|
}
|
|
1174
|
-
else if ((0, supported_1.
|
|
1174
|
+
else if ((0, supported_1.runtimeIsLanguage)(backend.runtime, "dart")) {
|
|
1175
1175
|
runtime = await this.startDart(backend, { ...runtimeEnv, ...secretEnvs });
|
|
1176
1176
|
}
|
|
1177
1177
|
else {
|
|
@@ -1242,8 +1242,7 @@ class FunctionsEmulator {
|
|
|
1242
1242
|
this.logger.log("DEBUG", `[functions] Runtime ready! Sending request!`);
|
|
1243
1243
|
const url = new url_1.URL(`${req.protocol}://${req.hostname}${req.url}`);
|
|
1244
1244
|
let path = `${url.pathname}${url.search}`.replace(new RegExp(`\/${this.args.projectId}\/[^\/]*\/${req.params.trigger_name}\/?`), "/");
|
|
1245
|
-
|
|
1246
|
-
if (isDart) {
|
|
1245
|
+
if ((0, supported_1.runtimeIsLanguage)(record.backend.runtime, "dart")) {
|
|
1247
1246
|
const isBackgroundRoute = req.url.startsWith("/functions/projects/");
|
|
1248
1247
|
if (isBackgroundRoute || path === "/") {
|
|
1249
1248
|
path = `/${trigger.entryPoint}`;
|
|
@@ -231,7 +231,7 @@ class RuntimeWorkerPool {
|
|
|
231
231
|
if (this.mode === types_1.FunctionsExecutionMode.SEQUENTIAL) {
|
|
232
232
|
return "~shared~";
|
|
233
233
|
}
|
|
234
|
-
if ((0, supported_1.
|
|
234
|
+
if ((0, supported_1.runtimeIsLanguage)(runtime, "dart")) {
|
|
235
235
|
return "~dart-shared~";
|
|
236
236
|
}
|
|
237
237
|
return triggerId || "~diagnostic~";
|
package/lib/experiments.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WEBPACK_LAYERS = exports.ESBUILD_VERSION = exports.CONFIG_FILES = exports.SERVER_REFERENCE_MANIFEST = exports.APP_PATHS_MANIFEST = exports.ROUTES_MANIFEST = exports.PRERENDER_MANIFEST = exports.PAGES_MANIFEST = exports.MIDDLEWARE_MANIFEST = exports.IMAGES_MANIFEST = exports.EXPORT_MARKER = exports.APP_PATH_ROUTES_MANIFEST = void 0;
|
|
3
|
+
exports.WEBPACK_LAYERS = exports.ESBUILD_VERSION = exports.CONFIG_FILES = exports.SERVER_REFERENCE_MANIFEST = exports.APP_PATHS_MANIFEST = exports.ROUTES_MANIFEST = exports.PRERENDER_MANIFEST = exports.PAGES_MANIFEST = exports.FUNCTIONS_CONFIG_MANIFEST = exports.MIDDLEWARE_MANIFEST = exports.IMAGES_MANIFEST = exports.EXPORT_MARKER = exports.APP_PATH_ROUTES_MANIFEST = void 0;
|
|
4
4
|
exports.APP_PATH_ROUTES_MANIFEST = "app-path-routes-manifest.json";
|
|
5
5
|
exports.EXPORT_MARKER = "export-marker.json";
|
|
6
6
|
exports.IMAGES_MANIFEST = "images-manifest.json";
|
|
7
7
|
exports.MIDDLEWARE_MANIFEST = "middleware-manifest.json";
|
|
8
|
+
exports.FUNCTIONS_CONFIG_MANIFEST = "functions-config-manifest.json";
|
|
8
9
|
exports.PAGES_MANIFEST = "pages-manifest.json";
|
|
9
10
|
exports.PRERENDER_MANIFEST = "prerender-manifest.json";
|
|
10
11
|
exports.ROUTES_MANIFEST = "routes-manifest.json";
|
|
@@ -255,16 +255,17 @@ async function ɵcodegenPublicDirectory(sourceDir, destDir, _, context) {
|
|
|
255
255
|
await (0, fs_extra_1.copy)(publicPath, (0, path_1.join)(destDir, basePath));
|
|
256
256
|
}
|
|
257
257
|
await (0, fs_extra_1.copy)((0, path_1.join)(sourceDir, distDir, "static"), (0, path_1.join)(destDir, basePath, "_next", "static"));
|
|
258
|
-
const [middlewareManifest, prerenderManifest, routesManifest, pagesManifest, appPathRoutesManifest, serverReferenceManifest,] = await Promise.all([
|
|
258
|
+
const [middlewareManifest, prerenderManifest, routesManifest, pagesManifest, appPathRoutesManifest, serverReferenceManifest, functionsConfigManifest,] = await Promise.all([
|
|
259
259
|
(0, utils_1.readJSON)((0, path_1.join)(sourceDir, distDir, "server", constants_2.MIDDLEWARE_MANIFEST)),
|
|
260
260
|
(0, utils_1.readJSON)((0, path_1.join)(sourceDir, distDir, constants_2.PRERENDER_MANIFEST)),
|
|
261
261
|
(0, utils_1.readJSON)((0, path_1.join)(sourceDir, distDir, constants_2.ROUTES_MANIFEST)),
|
|
262
262
|
(0, utils_1.readJSON)((0, path_1.join)(sourceDir, distDir, "server", constants_2.PAGES_MANIFEST)),
|
|
263
263
|
(0, utils_1.readJSON)((0, path_1.join)(sourceDir, distDir, constants_2.APP_PATH_ROUTES_MANIFEST)).catch(() => ({})),
|
|
264
264
|
(0, utils_1.readJSON)((0, path_1.join)(sourceDir, distDir, "server", constants_2.SERVER_REFERENCE_MANIFEST)).catch(() => ({ node: {}, edge: {}, encryptionKey: "" })),
|
|
265
|
+
(0, utils_1.readJSON)((0, path_1.join)(sourceDir, distDir, "server", constants_2.FUNCTIONS_CONFIG_MANIFEST)).catch(() => ({ version: 0, functions: {} })),
|
|
265
266
|
]);
|
|
266
267
|
const appPathRoutesEntries = Object.entries(appPathRoutesManifest);
|
|
267
|
-
const middlewareMatcherRegexes = (0, utils_2.getMiddlewareMatcherRegexes)(middlewareManifest);
|
|
268
|
+
const middlewareMatcherRegexes = (0, utils_2.getMiddlewareMatcherRegexes)(middlewareManifest, functionsConfigManifest);
|
|
268
269
|
const { redirects = [], rewrites = [], headers = [] } = routesManifest;
|
|
269
270
|
const rewritesRegexesNotSupportedByHosting = (0, utils_2.getNextjsRewritesToUse)(rewrites)
|
|
270
271
|
.filter((rewrite) => !(0, utils_2.isRewriteSupportedByHosting)(rewrite))
|