@wix/cli 1.1.61 → 1.1.62
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/build/{DevCommand-3CEY3HPC.js → DevCommand-NWZ75YTP.js} +11 -12
- package/build/{DevCommand-3CEY3HPC.js.map → DevCommand-NWZ75YTP.js.map} +1 -1
- package/build/{DevCommand-NPVKUDPR.js → DevCommand-ZNHBPCVV.js} +13 -14
- package/build/{DevCommand-NPVKUDPR.js.map → DevCommand-ZNHBPCVV.js.map} +1 -1
- package/build/{LoginCommand-RTNDZF77.js → LoginCommand-AQIYGH36.js} +9 -9
- package/build/{LogoutCommand-CUOS2BUH.js → LogoutCommand-LPI7NUZJ.js} +6 -6
- package/build/{PreviewCommand-5GAG7MBS.js → PreviewCommand-666UOTAN.js} +12 -12
- package/build/{WhoamiCommand-VZ6KKOVQ.js → WhoamiCommand-BWXA3TXF.js} +3 -3
- package/build/{chunk-DP2BL2V4.js → chunk-45UEHUOD.js} +6 -6
- package/build/{chunk-J573TQNU.js → chunk-4YD2W3LA.js} +2 -2
- package/build/{chunk-332V5RP4.js → chunk-4ZQFECEW.js} +41 -14
- package/build/{chunk-332V5RP4.js.map → chunk-4ZQFECEW.js.map} +1 -1
- package/build/{chunk-HV2IEAOB.js → chunk-55EFTE5M.js} +2 -2
- package/build/{chunk-N3OHN3MH.js → chunk-A6TCWKZD.js} +4 -4
- package/build/{chunk-N3OHN3MH.js.map → chunk-A6TCWKZD.js.map} +1 -1
- package/build/{chunk-2KK3GKES.js → chunk-D6HNYFE6.js} +5 -5
- package/build/{chunk-HMGX4HL2.js → chunk-DTRL25IG.js} +6 -6
- package/build/{chunk-XFEYPXEY.js → chunk-DVR2CMCO.js} +3 -3
- package/build/{chunk-3UE73ERL.js → chunk-ETAVRPIY.js} +2 -2
- package/build/{chunk-G4NFI3XC.js → chunk-G34I4OXF.js} +3 -3
- package/build/{chunk-3NEXZN7N.js → chunk-IPI4IXDD.js} +8 -8
- package/build/chunk-IPI4IXDD.js.map +1 -0
- package/build/{chunk-Q3GS63B5.js → chunk-JIH3GSZJ.js} +2 -2
- package/build/{chunk-PTIE2TCP.js → chunk-LWQGSEXR.js} +2 -2
- package/build/{chunk-P4UAXEEN.js → chunk-NLMXNKQO.js} +8 -8
- package/build/{chunk-M34KVUTA.js → chunk-OEYFKLWJ.js} +2 -2
- package/build/{chunk-B5A3CFP2.js → chunk-OOWNEBOM.js} +2 -2
- package/build/{chunk-6K6VPM3T.js → chunk-OSWRZGLN.js} +4 -4
- package/build/{chunk-DEO7G3RD.js → chunk-PF4VD6IT.js} +5 -5
- package/build/{chunk-6YVNZGPU.js → chunk-TCSPCAZI.js} +2 -2
- package/build/{chunk-V7JWKPQI.js → chunk-WJQFCMN3.js} +4 -4
- package/build/{chunk-77YDQA7O.js → chunk-XOFZJ3JQ.js} +5 -5
- package/build/{chunk-L53ZVQB7.js → chunk-Y5LMYOCJ.js} +472 -7
- package/build/chunk-Y5LMYOCJ.js.map +1 -0
- package/build/{chunk-H6BDO22X.js → chunk-YQW75RJ5.js} +9 -5
- package/build/{chunk-H6BDO22X.js.map → chunk-YQW75RJ5.js.map} +1 -1
- package/build/{chunk-KOGQSQ4I.js → chunk-YYH6VZI3.js} +3 -14
- package/build/{chunk-KOGQSQ4I.js.map → chunk-YYH6VZI3.js.map} +1 -1
- package/build/{chunk-ZVHSVTAJ.js → chunk-ZIXYUOVJ.js} +3 -3
- package/build/{chunk-2WA6TGDO.js → chunk-ZR5EKZZ3.js} +4 -4
- package/build/{dev-FOGJASYZ.js → dev-B7FMRZWG.js} +19 -20
- package/build/dev-B7FMRZWG.js.map +1 -0
- package/build/index.js +3549 -10598
- package/build/index.js.map +1 -1
- package/build/{install-NSVJU2EB.js → install-B37NJYMG.js} +13 -13
- package/build/{preview-RQ5CLHV5.js → preview-W5ZYLI5U.js} +16 -16
- package/build/{publish-YWESFDVY.js → publish-KZKBMTND.js} +16 -16
- package/build/{render-command-E3JPPTZA.js → render-command-FWDU3W5M.js} +9 -9
- package/build/{render-command-4GOKWOT7.js → render-command-S7D3MWYC.js} +8 -8
- package/build/{render-command-WMEIFR3G.js → render-command-TKO7PYVO.js} +9 -9
- package/build/{run-command-D54S2NI5.js → run-command-YYML7BJX.js} +6 -6
- package/build/{src-IIEVMGC3.js → src-5VO6B75Q.js} +16 -16
- package/build/{src-NGHHXRWJ.js → src-DVFFJLN5.js} +2 -2
- package/build/{src-HA6XHM2E.js → src-GQFPGSHL.js} +6 -6
- package/build/{src-4W7XB5DS.js → src-IMPYJZRW.js} +7 -7
- package/build/{src-OIVJ4AKD.js → src-SCGDSQRH.js} +4 -4
- package/build/{src-NS46VL23.js → src-WV4RZ4FT.js} +5 -5
- package/build/{sync-types-SQEHJPEG.js → sync-types-M76E2RFC.js} +11 -12
- package/build/{uninstall-ASZ55QZA.js → uninstall-LDNBVTQR.js} +13 -13
- package/package.json +2 -2
- package/build/chunk-3NEXZN7N.js.map +0 -1
- package/build/chunk-L53ZVQB7.js.map +0 -1
- package/build/chunk-YXFEXGAH.js +0 -479
- package/build/chunk-YXFEXGAH.js.map +0 -1
- package/build/dev-FOGJASYZ.js.map +0 -1
- /package/build/{LoginCommand-RTNDZF77.js.map → LoginCommand-AQIYGH36.js.map} +0 -0
- /package/build/{LogoutCommand-CUOS2BUH.js.map → LogoutCommand-LPI7NUZJ.js.map} +0 -0
- /package/build/{PreviewCommand-5GAG7MBS.js.map → PreviewCommand-666UOTAN.js.map} +0 -0
- /package/build/{WhoamiCommand-VZ6KKOVQ.js.map → WhoamiCommand-BWXA3TXF.js.map} +0 -0
- /package/build/{chunk-DP2BL2V4.js.map → chunk-45UEHUOD.js.map} +0 -0
- /package/build/{chunk-J573TQNU.js.map → chunk-4YD2W3LA.js.map} +0 -0
- /package/build/{chunk-HV2IEAOB.js.map → chunk-55EFTE5M.js.map} +0 -0
- /package/build/{chunk-2KK3GKES.js.map → chunk-D6HNYFE6.js.map} +0 -0
- /package/build/{chunk-HMGX4HL2.js.map → chunk-DTRL25IG.js.map} +0 -0
- /package/build/{chunk-XFEYPXEY.js.map → chunk-DVR2CMCO.js.map} +0 -0
- /package/build/{chunk-3UE73ERL.js.map → chunk-ETAVRPIY.js.map} +0 -0
- /package/build/{chunk-G4NFI3XC.js.map → chunk-G34I4OXF.js.map} +0 -0
- /package/build/{chunk-Q3GS63B5.js.map → chunk-JIH3GSZJ.js.map} +0 -0
- /package/build/{chunk-PTIE2TCP.js.map → chunk-LWQGSEXR.js.map} +0 -0
- /package/build/{chunk-P4UAXEEN.js.map → chunk-NLMXNKQO.js.map} +0 -0
- /package/build/{chunk-M34KVUTA.js.map → chunk-OEYFKLWJ.js.map} +0 -0
- /package/build/{chunk-B5A3CFP2.js.map → chunk-OOWNEBOM.js.map} +0 -0
- /package/build/{chunk-6K6VPM3T.js.map → chunk-OSWRZGLN.js.map} +0 -0
- /package/build/{chunk-DEO7G3RD.js.map → chunk-PF4VD6IT.js.map} +0 -0
- /package/build/{chunk-6YVNZGPU.js.map → chunk-TCSPCAZI.js.map} +0 -0
- /package/build/{chunk-V7JWKPQI.js.map → chunk-WJQFCMN3.js.map} +0 -0
- /package/build/{chunk-77YDQA7O.js.map → chunk-XOFZJ3JQ.js.map} +0 -0
- /package/build/{chunk-ZVHSVTAJ.js.map → chunk-ZIXYUOVJ.js.map} +0 -0
- /package/build/{chunk-2WA6TGDO.js.map → chunk-ZR5EKZZ3.js.map} +0 -0
- /package/build/{install-NSVJU2EB.js.map → install-B37NJYMG.js.map} +0 -0
- /package/build/{preview-RQ5CLHV5.js.map → preview-W5ZYLI5U.js.map} +0 -0
- /package/build/{publish-YWESFDVY.js.map → publish-KZKBMTND.js.map} +0 -0
- /package/build/{render-command-E3JPPTZA.js.map → render-command-FWDU3W5M.js.map} +0 -0
- /package/build/{render-command-4GOKWOT7.js.map → render-command-S7D3MWYC.js.map} +0 -0
- /package/build/{render-command-WMEIFR3G.js.map → render-command-TKO7PYVO.js.map} +0 -0
- /package/build/{run-command-D54S2NI5.js.map → run-command-YYML7BJX.js.map} +0 -0
- /package/build/{src-IIEVMGC3.js.map → src-5VO6B75Q.js.map} +0 -0
- /package/build/{src-HA6XHM2E.js.map → src-DVFFJLN5.js.map} +0 -0
- /package/build/{src-NGHHXRWJ.js.map → src-GQFPGSHL.js.map} +0 -0
- /package/build/{src-4W7XB5DS.js.map → src-IMPYJZRW.js.map} +0 -0
- /package/build/{src-OIVJ4AKD.js.map → src-SCGDSQRH.js.map} +0 -0
- /package/build/{src-NS46VL23.js.map → src-WV4RZ4FT.js.map} +0 -0
- /package/build/{sync-types-SQEHJPEG.js.map → sync-types-M76E2RFC.js.map} +0 -0
- /package/build/{uninstall-ASZ55QZA.js.map → uninstall-LDNBVTQR.js.map} +0 -0
package/build/chunk-YXFEXGAH.js
DELETED
|
@@ -1,479 +0,0 @@
|
|
|
1
|
-
import { createRequire as _createRequire } from 'node:module';
|
|
2
|
-
const require = _createRequire(import.meta.url);
|
|
3
|
-
import {
|
|
4
|
-
__commonJS,
|
|
5
|
-
init_esm_shims
|
|
6
|
-
} from "./chunk-PYIAC2GK.js";
|
|
7
|
-
|
|
8
|
-
// ../../node_modules/http-cache-semantics/index.js
|
|
9
|
-
var require_http_cache_semantics = __commonJS({
|
|
10
|
-
"../../node_modules/http-cache-semantics/index.js"(exports, module) {
|
|
11
|
-
"use strict";
|
|
12
|
-
init_esm_shims();
|
|
13
|
-
var statusCodeCacheableByDefault = /* @__PURE__ */ new Set([
|
|
14
|
-
200,
|
|
15
|
-
203,
|
|
16
|
-
204,
|
|
17
|
-
206,
|
|
18
|
-
300,
|
|
19
|
-
301,
|
|
20
|
-
308,
|
|
21
|
-
404,
|
|
22
|
-
405,
|
|
23
|
-
410,
|
|
24
|
-
414,
|
|
25
|
-
501
|
|
26
|
-
]);
|
|
27
|
-
var understoodStatuses = /* @__PURE__ */ new Set([
|
|
28
|
-
200,
|
|
29
|
-
203,
|
|
30
|
-
204,
|
|
31
|
-
300,
|
|
32
|
-
301,
|
|
33
|
-
302,
|
|
34
|
-
303,
|
|
35
|
-
307,
|
|
36
|
-
308,
|
|
37
|
-
404,
|
|
38
|
-
405,
|
|
39
|
-
410,
|
|
40
|
-
414,
|
|
41
|
-
501
|
|
42
|
-
]);
|
|
43
|
-
var errorStatusCodes = /* @__PURE__ */ new Set([
|
|
44
|
-
500,
|
|
45
|
-
502,
|
|
46
|
-
503,
|
|
47
|
-
504
|
|
48
|
-
]);
|
|
49
|
-
var hopByHopHeaders = {
|
|
50
|
-
date: true,
|
|
51
|
-
// included, because we add Age update Date
|
|
52
|
-
connection: true,
|
|
53
|
-
"keep-alive": true,
|
|
54
|
-
"proxy-authenticate": true,
|
|
55
|
-
"proxy-authorization": true,
|
|
56
|
-
te: true,
|
|
57
|
-
trailer: true,
|
|
58
|
-
"transfer-encoding": true,
|
|
59
|
-
upgrade: true
|
|
60
|
-
};
|
|
61
|
-
var excludedFromRevalidationUpdate = {
|
|
62
|
-
// Since the old body is reused, it doesn't make sense to change properties of the body
|
|
63
|
-
"content-length": true,
|
|
64
|
-
"content-encoding": true,
|
|
65
|
-
"transfer-encoding": true,
|
|
66
|
-
"content-range": true
|
|
67
|
-
};
|
|
68
|
-
function toNumberOrZero(s) {
|
|
69
|
-
const n = parseInt(s, 10);
|
|
70
|
-
return isFinite(n) ? n : 0;
|
|
71
|
-
}
|
|
72
|
-
function isErrorResponse(response) {
|
|
73
|
-
if (!response) {
|
|
74
|
-
return true;
|
|
75
|
-
}
|
|
76
|
-
return errorStatusCodes.has(response.status);
|
|
77
|
-
}
|
|
78
|
-
function parseCacheControl(header) {
|
|
79
|
-
const cc = {};
|
|
80
|
-
if (!header) return cc;
|
|
81
|
-
const parts = header.trim().split(/,/);
|
|
82
|
-
for (const part of parts) {
|
|
83
|
-
const [k, v] = part.split(/=/, 2);
|
|
84
|
-
cc[k.trim()] = v === void 0 ? true : v.trim().replace(/^"|"$/g, "");
|
|
85
|
-
}
|
|
86
|
-
return cc;
|
|
87
|
-
}
|
|
88
|
-
function formatCacheControl(cc) {
|
|
89
|
-
let parts = [];
|
|
90
|
-
for (const k in cc) {
|
|
91
|
-
const v = cc[k];
|
|
92
|
-
parts.push(v === true ? k : k + "=" + v);
|
|
93
|
-
}
|
|
94
|
-
if (!parts.length) {
|
|
95
|
-
return void 0;
|
|
96
|
-
}
|
|
97
|
-
return parts.join(", ");
|
|
98
|
-
}
|
|
99
|
-
module.exports = class CachePolicy {
|
|
100
|
-
constructor(req, res, {
|
|
101
|
-
shared,
|
|
102
|
-
cacheHeuristic,
|
|
103
|
-
immutableMinTimeToLive,
|
|
104
|
-
ignoreCargoCult,
|
|
105
|
-
_fromObject
|
|
106
|
-
} = {}) {
|
|
107
|
-
if (_fromObject) {
|
|
108
|
-
this._fromObject(_fromObject);
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
if (!res || !res.headers) {
|
|
112
|
-
throw Error("Response headers missing");
|
|
113
|
-
}
|
|
114
|
-
this._assertRequestHasHeaders(req);
|
|
115
|
-
this._responseTime = this.now();
|
|
116
|
-
this._isShared = shared !== false;
|
|
117
|
-
this._cacheHeuristic = void 0 !== cacheHeuristic ? cacheHeuristic : 0.1;
|
|
118
|
-
this._immutableMinTtl = void 0 !== immutableMinTimeToLive ? immutableMinTimeToLive : 24 * 3600 * 1e3;
|
|
119
|
-
this._status = "status" in res ? res.status : 200;
|
|
120
|
-
this._resHeaders = res.headers;
|
|
121
|
-
this._rescc = parseCacheControl(res.headers["cache-control"]);
|
|
122
|
-
this._method = "method" in req ? req.method : "GET";
|
|
123
|
-
this._url = req.url;
|
|
124
|
-
this._host = req.headers.host;
|
|
125
|
-
this._noAuthorization = !req.headers.authorization;
|
|
126
|
-
this._reqHeaders = res.headers.vary ? req.headers : null;
|
|
127
|
-
this._reqcc = parseCacheControl(req.headers["cache-control"]);
|
|
128
|
-
if (ignoreCargoCult && "pre-check" in this._rescc && "post-check" in this._rescc) {
|
|
129
|
-
delete this._rescc["pre-check"];
|
|
130
|
-
delete this._rescc["post-check"];
|
|
131
|
-
delete this._rescc["no-cache"];
|
|
132
|
-
delete this._rescc["no-store"];
|
|
133
|
-
delete this._rescc["must-revalidate"];
|
|
134
|
-
this._resHeaders = Object.assign({}, this._resHeaders, {
|
|
135
|
-
"cache-control": formatCacheControl(this._rescc)
|
|
136
|
-
});
|
|
137
|
-
delete this._resHeaders.expires;
|
|
138
|
-
delete this._resHeaders.pragma;
|
|
139
|
-
}
|
|
140
|
-
if (res.headers["cache-control"] == null && /no-cache/.test(res.headers.pragma)) {
|
|
141
|
-
this._rescc["no-cache"] = true;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
now() {
|
|
145
|
-
return Date.now();
|
|
146
|
-
}
|
|
147
|
-
storable() {
|
|
148
|
-
return !!(!this._reqcc["no-store"] && // A cache MUST NOT store a response to any request, unless:
|
|
149
|
-
// The request method is understood by the cache and defined as being cacheable, and
|
|
150
|
-
("GET" === this._method || "HEAD" === this._method || "POST" === this._method && this._hasExplicitExpiration()) && // the response status code is understood by the cache, and
|
|
151
|
-
understoodStatuses.has(this._status) && // the "no-store" cache directive does not appear in request or response header fields, and
|
|
152
|
-
!this._rescc["no-store"] && // the "private" response directive does not appear in the response, if the cache is shared, and
|
|
153
|
-
(!this._isShared || !this._rescc.private) && // the Authorization header field does not appear in the request, if the cache is shared,
|
|
154
|
-
(!this._isShared || this._noAuthorization || this._allowsStoringAuthenticated()) && // the response either:
|
|
155
|
-
// contains an Expires header field, or
|
|
156
|
-
(this._resHeaders.expires || // contains a max-age response directive, or
|
|
157
|
-
// contains a s-maxage response directive and the cache is shared, or
|
|
158
|
-
// contains a public response directive.
|
|
159
|
-
this._rescc["max-age"] || this._isShared && this._rescc["s-maxage"] || this._rescc.public || // has a status code that is defined as cacheable by default
|
|
160
|
-
statusCodeCacheableByDefault.has(this._status)));
|
|
161
|
-
}
|
|
162
|
-
_hasExplicitExpiration() {
|
|
163
|
-
return this._isShared && this._rescc["s-maxage"] || this._rescc["max-age"] || this._resHeaders.expires;
|
|
164
|
-
}
|
|
165
|
-
_assertRequestHasHeaders(req) {
|
|
166
|
-
if (!req || !req.headers) {
|
|
167
|
-
throw Error("Request headers missing");
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
satisfiesWithoutRevalidation(req) {
|
|
171
|
-
this._assertRequestHasHeaders(req);
|
|
172
|
-
const requestCC = parseCacheControl(req.headers["cache-control"]);
|
|
173
|
-
if (requestCC["no-cache"] || /no-cache/.test(req.headers.pragma)) {
|
|
174
|
-
return false;
|
|
175
|
-
}
|
|
176
|
-
if (requestCC["max-age"] && this.age() > requestCC["max-age"]) {
|
|
177
|
-
return false;
|
|
178
|
-
}
|
|
179
|
-
if (requestCC["min-fresh"] && this.timeToLive() < 1e3 * requestCC["min-fresh"]) {
|
|
180
|
-
return false;
|
|
181
|
-
}
|
|
182
|
-
if (this.stale()) {
|
|
183
|
-
const allowsStale = requestCC["max-stale"] && !this._rescc["must-revalidate"] && (true === requestCC["max-stale"] || requestCC["max-stale"] > this.age() - this.maxAge());
|
|
184
|
-
if (!allowsStale) {
|
|
185
|
-
return false;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
return this._requestMatches(req, false);
|
|
189
|
-
}
|
|
190
|
-
_requestMatches(req, allowHeadMethod) {
|
|
191
|
-
return (!this._url || this._url === req.url) && this._host === req.headers.host && // the request method associated with the stored response allows it to be used for the presented request, and
|
|
192
|
-
(!req.method || this._method === req.method || allowHeadMethod && "HEAD" === req.method) && // selecting header fields nominated by the stored response (if any) match those presented, and
|
|
193
|
-
this._varyMatches(req);
|
|
194
|
-
}
|
|
195
|
-
_allowsStoringAuthenticated() {
|
|
196
|
-
return this._rescc["must-revalidate"] || this._rescc.public || this._rescc["s-maxage"];
|
|
197
|
-
}
|
|
198
|
-
_varyMatches(req) {
|
|
199
|
-
if (!this._resHeaders.vary) {
|
|
200
|
-
return true;
|
|
201
|
-
}
|
|
202
|
-
if (this._resHeaders.vary === "*") {
|
|
203
|
-
return false;
|
|
204
|
-
}
|
|
205
|
-
const fields = this._resHeaders.vary.trim().toLowerCase().split(/\s*,\s*/);
|
|
206
|
-
for (const name of fields) {
|
|
207
|
-
if (req.headers[name] !== this._reqHeaders[name]) return false;
|
|
208
|
-
}
|
|
209
|
-
return true;
|
|
210
|
-
}
|
|
211
|
-
_copyWithoutHopByHopHeaders(inHeaders) {
|
|
212
|
-
const headers = {};
|
|
213
|
-
for (const name in inHeaders) {
|
|
214
|
-
if (hopByHopHeaders[name]) continue;
|
|
215
|
-
headers[name] = inHeaders[name];
|
|
216
|
-
}
|
|
217
|
-
if (inHeaders.connection) {
|
|
218
|
-
const tokens = inHeaders.connection.trim().split(/\s*,\s*/);
|
|
219
|
-
for (const name of tokens) {
|
|
220
|
-
delete headers[name];
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
if (headers.warning) {
|
|
224
|
-
const warnings = headers.warning.split(/,/).filter((warning) => {
|
|
225
|
-
return !/^\s*1[0-9][0-9]/.test(warning);
|
|
226
|
-
});
|
|
227
|
-
if (!warnings.length) {
|
|
228
|
-
delete headers.warning;
|
|
229
|
-
} else {
|
|
230
|
-
headers.warning = warnings.join(",").trim();
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
return headers;
|
|
234
|
-
}
|
|
235
|
-
responseHeaders() {
|
|
236
|
-
const headers = this._copyWithoutHopByHopHeaders(this._resHeaders);
|
|
237
|
-
const age = this.age();
|
|
238
|
-
if (age > 3600 * 24 && !this._hasExplicitExpiration() && this.maxAge() > 3600 * 24) {
|
|
239
|
-
headers.warning = (headers.warning ? `${headers.warning}, ` : "") + '113 - "rfc7234 5.5.4"';
|
|
240
|
-
}
|
|
241
|
-
headers.age = `${Math.round(age)}`;
|
|
242
|
-
headers.date = new Date(this.now()).toUTCString();
|
|
243
|
-
return headers;
|
|
244
|
-
}
|
|
245
|
-
/**
|
|
246
|
-
* Value of the Date response header or current time if Date was invalid
|
|
247
|
-
* @return timestamp
|
|
248
|
-
*/
|
|
249
|
-
date() {
|
|
250
|
-
const serverDate = Date.parse(this._resHeaders.date);
|
|
251
|
-
if (isFinite(serverDate)) {
|
|
252
|
-
return serverDate;
|
|
253
|
-
}
|
|
254
|
-
return this._responseTime;
|
|
255
|
-
}
|
|
256
|
-
/**
|
|
257
|
-
* Value of the Age header, in seconds, updated for the current time.
|
|
258
|
-
* May be fractional.
|
|
259
|
-
*
|
|
260
|
-
* @return Number
|
|
261
|
-
*/
|
|
262
|
-
age() {
|
|
263
|
-
let age = this._ageValue();
|
|
264
|
-
const residentTime = (this.now() - this._responseTime) / 1e3;
|
|
265
|
-
return age + residentTime;
|
|
266
|
-
}
|
|
267
|
-
_ageValue() {
|
|
268
|
-
return toNumberOrZero(this._resHeaders.age);
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* Value of applicable max-age (or heuristic equivalent) in seconds. This counts since response's `Date`.
|
|
272
|
-
*
|
|
273
|
-
* For an up-to-date value, see `timeToLive()`.
|
|
274
|
-
*
|
|
275
|
-
* @return Number
|
|
276
|
-
*/
|
|
277
|
-
maxAge() {
|
|
278
|
-
if (!this.storable() || this._rescc["no-cache"]) {
|
|
279
|
-
return 0;
|
|
280
|
-
}
|
|
281
|
-
if (this._isShared && (this._resHeaders["set-cookie"] && !this._rescc.public && !this._rescc.immutable)) {
|
|
282
|
-
return 0;
|
|
283
|
-
}
|
|
284
|
-
if (this._resHeaders.vary === "*") {
|
|
285
|
-
return 0;
|
|
286
|
-
}
|
|
287
|
-
if (this._isShared) {
|
|
288
|
-
if (this._rescc["proxy-revalidate"]) {
|
|
289
|
-
return 0;
|
|
290
|
-
}
|
|
291
|
-
if (this._rescc["s-maxage"]) {
|
|
292
|
-
return toNumberOrZero(this._rescc["s-maxage"]);
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
if (this._rescc["max-age"]) {
|
|
296
|
-
return toNumberOrZero(this._rescc["max-age"]);
|
|
297
|
-
}
|
|
298
|
-
const defaultMinTtl = this._rescc.immutable ? this._immutableMinTtl : 0;
|
|
299
|
-
const serverDate = this.date();
|
|
300
|
-
if (this._resHeaders.expires) {
|
|
301
|
-
const expires = Date.parse(this._resHeaders.expires);
|
|
302
|
-
if (Number.isNaN(expires) || expires < serverDate) {
|
|
303
|
-
return 0;
|
|
304
|
-
}
|
|
305
|
-
return Math.max(defaultMinTtl, (expires - serverDate) / 1e3);
|
|
306
|
-
}
|
|
307
|
-
if (this._resHeaders["last-modified"]) {
|
|
308
|
-
const lastModified = Date.parse(this._resHeaders["last-modified"]);
|
|
309
|
-
if (isFinite(lastModified) && serverDate > lastModified) {
|
|
310
|
-
return Math.max(
|
|
311
|
-
defaultMinTtl,
|
|
312
|
-
(serverDate - lastModified) / 1e3 * this._cacheHeuristic
|
|
313
|
-
);
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
return defaultMinTtl;
|
|
317
|
-
}
|
|
318
|
-
timeToLive() {
|
|
319
|
-
const age = this.maxAge() - this.age();
|
|
320
|
-
const staleIfErrorAge = age + toNumberOrZero(this._rescc["stale-if-error"]);
|
|
321
|
-
const staleWhileRevalidateAge = age + toNumberOrZero(this._rescc["stale-while-revalidate"]);
|
|
322
|
-
return Math.max(0, age, staleIfErrorAge, staleWhileRevalidateAge) * 1e3;
|
|
323
|
-
}
|
|
324
|
-
stale() {
|
|
325
|
-
return this.maxAge() <= this.age();
|
|
326
|
-
}
|
|
327
|
-
_useStaleIfError() {
|
|
328
|
-
return this.maxAge() + toNumberOrZero(this._rescc["stale-if-error"]) > this.age();
|
|
329
|
-
}
|
|
330
|
-
useStaleWhileRevalidate() {
|
|
331
|
-
return this.maxAge() + toNumberOrZero(this._rescc["stale-while-revalidate"]) > this.age();
|
|
332
|
-
}
|
|
333
|
-
static fromObject(obj) {
|
|
334
|
-
return new this(void 0, void 0, { _fromObject: obj });
|
|
335
|
-
}
|
|
336
|
-
_fromObject(obj) {
|
|
337
|
-
if (this._responseTime) throw Error("Reinitialized");
|
|
338
|
-
if (!obj || obj.v !== 1) throw Error("Invalid serialization");
|
|
339
|
-
this._responseTime = obj.t;
|
|
340
|
-
this._isShared = obj.sh;
|
|
341
|
-
this._cacheHeuristic = obj.ch;
|
|
342
|
-
this._immutableMinTtl = obj.imm !== void 0 ? obj.imm : 24 * 3600 * 1e3;
|
|
343
|
-
this._status = obj.st;
|
|
344
|
-
this._resHeaders = obj.resh;
|
|
345
|
-
this._rescc = obj.rescc;
|
|
346
|
-
this._method = obj.m;
|
|
347
|
-
this._url = obj.u;
|
|
348
|
-
this._host = obj.h;
|
|
349
|
-
this._noAuthorization = obj.a;
|
|
350
|
-
this._reqHeaders = obj.reqh;
|
|
351
|
-
this._reqcc = obj.reqcc;
|
|
352
|
-
}
|
|
353
|
-
toObject() {
|
|
354
|
-
return {
|
|
355
|
-
v: 1,
|
|
356
|
-
t: this._responseTime,
|
|
357
|
-
sh: this._isShared,
|
|
358
|
-
ch: this._cacheHeuristic,
|
|
359
|
-
imm: this._immutableMinTtl,
|
|
360
|
-
st: this._status,
|
|
361
|
-
resh: this._resHeaders,
|
|
362
|
-
rescc: this._rescc,
|
|
363
|
-
m: this._method,
|
|
364
|
-
u: this._url,
|
|
365
|
-
h: this._host,
|
|
366
|
-
a: this._noAuthorization,
|
|
367
|
-
reqh: this._reqHeaders,
|
|
368
|
-
reqcc: this._reqcc
|
|
369
|
-
};
|
|
370
|
-
}
|
|
371
|
-
/**
|
|
372
|
-
* Headers for sending to the origin server to revalidate stale response.
|
|
373
|
-
* Allows server to return 304 to allow reuse of the previous response.
|
|
374
|
-
*
|
|
375
|
-
* Hop by hop headers are always stripped.
|
|
376
|
-
* Revalidation headers may be added or removed, depending on request.
|
|
377
|
-
*/
|
|
378
|
-
revalidationHeaders(incomingReq) {
|
|
379
|
-
this._assertRequestHasHeaders(incomingReq);
|
|
380
|
-
const headers = this._copyWithoutHopByHopHeaders(incomingReq.headers);
|
|
381
|
-
delete headers["if-range"];
|
|
382
|
-
if (!this._requestMatches(incomingReq, true) || !this.storable()) {
|
|
383
|
-
delete headers["if-none-match"];
|
|
384
|
-
delete headers["if-modified-since"];
|
|
385
|
-
return headers;
|
|
386
|
-
}
|
|
387
|
-
if (this._resHeaders.etag) {
|
|
388
|
-
headers["if-none-match"] = headers["if-none-match"] ? `${headers["if-none-match"]}, ${this._resHeaders.etag}` : this._resHeaders.etag;
|
|
389
|
-
}
|
|
390
|
-
const forbidsWeakValidators = headers["accept-ranges"] || headers["if-match"] || headers["if-unmodified-since"] || this._method && this._method != "GET";
|
|
391
|
-
if (forbidsWeakValidators) {
|
|
392
|
-
delete headers["if-modified-since"];
|
|
393
|
-
if (headers["if-none-match"]) {
|
|
394
|
-
const etags = headers["if-none-match"].split(/,/).filter((etag) => {
|
|
395
|
-
return !/^\s*W\//.test(etag);
|
|
396
|
-
});
|
|
397
|
-
if (!etags.length) {
|
|
398
|
-
delete headers["if-none-match"];
|
|
399
|
-
} else {
|
|
400
|
-
headers["if-none-match"] = etags.join(",").trim();
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
} else if (this._resHeaders["last-modified"] && !headers["if-modified-since"]) {
|
|
404
|
-
headers["if-modified-since"] = this._resHeaders["last-modified"];
|
|
405
|
-
}
|
|
406
|
-
return headers;
|
|
407
|
-
}
|
|
408
|
-
/**
|
|
409
|
-
* Creates new CachePolicy with information combined from the previews response,
|
|
410
|
-
* and the new revalidation response.
|
|
411
|
-
*
|
|
412
|
-
* Returns {policy, modified} where modified is a boolean indicating
|
|
413
|
-
* whether the response body has been modified, and old cached body can't be used.
|
|
414
|
-
*
|
|
415
|
-
* @return {Object} {policy: CachePolicy, modified: Boolean}
|
|
416
|
-
*/
|
|
417
|
-
revalidatedPolicy(request, response) {
|
|
418
|
-
this._assertRequestHasHeaders(request);
|
|
419
|
-
if (this._useStaleIfError() && isErrorResponse(response)) {
|
|
420
|
-
return {
|
|
421
|
-
modified: false,
|
|
422
|
-
matches: false,
|
|
423
|
-
policy: this
|
|
424
|
-
};
|
|
425
|
-
}
|
|
426
|
-
if (!response || !response.headers) {
|
|
427
|
-
throw Error("Response headers missing");
|
|
428
|
-
}
|
|
429
|
-
let matches = false;
|
|
430
|
-
if (response.status !== void 0 && response.status != 304) {
|
|
431
|
-
matches = false;
|
|
432
|
-
} else if (response.headers.etag && !/^\s*W\//.test(response.headers.etag)) {
|
|
433
|
-
matches = this._resHeaders.etag && this._resHeaders.etag.replace(/^\s*W\//, "") === response.headers.etag;
|
|
434
|
-
} else if (this._resHeaders.etag && response.headers.etag) {
|
|
435
|
-
matches = this._resHeaders.etag.replace(/^\s*W\//, "") === response.headers.etag.replace(/^\s*W\//, "");
|
|
436
|
-
} else if (this._resHeaders["last-modified"]) {
|
|
437
|
-
matches = this._resHeaders["last-modified"] === response.headers["last-modified"];
|
|
438
|
-
} else {
|
|
439
|
-
if (!this._resHeaders.etag && !this._resHeaders["last-modified"] && !response.headers.etag && !response.headers["last-modified"]) {
|
|
440
|
-
matches = true;
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
if (!matches) {
|
|
444
|
-
return {
|
|
445
|
-
policy: new this.constructor(request, response),
|
|
446
|
-
// Client receiving 304 without body, even if it's invalid/mismatched has no option
|
|
447
|
-
// but to reuse a cached body. We don't have a good way to tell clients to do
|
|
448
|
-
// error recovery in such case.
|
|
449
|
-
modified: response.status != 304,
|
|
450
|
-
matches: false
|
|
451
|
-
};
|
|
452
|
-
}
|
|
453
|
-
const headers = {};
|
|
454
|
-
for (const k in this._resHeaders) {
|
|
455
|
-
headers[k] = k in response.headers && !excludedFromRevalidationUpdate[k] ? response.headers[k] : this._resHeaders[k];
|
|
456
|
-
}
|
|
457
|
-
const newResponse = Object.assign({}, response, {
|
|
458
|
-
status: this._status,
|
|
459
|
-
method: this._method,
|
|
460
|
-
headers
|
|
461
|
-
});
|
|
462
|
-
return {
|
|
463
|
-
policy: new this.constructor(request, newResponse, {
|
|
464
|
-
shared: this._isShared,
|
|
465
|
-
cacheHeuristic: this._cacheHeuristic,
|
|
466
|
-
immutableMinTimeToLive: this._immutableMinTtl
|
|
467
|
-
}),
|
|
468
|
-
modified: false,
|
|
469
|
-
matches: true
|
|
470
|
-
};
|
|
471
|
-
}
|
|
472
|
-
};
|
|
473
|
-
}
|
|
474
|
-
});
|
|
475
|
-
|
|
476
|
-
export {
|
|
477
|
-
require_http_cache_semantics
|
|
478
|
-
};
|
|
479
|
-
//# sourceMappingURL=chunk-YXFEXGAH.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../node_modules/http-cache-semantics/index.js"],"sourcesContent":["'use strict';\n// rfc7231 6.1\nconst statusCodeCacheableByDefault = new Set([\n 200,\n 203,\n 204,\n 206,\n 300,\n 301,\n 308,\n 404,\n 405,\n 410,\n 414,\n 501,\n]);\n\n// This implementation does not understand partial responses (206)\nconst understoodStatuses = new Set([\n 200,\n 203,\n 204,\n 300,\n 301,\n 302,\n 303,\n 307,\n 308,\n 404,\n 405,\n 410,\n 414,\n 501,\n]);\n\nconst errorStatusCodes = new Set([\n 500,\n 502,\n 503, \n 504,\n]);\n\nconst hopByHopHeaders = {\n date: true, // included, because we add Age update Date\n connection: true,\n 'keep-alive': true,\n 'proxy-authenticate': true,\n 'proxy-authorization': true,\n te: true,\n trailer: true,\n 'transfer-encoding': true,\n upgrade: true,\n};\n\nconst excludedFromRevalidationUpdate = {\n // Since the old body is reused, it doesn't make sense to change properties of the body\n 'content-length': true,\n 'content-encoding': true,\n 'transfer-encoding': true,\n 'content-range': true,\n};\n\nfunction toNumberOrZero(s) {\n const n = parseInt(s, 10);\n return isFinite(n) ? n : 0;\n}\n\n// RFC 5861\nfunction isErrorResponse(response) {\n // consider undefined response as faulty\n if(!response) {\n return true\n }\n return errorStatusCodes.has(response.status);\n}\n\nfunction parseCacheControl(header) {\n const cc = {};\n if (!header) return cc;\n\n // TODO: When there is more than one value present for a given directive (e.g., two Expires header fields, multiple Cache-Control: max-age directives),\n // the directive's value is considered invalid. Caches are encouraged to consider responses that have invalid freshness information to be stale\n const parts = header.trim().split(/,/);\n for (const part of parts) {\n const [k, v] = part.split(/=/, 2);\n cc[k.trim()] = v === undefined ? true : v.trim().replace(/^\"|\"$/g, '');\n }\n\n return cc;\n}\n\nfunction formatCacheControl(cc) {\n let parts = [];\n for (const k in cc) {\n const v = cc[k];\n parts.push(v === true ? k : k + '=' + v);\n }\n if (!parts.length) {\n return undefined;\n }\n return parts.join(', ');\n}\n\nmodule.exports = class CachePolicy {\n constructor(\n req,\n res,\n {\n shared,\n cacheHeuristic,\n immutableMinTimeToLive,\n ignoreCargoCult,\n _fromObject,\n } = {}\n ) {\n if (_fromObject) {\n this._fromObject(_fromObject);\n return;\n }\n\n if (!res || !res.headers) {\n throw Error('Response headers missing');\n }\n this._assertRequestHasHeaders(req);\n\n this._responseTime = this.now();\n this._isShared = shared !== false;\n this._cacheHeuristic =\n undefined !== cacheHeuristic ? cacheHeuristic : 0.1; // 10% matches IE\n this._immutableMinTtl =\n undefined !== immutableMinTimeToLive\n ? immutableMinTimeToLive\n : 24 * 3600 * 1000;\n\n this._status = 'status' in res ? res.status : 200;\n this._resHeaders = res.headers;\n this._rescc = parseCacheControl(res.headers['cache-control']);\n this._method = 'method' in req ? req.method : 'GET';\n this._url = req.url;\n this._host = req.headers.host;\n this._noAuthorization = !req.headers.authorization;\n this._reqHeaders = res.headers.vary ? req.headers : null; // Don't keep all request headers if they won't be used\n this._reqcc = parseCacheControl(req.headers['cache-control']);\n\n // Assume that if someone uses legacy, non-standard uncecessary options they don't understand caching,\n // so there's no point stricly adhering to the blindly copy&pasted directives.\n if (\n ignoreCargoCult &&\n 'pre-check' in this._rescc &&\n 'post-check' in this._rescc\n ) {\n delete this._rescc['pre-check'];\n delete this._rescc['post-check'];\n delete this._rescc['no-cache'];\n delete this._rescc['no-store'];\n delete this._rescc['must-revalidate'];\n this._resHeaders = Object.assign({}, this._resHeaders, {\n 'cache-control': formatCacheControl(this._rescc),\n });\n delete this._resHeaders.expires;\n delete this._resHeaders.pragma;\n }\n\n // When the Cache-Control header field is not present in a request, caches MUST consider the no-cache request pragma-directive\n // as having the same effect as if \"Cache-Control: no-cache\" were present (see Section 5.2.1).\n if (\n res.headers['cache-control'] == null &&\n /no-cache/.test(res.headers.pragma)\n ) {\n this._rescc['no-cache'] = true;\n }\n }\n\n now() {\n return Date.now();\n }\n\n storable() {\n // The \"no-store\" request directive indicates that a cache MUST NOT store any part of either this request or any response to it.\n return !!(\n !this._reqcc['no-store'] &&\n // A cache MUST NOT store a response to any request, unless:\n // The request method is understood by the cache and defined as being cacheable, and\n ('GET' === this._method ||\n 'HEAD' === this._method ||\n ('POST' === this._method && this._hasExplicitExpiration())) &&\n // the response status code is understood by the cache, and\n understoodStatuses.has(this._status) &&\n // the \"no-store\" cache directive does not appear in request or response header fields, and\n !this._rescc['no-store'] &&\n // the \"private\" response directive does not appear in the response, if the cache is shared, and\n (!this._isShared || !this._rescc.private) &&\n // the Authorization header field does not appear in the request, if the cache is shared,\n (!this._isShared ||\n this._noAuthorization ||\n this._allowsStoringAuthenticated()) &&\n // the response either:\n // contains an Expires header field, or\n (this._resHeaders.expires ||\n // contains a max-age response directive, or\n // contains a s-maxage response directive and the cache is shared, or\n // contains a public response directive.\n this._rescc['max-age'] ||\n (this._isShared && this._rescc['s-maxage']) ||\n this._rescc.public ||\n // has a status code that is defined as cacheable by default\n statusCodeCacheableByDefault.has(this._status))\n );\n }\n\n _hasExplicitExpiration() {\n // 4.2.1 Calculating Freshness Lifetime\n return (\n (this._isShared && this._rescc['s-maxage']) ||\n this._rescc['max-age'] ||\n this._resHeaders.expires\n );\n }\n\n _assertRequestHasHeaders(req) {\n if (!req || !req.headers) {\n throw Error('Request headers missing');\n }\n }\n\n satisfiesWithoutRevalidation(req) {\n this._assertRequestHasHeaders(req);\n\n // When presented with a request, a cache MUST NOT reuse a stored response, unless:\n // the presented request does not contain the no-cache pragma (Section 5.4), nor the no-cache cache directive,\n // unless the stored response is successfully validated (Section 4.3), and\n const requestCC = parseCacheControl(req.headers['cache-control']);\n if (requestCC['no-cache'] || /no-cache/.test(req.headers.pragma)) {\n return false;\n }\n\n if (requestCC['max-age'] && this.age() > requestCC['max-age']) {\n return false;\n }\n\n if (\n requestCC['min-fresh'] &&\n this.timeToLive() < 1000 * requestCC['min-fresh']\n ) {\n return false;\n }\n\n // the stored response is either:\n // fresh, or allowed to be served stale\n if (this.stale()) {\n const allowsStale =\n requestCC['max-stale'] &&\n !this._rescc['must-revalidate'] &&\n (true === requestCC['max-stale'] ||\n requestCC['max-stale'] > this.age() - this.maxAge());\n if (!allowsStale) {\n return false;\n }\n }\n\n return this._requestMatches(req, false);\n }\n\n _requestMatches(req, allowHeadMethod) {\n // The presented effective request URI and that of the stored response match, and\n return (\n (!this._url || this._url === req.url) &&\n this._host === req.headers.host &&\n // the request method associated with the stored response allows it to be used for the presented request, and\n (!req.method ||\n this._method === req.method ||\n (allowHeadMethod && 'HEAD' === req.method)) &&\n // selecting header fields nominated by the stored response (if any) match those presented, and\n this._varyMatches(req)\n );\n }\n\n _allowsStoringAuthenticated() {\n // following Cache-Control response directives (Section 5.2.2) have such an effect: must-revalidate, public, and s-maxage.\n return (\n this._rescc['must-revalidate'] ||\n this._rescc.public ||\n this._rescc['s-maxage']\n );\n }\n\n _varyMatches(req) {\n if (!this._resHeaders.vary) {\n return true;\n }\n\n // A Vary header field-value of \"*\" always fails to match\n if (this._resHeaders.vary === '*') {\n return false;\n }\n\n const fields = this._resHeaders.vary\n .trim()\n .toLowerCase()\n .split(/\\s*,\\s*/);\n for (const name of fields) {\n if (req.headers[name] !== this._reqHeaders[name]) return false;\n }\n return true;\n }\n\n _copyWithoutHopByHopHeaders(inHeaders) {\n const headers = {};\n for (const name in inHeaders) {\n if (hopByHopHeaders[name]) continue;\n headers[name] = inHeaders[name];\n }\n // 9.1. Connection\n if (inHeaders.connection) {\n const tokens = inHeaders.connection.trim().split(/\\s*,\\s*/);\n for (const name of tokens) {\n delete headers[name];\n }\n }\n if (headers.warning) {\n const warnings = headers.warning.split(/,/).filter(warning => {\n return !/^\\s*1[0-9][0-9]/.test(warning);\n });\n if (!warnings.length) {\n delete headers.warning;\n } else {\n headers.warning = warnings.join(',').trim();\n }\n }\n return headers;\n }\n\n responseHeaders() {\n const headers = this._copyWithoutHopByHopHeaders(this._resHeaders);\n const age = this.age();\n\n // A cache SHOULD generate 113 warning if it heuristically chose a freshness\n // lifetime greater than 24 hours and the response's age is greater than 24 hours.\n if (\n age > 3600 * 24 &&\n !this._hasExplicitExpiration() &&\n this.maxAge() > 3600 * 24\n ) {\n headers.warning =\n (headers.warning ? `${headers.warning}, ` : '') +\n '113 - \"rfc7234 5.5.4\"';\n }\n headers.age = `${Math.round(age)}`;\n headers.date = new Date(this.now()).toUTCString();\n return headers;\n }\n\n /**\n * Value of the Date response header or current time if Date was invalid\n * @return timestamp\n */\n date() {\n const serverDate = Date.parse(this._resHeaders.date);\n if (isFinite(serverDate)) {\n return serverDate;\n }\n return this._responseTime;\n }\n\n /**\n * Value of the Age header, in seconds, updated for the current time.\n * May be fractional.\n *\n * @return Number\n */\n age() {\n let age = this._ageValue();\n\n const residentTime = (this.now() - this._responseTime) / 1000;\n return age + residentTime;\n }\n\n _ageValue() {\n return toNumberOrZero(this._resHeaders.age);\n }\n\n /**\n * Value of applicable max-age (or heuristic equivalent) in seconds. This counts since response's `Date`.\n *\n * For an up-to-date value, see `timeToLive()`.\n *\n * @return Number\n */\n maxAge() {\n if (!this.storable() || this._rescc['no-cache']) {\n return 0;\n }\n\n // Shared responses with cookies are cacheable according to the RFC, but IMHO it'd be unwise to do so by default\n // so this implementation requires explicit opt-in via public header\n if (\n this._isShared &&\n (this._resHeaders['set-cookie'] &&\n !this._rescc.public &&\n !this._rescc.immutable)\n ) {\n return 0;\n }\n\n if (this._resHeaders.vary === '*') {\n return 0;\n }\n\n if (this._isShared) {\n if (this._rescc['proxy-revalidate']) {\n return 0;\n }\n // if a response includes the s-maxage directive, a shared cache recipient MUST ignore the Expires field.\n if (this._rescc['s-maxage']) {\n return toNumberOrZero(this._rescc['s-maxage']);\n }\n }\n\n // If a response includes a Cache-Control field with the max-age directive, a recipient MUST ignore the Expires field.\n if (this._rescc['max-age']) {\n return toNumberOrZero(this._rescc['max-age']);\n }\n\n const defaultMinTtl = this._rescc.immutable ? this._immutableMinTtl : 0;\n\n const serverDate = this.date();\n if (this._resHeaders.expires) {\n const expires = Date.parse(this._resHeaders.expires);\n // A cache recipient MUST interpret invalid date formats, especially the value \"0\", as representing a time in the past (i.e., \"already expired\").\n if (Number.isNaN(expires) || expires < serverDate) {\n return 0;\n }\n return Math.max(defaultMinTtl, (expires - serverDate) / 1000);\n }\n\n if (this._resHeaders['last-modified']) {\n const lastModified = Date.parse(this._resHeaders['last-modified']);\n if (isFinite(lastModified) && serverDate > lastModified) {\n return Math.max(\n defaultMinTtl,\n ((serverDate - lastModified) / 1000) * this._cacheHeuristic\n );\n }\n }\n\n return defaultMinTtl;\n }\n\n timeToLive() {\n const age = this.maxAge() - this.age();\n const staleIfErrorAge = age + toNumberOrZero(this._rescc['stale-if-error']);\n const staleWhileRevalidateAge = age + toNumberOrZero(this._rescc['stale-while-revalidate']);\n return Math.max(0, age, staleIfErrorAge, staleWhileRevalidateAge) * 1000;\n }\n\n stale() {\n return this.maxAge() <= this.age();\n }\n\n _useStaleIfError() {\n return this.maxAge() + toNumberOrZero(this._rescc['stale-if-error']) > this.age();\n }\n\n useStaleWhileRevalidate() {\n return this.maxAge() + toNumberOrZero(this._rescc['stale-while-revalidate']) > this.age();\n }\n\n static fromObject(obj) {\n return new this(undefined, undefined, { _fromObject: obj });\n }\n\n _fromObject(obj) {\n if (this._responseTime) throw Error('Reinitialized');\n if (!obj || obj.v !== 1) throw Error('Invalid serialization');\n\n this._responseTime = obj.t;\n this._isShared = obj.sh;\n this._cacheHeuristic = obj.ch;\n this._immutableMinTtl =\n obj.imm !== undefined ? obj.imm : 24 * 3600 * 1000;\n this._status = obj.st;\n this._resHeaders = obj.resh;\n this._rescc = obj.rescc;\n this._method = obj.m;\n this._url = obj.u;\n this._host = obj.h;\n this._noAuthorization = obj.a;\n this._reqHeaders = obj.reqh;\n this._reqcc = obj.reqcc;\n }\n\n toObject() {\n return {\n v: 1,\n t: this._responseTime,\n sh: this._isShared,\n ch: this._cacheHeuristic,\n imm: this._immutableMinTtl,\n st: this._status,\n resh: this._resHeaders,\n rescc: this._rescc,\n m: this._method,\n u: this._url,\n h: this._host,\n a: this._noAuthorization,\n reqh: this._reqHeaders,\n reqcc: this._reqcc,\n };\n }\n\n /**\n * Headers for sending to the origin server to revalidate stale response.\n * Allows server to return 304 to allow reuse of the previous response.\n *\n * Hop by hop headers are always stripped.\n * Revalidation headers may be added or removed, depending on request.\n */\n revalidationHeaders(incomingReq) {\n this._assertRequestHasHeaders(incomingReq);\n const headers = this._copyWithoutHopByHopHeaders(incomingReq.headers);\n\n // This implementation does not understand range requests\n delete headers['if-range'];\n\n if (!this._requestMatches(incomingReq, true) || !this.storable()) {\n // revalidation allowed via HEAD\n // not for the same resource, or wasn't allowed to be cached anyway\n delete headers['if-none-match'];\n delete headers['if-modified-since'];\n return headers;\n }\n\n /* MUST send that entity-tag in any cache validation request (using If-Match or If-None-Match) if an entity-tag has been provided by the origin server. */\n if (this._resHeaders.etag) {\n headers['if-none-match'] = headers['if-none-match']\n ? `${headers['if-none-match']}, ${this._resHeaders.etag}`\n : this._resHeaders.etag;\n }\n\n // Clients MAY issue simple (non-subrange) GET requests with either weak validators or strong validators. Clients MUST NOT use weak validators in other forms of request.\n const forbidsWeakValidators =\n headers['accept-ranges'] ||\n headers['if-match'] ||\n headers['if-unmodified-since'] ||\n (this._method && this._method != 'GET');\n\n /* SHOULD send the Last-Modified value in non-subrange cache validation requests (using If-Modified-Since) if only a Last-Modified value has been provided by the origin server.\n Note: This implementation does not understand partial responses (206) */\n if (forbidsWeakValidators) {\n delete headers['if-modified-since'];\n\n if (headers['if-none-match']) {\n const etags = headers['if-none-match']\n .split(/,/)\n .filter(etag => {\n return !/^\\s*W\\//.test(etag);\n });\n if (!etags.length) {\n delete headers['if-none-match'];\n } else {\n headers['if-none-match'] = etags.join(',').trim();\n }\n }\n } else if (\n this._resHeaders['last-modified'] &&\n !headers['if-modified-since']\n ) {\n headers['if-modified-since'] = this._resHeaders['last-modified'];\n }\n\n return headers;\n }\n\n /**\n * Creates new CachePolicy with information combined from the previews response,\n * and the new revalidation response.\n *\n * Returns {policy, modified} where modified is a boolean indicating\n * whether the response body has been modified, and old cached body can't be used.\n *\n * @return {Object} {policy: CachePolicy, modified: Boolean}\n */\n revalidatedPolicy(request, response) {\n this._assertRequestHasHeaders(request);\n if(this._useStaleIfError() && isErrorResponse(response)) { // I consider the revalidation request unsuccessful\n return {\n modified: false,\n matches: false,\n policy: this,\n };\n }\n if (!response || !response.headers) {\n throw Error('Response headers missing');\n }\n\n // These aren't going to be supported exactly, since one CachePolicy object\n // doesn't know about all the other cached objects.\n let matches = false;\n if (response.status !== undefined && response.status != 304) {\n matches = false;\n } else if (\n response.headers.etag &&\n !/^\\s*W\\//.test(response.headers.etag)\n ) {\n // \"All of the stored responses with the same strong validator are selected.\n // If none of the stored responses contain the same strong validator,\n // then the cache MUST NOT use the new response to update any stored responses.\"\n matches =\n this._resHeaders.etag &&\n this._resHeaders.etag.replace(/^\\s*W\\//, '') ===\n response.headers.etag;\n } else if (this._resHeaders.etag && response.headers.etag) {\n // \"If the new response contains a weak validator and that validator corresponds\n // to one of the cache's stored responses,\n // then the most recent of those matching stored responses is selected for update.\"\n matches =\n this._resHeaders.etag.replace(/^\\s*W\\//, '') ===\n response.headers.etag.replace(/^\\s*W\\//, '');\n } else if (this._resHeaders['last-modified']) {\n matches =\n this._resHeaders['last-modified'] ===\n response.headers['last-modified'];\n } else {\n // If the new response does not include any form of validator (such as in the case where\n // a client generates an If-Modified-Since request from a source other than the Last-Modified\n // response header field), and there is only one stored response, and that stored response also\n // lacks a validator, then that stored response is selected for update.\n if (\n !this._resHeaders.etag &&\n !this._resHeaders['last-modified'] &&\n !response.headers.etag &&\n !response.headers['last-modified']\n ) {\n matches = true;\n }\n }\n\n if (!matches) {\n return {\n policy: new this.constructor(request, response),\n // Client receiving 304 without body, even if it's invalid/mismatched has no option\n // but to reuse a cached body. We don't have a good way to tell clients to do\n // error recovery in such case.\n modified: response.status != 304,\n matches: false,\n };\n }\n\n // use other header fields provided in the 304 (Not Modified) response to replace all instances\n // of the corresponding header fields in the stored response.\n const headers = {};\n for (const k in this._resHeaders) {\n headers[k] =\n k in response.headers && !excludedFromRevalidationUpdate[k]\n ? response.headers[k]\n : this._resHeaders[k];\n }\n\n const newResponse = Object.assign({}, response, {\n status: this._status,\n method: this._method,\n headers,\n });\n return {\n policy: new this.constructor(request, newResponse, {\n shared: this._isShared,\n cacheHeuristic: this._cacheHeuristic,\n immutableMinTimeToLive: this._immutableMinTtl,\n }),\n modified: false,\n matches: true,\n };\n }\n};\n"],"mappings":";;;;;;;;AAAA;AAAA;AAAA;AAAA;AAEA,QAAM,+BAA+B,oBAAI,IAAI;AAAA,MACzC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ,CAAC;AAGD,QAAM,qBAAqB,oBAAI,IAAI;AAAA,MAC/B;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ,CAAC;AAED,QAAM,mBAAmB,oBAAI,IAAI;AAAA,MAC7B;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ,CAAC;AAED,QAAM,kBAAkB;AAAA,MACpB,MAAM;AAAA;AAAA,MACN,YAAY;AAAA,MACZ,cAAc;AAAA,MACd,sBAAsB;AAAA,MACtB,uBAAuB;AAAA,MACvB,IAAI;AAAA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Q,CAAC,IAClB,KAAK,YAAY,CAAC;AAAA,QAChC;AAEA,cAAM,cAAc,OAAO,OAAO,CAAC,GAAG,UAAU;AAAA,UAC5C,QAAQ,KAAK;AAAA,UACb,QAAQ,KAAK;AAAA,UACb;AAAA,QACJ,CAAC;AACD,eAAO;AAAA,UACH,QAAQ,IAAI,KAAK,YAAY,SAAS,aAAa;AAAA,YAC/C,QAAQ,KAAK;AAAA,YACb,gBAAgB,KAAK;AAAA,YACrB,wBAAwB,KAAK;AAAA,UACjC,CAAC;AAAA,UACD,UAAU;AAAA,UACV,SAAS;AAAA,QACb;AAAA,MACJ;AAAA,IACJ;AAAA;AAAA;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../cli-site-old/src/dev/index.ts","../../cli-site-old/src/dev/dev.ts","../../../node_modules/exit-hook/index.js","../../cli-site-old/src/environment.ts","../../cli-site-old/src/gridapp/createGridApp.ts","../../cli-site-old/src/gridapp/error-handlers/maxFileSizeErrorHandler.ts","../../cli-site-old/src/gridapp/startGridAppUpdater.ts","../../cli-site-old/src/key-watcher.ts","../../cli-site-old/src/bi.ts","../../cli-site-old/src/dev/sync-all-to-revision.ts","../../cli-site-old/src/sources/index.ts","../../cli-site-old/src/sources/pages-diff.ts"],"sourcesContent":["export { dev } from './dev.js';\n","import { createVeloCLIServer } from '@wix/editor-velo-cli-comm-api';\nimport { openBrowser } from '@wix/user-browser';\nimport { asyncExitHook } from 'exit-hook';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport { ErrorViewer } from '@wix/cli-error-reporting';\nimport { writeCrashReport } from '@wix/cli-debug-log';\nimport { getDebugLogFilePath } from '@wix/cli-core-definitions';\nimport type { CommandServices } from '@wix/cli-command-contract';\nimport { createElement } from 'react';\nimport { renderSync } from '@wix/cli-ui-kit';\nimport { isHttpError } from '@wix/cli-http-client';\nimport { getDevEditorBaseUrl } from '../environment.js';\nimport { createMutableGridApp } from '../gridapp/createGridApp.js';\nimport { startGridAppUpdater } from '../gridapp/startGridAppUpdater.js';\nimport { KeyWatcher } from '../key-watcher.js';\nimport type { ProjectModel } from '../model.js';\nimport { saveProjectModel } from '../model.js';\nimport { createLogger } from '../logger.js';\nimport { sitesBiEvents } from '../bi.js';\nimport { createI18nT } from '../i18n.js';\nimport { authenticate } from '../authentication.js';\nimport { syncAllToRevision } from './sync-all-to-revision.js';\n\nexport async function dev(\n initialModel: ProjectModel,\n { biLogger, errorReporter }: CommandServices,\n {\n https = false,\n }: {\n https?: boolean;\n }\n) {\n let model = initialModel;\n const authState = await authenticate({\n metaSiteId: model.metaSiteId,\n biLogger,\n errorReporter,\n });\n\n const t = createI18nT();\n const logger = createLogger({ t });\n const biEvents = sitesBiEvents(biLogger);\n\n const server = createVeloCLIServer({ https });\n\n let gridAppId: string;\n try {\n gridAppId = await createMutableGridApp(model.projectFolder, {\n authState,\n });\n } catch (error) {\n const message = isHttpError(error) && error.response?.data?.message;\n\n throw new CliError({\n code: CliErrorCode.FailedToCreateGridApp({\n error: message,\n }),\n cause: error,\n });\n }\n\n await syncAllToRevision(model, { authState }, logger);\n\n const { close } = startGridAppUpdater(\n model,\n gridAppId,\n {\n authState,\n onError(error) {\n logger.logNewLine();\n errorReporter.reportError(error);\n writeCrashReport(getDebugLogFilePath(model.projectFolder), error);\n renderSync(createElement(ErrorViewer, { error }));\n },\n },\n logger,\n biEvents\n );\n\n const onServerDisconnected = (devEditorUrl: string) => {\n const message = logger.logNoOpenedTab(devEditorUrl);\n biEvents.messageDisplayed({ model, message });\n };\n\n const onSyncDevEditorChanges = async (revision: string) => {\n if (revision !== model.revision) {\n const newModel = { ...model, revision };\n\n await saveProjectModel(newModel);\n const message = logger.logUpdatedLocalCodeToRevision({\n revision: newModel.revision,\n });\n biEvents.messageDisplayed({ message, model });\n\n await syncAllToRevision(newModel, { authState }, logger);\n\n model = newModel;\n }\n };\n\n const openLocalEditor = async (serverPort: number) => {\n biEvents.userResponse({\n action: 'Browser opened',\n message: 'Opening the Local Editor',\n model,\n });\n\n const devEditorUrl = getDevEditorUrl(serverPort);\n\n if (https) {\n await openBrowser(new URL(`https://localhost:${serverPort}`).href);\n } else {\n await openBrowser(devEditorUrl);\n }\n };\n\n const getDevEditorUrl = (serverPort: number) => {\n const url = new URL(model.metaSiteId, getDevEditorBaseUrl());\n\n url.searchParams.append('localPort', serverPort.toString());\n url.searchParams.append('secureSocket', https.toString());\n\n return url.toString();\n };\n\n let keyWatcher: KeyWatcher | undefined;\n try {\n const { port: serverPort } = await server.serve(gridAppId, getDevEditorUrl);\n\n const devEditorUrl = getDevEditorUrl(serverPort);\n\n server.on('disconnected', () => onServerDisconnected(devEditorUrl));\n server.on('syncDevEditorChanges', onSyncDevEditorChanges);\n\n keyWatcher = new KeyWatcher();\n\n logger.logOpeningBrowser(https);\n\n await openLocalEditor(serverPort);\n const { ctrlCPromise } = keyWatcher.watch();\n keyWatcher.on('e', () => openLocalEditor(serverPort));\n\n asyncExitHook(server.close, { minimumWait: 500 });\n await ctrlCPromise;\n } finally {\n keyWatcher?.unwatch();\n await Promise.all([server.close(), close()]);\n }\n}\n","import process from 'node:process';\n\nconst asyncCallbacks = new Set();\nconst callbacks = new Set();\n\nlet isCalled = false;\nlet isRegistered = false;\n\nasync function exit(shouldManuallyExit, isSynchronous, signal) {\n\tif (isCalled) {\n\t\treturn;\n\t}\n\n\tisCalled = true;\n\n\tif (asyncCallbacks.size > 0 && isSynchronous) {\n\t\tconsole.error([\n\t\t\t'SYNCHRONOUS TERMINATION NOTICE:',\n\t\t\t'When explicitly exiting the process via process.exit or via a parent process,',\n\t\t\t'asynchronous tasks in your exitHooks will not run. Either remove these tasks,',\n\t\t\t'use gracefulExit() instead of process.exit(), or ensure your parent process',\n\t\t\t'sends a SIGINT to the process running this code.',\n\t\t].join(' '));\n\t}\n\n\tconst exitCode = 128 + signal;\n\n\tconst done = (force = false) => {\n\t\tif (force === true || shouldManuallyExit === true) {\n\t\t\tprocess.exit(exitCode); // eslint-disable-line unicorn/no-process-exit\n\t\t}\n\t};\n\n\tfor (const callback of callbacks) {\n\t\tcallback(exitCode);\n\t}\n\n\tif (isSynchronous) {\n\t\tdone();\n\t\treturn;\n\t}\n\n\tconst promises = [];\n\tlet forceAfter = 0;\n\tfor (const [callback, wait] of asyncCallbacks) {\n\t\tforceAfter = Math.max(forceAfter, wait);\n\t\tpromises.push(Promise.resolve(callback(exitCode)));\n\t}\n\n\t// Force exit if we exceeded our wait value\n\tconst asyncTimer = setTimeout(() => {\n\t\tdone(true);\n\t}, forceAfter);\n\n\tawait Promise.all(promises);\n\tclearTimeout(asyncTimer);\n\tdone();\n}\n\nfunction addHook(options) {\n\tconst {onExit, minimumWait, isSynchronous} = options;\n\tconst asyncCallbackConfig = [onExit, minimumWait];\n\n\tif (isSynchronous) {\n\t\tcallbacks.add(onExit);\n\t} else {\n\t\tasyncCallbacks.add(asyncCallbackConfig);\n\t}\n\n\tif (!isRegistered) {\n\t\tisRegistered = true;\n\n\t\t// Exit cases that support asynchronous handling\n\t\tprocess.once('beforeExit', exit.bind(undefined, true, false, -128));\n\t\tprocess.once('SIGINT', exit.bind(undefined, true, false, 2));\n\t\tprocess.once('SIGTERM', exit.bind(undefined, true, false, 15));\n\n\t\t// Explicit exit events. Calling will force an immediate exit and run all\n\t\t// synchronous hooks. Explicit exits must not extend the node process\n\t\t// artificially. Will log errors if asynchronous calls exist.\n\t\tprocess.once('exit', exit.bind(undefined, false, true, 0));\n\n\t\t// PM2 Cluster shutdown message. Caught to support async handlers with pm2,\n\t\t// needed because explicitly calling process.exit() doesn't trigger the\n\t\t// beforeExit event, and the exit event cannot support async handlers,\n\t\t// since the event loop is never called after it.\n\t\tprocess.on('message', message => {\n\t\t\tif (message === 'shutdown') {\n\t\t\t\texit(true, true, -128);\n\t\t\t}\n\t\t});\n\t}\n\n\treturn () => {\n\t\tif (isSynchronous) {\n\t\t\tcallbacks.delete(onExit);\n\t\t} else {\n\t\t\tasyncCallbacks.delete(asyncCallbackConfig);\n\t\t}\n\t};\n}\n\nexport default function exitHook(onExit) {\n\tif (typeof onExit !== 'function') {\n\t\tthrow new TypeError('onExit must be a function');\n\t}\n\n\treturn addHook({\n\t\tonExit,\n\t\tisSynchronous: true,\n\t});\n}\n\nexport function asyncExitHook(onExit, options = {}) {\n\tif (typeof onExit !== 'function') {\n\t\tthrow new TypeError('onExit must be a function');\n\t}\n\n\tif (!(typeof options.minimumWait === 'number' && options.minimumWait > 0)) {\n\t\tthrow new TypeError('minimumWait must be set to a positive numeric value');\n\t}\n\n\treturn addHook({\n\t\tonExit,\n\t\tminimumWait: options.minimumWait,\n\t\tisSynchronous: false,\n\t});\n}\n\nexport function gracefulExit(signal = 0) {\n\texit(true, false, -128 + signal);\n}\n","import { getTestOverrides } from '@wix/cli-test-overrides';\n\nconst DEV_EDITOR_BASE_URL = 'https://wix.com/editor/';\n\nexport function getDevEditorBaseUrl(): string {\n return getTestOverrides().devEditorBaseUrl ?? DEV_EDITOR_BASE_URL;\n}\n","import type { AuthState } from '@wix/cli-auth';\nimport { createApp } from '@wix/ambassador-velo-apps-v1-app/http';\nimport type {\n App,\n CreateAppRequest,\n} from '@wix/ambassador-velo-apps-v1-app/types';\nimport { AppType } from '@wix/ambassador-velo-apps-v1-app/types';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport { httpRequest } from '../http-request.js';\nimport { catchFilesMaxSizeError } from './error-handlers/maxFileSizeErrorHandler.js';\nimport { loadProjectGridAppContent } from './loadProjectGridAppContent.js';\n\nasync function createAppWithParams(\n params: CreateAppRequest,\n opts: {\n authState: AuthState;\n }\n): Promise<string> {\n let app: App | undefined;\n\n try {\n const response = await httpRequest(\n { type: 'code', authState: opts.authState },\n createApp(params)\n );\n app = response.data.app;\n } catch (err) {\n catchFilesMaxSizeError(err, params.content?.files);\n\n throw err;\n }\n\n if (!app?.id) {\n throw new CliError({\n code: CliErrorCode.InvalidCreateAppResponse(),\n info: { app },\n cause: null,\n });\n }\n\n return app.id;\n}\n\nexport async function createMutableGridApp(\n projectFolder: string,\n opts: {\n authState: AuthState;\n }\n) {\n const content = await loadProjectGridAppContent(projectFolder);\n\n return createAppWithParams(\n {\n app: {\n mutable: true,\n appType: AppType.VELO_ISOLATED,\n },\n content,\n },\n opts\n );\n}\n","import type { File } from '@wix/ambassador-velo-apps-v1-app/types';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport { extractHttpError } from '@wix/cli-http-client';\n\nexport function catchFilesMaxSizeError(err: unknown, files: File[] = []) {\n if (!files.length) {\n return;\n }\n\n const httpError = extractHttpError(err);\n\n if (!httpError) {\n return;\n }\n\n const filesMaxSizeRawViolations =\n httpError.response?.data?.details?.validationError?.fieldViolations?.filter(\n (v: { violatedRule: string }) => v.violatedRule === 'MAX_LENGTH'\n );\n\n if (!filesMaxSizeRawViolations?.length) {\n return;\n }\n\n const maxSizeViolationsData = tryExtractMaxSizeViolationMetadata(\n filesMaxSizeRawViolations\n );\n\n throw new CliError({\n code: CliErrorCode.GridAppFilesMaxLengthExcceeded({\n maxSizeViolationsData,\n filePaths: files.map((f) => f.path ?? '[unknown file path]'),\n }),\n cause: httpError,\n });\n}\n\nfunction tryExtractMaxSizeViolationMetadata(\n filesMaxSizeViolations: Array<{ field: string; description: string }>\n) {\n const fileIndexRegex = /\\[(?<fileIndex>\\d+)\\].content/;\n const expectedAndReceivedSizeRegex =\n /has size (?<receivedSize>\\d+), expected (?<expectedSize>\\d+) or less/;\n const violationsData: {\n expectedSize?: number;\n files: Array<{ fileIndex: number; receivedSize: number }>;\n } = {\n expectedSize: undefined,\n files: [],\n };\n\n for (const filesMaxSizeViolation of filesMaxSizeViolations) {\n const fileIndexMatchResult = fileIndexRegex.exec(\n filesMaxSizeViolation.field\n );\n const expectedAndReceivedSizeMatchResult =\n expectedAndReceivedSizeRegex.exec(filesMaxSizeViolation.description);\n\n if (\n !(\n fileIndexMatchResult?.groups?.fileIndex &&\n expectedAndReceivedSizeMatchResult?.groups?.receivedSize &&\n expectedAndReceivedSizeMatchResult.groups.expectedSize\n )\n ) {\n return null;\n }\n\n violationsData.expectedSize ??= Math.trunc(\n parseInt(expectedAndReceivedSizeMatchResult.groups.expectedSize, 10) /\n 1000\n );\n\n violationsData.files.push({\n receivedSize: Math.trunc(\n parseInt(expectedAndReceivedSizeMatchResult.groups.receivedSize, 10) /\n 1000\n ),\n fileIndex: parseInt(fileIndexMatchResult.groups.fileIndex, 10),\n });\n }\n\n return violationsData;\n}\n","import { readFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport type { AuthState } from '@wix/cli-auth';\nimport { updateFiles } from '@wix/ambassador-velo-ide-v1-gridapp-filestructure/http';\nimport { GridAppLayout } from '@wix/ambassador-velo-ide-v1-gridapp-filestructure/types';\nimport { getSourceFolder } from '@wix/velo-github-layout-definitions';\nimport { watch } from 'chokidar';\nimport { debounceQueue } from '@wix/debounce-queue';\nimport pLimit from 'p-limit';\nimport normalizePath from 'normalize-path';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport { httpRequest } from '../http-request.js';\nimport type { ProjectModel } from '../model.js';\nimport type { Logger } from '../logger.js';\nimport type { SitesBiEvents } from '../bi.js';\nimport { catchFilesMaxSizeError } from './error-handlers/maxFileSizeErrorHandler.js';\n\ntype ChokidarEventParams = [\n 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir',\n string,\n];\n\nconst WATCH_FS_EVENTS_DEBOUNCE_TIME = 1000;\n\nconst getSectionName = (path: string) => {\n if (path.startsWith('src/pages')) {\n return 'public';\n }\n if (path.startsWith('src/backend')) {\n return 'backend';\n }\n return 'other';\n};\n\nexport function startGridAppUpdater(\n model: ProjectModel,\n gridAppId: string,\n opts: {\n onError: (e: CliError) => void;\n authState: AuthState;\n },\n logger: Logger,\n biEvents: SitesBiEvents\n) {\n const { projectFolder } = model;\n const limit = pLimit(1);\n\n const watcher = watch(getSourceFolder(projectFolder), {\n disableGlobbing: true,\n cwd: projectFolder,\n ignoreInitial: true,\n })\n .on(\n 'all',\n debounceQueue(async (events: ChokidarEventParams[]) => {\n await limit(async () => {\n const logSynced = logger.logSyncingLocalCode();\n const { added, changed, removed } =\n normalizeChokidarBatchedEvents(events);\n const addedArray = Array.from(added.values()).map((path) => ({\n path,\n type: 'create',\n }));\n const changedArray = Array.from(changed.values()).map((path) => ({\n path,\n type: 'update',\n }));\n const removedArray = Array.from(removed.values()).map((path) => ({\n path,\n type: 'delete',\n }));\n\n for (const val of [...addedArray, ...changedArray, ...removedArray]) {\n biEvents.file({\n model,\n action: val.type as 'create' | 'update' | 'delete',\n path: val.path,\n oldPath: '',\n sectionName: getSectionName(val.path),\n });\n if (val.type === 'update') {\n biEvents.codeChanged(model, val.path);\n }\n }\n\n try {\n await writeFiles({\n filesToUpdate: await Promise.all(\n addedArray.concat(changedArray).map(async (val) => ({\n path: normalizePath(val.path),\n content: await readFile(\n join(projectFolder, val.path),\n 'utf8'\n ),\n }))\n ),\n removedArray,\n gridAppId,\n authState: opts.authState,\n });\n\n const message = logSynced.success();\n biEvents.messageDisplayed({ message, model });\n biEvents.readyForReloadAfterCodeChanged(model);\n } catch (e) {\n logSynced.fail();\n const error = new CliError({\n code: CliErrorCode.GridAppFailedToUpdateFiles(),\n cause: e,\n info: {\n added,\n changed,\n removed,\n },\n });\n opts.onError(error);\n }\n });\n }, WATCH_FS_EVENTS_DEBOUNCE_TIME)\n )\n .on('error', (e) => {\n const error = new CliError({\n code: CliErrorCode.FailedToWatchFiles(),\n cause: e,\n });\n\n opts.onError(error);\n });\n\n return { close: () => watcher.close() };\n}\n\nfunction normalizeChokidarBatchedEvents(events: ChokidarEventParams[]) {\n return events.reduce(\n (result, [eventType, filePath]) => {\n switch (eventType) {\n case 'add': {\n result.added.add(filePath);\n break;\n }\n case 'change': {\n result.changed.add(filePath);\n break;\n }\n case 'unlink': {\n result.added.delete(filePath);\n result.changed.delete(filePath);\n result.removed.add(filePath);\n break;\n }\n case 'unlinkDir': {\n const filePathAsDir = filePath.endsWith('/')\n ? filePath\n : `${filePath}/`;\n for (const filePath of result.added) {\n if (filePath.startsWith(filePathAsDir)) {\n result.added.delete(filePath);\n }\n }\n for (const filePath of result.changed) {\n if (filePath.startsWith(filePathAsDir)) {\n result.changed.delete(filePath);\n }\n }\n result.removed.add(filePath);\n break;\n }\n case 'addDir': {\n break;\n }\n }\n return result;\n },\n {\n added: new Set<string>(),\n changed: new Set<string>(),\n removed: new Set<string>(),\n }\n );\n}\n\nasync function writeFiles({\n filesToUpdate,\n removedArray,\n gridAppId,\n authState,\n}: {\n filesToUpdate: Array<{ path: string; content: string }>;\n removedArray: Array<{ path: string; type: string }>;\n gridAppId: string;\n authState: AuthState;\n}) {\n try {\n await httpRequest(\n {\n type: 'code',\n authState,\n },\n updateFiles({\n gridAppId,\n layout: GridAppLayout.GITHUB,\n filesToUpdate,\n ignoreForbiddenPaths: true,\n pathsToDelete: removedArray.map((val) => val.path),\n })\n );\n } catch (err) {\n catchFilesMaxSizeError(err, filesToUpdate);\n throw err;\n }\n}\n","import readline from 'node:readline';\nimport { stdin } from 'node:process';\n\ninterface Key {\n ctrl: boolean;\n name: string;\n sequence: string;\n meta: boolean;\n shift: boolean;\n}\n\ntype Callback = (key: Key) => void;\nexport class KeyWatcher {\n private actions = new Map<string, Callback>();\n\n private watchExitProcess() {\n return new Promise<void>((resolve) => {\n this.on('c', (key) => {\n if (key.ctrl) {\n resolve();\n }\n });\n });\n }\n\n on(key: string, callback: Callback) {\n this.actions.set(key, callback);\n }\n\n watch() {\n const rl = readline.createInterface(stdin);\n\n readline.emitKeypressEvents(stdin, rl);\n\n if (stdin.isTTY) {\n // This is required since in test we don't have a terminal and setRawMode is undefined\n stdin.setRawMode(true);\n stdin.setEncoding('utf8');\n }\n\n stdin.on('keypress', this.handleKeyPress);\n\n return {\n ctrlCPromise: this.watchExitProcess(),\n };\n }\n\n unwatch() {\n if (stdin.isTTY) {\n // This is required since in test we don't have a terminal and setRawMode is undefined\n stdin.setRawMode(false);\n }\n stdin.off('keypress', this.handleKeyPress);\n stdin.pause();\n this.actions.clear();\n }\n\n handleKeyPress = (_: string, key: Key) => {\n this.actions.get(key.name)?.(key);\n };\n}\n","import { randomUUID } from 'node:crypto';\nimport {\n wixCliFileFolderCreatedRenamedDeleted,\n wixCliCliMessageDisplayed,\n wixCliCodeHasBeenChanged,\n wixCliUserResponseToCliMessage,\n wixCliReadyForReloadAfterCodeChange,\n} from '@wix/bi-logger-wix-cli/v2';\nimport type { BiLogger } from '@wix/cli-telemetry';\nimport type { ProjectModel } from './model.js';\n\nexport const sitesBiEvents = (biLogger: BiLogger) => ({\n file: ({\n model,\n action,\n path,\n sectionName,\n oldPath,\n }: {\n model: ProjectModel;\n action: 'create' | 'update' | 'delete';\n path: string;\n sectionName: string;\n oldPath: string;\n }) => {\n void biLogger.report(\n wixCliFileFolderCreatedRenamedDeleted({\n action,\n path,\n sectionName,\n oldPath,\n siteRevision: Number(model.revision),\n })\n );\n },\n codeChanged: (model: ProjectModel, fileName: string) => {\n void biLogger.report(\n wixCliCodeHasBeenChanged({\n fileName,\n siteRevision: Number(model.revision),\n })\n );\n },\n readyForReloadAfterCodeChanged: (model: ProjectModel) => {\n void biLogger.report(\n wixCliReadyForReloadAfterCodeChange({\n siteRevision: Number(model.revision),\n })\n );\n },\n messageDisplayed: ({\n message,\n model,\n }: {\n message: string;\n model: ProjectModel;\n }) => {\n void biLogger.report(\n wixCliCliMessageDisplayed({\n message,\n messageId: randomUUID(),\n siteRevision: Number(model.revision),\n })\n );\n },\n userResponse: ({\n model,\n action,\n message,\n }: {\n model: ProjectModel;\n action: 'Browser opened';\n message: string;\n }) => {\n void biLogger.report(\n wixCliUserResponseToCliMessage({\n action,\n message,\n messageId: randomUUID(),\n siteRevision: Number(model.revision),\n })\n );\n },\n});\n\nexport type SitesBiEvents = ReturnType<typeof sitesBiEvents>;\n","import { rm } from 'node:fs/promises';\nimport type { AuthState } from '@wix/cli-auth';\nimport { writeCrashReport } from '@wix/cli-debug-log';\nimport { getTypesDir } from '@wix/velo-github-layout-definitions';\nimport { getDebugLogFilePath } from '@wix/cli-core-definitions';\nimport type { ProjectModel } from '../model.js';\nimport { syncPages } from '../sources/index.js';\nimport { syncTypesWithAuth } from '../sync-types/index.js';\nimport type { Logger } from '../logger.js';\n\nexport async function syncAllToRevision(\n model: ProjectModel,\n opts: {\n authState: AuthState;\n },\n logger: Logger\n) {\n const logTypesSynced = logger.logSyncingTypesToRevision(model.revision);\n try {\n await syncTypesWithAuth(model, { authState: opts.authState });\n logTypesSynced.success();\n } catch (error) {\n // As a workaround until the types sync can handle large projects, this error is recoverable\n writeCrashReport(getDebugLogFilePath(model.projectFolder), error);\n logTypesSynced.fail();\n await rm(getTypesDir(model.projectFolder), {\n recursive: true,\n force: true,\n }).catch((e: unknown) => {\n writeCrashReport(getDebugLogFilePath(model.projectFolder), e);\n logger.logRecoverableFailureToRemoveTypesDir(e);\n });\n }\n\n const logPagesSynced = logger.logSyncingPagesToRevision(model.revision);\n try {\n await syncPages(model, { authState: opts.authState });\n logPagesSynced.success();\n } catch (error) {\n logPagesSynced.fail();\n throw error;\n }\n}\n","import { readdir } from 'node:fs/promises';\nimport { pagesDiff } from '@wix/ambassador-velo-apps-v1-app/http';\nimport type { PagesDiffRequest } from '@wix/ambassador-velo-apps-v1-app/types';\nimport { GridAppLayout } from '@wix/ambassador-velo-apps-v1-app/types';\nimport {\n getPagesFolder,\n getSourceFolder,\n} from '@wix/velo-github-layout-definitions';\nimport type { AuthState } from '@wix/cli-auth';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport { pathExists } from '@wix/cli-fs';\nimport { httpRequest } from '../http-request.js';\nimport type { ProjectModel } from '../model.js';\nimport { createPages, deletePages, renamePages } from './pages-diff.js';\n\nexport async function syncPages(\n model: ProjectModel,\n opts: {\n authState: AuthState;\n }\n): Promise<void> {\n const pagesFolder = getPagesFolder(model.projectFolder);\n\n if (!(await pathExists(pagesFolder))) {\n throw new CliError({\n code: CliErrorCode.NoPagesDirectoryFound({\n srcDir: getSourceFolder(model.projectFolder),\n }),\n cause: null,\n });\n }\n\n const params: PagesDiffRequest = {\n layout: GridAppLayout.GITHUB,\n sourcePagesPaths: await readdir(pagesFolder),\n targetRevision: model.revision,\n };\n const { data } = await httpRequest(\n {\n authState: opts.authState,\n type: 'code',\n },\n pagesDiff(params)\n ).catch((e: unknown) => {\n throw new CliError({\n code: CliErrorCode.FailedToGetPagesDiff(),\n cause: e,\n info: { ...params },\n });\n });\n\n await Promise.all([\n createPages(model.projectFolder, data.pagesDiff?.created ?? []),\n renamePages(model.projectFolder, data.pagesDiff?.renamed ?? []),\n deletePages(model.projectFolder, data.pagesDiff?.deleted ?? []),\n ]);\n}\n","import { join } from 'node:path';\nimport { rm, rename } from 'node:fs/promises';\nimport type {\n NewPage,\n RenamedPage,\n PageId,\n} from '@wix/ambassador-velo-apps-v1-app/types';\nimport { pathExists, outputFile } from '@wix/cli-fs';\n\nexport async function createPages(\n projectFolder: string,\n pages: NewPage[]\n): Promise<void> {\n await Promise.all(\n pages.map((page) => {\n if (!page.pageId?.path || !page.content) {\n return Promise.resolve();\n }\n\n return outputFile(join(projectFolder, page.pageId.path), page.content);\n })\n );\n}\n\nexport async function renamePages(\n projectFolder: string,\n pages: RenamedPage[]\n): Promise<void> {\n await Promise.all(\n pages.map(async (page) => {\n if (!page.sourcePath?.path || !page.targetPath?.path) {\n return;\n }\n\n const sourcePath = join(projectFolder, page.sourcePath.path);\n const targetPath = join(projectFolder, page.targetPath.path);\n\n if (await pathExists(targetPath)) {\n return rm(sourcePath, { force: true });\n }\n\n return rename(sourcePath, targetPath);\n })\n );\n}\n\nexport async function deletePages(\n projectFolder: string,\n pages: PageId[]\n): Promise<void> {\n await Promise.all(\n pages.map((page) => {\n if (!page.path) {\n return Promise.resolve();\n }\n\n return rm(join(projectFolder, page.path), { force: true });\n })\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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