@akanjs/next 0.0.54 → 0.0.56

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/bootCsr.js CHANGED
@@ -1,21 +1,48 @@
1
1
  "use client";
2
- import { device, initAuth, storage } from "@akanjs/client";
3
- import {
4
- csrContext,
5
- DEFAULT_BOTTOM_INSET,
6
- DEFAULT_TOP_INSET,
7
- defaultPageState
8
- } from "@akanjs/client";
9
- import { Logger } from "@akanjs/common";
10
- import React from "react";
11
- import * as ReactDOM from "react-dom/client";
12
- import { useCsrValues } from "./useCsrValues";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var bootCsr_exports = {};
30
+ __export(bootCsr_exports, {
31
+ bootCsr: () => bootCsr
32
+ });
33
+ module.exports = __toCommonJS(bootCsr_exports);
34
+ var import_client = require("@akanjs/client");
35
+ var import_client2 = require("@akanjs/client");
36
+ var import_common = require("@akanjs/common");
37
+ var import_react = __toESM(require("react"));
38
+ var ReactDOM = __toESM(require("react-dom/client"));
39
+ var import_useCsrValues = require("./useCsrValues");
13
40
  const supportLanguages = ["en", "ko"];
14
41
  const bootCsr = async (context, rootPath, entryPath = "/route") => {
15
- const [, jwt] = await Promise.all([device.init({ supportLanguages }), storage.getItem("jwt")]);
42
+ const [, jwt] = await Promise.all([import_client.device.init({ supportLanguages }), import_client.storage.getItem("jwt")]);
16
43
  if (jwt)
17
- initAuth({ jwt });
18
- Logger.verbose(`Set default language: ${device.lang}`);
44
+ (0, import_client.initAuth)({ jwt });
45
+ import_common.Logger.verbose(`Set default language: ${import_client.device.lang}`);
19
46
  const pages = {};
20
47
  await Promise.all(
21
48
  Object.entries(context).map(async ([key, value]) => {
@@ -26,12 +53,12 @@ const bootCsr = async (context, rootPath, entryPath = "/route") => {
26
53
  const { transition, safeArea, topInset, bottomInset, gesture, cache } = csrConfig ?? {};
27
54
  const pageState = {
28
55
  transition: transition ?? "none",
29
- topSafeArea: safeArea === false ? 0 : device.topSafeArea,
30
- bottomSafeArea: safeArea === false ? 0 : device.bottomSafeArea,
56
+ topSafeArea: safeArea === false ? 0 : import_client.device.topSafeArea,
57
+ bottomSafeArea: safeArea === false ? 0 : import_client.device.bottomSafeArea,
31
58
  // topSafeArea: safeArea === false || device.info.platform === "android" ? 0 : device.topSafeArea,
32
59
  // bottomSafeArea: safeArea === false || device.info.platform === "android" ? 0 : device.bottomSafeArea,
33
- topInset: topInset === true ? DEFAULT_TOP_INSET : topInset === false ? 0 : topInset ?? 0,
34
- bottomInset: bottomInset === true ? DEFAULT_BOTTOM_INSET : bottomInset === false ? 0 : bottomInset ?? 0,
60
+ topInset: topInset === true ? import_client2.DEFAULT_TOP_INSET : topInset === false ? 0 : topInset ?? 0,
61
+ bottomInset: bottomInset === true ? import_client2.DEFAULT_BOTTOM_INSET : bottomInset === false ? 0 : bottomInset ?? 0,
35
62
  gesture: gesture ?? true,
36
63
  cache: cache ?? false
37
64
  };
@@ -70,7 +97,7 @@ const bootCsr = async (context, rootPath, entryPath = "/route") => {
70
97
  });
71
98
  }
72
99
  const pathname = window.location.pathname;
73
- const initialPath = device.lang + entryPath;
100
+ const initialPath = import_client.device.lang + entryPath;
74
101
  window.document.body.style.overflow = "hidden";
75
102
  const getPathRoutes = (route, parentRootLayouts = [], parentLayouts = [], parentPaths = []) => {
76
103
  const parentPath = parentPaths.filter((path2) => path2 !== "/").join("");
@@ -88,7 +115,7 @@ const bootCsr = async (context, rootPath, entryPath = "/route") => {
88
115
  Page: route.Page,
89
116
  RootLayouts,
90
117
  Layouts,
91
- pageState: route.pageState ?? defaultPageState
118
+ pageState: route.pageState ?? import_client2.defaultPageState
92
119
  }
93
120
  ] : [],
94
121
  ...route.children.size ? [...route.children.values()].flatMap((child) => getPathRoutes(child, RootLayouts, Layouts, pathSegments)) : []
@@ -113,13 +140,13 @@ const bootCsr = async (context, rootPath, entryPath = "/route") => {
113
140
  }, routeGuide);
114
141
  });
