@koine/next 1.0.9 → 1.0.12
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.js +12 -16
- package/Auth/helpers.js +6 -5
- package/Auth/useLogin.js +17 -18
- package/Auth/useLoginUrl.js +5 -5
- package/Auth/useLogout.js +19 -19
- package/Favicon/Favicon.js +2 -1
- package/Forms/useForm.js +11 -13
- package/Forms/useSubmit.js +24 -19
- package/I18n/I18n.js +35 -14
- package/Img/Img.js +22 -20
- package/Link/Link.js +4 -2
- package/NextProgress/NextProgress.js +12 -9
- package/Seo/Seo.js +2 -2
- package/Seo/SeoDefaults.js +2 -2
- package/Seo/helpers.js +34 -30
- package/Theme/Theme.js +98 -88
- package/app/AppHead.js +1 -1
- package/app/css/AppMain.js +4 -2
- package/app/css/AppTheme.js +4 -2
- package/app/css/auth/index.js +3 -2
- package/app/css/index.js +3 -2
- package/app/em/AppMain.js +9 -7
- package/app/em/AppTheme.js +6 -5
- package/app/em/auth/index.js +3 -2
- package/app/em/index.js +3 -2
- package/app/sc/AppMain.js +9 -7
- package/app/sc/AppTheme.js +4 -2
- package/app/sc/auth/index.js +3 -2
- package/app/sc/index.js +3 -2
- package/config/index.js +62 -72
- package/document/Document.js +12 -5
- package/document/css/index.js +26 -12
- package/document/em/index.js +39 -48
- package/document/sc/index.js +44 -23
- package/node/Analytics/AnalyticsGoogle.js +17 -22
- package/node/Analytics/index.js +1 -1
- package/node/Auth/helpers.js +6 -5
- package/node/Auth/index.js +1 -1
- package/node/Auth/useLogin.js +23 -24
- package/node/Auth/useLoginUrl.js +8 -8
- package/node/Auth/useLogout.js +25 -25
- package/node/Favicon/Favicon.js +5 -5
- package/node/Favicon/index.js +1 -1
- package/node/Forms/index.js +1 -1
- package/node/Forms/useForm.js +15 -17
- package/node/Forms/useSubmit.js +25 -20
- package/node/Head/index.js +1 -1
- package/node/I18n/I18n.js +40 -20
- package/node/I18n/index.js +1 -1
- package/node/Img/Img.js +24 -23
- package/node/Img/index.js +1 -1
- package/node/Link/Link.js +7 -6
- package/node/Link/index.js +1 -1
- package/node/NextProgress/NextProgress.js +15 -12
- package/node/Seo/Seo.js +6 -6
- package/node/Seo/SeoDefaults.js +6 -6
- package/node/Seo/helpers.js +36 -32
- package/node/Seo/index.js +1 -1
- package/node/Theme/Theme.js +102 -93
- package/node/Theme/index.js +1 -1
- package/node/app/AppHead.js +4 -4
- package/node/app/css/AppMain.js +7 -6
- package/node/app/css/AppTheme.js +6 -4
- package/node/app/css/auth/index.js +9 -9
- package/node/app/css/index.js +8 -8
- package/node/app/em/AppMain.js +16 -14
- package/node/app/em/AppTheme.js +13 -13
- package/node/app/em/auth/index.js +9 -9
- package/node/app/em/index.js +8 -8
- package/node/app/index.js +1 -1
- package/node/app/sc/AppMain.js +16 -14
- package/node/app/sc/AppTheme.js +7 -5
- package/node/app/sc/auth/index.js +9 -9
- package/node/app/sc/index.js +8 -8
- package/node/config/index.js +62 -72
- package/node/document/Document.js +14 -9
- package/node/document/css/index.js +29 -17
- package/node/document/em/index.js +43 -54
- package/node/document/sc/index.js +48 -29
- package/node/index.js +1 -1
- package/node/utils/api.js +41 -32
- package/node/utils/emotion-cache.js +2 -2
- package/node/utils/index.js +7 -6
- package/package.json +28 -2
- package/utils/api.js +40 -31
- package/utils/index.js +7 -6
package/node/app/em/AppMain.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AppMain = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var react_1 = require("react");
|
|
6
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
var router_1 = require("next/router");
|
|
8
|
+
var framer_motion_1 = require("framer-motion");
|
|
9
|
+
var m_1 = require("@koine/react/m");
|
|
10
|
+
var Seo_1 = require("../../Seo");
|
|
11
|
+
var NextProgress_1 = require("../../NextProgress");
|
|
11
12
|
/**
|
|
12
13
|
* App main
|
|
13
14
|
*
|
|
@@ -15,12 +16,13 @@ const NextProgress_1 = require("../../NextProgress");
|
|
|
15
16
|
*
|
|
16
17
|
* About the page transition [wallis' blog post](https://wallis.dev/blog/nextjs-page-transitions-with-framer-motion)
|
|
17
18
|
*/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
var AppMain = function (_a) {
|
|
20
|
+
var Component = _a.Component, pageProps = _a.pageProps, Layout = _a.Layout, ProgressOverlay = _a.ProgressOverlay, seo = _a.seo, motion = _a.motion, _b = _a.transition, transition = _b === void 0 ? {
|
|
21
|
+
initial: { opacity: 0 },
|
|
22
|
+
animate: { opacity: 1 },
|
|
23
|
+
exit: { opacity: 0 },
|
|
24
|
+
} : _b, pre = _a.pre, post = _a.post;
|
|
25
|
+
var pathname = (0, router_1.useRouter)().pathname;
|
|
26
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Seo_1.SeoDefaults, tslib_1.__assign({}, seo)), pre, (0, jsx_runtime_1.jsxs)(m_1.MotionProvider, tslib_1.__assign({ features: motion }, { children: [ProgressOverlay && (0, jsx_runtime_1.jsx)(NextProgress_1.NextProgress, { Overlay: ProgressOverlay }), (0, jsx_runtime_1.jsx)(Layout, { children: (0, jsx_runtime_1.jsx)(framer_motion_1.AnimatePresence, tslib_1.__assign({ exitBeforeEnter: true, initial: false }, { children: (0, jsx_runtime_1.jsx)(framer_motion_1.m.div, tslib_1.__assign({}, transition, { children: (0, react_1.createElement)(Component, tslib_1.__assign({}, pageProps, { key: pathname })) }), pathname) })) })] })), post] }));
|
|
25
27
|
};
|
|
26
28
|
exports.AppMain = AppMain;
|
package/node/app/em/AppTheme.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AppTheme = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
var styles_1 = require("@mui/material/styles");
|
|
7
|
+
var react_1 = require("@emotion/react");
|
|
8
|
+
var CssBaseline_1 = tslib_1.__importDefault(require("@mui/material/CssBaseline"));
|
|
9
|
+
var react_2 = require("@emotion/react");
|
|
10
|
+
var sc_1 = require("@koine/react/sc");
|
|
11
|
+
var emotion_cache_1 = require("../../utils/emotion-cache");
|
|
12
12
|
// client-side cache, shared for the whole session of the user in the browser.
|
|
13
|
-
|
|
13
|
+
var clientSideEmotionCache = (0, emotion_cache_1.createEmotionCache)();
|
|
14
14
|
/**
|
|
15
15
|
* App theme with `emotion` (good for `@mui`)s
|
|
16
16
|
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
` }), children] }) }));
|
|
17
|
+
var AppTheme = function (_a) {
|
|
18
|
+
var _b = _a.emotionCache, emotionCache = _b === void 0 ? clientSideEmotionCache : _b, theme = _a.theme, children = _a.children;
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)(react_1.CacheProvider, tslib_1.__assign({ value: emotionCache }, { children: (0, jsx_runtime_1.jsxs)(styles_1.ThemeProvider, tslib_1.__assign({ theme: theme }, { children: [(0, jsx_runtime_1.jsx)(CssBaseline_1.default, {}), (0, jsx_runtime_1.jsx)(react_2.Global, { styles: (0, react_2.css)(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n ", "\n "], ["\n ", "\n "])), sc_1.stylesGlobal) }), children] })) })));
|
|
21
20
|
};
|
|
22
21
|
exports.AppTheme = AppTheme;
|
|
22
|
+
var templateObject_1;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NextApp = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
var react_1 = tslib_1.__importDefault(require("react"));
|
|
7
|
+
var react_2 = require("next-auth/react");
|
|
8
|
+
var AppHead_1 = require("../../AppHead");
|
|
9
|
+
var AppTheme_1 = require("../AppTheme");
|
|
10
|
+
var AppMain_1 = require("../AppMain");
|
|
11
11
|
/**
|
|
12
12
|
* App with authentication provided by `next-auth`
|
|
13
13
|
*/
|
|
14
|
-
|
|
15
|
-
return ((0, jsx_runtime_1.jsxs)(react_1.default.StrictMode, { children: [(0, jsx_runtime_1.jsx)(AppHead_1.AppHead, {}), (0, jsx_runtime_1.jsx)(react_2.SessionProvider, { session: props.pageProps.session, children: (0, jsx_runtime_1.jsx)(AppTheme_1.AppTheme, {
|
|
14
|
+
var NextApp = function (props) {
|
|
15
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.default.StrictMode, { children: [(0, jsx_runtime_1.jsx)(AppHead_1.AppHead, {}), (0, jsx_runtime_1.jsx)(react_2.SessionProvider, tslib_1.__assign({ session: props.pageProps.session }, { children: (0, jsx_runtime_1.jsx)(AppTheme_1.AppTheme, tslib_1.__assign({}, props, { children: (0, jsx_runtime_1.jsx)(AppMain_1.AppMain, tslib_1.__assign({}, props)) })) }))] }));
|
|
16
16
|
};
|
|
17
17
|
exports.NextApp = NextApp;
|
|
18
18
|
exports.default = exports.NextApp;
|
package/node/app/em/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NextApp = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
var react_1 = tslib_1.__importDefault(require("react"));
|
|
7
|
+
var AppHead_1 = require("../AppHead");
|
|
8
|
+
var AppTheme_1 = require("./AppTheme");
|
|
9
|
+
var AppMain_1 = require("./AppMain");
|
|
10
10
|
/**
|
|
11
11
|
* App
|
|
12
12
|
*/
|
|
13
|
-
|
|
14
|
-
return ((0, jsx_runtime_1.jsxs)(react_1.default.StrictMode, { children: [(0, jsx_runtime_1.jsx)(AppHead_1.AppHead, {}), (0, jsx_runtime_1.jsx)(AppTheme_1.AppTheme, {
|
|
13
|
+
var NextApp = function (props) {
|
|
14
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.default.StrictMode, { children: [(0, jsx_runtime_1.jsx)(AppHead_1.AppHead, {}), (0, jsx_runtime_1.jsx)(AppTheme_1.AppTheme, tslib_1.__assign({}, props, { children: (0, jsx_runtime_1.jsx)(AppMain_1.AppMain, tslib_1.__assign({}, props)) }))] }));
|
|
15
15
|
};
|
|
16
16
|
exports.NextApp = NextApp;
|
|
17
17
|
exports.default = exports.NextApp;
|
package/node/app/index.js
CHANGED
package/node/app/sc/AppMain.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AppMain = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var react_1 = require("react");
|
|
6
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
var router_1 = require("next/router");
|
|
8
|
+
var framer_motion_1 = require("framer-motion");
|
|
9
|
+
var m_1 = require("@koine/react/m");
|
|
10
|
+
var Seo_1 = require("../../Seo");
|
|
11
|
+
var NextProgress_1 = require("../../NextProgress");
|
|
11
12
|
/**
|
|
12
13
|
* App main
|
|
13
14
|
*
|
|
@@ -15,12 +16,13 @@ const NextProgress_1 = require("../../NextProgress");
|
|
|
15
16
|
*
|
|
16
17
|
* About the page transition [wallis' blog post](https://wallis.dev/blog/nextjs-page-transitions-with-framer-motion)
|
|
17
18
|
*/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
var AppMain = function (_a) {
|
|
20
|
+
var Component = _a.Component, pageProps = _a.pageProps, Layout = _a.Layout, ProgressOverlay = _a.ProgressOverlay, seo = _a.seo, motion = _a.motion, _b = _a.transition, transition = _b === void 0 ? {
|
|
21
|
+
initial: { opacity: 0 },
|
|
22
|
+
animate: { opacity: 1 },
|
|
23
|
+
exit: { opacity: 0 },
|
|
24
|
+
} : _b, pre = _a.pre, post = _a.post;
|
|
25
|
+
var pathname = (0, router_1.useRouter)().pathname;
|
|
26
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Seo_1.SeoDefaults, tslib_1.__assign({}, seo)), pre, (0, jsx_runtime_1.jsxs)(m_1.MotionProvider, tslib_1.__assign({ features: motion }, { children: [ProgressOverlay && (0, jsx_runtime_1.jsx)(NextProgress_1.NextProgress, { Overlay: ProgressOverlay }), (0, jsx_runtime_1.jsx)(Layout, { children: (0, jsx_runtime_1.jsx)(framer_motion_1.AnimatePresence, tslib_1.__assign({ exitBeforeEnter: true, initial: false }, { children: (0, jsx_runtime_1.jsx)(framer_motion_1.m.div, tslib_1.__assign({}, transition, { children: (0, react_1.createElement)(Component, tslib_1.__assign({}, pageProps, { key: pathname })) }), pathname) })) })] })), post] }));
|
|
25
27
|
};
|
|
26
28
|
exports.AppMain = AppMain;
|
package/node/app/sc/AppTheme.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AppTheme = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
var styled_components_1 = require("styled-components");
|
|
7
|
+
var sc_1 = require("@koine/react/sc");
|
|
7
8
|
/**
|
|
8
9
|
* App theme with `styled-components`
|
|
9
10
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
var AppTheme = function (_a) {
|
|
12
|
+
var theme = _a.theme, children = _a.children;
|
|
13
|
+
return ((0, jsx_runtime_1.jsxs)(styled_components_1.ThemeProvider, tslib_1.__assign({ theme: theme }, { children: [(0, jsx_runtime_1.jsx)(sc_1.StylesGlobal, {}), children] })));
|
|
12
14
|
};
|
|
13
15
|
exports.AppTheme = AppTheme;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NextApp = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
var react_1 = tslib_1.__importDefault(require("react"));
|
|
7
|
+
var react_2 = require("next-auth/react");
|
|
8
|
+
var AppHead_1 = require("../../AppHead");
|
|
9
|
+
var AppTheme_1 = require("../AppTheme");
|
|
10
|
+
var AppMain_1 = require("../AppMain");
|
|
11
11
|
/**
|
|
12
12
|
* App with authentication provided by `next-auth`
|
|
13
13
|
*/
|
|
14
|
-
|
|
15
|
-
return ((0, jsx_runtime_1.jsxs)(react_1.default.StrictMode, { children: [(0, jsx_runtime_1.jsx)(AppHead_1.AppHead, {}), (0, jsx_runtime_1.jsx)(react_2.SessionProvider, { session: props.pageProps.session, children: (0, jsx_runtime_1.jsx)(AppTheme_1.AppTheme, {
|
|
14
|
+
var NextApp = function (props) {
|
|
15
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.default.StrictMode, { children: [(0, jsx_runtime_1.jsx)(AppHead_1.AppHead, {}), (0, jsx_runtime_1.jsx)(react_2.SessionProvider, tslib_1.__assign({ session: props.pageProps.session }, { children: (0, jsx_runtime_1.jsx)(AppTheme_1.AppTheme, tslib_1.__assign({}, props, { children: (0, jsx_runtime_1.jsx)(AppMain_1.AppMain, tslib_1.__assign({}, props)) })) }))] }));
|
|
16
16
|
};
|
|
17
17
|
exports.NextApp = NextApp;
|
|
18
18
|
exports.default = exports.NextApp;
|
package/node/app/sc/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NextApp = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
var react_1 = tslib_1.__importDefault(require("react"));
|
|
7
|
+
var AppHead_1 = require("../AppHead");
|
|
8
|
+
var AppTheme_1 = require("./AppTheme");
|
|
9
|
+
var AppMain_1 = require("./AppMain");
|
|
10
10
|
/**
|
|
11
11
|
* App
|
|
12
12
|
*
|
|
@@ -57,8 +57,8 @@ const AppMain_1 = require("./AppMain");
|
|
|
57
57
|
*
|
|
58
58
|
* ```
|
|
59
59
|
*/
|
|
60
|
-
|
|
61
|
-
return ((0, jsx_runtime_1.jsxs)(react_1.default.StrictMode, { children: [(0, jsx_runtime_1.jsx)(AppHead_1.AppHead, {}), (0, jsx_runtime_1.jsx)(AppTheme_1.AppTheme, {
|
|
60
|
+
var NextApp = function (props) {
|
|
61
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.default.StrictMode, { children: [(0, jsx_runtime_1.jsx)(AppHead_1.AppHead, {}), (0, jsx_runtime_1.jsx)(AppTheme_1.AppTheme, tslib_1.__assign({}, props, { children: (0, jsx_runtime_1.jsx)(AppMain_1.AppMain, tslib_1.__assign({}, props)) }))] }));
|
|
62
62
|
};
|
|
63
63
|
exports.NextApp = NextApp;
|
|
64
64
|
exports.default = exports.NextApp;
|
package/node/config/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.withKoine = exports.getRewrites = exports.getRedirects = exports.getPathRewrite = exports.getPathRedirect = exports.encodePathname = exports.normaliseUrlPathname = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
4
5
|
/**
|
|
5
6
|
* Normalise pathname
|
|
6
7
|
*
|
|
@@ -19,20 +20,20 @@ exports.normaliseUrlPathname = normaliseUrlPathname;
|
|
|
19
20
|
* @see {@link normaliseUrlPathname}
|
|
20
21
|
*/
|
|
21
22
|
function encodePathname(pathname) {
|
|
22
|
-
|
|
23
|
+
var parts = normaliseUrlPathname(pathname).split("/");
|
|
23
24
|
return parts
|
|
24
|
-
.filter((part)
|
|
25
|
-
.map((part)
|
|
25
|
+
.filter(function (part) { return !!part; })
|
|
26
|
+
.map(function (part) { return encodeURIComponent(part); })
|
|
26
27
|
.join("/");
|
|
27
28
|
}
|
|
28
29
|
exports.encodePathname = encodePathname;
|
|
29
30
|
/**
|
|
30
31
|
*/
|
|
31
32
|
function getPathRedirect(locale, localisedPathname, templateName, dynamic, permanent) {
|
|
32
|
-
|
|
33
|
+
var suffix = dynamic ? "/:slug*" : "";
|
|
33
34
|
return {
|
|
34
|
-
source:
|
|
35
|
-
destination:
|
|
35
|
+
source: "/".concat(locale, "/").concat(encodePathname(localisedPathname)).concat(suffix),
|
|
36
|
+
destination: "/".concat(encodePathname(templateName)).concat(suffix),
|
|
36
37
|
permanent: Boolean(permanent),
|
|
37
38
|
locale: false,
|
|
38
39
|
};
|
|
@@ -41,49 +42,61 @@ exports.getPathRedirect = getPathRedirect;
|
|
|
41
42
|
/**
|
|
42
43
|
*/
|
|
43
44
|
function getPathRewrite(source, destination, dynamic) {
|
|
44
|
-
|
|
45
|
+
var suffix = dynamic ? "/:path*" : "";
|
|
45
46
|
return {
|
|
46
|
-
source:
|
|
47
|
-
destination:
|
|
47
|
+
source: "/".concat(encodePathname(source)).concat(suffix),
|
|
48
|
+
destination: "/".concat(encodePathname(destination)).concat(suffix),
|
|
48
49
|
};
|
|
49
50
|
}
|
|
50
51
|
exports.getPathRewrite = getPathRewrite;
|
|
51
52
|
/**
|
|
52
53
|
*/
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
54
|
+
function getRedirects(_a) {
|
|
55
|
+
var defaultLocale = _a.defaultLocale, routes = _a.routes, dynamicRoutes = _a.dynamicRoutes, permanent = _a.permanent;
|
|
56
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
57
|
+
var redirects;
|
|
58
|
+
return tslib_1.__generator(this, function (_b) {
|
|
59
|
+
redirects = [];
|
|
60
|
+
Object.keys(routes).forEach(function (page) {
|
|
61
|
+
var dynamic = dynamicRoutes[page];
|
|
62
|
+
if (routes[page] !== page) {
|
|
63
|
+
if (dynamic) {
|
|
64
|
+
redirects.push(getPathRedirect(defaultLocale, page, routes[page], true, permanent));
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
redirects.push(getPathRedirect(defaultLocale, page, routes[page], false, permanent));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
// console.log("redirects", redirects);
|
|
72
|
+
return [2 /*return*/, redirects];
|
|
73
|
+
});
|
|
65
74
|
});
|
|
66
|
-
// console.log("redirects", redirects);
|
|
67
|
-
return redirects;
|
|
68
75
|
}
|
|
69
76
|
exports.getRedirects = getRedirects;
|
|
70
77
|
/**
|
|
71
78
|
*/
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
79
|
+
function getRewrites(_a) {
|
|
80
|
+
var routes = _a.routes, dynamicRoutes = _a.dynamicRoutes;
|
|
81
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
82
|
+
var rewrites;
|
|
83
|
+
return tslib_1.__generator(this, function (_b) {
|
|
84
|
+
rewrites = [];
|
|
85
|
+
Object.keys(routes).forEach(function (page) {
|
|
86
|
+
var dynamic = dynamicRoutes[page];
|
|
87
|
+
if (routes[page] !== page) {
|
|
88
|
+
if (dynamic) {
|
|
89
|
+
rewrites.push(getPathRewrite(routes[page], page, true));
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
rewrites.push(getPathRewrite(routes[page], page));
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
// console.log("rewrites", rewrites);
|
|
97
|
+
return [2 /*return*/, rewrites];
|
|
98
|
+
});
|
|
84
99
|
});
|
|
85
|
-
// console.log("rewrites", rewrites);
|
|
86
|
-
return rewrites;
|
|
87
100
|
}
|
|
88
101
|
exports.getRewrites = getRewrites;
|
|
89
102
|
/**
|
|
@@ -97,47 +110,24 @@ exports.getRewrites = getRewrites;
|
|
|
97
110
|
* 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)
|
|
98
111
|
* and it enables the same for `next-translate`.
|
|
99
112
|
*/
|
|
100
|
-
function withKoine(
|
|
101
|
-
|
|
113
|
+
function withKoine(_a) {
|
|
114
|
+
var _b;
|
|
115
|
+
if (_a === void 0) { _a = {}; }
|
|
116
|
+
var _c = _a.nx, nx = _c === void 0 ? true : _c, _d = _a.svg, svg = _d === void 0 ? true : _d, _e = _a.sc, sc = _e === void 0 ? true : _e, page = _a.page, nextConfig = tslib_1.__rest(_a, ["nx", "svg", "sc", "page"]);
|
|
117
|
+
nextConfig = tslib_1.__assign({
|
|
102
118
|
// @see https://nextjs.org/docs/api-reference/next.config.js/custom-page-extensions#including-non-page-files-in-the-pages-directory
|
|
103
|
-
pageExtensions: page ? ["page.tsx", "page.ts"] : undefined,
|
|
104
|
-
eslint: {
|
|
119
|
+
pageExtensions: page ? ["page.tsx", "page.ts"] : undefined, eslint: {
|
|
105
120
|
ignoreDuringBuilds: true, // we have this strict check on each commit
|
|
106
|
-
},
|
|
107
|
-
typescript: {
|
|
121
|
+
}, typescript: {
|
|
108
122
|
ignoreBuildErrors: true, // we have this strict check on each commit
|
|
109
|
-
},
|
|
110
|
-
poweredByHeader: false,
|
|
111
|
-
swcMinify: true,
|
|
112
|
-
experimental: {
|
|
123
|
+
}, poweredByHeader: false, swcMinify: true, experimental: tslib_1.__assign(tslib_1.__assign({
|
|
113
124
|
// @see https://github.com/vercel/vercel/discussions/5973#discussioncomment-472618
|
|
114
125
|
// @see critters error https://github.com/vercel/next.js/issues/20742
|
|
115
126
|
// optimizeCss: true,
|
|
116
127
|
// @see https://github.com/vercel/next.js/discussions/30174#discussion-3643870
|
|
117
|
-
scrollRestoration: true,
|
|
118
|
-
// concurrentFeatures: true,
|
|
119
|
-
// serverComponents: true,
|
|
120
|
-
// reactRoot: true,
|
|
121
|
-
...(nextConfig.experimental || {}),
|
|
128
|
+
scrollRestoration: true }, (nextConfig.experimental || {})), {
|
|
122
129
|
// @see https://nextjs.org/docs/advanced-features/compiler#modularize-imports
|
|
123
|
-
modularizeImports: {
|
|
124
|
-
...(nextConfig?.experimental?.modularizeImports || {}),
|
|
125
|
-
// FIXME: make these work with the right file/folder structure?
|
|
126
|
-
// "@koine/next/?(((\\w*)?/?)*)": {
|
|
127
|
-
// transform: "@koine/next/{{ matches.[1] }}/{{member}}",
|
|
128
|
-
// },
|
|
129
|
-
// "@koine/react/?(((\\w*)?/?)*)": {
|
|
130
|
-
// transform: "@koine/react/{{ matches.[1] }}/{{member}}",
|
|
131
|
-
// },
|
|
132
|
-
// "@koine/utils/?(((\\w*)?/?)*)": {
|
|
133
|
-
// transform: "@koine/utils/{{ matches.[1] }}/{{member}}",
|
|
134
|
-
// },
|
|
135
|
-
},
|
|
136
|
-
},
|
|
137
|
-
// @see https://github.com/vercel/next.js/issues/7322#issuecomment-887330111
|
|
138
|
-
// reactStrictMode: false,
|
|
139
|
-
...nextConfig,
|
|
140
|
-
};
|
|
130
|
+
modularizeImports: tslib_1.__assign({}, (((_b = nextConfig === null || nextConfig === void 0 ? void 0 : nextConfig.experimental) === null || _b === void 0 ? void 0 : _b.modularizeImports) || {})) }) }, nextConfig);
|
|
141
131
|
if (svg) {
|
|
142
132
|
if (nx) {
|
|
143
133
|
// @see https://github.com/gregberge/svgr
|
|
@@ -146,8 +136,8 @@ function withKoine({ nx = true, svg = true, sc = true, page, ...nextConfig } = {
|
|
|
146
136
|
};
|
|
147
137
|
}
|
|
148
138
|
else {
|
|
149
|
-
nextConfig.webpack = (_config, options)
|
|
150
|
-
|
|
139
|
+
nextConfig.webpack = function (_config, options) {
|
|
140
|
+
var webpackConfig = typeof nextConfig.webpack === "function"
|
|
151
141
|
? nextConfig.webpack(_config, options)
|
|
152
142
|
: _config;
|
|
153
143
|
// @see https://dev.to/dolearning/importing-svgs-to-next-js-nna#svgr
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Document = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
var document_1 = tslib_1.__importStar(require("next/document"));
|
|
7
|
+
var react_1 = require("@koine/react");
|
|
8
8
|
/**
|
|
9
9
|
* Next Document wrapper for bare projects
|
|
10
10
|
*
|
|
@@ -15,10 +15,15 @@ const react_1 = require("@koine/react");
|
|
|
15
15
|
* export { Document as default } from "@koine/next/document";
|
|
16
16
|
* ```
|
|
17
17
|
*/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return
|
|
18
|
+
var Document = /** @class */ (function (_super) {
|
|
19
|
+
tslib_1.__extends(Document, _super);
|
|
20
|
+
function Document() {
|
|
21
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
Document.prototype.render = function () {
|
|
24
|
+
var _a = this.props.__NEXT_DATA__, locale = _a.locale, defaultLocale = _a.defaultLocale;
|
|
25
|
+
return ((0, jsx_runtime_1.jsxs)(document_1.Html, tslib_1.__assign({ lang: locale || defaultLocale, className: "no-js" }, { children: [(0, jsx_runtime_1.jsxs)(document_1.Head, { children: [(0, jsx_runtime_1.jsx)(react_1.Meta, {}), (0, jsx_runtime_1.jsx)(react_1.NoJs, {})] }), (0, jsx_runtime_1.jsxs)("body", { children: [(0, jsx_runtime_1.jsx)(document_1.Main, {}), (0, jsx_runtime_1.jsx)(document_1.NextScript, {})] })] })));
|
|
26
|
+
};
|
|
27
|
+
return Document;
|
|
28
|
+
}(document_1.default));
|
|
24
29
|
exports.Document = Document;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Document = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
var document_1 = tslib_1.__importStar(require("next/document"));
|
|
7
|
+
var react_1 = require("@koine/react");
|
|
8
|
+
var sc_1 = require("@koine/react/sc"); // FIXME: this should be imported from another entrypoint
|
|
9
9
|
/**
|
|
10
10
|
* Next Document wrapper for `css/tailwind` based projects
|
|
11
11
|
*
|
|
@@ -18,18 +18,30 @@ const sc_1 = require("@koine/react/sc"); // FIXME: this should be imported from
|
|
|
18
18
|
* export { Document as default } from "@koine/next/document/css";
|
|
19
19
|
* ```
|
|
20
20
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return
|
|
25
|
-
...initialProps,
|
|
26
|
-
theme: (0, sc_1.getInitialThemeFromRequest)(ctx.req?.headers.cookie /* || document?.cookie */ || ""),
|
|
27
|
-
};
|
|
21
|
+
var Document = /** @class */ (function (_super) {
|
|
22
|
+
tslib_1.__extends(Document, _super);
|
|
23
|
+
function Document() {
|
|
24
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
28
25
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
Document.getInitialProps = function (ctx) {
|
|
27
|
+
var _a;
|
|
28
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
29
|
+
var initialProps;
|
|
30
|
+
return tslib_1.__generator(this, function (_b) {
|
|
31
|
+
switch (_b.label) {
|
|
32
|
+
case 0: return [4 /*yield*/, document_1.default.getInitialProps(ctx)];
|
|
33
|
+
case 1:
|
|
34
|
+
initialProps = _b.sent();
|
|
35
|
+
return [2 /*return*/, tslib_1.__assign(tslib_1.__assign({}, initialProps), { theme: (0, sc_1.getInitialThemeFromRequest)(((_a = ctx.req) === null || _a === void 0 ? void 0 : _a.headers.cookie /* || document?.cookie */) || "") })];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
Document.prototype.render = function () {
|
|
41
|
+
var _a = this.props.__NEXT_DATA__, locale = _a.locale, defaultLocale = _a.defaultLocale;
|
|
42
|
+
return ((0, jsx_runtime_1.jsxs)(document_1.Html, tslib_1.__assign({ lang: locale || defaultLocale, className: "no-js" }, { children: [(0, jsx_runtime_1.jsxs)(document_1.Head, { children: [(0, jsx_runtime_1.jsx)(react_1.Meta, {}), (0, jsx_runtime_1.jsx)(react_1.NoJs, {})] }), (0, jsx_runtime_1.jsxs)("body", { children: [(0, jsx_runtime_1.jsx)(document_1.Main, {}), (0, jsx_runtime_1.jsx)(document_1.NextScript, {})] })] })));
|
|
43
|
+
};
|
|
44
|
+
return Document;
|
|
45
|
+
}(document_1.default));
|
|
34
46
|
exports.Document = Document;
|
|
35
47
|
exports.default = Document;
|