@mjhls/mjh-framework 1.0.795-beta.0 → 1.0.795-beta.1

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.
@@ -1,4 +1,4 @@
1
- import './_commonjsHelpers-0c4b6f40.js';
1
+ import { c as createCommonjsModule, u as unwrapExports, a as commonjsGlobal } from './_commonjsHelpers-0c4b6f40.js';
2
2
  import './_to-object-a4107da3.js';
3
3
  import './es6.string.iterator-c990c18c.js';
4
4
  import './_library-528f1934.js';
@@ -6,9 +6,358 @@ import './_iter-detect-5d49a330.js';
6
6
  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-fc1c2e29.js';
9
- import { parseCookies, setCookie } from 'nookies';
9
+ import { c as cookie } from './index-db3bb315.js';
10
10
  import getQuery from './getQuery.js';
11
11
 
12
+ var defaultParseOptions = {
13
+ decodeValues: true,
14
+ map: false,
15
+ silent: false,
16
+ };
17
+
18
+ function isNonEmptyString(str) {
19
+ return typeof str === "string" && !!str.trim();
20
+ }
21
+
22
+ function parseString(setCookieValue, options) {
23
+ var parts = setCookieValue.split(";").filter(isNonEmptyString);
24
+ var nameValue = parts.shift().split("=");
25
+ var name = nameValue.shift();
26
+ var value = nameValue.join("="); // everything after the first =, joined by a "=" if there was more than one part
27
+
28
+ options = options
29
+ ? Object.assign({}, defaultParseOptions, options)
30
+ : defaultParseOptions;
31
+
32
+ var cookie = {
33
+ name: name, // grab everything before the first =
34
+ value: options.decodeValues ? decodeURIComponent(value) : value, // decode cookie value
35
+ };
36
+
37
+ parts.forEach(function (part) {
38
+ var sides = part.split("=");
39
+ var key = sides.shift().trimLeft().toLowerCase();
40
+ var value = sides.join("=");
41
+ if (key === "expires") {
42
+ cookie.expires = new Date(value);
43
+ } else if (key === "max-age") {
44
+ cookie.maxAge = parseInt(value, 10);
45
+ } else if (key === "secure") {
46
+ cookie.secure = true;
47
+ } else if (key === "httponly") {
48
+ cookie.httpOnly = true;
49
+ } else if (key === "samesite") {
50
+ cookie.sameSite = value;
51
+ } else {
52
+ cookie[key] = value;
53
+ }
54
+ });
55
+
56
+ return cookie;
57
+ }
58
+
59
+ function parse(input, options) {
60
+ options = options
61
+ ? Object.assign({}, defaultParseOptions, options)
62
+ : defaultParseOptions;
63
+
64
+ if (!input) {
65
+ if (!options.map) {
66
+ return [];
67
+ } else {
68
+ return {};
69
+ }
70
+ }
71
+
72
+ if (input.headers && input.headers["set-cookie"]) {
73
+ // fast-path for node.js (which automatically normalizes header names to lower-case
74
+ input = input.headers["set-cookie"];
75
+ } else if (input.headers) {
76
+ // slow-path for other environments - see #25
77
+ var sch =
78
+ input.headers[
79
+ Object.keys(input.headers).find(function (key) {
80
+ return key.toLowerCase() === "set-cookie";
81
+ })
82
+ ];
83
+ // warn if called on a request-like object with a cookie header rather than a set-cookie header - see #34, 36
84
+ if (!sch && input.headers.cookie && !options.silent) {
85
+ console.warn(
86
+ "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."
87
+ );
88
+ }
89
+ input = sch;
90
+ }
91
+ if (!Array.isArray(input)) {
92
+ input = [input];
93
+ }
94
+
95
+ options = options
96
+ ? Object.assign({}, defaultParseOptions, options)
97
+ : defaultParseOptions;
98
+
99
+ if (!options.map) {
100
+ return input.filter(isNonEmptyString).map(function (str) {
101
+ return parseString(str, options);
102
+ });
103
+ } else {
104
+ var cookies = {};
105
+ return input.filter(isNonEmptyString).reduce(function (cookies, str) {
106
+ var cookie = parseString(str, options);
107
+ cookies[cookie.name] = cookie;
108
+ return cookies;
109
+ }, cookies);
110
+ }
111
+ }
112
+
113
+ /*
114
+ Set-Cookie header field-values are sometimes comma joined in one string. This splits them without choking on commas
115
+ that are within a single set-cookie field-value, such as in the Expires portion.
116
+
117
+ This is uncommon, but explicitly allowed - see https://tools.ietf.org/html/rfc2616#section-4.2
118
+ Node.js does this for every header *except* set-cookie - see https://github.com/nodejs/node/blob/d5e363b77ebaf1caf67cd7528224b651c86815c1/lib/_http_incoming.js#L128
119
+ React Native's fetch does this for *every* header, including set-cookie.
120
+
121
+ Based on: https://github.com/google/j2objc/commit/16820fdbc8f76ca0c33472810ce0cb03d20efe25
122
+ Credits to: https://github.com/tomball for original and https://github.com/chrusart for JavaScript implementation
123
+ */
124
+ function splitCookiesString(cookiesString) {
125
+ if (Array.isArray(cookiesString)) {
126
+ return cookiesString;
127
+ }
128
+ if (typeof cookiesString !== "string") {
129
+ return [];
130
+ }
131
+
132
+ var cookiesStrings = [];
133
+ var pos = 0;
134
+ var start;
135
+ var ch;
136
+ var lastComma;
137
+ var nextStart;
138
+ var cookiesSeparatorFound;
139
+
140
+ function skipWhitespace() {
141
+ while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) {
142
+ pos += 1;
143
+ }
144
+ return pos < cookiesString.length;
145
+ }
146
+
147
+ function notSpecialChar() {
148
+ ch = cookiesString.charAt(pos);
149
+
150
+ return ch !== "=" && ch !== ";" && ch !== ",";
151
+ }
152
+
153
+ while (pos < cookiesString.length) {
154
+ start = pos;
155
+ cookiesSeparatorFound = false;
156
+
157
+ while (skipWhitespace()) {
158
+ ch = cookiesString.charAt(pos);
159
+ if (ch === ",") {
160
+ // ',' is a cookie separator if we have later first '=', not ';' or ','
161
+ lastComma = pos;
162
+ pos += 1;
163
+
164
+ skipWhitespace();
165
+ nextStart = pos;
166
+
167
+ while (pos < cookiesString.length && notSpecialChar()) {
168
+ pos += 1;
169
+ }
170
+
171
+ // currently special character
172
+ if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") {
173
+ // we found cookies separator
174
+ cookiesSeparatorFound = true;
175
+ // pos is inside the next cookie, so back up and return it.
176
+ pos = nextStart;
177
+ cookiesStrings.push(cookiesString.substring(start, lastComma));
178
+ start = pos;
179
+ } else {
180
+ // in param ',' or param separator ';',
181
+ // we continue from that comma
182
+ pos = lastComma + 1;
183
+ }
184
+ } else {
185
+ pos += 1;
186
+ }
187
+ }
188
+
189
+ if (!cookiesSeparatorFound || pos >= cookiesString.length) {
190
+ cookiesStrings.push(cookiesString.substring(start, cookiesString.length));
191
+ }
192
+ }
193
+
194
+ return cookiesStrings;
195
+ }
196
+
197
+ var setCookie = parse;
198
+ var parse_1 = parse;
199
+ var parseString_1 = parseString;
200
+ var splitCookiesString_1 = splitCookiesString;
201
+ setCookie.parse = parse_1;
202
+ setCookie.parseString = parseString_1;
203
+ setCookie.splitCookiesString = splitCookiesString_1;
204
+
205
+ var dist = createCommonjsModule(function (module, exports) {
206
+ var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
207
+ __assign = Object.assign || function(t) {
208
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
209
+ s = arguments[i];
210
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
211
+ t[p] = s[p];
212
+ }
213
+ return t;
214
+ };
215
+ return __assign.apply(this, arguments);
216
+ };
217
+ Object.defineProperty(exports, "__esModule", { value: true });
218
+ exports.destroyCookie = exports.setCookie = exports.parseCookies = void 0;
219
+
220
+
221
+ var isBrowser = function () { return typeof window !== 'undefined'; };
222
+ function hasSameProperties(a, b) {
223
+ var aProps = Object.getOwnPropertyNames(a);
224
+ var bProps = Object.getOwnPropertyNames(b);
225
+ if (aProps.length !== bProps.length) {
226
+ return false;
227
+ }
228
+ for (var i = 0; i < aProps.length; i++) {
229
+ var propName = aProps[i];
230
+ if (a[propName] !== b[propName]) {
231
+ return false;
232
+ }
233
+ }
234
+ return true;
235
+ }
236
+ /**
237
+ * Compare the cookie and return true if the cookies has equivalent
238
+ * options and the cookies would be overwritten in the browser storage.
239
+ *
240
+ * @param a first Cookie for comparison
241
+ * @param b second Cookie for comparison
242
+ */
243
+ function areCookiesEqual(a, b) {
244
+ var sameSiteSame = a.sameSite === b.sameSite;
245
+ if (typeof a.sameSite === 'string' && typeof b.sameSite === 'string') {
246
+ sameSiteSame = a.sameSite.toLowerCase() === b.sameSite.toLowerCase();
247
+ }
248
+ return (hasSameProperties(__assign(__assign({}, a), { sameSite: undefined }), __assign(__assign({}, b), { sameSite: undefined })) && sameSiteSame);
249
+ }
250
+ /**
251
+ * Create an instance of the Cookie interface
252
+ *
253
+ * @param name name of the Cookie
254
+ * @param value value of the Cookie
255
+ * @param options Cookie options
256
+ */
257
+ function createCookie(name, value, options) {
258
+ var sameSite = options.sameSite;
259
+ if (sameSite === true) {
260
+ sameSite = 'strict';
261
+ }
262
+ if (sameSite === undefined || sameSite === false) {
263
+ sameSite = 'lax';
264
+ }
265
+ var cookieToSet = __assign(__assign({}, options), { sameSite: sameSite });
266
+ delete cookieToSet.encode;
267
+ return __assign({ name: name, value: value }, cookieToSet);
268
+ }
269
+ /**
270
+ *
271
+ * Parses cookies.
272
+ *
273
+ * @param ctx
274
+ * @param options
275
+ */
276
+ function parseCookies(ctx, options) {
277
+ if (ctx && ctx.req && ctx.req.headers && ctx.req.headers.cookie) {
278
+ return cookie.parse(ctx.req.headers.cookie, options);
279
+ }
280
+ if (isBrowser()) {
281
+ return cookie.parse(document.cookie, options);
282
+ }
283
+ return {};
284
+ }
285
+ exports.parseCookies = parseCookies;
286
+ /**
287
+ *
288
+ * Sets a cookie.
289
+ *
290
+ * @param ctx
291
+ * @param name
292
+ * @param value
293
+ * @param options
294
+ */
295
+ function setCookie$1(ctx, name, value, options) {
296
+ if (ctx && ctx.res && ctx.res.getHeader && ctx.res.setHeader) {
297
+ var cookies = ctx.res.getHeader('Set-Cookie') || [];
298
+ if (typeof cookies === 'string')
299
+ cookies = [cookies];
300
+ if (typeof cookies === 'number')
301
+ cookies = [];
302
+ var parsedCookies = setCookie.parse(cookies);
303
+ var cookiesToSet_1 = [];
304
+ parsedCookies.forEach(function (parsedCookie) {
305
+ if (!areCookiesEqual(parsedCookie, createCookie(name, value, options))) {
306
+ cookiesToSet_1.push(cookie.serialize(parsedCookie.name, parsedCookie.value, __assign({}, parsedCookie)));
307
+ }
308
+ });
309
+ cookiesToSet_1.push(cookie.serialize(name, value, options));
310
+ if (!ctx.res.finished) {
311
+ ctx.res.setHeader('Set-Cookie', cookiesToSet_1);
312
+ }
313
+ }
314
+ if (isBrowser()) {
315
+ if (options && options.httpOnly) {
316
+ throw new Error('Can not set a httpOnly cookie in the browser.');
317
+ }
318
+ document.cookie = cookie.serialize(name, value, options);
319
+ }
320
+ return {};
321
+ }
322
+ exports.setCookie = setCookie$1;
323
+ /**
324
+ *
325
+ * Destroys a cookie with a particular name.
326
+ *
327
+ * @param ctx
328
+ * @param name
329
+ * @param options
330
+ */
331
+ function destroyCookie(ctx, name, options) {
332
+ var opts = __assign(__assign({}, (options || {})), { maxAge: -1 });
333
+ if (ctx && ctx.res && ctx.res.setHeader && ctx.res.getHeader) {
334
+ var cookies = ctx.res.getHeader('Set-Cookie') || [];
335
+ if (typeof cookies === 'string')
336
+ cookies = [cookies];
337
+ if (typeof cookies === 'number')
338
+ cookies = [];
339
+ cookies.push(cookie.serialize(name, '', opts));
340
+ ctx.res.setHeader('Set-Cookie', cookies);
341
+ }
342
+ if (isBrowser()) {
343
+ document.cookie = cookie.serialize(name, '', opts);
344
+ }
345
+ return {};
346
+ }
347
+ exports.destroyCookie = destroyCookie;
348
+ exports.default = {
349
+ set: setCookie$1,
350
+ get: parseCookies,
351
+ destroy: destroyCookie,
352
+ };
353
+
354
+ });
355
+
356
+ unwrapExports(dist);
357
+ var dist_1 = dist.destroyCookie;
358
+ var dist_2 = dist.setCookie;
359
+ var dist_3 = dist.parseCookies;
360
+
12
361
  var _this = undefined;
