@koine/next 2.0.0-beta.7 → 2.0.0-beta.71

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.
Files changed (160) hide show
  1. package/12/AnalyticsGoogle.d.ts +1 -2
  2. package/12/DisableErrorOverlay.d.ts +1 -6
  3. package/12/Seo.d.ts +8 -26
  4. package/12/SeoDefaults.d.ts +3 -4
  5. package/12/seoBuildTags.d.ts +1 -16
  6. package/12/types.d.ts +2 -0
  7. package/12.cjs.d.ts +1 -0
  8. package/12.cjs.default.js +1 -0
  9. package/12.cjs.js +28 -0
  10. package/12.cjs.mjs +2 -0
  11. package/12.d.ts +3 -0
  12. package/12.esm.js +18 -0
  13. package/README.md +0 -12
  14. package/config.cjs.d.ts +1 -0
  15. package/config.cjs.default.js +1 -0
  16. package/config.cjs.js +9 -0
  17. package/config.cjs.mjs +2 -0
  18. package/config.d.ts +7 -0
  19. package/config.esm.js +5 -0
  20. package/index.cjs.d.ts +1 -0
  21. package/index.cjs.default.js +1 -0
  22. package/index.cjs.js +25 -0
  23. package/index.cjs.mjs +2 -0
  24. package/index.d.ts +4 -2
  25. package/index.esm.js +14 -0
  26. package/package.json +30 -69
  27. package/theme/ThemeContext.d.ts +11 -0
  28. package/theme/ThemeProvider.d.ts +17 -0
  29. package/theme/useTheme.d.ts +4 -0
  30. package/typings.d.ts +39 -50
  31. package/utils/load.d.ts +1 -0
  32. package/12/AnalyticsGoogle.js +0 -79
  33. package/12/AnalyticsGoogle.mjs +0 -60
  34. package/12/DisableErrorOverlay.js +0 -31
  35. package/12/DisableErrorOverlay.mjs +0 -16
  36. package/12/DynamicNamespaces.d.ts +0 -13
  37. package/12/DynamicNamespaces.js +0 -23
  38. package/12/DynamicNamespaces.mjs +0 -8
  39. package/12/Favicon.d.ts +0 -4
  40. package/12/Favicon.js +0 -29
  41. package/12/Favicon.mjs +0 -10
  42. package/12/Link.d.ts +0 -10
  43. package/12/Link.js +0 -38
  44. package/12/Link.mjs +0 -20
  45. package/12/NextProgress.d.ts +0 -25
  46. package/12/NextProgress.js +0 -69
  47. package/12/NextProgress.mjs +0 -51
  48. package/12/Seo.js +0 -29
  49. package/12/Seo.mjs +0 -30
  50. package/12/SeoDefaults.js +0 -31
  51. package/12/SeoDefaults.mjs +0 -14
  52. package/12/T.d.ts +0 -16
  53. package/12/T.js +0 -43
  54. package/12/T.mjs +0 -27
  55. package/12/ThemeContext.d.ts +0 -17
  56. package/12/ThemeContext.js +0 -25
  57. package/12/ThemeContext.mjs +0 -7
  58. package/12/ThemeProvider.d.ts +0 -35
  59. package/12/ThemeProvider.js +0 -256
  60. package/12/ThemeProvider.mjs +0 -245
  61. package/12/TransText.d.ts +0 -3
  62. package/12/TransText.js +0 -23
  63. package/12/TransText.mjs +0 -4
  64. package/12/app/AppHead.d.ts +0 -3
  65. package/12/app/AppHead.js +0 -31
  66. package/12/app/AppHead.mjs +0 -12
  67. package/12/app/AppMain.d.ts +0 -35
  68. package/12/app/AppMain.js +0 -6
  69. package/12/app/AppMain.mjs +0 -1
  70. package/12/app/css/AppMain.d.ts +0 -9
  71. package/12/app/css/AppMain.js +0 -39
  72. package/12/app/css/AppMain.mjs +0 -24
  73. package/12/app/css/AppTheme.d.ts +0 -11
  74. package/12/app/css/AppTheme.js +0 -33
  75. package/12/app/css/AppTheme.mjs +0 -17
  76. package/12/app/css/auth/index.d.ts +0 -11
  77. package/12/app/css/auth/index.js +0 -40
  78. package/12/app/css/auth/index.mjs +0 -24
  79. package/12/app/css/index.d.ts +0 -54
  80. package/12/app/css/index.js +0 -36
  81. package/12/app/css/index.mjs +0 -65
  82. package/12/app/index.d.ts +0 -2
  83. package/12/app/index.js +0 -7
  84. package/12/app/index.mjs +0 -2
  85. package/12/app/sc/AppMain.d.ts +0 -11
  86. package/12/app/sc/AppMain.js +0 -70
  87. package/12/app/sc/AppMain.mjs +0 -58
  88. package/12/app/sc/AppTheme.d.ts +0 -14
  89. package/12/app/sc/AppTheme.js +0 -33
  90. package/12/app/sc/AppTheme.mjs +0 -16
  91. package/12/app/sc/auth/index.d.ts +0 -11
  92. package/12/app/sc/auth/index.js +0 -40
  93. package/12/app/sc/auth/index.mjs +0 -24
  94. package/12/app/sc/index.d.ts +0 -56
  95. package/12/app/sc/index.js +0 -36
  96. package/12/app/sc/index.mjs +0 -67
  97. package/12/document/Document.d.ts +0 -15
  98. package/12/document/Document.js +0 -49
  99. package/12/document/Document.mjs +0 -38
  100. package/12/document/css/index.d.ts +0 -17
  101. package/12/document/css/index.js +0 -60
  102. package/12/document/css/index.mjs +0 -53
  103. package/12/document/index.d.ts +0 -2
  104. package/12/document/index.js +0 -19
  105. package/12/document/index.mjs +0 -2
  106. package/12/document/sc/index.d.ts +0 -19
  107. package/12/document/sc/index.js +0 -73
  108. package/12/document/sc/index.mjs +0 -65
  109. package/12/getT.d.ts +0 -9
  110. package/12/getT.js +0 -23
  111. package/12/getT.mjs +0 -8
  112. package/12/index.d.ts +0 -24
  113. package/12/index.js +0 -100
  114. package/12/index.mjs +0 -27
  115. package/12/seoBuildTags.js +0 -126
  116. package/12/seoBuildTags.mjs +0 -121
  117. package/12/to.d.ts +0 -24
  118. package/12/to.js +0 -31
  119. package/12/to.mjs +0 -19
  120. package/12/translationAsOptions.d.ts +0 -3
  121. package/12/translationAsOptions.js +0 -19
  122. package/12/translationAsOptions.mjs +0 -9
  123. package/12/types-i18n.d.ts +0 -118
  124. package/12/types-i18n.js +0 -15
  125. package/12/types-i18n.mjs +0 -12
  126. package/12/types-seo.d.ts +0 -7
  127. package/12/types-seo.js +0 -4
  128. package/12/types-seo.mjs +0 -1
  129. package/12/useBackUrl.d.ts +0 -2
  130. package/12/useBackUrl.js +0 -47
  131. package/12/useBackUrl.mjs +0 -28
  132. package/12/useDateFormat.d.ts +0 -7
  133. package/12/useDateFormat.js +0 -42
  134. package/12/useDateFormat.mjs +0 -26
  135. package/12/useForm.d.ts +0 -27
  136. package/12/useForm.js +0 -65
  137. package/12/useForm.mjs +0 -47
  138. package/12/useLocale.d.ts +0 -2
  139. package/12/useLocale.js +0 -25
  140. package/12/useLocale.mjs +0 -6
  141. package/12/useT.d.ts +0 -4
  142. package/12/useT.js +0 -58
  143. package/12/useT.mjs +0 -39
  144. package/12/useTheme.d.ts +0 -7
  145. package/12/useTheme.js +0 -23
  146. package/12/useTheme.mjs +0 -7
  147. package/12/useTo.d.ts +0 -3
  148. package/12/useTo.js +0 -26
  149. package/12/useTo.mjs +0 -8
  150. package/config/index.d.ts +0 -160
  151. package/config/index.js +0 -317
  152. package/config/index.mjs +0 -315
  153. package/getSiteUrl.d.ts +0 -8
  154. package/getSiteUrl.js +0 -24
  155. package/getSiteUrl.mjs +0 -10
  156. package/index.js +0 -20
  157. package/index.mjs +0 -2
  158. package/load.d.ts +0 -10
  159. package/load.js +0 -31
  160. package/load.mjs +0 -13
