@kirill.konshin/next 0.0.1 → 0.0.2

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/.ctirc CHANGED
@@ -1,11 +1,20 @@
1
1
  {
2
- "addNewline": true,
3
- "fileExcludePatterns": [
4
- "*.stories.*",
5
- "*.test.*",
6
- "*.fixture.*"
7
- ],
8
- "verbose": false,
9
- "withoutBackupFile": true,
10
- "withoutComment": true
11
- }
2
+ "options": [
3
+ {
4
+ "mode": "create",
5
+ "project": "tsconfig.json",
6
+ "include": "src/**/*.{ts,tsx}",
7
+ "exclude": [
8
+ "**/*.stories.*",
9
+ "**/*.test.*",
10
+ "**/*.fixture.*"
11
+ ],
12
+ "startFrom": "src",
13
+ "backup": false,
14
+ "overwrite": true,
15
+ "generationStyle": "default-alias-named-star",
16
+ "output": "src",
17
+ "verbose": true
18
+ }
19
+ ]
20
+ }
@@ -1,16 +1,24 @@
1
1
  vite v7.0.6 building SSR bundle for production...
2
- create succeeded: /home/runner/work/utils/utils/packages/next/src
2
+ - ctix 'create' mode start, ...
3
+ ✔ /home/runner/work/utils/utils/packages/next/tsconfig.json loading complete!
4
+ ✔ analysis export statements completed!
5
+ - build "index.ts" file start
6
+ - output file exists check, ...
7
+
8
+
9
+ ✔ ctix 'create' mode complete!
3
10
  transforming...
4
11
  ✓ 6 modules transformed.
5
12
  rendering chunks...
6
13
 
7
14
  [vite:dts] Start generate declaration files...
8
- dist/noSSR.js 0.33 kB │ map: 1.38 kB
9
- dist/index.js 0.34 kB │ map: 0.10 kB
15
+ dist/noSSR.js 0.35 kB │ map: 1.45 kB
16
+ dist/index.js 0.35 kB │ map: 0.09 kB
10
17
  dist/useIsInner.js 0.37 kB │ map: 0.61 kB
18
+ dist/redirect.js 0.38 kB │ map: 0.85 kB
11
19
  dist/measure.js 0.38 kB │ map: 1.04 kB
12
- dist/appLink.js 0.77 kB │ map: 1.58 kB
13
- [vite:dts] Declaration files built in 1575ms.
20
+ dist/appLink.js 0.80 kB │ map: 1.62 kB
21
+ [vite:dts] Declaration files built in 1665ms.
14
22
 
15
- ✓ built in 2.28s
23
+ ✓ built in 4.92s
16
24
  Updated package.json with exports
package/CHANGELOG.md ADDED
@@ -0,0 +1,10 @@
1
+ # @kirill.konshin/next
2
+
3
+ ## 0.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 63fdba8: Agent-assisted refactoring
8
+ - 63fdba8: Divided core to browser/node/worker-specific packages, CTIX upgrade, etc.
9
+ - Updated dependencies [63fdba8]
10
+ - @kirill.konshin/node@0.0.2
package/dist/appLink.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import { ComponentProps, FC } from 'react';
2
2
  import { default as Link, LinkProps } from 'next/link';
3
- export declare const AppLink: FC<{
3
+ export type AppLinkProps = {
4
4
  children: any;
5
5
  exact?: boolean;
6
6
  activeClassName?: any;
7
- } & LinkProps & ComponentProps<typeof Link>>;
7
+ } & LinkProps & ComponentProps<typeof Link>;
8
+ export declare const AppLink: FC<AppLinkProps>;
8
9
  //# sourceMappingURL=appLink.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"appLink.d.ts","sourceRoot":"","sources":["../src/appLink.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAElD,OAAO,IAAI,EAAE,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAI5C,eAAO,MAAM,OAAO,EAAE,EAAE,CACpB;IACI,QAAQ,EAAE,GAAG,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,eAAe,CAAC,EAAE,GAAG,CAAC;CACzB,GAAG,SAAS,GACT,cAAc,CAAC,OAAO,IAAI,CAAC,CAyBlC,CAAC"}