13
362
 
14
363
  var getRelatedArticle = function () {
@@ -85,13 +434,13 @@ var getRelatedArticle = function () {
85
434
 
86
435
 
87
436
  if (ctx && url) {
88
- cookies = parseCookies(ctx);
437
+ cookies = dist_3(ctx);
89
438
  prevSlugs = cookies['prevSlugs'];
90
439
 
91
440
  if (!!prevSlugs) {
92
- if (!prevSlugs.includes(url)) setCookie(ctx, 'prevSlugs', prevSlugs + ',"' + url + '"', {});
441
+ if (!prevSlugs.includes(url)) dist_2(ctx, 'prevSlugs', prevSlugs + ',"' + url + '"', {});
93
442
  filters = filters + ' && !(url.current in [' + prevSlugs + '])';
94
- } else setCookie(ctx, 'prevSlugs', '"' + url + '"', {});
443
+ } else dist_2(ctx, 'prevSlugs', '"' + url + '"', {});
95
444
  }
96
445
 
97
446
  query = getQuery('related', filters, '', articleCount).replace('&& taxonomyMapping[]._ref in $taxonomy', '');
@@ -41,7 +41,7 @@ import './GroupDeck.js';
41
41
  import 'react-bootstrap';
42
42
  import './iconBase-602d52fe.js';
43
43
  import './index.esm-29e48d38.js';
44
- export { g as default } from './index-85f89e4d.js';
44
+ export { g as default } from './index-41b5c632.js';
45
45
  import './util-7700fc59.js';
46
46
  import './brightcove-react-player-loader.es-83f53e4e.js';
47
47
  import 'next/head';
@@ -8924,7 +8924,7 @@ var generateSrcSet = function generateSrcSet(source, client) {
8924
8924
  var builder = imageUrlBuilder(client);
8925
8925
  var imageWidths = [500, 1000, 1500];
8926
8926
  var srcSet = imageWidths.reduce(function (result, width, index) {
8927
- var image = builder.image(source).auto('format').width(width).url();
8927
+ var image = builder.image(source).width(width).fit('max').auto('format').url();
8928
8928
  return result = '' + result + image + ' ' + width + 'w' + (index !== imageWidths.length - 1 ? ', ' : '');
8929
8929
  }, '');
8930
8930
  return srcSet;
@@ -0,0 +1,207 @@
1
+ /*!
2
+ * cookie
3
+ * Copyright(c) 2012-2014 Roman Shtylman
4
+ * Copyright(c) 2015 Douglas Christopher Wilson
5
+ * MIT Licensed
6
+ */
7
+
8
+ /**
9
+ * Module exports.
10
+ * @public
11
+ */
12
+
13
+ var parse_1 = parse;
14
+ var serialize_1 = serialize;
15
+
16
+ /**
17
+ * Module variables.
18
+ * @private
19
+ */
20
+
21
+ var decode = decodeURIComponent;
22
+ var encode = encodeURIComponent;
23
+ var pairSplitRegExp = /; */;
24
+
25
+ /**
26
+ * RegExp to match field-content in RFC 7230 sec 3.2
27
+ *
28
+ * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
29
+ * field-vchar = VCHAR / obs-text
30
+ * obs-text = %x80-FF
31
+ */
32
+
33
+ var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
34
+
35
+ /**
36
+ * Parse a cookie header.
37
+ *
38
+ * Parse the given cookie header string into an object
39
+ * The object has the various cookies as keys(names) => values
40
+ *
41
+ * @param {string} str
42
+ * @param {object} [options]
43
+ * @return {object}
44
+ * @public
45
+ */
46
+
47
+ function parse(str, options) {
48
+ if (typeof str !== 'string') {
49
+ throw new TypeError('argument str must be a string');
50
+ }
51
+
52
+ var obj = {};
53
+ var opt = options || {};
54
+ var pairs = str.split(pairSplitRegExp);
55
+ var dec = opt.decode || decode;
56
+
57
+ for (var i = 0; i < pairs.length; i++) {
58
+ var pair = pairs[i];
59
+ var eq_idx = pair.indexOf('=');
60
+
61
+ // skip things that don't look like key=value
62
+ if (eq_idx < 0) {
63
+ continue;
64
+ }
65
+
66
+ var key = pair.substr(0, eq_idx).trim();
67
+ var val = pair.substr(++eq_idx, pair.length).trim();
68
+
69
+ // quoted values
70
+ if ('"' == val[0]) {
71
+ val = val.slice(1, -1);
72
+ }
73
+
74
+ // only assign once
75
+ if (undefined == obj[key]) {
76
+ obj[key] = tryDecode(val, dec);
77
+ }
78
+ }
79
+
80
+ return obj;
81
+ }
82
+
83
+ /**
84
+ * Serialize data into a cookie header.
85
+ *
86
+ * Serialize the a name value pair into a cookie string suitable for
87
+ * http headers. An optional options object specified cookie parameters.
88
+ *
89
+ * serialize('foo', 'bar', { httpOnly: true })
90
+ * => "foo=bar; httpOnly"
91
+ *
92
+ * @param {string} name
93
+ * @param {string} val
94
+ * @param {object} [options]
95
+ * @return {string}
96
+ * @public
97
+ */
98
+
99
+ function serialize(name, val, options) {
100
+ var opt = options || {};
101
+ var enc = opt.encode || encode;
102
+
103
+ if (typeof enc !== 'function') {
104
+ throw new TypeError('option encode is invalid');
105
+ }
106
+
107
+ if (!fieldContentRegExp.test(name)) {
108
+ throw new TypeError('argument name is invalid');
109
+ }
110
+
111
+ var value = enc(val);
112
+
113
+ if (value && !fieldContentRegExp.test(value)) {
114
+ throw new TypeError('argument val is invalid');
115
+ }
116
+
117
+ var str = name + '=' + value;
118
+
119
+ if (null != opt.maxAge) {
120
+ var maxAge = opt.maxAge - 0;
121
+
122
+ if (isNaN(maxAge) || !isFinite(maxAge)) {
123
+ throw new TypeError('option maxAge is invalid')
124
+ }
125
+
126
+ str += '; Max-Age=' + Math.floor(maxAge);
127
+ }
128
+
129
+ if (opt.domain) {
130
+ if (!fieldContentRegExp.test(opt.domain)) {
131
+ throw new TypeError('option domain is invalid');
132
+ }
133
+
134
+ str += '; Domain=' + opt.domain;
135
+ }
136
+
137
+ if (opt.path) {
138
+ if (!fieldContentRegExp.test(opt.path)) {
139
+ throw new TypeError('option path is invalid');
140
+ }
141
+
142
+ str += '; Path=' + opt.path;
143
+ }
144
+
145
+ if (opt.expires) {
146
+ if (typeof opt.expires.toUTCString !== 'function') {
147
+ throw new TypeError('option expires is invalid');
148
+ }
149
+
150
+ str += '; Expires=' + opt.expires.toUTCString();
151
+ }
152
+
153
+ if (opt.httpOnly) {
154
+ str += '; HttpOnly';
155
+ }
156
+
157
+ if (opt.secure) {
158
+ str += '; Secure';
159
+ }
160
+
161
+ if (opt.sameSite) {
162
+ var sameSite = typeof opt.sameSite === 'string'
163
+ ? opt.sameSite.toLowerCase() : opt.sameSite;
164
+
165
+ switch (sameSite) {
166
+ case true:
167
+ str += '; SameSite=Strict';
168
+ break;
169
+ case 'lax':
170
+ str += '; SameSite=Lax';
171
+ break;
172
+ case 'strict':
173
+ str += '; SameSite=Strict';
174
+ break;
175
+ case 'none':
176
+ str += '; SameSite=None';
177
+ break;
178
+ default:
179
+ throw new TypeError('option sameSite is invalid');
180
+ }
181
+ }
182
+
183
+ return str;
184
+ }
185
+
186
+ /**
187
+ * Try decoding a string using a decoding function.
188
+ *
189
+ * @param {string} str
190
+ * @param {function} decode
191
+ * @private
192
+ */
193
+
194
+ function tryDecode(str, decode) {
195
+ try {
196
+ return decode(str);
197
+ } catch (e) {
198
+ return str;
199
+ }
200
+ }
201
+
202
+ var cookie = {
203
+ parse: parse_1,
204
+ serialize: serialize_1
205
+ };
206
+
207
+ export { cookie as c, parse_1 as p, serialize_1 as s };
package/dist/esm/index.js CHANGED
@@ -67,7 +67,7 @@ import './index.esm-29e48d38.js';
67
67
  export { default as VideoSeriesListing } from './VideoSeriesListing.js';
68
68
  export { default as ArticleSeriesListing } from './ArticleSeriesListing.js';
69
69
  export { default as ArticleCarousel } from './ArticleCarousel.js';
70
- export { g as getSerializers } from './index-85f89e4d.js';
70
+ export { g as getSerializers } from './index-41b5c632.js';
71
71
  import './util-7700fc59.js';
72
72
  import './brightcove-react-player-loader.es-83f53e4e.js';
73
73
  import 'next/head';
@@ -164,12 +164,11 @@ export { default as ConferenceArticleCard } from './ConferenceArticleCard.js';
164
164
  export { default as KMTracker } from './KMTracker.js';
165
165
  export { default as getSeriesDetail } from './getSeriesDetail.js';
166
166
  export { default as SetCookie } from './SetCookie.js';
167
- import 'nookies';
168
- export { default as getQuery } from './getQuery.js';
167
+ import './index-db3bb315.js';
169
168
  export { default as getRelatedArticle } from './getRelatedArticle.js';
169
+ export { default as getQuery } from './getQuery.js';
170
170
  export { default as Auth } from './Auth.js';
171
171
  import 'swr';
172
- import 'cookie';
173
172
  import 'passport-local';
174
173
  import 'mysql';
175
174
  import './SeriesSlider-36be7223.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mjhls/mjh-framework",
3
- "version": "1.0.795-beta.0",
3
+ "version": "1.0.795-beta.1",
4
4
  "description": "Foundation Framework",
5
5
  "author": "mjh-framework",
6
6
  "license": "MIT",