firebase-tools 11.13.0 → 11.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.
Files changed (65) hide show
  1. package/lib/commands/hosting-channel-deploy.js +10 -10
  2. package/lib/commands/hosting-channel-deploy.js.map +1 -1
  3. package/lib/deploy/functions/backend.js +14 -15
  4. package/lib/deploy/functions/backend.js.map +1 -1
  5. package/lib/deploy/hosting/{hostingDeploy.js → context.js} +1 -1
  6. package/lib/deploy/hosting/context.js.map +1 -0
  7. package/lib/deploy/hosting/convertConfig.js +107 -175
  8. package/lib/deploy/hosting/convertConfig.js.map +1 -1
  9. package/lib/deploy/hosting/deploy.js +5 -5
  10. package/lib/deploy/hosting/deploy.js.map +1 -1
  11. package/lib/deploy/hosting/prepare.js +13 -25
  12. package/lib/deploy/hosting/prepare.js.map +1 -1
  13. package/lib/deploy/hosting/release.js +20 -19
  14. package/lib/deploy/hosting/release.js.map +1 -1
  15. package/lib/deploy/index.js +1 -1
  16. package/lib/deploy/index.js.map +1 -1
  17. package/lib/emulator/controller.js +12 -2
  18. package/lib/emulator/controller.js.map +1 -1
  19. package/lib/emulator/downloadableEmulators.js +9 -7
  20. package/lib/emulator/downloadableEmulators.js.map +1 -1
  21. package/lib/emulator/firestoreEmulator.js +2 -2
  22. package/lib/emulator/firestoreEmulator.js.map +1 -1
  23. package/lib/emulator/functionsEmulator.js +36 -10
  24. package/lib/emulator/functionsEmulator.js.map +1 -1
  25. package/lib/emulator/functionsEmulatorRuntime.js +3 -6
  26. package/lib/emulator/functionsEmulatorRuntime.js.map +1 -1
  27. package/lib/emulator/functionsEmulatorShared.js +15 -4
  28. package/lib/emulator/functionsEmulatorShared.js.map +1 -1
  29. package/lib/experiments.js +10 -0
  30. package/lib/experiments.js.map +1 -1
  31. package/lib/frameworks/index.js +21 -6
  32. package/lib/frameworks/index.js.map +1 -1
  33. package/lib/functions/events/v2.js.map +1 -1
  34. package/lib/gcp/proto.js +28 -2
  35. package/lib/gcp/proto.js.map +1 -1
  36. package/lib/gcp/run.js +10 -1
  37. package/lib/gcp/run.js.map +1 -1
  38. package/lib/hosting/api.js +34 -15
  39. package/lib/hosting/api.js.map +1 -1
  40. package/lib/hosting/config.js +193 -0
  41. package/lib/hosting/config.js.map +1 -0
  42. package/lib/hosting/expireUtils.js +1 -1
  43. package/lib/hosting/expireUtils.js.map +1 -1
  44. package/lib/hosting/functionsProxy.js +12 -5
  45. package/lib/hosting/functionsProxy.js.map +1 -1
  46. package/lib/hosting/initMiddleware.js +5 -7
  47. package/lib/hosting/initMiddleware.js.map +1 -1
  48. package/lib/hosting/options.js +4 -0
  49. package/lib/hosting/options.js.map +1 -0
  50. package/lib/hosting/runTags.js +116 -0
  51. package/lib/hosting/runTags.js.map +1 -0
  52. package/lib/init/features/emulators.js +3 -0
  53. package/lib/init/features/emulators.js.map +1 -1
  54. package/lib/serve/hosting.js +11 -9
  55. package/lib/serve/hosting.js.map +1 -1
  56. package/npm-shrinkwrap.json +473 -853
  57. package/package.json +2 -2
  58. package/schema/firebase-config.json +321 -0
  59. package/lib/deploy/hosting/client.js +0 -10
  60. package/lib/deploy/hosting/client.js.map +0 -1
  61. package/lib/deploy/hosting/hostingDeploy.js.map +0 -1
  62. package/lib/deploy/hosting/validate.js +0 -42
  63. package/lib/deploy/hosting/validate.js.map +0 -1
  64. package/lib/hosting/normalizedHostingConfigs.js +0 -99
  65. package/lib/hosting/normalizedHostingConfigs.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "firebase-tools",
