@koine/next 1.0.1 → 1.0.4
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/Analytics/AnalyticsGoogle.d.ts +6 -0
- package/Analytics/index.d.ts +1 -0
- package/Auth/helpers.d.ts +17 -0
- package/Auth/index.d.ts +4 -0
- package/Auth/useLogin.d.ts +7 -0
- package/Auth/useLoginUrl.d.ts +1 -0
- package/Auth/useLogout.d.ts +6 -0
- package/Favicon/Favicon.d.ts +4 -0
- package/Favicon/index.d.ts +1 -0
- package/Forms/index.d.ts +2 -0
- package/Forms/useForm.d.ts +32 -0
- package/Forms/useSubmit.d.ts +24 -0
- package/Head/Head.d.ts +1 -0
- package/Head/index.d.ts +1 -0
- package/I18n/I18n.d.ts +48 -0
- package/I18n/index.d.ts +1 -0
- package/Img/Img.d.ts +21 -0
- package/Img/index.d.ts +1 -0
- package/Link/Link.d.ts +8 -0
- package/Link/index.d.ts +1 -0
- package/NextProgress/NextProgress.d.ts +14 -0
- package/NextProgress/index.d.ts +1 -0
- package/Seo/Seo.d.ts +3 -0
- package/Seo/SeoDefaults.d.ts +3 -0
- package/Seo/helpers.d.ts +48 -0
- package/Seo/index.d.ts +12 -0
- package/Theme/Theme.d.ts +46 -0
- package/Theme/index.d.ts +1 -0
- package/Theme.js +1905 -0
- package/_tslib.js +41 -0
- package/app/App--emotion.d.ts +10 -0
- package/app/App--sc.d.ts +10 -0
- package/app/App--vanilla.d.ts +10 -0
- package/app/AppAuth--emotion.d.ts +10 -0
- package/app/AppAuth--sc.d.ts +10 -0
- package/app/AppHead.d.ts +3 -0
- package/app/AppMain--vanilla.d.ts +27 -0
- package/app/AppMain.d.ts +34 -0
- package/app/AppTheme--emotion.d.ts +15 -0
- package/app/AppTheme--sc.d.ts +13 -0
- package/app/AppTheme--vanilla.d.ts +10 -0
- package/app/index.d.ts +11 -0
- package/app/motion-features.d.ts +2 -0
- package/app.js +250 -0
- package/config/index.d.ts +58 -0
- package/config.js +156 -880
- package/document/Document--emotion.d.ts +5 -0
- package/document/Document--sc.d.ts +11 -0
- package/document/Document--vanilla.d.ts +11 -0
- package/document/Document.d.ts +10 -0
- package/document/emotion.d.ts +5 -0
- package/document/index.d.ts +4 -0
- package/document.js +207 -0
- package/emotion.js +1329 -0
- package/es.object.assign.js +1074 -0
- package/es.string.replace.js +785 -0
- package/es.string.split.js +201 -0
- package/index.d.ts +12 -0
- package/index.esm.js +4437 -4406
- package/index.js +743 -0
- package/index.umd.js +4635 -4623
- package/motion-features.js +10 -0
- package/package.json +18 -9
- package/types.d.ts +91 -0
- package/utils/api.d.ts +55 -0
- package/utils/index.d.ts +19 -0
- package/motion-features.esm.js +0 -2
package/config.js
CHANGED
|
@@ -2,899 +2,175 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
require('./es.string.replace.js');
|
|
6
|
+
require('./es.string.split.js');
|
|
7
|
+
require('./es.object.assign.js');
|
|
8
|
+
var _tslib = require('./_tslib.js');
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Normalise pathname
|
|
12
|
+
*
|
|
13
|
+
* From a path like `/some//malformed/path///` it returns `some/malformed/path`
|
|
14
|
+
*
|
|
15
|
+
* - Removes subsequent slashes
|
|
16
|
+
* - Removing initial and ending slashes
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
function normaliseUrlPathname(pathname) {
|
|
20
|
+
return pathname.replace(/\/+\//g, "/").replace(/^\/+(.*?)\/+$/, "$1");
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Clean a pathname and encode each part
|
|
24
|
+
*
|
|
25
|
+
* @see {@link normaliseUrlPathname}
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
function encodePathname(pathname) {
|
|
29
|
+
const parts = normaliseUrlPathname(pathname).split("/");
|
|
30
|
+
return parts.filter(part => !!part).map(part => encodeURIComponent(part)).join("/");
|
|
16
31
|
}
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
arg: fn.call(obj, arg)
|
|
57
|
-
};
|
|
58
|
-
} catch (err) {
|
|
59
|
-
return {
|
|
60
|
-
type: "throw",
|
|
61
|
-
arg: err
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
var Generator = // Dummy constructor functions that we use as the .constructor and
|
|
66
|
-
// .constructor.prototype properties for functions that return Generator
|
|
67
|
-
// objects. For full spec compliance, you may wish to configure your
|
|
68
|
-
// minifier not to mangle the names of these two functions.
|
|
69
|
-
function Generator() {};
|
|
70
|
-
var GeneratorFunction = function GeneratorFunction() {};
|
|
71
|
-
var GeneratorFunctionPrototype = function GeneratorFunctionPrototype() {};
|
|
72
|
-
var defineIteratorMethods = // Helper for defining the .next, .throw, and .return methods of the
|
|
73
|
-
// Iterator interface in terms of a single ._invoke method.
|
|
74
|
-
function defineIteratorMethods(prototype) {
|
|
75
|
-
[
|
|
76
|
-
"next",
|
|
77
|
-
"throw",
|
|
78
|
-
"return"
|
|
79
|
-
].forEach(function(method) {
|
|
80
|
-
define(prototype, method, function(arg) {
|
|
81
|
-
return this._invoke(method, arg);
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
};
|
|
85
|
-
var AsyncIterator = function AsyncIterator(generator, PromiseImpl) {
|
|
86
|
-
function invoke(method, arg, resolve, reject) {
|
|
87
|
-
var record = tryCatch(generator[method], generator, arg);
|
|
88
|
-
if (record.type === "throw") {
|
|
89
|
-
reject(record.arg);
|
|
90
|
-
} else {
|
|
91
|
-
var result = record.arg;
|
|
92
|
-
var value1 = result.value;
|
|
93
|
-
if (value1 && typeof value1 === "object" && hasOwn.call(value1, "__await")) {
|
|
94
|
-
return PromiseImpl.resolve(value1.__await).then(function(value) {
|
|
95
|
-
invoke("next", value, resolve, reject);
|
|
96
|
-
}, function(err) {
|
|
97
|
-
invoke("throw", err, resolve, reject);
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
return PromiseImpl.resolve(value1).then(function(unwrapped) {
|
|
101
|
-
// When a yielded Promise is resolved, its final value becomes
|
|
102
|
-
// the .value of the Promise<{value,done}> result for the
|
|
103
|
-
// current iteration.
|
|
104
|
-
result.value = unwrapped;
|
|
105
|
-
resolve(result);
|
|
106
|
-
}, function(error) {
|
|
107
|
-
// If a rejected Promise was yielded, throw the rejection back
|
|
108
|
-
// into the async generator function so it can be handled there.
|
|
109
|
-
return invoke("throw", error, resolve, reject);
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
var previousPromise;
|
|
114
|
-
function enqueue(method, arg) {
|
|
115
|
-
function callInvokeWithMethodAndArg() {
|
|
116
|
-
return new PromiseImpl(function(resolve, reject) {
|
|
117
|
-
invoke(method, arg, resolve, reject);
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
return previousPromise = // If enqueue has been called before, then we want to wait until
|
|
121
|
-
// all previous Promises have been resolved before calling invoke,
|
|
122
|
-
// so that results are always delivered in the correct order. If
|
|
123
|
-
// enqueue has not been called before, then it is important to
|
|
124
|
-
// call invoke immediately, without waiting on a callback to fire,
|
|
125
|
-
// so that the async generator function has the opportunity to do
|
|
126
|
-
// any necessary setup in a predictable way. This predictability
|
|
127
|
-
// is why the Promise constructor synchronously invokes its
|
|
128
|
-
// executor callback, and why async functions synchronously
|
|
129
|
-
// execute code before the first await. Since we implement simple
|
|
130
|
-
// async functions in terms of async generators, it is especially
|
|
131
|
-
// important to get this right, even though it requires care.
|
|
132
|
-
previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later
|
|
133
|
-
// invocations of the iterator.
|
|
134
|
-
callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
135
|
-
}
|
|
136
|
-
// Define the unified helper method that is used to implement .next,
|
|
137
|
-
// .throw, and .return (see defineIteratorMethods).
|
|
138
|
-
this._invoke = enqueue;
|
|
139
|
-
};
|
|
140
|
-
var makeInvokeMethod = function makeInvokeMethod(innerFn, self, context) {
|
|
141
|
-
var state = GenStateSuspendedStart;
|
|
142
|
-
return function invoke(method, arg) {
|
|
143
|
-
if (state === GenStateExecuting) {
|
|
144
|
-
throw new Error("Generator is already running");
|
|
145
|
-
}
|
|
146
|
-
if (state === GenStateCompleted) {
|
|
147
|
-
if (method === "throw") {
|
|
148
|
-
throw arg;
|
|
149
|
-
}
|
|
150
|
-
// Be forgiving, per 25.3.3.3.3 of the spec:
|
|
151
|
-
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
|
152
|
-
return doneResult();
|
|
153
|
-
}
|
|
154
|
-
context.method = method;
|
|
155
|
-
context.arg = arg;
|
|
156
|
-
while(true){
|
|
157
|
-
var delegate = context.delegate;
|
|
158
|
-
if (delegate) {
|
|
159
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
160
|
-
if (delegateResult) {
|
|
161
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
162
|
-
return delegateResult;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
if (context.method === "next") {
|
|
166
|
-
// Setting context._sent for legacy support of Babel's
|
|
167
|
-
// function.sent implementation.
|
|
168
|
-
context.sent = context._sent = context.arg;
|
|
169
|
-
} else if (context.method === "throw") {
|
|
170
|
-
if (state === GenStateSuspendedStart) {
|
|
171
|
-
state = GenStateCompleted;
|
|
172
|
-
throw context.arg;
|
|
173
|
-
}
|
|
174
|
-
context.dispatchException(context.arg);
|
|
175
|
-
} else if (context.method === "return") {
|
|
176
|
-
context.abrupt("return", context.arg);
|
|
177
|
-
}
|
|
178
|
-
state = GenStateExecuting;
|
|
179
|
-
var record = tryCatch(innerFn, self, context);
|
|
180
|
-
if (record.type === "normal") {
|
|
181
|
-
// If an exception is thrown from innerFn, we leave state ===
|
|
182
|
-
// GenStateExecuting and loop back for another invocation.
|
|
183
|
-
state = context.done ? GenStateCompleted : GenStateSuspendedYield;
|
|
184
|
-
if (record.arg === ContinueSentinel) {
|
|
185
|
-
continue;
|
|
186
|
-
}
|
|
187
|
-
return {
|
|
188
|
-
value: record.arg,
|
|
189
|
-
done: context.done
|
|
190
|
-
};
|
|
191
|
-
} else if (record.type === "throw") {
|
|
192
|
-
state = GenStateCompleted;
|
|
193
|
-
// Dispatch the exception by looping back around to the
|
|
194
|
-
// context.dispatchException(context.arg) call above.
|
|
195
|
-
context.method = "throw";
|
|
196
|
-
context.arg = record.arg;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
};
|
|
200
|
-
};
|
|
201
|
-
var pushTryEntry = function pushTryEntry(locs) {
|
|
202
|
-
var entry = {
|
|
203
|
-
tryLoc: locs[0]
|
|
204
|
-
};
|
|
205
|
-
if (1 in locs) {
|
|
206
|
-
entry.catchLoc = locs[1];
|
|
207
|
-
}
|
|
208
|
-
if (2 in locs) {
|
|
209
|
-
entry.finallyLoc = locs[2];
|
|
210
|
-
entry.afterLoc = locs[3];
|
|
211
|
-
}
|
|
212
|
-
this.tryEntries.push(entry);
|
|
213
|
-
};
|
|
214
|
-
var resetTryEntry = function resetTryEntry(entry) {
|
|
215
|
-
var record = entry.completion || {};
|
|
216
|
-
record.type = "normal";
|
|
217
|
-
delete record.arg;
|
|
218
|
-
entry.completion = record;
|
|
219
|
-
};
|
|
220
|
-
var Context = function Context(tryLocsList) {
|
|
221
|
-
// The root entry object (effectively a try statement without a catch
|
|
222
|
-
// or a finally block) gives us a place to store values thrown from
|
|
223
|
-
// locations where there is no enclosing try statement.
|
|
224
|
-
this.tryEntries = [
|
|
225
|
-
{
|
|
226
|
-
tryLoc: "root"
|
|
227
|
-
}
|
|
228
|
-
];
|
|
229
|
-
tryLocsList.forEach(pushTryEntry, this);
|
|
230
|
-
this.reset(true);
|
|
231
|
-
};
|
|
232
|
-
var values = function values(iterable) {
|
|
233
|
-
if (iterable) {
|
|
234
|
-
var iteratorMethod = iterable[iteratorSymbol];
|
|
235
|
-
if (iteratorMethod) {
|
|
236
|
-
return iteratorMethod.call(iterable);
|
|
237
|
-
}
|
|
238
|
-
if (typeof iterable.next === "function") {
|
|
239
|
-
return iterable;
|
|
240
|
-
}
|
|
241
|
-
if (!isNaN(iterable.length)) {
|
|
242
|
-
var i = -1, next1 = function next() {
|
|
243
|
-
while(++i < iterable.length){
|
|
244
|
-
if (hasOwn.call(iterable, i)) {
|
|
245
|
-
next.value = iterable[i];
|
|
246
|
-
next.done = false;
|
|
247
|
-
return next;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
next.value = undefined$1;
|
|
251
|
-
next.done = true;
|
|
252
|
-
return next;
|
|
253
|
-
};
|
|
254
|
-
return next1.next = next1;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
// Return an iterator with no values.
|
|
258
|
-
return {
|
|
259
|
-
next: doneResult
|
|
260
|
-
};
|
|
261
|
-
};
|
|
262
|
-
var doneResult = function doneResult() {
|
|
263
|
-
return {
|
|
264
|
-
value: undefined$1,
|
|
265
|
-
done: true
|
|
266
|
-
};
|
|
267
|
-
};
|
|
268
|
-
var Op = Object.prototype;
|
|
269
|
-
var hasOwn = Op.hasOwnProperty;
|
|
270
|
-
var undefined$1; // More compressible than void 0.
|
|
271
|
-
var $Symbol = typeof Symbol === "function" ? Symbol : {};
|
|
272
|
-
var iteratorSymbol = $Symbol.iterator || "@@iterator";
|
|
273
|
-
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
|
274
|
-
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
275
|
-
try {
|
|
276
|
-
// IE 8 has a broken Object.defineProperty that only works on DOM objects.
|
|
277
|
-
define({}, "");
|
|
278
|
-
} catch (err) {
|
|
279
|
-
define = function define(obj, key, value) {
|
|
280
|
-
return obj[key] = value;
|
|
281
|
-
};
|
|
282
|
-
}
|
|
283
|
-
exports.wrap = wrap;
|
|
284
|
-
var GenStateSuspendedStart = "suspendedStart";
|
|
285
|
-
var GenStateSuspendedYield = "suspendedYield";
|
|
286
|
-
var GenStateExecuting = "executing";
|
|
287
|
-
var GenStateCompleted = "completed";
|
|
288
|
-
// Returning this object from the innerFn has the same effect as
|
|
289
|
-
// breaking out of the dispatch switch statement.
|
|
290
|
-
var ContinueSentinel = {};
|
|
291
|
-
// This is a polyfill for %IteratorPrototype% for environments that
|
|
292
|
-
// don't natively support it.
|
|
293
|
-
var IteratorPrototype = {};
|
|
294
|
-
IteratorPrototype[iteratorSymbol] = function() {
|
|
295
|
-
return this;
|
|
296
|
-
};
|
|
297
|
-
var getProto = Object.getPrototypeOf;
|
|
298
|
-
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
299
|
-
if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
|
300
|
-
// This environment has a native %IteratorPrototype%; use it instead
|
|
301
|
-
// of the polyfill.
|
|
302
|
-
IteratorPrototype = NativeIteratorPrototype;
|
|
303
|
-
}
|
|
304
|
-
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
305
|
-
GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
|
|
306
|
-
GeneratorFunctionPrototype.constructor = GeneratorFunction;
|
|
307
|
-
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
|
|
308
|
-
exports.isGeneratorFunction = function(genFun) {
|
|
309
|
-
var ctor = typeof genFun === "function" && genFun.constructor;
|
|
310
|
-
return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can
|
|
311
|
-
// do is to check its .name property.
|
|
312
|
-
(ctor.displayName || ctor.name) === "GeneratorFunction" : false;
|
|
313
|
-
};
|
|
314
|
-
exports.mark = function(genFun) {
|
|
315
|
-
if (Object.setPrototypeOf) {
|
|
316
|
-
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
|
32
|
+
/**
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
function getPathRedirect(locale, localisedPathname, templateName, dynamic, permanent) {
|
|
36
|
+
const suffix = dynamic ? `/:slug*` : "";
|
|
37
|
+
return {
|
|
38
|
+
source: `/${locale}/${encodePathname(localisedPathname)}${suffix}`,
|
|
39
|
+
destination: `/${encodePathname(templateName)}${suffix}`,
|
|
40
|
+
permanent: Boolean(permanent),
|
|
41
|
+
locale: false
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
function getPathRewrite(source, destination, dynamic) {
|
|
48
|
+
const suffix = dynamic ? `/:path*` : "";
|
|
49
|
+
return {
|
|
50
|
+
source: `/${encodePathname(source)}${suffix}`,
|
|
51
|
+
destination: `/${encodePathname(destination)}${suffix}`
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
function getRedirects({
|
|
58
|
+
defaultLocale,
|
|
59
|
+
routes,
|
|
60
|
+
dynamicRoutes,
|
|
61
|
+
permanent
|
|
62
|
+
}) {
|
|
63
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
const redirects = [];
|
|
65
|
+
Object.keys(routes).forEach(page => {
|
|
66
|
+
const dynamic = dynamicRoutes[page];
|
|
67
|
+
|
|
68
|
+
if (routes[page] !== page) {
|
|
69
|
+
if (dynamic) {
|
|
70
|
+
redirects.push(getPathRedirect(defaultLocale, page, routes[page], true, permanent));
|
|
317
71
|
} else {
|
|
318
|
-
|
|
319
|
-
define(genFun, toStringTagSymbol, "GeneratorFunction");
|
|
72
|
+
redirects.push(getPathRedirect(defaultLocale, page, routes[page], false, permanent));
|
|
320
73
|
}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
if (PromiseImpl === void 0) PromiseImpl = Promise;
|
|
343
|
-
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
344
|
-
return exports.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator.
|
|
345
|
-
: iter.next().then(function(result) {
|
|
346
|
-
return result.done ? result.value : iter.next();
|
|
347
|
-
});
|
|
348
|
-
};
|
|
349
|
-
// Call delegate.iterator[context.method](context.arg) and handle the
|
|
350
|
-
// result, either by returning a { value, done } result from the
|
|
351
|
-
// delegate iterator, or by modifying context.method and context.arg,
|
|
352
|
-
// setting context.delegate to null, and returning the ContinueSentinel.
|
|
353
|
-
function maybeInvokeDelegate(delegate, context) {
|
|
354
|
-
var method = delegate.iterator[context.method];
|
|
355
|
-
if (method === undefined$1) {
|
|
356
|
-
// A .throw or .return when the delegate iterator has no .throw
|
|
357
|
-
// method always terminates the yield* loop.
|
|
358
|
-
context.delegate = null;
|
|
359
|
-
if (context.method === "throw") {
|
|
360
|
-
// Note: ["return"] must be used for ES3 parsing compatibility.
|
|
361
|
-
if (delegate.iterator["return"]) {
|
|
362
|
-
// If the delegate iterator has a return method, give it a
|
|
363
|
-
// chance to clean up.
|
|
364
|
-
context.method = "return";
|
|
365
|
-
context.arg = undefined$1;
|
|
366
|
-
maybeInvokeDelegate(delegate, context);
|
|
367
|
-
if (context.method === "throw") {
|
|
368
|
-
// If maybeInvokeDelegate(context) changed context.method from
|
|
369
|
-
// "return" to "throw", let that override the TypeError below.
|
|
370
|
-
return ContinueSentinel;
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
context.method = "throw";
|
|
374
|
-
context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
375
|
-
}
|
|
376
|
-
return ContinueSentinel;
|
|
377
|
-
}
|
|
378
|
-
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
379
|
-
if (record.type === "throw") {
|
|
380
|
-
context.method = "throw";
|
|
381
|
-
context.arg = record.arg;
|
|
382
|
-
context.delegate = null;
|
|
383
|
-
return ContinueSentinel;
|
|
384
|
-
}
|
|
385
|
-
var info = record.arg;
|
|
386
|
-
if (!info) {
|
|
387
|
-
context.method = "throw";
|
|
388
|
-
context.arg = new TypeError("iterator result is not an object");
|
|
389
|
-
context.delegate = null;
|
|
390
|
-
return ContinueSentinel;
|
|
391
|
-
}
|
|
392
|
-
if (info.done) {
|
|
393
|
-
// Assign the result of the finished delegate to the temporary
|
|
394
|
-
// variable specified by delegate.resultName (see delegateYield).
|
|
395
|
-
context[delegate.resultName] = info.value;
|
|
396
|
-
// Resume execution at the desired location (see delegateYield).
|
|
397
|
-
context.next = delegate.nextLoc;
|
|
398
|
-
// If context.method was "throw" but the delegate handled the
|
|
399
|
-
// exception, let the outer generator proceed normally. If
|
|
400
|
-
// context.method was "next", forget context.arg since it has been
|
|
401
|
-
// "consumed" by the delegate iterator. If context.method was
|
|
402
|
-
// "return", allow the original .return call to continue in the
|
|
403
|
-
// outer generator.
|
|
404
|
-
if (context.method !== "return") {
|
|
405
|
-
context.method = "next";
|
|
406
|
-
context.arg = undefined$1;
|
|
407
|
-
}
|
|
74
|
+
}
|
|
75
|
+
}); // console.log("redirects", redirects);
|
|
76
|
+
|
|
77
|
+
return redirects;
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
function getRewrites({
|
|
84
|
+
routes,
|
|
85
|
+
dynamicRoutes
|
|
86
|
+
}) {
|
|
87
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
const rewrites = [];
|
|
89
|
+
Object.keys(routes).forEach(page => {
|
|
90
|
+
const dynamic = dynamicRoutes[page];
|
|
91
|
+
|
|
92
|
+
if (routes[page] !== page) {
|
|
93
|
+
if (dynamic) {
|
|
94
|
+
rewrites.push(getPathRewrite(routes[page], page, true));
|
|
408
95
|
} else {
|
|
409
|
-
|
|
410
|
-
return info;
|
|
411
|
-
}
|
|
412
|
-
// The delegate iterator is finished, so forget it and continue with
|
|
413
|
-
// the outer generator.
|
|
414
|
-
context.delegate = null;
|
|
415
|
-
return ContinueSentinel;
|
|
416
|
-
}
|
|
417
|
-
// Define Generator.prototype.{next,throw,return} in terms of the
|
|
418
|
-
// unified ._invoke helper method.
|
|
419
|
-
defineIteratorMethods(Gp);
|
|
420
|
-
define(Gp, toStringTagSymbol, "Generator");
|
|
421
|
-
// A Generator should always return itself as the iterator object when the
|
|
422
|
-
// @@iterator function is called on it. Some browsers' implementations of the
|
|
423
|
-
// iterator prototype chain incorrectly implement this, causing the Generator
|
|
424
|
-
// object to not be returned from this call. This ensures that doesn't happen.
|
|
425
|
-
// See https://github.com/facebook/regenerator/issues/274 for more details.
|
|
426
|
-
Gp[iteratorSymbol] = function() {
|
|
427
|
-
return this;
|
|
428
|
-
};
|
|
429
|
-
Gp.toString = function() {
|
|
430
|
-
return "[object Generator]";
|
|
431
|
-
};
|
|
432
|
-
exports.keys = function(object) {
|
|
433
|
-
var keys = [];
|
|
434
|
-
for(var key1 in object){
|
|
435
|
-
keys.push(key1);
|
|
96
|
+
rewrites.push(getPathRewrite(routes[page], page));
|
|
436
97
|
}
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
var key = keys.pop();
|
|
443
|
-
if (key in object) {
|
|
444
|
-
next.value = key;
|
|
445
|
-
next.done = false;
|
|
446
|
-
return next;
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
// To avoid creating an additional object, we just hang the .value
|
|
450
|
-
// and .done properties off the next function object itself. This
|
|
451
|
-
// also ensures that the minifier will not anonymize the function.
|
|
452
|
-
next.done = true;
|
|
453
|
-
return next;
|
|
454
|
-
};
|
|
455
|
-
};
|
|
456
|
-
exports.values = values;
|
|
457
|
-
Context.prototype = {
|
|
458
|
-
constructor: Context,
|
|
459
|
-
reset: function reset(skipTempReset) {
|
|
460
|
-
this.prev = 0;
|
|
461
|
-
this.next = 0;
|
|
462
|
-
// Resetting context._sent for legacy support of Babel's
|
|
463
|
-
// function.sent implementation.
|
|
464
|
-
this.sent = this._sent = undefined$1;
|
|
465
|
-
this.done = false;
|
|
466
|
-
this.delegate = null;
|
|
467
|
-
this.method = "next";
|
|
468
|
-
this.arg = undefined$1;
|
|
469
|
-
this.tryEntries.forEach(resetTryEntry);
|
|
470
|
-
if (!skipTempReset) {
|
|
471
|
-
for(var name in this){
|
|
472
|
-
// Not sure about the optimal order of these conditions:
|
|
473
|
-
if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
|
|
474
|
-
this[name] = undefined$1;
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
},
|
|
479
|
-
stop: function stop() {
|
|
480
|
-
this.done = true;
|
|
481
|
-
var rootEntry = this.tryEntries[0];
|
|
482
|
-
var rootRecord = rootEntry.completion;
|
|
483
|
-
if (rootRecord.type === "throw") {
|
|
484
|
-
throw rootRecord.arg;
|
|
485
|
-
}
|
|
486
|
-
return this.rval;
|
|
487
|
-
},
|
|
488
|
-
dispatchException: function dispatchException(exception) {
|
|
489
|
-
var handle = function handle(loc, caught) {
|
|
490
|
-
record.type = "throw";
|
|
491
|
-
record.arg = exception;
|
|
492
|
-
context.next = loc;
|
|
493
|
-
if (caught) {
|
|
494
|
-
// If the dispatched exception was caught by a catch block,
|
|
495
|
-
// then let that catch block handle the exception normally.
|
|
496
|
-
context.method = "next";
|
|
497
|
-
context.arg = undefined$1;
|
|
498
|
-
}
|
|
499
|
-
return !!caught;
|
|
500
|
-
};
|
|
501
|
-
if (this.done) {
|
|
502
|
-
throw exception;
|
|
503
|
-
}
|
|
504
|
-
var context = this;
|
|
505
|
-
for(var i = this.tryEntries.length - 1; i >= 0; --i){
|
|
506
|
-
var entry = this.tryEntries[i];
|
|
507
|
-
var record = entry.completion;
|
|
508
|
-
if (entry.tryLoc === "root") {
|
|
509
|
-
// Exception thrown outside of any try block that could handle
|
|
510
|
-
// it, so set the completion value of the entire function to
|
|
511
|
-
// throw the exception.
|
|
512
|
-
return handle("end");
|
|
513
|
-
}
|
|
514
|
-
if (entry.tryLoc <= this.prev) {
|
|
515
|
-
var hasCatch = hasOwn.call(entry, "catchLoc");
|
|
516
|
-
var hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
517
|
-
if (hasCatch && hasFinally) {
|
|
518
|
-
if (this.prev < entry.catchLoc) {
|
|
519
|
-
return handle(entry.catchLoc, true);
|
|
520
|
-
} else if (this.prev < entry.finallyLoc) {
|
|
521
|
-
return handle(entry.finallyLoc);
|
|
522
|
-
}
|
|
523
|
-
} else if (hasCatch) {
|
|
524
|
-
if (this.prev < entry.catchLoc) {
|
|
525
|
-
return handle(entry.catchLoc, true);
|
|
526
|
-
}
|
|
527
|
-
} else if (hasFinally) {
|
|
528
|
-
if (this.prev < entry.finallyLoc) {
|
|
529
|
-
return handle(entry.finallyLoc);
|
|
530
|
-
}
|
|
531
|
-
} else {
|
|
532
|
-
throw new Error("try statement without catch or finally");
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
},
|
|
537
|
-
abrupt: function abrupt(type, arg) {
|
|
538
|
-
for(var i = this.tryEntries.length - 1; i >= 0; --i){
|
|
539
|
-
var entry = this.tryEntries[i];
|
|
540
|
-
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
541
|
-
var finallyEntry = entry;
|
|
542
|
-
break;
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
|
|
546
|
-
// Ignore the finally entry if control is not jumping to a
|
|
547
|
-
// location outside the try/catch block.
|
|
548
|
-
finallyEntry = null;
|
|
549
|
-
}
|
|
550
|
-
var record = finallyEntry ? finallyEntry.completion : {};
|
|
551
|
-
record.type = type;
|
|
552
|
-
record.arg = arg;
|
|
553
|
-
if (finallyEntry) {
|
|
554
|
-
this.method = "next";
|
|
555
|
-
this.next = finallyEntry.finallyLoc;
|
|
556
|
-
return ContinueSentinel;
|
|
557
|
-
}
|
|
558
|
-
return this.complete(record);
|
|
559
|
-
},
|
|
560
|
-
complete: function complete(record, afterLoc) {
|
|
561
|
-
if (record.type === "throw") {
|
|
562
|
-
throw record.arg;
|
|
563
|
-
}
|
|
564
|
-
if (record.type === "break" || record.type === "continue") {
|
|
565
|
-
this.next = record.arg;
|
|
566
|
-
} else if (record.type === "return") {
|
|
567
|
-
this.rval = this.arg = record.arg;
|
|
568
|
-
this.method = "return";
|
|
569
|
-
this.next = "end";
|
|
570
|
-
} else if (record.type === "normal" && afterLoc) {
|
|
571
|
-
this.next = afterLoc;
|
|
572
|
-
}
|
|
573
|
-
return ContinueSentinel;
|
|
574
|
-
},
|
|
575
|
-
finish: function finish(finallyLoc) {
|
|
576
|
-
for(var i = this.tryEntries.length - 1; i >= 0; --i){
|
|
577
|
-
var entry = this.tryEntries[i];
|
|
578
|
-
if (entry.finallyLoc === finallyLoc) {
|
|
579
|
-
this.complete(entry.completion, entry.afterLoc);
|
|
580
|
-
resetTryEntry(entry);
|
|
581
|
-
return ContinueSentinel;
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
},
|
|
585
|
-
"catch": function(tryLoc) {
|
|
586
|
-
for(var i = this.tryEntries.length - 1; i >= 0; --i){
|
|
587
|
-
var entry = this.tryEntries[i];
|
|
588
|
-
if (entry.tryLoc === tryLoc) {
|
|
589
|
-
var record = entry.completion;
|
|
590
|
-
if (record.type === "throw") {
|
|
591
|
-
var thrown = record.arg;
|
|
592
|
-
resetTryEntry(entry);
|
|
593
|
-
}
|
|
594
|
-
return thrown;
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
// The context.catch method must only be called with a location
|
|
598
|
-
// argument that corresponds to a known catch block.
|
|
599
|
-
throw new Error("illegal catch attempt");
|
|
600
|
-
},
|
|
601
|
-
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
602
|
-
this.delegate = {
|
|
603
|
-
iterator: values(iterable),
|
|
604
|
-
resultName: resultName,
|
|
605
|
-
nextLoc: nextLoc
|
|
606
|
-
};
|
|
607
|
-
if (this.method === "next") {
|
|
608
|
-
// Deliberately forget the last sent value so that we don't
|
|
609
|
-
// accidentally pass it on to the delegate.
|
|
610
|
-
this.arg = undefined$1;
|
|
611
|
-
}
|
|
612
|
-
return ContinueSentinel;
|
|
613
|
-
}
|
|
614
|
-
};
|
|
615
|
-
// Regardless of whether this script is executing as a CommonJS module
|
|
616
|
-
// or not, return the runtime object so that we can declare the variable
|
|
617
|
-
// regeneratorRuntime in the outer scope, which allows this module to be
|
|
618
|
-
// injected easily by `bin/regenerator --include-runtime script.js`.
|
|
619
|
-
return exports;
|
|
620
|
-
}(// If this script is executing as a CommonJS module, use module.exports
|
|
621
|
-
// as the regeneratorRuntime namespace. Otherwise create a new empty
|
|
622
|
-
// object. Either way, the resulting object will be used to initialize
|
|
623
|
-
// the regeneratorRuntime variable at the top of this file.
|
|
624
|
-
module.exports );
|
|
625
|
-
try {
|
|
626
|
-
regeneratorRuntime = runtime;
|
|
627
|
-
} catch (accidentalStrictMode) {
|
|
628
|
-
// This module should not be running in strict mode, so the above
|
|
629
|
-
// assignment should always work unless something is misconfigured. Just
|
|
630
|
-
// in case runtime.js accidentally runs in strict mode, we can escape
|
|
631
|
-
// strict mode using a global Function call. This could conceivably fail
|
|
632
|
-
// if a Content Security Policy forbids using Function, but in that case
|
|
633
|
-
// the proper solution is to fix the accidental strict mode problem. If
|
|
634
|
-
// you've misconfigured your bundler to force strict mode and applied a
|
|
635
|
-
// CSP to forbid Function, and you're not willing to fix either of those
|
|
636
|
-
// problems, please detail your unique predicament in a GitHub issue.
|
|
637
|
-
Function("r", "regeneratorRuntime = r")(runtime);
|
|
98
|
+
}
|
|
99
|
+
}); // console.log("rewrites", rewrites);
|
|
100
|
+
|
|
101
|
+
return rewrites;
|
|
102
|
+
});
|
|
638
103
|
}
|
|
639
|
-
|
|
104
|
+
/**
|
|
105
|
+
* Get Next.js config with some basic opinionated defaults
|
|
106
|
+
*/
|
|
640
107
|
|
|
641
|
-
|
|
108
|
+
function withKoine(_a = {}) {
|
|
109
|
+
var {
|
|
110
|
+
nx = true,
|
|
111
|
+
svg = true,
|
|
112
|
+
sc = true
|
|
113
|
+
} = _a,
|
|
114
|
+
nextConfig = _tslib.__rest(_a, ["nx", "svg", "sc"]);
|
|
642
115
|
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
}
|
|
672
|
-
function _defineProperty(obj, key, value) {
|
|
673
|
-
if (key in obj) {
|
|
674
|
-
Object.defineProperty(obj, key, {
|
|
675
|
-
value: value,
|
|
676
|
-
enumerable: true,
|
|
677
|
-
configurable: true,
|
|
678
|
-
writable: true
|
|
679
|
-
});
|
|
116
|
+
nextConfig = Object.assign({
|
|
117
|
+
// @see https://nextjs.org/docs/api-reference/next.config.js/custom-page-extensions#including-non-page-files-in-the-pages-directory
|
|
118
|
+
pageExtensions: ["page.tsx", "page.ts"],
|
|
119
|
+
eslint: {
|
|
120
|
+
ignoreDuringBuilds: true // we have this strict check on each commit
|
|
121
|
+
|
|
122
|
+
},
|
|
123
|
+
typescript: {
|
|
124
|
+
ignoreBuildErrors: true // we have this strict check on each commit
|
|
125
|
+
|
|
126
|
+
},
|
|
127
|
+
poweredByHeader: false,
|
|
128
|
+
swcMinify: true,
|
|
129
|
+
experimental: Object.assign({
|
|
130
|
+
// @see https://github.com/vercel/vercel/discussions/5973#discussioncomment-472618
|
|
131
|
+
// @see critters error https://github.com/vercel/next.js/issues/20742
|
|
132
|
+
// optimizeCss: true,
|
|
133
|
+
// @see https://github.com/vercel/next.js/discussions/30174#discussion-3643870
|
|
134
|
+
scrollRestoration: true
|
|
135
|
+
}, nextConfig.experimental || {})
|
|
136
|
+
}, nextConfig);
|
|
137
|
+
|
|
138
|
+
if (svg) {
|
|
139
|
+
if (nx) {
|
|
140
|
+
// @see https://github.com/gregberge/svgr
|
|
141
|
+
nextConfig["nx"] = {
|
|
142
|
+
svgr: true
|
|
143
|
+
};
|
|
680
144
|
} else {
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
145
|
+
nextConfig.webpack = (_config, options) => {
|
|
146
|
+
const webpackConfig = typeof nextConfig.webpack === "function" ? nextConfig.webpack(_config, options) : _config; // @see https://dev.to/dolearning/importing-svgs-to-next-js-nna#svgr
|
|
147
|
+
|
|
148
|
+
webpackConfig.module.rules.push({
|
|
149
|
+
test: /\.svg$/,
|
|
150
|
+
use: [{
|
|
151
|
+
loader: "@svgr/webpack",
|
|
152
|
+
options: {
|
|
153
|
+
svgoConfig: {
|
|
154
|
+
plugins: [{
|
|
155
|
+
name: "removeViewBox",
|
|
156
|
+
active: false
|
|
157
|
+
}]
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}]
|
|
696
161
|
});
|
|
162
|
+
return webpackConfig;
|
|
163
|
+
};
|
|
697
164
|
}
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
var key, i;
|
|
704
|
-
if (Object.getOwnPropertySymbols) {
|
|
705
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
706
|
-
for(i = 0; i < sourceSymbolKeys.length; i++){
|
|
707
|
-
key = sourceSymbolKeys[i];
|
|
708
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
709
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
710
|
-
target[key] = source[key];
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
return target;
|
|
714
|
-
}
|
|
715
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
716
|
-
if (source == null) return {};
|
|
717
|
-
var target = {};
|
|
718
|
-
var sourceKeys = Object.keys(source);
|
|
719
|
-
var key, i;
|
|
720
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
721
|
-
key = sourceKeys[i];
|
|
722
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
723
|
-
target[key] = source[key];
|
|
724
|
-
}
|
|
725
|
-
return target;
|
|
726
|
-
}
|
|
727
|
-
/**
|
|
728
|
-
* Normalise pathname
|
|
729
|
-
*
|
|
730
|
-
* From a path like `/some//malformed/path///` it returns `some/malformed/path`
|
|
731
|
-
*
|
|
732
|
-
* - Removes subsequent slashes
|
|
733
|
-
* - Removing initial and ending slashes
|
|
734
|
-
*/ function normaliseUrlPathname(pathname) {
|
|
735
|
-
return pathname.replace(/\/+\//g, "/").replace(/^\/+(.*?)\/+$/, "$1");
|
|
736
|
-
}
|
|
737
|
-
/**
|
|
738
|
-
* Clean a pathname and encode each part
|
|
739
|
-
*
|
|
740
|
-
* @see {@link normaliseUrlPathname}
|
|
741
|
-
*/ function encodePathname(pathname) {
|
|
742
|
-
var parts = normaliseUrlPathname(pathname).split("/");
|
|
743
|
-
return parts.filter(function(part) {
|
|
744
|
-
return !!part;
|
|
745
|
-
}).map(function(part) {
|
|
746
|
-
return encodeURIComponent(part);
|
|
747
|
-
}).join("/");
|
|
748
|
-
}
|
|
749
|
-
/**
|
|
750
|
-
*/ function getPathRedirect(locale, localisedPathname, templateName, dynamic, permanent) {
|
|
751
|
-
var suffix = dynamic ? "/:slug*" : "";
|
|
752
|
-
return {
|
|
753
|
-
source: "/".concat(locale, "/").concat(encodePathname(localisedPathname)).concat(suffix),
|
|
754
|
-
destination: "/".concat(encodePathname(templateName)).concat(suffix),
|
|
755
|
-
permanent: Boolean(permanent),
|
|
756
|
-
locale: false
|
|
757
|
-
};
|
|
758
|
-
}
|
|
759
|
-
/**
|
|
760
|
-
*/ function getPathRewrite(source, destination, dynamic) {
|
|
761
|
-
var suffix = dynamic ? "/:path*" : "";
|
|
762
|
-
return {
|
|
763
|
-
source: "/".concat(encodePathname(source)).concat(suffix),
|
|
764
|
-
destination: "/".concat(encodePathname(destination)).concat(suffix)
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (sc) {
|
|
168
|
+
nextConfig.compiler = {
|
|
169
|
+
styledComponents: true
|
|
765
170
|
};
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
return _getRedirects.apply(this, arguments);
|
|
770
|
-
}
|
|
771
|
-
function _getRedirects() {
|
|
772
|
-
_getRedirects = _asyncToGenerator(regeneratorRuntime$1.mark(function _callee(param) {
|
|
773
|
-
var defaultLocale, routes, dynamicRoutes, permanent, redirects;
|
|
774
|
-
return regeneratorRuntime$1.wrap(function _callee$(_ctx) {
|
|
775
|
-
while(1)switch(_ctx.prev = _ctx.next){
|
|
776
|
-
case 0:
|
|
777
|
-
defaultLocale = param.defaultLocale, routes = param.routes, dynamicRoutes = param.dynamicRoutes, permanent = param.permanent;
|
|
778
|
-
redirects = [];
|
|
779
|
-
Object.keys(routes).forEach(function(page) {
|
|
780
|
-
var dynamic = dynamicRoutes[page];
|
|
781
|
-
if (routes[page] !== page) {
|
|
782
|
-
if (dynamic) {
|
|
783
|
-
redirects.push(getPathRedirect(defaultLocale, page, routes[page], true, permanent));
|
|
784
|
-
} else {
|
|
785
|
-
redirects.push(getPathRedirect(defaultLocale, page, routes[page], false, permanent));
|
|
786
|
-
}
|
|
787
|
-
}
|
|
788
|
-
});
|
|
789
|
-
return _ctx.abrupt("return", redirects);
|
|
790
|
-
case 4:
|
|
791
|
-
case "end":
|
|
792
|
-
return _ctx.stop();
|
|
793
|
-
}
|
|
794
|
-
}, _callee);
|
|
795
|
-
}));
|
|
796
|
-
return _getRedirects.apply(this, arguments);
|
|
797
|
-
}
|
|
798
|
-
/**
|
|
799
|
-
*/ function getRewrites(_) {
|
|
800
|
-
return _getRewrites.apply(this, arguments);
|
|
801
|
-
}
|
|
802
|
-
function _getRewrites() {
|
|
803
|
-
_getRewrites = _asyncToGenerator(regeneratorRuntime$1.mark(function _callee(param) {
|
|
804
|
-
var routes, dynamicRoutes, rewrites;
|
|
805
|
-
return regeneratorRuntime$1.wrap(function _callee$(_ctx) {
|
|
806
|
-
while(1)switch(_ctx.prev = _ctx.next){
|
|
807
|
-
case 0:
|
|
808
|
-
routes = param.routes, dynamicRoutes = param.dynamicRoutes;
|
|
809
|
-
rewrites = [];
|
|
810
|
-
Object.keys(routes).forEach(function(page) {
|
|
811
|
-
var dynamic = dynamicRoutes[page];
|
|
812
|
-
if (routes[page] !== page) {
|
|
813
|
-
if (dynamic) {
|
|
814
|
-
rewrites.push(getPathRewrite(routes[page], page, true));
|
|
815
|
-
} else {
|
|
816
|
-
rewrites.push(getPathRewrite(routes[page], page));
|
|
817
|
-
}
|
|
818
|
-
}
|
|
819
|
-
});
|
|
820
|
-
return _ctx.abrupt("return", rewrites);
|
|
821
|
-
case 4:
|
|
822
|
-
case "end":
|
|
823
|
-
return _ctx.stop();
|
|
824
|
-
}
|
|
825
|
-
}, _callee);
|
|
826
|
-
}));
|
|
827
|
-
return _getRewrites.apply(this, arguments);
|
|
828
|
-
}
|
|
829
|
-
/**
|
|
830
|
-
* Get Next.js config with some basic opinionated defaults
|
|
831
|
-
*/ function withKoine() {
|
|
832
|
-
var _param = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
833
|
-
var _nx = _param.nx, nx = _nx === void 0 ? true : _nx, _svg = _param.svg, svg = _svg === void 0 ? true : _svg, _sc = _param.sc, sc = _sc === void 0 ? true : _sc, nextConfig = _objectWithoutProperties(_param, [
|
|
834
|
-
"nx",
|
|
835
|
-
"svg",
|
|
836
|
-
"sc"
|
|
837
|
-
]);
|
|
838
|
-
nextConfig = _objectSpread({
|
|
839
|
-
// @see https://nextjs.org/docs/api-reference/next.config.js/custom-page-extensions#including-non-page-files-in-the-pages-directory
|
|
840
|
-
pageExtensions: [
|
|
841
|
-
"page.tsx",
|
|
842
|
-
"page.ts"
|
|
843
|
-
],
|
|
844
|
-
eslint: {
|
|
845
|
-
ignoreDuringBuilds: true
|
|
846
|
-
},
|
|
847
|
-
typescript: {
|
|
848
|
-
ignoreBuildErrors: true
|
|
849
|
-
},
|
|
850
|
-
poweredByHeader: false,
|
|
851
|
-
swcMinify: true,
|
|
852
|
-
experimental: _objectSpread({
|
|
853
|
-
// @see https://github.com/vercel/vercel/discussions/5973#discussioncomment-472618
|
|
854
|
-
// @see critters error https://github.com/vercel/next.js/issues/20742
|
|
855
|
-
// optimizeCss: true,
|
|
856
|
-
// @see https://github.com/vercel/next.js/discussions/30174#discussion-3643870
|
|
857
|
-
scrollRestoration: true
|
|
858
|
-
}, nextConfig.experimental || {})
|
|
859
|
-
}, nextConfig);
|
|
860
|
-
if (svg) {
|
|
861
|
-
if (nx) {
|
|
862
|
-
// @see https://github.com/gregberge/svgr
|
|
863
|
-
nextConfig["nx"] = {
|
|
864
|
-
svgr: true
|
|
865
|
-
};
|
|
866
|
-
} else {
|
|
867
|
-
nextConfig.webpack = function(_config, options) {
|
|
868
|
-
var webpackConfig = typeof nextConfig.webpack === "function" ? nextConfig.webpack(_config, options) : _config;
|
|
869
|
-
// @see https://dev.to/dolearning/importing-svgs-to-next-js-nna#svgr
|
|
870
|
-
webpackConfig.module.rules.push({
|
|
871
|
-
test: /\.svg$/,
|
|
872
|
-
use: [
|
|
873
|
-
{
|
|
874
|
-
loader: "@svgr/webpack",
|
|
875
|
-
options: {
|
|
876
|
-
svgoConfig: {
|
|
877
|
-
plugins: [
|
|
878
|
-
{
|
|
879
|
-
name: "removeViewBox",
|
|
880
|
-
active: false
|
|
881
|
-
},
|
|
882
|
-
]
|
|
883
|
-
}
|
|
884
|
-
}
|
|
885
|
-
},
|
|
886
|
-
]
|
|
887
|
-
});
|
|
888
|
-
return webpackConfig;
|
|
889
|
-
};
|
|
890
|
-
}
|
|
891
|
-
}
|
|
892
|
-
if (sc) {
|
|
893
|
-
nextConfig.compiler = {
|
|
894
|
-
styledComponents: true
|
|
895
|
-
};
|
|
896
|
-
}
|
|
897
|
-
return nextConfig;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return nextConfig;
|
|
898
174
|
}
|
|
899
175
|
|
|
900
176
|
exports["default"] = withKoine;
|