115
142
  const RouterProvider = () => {
116
- const csrValues = useCsrValues(routeGuide, pathRoutes);
143
+ const csrValues = (0, import_useCsrValues.useCsrValues)(routeGuide, pathRoutes);
117
144
  const { location } = csrValues;
118
- return /* @__PURE__ */ React.createElement(csrContext.Provider, { value: csrValues }, location.pathRoute.RootLayouts.reduceRight(
145
+ return /* @__PURE__ */ import_react.default.createElement(import_client2.csrContext.Provider, { value: csrValues }, location.pathRoute.RootLayouts.reduceRight(
119
146
  (children, Layout) => {
120
- return /* @__PURE__ */ React.createElement(Layout, { params: location.params, searchParams: location.searchParams }, children);
147
+ return /* @__PURE__ */ import_react.default.createElement(Layout, { params: location.params, searchParams: location.searchParams }, children);
121
148
  },
122
- /* @__PURE__ */ React.createElement(React.Fragment, null)
149
+ /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null)
123
150
  ));
124
151
  };
125
152
  if (pathname !== `/${initialPath}`) {
@@ -130,9 +157,6 @@ const bootCsr = async (context, rootPath, entryPath = "/route") => {
130
157
  if (!el)
131
158
  throw new Error("No root element");
132
159
  const root = ReactDOM.createRoot(el);
133
- root.render(/* @__PURE__ */ React.createElement(RouterProvider, null));
160
+ root.render(/* @__PURE__ */ import_react.default.createElement(RouterProvider, null));
134
161
  }
135
162
  };
136
- export {
137
- bootCsr
138
- };
package/bootCsr.mjs ADDED
@@ -0,0 +1,138 @@
1
+ "use client";
2
+ import { device, initAuth, storage } from "@akanjs/client";
3
+ import {
4
+ csrContext,
5
+ DEFAULT_BOTTOM_INSET,
6
+ DEFAULT_TOP_INSET,
7
+ defaultPageState
8
+ } from "@akanjs/client";
9
+ import { Logger } from "@akanjs/common";
10
+ import React from "react";
11
+ import * as ReactDOM from "react-dom/client";
12
+ import { useCsrValues } from "./useCsrValues";
13
+ const supportLanguages = ["en", "ko"];
14
+ const bootCsr = async (context, rootPath, entryPath = "/route") => {
15
+ const [, jwt] = await Promise.all([device.init({ supportLanguages }), storage.getItem("jwt")]);
16
+ if (jwt)
17
+ initAuth({ jwt });
18
+ Logger.verbose(`Set default language: ${device.lang}`);
19
+ const pages = {};
20
+ await Promise.all(
21
+ Object.entries(context).map(async ([key, value]) => {
22
+ pages[key] = await value();
23
+ })
24
+ );
25
+ const getPageState = (csrConfig) => {
26
+ const { transition, safeArea, topInset, bottomInset, gesture, cache } = csrConfig ?? {};
27
+ const pageState = {
28
+ transition: transition ?? "none",
29
+ topSafeArea: safeArea === false ? 0 : device.topSafeArea,
30
+ bottomSafeArea: safeArea === false ? 0 : device.bottomSafeArea,
31
+ // topSafeArea: safeArea === false || device.info.platform === "android" ? 0 : device.topSafeArea,
32
+ // bottomSafeArea: safeArea === false || device.info.platform === "android" ? 0 : device.bottomSafeArea,
33
+ topInset: topInset === true ? DEFAULT_TOP_INSET : topInset === false ? 0 : topInset ?? 0,
34
+ bottomInset: bottomInset === true ? DEFAULT_BOTTOM_INSET : bottomInset === false ? 0 : bottomInset ?? 0,
35
+ gesture: gesture ?? true,
36
+ cache: cache ?? false
37
+ };
38
+ return pageState;
39
+ };
40
+ const routeMap = /* @__PURE__ */ new Map();
41
+ routeMap.set("/", { path: "/", children: /* @__PURE__ */ new Map() });
42
+ for (const filePath of Object.keys(pages)) {
43
+ const fileName = /\.\/(.*)\.tsx$/.exec(filePath)?.[1];
44
+ if (!fileName)
45
+ continue;
46
+ const fileType = fileName.endsWith("page") ? "page" : fileName.endsWith("layout") ? "layout" : null;
47
+ if (!fileType)
48
+ continue;
49
+ const pathSegments = [
50
+ "/",
51
+ ...fileName.split("/").slice(0, -1).map((segment) => `/${segment.replace(/\[(.*?)\]/g, ":$1")}`)
52
+ ];
53
+ const targetRouteMap = pathSegments.slice(0, -1).reduce((rMap, path) => {
54
+ if (!rMap.has(path))
55
+ rMap.set(path, { path, children: /* @__PURE__ */ new Map() });
56
+ return rMap.get(path)?.children;
57
+ }, routeMap);
58
+ if (!targetRouteMap)
59
+ continue;
60
+ const targetPath = pathSegments[pathSegments.length - 1];
61
+ targetRouteMap.set(targetPath, {
62
+ // action: pages[path]?.action,
63
+ // ErrorBoundary: pages[path]?.ErrorBoundary,
64
+ ...targetRouteMap.get(targetPath) ?? { path: targetPath, children: /* @__PURE__ */ new Map() },
65
+ ...fileType === "layout" ? { Layout: pages[filePath].default } : {
66
+ Page: pages[filePath].default,
67
+ pageState: getPageState(pages[filePath].default.csrConfig),
68
+ csrConfig: pages[filePath].default.csrConfig
69
+ }
70
+ });
71
+ }
72
+ const pathname = window.location.pathname;
73
+ const initialPath = device.lang + entryPath;
74
+ window.document.body.style.overflow = "hidden";
75
+ const getPathRoutes = (route, parentRootLayouts = [], parentLayouts = [], parentPaths = []) => {
76
+ const parentPath = parentPaths.filter((path2) => path2 !== "/").join("");
77
+ const currentPathSegment = /^\/\(.*\)$/.test(route.path) ? "" : route.path;
78
+ const isRoot = ["/", "/:lang"].includes(parentPath + currentPathSegment) && parentRootLayouts.length < 2;
79
+ const path = parentPath + currentPathSegment;
80
+ const pathSegments = [...parentPaths, ...currentPathSegment ? [currentPathSegment] : []];
81
+ const RootLayouts = [...parentRootLayouts, ...isRoot && route.Layout ? [route.Layout] : []];
82
+ const Layouts = [...parentLayouts, ...!isRoot && route.Layout ? [route.Layout] : []];
83
+ return [
84
+ ...route.Page ? [
85
+ {
86
+ path,
87
+ pathSegments,
88
+ Page: route.Page,
89
+ RootLayouts,
90
+ Layouts,
91
+ pageState: route.pageState ?? defaultPageState
92
+ }
93
+ ] : [],
94
+ ...route.children.size ? [...route.children.values()].flatMap((child) => getPathRoutes(child, RootLayouts, Layouts, pathSegments)) : []
95
+ ];
96
+ };
97
+ const rootRoute = routeMap.get("/");
98
+ if (!rootRoute)
99
+ throw new Error("No root route");
100
+ const pathRoutes = getPathRoutes(rootRoute);
101
+ const routeGuide = { pathSegment: "/", children: {} };
102
+ pathRoutes.forEach((pathRoute) => {
103
+ const pathSegments = pathRoute.pathSegments.slice(1);
104
+ pathSegments.reduce((routeGuide2, pathSegment, index) => {
105
+ const child = routeGuide2.children[pathSegment];
106
+ routeGuide2.children[pathSegment] = {
107
+ ...child ?? {},
108
+ pathSegment,
109
+ ...index === pathSegments.length - 1 ? { pathRoute } : {},
110
+ children: child?.children ?? {}
111
+ };
112
+ return routeGuide2.children[pathSegment];
113
+ }, routeGuide);
114
+ });
115
+ const RouterProvider = () => {
116
+ const csrValues = useCsrValues(routeGuide, pathRoutes);
117
+ const { location } = csrValues;
118
+ return /* @__PURE__ */ React.createElement(csrContext.Provider, { value: csrValues }, location.pathRoute.RootLayouts.reduceRight(
119
+ (children, Layout) => {
120
+ return /* @__PURE__ */ React.createElement(Layout, { params: location.params, searchParams: location.searchParams }, children);
121
+ },
122
+ /* @__PURE__ */ React.createElement(React.Fragment, null)
123
+ ));
124
+ };
125
+ if (pathname !== `/${initialPath}`) {
126
+ window.location.replace(initialPath);
127
+ return;
128
+ } else {
129
+ const el = document.getElementById("root");
130
+ if (!el)
131
+ throw new Error("No root element");
132
+ const root = ReactDOM.createRoot(el);
133
+ root.render(/* @__PURE__ */ React.createElement(RouterProvider, null));
134
+ }
135
+ };
136
+ export {
137
+ bootCsr
138
+ };
@@ -1,8 +1,40 @@
1
- import { logo } from "@akanjs/base";
2
- import { Logger } from "@akanjs/common";
3
- import { match as matchLocale } from "@formatjs/intl-localematcher";
4
- import Negotiator from "negotiator";
5
- import { NextResponse } from "next/server";
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var createNextMiddleware_exports = {};
29
+ __export(createNextMiddleware_exports, {
30
+ createNextMiddleware: () => createNextMiddleware
31
+ });
32
+ module.exports = __toCommonJS(createNextMiddleware_exports);
33
+ var import_base = require("@akanjs/base");
34
+ var import_common = require("@akanjs/common");
35
+ var import_intl_localematcher = require("@formatjs/intl-localematcher");
36
+ var import_negotiator = __toESM(require("negotiator"));
37
+ var import_server = require("next/server");
6
38
  const i18n = { defaultLocale: "en", locales: ["en", "ko"] };
7
39
  const basePaths = process.env.basePaths ? process.env.basePaths.split(",") : [];
8
40
  function getLocale(request) {
@@ -11,21 +43,21 @@ function getLocale(request) {
11
43
  const negotiatorHeaders = {};
12
44
  request.headers.forEach((value, key) => negotiatorHeaders[key] = value);
13
45
  try {
14
- const languages = new Negotiator({ headers: negotiatorHeaders }).languages();
15
- return matchLocale(languages, i18n.locales, i18n.defaultLocale);
46
+ const languages = new import_negotiator.default({ headers: negotiatorHeaders }).languages();
47
+ return (0, import_intl_localematcher.match)(languages, i18n.locales, i18n.defaultLocale);
16
48
  } catch (e) {
17
49
  return i18n.defaultLocale;
18
50
  }
19
51
  }
20
52
  const createNextMiddleware = () => {
21
- Logger.rawLog(logo, "console");
53
+ import_common.Logger.rawLog(import_base.logo, "console");
22
54
  const middleware = (request) => {
23
55
  const pathname = request.nextUrl.pathname;
24
56
  const pathnameIsMissingLocale = i18n.locales.every(
25
57
  (locale2) => !pathname.startsWith(`/${locale2}/`) && pathname !== `/${locale2}`
26
58
  );
27
59
  if (pathnameIsMissingLocale)
28
- return NextResponse.redirect(
60
+ return import_server.NextResponse.redirect(
29
61
  new URL(`/${getLocale(request)}/${request.nextUrl.href.split("/").slice(3).join("/")}`, request.url)
30
62
  );
31
63
  const splits = pathname.split("/");
@@ -40,10 +72,7 @@ const createNextMiddleware = () => {
40
72
  headers.set("x-base-path", basePath);
41
73
  if (searchParamJwt)
42
74
  headers.set("jwt", searchParamJwt);
43
- return NextResponse.next({ request: { headers } });
75
+ return import_server.NextResponse.next({ request: { headers } });
44
76
  };
45
77
  return middleware;
46
78
  };
47
- export {
48
- createNextMiddleware
49
- };
@@ -0,0 +1,49 @@
1
+ import { logo } from "@akanjs/base";
2
+ import { Logger } from "@akanjs/common";
3
+ import { match as matchLocale } from "@formatjs/intl-localematcher";
4
+ import Negotiator from "negotiator";
5
+ import { NextResponse } from "next/server";
6
+ const i18n = { defaultLocale: "en", locales: ["en", "ko"] };
7
+ const basePaths = process.env.basePaths ? process.env.basePaths.split(",") : [];
8
+ function getLocale(request) {
9
+ if (!request.headers.get("accept-language"))
10
+ return i18n.defaultLocale;
11
+ const negotiatorHeaders = {};
12
+ request.headers.forEach((value, key) => negotiatorHeaders[key] = value);
13
+ try {
14
+ const languages = new Negotiator({ headers: negotiatorHeaders }).languages();
15
+ return matchLocale(languages, i18n.locales, i18n.defaultLocale);
16
+ } catch (e) {
17
+ return i18n.defaultLocale;
18
+ }
19
+ }
20
+ const createNextMiddleware = () => {
21
+ Logger.rawLog(logo, "console");
22
+ const middleware = (request) => {
23
+ const pathname = request.nextUrl.pathname;
24
+ const pathnameIsMissingLocale = i18n.locales.every(
25
+ (locale2) => !pathname.startsWith(`/${locale2}/`) && pathname !== `/${locale2}`
26
+ );
27
+ if (pathnameIsMissingLocale)
28
+ return NextResponse.redirect(
29
+ new URL(`/${getLocale(request)}/${request.nextUrl.href.split("/").slice(3).join("/")}`, request.url)
30
+ );
31
+ const splits = pathname.split("/");
32
+ const locale = splits[1];
33
+ const basePath = basePaths.includes(splits[2]) ? splits[2] : null;
34
+ const headers = new Headers(request.headers);
35
+ const searchParams = new URLSearchParams(request.nextUrl.search);
36
+ const searchParamJwt = searchParams.get("jwt");
37
+ headers.set("x-locale", locale);
38
+ headers.set("x-path", "/" + splits.slice(2).join("/"));
39
+ if (basePath)
40
+ headers.set("x-base-path", basePath);
41
+ if (searchParamJwt)
42
+ headers.set("jwt", searchParamJwt);
43
+ return NextResponse.next({ request: { headers } });
44
+ };
45
+ return middleware;
46
+ };
47
+ export {
48
+ createNextMiddleware
49
+ };
@@ -1,3 +1,25 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var createRobotPage_exports = {};
19
+ __export(createRobotPage_exports, {
20
+ createRobotPage: () => createRobotPage
21
+ });
22
+ module.exports = __toCommonJS(createRobotPage_exports);
1
23
  const createRobotPage = (clientHttpUri, config) => {
2
24
  return {
3
25
  ...config ?? {},
@@ -10,6 +32,3 @@ const createRobotPage = (clientHttpUri, config) => {
10
32
  sitemap: `${clientHttpUri}/sitemap.xml`
11
33
  };
12
34
  };
13
- export {
14
- createRobotPage
15
- };
@@ -0,0 +1,15 @@
1
+ const createRobotPage = (clientHttpUri, config) => {
2
+ return {
3
+ ...config ?? {},
4
+ rules: {
5
+ userAgent: "*",
6
+ allow: "/",
7
+ disallow: "/admin/",
8
+ ...config?.rules ?? {}
9
+ },
10
+ sitemap: `${clientHttpUri}/sitemap.xml`
11
+ };
12
+ };
13
+ export {
14
+ createRobotPage
15
+ };
@@ -1,7 +1,26 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var createSitemapPage_exports = {};
19
+ __export(createSitemapPage_exports, {
20
+ createSitemapPage: () => createSitemapPage
21
+ });
22
+ module.exports = __toCommonJS(createSitemapPage_exports);
1
23
  const lastModified = /* @__PURE__ */ new Date();
2
24
  const createSitemapPage = (clientHttpUri, paths) => {
3
25
  return paths.map((path) => ({ url: `${clientHttpUri}${path}`, lastModified }));
4
26
  };
5
- export {
6
- createSitemapPage
7
- };
@@ -0,0 +1,7 @@
1
+ const lastModified = /* @__PURE__ */ new Date();
2
+ const createSitemapPage = (clientHttpUri, paths) => {
3
+ return paths.map((path) => ({ url: `${clientHttpUri}${path}`, lastModified }));
4
+ };
5
+ export {
6
+ createSitemapPage
7
+ };
package/index.js CHANGED
@@ -1,41 +1,60 @@
1
- import { useFetch } from "./useFetch";
2
- import { lazy } from "./lazy";
3
- import { makePageProto } from "./makePageProto";
4
- import { useDebounce } from "./useDebounce";
5
- import { useInterval } from "./useInterval";
6
- import { bootCsr } from "./bootCsr";
7
- import { useCamera } from "./useCamera";
8
- import { useContact } from "./useContact";
9
- import { usePushNoti } from "./usePushNoti";
10
- import { useGeoLocation } from "./useGeoLocation";
11
- import { useCodepush } from "./useCodepush";
12
- import { usePurchase } from "./usePurchase";
13
- import { useCsrValues } from "./useCsrValues";
14
- import { createRobotPage } from "./createRobotPage";
15
- import { createSitemapPage } from "./createSitemapPage";
16
- import { createNextMiddleware } from "./createNextMiddleware";
17
- //! PageAgent csr에서 말썽 일으킨다
18
- import { useThrottle } from "./useThrottle";
19
- import { useHistory } from "./useHistory";
20
- import { useLocation } from "./useLocation";
21
- export {
22
- bootCsr,
23
- createNextMiddleware,
24
- createRobotPage,
25
- createSitemapPage,
26
- lazy,
27
- makePageProto,
28
- useCamera,
29
- useCodepush,
30
- useContact,
31
- useCsrValues,
32
- useDebounce,
33
- useFetch,
34
- useGeoLocation,
35
- useHistory,
36
- useInterval,
37
- useLocation,
38
- usePurchase,
39
- usePushNoti,
40
- useThrottle
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
41
16
  };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var next_exports = {};
19
+ __export(next_exports, {
20
+ bootCsr: () => import_bootCsr.bootCsr,
21
+ createNextMiddleware: () => import_createNextMiddleware.createNextMiddleware,
22
+ createRobotPage: () => import_createRobotPage.createRobotPage,
23
+ createSitemapPage: () => import_createSitemapPage.createSitemapPage,
24
+ lazy: () => import_lazy.lazy,
25
+ makePageProto: () => import_makePageProto.makePageProto,
26
+ useCamera: () => import_useCamera.useCamera,
27
+ useCodepush: () => import_useCodepush.useCodepush,
28
+ useContact: () => import_useContact.useContact,
29
+ useCsrValues: () => import_useCsrValues.useCsrValues,
30
+ useDebounce: () => import_useDebounce.useDebounce,
31
+ useFetch: () => import_useFetch.useFetch,
32
+ useGeoLocation: () => import_useGeoLocation.useGeoLocation,
33
+ useHistory: () => import_useHistory.useHistory,
34
+ useInterval: () => import_useInterval.useInterval,
35
+ useLocation: () => import_useLocation.useLocation,
36
+ usePurchase: () => import_usePurchase.usePurchase,
37
+ usePushNoti: () => import_usePushNoti.usePushNoti,
38
+ useThrottle: () => import_useThrottle.useThrottle
39
+ });
40
+ module.exports = __toCommonJS(next_exports);
41
+ var import_useFetch = require("./useFetch");
42
+ var import_lazy = require("./lazy");
43
+ var import_makePageProto = require("./makePageProto");
44
+ var import_useDebounce = require("./useDebounce");
45
+ var import_useInterval = require("./useInterval");
46
+ var import_bootCsr = require("./bootCsr");
47
+ var import_useCamera = require("./useCamera");
48
+ var import_useContact = require("./useContact");
49
+ var import_usePushNoti = require("./usePushNoti");
50
+ var import_useGeoLocation = require("./useGeoLocation");
51
+ var import_useCodepush = require("./useCodepush");
52
+ var import_usePurchase = require("./usePurchase");
53
+ var import_useCsrValues = require("./useCsrValues");
54
+ var import_createRobotPage = require("./createRobotPage");
55
+ var import_createSitemapPage = require("./createSitemapPage");
56
+ var import_createNextMiddleware = require("./createNextMiddleware");
57
+ var import_useThrottle = require("./useThrottle");
58
+ var import_useHistory = require("./useHistory");
59
+ var import_useLocation = require("./useLocation");
60
+ //! PageAgent csr에서 말썽 일으킨다
package/index.mjs ADDED
@@ -0,0 +1,41 @@
1
+ import { useFetch } from "./useFetch";
2
+ import { lazy } from "./lazy";
3
+ import { makePageProto } from "./makePageProto";
4
+ import { useDebounce } from "./useDebounce";
5
+ import { useInterval } from "./useInterval";
6
+ import { bootCsr } from "./bootCsr";
7
+ import { useCamera } from "./useCamera";
8
+ import { useContact } from "./useContact";
9
+ import { usePushNoti } from "./usePushNoti";
10
+ import { useGeoLocation } from "./useGeoLocation";
11
+ import { useCodepush } from "./useCodepush";
12
+ import { usePurchase } from "./usePurchase";
13
+ import { useCsrValues } from "./useCsrValues";
14
+ import { createRobotPage } from "./createRobotPage";
15
+ import { createSitemapPage } from "./createSitemapPage";
16
+ import { createNextMiddleware } from "./createNextMiddleware";
17
+ //! PageAgent csr에서 말썽 일으킨다
18
+ import { useThrottle } from "./useThrottle";
19
+ import { useHistory } from "./useHistory";
20
+ import { useLocation } from "./useLocation";
21
+ export {
22
+ bootCsr,
23
+ createNextMiddleware,
24
+ createRobotPage,
25
+ createSitemapPage,
26
+ lazy,
27
+ makePageProto,
28
+ useCamera,
29
+ useCodepush,
30
+ useContact,
31
+ useCsrValues,
32
+ useDebounce,
33
+ useFetch,
34
+ useGeoLocation,
35
+ useHistory,
36
+ useInterval,
37
+ useLocation,
38
+ usePurchase,
39
+ usePushNoti,
40
+ useThrottle
41
+ };