@mjhls/mjh-framework 1.0.720-navigation-scroll-fix-v1 → 1.0.720-navigation-scroll-fix-v3
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/cjs/Auth.js +206 -6
- package/dist/cjs/HamMagazine.js +1 -0
- package/dist/cjs/View.js +2 -2
- package/dist/cjs/getRelatedArticle.js +5 -416
- package/dist/cjs/index.js +3 -3
- package/dist/esm/Auth.js +201 -1
- package/dist/esm/HamMagazine.js +1 -0
- package/dist/esm/View.js +2 -2
- package/dist/esm/getRelatedArticle.js +5 -416
- package/dist/esm/index.js +2 -2
- package/package.json +1 -1
- package/dist/cjs/index-bd6c9f56.js +0 -211
- package/dist/esm/index-db3bb315.js +0 -207
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import './_commonjsHelpers-0c4b6f40.js';
|
|
2
2
|
import './_to-object-a4107da3.js';
|
|
3
3
|
import './es6.string.iterator-c990c18c.js';
|
|
4
4
|
import './_library-528f1934.js';
|
|
@@ -7,420 +7,9 @@ import './core.get-iterator-method-e1de7503.js';
|
|
|
7
7
|
import './web.dom.iterable-4439f05a.js';
|
|
8
8
|
import { a as _asyncToGenerator, r as regenerator } from './asyncToGenerator-502f13b4.js';
|
|
9
9
|
import './_set-species-3f8319f5.js';
|
|
10
|
-
import {
|
|
10
|
+
import { parseCookies, setCookie } from 'nookies';
|
|
11
11
|
import getQuery from './getQuery.js';
|
|
12
12
|
|
|
13
|
-
var defaultParseOptions = {
|
|
14
|
-
decodeValues: true,
|
|
15
|
-
map: false,
|
|
16
|
-
silent: false,
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
function isNonEmptyString(str) {
|
|
20
|
-
return typeof str === "string" && !!str.trim();
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function parseString(setCookieValue, options) {
|
|
24
|
-
var parts = setCookieValue.split(";").filter(isNonEmptyString);
|
|
25
|
-
var nameValue = parts.shift().split("=");
|
|
26
|
-
var name = nameValue.shift();
|
|
27
|
-
var value = nameValue.join("="); // everything after the first =, joined by a "=" if there was more than one part
|
|
28
|
-
|
|
29
|
-
options = options
|
|
30
|
-
? Object.assign({}, defaultParseOptions, options)
|
|
31
|
-
: defaultParseOptions;
|
|
32
|
-
|
|
33
|
-
try {
|
|
34
|
-
value = options.decodeValues ? decodeURIComponent(value) : value; // decode cookie value
|
|
35
|
-
} catch (e) {
|
|
36
|
-
console.error(
|
|
37
|
-
`set-cookie-parser encountered an error while decoding a cookie with value '${value}'. Set options.decodeValues to false to disable this feature.`,
|
|
38
|
-
e
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
var cookie = {
|
|
43
|
-
name: name, // grab everything before the first =
|
|
44
|
-
value: value,
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
parts.forEach(function (part) {
|
|
48
|
-
var sides = part.split("=");
|
|
49
|
-
var key = sides.shift().trimLeft().toLowerCase();
|
|
50
|
-
var value = sides.join("=");
|
|
51
|
-
if (key === "expires") {
|
|
52
|
-
cookie.expires = new Date(value);
|
|
53
|
-
} else if (key === "max-age") {
|
|
54
|
-
cookie.maxAge = parseInt(value, 10);
|
|
55
|
-
} else if (key === "secure") {
|
|
56
|
-
cookie.secure = true;
|
|
57
|
-
} else if (key === "httponly") {
|
|
58
|
-
cookie.httpOnly = true;
|
|
59
|
-
} else if (key === "samesite") {
|
|
60
|
-
cookie.sameSite = value;
|
|
61
|
-
} else {
|
|
62
|
-
cookie[key] = value;
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
return cookie;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function parse(input, options) {
|
|
70
|
-
options = options
|
|
71
|
-
? Object.assign({}, defaultParseOptions, options)
|
|
72
|
-
: defaultParseOptions;
|
|
73
|
-
|
|
74
|
-
if (!input) {
|
|
75
|
-
if (!options.map) {
|
|
76
|
-
return [];
|
|
77
|
-
} else {
|
|
78
|
-
return {};
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (input.headers && input.headers["set-cookie"]) {
|
|
83
|
-
// fast-path for node.js (which automatically normalizes header names to lower-case
|
|
84
|
-
input = input.headers["set-cookie"];
|
|
85
|
-
} else if (input.headers) {
|
|
86
|
-
// slow-path for other environments - see #25
|
|
87
|
-
var sch =
|
|
88
|
-
input.headers[
|
|
89
|
-
Object.keys(input.headers).find(function (key) {
|
|
90
|
-
return key.toLowerCase() === "set-cookie";
|
|
91
|
-
})
|
|
92
|
-
];
|
|
93
|
-
// warn if called on a request-like object with a cookie header rather than a set-cookie header - see #34, 36
|
|
94
|
-
if (!sch && input.headers.cookie && !options.silent) {
|
|
95
|
-
console.warn(
|
|
96
|
-
"Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
input = sch;
|
|
100
|
-
}
|
|
101
|
-
if (!Array.isArray(input)) {
|
|
102
|
-
input = [input];
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
options = options
|
|
106
|
-
? Object.assign({}, defaultParseOptions, options)
|
|
107
|
-
: defaultParseOptions;
|
|
108
|
-
|
|
109
|
-
if (!options.map) {
|
|
110
|
-
return input.filter(isNonEmptyString).map(function (str) {
|
|
111
|
-
return parseString(str, options);
|
|
112
|
-
});
|
|
113
|
-
} else {
|
|
114
|
-
var cookies = {};
|
|
115
|
-
return input.filter(isNonEmptyString).reduce(function (cookies, str) {
|
|
116
|
-
var cookie = parseString(str, options);
|
|
117
|
-
cookies[cookie.name] = cookie;
|
|
118
|
-
return cookies;
|
|
119
|
-
}, cookies);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/*
|
|
124
|
-
Set-Cookie header field-values are sometimes comma joined in one string. This splits them without choking on commas
|
|
125
|
-
that are within a single set-cookie field-value, such as in the Expires portion.
|
|
126
|
-
|
|
127
|
-
This is uncommon, but explicitly allowed - see https://tools.ietf.org/html/rfc2616#section-4.2
|
|
128
|
-
Node.js does this for every header *except* set-cookie - see https://github.com/nodejs/node/blob/d5e363b77ebaf1caf67cd7528224b651c86815c1/lib/_http_incoming.js#L128
|
|
129
|
-
React Native's fetch does this for *every* header, including set-cookie.
|
|
130
|
-
|
|
131
|
-
Based on: https://github.com/google/j2objc/commit/16820fdbc8f76ca0c33472810ce0cb03d20efe25
|
|
132
|
-
Credits to: https://github.com/tomball for original and https://github.com/chrusart for JavaScript implementation
|
|
133
|
-
*/
|
|
134
|
-
function splitCookiesString(cookiesString) {
|
|
135
|
-
if (Array.isArray(cookiesString)) {
|
|
136
|
-
return cookiesString;
|
|
137
|
-
}
|
|
138
|
-
if (typeof cookiesString !== "string") {
|
|
139
|
-
return [];
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
var cookiesStrings = [];
|
|
143
|
-
var pos = 0;
|
|
144
|
-
var start;
|
|
145
|
-
var ch;
|
|
146
|
-
var lastComma;
|
|
147
|
-
var nextStart;
|
|
148
|
-
var cookiesSeparatorFound;
|
|
149
|
-
|
|
150
|
-
function skipWhitespace() {
|
|
151
|
-
while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) {
|
|
152
|
-
pos += 1;
|
|
153
|
-
}
|
|
154
|
-
return pos < cookiesString.length;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
function notSpecialChar() {
|
|
158
|
-
ch = cookiesString.charAt(pos);
|
|
159
|
-
|
|
160
|
-
return ch !== "=" && ch !== ";" && ch !== ",";
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
while (pos < cookiesString.length) {
|
|
164
|
-
start = pos;
|
|
165
|
-
cookiesSeparatorFound = false;
|
|
166
|
-
|
|
167
|
-
while (skipWhitespace()) {
|
|
168
|
-
ch = cookiesString.charAt(pos);
|
|
169
|
-
if (ch === ",") {
|
|
170
|
-
// ',' is a cookie separator if we have later first '=', not ';' or ','
|
|
171
|
-
lastComma = pos;
|
|
172
|
-
pos += 1;
|
|
173
|
-
|
|
174
|
-
skipWhitespace();
|
|
175
|
-
nextStart = pos;
|
|
176
|
-
|
|
177
|
-
while (pos < cookiesString.length && notSpecialChar()) {
|
|
178
|
-
pos += 1;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
// currently special character
|
|
182
|
-
if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") {
|
|
183
|
-
// we found cookies separator
|
|
184
|
-
cookiesSeparatorFound = true;
|
|
185
|
-
// pos is inside the next cookie, so back up and return it.
|
|
186
|
-
pos = nextStart;
|
|
187
|
-
cookiesStrings.push(cookiesString.substring(start, lastComma));
|
|
188
|
-
start = pos;
|
|
189
|
-
} else {
|
|
190
|
-
// in param ',' or param separator ';',
|
|
191
|
-
// we continue from that comma
|
|
192
|
-
pos = lastComma + 1;
|
|
193
|
-
}
|
|
194
|
-
} else {
|
|
195
|
-
pos += 1;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
if (!cookiesSeparatorFound || pos >= cookiesString.length) {
|
|
200
|
-
cookiesStrings.push(cookiesString.substring(start, cookiesString.length));
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
return cookiesStrings;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
var setCookie = parse;
|
|
208
|
-
var parse_1 = parse;
|
|
209
|
-
var parseString_1 = parseString;
|
|
210
|
-
var splitCookiesString_1 = splitCookiesString;
|
|
211
|
-
setCookie.parse = parse_1;
|
|
212
|
-
setCookie.parseString = parseString_1;
|
|
213
|
-
setCookie.splitCookiesString = splitCookiesString_1;
|
|
214
|
-
|
|
215
|
-
var utils = createCommonjsModule(function (module, exports) {
|
|
216
|
-
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
|
217
|
-
__assign = Object.assign || function(t) {
|
|
218
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
219
|
-
s = arguments[i];
|
|
220
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
221
|
-
t[p] = s[p];
|
|
222
|
-
}
|
|
223
|
-
return t;
|
|
224
|
-
};
|
|
225
|
-
return __assign.apply(this, arguments);
|
|
226
|
-
};
|
|
227
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
228
|
-
exports.areCookiesEqual = exports.hasSameProperties = exports.createCookie = exports.isBrowser = void 0;
|
|
229
|
-
/**
|
|
230
|
-
* Tells whether we are in a browser or server.
|
|
231
|
-
*/
|
|
232
|
-
function isBrowser() {
|
|
233
|
-
return typeof window !== 'undefined';
|
|
234
|
-
}
|
|
235
|
-
exports.isBrowser = isBrowser;
|
|
236
|
-
/**
|
|
237
|
-
* Create an instance of the Cookie interface
|
|
238
|
-
*/
|
|
239
|
-
function createCookie(name, value, options) {
|
|
240
|
-
var sameSite = options.sameSite;
|
|
241
|
-
if (sameSite === true) {
|
|
242
|
-
sameSite = 'strict';
|
|
243
|
-
}
|
|
244
|
-
if (sameSite === undefined || sameSite === false) {
|
|
245
|
-
sameSite = 'lax';
|
|
246
|
-
}
|
|
247
|
-
var cookieToSet = __assign(__assign({}, options), { sameSite: sameSite });
|
|
248
|
-
delete cookieToSet.encode;
|
|
249
|
-
return __assign({ name: name, value: value }, cookieToSet);
|
|
250
|
-
}
|
|
251
|
-
exports.createCookie = createCookie;
|
|
252
|
-
/**
|
|
253
|
-
* Tells whether given objects have the same properties.
|
|
254
|
-
*/
|
|
255
|
-
function hasSameProperties(a, b) {
|
|
256
|
-
var aProps = Object.getOwnPropertyNames(a);
|
|
257
|
-
var bProps = Object.getOwnPropertyNames(b);
|
|
258
|
-
if (aProps.length !== bProps.length) {
|
|
259
|
-
return false;
|
|
260
|
-
}
|
|
261
|
-
for (var i = 0; i < aProps.length; i++) {
|
|
262
|
-
var propName = aProps[i];
|
|
263
|
-
if (a[propName] !== b[propName]) {
|
|
264
|
-
return false;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
return true;
|
|
268
|
-
}
|
|
269
|
-
exports.hasSameProperties = hasSameProperties;
|
|
270
|
-
/**
|
|
271
|
-
* Compare the cookie and return true if the cookies have equivalent
|
|
272
|
-
* options and the cookies would be overwritten in the browser storage.
|
|
273
|
-
*
|
|
274
|
-
* @param a first Cookie for comparison
|
|
275
|
-
* @param b second Cookie for comparison
|
|
276
|
-
*/
|
|
277
|
-
function areCookiesEqual(a, b) {
|
|
278
|
-
var sameSiteSame = a.sameSite === b.sameSite;
|
|
279
|
-
if (typeof a.sameSite === 'string' && typeof b.sameSite === 'string') {
|
|
280
|
-
sameSiteSame = a.sameSite.toLowerCase() === b.sameSite.toLowerCase();
|
|
281
|
-
}
|
|
282
|
-
return (hasSameProperties(__assign(__assign({}, a), { sameSite: undefined }), __assign(__assign({}, b), { sameSite: undefined })) && sameSiteSame);
|
|
283
|
-
}
|
|
284
|
-
exports.areCookiesEqual = areCookiesEqual;
|
|
285
|
-
/* Functions */
|
|
286
|
-
|
|
287
|
-
});
|
|
288
|
-
|
|
289
|
-
unwrapExports(utils);
|
|
290
|
-
var utils_1 = utils.areCookiesEqual;
|
|
291
|
-
var utils_2 = utils.hasSameProperties;
|
|
292
|
-
var utils_3 = utils.createCookie;
|
|
293
|
-
var utils_4 = utils.isBrowser;
|
|
294
|
-
|
|
295
|
-
var dist = createCommonjsModule(function (module, exports) {
|
|
296
|
-
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
|
297
|
-
__assign = Object.assign || function(t) {
|
|
298
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
299
|
-
s = arguments[i];
|
|
300
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
301
|
-
t[p] = s[p];
|
|
302
|
-
}
|
|
303
|
-
return t;
|
|
304
|
-
};
|
|
305
|
-
return __assign.apply(this, arguments);
|
|
306
|
-
};
|
|
307
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
308
|
-
exports.destroyCookie = exports.setCookie = exports.parseCookies = void 0;
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
/**
|
|
313
|
-
* Parses cookies.
|
|
314
|
-
*
|
|
315
|
-
* @param ctx NextJS page or API context, express context, null or undefined.
|
|
316
|
-
* @param options Options that we pass down to `cookie` library.
|
|
317
|
-
*/
|
|
318
|
-
function parseCookies(ctx, options) {
|
|
319
|
-
var _a, _b;
|
|
320
|
-
if ((_b = (_a = ctx === null || ctx === void 0 ? void 0 : ctx.req) === null || _a === void 0 ? void 0 : _a.headers) === null || _b === void 0 ? void 0 : _b.cookie) {
|
|
321
|
-
return cookie.parse(ctx.req.headers.cookie, options);
|
|
322
|
-
}
|
|
323
|
-
if (utils.isBrowser()) {
|
|
324
|
-
return cookie.parse(document.cookie, options);
|
|
325
|
-
}
|
|
326
|
-
return {};
|
|
327
|
-
}
|
|
328
|
-
exports.parseCookies = parseCookies;
|
|
329
|
-
/**
|
|
330
|
-
* Sets a cookie.
|
|
331
|
-
*
|
|
332
|
-
* @param ctx NextJS page or API context, express context, null or undefined.
|
|
333
|
-
* @param name The name of your cookie.
|
|
334
|
-
* @param value The value of your cookie.
|
|
335
|
-
* @param options Options that we pass down to `cookie` library.
|
|
336
|
-
*/
|
|
337
|
-
function setCookie$1(ctx, name, value, options) {
|
|
338
|
-
var _a, _b;
|
|
339
|
-
if (options === void 0) { options = {}; }
|
|
340
|
-
// SSR
|
|
341
|
-
if (((_a = ctx === null || ctx === void 0 ? void 0 : ctx.res) === null || _a === void 0 ? void 0 : _a.getHeader) && ctx.res.setHeader) {
|
|
342
|
-
// Check if response has finished and warn about it.
|
|
343
|
-
if ((_b = ctx === null || ctx === void 0 ? void 0 : ctx.res) === null || _b === void 0 ? void 0 : _b.finished) {
|
|
344
|
-
console.warn("Not setting \"" + name + "\" cookie. Response has finished.");
|
|
345
|
-
console.warn("You should set cookie before res.send()");
|
|
346
|
-
return {};
|
|
347
|
-
}
|
|
348
|
-
/**
|
|
349
|
-
* Load existing cookies from the header and parse them.
|
|
350
|
-
*/
|
|
351
|
-
var cookies = ctx.res.getHeader('Set-Cookie') || [];
|
|
352
|
-
if (typeof cookies === 'string')
|
|
353
|
-
cookies = [cookies];
|
|
354
|
-
if (typeof cookies === 'number')
|
|
355
|
-
cookies = [];
|
|
356
|
-
/**
|
|
357
|
-
* Parse cookies but ignore values - we've already encoded
|
|
358
|
-
* them in the previous call.
|
|
359
|
-
*/
|
|
360
|
-
var parsedCookies = setCookie.parse(cookies, {
|
|
361
|
-
decodeValues: false,
|
|
362
|
-
});
|
|
363
|
-
/**
|
|
364
|
-
* We create the new cookie and make sure that none of
|
|
365
|
-
* the existing cookies match it.
|
|
366
|
-
*/
|
|
367
|
-
var newCookie_1 = utils.createCookie(name, value, options);
|
|
368
|
-
var cookiesToSet_1 = [];
|
|
369
|
-
parsedCookies.forEach(function (parsedCookie) {
|
|
370
|
-
if (!utils.areCookiesEqual(parsedCookie, newCookie_1)) {
|
|
371
|
-
/**
|
|
372
|
-
* We serialize the cookie back to the original format
|
|
373
|
-
* if it isn't the same as the new one.
|
|
374
|
-
*/
|
|
375
|
-
var serializedCookie = cookie.serialize(parsedCookie.name, parsedCookie.value, __assign({
|
|
376
|
-
// we prevent reencoding by default, but you might override it
|
|
377
|
-
encode: function (val) { return val; } }, parsedCookie));
|
|
378
|
-
cookiesToSet_1.push(serializedCookie);
|
|
379
|
-
}
|
|
380
|
-
});
|
|
381
|
-
cookiesToSet_1.push(cookie.serialize(name, value, options));
|
|
382
|
-
// Update the header.
|
|
383
|
-
ctx.res.setHeader('Set-Cookie', cookiesToSet_1);
|
|
384
|
-
}
|
|
385
|
-
// Browser
|
|
386
|
-
if (utils.isBrowser()) {
|
|
387
|
-
if (options && options.httpOnly) {
|
|
388
|
-
throw new Error('Can not set a httpOnly cookie in the browser.');
|
|
389
|
-
}
|
|
390
|
-
document.cookie = cookie.serialize(name, value, options);
|
|
391
|
-
}
|
|
392
|
-
return {};
|
|
393
|
-
}
|
|
394
|
-
exports.setCookie = setCookie$1;
|
|
395
|
-
/**
|
|
396
|
-
* Destroys a cookie with a particular name.
|
|
397
|
-
*
|
|
398
|
-
* @param ctx NextJS page or API context, express context, null or undefined.
|
|
399
|
-
* @param name Cookie name.
|
|
400
|
-
* @param options Options that we pass down to `cookie` library.
|
|
401
|
-
*/
|
|
402
|
-
function destroyCookie(ctx, name, options) {
|
|
403
|
-
/**
|
|
404
|
-
* We forward the request destroy to setCookie function
|
|
405
|
-
* as it is the same function with modified maxAge value.
|
|
406
|
-
*/
|
|
407
|
-
return setCookie$1(ctx, name, '', __assign(__assign({}, (options || {})), { maxAge: -1 }));
|
|
408
|
-
}
|
|
409
|
-
exports.destroyCookie = destroyCookie;
|
|
410
|
-
/* Utility Exports */
|
|
411
|
-
exports.default = {
|
|
412
|
-
set: setCookie$1,
|
|
413
|
-
get: parseCookies,
|
|
414
|
-
destroy: destroyCookie,
|
|
415
|
-
};
|
|
416
|
-
|
|
417
|
-
});
|
|
418
|
-
|
|
419
|
-
unwrapExports(dist);
|
|
420
|
-
var dist_1 = dist.destroyCookie;
|
|
421
|
-
var dist_2 = dist.setCookie;
|
|
422
|
-
var dist_3 = dist.parseCookies;
|
|
423
|
-
|
|
424
13
|
var _this = undefined;
|
|
425
14
|
|
|
426
15
|
var getRelatedArticle = function () {
|
|
@@ -497,13 +86,13 @@ var getRelatedArticle = function () {
|
|
|
497
86
|
|
|
498
87
|
|
|
499
88
|
if (ctx && url) {
|
|
500
|
-
cookies =
|
|
89
|
+
cookies = parseCookies(ctx);
|
|
501
90
|
prevSlugs = cookies['prevSlugs'];
|
|
502
91
|
|
|
503
92
|
if (!!prevSlugs) {
|
|
504
|
-
|
|
93
|
+
setCookie(ctx, 'prevSlugs', prevSlugs + ',"' + url + '"', {});
|
|
505
94
|
filters = '&& !(url.current in [' + prevSlugs + '])';
|
|
506
|
-
} else
|
|
95
|
+
} else setCookie(ctx, 'prevSlugs', '"' + url + '"', {});
|
|
507
96
|
}
|
|
508
97
|
|
|
509
98
|
query = getQuery('related', filters, '', articleCount).replace('&& taxonomyMapping[]._ref in $taxonomy', '');
|
package/dist/esm/index.js
CHANGED
|
@@ -161,9 +161,9 @@ export { default as ConferenceArticleCard } from './ConferenceArticleCard.js';
|
|
|
161
161
|
export { default as KMTracker } from './KMTracker.js';
|
|
162
162
|
export { default as getSeriesDetail } from './getSeriesDetail.js';
|
|
163
163
|
export { default as SetCookie } from './SetCookie.js';
|
|
164
|
-
import '
|
|
165
|
-
export { default as getRelatedArticle } from './getRelatedArticle.js';
|
|
164
|
+
import 'nookies';
|
|
166
165
|
export { default as getQuery } from './getQuery.js';
|
|
166
|
+
export { default as getRelatedArticle } from './getRelatedArticle.js';
|
|
167
167
|
export { default as Auth } from './Auth.js';
|
|
168
168
|
import 'swr';
|
|
169
169
|
import 'passport-local';
|
package/package.json
CHANGED
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/*!
|
|
4
|
-
* cookie
|
|
5
|
-
* Copyright(c) 2012-2014 Roman Shtylman
|
|
6
|
-
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
7
|
-
* MIT Licensed
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Module exports.
|
|
12
|
-
* @public
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
var parse_1 = parse;
|
|
16
|
-
var serialize_1 = serialize;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Module variables.
|
|
20
|
-
* @private
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
var decode = decodeURIComponent;
|
|
24
|
-
var encode = encodeURIComponent;
|
|
25
|
-
var pairSplitRegExp = /; */;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* RegExp to match field-content in RFC 7230 sec 3.2
|
|
29
|
-
*
|
|
30
|
-
* field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
|
|
31
|
-
* field-vchar = VCHAR / obs-text
|
|
32
|
-
* obs-text = %x80-FF
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Parse a cookie header.
|
|
39
|
-
*
|
|
40
|
-
* Parse the given cookie header string into an object
|
|
41
|
-
* The object has the various cookies as keys(names) => values
|
|
42
|
-
*
|
|
43
|
-
* @param {string} str
|
|
44
|
-
* @param {object} [options]
|
|
45
|
-
* @return {object}
|
|
46
|
-
* @public
|
|
47
|
-
*/
|
|
48
|
-
|
|
49
|
-
function parse(str, options) {
|
|
50
|
-
if (typeof str !== 'string') {
|
|
51
|
-
throw new TypeError('argument str must be a string');
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
var obj = {};
|
|
55
|
-
var opt = options || {};
|
|
56
|
-
var pairs = str.split(pairSplitRegExp);
|
|
57
|
-
var dec = opt.decode || decode;
|
|
58
|
-
|
|
59
|
-
for (var i = 0; i < pairs.length; i++) {
|
|
60
|
-
var pair = pairs[i];
|
|
61
|
-
var eq_idx = pair.indexOf('=');
|
|
62
|
-
|
|
63
|
-
// skip things that don't look like key=value
|
|
64
|
-
if (eq_idx < 0) {
|
|
65
|
-
continue;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
var key = pair.substr(0, eq_idx).trim();
|
|
69
|
-
var val = pair.substr(++eq_idx, pair.length).trim();
|
|
70
|
-
|
|
71
|
-
// quoted values
|
|
72
|
-
if ('"' == val[0]) {
|
|
73
|
-
val = val.slice(1, -1);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// only assign once
|
|
77
|
-
if (undefined == obj[key]) {
|
|
78
|
-
obj[key] = tryDecode(val, dec);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return obj;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Serialize data into a cookie header.
|
|
87
|
-
*
|
|
88
|
-
* Serialize the a name value pair into a cookie string suitable for
|
|
89
|
-
* http headers. An optional options object specified cookie parameters.
|
|
90
|
-
*
|
|
91
|
-
* serialize('foo', 'bar', { httpOnly: true })
|
|
92
|
-
* => "foo=bar; httpOnly"
|
|
93
|
-
*
|
|
94
|
-
* @param {string} name
|
|
95
|
-
* @param {string} val
|
|
96
|
-
* @param {object} [options]
|
|
97
|
-
* @return {string}
|
|
98
|
-
* @public
|
|
99
|
-
*/
|
|
100
|
-
|
|
101
|
-
function serialize(name, val, options) {
|
|
102
|
-
var opt = options || {};
|
|
103
|
-
var enc = opt.encode || encode;
|
|
104
|
-
|
|
105
|
-
if (typeof enc !== 'function') {
|
|
106
|
-
throw new TypeError('option encode is invalid');
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
if (!fieldContentRegExp.test(name)) {
|
|
110
|
-
throw new TypeError('argument name is invalid');
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
var value = enc(val);
|
|
114
|
-
|
|
115
|
-
if (value && !fieldContentRegExp.test(value)) {
|
|
116
|
-
throw new TypeError('argument val is invalid');
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
var str = name + '=' + value;
|
|
120
|
-
|
|
121
|
-
if (null != opt.maxAge) {
|
|
122
|
-
var maxAge = opt.maxAge - 0;
|
|
123
|
-
|
|
124
|
-
if (isNaN(maxAge) || !isFinite(maxAge)) {
|
|
125
|
-
throw new TypeError('option maxAge is invalid')
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
str += '; Max-Age=' + Math.floor(maxAge);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
if (opt.domain) {
|
|
132
|
-
if (!fieldContentRegExp.test(opt.domain)) {
|
|
133
|
-
throw new TypeError('option domain is invalid');
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
str += '; Domain=' + opt.domain;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
if (opt.path) {
|
|
140
|
-
if (!fieldContentRegExp.test(opt.path)) {
|
|
141
|
-
throw new TypeError('option path is invalid');
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
str += '; Path=' + opt.path;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
if (opt.expires) {
|
|
148
|
-
if (typeof opt.expires.toUTCString !== 'function') {
|
|
149
|
-
throw new TypeError('option expires is invalid');
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
str += '; Expires=' + opt.expires.toUTCString();
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
if (opt.httpOnly) {
|
|
156
|
-
str += '; HttpOnly';
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
if (opt.secure) {
|
|
160
|
-
str += '; Secure';
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
if (opt.sameSite) {
|
|
164
|
-
var sameSite = typeof opt.sameSite === 'string'
|
|
165
|
-
? opt.sameSite.toLowerCase() : opt.sameSite;
|
|
166
|
-
|
|
167
|
-
switch (sameSite) {
|
|
168
|
-
case true:
|
|
169
|
-
str += '; SameSite=Strict';
|
|
170
|
-
break;
|
|
171
|
-
case 'lax':
|
|
172
|
-
str += '; SameSite=Lax';
|
|
173
|
-
break;
|
|
174
|
-
case 'strict':
|
|
175
|
-
str += '; SameSite=Strict';
|
|
176
|
-
break;
|
|
177
|
-
case 'none':
|
|
178
|
-
str += '; SameSite=None';
|
|
179
|
-
break;
|
|
180
|
-
default:
|
|
181
|
-
throw new TypeError('option sameSite is invalid');
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
return str;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* Try decoding a string using a decoding function.
|
|
190
|
-
*
|
|
191
|
-
* @param {string} str
|
|
192
|
-
* @param {function} decode
|
|
193
|
-
* @private
|
|
194
|
-
*/
|
|
195
|
-
|
|
196
|
-
function tryDecode(str, decode) {
|
|
197
|
-
try {
|
|
198
|
-
return decode(str);
|
|
199
|
-
} catch (e) {
|
|
200
|
-
return str;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
var cookie = {
|
|
205
|
-
parse: parse_1,
|
|
206
|
-
serialize: serialize_1
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
exports.cookie = cookie;
|
|
210
|
-
exports.parse_1 = parse_1;
|
|
211
|
-
exports.serialize_1 = serialize_1;
|