@koine/next 2.0.0-beta.2 → 2.0.0-beta.200
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/12/AnalyticsGoogle.cjs.js +20 -0
- package/12/AnalyticsGoogle.d.ts +1 -1
- package/12/AnalyticsGoogle.esm.js +15 -0
- package/12/DisableErrorOverlay.cjs.js +11 -0
- package/12/DisableErrorOverlay.d.ts +1 -1
- package/12/DisableErrorOverlay.esm.js +6 -0
- package/12/Seo.d.ts +11 -3
- package/12/SeoDefaults.d.ts +7 -2
- package/12/seoBuildTags.d.ts +1 -2
- package/12/types.d.ts +5 -0
- package/12.cjs.default.js +1 -0
- package/12.cjs.js +9 -0
- package/12.cjs.mjs +2 -0
- package/12.d.ts +3 -0
- package/12.esm.js +2 -0
- package/README.md +0 -12
- package/ThemeContext.cjs.default.js +1 -0
- package/ThemeContext.cjs.js +10 -0
- package/ThemeContext.cjs.mjs +2 -0
- package/{12/ThemeContext.d.ts → ThemeContext.d.ts} +0 -1
- package/ThemeContext.esm.js +5 -0
- package/ThemeProvider.cjs.default.js +1 -0
- package/ThemeProvider.cjs.js +14 -0
- package/ThemeProvider.cjs.mjs +2 -0
- package/{12/ThemeProvider.d.ts → ThemeProvider.d.ts} +0 -1
- package/ThemeProvider.esm.js +9 -0
- package/config.cjs.default.js +1 -0
- package/config.cjs.js +8 -0
- package/config.cjs.mjs +2 -0
- package/config.d.ts +33 -0
- package/config.esm.js +6 -0
- package/index.cjs.default.js +1 -0
- package/index.cjs.js +13 -0
- package/index.cjs.mjs +2 -0
- package/index.d.ts +3 -1
- package/index.esm.js +4 -0
- package/load.cjs.default.js +1 -0
- package/load.cjs.js +8 -0
- package/load.cjs.mjs +2 -0
- package/load.d.ts +0 -0
- package/load.esm.js +3 -0
- package/package.json +61 -91
- package/typings.d.ts +39 -50
- package/useTheme.cjs.default.js +1 -0
- package/useTheme.cjs.js +11 -0
- package/useTheme.cjs.mjs +2 -0
- package/{12/useTheme.d.ts → useTheme.d.ts} +1 -1
- package/useTheme.esm.js +6 -0
- package/vite.config.d.ts +2 -0
- package/12/AnalyticsGoogle.js +0 -39
- package/12/AnalyticsGoogle.mjs +0 -34
- package/12/DisableErrorOverlay.js +0 -18
- package/12/DisableErrorOverlay.mjs +0 -13
- package/12/DynamicNamespaces.d.ts +0 -13
- package/12/DynamicNamespaces.js +0 -13
- package/12/DynamicNamespaces.mjs +0 -9
- package/12/Favicon.d.ts +0 -4
- package/12/Favicon.js +0 -10
- package/12/Favicon.mjs +0 -6
- package/12/Link.d.ts +0 -10
- package/12/Link.js +0 -15
- package/12/Link.mjs +0 -12
- package/12/NextProgress.d.ts +0 -25
- package/12/NextProgress.js +0 -46
- package/12/NextProgress.mjs +0 -42
- package/12/Seo.js +0 -34
- package/12/Seo.mjs +0 -29
- package/12/SeoDefaults.js +0 -17
- package/12/SeoDefaults.mjs +0 -12
- package/12/T.d.ts +0 -16
- package/12/T.js +0 -17
- package/12/T.mjs +0 -13
- package/12/ThemeContext.js +0 -10
- package/12/ThemeContext.mjs +0 -7
- package/12/ThemeProvider.js +0 -239
- package/12/ThemeProvider.mjs +0 -235
- package/12/TransText.d.ts +0 -3
- package/12/TransText.js +0 -8
- package/12/TransText.mjs +0 -4
- package/12/app/AppHead.d.ts +0 -3
- package/12/app/AppHead.js +0 -11
- package/12/app/AppHead.mjs +0 -6
- package/12/app/AppMain.d.ts +0 -35
- package/12/app/AppMain.js +0 -2
- package/12/app/AppMain.mjs +0 -1
- package/12/app/css/AppMain.d.ts +0 -9
- package/12/app/css/AppMain.js +0 -18
- package/12/app/css/AppMain.mjs +0 -14
- package/12/app/css/AppTheme.d.ts +0 -11
- package/12/app/css/AppTheme.js +0 -18
- package/12/app/css/AppTheme.mjs +0 -14
- package/12/app/css/auth/index.d.ts +0 -11
- package/12/app/css/auth/index.js +0 -17
- package/12/app/css/auth/index.mjs +0 -13
- package/12/app/css/auth/package.json +0 -6
- package/12/app/css/index.d.ts +0 -54
- package/12/app/css/index.js +0 -61
- package/12/app/css/index.mjs +0 -57
- package/12/app/css/package.json +0 -6
- package/12/app/index.d.ts +0 -2
- package/12/app/index.js +0 -5
- package/12/app/index.mjs +0 -2
- package/12/app/package.json +0 -6
- package/12/app/sc/AppMain.d.ts +0 -11
- package/12/app/sc/AppMain.js +0 -29
- package/12/app/sc/AppMain.mjs +0 -25
- package/12/app/sc/AppTheme.d.ts +0 -14
- package/12/app/sc/AppTheme.js +0 -15
- package/12/app/sc/AppTheme.mjs +0 -11
- package/12/app/sc/auth/index.d.ts +0 -11
- package/12/app/sc/auth/index.js +0 -17
- package/12/app/sc/auth/index.mjs +0 -13
- package/12/app/sc/auth/package.json +0 -6
- package/12/app/sc/index.d.ts +0 -56
- package/12/app/sc/index.js +0 -63
- package/12/app/sc/index.mjs +0 -59
- package/12/app/sc/package.json +0 -6
- package/12/document/Document.d.ts +0 -15
- package/12/document/Document.js +0 -31
- package/12/document/Document.mjs +0 -28
- package/12/document/css/index.d.ts +0 -17
- package/12/document/css/index.js +0 -45
- package/12/document/css/index.mjs +0 -45
- package/12/document/css/package.json +0 -6
- package/12/document/index.d.ts +0 -2
- package/12/document/index.js +0 -7
- package/12/document/index.mjs +0 -2
- package/12/document/package.json +0 -6
- package/12/document/sc/index.d.ts +0 -19
- package/12/document/sc/index.js +0 -67
- package/12/document/sc/index.mjs +0 -64
- package/12/document/sc/package.json +0 -6
- package/12/getT.d.ts +0 -9
- package/12/getT.js +0 -14
- package/12/getT.mjs +0 -10
- package/12/index.d.ts +0 -24
- package/12/index.js +0 -52
- package/12/index.mjs +0 -27
- package/12/package.json +0 -6
- package/12/seoBuildTags.js +0 -121
- package/12/seoBuildTags.mjs +0 -117
- package/12/to.d.ts +0 -24
- package/12/to.js +0 -29
- package/12/to.mjs +0 -25
- package/12/translationAsOptions.d.ts +0 -3
- package/12/translationAsOptions.js +0 -13
- package/12/translationAsOptions.mjs +0 -9
- package/12/types-i18n.d.ts +0 -118
- package/12/types-i18n.js +0 -14
- package/12/types-i18n.mjs +0 -13
- package/12/types-seo.d.ts +0 -7
- package/12/types-seo.js +0 -2
- package/12/types-seo.mjs +0 -1
- package/12/useBackUrl.d.ts +0 -2
- package/12/useBackUrl.js +0 -33
- package/12/useBackUrl.mjs +0 -28
- package/12/useDateFormat.d.ts +0 -7
- package/12/useDateFormat.js +0 -43
- package/12/useDateFormat.mjs +0 -39
- package/12/useForm.d.ts +0 -27
- package/12/useForm.js +0 -39
- package/12/useForm.mjs +0 -35
- package/12/useLocale.d.ts +0 -2
- package/12/useLocale.js +0 -11
- package/12/useLocale.mjs +0 -6
- package/12/useT.d.ts +0 -4
- package/12/useT.js +0 -44
- package/12/useT.mjs +0 -21
- package/12/useTheme.js +0 -12
- package/12/useTheme.mjs +0 -8
- package/12/useTo.d.ts +0 -3
- package/12/useTo.js +0 -19
- package/12/useTo.mjs +0 -15
- package/config/index.d.ts +0 -160
- package/config/index.js +0 -343
- package/config/index.mjs +0 -332
- package/config/package.json +0 -6
- package/getSiteUrl.d.ts +0 -8
- package/getSiteUrl.js +0 -17
- package/getSiteUrl.mjs +0 -12
- package/index.js +0 -7
- package/index.mjs +0 -2
- package/load.js +0 -18
- package/load.mjs +0 -14
package/12/useForm.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use client";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.useForm = void 0;
|
|
5
|
-
var tslib_1 = require("tslib");
|
|
6
|
-
var react_1 = require("react");
|
|
7
|
-
var react_hook_form_1 = require("react-hook-form");
|
|
8
|
-
var yup_1 = require("@hookform/resolvers/yup");
|
|
9
|
-
function useForm(
|
|
10
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11
|
-
schema, t, formProps, debug) {
|
|
12
|
-
if (formProps === void 0) { formProps = {}; }
|
|
13
|
-
// const form = _useForm<InferType<ObjectSchema<T, object>>>({
|
|
14
|
-
var form = (0, react_hook_form_1.useForm)(tslib_1.__assign({
|
|
15
|
-
// @ts-expect-error FIXME:
|
|
16
|
-
resolver: (0, yup_1.yupResolver)(schema) }, formProps));
|
|
17
|
-
// const { control, register, setValue } = form;
|
|
18
|
-
// const field = { control, register, setValue, t };
|
|
19
|
-
// if (process.env["NODE_ENV"] !== "production") {
|
|
20
|
-
// if (debug) {
|
|
21
|
-
// console.info(
|
|
22
|
-
// `Form ${i18nNamespace} data`,
|
|
23
|
-
// form.watch(),
|
|
24
|
-
// `errors: `,
|
|
25
|
-
// form.formState.errors
|
|
26
|
-
// );
|
|
27
|
-
// }
|
|
28
|
-
// }
|
|
29
|
-
// if (formProps.mode === "onChange") {
|
|
30
|
-
// return { field, ...form };
|
|
31
|
-
// }
|
|
32
|
-
return (0, react_1.useMemo)(function () {
|
|
33
|
-
var control = form.control, register = form.register, setValue = form.setValue;
|
|
34
|
-
var field = { control: control, register: register, setValue: setValue, t: t };
|
|
35
|
-
return tslib_1.__assign({ field: field }, form);
|
|
36
|
-
}, [t, form]);
|
|
37
|
-
}
|
|
38
|
-
exports.useForm = useForm;
|
|
39
|
-
exports.default = useForm;
|
package/12/useForm.mjs
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { __assign } from "tslib";
|
|
3
|
-
import { useMemo } from "react";
|
|
4
|
-
import { useForm as _useForm } from "react-hook-form";
|
|
5
|
-
import { yupResolver as resolver } from "@hookform/resolvers/yup";
|
|
6
|
-
export function useForm(
|
|
7
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
|
-
schema, t, formProps, debug) {
|
|
9
|
-
if (formProps === void 0) { formProps = {}; }
|
|
10
|
-
// const form = _useForm<InferType<ObjectSchema<T, object>>>({
|
|
11
|
-
var form = _useForm(__assign({
|
|
12
|
-
// @ts-expect-error FIXME:
|
|
13
|
-
resolver: resolver(schema) }, formProps));
|
|
14
|
-
// const { control, register, setValue } = form;
|
|
15
|
-
// const field = { control, register, setValue, t };
|
|
16
|
-
// if (process.env["NODE_ENV"] !== "production") {
|
|
17
|
-
// if (debug) {
|
|
18
|
-
// console.info(
|
|
19
|
-
// `Form ${i18nNamespace} data`,
|
|
20
|
-
// form.watch(),
|
|
21
|
-
// `errors: `,
|
|
22
|
-
// form.formState.errors
|
|
23
|
-
// );
|
|
24
|
-
// }
|
|
25
|
-
// }
|
|
26
|
-
// if (formProps.mode === "onChange") {
|
|
27
|
-
// return { field, ...form };
|
|
28
|
-
// }
|
|
29
|
-
return useMemo(function () {
|
|
30
|
-
var control = form.control, register = form.register, setValue = form.setValue;
|
|
31
|
-
var field = { control: control, register: register, setValue: setValue, t: t };
|
|
32
|
-
return __assign({ field: field }, form);
|
|
33
|
-
}, [t, form]);
|
|
34
|
-
}
|
|
35
|
-
export default useForm;
|
package/12/useLocale.d.ts
DELETED
package/12/useLocale.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use client";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.useLocale = void 0;
|
|
5
|
-
var tslib_1 = require("tslib");
|
|
6
|
-
var useTranslation_1 = tslib_1.__importDefault(require("next-translate/useTranslation"));
|
|
7
|
-
function useLocale() {
|
|
8
|
-
return (0, useTranslation_1.default)().lang;
|
|
9
|
-
}
|
|
10
|
-
exports.useLocale = useLocale;
|
|
11
|
-
exports.default = useLocale;
|
package/12/useLocale.mjs
DELETED
package/12/useT.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { TranslateNamespace, TranslateDefault, TranslateNamespaced } from "./types-i18n";
|
|
2
|
-
export declare function useT(): TranslateDefault;
|
|
3
|
-
export declare function useT<TNamespace extends TranslateNamespace>(namespace: TNamespace): TranslateNamespaced<TNamespace>;
|
|
4
|
-
export default useT;
|
package/12/useT.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use client";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.useT = void 0;
|
|
5
|
-
var tslib_1 = require("tslib");
|
|
6
|
-
var react_1 = require("react");
|
|
7
|
-
// import useTranslation from "next-translate/useTranslation";
|
|
8
|
-
var context_1 = tslib_1.__importDefault(require("next-translate/context"));
|
|
9
|
-
function useT(namespace) {
|
|
10
|
-
var t = (0, react_1.useContext)(context_1.default).t;
|
|
11
|
-
// const t = useTranslation().t;
|
|
12
|
-
var tMemoized = (0, react_1.useMemo)(function () {
|
|
13
|
-
return function (s, q, o) {
|
|
14
|
-
return t(namespace ? "".concat(namespace, ":").concat(s) : "".concat(s), q === "obj" || q === "" ? null : q, q === "obj" || o === "obj"
|
|
15
|
-
? { returnObjects: true }
|
|
16
|
-
: q === "" || o === ""
|
|
17
|
-
? { fallback: "" }
|
|
18
|
-
: o);
|
|
19
|
-
// ) as TReturn extends (undefined | never | unknown) ? TranslateReturn<TranslationQuery, TranslationOptions> : TReturn;
|
|
20
|
-
// );
|
|
21
|
-
};
|
|
22
|
-
}, [t, namespace]);
|
|
23
|
-
return tMemoized;
|
|
24
|
-
}
|
|
25
|
-
exports.useT = useT;
|
|
26
|
-
exports.default = useT;
|
|
27
|
-
// Instead of wrapping the `useTranslation` hook from [`next-translate`](https://github.com/vinissimus/next-translate/blob/master/src/useTranslation.tsx)
|
|
28
|
-
// we might just rewrite it with our custom implementation but the `_context`
|
|
29
|
-
// to use is not exposed by the library...
|
|
30
|
-
// import { useContext/* , useMemo */ } from "react"
|
|
31
|
-
// // import wrapTWithDefaultNs from "next-translate";
|
|
32
|
-
// import I18nContext from "next-translate/context";
|
|
33
|
-
// import type { Translate } from "./types-i18n";
|
|
34
|
-
// export default function useT(_defaultNS?: string) {
|
|
35
|
-
// const ctx = useContext(I18nContext);
|
|
36
|
-
// return ctx.t as Translate;
|
|
37
|
-
// // return useMemo(
|
|
38
|
-
// // () => ({
|
|
39
|
-
// // ...ctx,
|
|
40
|
-
// // t: wrapTWithDefaultNs(ctx.t, defaultNS),
|
|
41
|
-
// // }),
|
|
42
|
-
// // [ctx, defaultNS]
|
|
43
|
-
// // )
|
|
44
|
-
// }
|
package/12/useT.mjs
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useContext, useMemo } from "react";
|
|
3
|
-
// import useTranslation from "next-translate/useTranslation";
|
|
4
|
-
import I18nContext from "next-translate/context";
|
|
5
|
-
export function useT(namespace) {
|
|
6
|
-
var t = useContext(I18nContext).t;
|
|
7
|
-
// const t = useTranslation().t;
|
|
8
|
-
var tMemoized = useMemo(function () {
|
|
9
|
-
return function (s, q, o) {
|
|
10
|
-
return t(namespace ? "".concat(namespace, ":").concat(s) : "".concat(s), q === "obj" || q === "" ? null : q, q === "obj" || o === "obj"
|
|
11
|
-
? { returnObjects: true }
|
|
12
|
-
: q === "" || o === ""
|
|
13
|
-
? { fallback: "" }
|
|
14
|
-
: o);
|
|
15
|
-
// ) as TReturn extends (undefined | never | unknown) ? TranslateReturn<TranslationQuery, TranslationOptions> : TReturn;
|
|
16
|
-
// );
|
|
17
|
-
};
|
|
18
|
-
}, [t, namespace]);
|
|
19
|
-
return tMemoized;
|
|
20
|
-
}
|
|
21
|
-
export default useT;
|
package/12/useTheme.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use client";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.useTheme = void 0;
|
|
5
|
-
var react_1 = require("react");
|
|
6
|
-
var ThemeContext_1 = require("./ThemeContext");
|
|
7
|
-
/**
|
|
8
|
-
* @borrows [next-themes](https://github.com/pacocoursey/next-themes)
|
|
9
|
-
*/
|
|
10
|
-
var useTheme = function () { return (0, react_1.useContext)(ThemeContext_1.ThemeContext); };
|
|
11
|
-
exports.useTheme = useTheme;
|
|
12
|
-
exports.default = exports.useTheme;
|
package/12/useTheme.mjs
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useContext } from "react";
|
|
3
|
-
import { ThemeContext } from "./ThemeContext";
|
|
4
|
-
/**
|
|
5
|
-
* @borrows [next-themes](https://github.com/pacocoursey/next-themes)
|
|
6
|
-
*/
|
|
7
|
-
export var useTheme = function () { return useContext(ThemeContext); };
|
|
8
|
-
export default useTheme;
|
package/12/useTo.d.ts
DELETED
package/12/useTo.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use client";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.useTo = void 0;
|
|
5
|
-
var tslib_1 = require("tslib");
|
|
6
|
-
var useT_1 = require("./useT");
|
|
7
|
-
var to_1 = require("./to");
|
|
8
|
-
function useTo() {
|
|
9
|
-
var t = (0, useT_1.useT)("~");
|
|
10
|
-
return function () {
|
|
11
|
-
var args = [];
|
|
12
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
13
|
-
args[_i] = arguments[_i];
|
|
14
|
-
}
|
|
15
|
-
return to_1.to.apply(void 0, tslib_1.__spreadArray([t], args, false));
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
exports.useTo = useTo;
|
|
19
|
-
exports.default = useTo;
|
package/12/useTo.mjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { __spreadArray } from "tslib";
|
|
3
|
-
import { useT } from "./useT";
|
|
4
|
-
import { to } from "./to";
|
|
5
|
-
export function useTo() {
|
|
6
|
-
var t = useT("~");
|
|
7
|
-
return function () {
|
|
8
|
-
var args = [];
|
|
9
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
10
|
-
args[_i] = arguments[_i];
|
|
11
|
-
}
|
|
12
|
-
return to.apply(void 0, __spreadArray([t], args, false));
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export default useTo;
|
package/config/index.d.ts
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import type { NextConfig } from "next";
|
|
2
|
-
import type { Redirect, Rewrite } from "next/dist/lib/load-custom-routes";
|
|
3
|
-
type Route = string | {
|
|
4
|
-
[key: string]: Route | string;
|
|
5
|
-
};
|
|
6
|
-
type Routes = Record<string, Route>;
|
|
7
|
-
type RoutesMapRoute = {
|
|
8
|
-
template: string;
|
|
9
|
-
pathname: string;
|
|
10
|
-
wildcard?: boolean;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Normalise pathname
|
|
14
|
-
*
|
|
15
|
-
* From a path like `/some//malformed/path///` it returns `some/malformed/path`
|
|
16
|
-
*
|
|
17
|
-
* - Removes subsequent slashes
|
|
18
|
-
* - Removing initial and ending slashes
|
|
19
|
-
* - Returns an empty string `"""` if only slashes are given
|
|
20
|
-
*/
|
|
21
|
-
export declare function normaliseUrlPathname(pathname?: string): string;
|
|
22
|
-
/**
|
|
23
|
-
* Transform to path any absolute or relative URL
|
|
24
|
-
*
|
|
25
|
-
* Useful when setting up `rewrites` and `redirects` especally in a [multi-zones
|
|
26
|
-
* setup](https://nextjs.org/docs/advanced-features/multi-zones).
|
|
27
|
-
*
|
|
28
|
-
* From a path like `http://localhost/some//malformed/path///` it returns `/some/malformed/path`
|
|
29
|
-
*
|
|
30
|
-
* @see {@link normaliseUrlPathname}
|
|
31
|
-
*/
|
|
32
|
-
export declare function toPath(urlOrPathname?: string): string;
|
|
33
|
-
/**
|
|
34
|
-
* Clean a pathname and encode each part
|
|
35
|
-
*
|
|
36
|
-
* @see {@link normaliseUrlPathname}
|
|
37
|
-
*/
|
|
38
|
-
export declare function encodePathname(pathname?: string): string;
|
|
39
|
-
/**
|
|
40
|
-
* Get path rewrite
|
|
41
|
-
*/
|
|
42
|
-
export declare function getPathRewrite(route: RoutesMapRoute): {
|
|
43
|
-
source: string;
|
|
44
|
-
destination: string;
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* Get path redirect
|
|
48
|
-
*/
|
|
49
|
-
export declare function getPathRedirect(locale: string | undefined, route: RoutesMapRoute, permanent?: boolean): {
|
|
50
|
-
source: string;
|
|
51
|
-
destination: string;
|
|
52
|
-
permanent: boolean;
|
|
53
|
-
locale: false;
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
*/
|
|
57
|
-
export declare function getRedirects(defaultLocale: string, routes: Routes, permanent?: boolean, debug?: boolean): Promise<Redirect[]>;
|
|
58
|
-
/**
|
|
59
|
-
*/
|
|
60
|
-
export declare function getRewrites(routes: Routes, debug?: boolean): Promise<Rewrite[]>;
|
|
61
|
-
type KoineNextConfig = {
|
|
62
|
-
/** @default true Nx monorepo setup */
|
|
63
|
-
nx?: boolean;
|
|
64
|
-
/** @default true Svg to react components */
|
|
65
|
-
svg?: boolean;
|
|
66
|
-
/** @default true Styled components enabled */
|
|
67
|
-
sc?: boolean;
|
|
68
|
-
/**
|
|
69
|
-
* When true uses `*.page.ts` or `*.page.tsx` extension for next.js config option [`pageExtensions`](https://nextjs.org/docs/api-reference/next.config.js/custom-page-extensions#including-non-page-files-in-the-pages-directory). When `true` it enables the same for `next-translate`
|
|
70
|
-
* @default false
|
|
71
|
-
*/
|
|
72
|
-
page?: boolean;
|
|
73
|
-
/**
|
|
74
|
-
* A JSON file containing the routes definition mapping template folders
|
|
75
|
-
* to localised slugs. It supports slugs's dynamic portions.
|
|
76
|
-
* All translated slugs needs to be defined starting from root `/`.
|
|
77
|
-
* The `require("...json")` file for each locale should look like:
|
|
78
|
-
*
|
|
79
|
-
* ```json
|
|
80
|
-
* {
|
|
81
|
-
* "home": "/",
|
|
82
|
-
* "products": {
|
|
83
|
-
* "list": "/products",
|
|
84
|
-
* "[category]": "/products/{{ category }}",
|
|
85
|
-
* "[tag]": {
|
|
86
|
-
* "view": "/products/{{ category }}/{{ tag }}",
|
|
87
|
-
* "related": "/products/{{ category }}/{{ tag }}/related"
|
|
88
|
-
* }
|
|
89
|
-
* },
|
|
90
|
-
* "company": {
|
|
91
|
-
* "about": "/about",
|
|
92
|
-
* "contact": "/contact"
|
|
93
|
-
* }
|
|
94
|
-
* }
|
|
95
|
-
* ```
|
|
96
|
-
*
|
|
97
|
-
* Here we also account for wildcards, those should only be defined in the
|
|
98
|
-
* pathname part of the JSON file, e.g.:
|
|
99
|
-
*
|
|
100
|
-
* ```json
|
|
101
|
-
* {
|
|
102
|
-
* "category": {
|
|
103
|
-
* "[slug]": {
|
|
104
|
-
* "[id]": "/categories/{{ slug }}/{{ id }}*"
|
|
105
|
-
* }
|
|
106
|
-
* }
|
|
107
|
-
* }
|
|
108
|
-
* ```
|
|
109
|
-
* This might be desired when we want to have param-based pagination, e.g. when
|
|
110
|
-
* we have the following folder structure:
|
|
111
|
-
*
|
|
112
|
-
* ```yml
|
|
113
|
-
* |__/category
|
|
114
|
-
* |__/[slug]
|
|
115
|
-
* |__/[id]
|
|
116
|
-
* |__/[[...page]].tsx
|
|
117
|
-
* ```
|
|
118
|
-
*
|
|
119
|
-
* NOTE1:
|
|
120
|
-
* You cannot name your dynamic template file "index.tsx" when they have nested
|
|
121
|
-
* segments or the rewrites won't work. So while this is allowed:
|
|
122
|
-
* `/pages/cats/[category]/index.tsx` it is not when you also have e.g.:
|
|
123
|
-
* `/pages/cats/[category]/reviews.tsx`
|
|
124
|
-
* TODO: This might be fixable? Is this fixed now?
|
|
125
|
-
*
|
|
126
|
-
* NOTE2:
|
|
127
|
-
* When `routes` is used be sure to pass before than the `i18n.defaultLocale`
|
|
128
|
-
* configuration. That is used for localised routing. By default we set `i18n`
|
|
129
|
-
* as such:
|
|
130
|
-
* ```js
|
|
131
|
-
* {
|
|
132
|
-
* // ...nextConfig,
|
|
133
|
-
* i18n: {
|
|
134
|
-
* defaultLocale: "en",
|
|
135
|
-
* locales: ["en"],
|
|
136
|
-
* }
|
|
137
|
-
* }
|
|
138
|
-
* ```
|
|
139
|
-
*/
|
|
140
|
-
routes?: Routes;
|
|
141
|
-
/**
|
|
142
|
-
* Whether the routes redirecting should be permanent. Switch this on once you
|
|
143
|
-
* go live and the routes structure is stable.
|
|
144
|
-
*/
|
|
145
|
-
permanent?: boolean;
|
|
146
|
-
debug?: boolean;
|
|
147
|
-
};
|
|
148
|
-
/**
|
|
149
|
-
* Get Next.js config with some basic opinionated defaults
|
|
150
|
-
*
|
|
151
|
-
* @param {object} options
|
|
152
|
-
* @property {boolean} [options.nx=false] Nx monorepo setup
|
|
153
|
-
* @property {boolean} [options.svg=false] Svg to react components
|
|
154
|
-
* @property {boolean} [options.sc=false] Styled components enabled
|
|
155
|
-
* @property {boolean} [options.page=false] When `true` uses `*.page.ts` or `*.page.tsx`
|
|
156
|
-
* extension for next.js config option [`pageExtensions`](https://nextjs.org/docs/api-reference/next.config.js/custom-page-extensions#including-non-page-files-in-the-pages-directory)
|
|
157
|
-
* and it enables the same for `next-translate`.
|
|
158
|
-
*/
|
|
159
|
-
export declare function withKoine({ nx, svg, sc, page, routes, permanent, debug, ...custom }?: NextConfig & KoineNextConfig): NextConfig;
|
|
160
|
-
export default withKoine;
|