@koine/next 2.0.0-beta.147 → 2.0.0-beta.149

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 CHANGED
@@ -3,6 +3,6 @@
3
3
  var swc = require('@koine/node/swc');
4
4
  var next = require('@koine/i18n/next');
5
5
 
6
- let withKoine=(s={})=>{let{nx:n,svg:p,i18nRoutes:l,i18nCompiler:a,modularize:u,...m}=s,c={eslint:{ignoreDuringBuilds:!0},typescript:{ignoreBuildErrors:!0},poweredByHeader:!1,experimental:{scrollRestoration:!0,...m.experimental||{}},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?c.nx={svgr:!0}:(delete c.nx,c.webpack=(e,r)=>{let o="function"==typeof m.webpack?m.webpack(e,r):e;return 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};
6
+ let withKoine=(s={})=>{let{nx:p,svg:a,i18nRoutes:m,i18nCompiler:l,modularize:u,...c}=s,w={modularizeImports:{...u?Array.isArray(u)?swc.swcCreateTransforms(u):swc.swcCreateTransform(u):{},...c.modularizeImports||{},...swc.swcTransformsKoine},...c};return (a&&(p?w.nx={svgr:!0}:(delete w.nx,w.webpack=(e,o)=>{let r="function"==typeof c.webpack?c.webpack(e,o):e;return r.module.rules.push({test:/\.svg$/,use:[{loader:"@svgr/webpack",options:{svgoConfig:{plugins:[{name:"removeViewBox",active:!1}]}}}]}),r})),m)?next.withI18nLegacy({...w,i18nRoutes:m}):l?p?next.withI18nAsync({...w,i18nCompiler:l}):next.withI18n({...w,i18nCompiler:l}):w};
7
7
 
8
8
  exports.withKoine = withKoine;
package/config.d.ts CHANGED
@@ -1,38 +1,33 @@
1
1
  import type { NextConfig } from "next";
2
+ import { type SwcTransformingLib } from "@koine/node/swc";
2
3
  import { type WithI18nAsyncOptions, type WithI18nLegacyOptions } from "@koine/i18n/next";
3
4
  /**
4
5
  * @legacy
5
6
  */
6
7
  export type Routes = NonNullable<WithI18nLegacyOptions["i18nRoutes"]>["routes"];
7
- type ModularizeShortcut = {
8
+ export type WithKoineOptions = NextConfig & {
8
9
  /**
9
- * A list of the packages to modularize, if a `scope` is given that will be
10
- * automatically prepended before a slash e.g. `{scope}/@{lib}`.
11
- * @example ["components", "utils"]
10
+ * Set it to `true` when your _Next.js_ app is built inside a Nx monorepo
12
11
  */
13
- libs: string[];
12
+ nx?: boolean;
14
13
  /**
15
- * The scope of the packages to modularize, if given a slash is automatically
16
- * appended between the scope and the lib name
17
- * @example "@"
14
+ * Set it to `true` in order to be able importing React components directly
15
+ * from `.svg` files.
16
+ *
17
+ * It automatically configure webpack taking into account the `nx` option.
18
18
  */
19
- scope?: string;
20
- };
21
- export type WithKoineOptions = NextConfig & {
22
- nx?: boolean;
23
19
  svg?: boolean;
24
20
  /**
25
21
  * Shortcut option to automatically create swc transforms to feed into
26
- * _Next.js_' `modularizeImports`
22
+ * _Next.js_' `modularizeImports`.
23
+ *
24
+ * Pass _one_ or an _array_ of {@link SwcTransformingLib lib transform object}.
27
25
  */
28
- modularize?: ModularizeShortcut[] | ModularizeShortcut;
26
+ modularize?: SwcTransformingLib[] | SwcTransformingLib;
29
27
  } & WithI18nLegacyOptions & WithI18nAsyncOptions;
30
28
  /**
31
- * Get Next.js config with some basic opinionated defaults
29
+ * Get _Next.js_ config with some extra {@link WithKoineOptions options}
32
30
  *
33
- * @param {object} options
34
- * @property {boolean} [options.nx=false] Nx monorepo setup
35
- * @property {boolean} [options.svg=false] SVG to react components
31
+ * @param options
36
32
  */
37
33
  export declare let withKoine: (options?: WithKoineOptions) => NextConfig;
38
- export {};
package/config.esm.js CHANGED
@@ -1,6 +1,6 @@
1
- import { swcCreateTransforms, swcTransformsKoine } from '@koine/node/swc';
1
+ import { swcCreateTransforms, swcCreateTransform, swcTransformsKoine } from '@koine/node/swc';
2
2
  import { withI18nLegacy, withI18nAsync, withI18n } from '@koine/i18n/next';
3
3
 
4
- let withKoine=(s={})=>{let{nx:n,svg:p,i18nRoutes:l,i18nCompiler:a,modularize:u,...m}=s,c={eslint:{ignoreDuringBuilds:!0},typescript:{ignoreBuildErrors:!0},poweredByHeader:!1,experimental:{scrollRestoration:!0,...m.experimental||{}},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?c.nx={svgr:!0}:(delete c.nx,c.webpack=(e,r)=>{let o="function"==typeof m.webpack?m.webpack(e,r):e;return 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};
4
+ let withKoine=(s={})=>{let{nx:p,svg:a,i18nRoutes:m,i18nCompiler:l,modularize:u,...c}=s,w={modularizeImports:{...u?Array.isArray(u)?swcCreateTransforms(u):swcCreateTransform(u):{},...c.modularizeImports||{},...swcTransformsKoine},...c};return (a&&(p?w.nx={svgr:!0}:(delete w.nx,w.webpack=(e,o)=>{let r="function"==typeof c.webpack?c.webpack(e,o):e;return r.module.rules.push({test:/\.svg$/,use:[{loader:"@svgr/webpack",options:{svgoConfig:{plugins:[{name:"removeViewBox",active:!1}]}}}]}),r})),m)?withI18nLegacy({...w,i18nRoutes:m}):l?p?withI18nAsync({...w,i18nCompiler:l}):withI18n({...w,i18nCompiler:l}):w};
5
5
 
6
6
  export { withKoine };
package/package.json CHANGED
@@ -2,10 +2,10 @@
2
2
  "name": "@koine/next",
3
3
  "sideEffects": false,
4
4
  "dependencies": {
5
- "@koine/browser": "2.0.0-beta.147",
6
- "@koine/i18n": "2.0.0-beta.147",
7
- "@koine/node": "2.0.0-beta.147",
8
- "@koine/utils": "2.0.0-beta.147"
5
+ "@koine/browser": "2.0.0-beta.149",
6
+ "@koine/i18n": "2.0.0-beta.149",
7
+ "@koine/node": "2.0.0-beta.149",
8
+ "@koine/utils": "2.0.0-beta.149"
9
9
  },
10
10
  "peerDependencies": {
11
11
  "next": "^14.0.4",
@@ -65,5 +65,5 @@
65
65
  "module": "./index.esm.js",
66
66
  "main": "./index.cjs.js",
67
67
  "types": "./index.esm.d.ts",
68
- "version": "2.0.0-beta.147"
68
+ "version": "2.0.0-beta.149"
69
69
  }