firebase-tools 11.16.1 → 11.18.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/deploy/extensions/planner.js +2 -1
- package/lib/deploy/functions/deploy.js +5 -2
- package/lib/deploy/functions/runtimes/index.js +2 -1
- package/lib/deploy/functions/runtimes/node/parseRuntimeAndValidateSDK.js +1 -0
- package/lib/deploy/lifecycleHooks.js +2 -1
- package/lib/emulator/auth/apiSpec.js +549 -201
- package/lib/emulator/auth/operations.js +4 -2
- package/lib/emulator/auth/server.js +19 -8
- package/lib/emulator/eventarcEmulator.js +2 -1
- package/lib/emulator/eventarcEmulatorUtils.js +60 -0
- package/lib/emulator/extensions/validation.js +2 -0
- package/lib/emulator/extensionsEmulator.js +1 -1
- package/lib/emulator/functionsEmulator.js +40 -29
- package/lib/extensions/billingMigrationHelper.js +2 -1
- package/lib/extensions/displayExtensionInfo.js +2 -1
- package/lib/extensions/emulator/specHelper.js +4 -3
- package/lib/extensions/emulator/triggerHelper.js +64 -20
- package/lib/extensions/extensionsHelper.js +9 -9
- package/lib/extensions/types.js +2 -1
- package/lib/extensions/utils.js +14 -1
- package/lib/firestore/indexes-api.js +7 -1
- package/lib/firestore/indexes-sort.js +4 -0
- package/lib/firestore/indexes.js +31 -5
- package/lib/firestore/util.js +5 -1
- package/lib/firestore/validator.js +7 -1
- package/lib/frameworks/angular/index.js +3 -0
- package/lib/frameworks/next/index.js +59 -16
- package/lib/frameworks/next/interfaces.js +2 -0
- package/lib/frameworks/next/utils.js +34 -0
- package/lib/frameworks/nuxt/index.js +3 -0
- package/lib/frameworks/utils.js +24 -0
- package/lib/frameworks/vite/index.js +4 -1
- package/lib/init/features/emulators.js +1 -1
- package/lib/utils.js +1 -1
- package/npm-shrinkwrap.json +38 -72
- package/package.json +1 -1
- package/schema/firebase-config.json +4 -2
package/lib/firestore/indexes.js
CHANGED
|
@@ -98,7 +98,8 @@ class FirestoreIndexes {
|
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
-
|
|
101
|
+
const sortedFieldOverridesToDeploy = fieldOverridesToDeploy.sort(sort.compareFieldOverride);
|
|
102
|
+
for (const field of sortedFieldOverridesToDeploy) {
|
|
102
103
|
const exists = existingFieldOverrides.some((x) => this.fieldMatchesSpec(x, field));
|
|
103
104
|
if (exists) {
|
|
104
105
|
logger_1.logger.debug(`Skipping existing field override: ${JSON.stringify(field)}`);
|
|
@@ -136,7 +137,7 @@ class FirestoreIndexes {
|
|
|
136
137
|
}
|
|
137
138
|
async listFieldOverrides(project) {
|
|
138
139
|
const parent = `projects/${project}/databases/(default)/collectionGroups/-`;
|
|
139
|
-
const url = `/${parent}/fields?filter=indexConfig.usesAncestorConfig=false
|
|
140
|
+
const url = `/${parent}/fields?filter=indexConfig.usesAncestorConfig=false OR ttlConfig:*`;
|
|
140
141
|
const res = await this.apiClient.get(url);
|
|
141
142
|
const fields = res.body.fields;
|
|
142
143
|
if (!fields) {
|
|
@@ -164,6 +165,7 @@ class FirestoreIndexes {
|
|
|
164
165
|
return {
|
|
165
166
|
collectionGroup: parsedName.collectionGroupId,
|
|
166
167
|
fieldPath: parsedName.fieldPath,
|
|
168
|
+
ttl: !!field.ttlConfig,
|
|
167
169
|
indexes: fieldIndexes.map((index) => {
|
|
168
170
|
const firstField = index.fields[0];
|
|
169
171
|
return {
|
|
@@ -232,6 +234,9 @@ class FirestoreIndexes {
|
|
|
232
234
|
validator.assertHas(field, "collectionGroup");
|
|
233
235
|
validator.assertHas(field, "fieldPath");
|
|
234
236
|
validator.assertHas(field, "indexes");
|
|
237
|
+
if (typeof field.ttl !== "undefined") {
|
|
238
|
+
validator.assertType("ttl", field.ttl, "boolean");
|
|
239
|
+
}
|
|
235
240
|
field.indexes.forEach((index) => {
|
|
236
241
|
validator.assertHasOneOf(index, ["arrayConfig", "order"]);
|
|
237
242
|
if (index.arrayConfig) {
|
|
@@ -259,17 +264,27 @@ class FirestoreIndexes {
|
|
|
259
264
|
],
|
|
260
265
|
};
|
|
261
266
|
});
|
|
262
|
-
|
|
267
|
+
let data = {
|
|
263
268
|
indexConfig: {
|
|
264
269
|
indexes,
|
|
265
270
|
},
|
|
266
271
|
};
|
|
267
|
-
|
|
272
|
+
if (spec.ttl) {
|
|
273
|
+
data = Object.assign(data, {
|
|
274
|
+
ttlConfig: {},
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
if (typeof spec.ttl !== "undefined") {
|
|
278
|
+
await this.apiClient.patch(url, data);
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
await this.apiClient.patch(url, data, { queryParams: { updateMask: "indexConfig" } });
|
|
282
|
+
}
|
|
268
283
|
}
|
|
269
284
|
deleteField(field) {
|
|
270
285
|
const url = field.name;
|
|
271
286
|
const data = {};
|
|
272
|
-
return this.apiClient.patch(`/${url}`, data
|
|
287
|
+
return this.apiClient.patch(`/${url}`, data);
|
|
273
288
|
}
|
|
274
289
|
createIndex(project, index) {
|
|
275
290
|
const url = `/projects/${project}/databases/(default)/collectionGroups/${index.collectionGroup}/indexes`;
|
|
@@ -318,6 +333,13 @@ class FirestoreIndexes {
|
|
|
318
333
|
if (parsedName.fieldPath !== spec.fieldPath) {
|
|
319
334
|
return false;
|
|
320
335
|
}
|
|
336
|
+
if (typeof spec.ttl !== "undefined" && util.booleanXOR(!!field.ttlConfig, spec.ttl)) {
|
|
337
|
+
return false;
|
|
338
|
+
}
|
|
339
|
+
else if (!!field.ttlConfig && typeof spec.ttl === "undefined") {
|
|
340
|
+
utils.logLabeledBullet("firestore", `there are TTL field overrides for collection ${spec.collectionGroup} defined in your project that are not present in your ` +
|
|
341
|
+
"firestore indexes file. The TTL policy won't be deleted since is not specified as false.");
|
|
342
|
+
}
|
|
321
343
|
const fieldIndexes = field.indexConfig.indexes || [];
|
|
322
344
|
if (fieldIndexes.length !== spec.indexes.length) {
|
|
323
345
|
return false;
|
|
@@ -427,6 +449,10 @@ class FirestoreIndexes {
|
|
|
427
449
|
else {
|
|
428
450
|
result += " (no indexes)";
|
|
429
451
|
}
|
|
452
|
+
const fieldTtl = field.ttlConfig;
|
|
453
|
+
if (fieldTtl) {
|
|
454
|
+
result += ` TTL(${fieldTtl.state})`;
|
|
455
|
+
}
|
|
430
456
|
return result;
|
|
431
457
|
}
|
|
432
458
|
}
|
package/lib/firestore/util.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseFieldName = exports.parseIndexName = void 0;
|
|
3
|
+
exports.booleanXOR = exports.parseFieldName = exports.parseIndexName = void 0;
|
|
4
4
|
const error_1 = require("../error");
|
|
5
5
|
const INDEX_NAME_REGEX = /projects\/([^\/]+?)\/databases\/\(default\)\/collectionGroups\/([^\/]+?)\/indexes\/([^\/]*)/;
|
|
6
6
|
const FIELD_NAME_REGEX = /projects\/([^\/]+?)\/databases\/\(default\)\/collectionGroups\/([^\/]+?)\/fields\/([^\/]*)/;
|
|
@@ -31,3 +31,7 @@ function parseFieldName(name) {
|
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
exports.parseFieldName = parseFieldName;
|
|
34
|
+
function booleanXOR(a, b) {
|
|
35
|
+
return !!(Number(a) - Number(b));
|
|
36
|
+
}
|
|
37
|
+
exports.booleanXOR = booleanXOR;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.assertEnum = exports.assertHasOneOf = exports.assertHas = void 0;
|
|
3
|
+
exports.assertType = exports.assertEnum = exports.assertHasOneOf = exports.assertHas = void 0;
|
|
4
4
|
const clc = require("colorette");
|
|
5
5
|
const error_1 = require("../error");
|
|
6
6
|
function assertHas(obj, prop) {
|
|
@@ -30,3 +30,9 @@ function assertEnum(obj, prop, valid) {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
exports.assertEnum = assertEnum;
|
|
33
|
+
function assertType(prop, propValue, type) {
|
|
34
|
+
if (typeof propValue !== type) {
|
|
35
|
+
throw new error_1.FirebaseError(`Property "${prop}" must be of type ${type}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.assertType = assertType;
|
|
@@ -8,10 +8,12 @@ const promises_1 = require("fs/promises");
|
|
|
8
8
|
const __1 = require("..");
|
|
9
9
|
const prompt_1 = require("../../prompt");
|
|
10
10
|
const proxy_1 = require("../../hosting/proxy");
|
|
11
|
+
const utils_1 = require("../utils");
|
|
11
12
|
exports.name = "Angular";
|
|
12
13
|
exports.support = "experimental";
|
|
13
14
|
exports.type = 3;
|
|
14
15
|
const CLI_COMMAND = (0, path_1.join)("node_modules", ".bin", process.platform === "win32" ? "ng.cmd" : "ng");
|
|
16
|
+
const DEFAULT_BUILD_SCRIPT = ["ng build"];
|
|
15
17
|
async function discover(dir) {
|
|
16
18
|
if (!(await (0, fs_extra_1.pathExists)((0, path_1.join)(dir, "package.json"))))
|
|
17
19
|
return;
|
|
@@ -48,6 +50,7 @@ async function build(dir) {
|
|
|
48
50
|
if (!success)
|
|
49
51
|
throw new Error(error);
|
|
50
52
|
};
|
|
53
|
+
await (0, utils_1.warnIfCustomBuildScript)(dir, exports.name, DEFAULT_BUILD_SCRIPT);
|
|
51
54
|
if (!browserTarget)
|
|
52
55
|
throw new Error("No build target...");
|
|
53
56
|
if (prerenderTarget) {
|
|
@@ -13,7 +13,11 @@ const semver_1 = require("semver");
|
|
|
13
13
|
const logger_1 = require("../../logger");
|
|
14
14
|
const error_1 = require("../../error");
|
|
15
15
|
const fsutils_1 = require("../../fsutils");
|
|
16
|
+
const utils_1 = require("./utils");
|
|
17
|
+
const utils_2 = require("../utils");
|
|
18
|
+
const utils_3 = require("../utils");
|
|
16
19
|
const CLI_COMMAND = (0, path_1.join)("node_modules", ".bin", process.platform === "win32" ? "next.cmd" : "next");
|
|
20
|
+
const DEFAULT_BUILD_SCRIPT = ["next build"];
|
|
17
21
|
exports.name = "Next.js";
|
|
18
22
|
exports.support = "experimental";
|
|
19
23
|
exports.type = 2;
|
|
@@ -34,7 +38,9 @@ async function discover(dir) {
|
|
|
34
38
|
}
|
|
35
39
|
exports.discover = discover;
|
|
36
40
|
async function build(dir) {
|
|
41
|
+
var _a, _b;
|
|
37
42
|
const { default: nextBuild } = (0, __1.relativeRequire)(dir, "next/dist/build");
|
|
43
|
+
await (0, utils_3.warnIfCustomBuildScript)(dir, exports.name, DEFAULT_BUILD_SCRIPT);
|
|
38
44
|
const reactVersion = getReactVersion(dir);
|
|
39
45
|
if (reactVersion && (0, semver_1.gte)(reactVersion, "18.0.0")) {
|
|
40
46
|
process.env.__NEXT_REACT_ROOT = "true";
|
|
@@ -74,23 +80,41 @@ async function build(dir) {
|
|
|
74
80
|
wantsBackend = false;
|
|
75
81
|
}
|
|
76
82
|
}
|
|
77
|
-
const
|
|
78
|
-
const manifest = JSON.parse(manifestBuffer.toString());
|
|
83
|
+
const manifest = await (0, utils_2.readJSON)((0, path_1.join)(dir, distDir, "routes-manifest.json"));
|
|
79
84
|
const { headers: nextJsHeaders = [], redirects: nextJsRedirects = [], rewrites: nextJsRewrites = [], } = manifest;
|
|
80
|
-
const
|
|
85
|
+
const isEveryHeaderSupported = nextJsHeaders.every(utils_1.isHeaderSupportedByFirebase);
|
|
86
|
+
if (!isEveryHeaderSupported)
|
|
87
|
+
wantsBackend = true;
|
|
88
|
+
const headers = nextJsHeaders.filter(utils_1.isHeaderSupportedByFirebase).map(({ source, headers }) => ({
|
|
89
|
+
source: (0, utils_1.cleanEscapedChars)(source),
|
|
90
|
+
headers,
|
|
91
|
+
}));
|
|
92
|
+
const isEveryRedirectSupported = nextJsRedirects.every(utils_1.isRedirectSupportedByFirebase);
|
|
93
|
+
if (!isEveryRedirectSupported)
|
|
94
|
+
wantsBackend = true;
|
|
81
95
|
const redirects = nextJsRedirects
|
|
82
|
-
.filter(
|
|
83
|
-
.map(({ source, destination, statusCode: type }) => ({
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
96
|
+
.filter(utils_1.isRedirectSupportedByFirebase)
|
|
97
|
+
.map(({ source, destination, statusCode: type }) => ({
|
|
98
|
+
source: (0, utils_1.cleanEscapedChars)(source),
|
|
99
|
+
destination,
|
|
100
|
+
type,
|
|
101
|
+
}));
|
|
102
|
+
const nextJsRewritesToUse = (0, utils_1.getNextjsRewritesToUse)(nextJsRewrites);
|
|
103
|
+
if (!Array.isArray(nextJsRewrites) &&
|
|
104
|
+
(((_a = nextJsRewrites.afterFiles) === null || _a === void 0 ? void 0 : _a.length) || ((_b = nextJsRewrites.fallback) === null || _b === void 0 ? void 0 : _b.length))) {
|
|
105
|
+
wantsBackend = true;
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
const isEveryRewriteSupported = nextJsRewritesToUse.every(utils_1.isRewriteSupportedByFirebase);
|
|
109
|
+
if (!isEveryRewriteSupported)
|
|
110
|
+
wantsBackend = true;
|
|
111
|
+
}
|
|
87
112
|
const rewrites = nextJsRewritesToUse
|
|
88
|
-
.
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
})
|
|
93
|
-
.filter((it) => it);
|
|
113
|
+
.filter(utils_1.isRewriteSupportedByFirebase)
|
|
114
|
+
.map(({ source, destination }) => ({
|
|
115
|
+
source: (0, utils_1.cleanEscapedChars)(source),
|
|
116
|
+
destination,
|
|
117
|
+
}));
|
|
94
118
|
return { wantsBackend, headers, redirects, rewrites };
|
|
95
119
|
}
|
|
96
120
|
exports.build = build;
|
|
@@ -131,14 +155,33 @@ async function ɵcodegenPublicDirectory(sourceDir, destDir) {
|
|
|
131
155
|
await (0, promises_1.copyFile)(appPath, (0, path_1.join)(destDir, file));
|
|
132
156
|
}
|
|
133
157
|
}
|
|
134
|
-
const
|
|
135
|
-
|
|
158
|
+
const [prerenderManifest, routesManifest] = await Promise.all([
|
|
159
|
+
(0, utils_2.readJSON)((0, path_1.join)(sourceDir, distDir, "prerender-manifest.json")),
|
|
160
|
+
(0, utils_2.readJSON)((0, path_1.join)(sourceDir, distDir, "routes-manifest.json")),
|
|
161
|
+
]);
|
|
162
|
+
const { redirects = [], rewrites = [], headers = [] } = routesManifest;
|
|
163
|
+
const rewritesToUse = (0, utils_1.getNextjsRewritesToUse)(rewrites);
|
|
164
|
+
const rewritesNotSupportedByFirebase = rewritesToUse.filter((rewrite) => !(0, utils_1.isRewriteSupportedByFirebase)(rewrite));
|
|
165
|
+
const rewritesRegexesNotSupportedByFirebase = rewritesNotSupportedByFirebase.map((rewrite) => new RegExp(rewrite.regex));
|
|
166
|
+
const redirectsNotSupportedByFirebase = redirects.filter((redirect) => !(0, utils_1.isRedirectSupportedByFirebase)(redirect));
|
|
167
|
+
const redirectsRegexesNotSupportedByFirebase = redirectsNotSupportedByFirebase.map((redirect) => new RegExp(redirect.regex));
|
|
168
|
+
const headersNotSupportedByFirebase = headers.filter((header) => !(0, utils_1.isHeaderSupportedByFirebase)(header));
|
|
169
|
+
const headersRegexesNotSupportedByFirebase = headersNotSupportedByFirebase.map((header) => new RegExp(header.regex));
|
|
136
170
|
for (const path in prerenderManifest.routes) {
|
|
137
171
|
if (prerenderManifest.routes[path]) {
|
|
138
172
|
const { initialRevalidateSeconds } = prerenderManifest.routes[path];
|
|
139
173
|
if (initialRevalidateSeconds) {
|
|
140
174
|
continue;
|
|
141
175
|
}
|
|
176
|
+
const routeMatchUnsupportedRewrite = rewritesRegexesNotSupportedByFirebase.some((rewriteRegex) => rewriteRegex.test(path));
|
|
177
|
+
if (routeMatchUnsupportedRewrite)
|
|
178
|
+
continue;
|
|
179
|
+
const routeMatchUnsupportedRedirect = redirectsRegexesNotSupportedByFirebase.some((redirectRegex) => redirectRegex.test(path));
|
|
180
|
+
if (routeMatchUnsupportedRedirect)
|
|
181
|
+
continue;
|
|
182
|
+
const routeMatchUnsupportedHeader = headersRegexesNotSupportedByFirebase.some((headerRegex) => headerRegex.test(path));
|
|
183
|
+
if (routeMatchUnsupportedHeader)
|
|
184
|
+
continue;
|
|
142
185
|
const parts = path
|
|
143
186
|
.split("/")
|
|
144
187
|
.slice(1)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getNextjsRewritesToUse = exports.isHeaderSupportedByFirebase = exports.isRedirectSupportedByFirebase = exports.isRewriteSupportedByFirebase = exports.cleanEscapedChars = exports.pathHasRegex = void 0;
|
|
4
|
+
const utils_1 = require("../utils");
|
|
5
|
+
function pathHasRegex(path) {
|
|
6
|
+
return /(?<!\\)\(/.test(path);
|
|
7
|
+
}
|
|
8
|
+
exports.pathHasRegex = pathHasRegex;
|
|
9
|
+
function cleanEscapedChars(path) {
|
|
10
|
+
return path.replace(/\\([(){}:+?*])/g, (a, b) => b);
|
|
11
|
+
}
|
|
12
|
+
exports.cleanEscapedChars = cleanEscapedChars;
|
|
13
|
+
function isRewriteSupportedByFirebase(rewrite) {
|
|
14
|
+
return !("has" in rewrite || pathHasRegex(rewrite.source) || (0, utils_1.isUrl)(rewrite.destination));
|
|
15
|
+
}
|
|
16
|
+
exports.isRewriteSupportedByFirebase = isRewriteSupportedByFirebase;
|
|
17
|
+
function isRedirectSupportedByFirebase(redirect) {
|
|
18
|
+
return !("has" in redirect || pathHasRegex(redirect.source) || "internal" in redirect);
|
|
19
|
+
}
|
|
20
|
+
exports.isRedirectSupportedByFirebase = isRedirectSupportedByFirebase;
|
|
21
|
+
function isHeaderSupportedByFirebase(header) {
|
|
22
|
+
return !("has" in header || pathHasRegex(header.source));
|
|
23
|
+
}
|
|
24
|
+
exports.isHeaderSupportedByFirebase = isHeaderSupportedByFirebase;
|
|
25
|
+
function getNextjsRewritesToUse(nextJsRewrites) {
|
|
26
|
+
if (Array.isArray(nextJsRewrites)) {
|
|
27
|
+
return nextJsRewrites;
|
|
28
|
+
}
|
|
29
|
+
if (nextJsRewrites === null || nextJsRewrites === void 0 ? void 0 : nextJsRewrites.beforeFiles) {
|
|
30
|
+
return nextJsRewrites.beforeFiles;
|
|
31
|
+
}
|
|
32
|
+
return [];
|
|
33
|
+
}
|
|
34
|
+
exports.getNextjsRewritesToUse = getNextjsRewritesToUse;
|
|
@@ -6,9 +6,11 @@ const promises_1 = require("fs/promises");
|
|
|
6
6
|
const path_1 = require("path");
|
|
7
7
|
const semver_1 = require("semver");
|
|
8
8
|
const __1 = require("..");
|
|
9
|
+
const utils_1 = require("../utils");
|
|
9
10
|
exports.name = "Nuxt";
|
|
10
11
|
exports.support = "experimental";
|
|
11
12
|
exports.type = 4;
|
|
13
|
+
const DEFAULT_BUILD_SCRIPT = ["nuxt build"];
|
|
12
14
|
async function discover(dir) {
|
|
13
15
|
if (!(await (0, fs_extra_1.pathExists)((0, path_1.join)(dir, "package.json"))))
|
|
14
16
|
return;
|
|
@@ -26,6 +28,7 @@ exports.discover = discover;
|
|
|
26
28
|
async function build(root) {
|
|
27
29
|
const { buildNuxt } = await (0, __1.relativeRequire)(root, "@nuxt/kit");
|
|
28
30
|
const nuxtApp = await getNuxtApp(root);
|
|
31
|
+
await (0, utils_1.warnIfCustomBuildScript)(root, exports.name, DEFAULT_BUILD_SCRIPT);
|
|
29
32
|
await buildNuxt(nuxtApp);
|
|
30
33
|
return { wantsBackend: true };
|
|
31
34
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.warnIfCustomBuildScript = exports.readJSON = exports.isUrl = void 0;
|
|
4
|
+
const fs_extra_1 = require("fs-extra");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const promises_1 = require("fs/promises");
|
|
7
|
+
function isUrl(url) {
|
|
8
|
+
return /^https?:\/\//.test(url);
|
|
9
|
+
}
|
|
10
|
+
exports.isUrl = isUrl;
|
|
11
|
+
function readJSON(file, options) {
|
|
12
|
+
return (0, fs_extra_1.readJSON)(file, options);
|
|
13
|
+
}
|
|
14
|
+
exports.readJSON = readJSON;
|
|
15
|
+
async function warnIfCustomBuildScript(dir, framework, defaultBuildScripts) {
|
|
16
|
+
var _a;
|
|
17
|
+
const packageJsonBuffer = await (0, promises_1.readFile)((0, path_1.join)(dir, "package.json"));
|
|
18
|
+
const packageJson = JSON.parse(packageJsonBuffer.toString());
|
|
19
|
+
const buildScript = (_a = packageJson.scripts) === null || _a === void 0 ? void 0 : _a.build;
|
|
20
|
+
if (buildScript && !defaultBuildScripts.includes(buildScript)) {
|
|
21
|
+
console.warn(`\nWARNING: Your package.json contains a custom build that is being ignored. Only the ${framework} default build script (e.g, "${defaultBuildScripts[0]}") is respected. If you have a more advanced build process you should build a custom integration https://firebase.google.com/docs/hosting/express\n`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.warnIfCustomBuildScript = warnIfCustomBuildScript;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDevModeHandle = exports.ɵcodegenPublicDirectory = exports.build = exports.discover = exports.vitePluginDiscover = exports.viteDiscoverWithNpmDependency = exports.init = exports.initViteTemplate = exports.type = exports.support = exports.name = void 0;
|
|
3
|
+
exports.getDevModeHandle = exports.ɵcodegenPublicDirectory = exports.build = exports.discover = exports.vitePluginDiscover = exports.viteDiscoverWithNpmDependency = exports.init = exports.initViteTemplate = exports.DEFAULT_BUILD_SCRIPT = exports.type = exports.support = exports.name = void 0;
|
|
4
4
|
const child_process_1 = require("child_process");
|
|
5
5
|
const fs_1 = require("fs");
|
|
6
6
|
const fs_extra_1 = require("fs-extra");
|
|
@@ -8,10 +8,12 @@ const path_1 = require("path");
|
|
|
8
8
|
const __1 = require("..");
|
|
9
9
|
const proxy_1 = require("../../hosting/proxy");
|
|
10
10
|
const prompt_1 = require("../../prompt");
|
|
11
|
+
const utils_1 = require("../utils");
|
|
11
12
|
exports.name = "Vite";
|
|
12
13
|
exports.support = "experimental";
|
|
13
14
|
exports.type = 4;
|
|
14
15
|
const CLI_COMMAND = (0, path_1.join)("node_modules", ".bin", process.platform === "win32" ? "vite.cmd" : "vite");
|
|
16
|
+
exports.DEFAULT_BUILD_SCRIPT = ["vite build", "tsc && vite build"];
|
|
15
17
|
const initViteTemplate = (template) => async (setup) => await init(setup, template);
|
|
16
18
|
exports.initViteTemplate = initViteTemplate;
|
|
17
19
|
async function init(setup, baseTemplate = "vanilla") {
|
|
@@ -56,6 +58,7 @@ async function discover(dir, plugin, npmDependency) {
|
|
|
56
58
|
exports.discover = discover;
|
|
57
59
|
async function build(root) {
|
|
58
60
|
const { build } = (0, __1.relativeRequire)(root, "vite");
|
|
61
|
+
await (0, utils_1.warnIfCustomBuildScript)(root, exports.name, exports.DEFAULT_BUILD_SCRIPT);
|
|
59
62
|
await build({ root });
|
|
60
63
|
}
|
|
61
64
|
exports.build = build;
|
package/lib/utils.js
CHANGED
|
@@ -363,7 +363,7 @@ function datetimeString(d) {
|
|
|
363
363
|
}
|
|
364
364
|
exports.datetimeString = datetimeString;
|
|
365
365
|
function isCloudEnvironment() {
|
|
366
|
-
return !!process.env.CODESPACES;
|
|
366
|
+
return !!process.env.CODESPACES || !!process.env.GOOGLE_CLOUD_WORKSTATIONS;
|
|
367
367
|
}
|
|
368
368
|
exports.isCloudEnvironment = isCloudEnvironment;
|
|
369
369
|
function isRunningInWSL() {
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "firebase-tools",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.18.0",
|
|
4
4
|
"lockfileVersion": 2,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "firebase-tools",
|
|
9
|
-
"version": "11.
|
|
9
|
+
"version": "11.18.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@google-cloud/pubsub": "^3.0.1",
|
|
@@ -167,24 +167,6 @@
|
|
|
167
167
|
"node": ">=12.0.0"
|
|
168
168
|
}
|
|
169
169
|
},
|
|
170
|
-
"node_modules/@google-cloud/pubsub/node_modules/@grpc/proto-loader": {
|
|
171
|
-
"version": "0.6.12",
|
|
172
|
-
"resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.6.12.tgz",
|
|
173
|
-
"integrity": "sha512-filTVbETFnxb9CyRX98zN18ilChTuf/C5scZ2xyaOTp0EHGq0/ufX8rjqXUcSb1Gpv7eZq4M2jDvbh9BogKnrg==",
|
|
174
|
-
"dependencies": {
|
|
175
|
-
"@types/long": "^4.0.1",
|
|
176
|
-
"lodash.camelcase": "^4.3.0",
|
|
177
|
-
"long": "^4.0.0",
|
|
178
|
-
"protobufjs": "^6.10.0",
|
|
179
|
-
"yargs": "^16.2.0"
|
|
180
|
-
},
|
|
181
|
-
"bin": {
|
|
182
|
-
"proto-loader-gen-types": "build/bin/proto-loader-gen-types.js"
|
|
183
|
-
},
|
|
184
|
-
"engines": {
|
|
185
|
-
"node": ">=6"
|
|
186
|
-
}
|
|
187
|
-
},
|
|
188
170
|
"node_modules/@google-cloud/pubsub/node_modules/debug": {
|
|
189
171
|
"version": "4.3.4",
|
|
190
172
|
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
|
@@ -343,15 +325,15 @@
|
|
|
343
325
|
"node": "^8.13.0 || >=10.10.0"
|
|
344
326
|
}
|
|
345
327
|
},
|
|
346
|
-
"node_modules/@grpc/
|
|
347
|
-
"version": "0.6.
|
|
348
|
-
"resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.6.
|
|
349
|
-
"integrity": "sha512-
|
|
328
|
+
"node_modules/@grpc/proto-loader": {
|
|
329
|
+
"version": "0.6.13",
|
|
330
|
+
"resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.6.13.tgz",
|
|
331
|
+
"integrity": "sha512-FjxPYDRTn6Ec3V0arm1FtSpmP6V50wuph2yILpyvTKzjc76oDdoihXqM1DzOW5ubvCC8GivfCnNtfaRE8myJ7g==",
|
|
350
332
|
"dependencies": {
|
|
351
333
|
"@types/long": "^4.0.1",
|
|
352
334
|
"lodash.camelcase": "^4.3.0",
|
|
353
335
|
"long": "^4.0.0",
|
|
354
|
-
"protobufjs": "^6.
|
|
336
|
+
"protobufjs": "^6.11.3",
|
|
355
337
|
"yargs": "^16.2.0"
|
|
356
338
|
},
|
|
357
339
|
"bin": {
|
|
@@ -3024,14 +3006,6 @@
|
|
|
3024
3006
|
"node": ">=10"
|
|
3025
3007
|
}
|
|
3026
3008
|
},
|
|
3027
|
-
"node_modules/google-p12-pem/node_modules/node-forge": {
|
|
3028
|
-
"version": "1.3.1",
|
|
3029
|
-
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz",
|
|
3030
|
-
"integrity": "sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==",
|
|
3031
|
-
"engines": {
|
|
3032
|
-
"node": ">= 6.13.0"
|
|
3033
|
-
}
|
|
3034
|
-
},
|
|
3035
3009
|
"node_modules/got": {
|
|
3036
3010
|
"version": "9.6.0",
|
|
3037
3011
|
"resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz",
|
|
@@ -3210,9 +3184,9 @@
|
|
|
3210
3184
|
}
|
|
3211
3185
|
},
|
|
3212
3186
|
"node_modules/https-proxy-agent": {
|
|
3213
|
-
"version": "5.0.
|
|
3214
|
-
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.
|
|
3215
|
-
"integrity": "sha512-
|
|
3187
|
+
"version": "5.0.1",
|
|
3188
|
+
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz",
|
|
3189
|
+
"integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==",
|
|
3216
3190
|
"dependencies": {
|
|
3217
3191
|
"agent-base": "6",
|
|
3218
3192
|
"debug": "4"
|
|
@@ -4539,6 +4513,14 @@
|
|
|
4539
4513
|
}
|
|
4540
4514
|
}
|
|
4541
4515
|
},
|
|
4516
|
+
"node_modules/node-forge": {
|
|
4517
|
+
"version": "1.3.1",
|
|
4518
|
+
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz",
|
|
4519
|
+
"integrity": "sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==",
|
|
4520
|
+
"engines": {
|
|
4521
|
+
"node": ">= 6.13.0"
|
|
4522
|
+
}
|
|
4523
|
+
},
|
|
4542
4524
|
"node_modules/node-gyp": {
|
|
4543
4525
|
"version": "9.1.0",
|
|
4544
4526
|
"resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-9.1.0.tgz",
|
|
@@ -7006,18 +6988,6 @@
|
|
|
7006
6988
|
"extend": "^3.0.2"
|
|
7007
6989
|
}
|
|
7008
6990
|
},
|
|
7009
|
-
"@grpc/proto-loader": {
|
|
7010
|
-
"version": "0.6.12",
|
|
7011
|
-
"resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.6.12.tgz",
|
|
7012
|
-
"integrity": "sha512-filTVbETFnxb9CyRX98zN18ilChTuf/C5scZ2xyaOTp0EHGq0/ufX8rjqXUcSb1Gpv7eZq4M2jDvbh9BogKnrg==",
|
|
7013
|
-
"requires": {
|
|
7014
|
-
"@types/long": "^4.0.1",
|
|
7015
|
-
"lodash.camelcase": "^4.3.0",
|
|
7016
|
-
"long": "^4.0.0",
|
|
7017
|
-
"protobufjs": "^6.10.0",
|
|
7018
|
-
"yargs": "^16.2.0"
|
|
7019
|
-
}
|
|
7020
|
-
},
|
|
7021
6991
|
"debug": {
|
|
7022
6992
|
"version": "4.3.4",
|
|
7023
6993
|
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
|
@@ -7138,20 +7108,18 @@
|
|
|
7138
7108
|
"requires": {
|
|
7139
7109
|
"@grpc/proto-loader": "^0.6.4",
|
|
7140
7110
|
"@types/node": ">=12.12.47"
|
|
7141
|
-
}
|
|
7142
|
-
|
|
7143
|
-
|
|
7144
|
-
|
|
7145
|
-
|
|
7146
|
-
|
|
7147
|
-
|
|
7148
|
-
|
|
7149
|
-
|
|
7150
|
-
|
|
7151
|
-
|
|
7152
|
-
|
|
7153
|
-
}
|
|
7154
|
-
}
|
|
7111
|
+
}
|
|
7112
|
+
},
|
|
7113
|
+
"@grpc/proto-loader": {
|
|
7114
|
+
"version": "0.6.13",
|
|
7115
|
+
"resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.6.13.tgz",
|
|
7116
|
+
"integrity": "sha512-FjxPYDRTn6Ec3V0arm1FtSpmP6V50wuph2yILpyvTKzjc76oDdoihXqM1DzOW5ubvCC8GivfCnNtfaRE8myJ7g==",
|
|
7117
|
+
"requires": {
|
|
7118
|
+
"@types/long": "^4.0.1",
|
|
7119
|
+
"lodash.camelcase": "^4.3.0",
|
|
7120
|
+
"long": "^4.0.0",
|
|
7121
|
+
"protobufjs": "^6.11.3",
|
|
7122
|
+
"yargs": "^16.2.0"
|
|
7155
7123
|
}
|
|
7156
7124
|
},
|
|
7157
7125
|
"@jsdevtools/ono": {
|
|
@@ -9246,13 +9214,6 @@
|
|
|
9246
9214
|
"integrity": "sha512-MC0jISvzymxePDVembypNefkAQp+DRP7dBE+zNUPaIjEspIlYg0++OrsNr248V9tPbz6iqtZ7rX1hxWA5B8qBQ==",
|
|
9247
9215
|
"requires": {
|
|
9248
9216
|
"node-forge": "^1.0.0"
|
|
9249
|
-
},
|
|
9250
|
-
"dependencies": {
|
|
9251
|
-
"node-forge": {
|
|
9252
|
-
"version": "1.3.1",
|
|
9253
|
-
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz",
|
|
9254
|
-
"integrity": "sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA=="
|
|
9255
|
-
}
|
|
9256
9217
|
}
|
|
9257
9218
|
},
|
|
9258
9219
|
"got": {
|
|
@@ -9402,9 +9363,9 @@
|
|
|
9402
9363
|
}
|
|
9403
9364
|
},
|
|
9404
9365
|
"https-proxy-agent": {
|
|
9405
|
-
"version": "5.0.
|
|
9406
|
-
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.
|
|
9407
|
-
"integrity": "sha512-
|
|
9366
|
+
"version": "5.0.1",
|
|
9367
|
+
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz",
|
|
9368
|
+
"integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==",
|
|
9408
9369
|
"requires": {
|
|
9409
9370
|
"agent-base": "6",
|
|
9410
9371
|
"debug": "4"
|
|
@@ -10434,6 +10395,11 @@
|
|
|
10434
10395
|
"whatwg-url": "^5.0.0"
|
|
10435
10396
|
}
|
|
10436
10397
|
},
|
|
10398
|
+
"node-forge": {
|
|
10399
|
+
"version": "1.3.1",
|
|
10400
|
+
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz",
|
|
10401
|
+
"integrity": "sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA=="
|
|
10402
|
+
},
|
|
10437
10403
|
"node-gyp": {
|
|
10438
10404
|
"version": "9.1.0",
|
|
10439
10405
|
"resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-9.1.0.tgz",
|
package/package.json
CHANGED
|
@@ -388,7 +388,8 @@
|
|
|
388
388
|
"nodejs10",
|
|
389
389
|
"nodejs12",
|
|
390
390
|
"nodejs14",
|
|
391
|
-
"nodejs16"
|
|
391
|
+
"nodejs16",
|
|
392
|
+
"nodejs18"
|
|
392
393
|
],
|
|
393
394
|
"type": "string"
|
|
394
395
|
},
|
|
@@ -442,7 +443,8 @@
|
|
|
442
443
|
"nodejs10",
|
|
443
444
|
"nodejs12",
|
|
444
445
|
"nodejs14",
|
|
445
|
-
"nodejs16"
|
|
446
|
+
"nodejs16",
|
|
447
|
+
"nodejs18"
|
|
446
448
|
],
|
|
447
449
|
"type": "string"
|
|
448
450
|
},
|