package/config/index.mjs DELETED
@@ -1,315 +0,0 @@
1
- /**
2
- * Normalise pathname
3
- *
4
- * From a path like `/some//malformed/path///` it returns `some/malformed/path`
5
- *
6
- * - Removes subsequent slashes
7
- * - Removing initial and ending slashes
8
- * - Returns an empty string `"""` if only slashes are given
9
- */ export function normaliseUrlPathname(pathname = "") {
10
- // with return pathname.replace(/\/+\//g, "/").replace(/^\/+(.*?)\/+$/, "$1");
11
- // we would instead return a single slash if only slashes are given
12
- return pathname.replace(/\/+\//g, "/").replace(/^\/*(.*?)\/*$/, "$1");
13
- }
14
- /**
15
- * Transform to path any absolute or relative URL
16
- *
17
- * Useful when setting up `rewrites` and `redirects` especally in a [multi-zones
18
- * setup](https://nextjs.org/docs/advanced-features/multi-zones).
19
- *
20
- * From a path like `http://localhost/some//malformed/path///` it returns `/some/malformed/path`
21
- *
22
- * @see {@link normaliseUrlPathname}
23
- */ export function toPath(urlOrPathname = "") {
24
- let pathname = "";
25
- try {
26
- const parsed = new URL(urlOrPathname);
27
- pathname = parsed.pathname;
28
- } catch (e) {
29
- pathname = urlOrPathname;
30
- }
31
- // with return pathname.replace(/\/+\//g, "/").replace(/^\/+(.*?)\/+$/, "$1");
32
- // we would instead return a single slash if only slashes are given
33
- return pathname.replace(/\/+\//g, "/").replace(/^\/*(.*?)\/*$/, "$1");
34
- }
35
- /**
36
- * Clean a pathname and encode each part
37
- *
38
- * @see {@link normaliseUrlPathname}
39
- */ export function encodePathname(pathname = "") {
40
- const parts = normaliseUrlPathname(pathname).split("/");
41
- return parts.filter((part)=>!!part).map((part)=>encodeURIComponent(part)).join("/");
42
- }
43
- /**
44
- * Transform the route translated defintion into a `pathname` and a `template`.
45
- *
46
- * Here we add the wildcard flag maybe found in the pathname to the template
47
- * name too, this is because we do not want to have the wildcard in the JSON
48
- * keys as those are also used to produce links throught the `useTo` hook and
49
- * having asterisks there is a bit cumbersome.
50
- *
51
- * @see https://nextjs.org/docs/messages/invalid-multi-match
52
- */ function transformRoute(route) {
53
- const { pathname: rawPathname, template: rawTemplate } = route;
54
- const pathnameParts = rawPathname.split("/").filter((part)=>!!part);
55
- const templateParts = rawTemplate.split("/").filter((part)=>!!part);
56
- const mapPartsByIdx = {};
57
- const pathname = pathnameParts.map((part)=>{
58
- const hasWildcard = part.endsWith("*");
59
- part = part.replace("*", "");
60
- const isDynamic = part.startsWith("{{") && part.endsWith("}}");
61
- const asValue = isDynamic ? part.match(/{{(.+)}}/)?.[1].trim() ?? "" : part.trim();
62
- const asPath = encodeURIComponent(asValue) + (hasWildcard ? "*" : "");
63
- mapPartsByIdx[asValue] = {
64
- isDynamic,
65
- hasWildcard
66
- };
67
- return isDynamic ? `:${asPath}` : asPath;
68
- }).join("/");
69
- const template = templateParts.map((part)=>{
70
- const isDynamic = part.startsWith("[") && part.endsWith("]");
71
- const asValue = isDynamic ? part.match(/\[(.+)\]/)?.[1].trim() ?? "" : part.trim();
72
- const hasWildcard = mapPartsByIdx[asValue]?.hasWildcard;
73
- const asPath = encodeURIComponent(asValue) + (hasWildcard ? "*" : "");
74
- return isDynamic ? `:${asPath}` : asPath;
75
- }).join("/");
76
- return {
77
- pathname,
78
- template
79
- };
80
- }
81
- /**
82
- * Get routes map dictionary
83
- */ function getRoutesMap(map = {}, routes, pathnameBuffer = "", templateBuffer = "") {
84
- for(const key in routes){
85
- const pathOrNestedRoutes = routes[key];
86
- const template = `${templateBuffer}/${key}`;
87
- if (typeof pathOrNestedRoutes === "string") {
88
- map[template] = {
89
- template,
90
- pathname: pathOrNestedRoutes,
91
- wildcard: pathOrNestedRoutes.includes("*")
92
- };
93
- } else {
94
- getRoutesMap(map, pathOrNestedRoutes, pathnameBuffer, template);
95
- }
96
- }
97
- return map;
98
- }
99
- /**
100
- * Removes `/index` from a template/url path
101
- */ function getWithoutIndex(template) {
102
- return template.replace(/\/index$/, "");
103
- }
104
- /**
105
- * Get path rewrite
106
- */ export function getPathRewrite(route) {
107
- const { pathname, template } = transformRoute(route);
108
- const source = `/${normaliseUrlPathname(pathname)}`;
109
- const destination = `/${normaliseUrlPathname(template)}`;
110
- // console.log(`rewrite pathname "${source}" to template "${destination}"`);
111
- return {
112
- source,
113
- destination: getWithoutIndex(destination)
114
- };
115
- }
116
- /**
117
- * Get path redirect
118
- */ export function getPathRedirect(locale = "", route, permanent) {
119
- const { template, pathname } = transformRoute(route);
120
- const source = `/${normaliseUrlPathname((locale ? `/${locale}/` : "/") + template)}`;
121
- const destination = `/${normaliseUrlPathname(pathname)}`;
122
- // console.log(`redirect template "${source}" to pathname "${destination}"`);
123
- return {
124
- source: getWithoutIndex(source),
125
- destination,
126
- permanent: Boolean(permanent),
127
- locale: false
128
- };
129
- }
130
- /**
131
- */ export async function getRedirects(defaultLocale, routes, permanent, debug) {
132
- const redirects = [];
133
- const routesMap = getRoutesMap({}, routes);
134
- Object.keys(routesMap).forEach((template)=>{
135
- const route = routesMap[template];
136
- // TODO: add option hideDefaultLocaleInUrl?
137
- // this is meant to redirect the URL with the default locale to the same
138
- // url without locale prefix, e.g.: /en/about -> /about (assuming en is the
139
- // defualt locale).
140
- // Actually this redirect seem not to be necessary, probably the i18n routing
141
- // mechanism of next 12 already does this, enabling causes infinite redirects
142
- // if (hideDefaultLocaleInUrl) {
143
- // redirects.push(getPathRedirect(defaultLocale, route, permanent));
144
- // }
145
- if (route.pathname !== getWithoutIndex(template)) {
146
- redirects.push(getPathRedirect("", route, permanent));
147
- }
148
- });
149
- if (debug) console.info("[@koine/next/config:getRedirects]", redirects);
150
- return redirects;
151
- }
152
- /**
153
- */ export async function getRewrites(routes, debug) {
154
- const rewrites = [];
155
- const routesMap = getRoutesMap({}, routes);
156
- Object.keys(routesMap).forEach((template)=>{
157
- const route = routesMap[template];
158
- if (route.pathname !== getWithoutIndex(template)) {
159
- rewrites.push(getPathRewrite(route));
160
- }
161
- });
162
- if (debug) console.info("[@koine/next/config:getRewrites]", rewrites);
163
- return rewrites;
164
- }
165
- /**
166
- * Get Next.js config with some basic opinionated defaults
167
- *
168
- * @param {object} options
169
- * @property {boolean} [options.nx=false] Nx monorepo setup
170
- * @property {boolean} [options.svg=false] Svg to react components
171
- * @property {boolean} [options.sc=false] Styled components enabled
172
- * @property {boolean} [options.page=false] When `true` uses `*.page.ts` or `*.page.tsx`
173
- * 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)
174
- * and it enables the same for `next-translate`.
175
- */ export function withKoine({ nx = true, svg = true, sc = true, page, routes, permanent, debug, ...custom } = {
176
- i18n: {
177
- locales: [
178
- "en"
179
- ],
180
- defaultLocale: "en"
181
- }
182
- }) {
183
- const nextConfig = {
184
- // @see https://nextjs.org/docs/api-reference/next.config.js/custom-page-extensions#including-non-page-files-in-the-pages-directory
185
- pageExtensions: page ? [
186
- "page.tsx",
187
- "page.ts"
188
- ] : undefined,
189
- eslint: {
190
- ignoreDuringBuilds: true
191
- },
192
- typescript: {
193
- ignoreBuildErrors: true
194
- },
195
- poweredByHeader: false,
196
- swcMinify: true,
197
- modularizeImports: {
198
- "@koine/api": {
199
- transform: "@koine/api/{{member}}"
200
- },
201
- "@koine/browser": {
202
- transform: "@koine/browser/{{member}}"
203
- },
204
- "@koine/dom": {
205
- transform: "@koine/dom/{{member}}"
206
- },
207
- "@koine/next/?(((\\w*)?/?)*)": {
208
- transform: "@koine/next/{{ matches.[1] }}/{{member}}"
209
- },
210
- "@koine/react/?(((\\w*)?/?)*)": {
211
- transform: "@koine/react/{{ matches.[1] }}/{{member}}"
212
- },
213
- "@koine/utils": {
214
- transform: "@koine/utils/{{member}}"
215
- },
216
- ...custom["modularizeImports"] || {}
217
- },
218
- experimental: {
219
- // @see https://github.com/vercel/vercel/discussions/5973#discussioncomment-472618
220
- // @see critters error https://github.com/vercel/next.js/issues/20742
221
- // optimizeCss: true,
222
- // @see https://github.com/vercel/next.js/discussions/30174#discussion-3643870
223
- scrollRestoration: true,
224
- // concurrentFeatures: true,
225
- // serverComponents: true,
226
- // reactRoot: true,
227
- ...custom["experimental"] || {}
228
- },
229
- // @see https://github.com/vercel/next.js/issues/7322#issuecomment-887330111
230
- // reactStrictMode: true,
231
- ...custom
232
- };
233
- if (svg) {
234
- if (nx) {
235
- // @see https://github.com/gregberge/svgr
236
- nextConfig["nx"] = {
237
- svgr: true
238
- };
239
- } else {
240
- nextConfig.webpack = (_config, options)=>{
241
- const webpackConfig = typeof nextConfig.webpack === "function" ? nextConfig.webpack(_config, options) : _config;
242
- // @see https://dev.to/dolearning/importing-svgs-to-next-js-nna#svgr
243
- webpackConfig.module.rules.push({
244
- test: /\.svg$/,
245
- use: [
246
- {
247
- loader: "@svgr/webpack",
248
- options: {
249
- svgoConfig: {
250
- plugins: [
251
- {
252
- name: "removeViewBox",
253
- active: false
254
- }
255
- ]
256
- }
257
- }
258
- }
259
- ]
260
- });
261
- return webpackConfig;
262
- };
263
- }
264
- }
265
- if (sc) {
266
- nextConfig.compiler = {
267
- styledComponents: true
268
- };
269
- }
270
- if (routes) {
271
- // we pass the default values, so we can assert I guess
272
- const defaultLocale = nextConfig?.i18n?.defaultLocale;
273
- return {
274
- ...nextConfig,
275
- async redirects () {
276
- const defaults = await getRedirects(defaultLocale, routes, permanent, debug);
277
- if (nextConfig.redirects) {
278
- const customs = await nextConfig.redirects();
279
- return [
280
- ...defaults,
281
- ...customs
282
- ];
283
- }
284
- return defaults;
285
- },
286
- async rewrites () {
287
- const defaults = await getRewrites(routes, debug);
288
- if (nextConfig.rewrites) {
289
- const customs = await nextConfig.rewrites();
290
- if (Array.isArray(customs)) {
291
- return {
292
- beforeFiles: defaults,
293
- afterFiles: customs,
294
- fallback: []
295
- };
296
- }
297
- return {
298
- ...customs,
299
- beforeFiles: [
300
- ...defaults,
301
- ...customs.beforeFiles || []
302
- ]
303
- };
304
- }
305
- return {
306
- afterFiles: [],
307
- beforeFiles: defaults,
308
- fallback: []
309
- };
310
- }
311
- };
312
- }
313
- return nextConfig;
314
- }
315
- export default withKoine;
package/getSiteUrl.d.ts DELETED
@@ -1,8 +0,0 @@
1
- /**
2
- * Get site absolute url with the given path
3
- *
4
- * - It uses the `NEXT_PUBLIC_APP_URL` env variable
5
- * - It removes the trailing slashes
6
- */
7
- export declare function getSiteUrl(path?: string): string;
8
- export default getSiteUrl;
package/getSiteUrl.js DELETED
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: all[name]
9
- });
10
- }
11
- _export(exports, {
12
- getSiteUrl: function() {
13
- return getSiteUrl;
14
- },
15
- default: function() {
16
- return _default;
17
- }
18
- });
19
- const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
20
- const _normaliseUrl = /*#__PURE__*/ _interop_require_default._(require("@koine/utils/normaliseUrl"));
21
- function getSiteUrl(path = "") {
22
- return (0, _normaliseUrl.default)(`${process.env["NEXT_PUBLIC_APP_URL"]}/${path}`);
23
- }
24
- const _default = getSiteUrl;
package/getSiteUrl.mjs DELETED
@@ -1,10 +0,0 @@
1
- import normaliseUrl from "@koine/utils/normaliseUrl";
2
- /**
3
- * Get site absolute url with the given path
4
- *
5
- * - It uses the `NEXT_PUBLIC_APP_URL` env variable
6
- * - It removes the trailing slashes
7
- */ export function getSiteUrl(path = "") {
8
- return normaliseUrl(`${process.env["NEXT_PUBLIC_APP_URL"]}/${path}`);
9
- }
10
- export default getSiteUrl;
package/index.js DELETED
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: all[name]
9
- });
10
- }
11
- _export(exports, {
12
- getSiteUrl: function() {
13
- return _getSiteUrl.getSiteUrl;
14
- },
15
- load: function() {
16
- return _load.load;
17
- }
18
- });
19
- const _getSiteUrl = require("./getSiteUrl");
20
- const _load = require("./load");
package/index.mjs DELETED
@@ -1,2 +0,0 @@
1
- export { getSiteUrl } from "./getSiteUrl";
2
- export { load } from "./load";
package/load.d.ts DELETED
@@ -1,10 +0,0 @@
1
- /**
2
- * Utility to load a component with an optional pre-determined delay.
3
- *
4
- * This was designed to improve anti spam with async form loading.
5
- *
6
- * @see https://github.com/vercel/next.js/blob/main/packages/next/next-server/lib/dynamic.tsx
7
- * @see https://github.com/vercel/next.js/blob/canary/examples/with-dynamic-import/pages/index.js
8
- */
9
- export declare function load<T>(component: T, milliseconds: number): Promise<T>;
10
- export default load;
package/load.js DELETED
@@ -1,31 +0,0 @@
1
- /**
2
- * Utility to load a component with an optional pre-determined delay.
3
- *
4
- * This was designed to improve anti spam with async form loading.
5
- *
6
- * @see https://github.com/vercel/next.js/blob/main/packages/next/next-server/lib/dynamic.tsx
7
- * @see https://github.com/vercel/next.js/blob/canary/examples/with-dynamic-import/pages/index.js
8
- */ "use strict";
9
- Object.defineProperty(exports, "__esModule", {
10
- value: true
11
- });
12
- function _export(target, all) {
13
- for(var name in all)Object.defineProperty(target, name, {
14
- enumerable: true,
15
- get: all[name]
16
- });
17
- }
18
- _export(exports, {
19
- load: function() {
20
- return load;
21
- },
22
- default: function() {
23
- return _default;
24
- }
25
- });
26
- function load(component, milliseconds) {
27
- return new Promise((resolve)=>{
28
- setTimeout(()=>resolve(component), milliseconds);
29
- });
30
- }
31
- const _default = load;
package/load.mjs DELETED
@@ -1,13 +0,0 @@
1
- /**
2
- * Utility to load a component with an optional pre-determined delay.
3
- *
4
- * This was designed to improve anti spam with async form loading.
5
- *
6
- * @see https://github.com/vercel/next.js/blob/main/packages/next/next-server/lib/dynamic.tsx
7
- * @see https://github.com/vercel/next.js/blob/canary/examples/with-dynamic-import/pages/index.js
8
- */ export function load(component, milliseconds) {
9
- return new Promise((resolve)=>{
10
- setTimeout(()=>resolve(component), milliseconds);
11
- });
12
- }
13
- export default load;