1
+ {"version":3,"file":"appLink.d.ts","sourceRoot":"","sources":["../src/appLink.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,cAAc,EAAE,EAAE,EAAQ,MAAM,OAAO,CAAC;AAExD,OAAO,IAAI,EAAE,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAG5C,MAAM,MAAM,YAAY,GAAG;IACvB,QAAQ,EAAE,GAAG,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,eAAe,CAAC,EAAE,GAAG,CAAC;CACzB,GAAG,SAAS,GACT,cAAc,CAAC,OAAO,IAAI,CAAC,CAAC;AAGhC,eAAO,MAAM,OAAO,EAAE,EAAE,CAAC,YAAY,CAwBnC,CAAC"}
package/dist/appLink.js CHANGED
@@ -1,9 +1,10 @@
1
1
  "use client";
2
2
  import { jsx } from "react/jsx-runtime";
3
+ import { memo } from "react";
3
4
  import { usePathname } from "next/navigation";
4
5
  import Link from "next/link";
5
6
  import clsx from "clsx";
6
- const AppLink = function AppLink2({
7
+ const AppLink = memo(function AppLink2({
7
8
  href,
8
9
  children,
9
10
  className = "",
@@ -27,7 +28,7 @@ const AppLink = function AppLink2({
27
28
  children
28
29
  }
29
30
  );
30
- };
31
+ });
31
32
  export {
32
33
  AppLink
33
34
  };
@@ -1 +1 @@
1
- {"version":3,"file":"appLink.js","sources":["../src/appLink.tsx"],"sourcesContent":["'use client';\n\nimport React, { ComponentProps, FC } from 'react';\nimport { usePathname } from 'next/navigation';\nimport Link, { LinkProps } from 'next/link';\nimport clsx from 'clsx';\n\n//TODO Test this\nexport const AppLink: FC<\n {\n children: any;\n exact?: boolean;\n activeClassName?: any;\n } & LinkProps &\n ComponentProps<typeof Link>\n> = function AppLink({\n href,\n children,\n className = '',\n activeClassName = '',\n prefetch = false, // set explicit default\n exact = false,\n ...props\n}) {\n const pathname = usePathname();\n const hrefPath = typeof href === 'string' ? href : href.pathname || '/';\n\n return (\n <Link\n {...props}\n href={href}\n className={clsx(className, {\n [activeClassName]: (!exact && pathname.startsWith(hrefPath)) || (exact && pathname === hrefPath),\n })}\n prefetch={prefetch}\n >\n {children}\n </Link>\n );\n};\n"],"names":["AppLink"],"mappings":";;;;;AAQO,MAAM,UAOT,SAASA,SAAQ;AAAA,EACjB;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,kBAAkB;AAAA,EAClB,WAAW;AAAA;AAAA,EACX,QAAQ;AAAA,EACR,GAAG;AACP,GAAG;AACC,QAAM,WAAW,YAAA;AACjB,QAAM,WAAW,OAAO,SAAS,WAAW,OAAO,KAAK,YAAY;AAEpE,SACI;AAAA,IAAC;AAAA,IAAA;AAAA,MACI,GAAG;AAAA,MACJ;AAAA,MACA,WAAW,KAAK,WAAW;AAAA,QACvB,CAAC,eAAe,GAAI,CAAC,SAAS,SAAS,WAAW,QAAQ,KAAO,SAAS,aAAa;AAAA,MAAA,CAC1F;AAAA,MACD;AAAA,MAEC;AAAA,IAAA;AAAA,EAAA;AAGb;"}
1
+ {"version":3,"file":"appLink.js","sources":["../src/appLink.tsx"],"sourcesContent":["'use client';\n\nimport React, { ComponentProps, FC, memo } from 'react';\nimport { usePathname } from 'next/navigation';\nimport Link, { LinkProps } from 'next/link';\nimport clsx from 'clsx';\n\nexport type AppLinkProps = {\n children: any;\n exact?: boolean;\n activeClassName?: any;\n} & LinkProps &\n ComponentProps<typeof Link>;\n\n//TODO Test this\nexport const AppLink: FC<AppLinkProps> = memo(function AppLink({\n href,\n children,\n className = '',\n activeClassName = '',\n prefetch = false, // set explicit default\n exact = false,\n ...props\n}) {\n const pathname = usePathname();\n const hrefPath = typeof href === 'string' ? href : href.pathname || '/';\n\n return (\n <Link\n {...props}\n href={href}\n className={clsx(className, {\n [activeClassName]: (!exact && pathname.startsWith(hrefPath)) || (exact && pathname === hrefPath),\n })}\n prefetch={prefetch}\n >\n {children}\n </Link>\n );\n});\n"],"names":["AppLink"],"mappings":";;;;;;AAeO,MAAM,UAA4B,KAAK,SAASA,SAAQ;AAAA,EAC3D;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,kBAAkB;AAAA,EAClB,WAAW;AAAA;AAAA,EACX,QAAQ;AAAA,EACR,GAAG;AACP,GAAG;AACC,QAAM,WAAW,YAAA;AACjB,QAAM,WAAW,OAAO,SAAS,WAAW,OAAO,KAAK,YAAY;AAEpE,SACI;AAAA,IAAC;AAAA,IAAA;AAAA,MACI,GAAG;AAAA,MACJ;AAAA,MACA,WAAW,KAAK,WAAW;AAAA,QACvB,CAAC,eAAe,GAAI,CAAC,SAAS,SAAS,WAAW,QAAQ,KAAO,SAAS,aAAa;AAAA,MAAA,CAC1F;AAAA,MACD;AAAA,MAEC;AAAA,IAAA;AAAA,EAAA;AAGb,CAAC;"}
package/dist/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { AppLink } from "./appLink.js";
2
2
  import { isProd, measurer } from "./measure.js";
3
3
  import { NoSSR } from "./noSSR.js";
4
- import "next/navigation";
5
- import "react";
4
+ import { Redirect } from "./redirect.js";
6
5
  import { useIsIndex, useIsInner } from "./useIsInner.js";
7
6
  export {
8
7
  AppLink,
9
8
  NoSSR,
9
+ Redirect,
10
10
  isProd,
11
11
  measurer,
12
12
  useIsIndex,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
package/dist/measure.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createMeasurer } from "@kirill.konshin/core";
1
+ import { createMeasurer } from "@kirill.konshin/node";
2
2
  import { PHASE_PRODUCTION_BUILD, PHASE_PRODUCTION_SERVER } from "next/constants";
3
3
  const isProd = process.env.NEXT_PHASE === PHASE_PRODUCTION_BUILD || process.env.NEXT_PHASE === PHASE_PRODUCTION_SERVER;
4
4
  const measurer = createMeasurer({ colors: isProd });
@@ -1 +1 @@
1
- {"version":3,"file":"measure.js","sources":["../src/measure.ts"],"sourcesContent":["import { createMeasurer } from '@kirill.konshin/core';\nimport { PHASE_PRODUCTION_BUILD, PHASE_PRODUCTION_SERVER } from 'next/constants';\n\nexport const isProd: boolean =\n process.env.NEXT_PHASE === PHASE_PRODUCTION_BUILD || process.env.NEXT_PHASE === PHASE_PRODUCTION_SERVER;\n\nexport const measurer: {\n measure: (\n what: string,\n step: string,\n supplemental?: string,\n ...args: any[]\n ) => {\n done: (result?: string, ...args2: any[]) => void;\n fail: (result?: string, ...args2: any[]) => void;\n log: (...args2: any[]) => void;\n };\n important: (str: any) => any;\n subject: (str: any) => any;\n arg: (str: any) => any;\n sup: (str: any) => any;\n ok: (str: any) => any;\n err: (str: any) => any;\n} = createMeasurer({ colors: isProd });\n"],"names":[],"mappings":";;AAGO,MAAM,SACT,QAAQ,IAAI,eAAe,0BAA0B,QAAQ,IAAI,eAAe;AAE7E,MAAM,WAiBT,eAAe,EAAE,QAAQ,QAAQ;"}
1
+ {"version":3,"file":"measure.js","sources":["../src/measure.ts"],"sourcesContent":["import { createMeasurer } from '@kirill.konshin/node';\nimport { PHASE_PRODUCTION_BUILD, PHASE_PRODUCTION_SERVER } from 'next/constants';\n\nexport const isProd: boolean =\n process.env.NEXT_PHASE === PHASE_PRODUCTION_BUILD || process.env.NEXT_PHASE === PHASE_PRODUCTION_SERVER;\n\nexport const measurer: {\n measure: (\n what: string,\n step: string,\n supplemental?: string,\n ...args: any[]\n ) => {\n done: (result?: string, ...args2: any[]) => void;\n fail: (result?: string, ...args2: any[]) => void;\n log: (...args2: any[]) => void;\n };\n important: (str: any) => any;\n subject: (str: any) => any;\n arg: (str: any) => any;\n sup: (str: any) => any;\n ok: (str: any) => any;\n err: (str: any) => any;\n} = createMeasurer({ colors: isProd });\n"],"names":[],"mappings":";;AAGO,MAAM,SACT,QAAQ,IAAI,eAAe,0BAA0B,QAAQ,IAAI,eAAe;AAE7E,MAAM,WAiBT,eAAe,EAAE,QAAQ,QAAQ;"}
package/dist/noSSR.d.ts CHANGED
@@ -1,4 +1,8 @@
1
1
  import { FC, JSX } from 'react';
2
+ export type NoSSRProps = {
3
+ children: any;
4
+ onSSR?: JSX.Element;
5
+ };
2
6
  /**
3
7
  * Prefer using Next.js `dynamic()` import with `ssr: false` because this will also remove import from server bundle.
4
8
  *
@@ -22,8 +26,5 @@ import { FC, JSX } from 'react';
22
26
  * @see https://github.com/kadirahq/react-no-ssr/blob/master/src/index.js
23
27
  * @see https://nextjs.org/docs/messages/react-hydration-error#solution-1-using-useeffect-to-run-on-the-client-only
24
28
  */
25
- export declare const NoSSR: FC<{
26
- children: any;
27
- onSSR?: JSX.Element;
28
- }>;
29
+ export declare const NoSSR: FC<NoSSRProps>;
29
30
  //# sourceMappingURL=noSSR.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"noSSR.d.ts","sourceRoot":"","sources":["../src/noSSR.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,EAAE,EAAE,GAAG,EAA6B,MAAM,OAAO,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,KAAK,EAAE,EAAE,CAAC;IAAE,QAAQ,EAAE,GAAG,CAAC;IAAC,KAAK,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;CAAE,CAQ5D,CAAC"}
1
+ {"version":3,"file":"noSSR.d.ts","sourceRoot":"","sources":["../src/noSSR.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,EAAE,EAAQ,GAAG,EAA6B,MAAM,OAAO,CAAC;AAExE,MAAM,MAAM,UAAU,GAAG;IACrB,QAAQ,EAAE,GAAG,CAAC;IACd,KAAK,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;CACvB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,KAAK,EAAE,EAAE,CAAC,UAAU,CAQ/B,CAAC"}
package/dist/noSSR.js CHANGED
@@ -1,12 +1,12 @@
1
1
  "use client";
2
- import { useState, useLayoutEffect } from "react";
3
- const NoSSR = function NoSSR2({ children, onSSR = null }) {
2
+ import { memo, useState, useLayoutEffect } from "react";
3
+ const NoSSR = memo(function NoSSR2({ children, onSSR = null }) {
4
4
  const [canRender, setCanRender] = useState(false);
5
5
  useLayoutEffect(() => {
6
6
  setCanRender(true);
7
7
  }, []);
8
8
  return canRender ? children : onSSR;
9
- };
9
+ });
10
10
  export {
11
11
  NoSSR
12
12
  };
package/dist/noSSR.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"noSSR.js","sources":["../src/noSSR.tsx"],"sourcesContent":["'use client';\n\nimport React, { FC, JSX, useLayoutEffect, useState } from 'react';\n\n/**\n * Prefer using Next.js `dynamic()` import with `ssr: false` because this will also remove import from server bundle.\n *\n * ```tsx\n * 'use client';\n *\n * import React from 'react';\n * import dynamic from 'next/dynamic';\n *\n * const PageClient = dynamic(() => import('./pageClient'), { ssr: false });\n *\n * export default function Page() {\n * return (\n * <PageClient />\n * );\n * }\n * ```\n *\n * In other cases this component can be used to just prevent server rendering.\n *\n * @see https://github.com/kadirahq/react-no-ssr/blob/master/src/index.js\n * @see https://nextjs.org/docs/messages/react-hydration-error#solution-1-using-useeffect-to-run-on-the-client-only\n */\nexport const NoSSR: FC<{ children: any; onSSR?: JSX.Element }> = function NoSSR({ children, onSSR = null }): any {\n const [canRender, setCanRender] = useState(false);\n\n useLayoutEffect(() => {\n setCanRender(true);\n }, []);\n\n return canRender ? children : onSSR;\n};\n"],"names":["NoSSR"],"mappings":";;AA2BO,MAAM,QAAoD,SAASA,OAAM,EAAE,UAAU,QAAQ,QAAa;AAC7G,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,KAAK;AAEhD,kBAAgB,MAAM;AAClB,iBAAa,IAAI;AAAA,EACrB,GAAG,CAAA,CAAE;AAEL,SAAO,YAAY,WAAW;AAClC;"}
1
+ {"version":3,"file":"noSSR.js","sources":["../src/noSSR.tsx"],"sourcesContent":["'use client';\n\nimport React, { FC, memo, JSX, useLayoutEffect, useState } from 'react';\n\nexport type NoSSRProps = {\n children: any;\n onSSR?: JSX.Element;\n};\n\n/**\n * Prefer using Next.js `dynamic()` import with `ssr: false` because this will also remove import from server bundle.\n *\n * ```tsx\n * 'use client';\n *\n * import React from 'react';\n * import dynamic from 'next/dynamic';\n *\n * const PageClient = dynamic(() => import('./pageClient'), { ssr: false });\n *\n * export default function Page() {\n * return (\n * <PageClient />\n * );\n * }\n * ```\n *\n * In other cases this component can be used to just prevent server rendering.\n *\n * @see https://github.com/kadirahq/react-no-ssr/blob/master/src/index.js\n * @see https://nextjs.org/docs/messages/react-hydration-error#solution-1-using-useeffect-to-run-on-the-client-only\n */\nexport const NoSSR: FC<NoSSRProps> = memo(function NoSSR({ children, onSSR = null }): any {\n const [canRender, setCanRender] = useState(false);\n\n useLayoutEffect(() => {\n setCanRender(true);\n }, []);\n\n return canRender ? children : onSSR;\n});\n"],"names":["NoSSR"],"mappings":";;AAgCO,MAAM,QAAwB,KAAK,SAASA,OAAM,EAAE,UAAU,QAAQ,QAAa;AACtF,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,KAAK;AAEhD,kBAAgB,MAAM;AAClB,iBAAa,IAAI;AAAA,EACrB,GAAG,CAAA,CAAE;AAEL,SAAO,YAAY,WAAW;AAClC,CAAC;"}
@@ -1,6 +1,8 @@
1
+ import { FC } from 'react';
1
2
  import { LinkProps } from 'next/link';
2
- export default function Redirect({ to, replace }: {
3
+ export type RedirectProps = {
3
4
  to: LinkProps['href'];
4
5
  replace?: LinkProps['replace'];
5
- }): null;
6
+ };
7
+ export declare const Redirect: FC<RedirectProps>;
6
8
  //# sourceMappingURL=redirect.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"redirect.d.ts","sourceRoot":"","sources":["../src/redirect.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE;IAAE,EAAE,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;CAAE,QAM1G"}
1
+ {"version":3,"file":"redirect.d.ts","sourceRoot":"","sources":["../src/redirect.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,EAAE,EAAmB,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,MAAM,MAAM,aAAa,GAAG;IACxB,EAAE,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IACtB,OAAO,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAClC,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CAMrC,CAAC"}
@@ -0,0 +1,14 @@
1
+ "use client";
2
+ import { useRouter } from "next/navigation";
3
+ import { memo, useEffect } from "react";
4
+ const Redirect = memo(function Redirect2({ to, replace }) {
5
+ const router = useRouter();
6
+ useEffect(() => {
7
+ router[replace ? "replace" : "push"](to.toString());
8
+ }, [replace, router, to]);
9
+ return null;
10
+ });
11
+ export {
12
+ Redirect
13
+ };
14
+ //# sourceMappingURL=redirect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redirect.js","sources":["../src/redirect.tsx"],"sourcesContent":["'use client';\n\nimport { useRouter } from 'next/navigation';\nimport { FC, memo, useEffect } from 'react';\nimport type { LinkProps } from 'next/link';\n\nexport type RedirectProps = {\n to: LinkProps['href'];\n replace?: LinkProps['replace'];\n};\n\nexport const Redirect: FC<RedirectProps> = memo(function Redirect({ to, replace }) {\n const router = useRouter();\n useEffect(() => {\n router[replace ? 'replace' : 'push'](to.toString()); //TODO Test this\n }, [replace, router, to]);\n return null;\n});\n"],"names":["Redirect"],"mappings":";;;AAWO,MAAM,WAA8B,KAAK,SAASA,UAAS,EAAE,IAAI,WAAW;AAC/E,QAAM,SAAS,UAAA;AACf,YAAU,MAAM;AACZ,WAAO,UAAU,YAAY,MAAM,EAAE,GAAG,UAAU;AAAA,EACtD,GAAG,CAAC,SAAS,QAAQ,EAAE,CAAC;AACxB,SAAO;AACX,CAAC;"}
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@kirill.konshin/next",
3
3
  "description": "Utilities",
4
- "version": "0.0.1",
4
+ "version": "0.0.2",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "----- BUILD -----": "",
8
8
  "clean": "rm -rf dist .tscache tsconfig.tsbuildinfo",
9
9
  "build": "vite build",
10
- "build:index": "cti create ./src",
10
+ "build:index": "ctix build",
11
11
  "build:check-types": "attw --pack .",
12
12
  "start": "yarn build --watch",
13
13
  "wait": "wait-on ./dist/index.js",
@@ -19,13 +19,8 @@
19
19
  "storybook:build": "storybook build"
20
20
  },
21
21
  "dependencies": {
22
- "@kirill.konshin/core": "*",
23
- "clsx": "^2.1.1",
24
- "colors": "^1.4.0",
25
- "file-saver": "^2.0.5",
26
- "many-keys-map": "^3.0.3",
27
- "psd": "^3.4.0",
28
- "sharp": "^0.34.3"
22
+ "@kirill.konshin/node": "*",
23
+ "clsx": "^2.1.1"
29
24
  },
30
25
  "devDependencies": {
31
26
  "@kirill.konshin/utils-private": "*",
package/src/appLink.tsx CHANGED
@@ -1,19 +1,19 @@
1
1
  'use client';
2
2
 
3
- import React, { ComponentProps, FC } from 'react';
3
+ import React, { ComponentProps, FC, memo } from 'react';
4
4
  import { usePathname } from 'next/navigation';
5
5
  import Link, { LinkProps } from 'next/link';
6
6
  import clsx from 'clsx';
7
7
 
8
+ export type AppLinkProps = {
9
+ children: any;
10
+ exact?: boolean;
11
+ activeClassName?: any;
12
+ } & LinkProps &
13
+ ComponentProps<typeof Link>;
14
+
8
15
  //TODO Test this
9
- export const AppLink: FC<
10
- {
11
- children: any;
12
- exact?: boolean;
13
- activeClassName?: any;
14
- } & LinkProps &
15
- ComponentProps<typeof Link>
16
- > = function AppLink({
16
+ export const AppLink: FC<AppLinkProps> = memo(function AppLink({
17
17
  href,
18
18
  children,
19
19
  className = '',
@@ -37,4 +37,4 @@ export const AppLink: FC<
37
37
  {children}
38
38
  </Link>
39
39
  );
40
- };
40
+ });
package/src/measure.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { createMeasurer } from '@kirill.konshin/core';
1
+ import { createMeasurer } from '@kirill.konshin/node';
2
2
  import { PHASE_PRODUCTION_BUILD, PHASE_PRODUCTION_SERVER } from 'next/constants';
3
3
 
4
4
  export const isProd: boolean =
package/src/noSSR.tsx CHANGED
@@ -1,6 +1,11 @@
1
1
  'use client';
2
2
 
3
- import React, { FC, JSX, useLayoutEffect, useState } from 'react';
3
+ import React, { FC, memo, JSX, useLayoutEffect, useState } from 'react';
4
+
5
+ export type NoSSRProps = {
6
+ children: any;
7
+ onSSR?: JSX.Element;
8
+ };
4
9
 
5
10
  /**
6
11
  * Prefer using Next.js `dynamic()` import with `ssr: false` because this will also remove import from server bundle.
@@ -25,7 +30,7 @@ import React, { FC, JSX, useLayoutEffect, useState } from 'react';
25
30
  * @see https://github.com/kadirahq/react-no-ssr/blob/master/src/index.js
26
31
  * @see https://nextjs.org/docs/messages/react-hydration-error#solution-1-using-useeffect-to-run-on-the-client-only
27
32
  */
28
- export const NoSSR: FC<{ children: any; onSSR?: JSX.Element }> = function NoSSR({ children, onSSR = null }): any {
33
+ export const NoSSR: FC<NoSSRProps> = memo(function NoSSR({ children, onSSR = null }): any {
29
34
  const [canRender, setCanRender] = useState(false);
30
35
 
31
36
  useLayoutEffect(() => {
@@ -33,4 +38,4 @@ export const NoSSR: FC<{ children: any; onSSR?: JSX.Element }> = function NoSSR(
33
38
  }, []);
34
39
 
35
40
  return canRender ? children : onSSR;
36
- };
41
+ });
package/src/redirect.tsx CHANGED
@@ -1,13 +1,18 @@
1
1
  'use client';
2
2
 
3
3
  import { useRouter } from 'next/navigation';
4
- import { useEffect } from 'react';
4
+ import { FC, memo, useEffect } from 'react';
5
5
  import type { LinkProps } from 'next/link';
6
6
 
7
- export default function Redirect({ to, replace }: { to: LinkProps['href']; replace?: LinkProps['replace'] }) {
7
+ export type RedirectProps = {
8
+ to: LinkProps['href'];
9
+ replace?: LinkProps['replace'];
10
+ };
11
+
12
+ export const Redirect: FC<RedirectProps> = memo(function Redirect({ to, replace }) {
8
13
  const router = useRouter();
9
14
  useEffect(() => {
10
15
  router[replace ? 'replace' : 'push'](to.toString()); //TODO Test this
11
16
  }, [replace, router, to]);
12
17
  return null;
13
- }
18
+ });