@netlify/cache 1.6.1 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bootstrap/main.cjs +7 -3
- package/dist/bootstrap/main.d.cts +2 -2
- package/dist/bootstrap/main.d.ts +2 -2
- package/dist/bootstrap/main.js +7 -3
- package/dist/{cache-fc378069.d.ts → cache-089d07a0.d.ts} +3 -1
- package/dist/main.d.cts +1 -1
- package/dist/main.d.ts +1 -1
- package/package.json +1 -1
package/dist/bootstrap/main.cjs
CHANGED
|
@@ -78,15 +78,17 @@ var allowedProtocols = /* @__PURE__ */ new Set(["http:", "https:"]);
|
|
|
78
78
|
var discardedHeaders = /* @__PURE__ */ new Set(["cookie", "content-encoding", "content-length"]);
|
|
79
79
|
var getInternalHeaders = Symbol("getInternalHeaders");
|
|
80
80
|
var serializeResourceHeaders = Symbol("serializeResourceHeaders");
|
|
81
|
-
var _base64Encode, _getContext, _name, _userAgent;
|
|
81
|
+
var _base64Encode, _getContext, _logger, _name, _userAgent;
|
|
82
82
|
var NetlifyCache = class {
|
|
83
|
-
constructor({ base64Encode, getContext, name, userAgent }) {
|
|
83
|
+
constructor({ base64Encode, getContext, logger, name, userAgent }) {
|
|
84
84
|
__privateAdd(this, _base64Encode, void 0);
|
|
85
85
|
__privateAdd(this, _getContext, void 0);
|
|
86
|
+
__privateAdd(this, _logger, void 0);
|
|
86
87
|
__privateAdd(this, _name, void 0);
|
|
87
88
|
__privateAdd(this, _userAgent, void 0);
|
|
88
89
|
__privateSet(this, _base64Encode, base64Encode);
|
|
89
90
|
__privateSet(this, _getContext, getContext);
|
|
91
|
+
__privateSet(this, _logger, logger);
|
|
90
92
|
__privateSet(this, _name, name);
|
|
91
93
|
__privateSet(this, _userAgent, userAgent);
|
|
92
94
|
}
|
|
@@ -169,6 +171,7 @@ var NetlifyCache = class {
|
|
|
169
171
|
return res ? [res] : [];
|
|
170
172
|
}
|
|
171
173
|
async put(request, response) {
|
|
174
|
+
var _a;
|
|
172
175
|
if (!response.ok) {
|
|
173
176
|
throw new TypeError(`Cannot cache response with status ${response.status}.`);
|
|
174
177
|
}
|
|
@@ -200,12 +203,13 @@ var NetlifyCache = class {
|
|
|
200
203
|
if (!cacheResponse.ok) {
|
|
201
204
|
const errorDetail = cacheResponse.headers.get(ErrorDetail) ?? "";
|
|
202
205
|
const errorMessage = ERROR_CODES[errorDetail] || GENERIC_ERROR;
|
|
203
|
-
|
|
206
|
+
(_a = __privateGet(this, _logger)) == null ? void 0 : _a.call(this, `Failed to write to the cache: ${errorMessage}`);
|
|
204
207
|
}
|
|
205
208
|
}
|
|
206
209
|
};
|
|
207
210
|
_base64Encode = new WeakMap();
|
|
208
211
|
_getContext = new WeakMap();
|
|
212
|
+
_logger = new WeakMap();
|
|
209
213
|
_name = new WeakMap();
|
|
210
214
|
_userAgent = new WeakMap();
|
|
211
215
|
var extractAndValidateURL = (input) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as EnvironmentOptions } from '../cache-
|
|
2
|
-
export { B as Base64Encoder, N as NetlifyCache, O as Operation, R as RequestContextFactory } from '../cache-
|
|
1
|
+
import { E as EnvironmentOptions } from '../cache-089d07a0.js';
|
|
2
|
+
export { B as Base64Encoder, N as NetlifyCache, O as Operation, R as RequestContextFactory } from '../cache-089d07a0.js';
|
|
3
3
|
|
|
4
4
|
declare class NetlifyCacheStorage {
|
|
5
5
|
#private;
|
package/dist/bootstrap/main.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as EnvironmentOptions } from '../cache-
|
|
2
|
-
export { B as Base64Encoder, N as NetlifyCache, O as Operation, R as RequestContextFactory } from '../cache-
|
|
1
|
+
import { E as EnvironmentOptions } from '../cache-089d07a0.js';
|
|
2
|
+
export { B as Base64Encoder, N as NetlifyCache, O as Operation, R as RequestContextFactory } from '../cache-089d07a0.js';
|
|
3
3
|
|
|
4
4
|
declare class NetlifyCacheStorage {
|
|
5
5
|
#private;
|
package/dist/bootstrap/main.js
CHANGED
|
@@ -51,15 +51,17 @@ var allowedProtocols = /* @__PURE__ */ new Set(["http:", "https:"]);
|
|
|
51
51
|
var discardedHeaders = /* @__PURE__ */ new Set(["cookie", "content-encoding", "content-length"]);
|
|
52
52
|
var getInternalHeaders = Symbol("getInternalHeaders");
|
|
53
53
|
var serializeResourceHeaders = Symbol("serializeResourceHeaders");
|
|
54
|
-
var _base64Encode, _getContext, _name, _userAgent;
|
|
54
|
+
var _base64Encode, _getContext, _logger, _name, _userAgent;
|
|
55
55
|
var NetlifyCache = class {
|
|
56
|
-
constructor({ base64Encode, getContext, name, userAgent }) {
|
|
56
|
+
constructor({ base64Encode, getContext, logger, name, userAgent }) {
|
|
57
57
|
__privateAdd(this, _base64Encode, void 0);
|
|
58
58
|
__privateAdd(this, _getContext, void 0);
|
|
59
|
+
__privateAdd(this, _logger, void 0);
|
|
59
60
|
__privateAdd(this, _name, void 0);
|
|
60
61
|
__privateAdd(this, _userAgent, void 0);
|
|
61
62
|
__privateSet(this, _base64Encode, base64Encode);
|
|
62
63
|
__privateSet(this, _getContext, getContext);
|
|
64
|
+
__privateSet(this, _logger, logger);
|
|
63
65
|
__privateSet(this, _name, name);
|
|
64
66
|
__privateSet(this, _userAgent, userAgent);
|
|
65
67
|
}
|
|
@@ -142,6 +144,7 @@ var NetlifyCache = class {
|
|
|
142
144
|
return res ? [res] : [];
|
|
143
145
|
}
|
|
144
146
|
async put(request, response) {
|
|
147
|
+
var _a;
|
|
145
148
|
if (!response.ok) {
|
|
146
149
|
throw new TypeError(`Cannot cache response with status ${response.status}.`);
|
|
147
150
|
}
|
|
@@ -173,12 +176,13 @@ var NetlifyCache = class {
|
|
|
173
176
|
if (!cacheResponse.ok) {
|
|
174
177
|
const errorDetail = cacheResponse.headers.get(ErrorDetail) ?? "";
|
|
175
178
|
const errorMessage = ERROR_CODES[errorDetail] || GENERIC_ERROR;
|
|
176
|
-
|
|
179
|
+
(_a = __privateGet(this, _logger)) == null ? void 0 : _a.call(this, `Failed to write to the cache: ${errorMessage}`);
|
|
177
180
|
}
|
|
178
181
|
}
|
|
179
182
|
};
|
|
180
183
|
_base64Encode = new WeakMap();
|
|
181
184
|
_getContext = new WeakMap();
|
|
185
|
+
_logger = new WeakMap();
|
|
182
186
|
_name = new WeakMap();
|
|
183
187
|
_userAgent = new WeakMap();
|
|
184
188
|
var extractAndValidateURL = (input) => {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
type Base64Encoder = (input: string) => string;
|
|
2
|
+
type Logger = (...args: any[]) => void;
|
|
2
3
|
interface EnvironmentOptions {
|
|
3
4
|
base64Encode: Base64Encoder;
|
|
4
5
|
getContext: RequestContextFactory;
|
|
6
|
+
logger?: Logger;
|
|
5
7
|
userAgent?: string;
|
|
6
8
|
}
|
|
7
9
|
declare enum Operation {
|
|
@@ -25,7 +27,7 @@ declare const getInternalHeaders: unique symbol;
|
|
|
25
27
|
declare const serializeResourceHeaders: unique symbol;
|
|
26
28
|
declare class NetlifyCache implements Cache {
|
|
27
29
|
#private;
|
|
28
|
-
constructor({ base64Encode, getContext, name, userAgent }: NetlifyCacheOptions);
|
|
30
|
+
constructor({ base64Encode, getContext, logger, name, userAgent }: NetlifyCacheOptions);
|
|
29
31
|
private [getInternalHeaders];
|
|
30
32
|
private [serializeResourceHeaders];
|
|
31
33
|
add(request: RequestInfo): Promise<void>;
|
package/dist/main.d.cts
CHANGED
package/dist/main.d.ts
CHANGED