@koine/next 2.0.0-beta.124 → 2.0.0-beta.125
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/config.cjs.js +9 -6
- package/config.d.ts +7 -0
- package/config.esm.js +10 -7
- package/package.json +4 -4
package/config.cjs.js
CHANGED
|
@@ -6,22 +6,25 @@ var next = require('@koine/i18n/next');
|
|
|
6
6
|
/**
|
|
7
7
|
* @legacy
|
|
8
8
|
*//**
|
|
9
|
+
* Shortcut option to automatically create swc transforms to feed into
|
|
10
|
+
* next.js' `modularizeImports`
|
|
11
|
+
*//**
|
|
9
12
|
* Get Next.js config with some basic opinionated defaults
|
|
10
13
|
*
|
|
11
14
|
* @param {object} options
|
|
12
15
|
* @property {boolean} [options.nx=false] Nx monorepo setup
|
|
13
16
|
* @property {boolean} [options.svg=false] SVG to react components
|
|
14
|
-
*/let withKoine=(
|
|
17
|
+
*/let withKoine=(s={})=>{let{nx:n,svg:p,i18nRoutes:l,i18nCompiler:a,modularize:u,...m}=s,c={eslint:{ignoreDuringBuilds:!0},// we have this strict check on each commit
|
|
15
18
|
typescript:{ignoreBuildErrors:!0},// we have this strict check on each commit
|
|
16
19
|
poweredByHeader:!1,experimental:{// @see https://github.com/vercel/vercel/discussions/5973#discussioncomment-472618
|
|
17
20
|
// @see critters error https://github.com/vercel/next.js/issues/20742
|
|
18
21
|
// optimizeCss: true,
|
|
19
22
|
// @see https://github.com/vercel/next.js/discussions/30174#discussion-3643870
|
|
20
|
-
scrollRestoration:!0,...
|
|
21
|
-
modularizeImports:{...
|
|
22
|
-
|
|
23
|
-
delete
|
|
23
|
+
scrollRestoration:!0,...m.experimental||{}},// @see https://www.zhoulujun.net/nextjs/advanced-features/compiler.html#modularize-imports
|
|
24
|
+
modularizeImports:{...u?Array.isArray(u)?u.reduce((r,o)=>({...r,...swc.swcCreateTransforms(o.libs,o.scope)}),{}):swc.swcCreateTransforms(u.libs,u.scope):{},...m.modularizeImports||{},...swc.swcTransformsKoine},...m};return (p&&(n?// @see https://github.com/gregberge/svgr
|
|
25
|
+
c.nx={svgr:!0}:(// if falsy just remove the key
|
|
26
|
+
delete c.nx,c.webpack=(e,r)=>// ...[_config, options]: Parameters<NonNullable<NextConfig['webpack']>>
|
|
24
27
|
{let o="function"==typeof m.webpack?m.webpack(e,r):e;return(// @see https://dev.to/dolearning/importing-svgs-to-next-js-nna#svgr
|
|
25
|
-
o.module.rules.push({test:/\.svg$/,use:[{loader:"@svgr/webpack",options:{svgoConfig:{plugins:[{name:"removeViewBox",active:!1}]}}}]}),o)})),
|
|
28
|
+
o.module.rules.push({test:/\.svg$/,use:[{loader:"@svgr/webpack",options:{svgoConfig:{plugins:[{name:"removeViewBox",active:!1}]}}}]}),o)})),l)?next.withI18nLegacy({...c,i18nRoutes:l}):a?n?next.withI18nAsync({...c,i18nCompiler:a}):next.withI18n({...c,i18nCompiler:a}):c};
|
|
26
29
|
|
|
27
30
|
exports.withKoine = withKoine;
|
package/config.d.ts
CHANGED
|
@@ -4,5 +4,12 @@ export type Routes = NonNullable<WithI18nLegacyOptions["i18nRoutes"]>["routes"];
|
|
|
4
4
|
export type WithKoineOptions = NextConfig & {
|
|
5
5
|
nx?: boolean;
|
|
6
6
|
svg?: boolean;
|
|
7
|
+
modularize?: {
|
|
8
|
+
scope: string;
|
|
9
|
+
libs: string[];
|
|
10
|
+
}[] | {
|
|
11
|
+
scope: string;
|
|
12
|
+
libs: string[];
|
|
13
|
+
};
|
|
7
14
|
} & WithI18nLegacyOptions & WithI18nAsyncOptions;
|
|
8
15
|
export declare let withKoine: (options?: WithKoineOptions) => NextConfig;
|
package/config.esm.js
CHANGED
|
@@ -1,25 +1,28 @@
|
|
|
1
|
-
import { swcTransformsKoine } from '@koine/node/swc';
|
|
1
|
+
import { swcCreateTransforms, swcTransformsKoine } from '@koine/node/swc';
|
|
2
2
|
import { withI18nLegacy, withI18nAsync, withI18n } from '@koine/i18n/next';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @legacy
|
|
6
6
|
*//**
|
|
7
|
+
* Shortcut option to automatically create swc transforms to feed into
|
|
8
|
+
* next.js' `modularizeImports`
|
|
9
|
+
*//**
|
|
7
10
|
* Get Next.js config with some basic opinionated defaults
|
|
8
11
|
*
|
|
9
12
|
* @param {object} options
|
|
10
13
|
* @property {boolean} [options.nx=false] Nx monorepo setup
|
|
11
14
|
* @property {boolean} [options.svg=false] SVG to react components
|
|
12
|
-
*/let withKoine=(
|
|
15
|
+
*/let withKoine=(s={})=>{let{nx:n,svg:p,i18nRoutes:l,i18nCompiler:a,modularize:u,...m}=s,c={eslint:{ignoreDuringBuilds:!0},// we have this strict check on each commit
|
|
13
16
|
typescript:{ignoreBuildErrors:!0},// we have this strict check on each commit
|
|
14
17
|
poweredByHeader:!1,experimental:{// @see https://github.com/vercel/vercel/discussions/5973#discussioncomment-472618
|
|
15
18
|
// @see critters error https://github.com/vercel/next.js/issues/20742
|
|
16
19
|
// optimizeCss: true,
|
|
17
20
|
// @see https://github.com/vercel/next.js/discussions/30174#discussion-3643870
|
|
18
|
-
scrollRestoration:!0,...
|
|
19
|
-
modularizeImports:{...
|
|
20
|
-
|
|
21
|
-
delete
|
|
21
|
+
scrollRestoration:!0,...m.experimental||{}},// @see https://www.zhoulujun.net/nextjs/advanced-features/compiler.html#modularize-imports
|
|
22
|
+
modularizeImports:{...u?Array.isArray(u)?u.reduce((r,o)=>({...r,...swcCreateTransforms(o.libs,o.scope)}),{}):swcCreateTransforms(u.libs,u.scope):{},...m.modularizeImports||{},...swcTransformsKoine},...m};return (p&&(n?// @see https://github.com/gregberge/svgr
|
|
23
|
+
c.nx={svgr:!0}:(// if falsy just remove the key
|
|
24
|
+
delete c.nx,c.webpack=(e,r)=>// ...[_config, options]: Parameters<NonNullable<NextConfig['webpack']>>
|
|
22
25
|
{let o="function"==typeof m.webpack?m.webpack(e,r):e;return(// @see https://dev.to/dolearning/importing-svgs-to-next-js-nna#svgr
|
|
23
|
-
o.module.rules.push({test:/\.svg$/,use:[{loader:"@svgr/webpack",options:{svgoConfig:{plugins:[{name:"removeViewBox",active:!1}]}}}]}),o)})),
|
|
26
|
+
o.module.rules.push({test:/\.svg$/,use:[{loader:"@svgr/webpack",options:{svgoConfig:{plugins:[{name:"removeViewBox",active:!1}]}}}]}),o)})),l)?withI18nLegacy({...c,i18nRoutes:l}):a?n?withI18nAsync({...c,i18nCompiler:a}):withI18n({...c,i18nCompiler:a}):c};
|
|
24
27
|
|
|
25
28
|
export { withKoine };
|
package/package.json
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"name": "@koine/next",
|
|
3
3
|
"sideEffects": false,
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@koine/browser": "2.0.0-beta.
|
|
6
|
-
"@koine/utils": "2.0.0-beta.
|
|
7
|
-
"@koine/i18n": "2.0.0-beta.
|
|
5
|
+
"@koine/browser": "2.0.0-beta.125",
|
|
6
|
+
"@koine/utils": "2.0.0-beta.125",
|
|
7
|
+
"@koine/i18n": "2.0.0-beta.125"
|
|
8
8
|
},
|
|
9
9
|
"peerDependencies": {
|
|
10
10
|
"next": "^14.0.4",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
},
|
|
57
57
|
"module": "./index.esm.js",
|
|
58
58
|
"main": "./index.cjs.js",
|
|
59
|
-
"version": "2.0.0-beta.
|
|
59
|
+
"version": "2.0.0-beta.125"
|
|
60
60
|
}
|