3
- "version": "11.13.0",
3
+ "version": "11.14.0",
4
4
  "description": "Command-Line Interface for Firebase",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {
@@ -106,7 +106,7 @@
106
106
  "stream-chain": "^2.2.4",
107
107
  "stream-json": "^1.7.3",
108
108
  "strip-ansi": "^6.0.1",
109
- "superstatic": "^8.0.0",
109
+ "superstatic": "^9.0.0",
110
110
  "tar": "^6.1.11",
111
111
  "tcp-port-used": "^1.0.2",
112
112
  "tmp": "^0.2.1",
@@ -266,6 +266,9 @@
266
266
  },
267
267
  "type": "object"
268
268
  },
269
+ "singleProjectMode": {
270
+ "type": "boolean"
271
+ },
269
272
  "storage": {
270
273
  "additionalProperties": false,
271
274
  "properties": {
@@ -459,6 +462,10 @@
459
462
  "additionalProperties": false,
460
463
  "properties": {
461
464
  "appAssociation": {
465
+ "enum": [
466
+ "AUTO",
467
+ "NONE"
468
+ ],
462
469
  "type": "string"
463
470
  },
464
471
  "cleanUrls": {
@@ -716,6 +723,37 @@
716
723
  ],
717
724
  "type": "object"
718
725
  },
726
+ {
727
+ "additionalProperties": false,
728
+ "properties": {
729
+ "function": {
730
+ "additionalProperties": false,
731
+ "properties": {
732
+ "functionId": {
733
+ "type": "string"
734
+ },
735
+ "pinTag": {
736
+ "type": "boolean"
737
+ },
738
+ "region": {
739
+ "type": "string"
740
+ }
741
+ },
742
+ "required": [
743
+ "functionId"
744
+ ],
745
+ "type": "object"
746
+ },
747
+ "glob": {
748
+ "type": "string"
749
+ }
750
+ },
751
+ "required": [
752
+ "function",
753
+ "glob"
754
+ ],
755
+ "type": "object"
756
+ },
719
757
  {
720
758
  "additionalProperties": false,
721
759
  "properties": {
@@ -725,6 +763,9 @@
725
763
  "run": {
726
764
  "additionalProperties": false,
727
765
  "properties": {
766
+ "pinTag": {
767
+ "type": "boolean"
768
+ },
728
769
  "region": {
729
770
  "type": "string"
730
771
  },
@@ -795,12 +836,46 @@
795
836
  ],
796
837
  "type": "object"
797
838
  },
839
+ {
840
+ "additionalProperties": false,
841
+ "properties": {
842
+ "function": {
843
+ "additionalProperties": false,
844
+ "properties": {
845
+ "functionId": {
846
+ "type": "string"
847
+ },
848
+ "pinTag": {
849
+ "type": "boolean"
850
+ },
851
+ "region": {
852
+ "type": "string"
853
+ }
854
+ },
855
+ "required": [
856
+ "functionId"
857
+ ],
858
+ "type": "object"
859
+ },
860
+ "source": {
861
+ "type": "string"
862
+ }
863
+ },
864
+ "required": [
865
+ "function",
866
+ "source"
867
+ ],
868
+ "type": "object"
869
+ },
798
870
  {
799
871
  "additionalProperties": false,
800
872
  "properties": {
801
873
  "run": {
802
874
  "additionalProperties": false,
803
875
  "properties": {
876
+ "pinTag": {
877
+ "type": "boolean"
878
+ },
804
879
  "region": {
805
880
  "type": "string"
806
881
  },
@@ -874,6 +949,37 @@
874
949
  ],
875
950
  "type": "object"
876
951
  },
952
+ {
953
+ "additionalProperties": false,
954
+ "properties": {
955
+ "function": {
956
+ "additionalProperties": false,
957
+ "properties": {
958
+ "functionId": {
959
+ "type": "string"
960
+ },
961
+ "pinTag": {
962
+ "type": "boolean"
963
+ },
964
+ "region": {
965
+ "type": "string"
966
+ }
967
+ },
968
+ "required": [
969
+ "functionId"
970
+ ],
971
+ "type": "object"
972
+ },
973
+ "regex": {
974
+ "type": "string"
975
+ }
976
+ },
977
+ "required": [
978
+ "function",
979
+ "regex"
980
+ ],
981
+ "type": "object"
982
+ },
877
983
  {
878
984
  "additionalProperties": false,
879
985
  "properties": {
@@ -883,6 +989,9 @@
883
989
  "run": {
884
990
  "additionalProperties": false,
885
991
  "properties": {
992
+ "pinTag": {
993
+ "type": "boolean"
994
+ },
886
995
  "region": {
887
996
  "type": "string"
888
997
  },
@@ -944,6 +1053,10 @@
944
1053
  "additionalProperties": false,
945
1054
  "properties": {
946
1055
  "appAssociation": {
1056
+ "enum": [
1057
+ "AUTO",
1058
+ "NONE"
1059
+ ],
947
1060
  "type": "string"
948
1061
  },
949
1062
  "cleanUrls": {
@@ -1201,6 +1314,37 @@
1201
1314
  ],
1202
1315
  "type": "object"
1203
1316
  },
1317
+ {
1318
+ "additionalProperties": false,
1319
+ "properties": {
1320
+ "function": {
1321
+ "additionalProperties": false,
1322
+ "properties": {
1323
+ "functionId": {
1324
+ "type": "string"
1325
+ },
1326
+ "pinTag": {
1327
+ "type": "boolean"
1328
+ },
1329
+ "region": {
1330
+ "type": "string"
1331
+ }
1332
+ },
1333
+ "required": [
1334
+ "functionId"
1335
+ ],
1336
+ "type": "object"
1337
+ },
1338
+ "glob": {
1339
+ "type": "string"
1340
+ }
1341
+ },
1342
+ "required": [
1343
+ "function",
1344
+ "glob"
1345
+ ],
1346
+ "type": "object"
1347
+ },
1204
1348
  {
1205
1349
  "additionalProperties": false,
1206
1350
  "properties": {
@@ -1210,6 +1354,9 @@
1210
1354
  "run": {
1211
1355
  "additionalProperties": false,
1212
1356
  "properties": {
1357
+ "pinTag": {
1358
+ "type": "boolean"
1359
+ },
1213
1360
  "region": {
1214
1361
  "type": "string"
1215
1362
  },
@@ -1280,12 +1427,46 @@
1280
1427
  ],
1281
1428
  "type": "object"
1282
1429
  },
1430
+ {
1431
+ "additionalProperties": false,
1432
+ "properties": {
1433
+ "function": {
1434
+ "additionalProperties": false,
1435
+ "properties": {
1436
+ "functionId": {
1437
+ "type": "string"
1438
+ },
1439
+ "pinTag": {
1440
+ "type": "boolean"
1441
+ },
1442
+ "region": {
1443
+ "type": "string"
1444
+ }
1445
+ },
1446
+ "required": [
1447
+ "functionId"
1448
+ ],
1449
+ "type": "object"
1450
+ },
1451
+ "source": {
1452
+ "type": "string"
1453
+ }
1454
+ },
1455
+ "required": [
1456
+ "function",
1457
+ "source"
1458
+ ],
1459
+ "type": "object"
1460
+ },
1283
1461
  {
1284
1462
  "additionalProperties": false,
1285
1463
  "properties": {
1286
1464
  "run": {
1287
1465
  "additionalProperties": false,
1288
1466
  "properties": {
1467
+ "pinTag": {
1468
+ "type": "boolean"
1469
+ },
1289
1470
  "region": {
1290
1471
  "type": "string"
1291
1472
  },
@@ -1359,6 +1540,37 @@
1359
1540
  ],
1360
1541
  "type": "object"
1361
1542
  },
1543
+ {
1544
+ "additionalProperties": false,
1545
+ "properties": {
1546
+ "function": {
1547
+ "additionalProperties": false,
1548
+ "properties": {
1549
+ "functionId": {
1550
+ "type": "string"
1551
+ },
1552
+ "pinTag": {
1553
+ "type": "boolean"
1554
+ },
1555
+ "region": {
1556
+ "type": "string"
1557
+ }
1558
+ },
1559
+ "required": [
1560
+ "functionId"
1561
+ ],
1562
+ "type": "object"
1563
+ },
1564
+ "regex": {
1565
+ "type": "string"
1566
+ }
1567
+ },
1568
+ "required": [
1569
+ "function",
1570
+ "regex"
1571
+ ],
1572
+ "type": "object"
1573
+ },
1362
1574
  {
1363
1575
  "additionalProperties": false,
1364
1576
  "properties": {
@@ -1368,6 +1580,9 @@
1368
1580
  "run": {
1369
1581
  "additionalProperties": false,
1370
1582
  "properties": {
1583
+ "pinTag": {
1584
+ "type": "boolean"
1585
+ },
1371
1586
  "region": {
1372
1587
  "type": "string"
1373
1588
  },
@@ -1429,6 +1644,10 @@
1429
1644
  "additionalProperties": false,
1430
1645
  "properties": {
1431
1646
  "appAssociation": {
1647
+ "enum": [
1648
+ "AUTO",
1649
+ "NONE"
1650
+ ],
1432
1651
  "type": "string"
1433
1652
  },
1434
1653
  "cleanUrls": {
@@ -1686,6 +1905,37 @@
1686
1905
  ],
1687
1906
  "type": "object"
1688
1907
  },
1908
+ {
1909
+ "additionalProperties": false,
1910
+ "properties": {
1911
+ "function": {
1912
+ "additionalProperties": false,
1913
+ "properties": {
1914
+ "functionId": {
1915
+ "type": "string"
1916
+ },
1917
+ "pinTag": {
1918
+ "type": "boolean"
1919
+ },
1920
+ "region": {
1921
+ "type": "string"
1922
+ }
1923
+ },
1924
+ "required": [
1925
+ "functionId"
1926
+ ],
1927
+ "type": "object"
1928
+ },
1929
+ "glob": {
1930
+ "type": "string"
1931
+ }
1932
+ },
1933
+ "required": [
1934
+ "function",
1935
+ "glob"
1936
+ ],
1937
+ "type": "object"
1938
+ },
1689
1939
  {
1690
1940
  "additionalProperties": false,
1691
1941
  "properties": {
@@ -1695,6 +1945,9 @@
1695
1945
  "run": {
1696
1946
  "additionalProperties": false,
1697
1947
  "properties": {
1948
+ "pinTag": {
1949
+ "type": "boolean"
1950
+ },
1698
1951
  "region": {
1699
1952
  "type": "string"
1700
1953
  },
@@ -1765,12 +2018,46 @@
1765
2018
  ],
1766
2019
  "type": "object"
1767
2020
  },
2021
+ {
2022
+ "additionalProperties": false,
2023
+ "properties": {
2024
+ "function": {
2025
+ "additionalProperties": false,
2026
+ "properties": {
2027
+ "functionId": {
2028
+ "type": "string"
2029
+ },
2030
+ "pinTag": {
2031
+ "type": "boolean"
2032
+ },
2033
+ "region": {
2034
+ "type": "string"
2035
+ }
2036
+ },
2037
+ "required": [
2038
+ "functionId"
2039
+ ],
2040
+ "type": "object"
2041
+ },
2042
+ "source": {
2043
+ "type": "string"
2044
+ }
2045
+ },
2046
+ "required": [
2047
+ "function",
2048
+ "source"
2049
+ ],
2050
+ "type": "object"
2051
+ },
1768
2052
  {
1769
2053
  "additionalProperties": false,
1770
2054
  "properties": {
1771
2055
  "run": {
1772
2056
  "additionalProperties": false,
1773
2057
  "properties": {
2058
+ "pinTag": {
2059
+ "type": "boolean"
2060
+ },
1774
2061
  "region": {
1775
2062
  "type": "string"
1776
2063
  },
@@ -1844,6 +2131,37 @@
1844
2131
  ],
1845
2132
  "type": "object"
1846
2133
  },
2134
+ {
2135
+ "additionalProperties": false,
2136
+ "properties": {
2137
+ "function": {
2138
+ "additionalProperties": false,
2139
+ "properties": {
2140
+ "functionId": {
2141
+ "type": "string"
2142
+ },
2143
+ "pinTag": {
2144
+ "type": "boolean"
2145
+ },
2146
+ "region": {
2147
+ "type": "string"
2148
+ }
2149
+ },
2150
+ "required": [
2151
+ "functionId"
2152
+ ],
2153
+ "type": "object"
2154
+ },
2155
+ "regex": {
2156
+ "type": "string"
2157
+ }
2158
+ },
2159
+ "required": [
2160
+ "function",
2161
+ "regex"
2162
+ ],
2163
+ "type": "object"
2164
+ },
1847
2165
  {
1848
2166
  "additionalProperties": false,
1849
2167
  "properties": {
@@ -1853,6 +2171,9 @@
1853
2171
  "run": {
1854
2172
  "additionalProperties": false,
1855
2173
  "properties": {
2174
+ "pinTag": {
2175
+ "type": "boolean"
2176
+ },
1856
2177
  "region": {
1857
2178
  "type": "string"
1858
2179
  },
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.client = void 0;
4
- const api_1 = require("../../api");
5
- const apiv2_1 = require("../../apiv2");
6
- exports.client = new apiv2_1.Client({
7
- urlPrefix: api_1.hostingApiOrigin,
8
- apiVersion: "v1beta1",
9
- });
10
- //# sourceMappingURL=client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/deploy/hosting/client.ts"],"names":[],"mappings":";;;AAAA,mCAA6C;AAC7C,uCAAqC;AAExB,QAAA,MAAM,GAAG,IAAI,cAAM,CAAC;IAC/B,SAAS,EAAE,sBAAgB;IAC3B,UAAU,EAAE,SAAS;CACtB,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"hostingDeploy.js","sourceRoot":"","sources":["../../../src/deploy/hosting/hostingDeploy.ts"],"names":[],"mappings":""}
@@ -1,42 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateDeploy = void 0;
4
- const path = require("path");
5
- const clc = require("colorette");
6
- const error_1 = require("../../error");
7
- const projectPath_1 = require("../../projectPath");
8
- const fsutils_1 = require("../../fsutils");
9
- const utils_1 = require("../../utils");
10
- function validateDeploy(deploy, options) {
11
- var _a, _b, _c;
12
- const cfg = deploy.config;
13
- const hasPublicDir = !!cfg.public;
14
- const hasAnyStaticRewrites = !!((_a = (cfg.rewrites || []).filter((rw) => rw.destination)) === null || _a === void 0 ? void 0 : _a.length);
15
- const hasAnyDynamicRewrites = !!((_b = (cfg.rewrites || []).filter((rw) => !rw.destination)) === null || _b === void 0 ? void 0 : _b.length);
16
- const hasAnyRedirects = !!((_c = cfg.redirects) === null || _c === void 0 ? void 0 : _c.length);
17
- if (!hasPublicDir && hasAnyStaticRewrites) {
18
- throw new error_1.FirebaseError('Must supply a "public" directory when using "destination" rewrites.');
19
- }
20
- if (!hasPublicDir && !hasAnyDynamicRewrites && !hasAnyRedirects) {
21
- throw new error_1.FirebaseError('Must supply a "public" directory or at least one rewrite or redirect in each "hosting" config.');
22
- }
23
- if (hasPublicDir && !(0, fsutils_1.dirExistsSync)((0, projectPath_1.resolveProjectPath)(options, cfg.public))) {
24
- throw new error_1.FirebaseError(`Specified "public" directory "${cfg.public}" does not exist, can't deploy hosting to site "${deploy.site}"`);
25
- }
26
- if (cfg.i18n) {
27
- if (!hasPublicDir) {
28
- throw new error_1.FirebaseError('Must supply a "public" directory when using "i18n" configuration.');
29
- }
30
- if (!cfg.i18n.root) {
31
- throw new error_1.FirebaseError('Must supply a "root" in "i18n" config.');
32
- }
33
- else {
34
- const i18nPath = path.join(cfg.public, cfg.i18n.root);
35
- if (!(0, fsutils_1.dirExistsSync)((0, projectPath_1.resolveProjectPath)(options, i18nPath))) {
36
- (0, utils_1.logLabeledWarning)("hosting", `Couldn't find specified i18n root directory ${clc.bold(cfg.i18n.root)} in public directory ${clc.bold(cfg.public || "")}.`);
37
- }
38
- }
39
- }
40
- }
41
- exports.validateDeploy = validateDeploy;
42
- //# sourceMappingURL=validate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../src/deploy/hosting/validate.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAC7B,iCAAiC;AAEjC,uCAA4C;AAC5C,mDAAuD;AACvD,2CAA8C;AAC9C,uCAAgD;AAGhD,SAAgB,cAAc,CAAC,MAAqB,EAAE,OAAY;;IAChE,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC;IAE1B,MAAM,YAAY,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC;IAClC,MAAM,oBAAoB,GAAG,CAAC,CAAC,CAAA,MAAA,CAAC,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,WAAW,CAAC,0CAAE,MAAM,CAAA,CAAC;IAC3F,MAAM,qBAAqB,GAAG,CAAC,CAAC,CAAA,MAAA,CAAC,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,WAAW,CAAC,0CAAE,MAAM,CAAA,CAAC;IAC7F,MAAM,eAAe,GAAG,CAAC,CAAC,CAAA,MAAA,GAAG,CAAC,SAAS,0CAAE,MAAM,CAAA,CAAC;IAEhD,IAAI,CAAC,YAAY,IAAI,oBAAoB,EAAE;QACzC,MAAM,IAAI,qBAAa,CAAC,qEAAqE,CAAC,CAAC;KAChG;IAED,IAAI,CAAC,YAAY,IAAI,CAAC,qBAAqB,IAAI,CAAC,eAAe,EAAE;QAC/D,MAAM,IAAI,qBAAa,CACrB,gGAAgG,CACjG,CAAC;KACH;IAED,IAAI,YAAY,IAAI,CAAC,IAAA,uBAAa,EAAC,IAAA,gCAAkB,EAAC,OAAO,EAAE,GAAG,CAAC,MAAO,CAAC,CAAC,EAAE;QAC5E,MAAM,IAAI,qBAAa,CACrB,iCAAiC,GAAG,CAAC,MAAM,mDAAmD,MAAM,CAAC,IAAI,GAAG,CAC7G,CAAC;KACH;IAED,IAAI,GAAG,CAAC,IAAI,EAAE;QACZ,IAAI,CAAC,YAAY,EAAE;YACjB,MAAM,IAAI,qBAAa,CAAC,mEAAmE,CAAC,CAAC;SAC9F;QAED,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE;YAClB,MAAM,IAAI,qBAAa,CAAC,wCAAwC,CAAC,CAAC;SACnE;aAAM;YACL,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAO,EAAE,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACvD,IAAI,CAAC,IAAA,uBAAa,EAAC,IAAA,gCAAkB,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,EAAE;gBACzD,IAAA,yBAAiB,EACf,SAAS,EACT,+CAA+C,GAAG,CAAC,IAAI,CACrD,GAAG,CAAC,IAAI,CAAC,IAAI,CACd,wBAAwB,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,IAAI,EAAE,CAAC,GAAG,CACvD,CAAC;aACH;SACF;KACF;AACH,CAAC;AA3CD,wCA2CC"}
@@ -1,99 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.normalizedHostingConfigs = void 0;
4
- const colorette_1 = require("colorette");
5
- const lodash_1 = require("lodash");
6
- const error_1 = require("../error");
7
- function filterOnly(configs, onlyString) {
8
- if (!onlyString) {
9
- return configs;
10
- }
11
- let onlyTargets = onlyString.split(",");
12
- if (onlyTargets.includes("hosting")) {
13
- return configs;
14
- }
15
- onlyTargets = onlyTargets
16
- .filter((target) => target.startsWith("hosting:"))
17
- .map((target) => target.replace("hosting:", ""));
18
- const configsBySite = new Map();
19
- const configsByTarget = new Map();
20
- for (const c of configs) {
21
- if (c.site) {
22
- configsBySite.set(c.site, c);
23
- }
24
- if (c.target) {
25
- configsByTarget.set(c.target, c);
26
- }
27
- }
28
- const filteredConfigs = [];
29
- for (const onlyTarget of onlyTargets) {
30
- if (configsBySite.has(onlyTarget)) {
31
- filteredConfigs.push(configsBySite.get(onlyTarget));
32
- }
33
- else if (configsByTarget.has(onlyTarget)) {
34
- filteredConfigs.push(configsByTarget.get(onlyTarget));
35
- }
36
- else {
37
- throw new error_1.FirebaseError(`Hosting site or target ${(0, colorette_1.bold)(onlyTarget)} not detected in firebase.json`);
38
- }
39
- }
40
- return filteredConfigs;
41
- }
42
- function filterExcept(configs, exceptOption) {
43
- if (!exceptOption) {
44
- return configs;
45
- }
46
- const exceptTargets = exceptOption.split(",");
47
- if (exceptTargets.includes("hosting")) {
48
- return [];
49
- }
50
- const exceptValues = new Set(exceptTargets.filter((t) => t.startsWith("hosting:")).map((t) => t.replace("hosting:", "")));
51
- const filteredConfigs = [];
52
- for (const c of configs) {
53
- if (!(exceptValues.has(c.site) || exceptValues.has(c.target))) {
54
- filteredConfigs.push(c);
55
- }
56
- }
57
- return filteredConfigs;
58
- }
59
- function normalizedHostingConfigs(cmdOptions, options = {}) {
60
- const normalizedHostingConfigs = cmdOptions.normalizedHostingConfigs;
61
- if (normalizedHostingConfigs)
62
- return normalizedHostingConfigs;
63
- let configs = (0, lodash_1.cloneDeep)(cmdOptions.config.get("hosting"));
64
- if (!configs) {
65
- return [];
66
- }
67
- if (!Array.isArray(configs)) {
68
- if (!configs.target && !configs.site) {
69
- configs.site = cmdOptions.site;
70
- }
71
- configs = [configs];
72
- }
73
- for (const c of configs) {
74
- if (c.target && c.site) {
75
- throw new error_1.FirebaseError(`Hosting configs should only include either "site" or "target", not both.`);
76
- }
77
- }
78
- let hostingConfigs = filterOnly(configs, cmdOptions.only);
79
- hostingConfigs = filterExcept(hostingConfigs, cmdOptions.except);
80
- if (options.resolveTargets) {
81
- for (const cfg of hostingConfigs) {
82
- if (cfg.target) {
83
- const matchingTargets = cmdOptions.rc.requireTarget(cmdOptions.project, "hosting", cfg.target);
84
- if (matchingTargets.length > 1) {
85
- throw new error_1.FirebaseError(`Hosting target ${(0, colorette_1.bold)(cfg.target)} is linked to multiple sites, ` +
86
- `but only one is permitted. ` +
87
- `To clear, run:\n\n firebase target:clear hosting ${cfg.target}`);
88
- }
89
- cfg.site = matchingTargets[0];
90
- }
91
- else if (!cfg.site) {
92
- throw new error_1.FirebaseError('Must supply either "site" or "target" in each "hosting" config.');
93
- }
94
- }
95
- }
96
- return hostingConfigs;
97
- }
98
- exports.normalizedHostingConfigs = normalizedHostingConfigs;
99
- //# sourceMappingURL=normalizedHostingConfigs.js.map