@uniformdev/canvas-next 19.100.0 → 19.106.1-alpha.3
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/dist/route/index.d.mts +13 -1
- package/dist/route/index.d.ts +13 -1
- package/dist/route/index.js +10 -0
- package/dist/route/index.mjs +9 -0
- package/package.json +7 -7
package/dist/route/index.d.mts
CHANGED
|
@@ -6,6 +6,7 @@ import { ParsedUrlQuery } from 'querystring';
|
|
|
6
6
|
import { RouteGetResponseEdgehancedComposition, RouteGetResponseNotFound, RouteGetResponseRedirect, RouteClient, RouteGetParameters, RootComponentInstance } from '@uniformdev/canvas';
|
|
7
7
|
import { ProjectMapNodeGetResponse, ProjectMapClient } from '@uniformdev/project-map';
|
|
8
8
|
import { RedirectClient } from '@uniformdev/redirect';
|
|
9
|
+
import { GetStaticPropsContext as GetStaticPropsContext$1, GetServerSidePropsContext as GetServerSidePropsContext$1 } from 'next/types';
|
|
9
10
|
import '@uniformdev/canvas-react';
|
|
10
11
|
|
|
11
12
|
type HandleRouteCompositionFunction<TContext, TResult> = (composition: RouteGetResponseEdgehancedComposition, context: TContext, defaultHandler: (composition: RouteGetResponseEdgehancedComposition) => Promise<TResult | null> | TResult | null, duration: number) => Promise<TResult | null> | TResult | null;
|
|
@@ -98,6 +99,17 @@ declare const withUniformGetStaticProps: <TProps extends {
|
|
|
98
99
|
param?: string | undefined;
|
|
99
100
|
}) | undefined) => GetStaticProps<TProps, ParsedUrlQuery, UniformPreviewData>;
|
|
100
101
|
|
|
102
|
+
/**
|
|
103
|
+
* Prepends correct locale to the path before sending it to Uniform Route API.
|
|
104
|
+
*
|
|
105
|
+
* Recommended default callback for `options.modifyPath` in `withUniformGetStaticProps` and `withUniformGetServerSideProps`.
|
|
106
|
+
* Should be used together with Next.js Internationalization Routing.
|
|
107
|
+
*
|
|
108
|
+
* @see https://nextjs.org/docs/pages/building-your-application/routing/internationalization
|
|
109
|
+
* @see https://docs.uniform.app/docs/guides/composition/localization#enable-localization-on-your-frontend-application
|
|
110
|
+
*/
|
|
111
|
+
declare const prependLocale: (path: string, { locale, defaultLocale, locales }: GetStaticPropsContext$1 | GetServerSidePropsContext$1) => string;
|
|
112
|
+
|
|
101
113
|
/**
|
|
102
114
|
* Default implementation of getServerSideProps with routes
|
|
103
115
|
* To configure custom behavior, use:
|
|
@@ -406,4 +418,4 @@ declare const getStaticPaths: () => Promise<{
|
|
|
406
418
|
fallback: boolean;
|
|
407
419
|
}>;
|
|
408
420
|
|
|
409
|
-
export { type HandleRouteCompositionFunction, type HandleRouteNotFoundFunction, type HandleRouteRedirectFunction, type RouteHandlerOptions, getServerSideProps, getStaticPaths, getStaticProps, withUniformGetServerSideProps, withUniformGetStaticPaths, withUniformGetStaticProps };
|
|
421
|
+
export { type HandleRouteCompositionFunction, type HandleRouteNotFoundFunction, type HandleRouteRedirectFunction, type RouteHandlerOptions, getServerSideProps, getStaticPaths, getStaticProps, prependLocale, withUniformGetServerSideProps, withUniformGetStaticPaths, withUniformGetStaticProps };
|
package/dist/route/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { ParsedUrlQuery } from 'querystring';
|
|
|
6
6
|
import { RouteGetResponseEdgehancedComposition, RouteGetResponseNotFound, RouteGetResponseRedirect, RouteClient, RouteGetParameters, RootComponentInstance } from '@uniformdev/canvas';
|
|
7
7
|
import { ProjectMapNodeGetResponse, ProjectMapClient } from '@uniformdev/project-map';
|
|
8
8
|
import { RedirectClient } from '@uniformdev/redirect';
|
|
9
|
+
import { GetStaticPropsContext as GetStaticPropsContext$1, GetServerSidePropsContext as GetServerSidePropsContext$1 } from 'next/types';
|
|
9
10
|
import '@uniformdev/canvas-react';
|
|
10
11
|
|
|
11
12
|
type HandleRouteCompositionFunction<TContext, TResult> = (composition: RouteGetResponseEdgehancedComposition, context: TContext, defaultHandler: (composition: RouteGetResponseEdgehancedComposition) => Promise<TResult | null> | TResult | null, duration: number) => Promise<TResult | null> | TResult | null;
|
|
@@ -98,6 +99,17 @@ declare const withUniformGetStaticProps: <TProps extends {
|
|
|
98
99
|
param?: string | undefined;
|
|
99
100
|
}) | undefined) => GetStaticProps<TProps, ParsedUrlQuery, UniformPreviewData>;
|
|
100
101
|
|
|
102
|
+
/**
|
|
103
|
+
* Prepends correct locale to the path before sending it to Uniform Route API.
|
|
104
|
+
*
|
|
105
|
+
* Recommended default callback for `options.modifyPath` in `withUniformGetStaticProps` and `withUniformGetServerSideProps`.
|
|
106
|
+
* Should be used together with Next.js Internationalization Routing.
|
|
107
|
+
*
|
|
108
|
+
* @see https://nextjs.org/docs/pages/building-your-application/routing/internationalization
|
|
109
|
+
* @see https://docs.uniform.app/docs/guides/composition/localization#enable-localization-on-your-frontend-application
|
|
110
|
+
*/
|
|
111
|
+
declare const prependLocale: (path: string, { locale, defaultLocale, locales }: GetStaticPropsContext$1 | GetServerSidePropsContext$1) => string;
|
|
112
|
+
|
|
101
113
|
/**
|
|
102
114
|
* Default implementation of getServerSideProps with routes
|
|
103
115
|
* To configure custom behavior, use:
|
|
@@ -406,4 +418,4 @@ declare const getStaticPaths: () => Promise<{
|
|
|
406
418
|
fallback: boolean;
|
|
407
419
|
}>;
|
|
408
420
|
|
|
409
|
-
export { type HandleRouteCompositionFunction, type HandleRouteNotFoundFunction, type HandleRouteRedirectFunction, type RouteHandlerOptions, getServerSideProps, getStaticPaths, getStaticProps, withUniformGetServerSideProps, withUniformGetStaticPaths, withUniformGetStaticProps };
|
|
421
|
+
export { type HandleRouteCompositionFunction, type HandleRouteNotFoundFunction, type HandleRouteRedirectFunction, type RouteHandlerOptions, getServerSideProps, getStaticPaths, getStaticProps, prependLocale, withUniformGetServerSideProps, withUniformGetStaticPaths, withUniformGetStaticProps };
|
package/dist/route/index.js
CHANGED
|
@@ -23,6 +23,7 @@ __export(route_exports, {
|
|
|
23
23
|
getServerSideProps: () => getServerSideProps,
|
|
24
24
|
getStaticPaths: () => getStaticPaths,
|
|
25
25
|
getStaticProps: () => getStaticProps,
|
|
26
|
+
prependLocale: () => prependLocale,
|
|
26
27
|
withUniformGetServerSideProps: () => withUniformGetServerSideProps,
|
|
27
28
|
withUniformGetStaticPaths: () => withUniformGetStaticPaths,
|
|
28
29
|
withUniformGetStaticProps: () => withUniformGetStaticProps
|
|
@@ -474,6 +475,14 @@ var withUniformGetStaticProps = (options) => {
|
|
|
474
475
|
return routeFetcher;
|
|
475
476
|
};
|
|
476
477
|
|
|
478
|
+
// src/route/localePathModifier.ts
|
|
479
|
+
var prependLocale = (path, { locale, defaultLocale, locales }) => {
|
|
480
|
+
if (!(locales == null ? void 0 : locales.length))
|
|
481
|
+
return path;
|
|
482
|
+
const slug = path === "/" ? "" : path;
|
|
483
|
+
return decodeURI(`/${locale || defaultLocale}${slug}`);
|
|
484
|
+
};
|
|
485
|
+
|
|
477
486
|
// src/route/index.ts
|
|
478
487
|
var getServerSideProps = withUniformGetServerSideProps();
|
|
479
488
|
var getStaticProps = withUniformGetStaticProps();
|
|
@@ -483,6 +492,7 @@ var getStaticPaths = withUniformGetStaticPaths();
|
|
|
483
492
|
getServerSideProps,
|
|
484
493
|
getStaticPaths,
|
|
485
494
|
getStaticProps,
|
|
495
|
+
prependLocale,
|
|
486
496
|
withUniformGetServerSideProps,
|
|
487
497
|
withUniformGetStaticPaths,
|
|
488
498
|
withUniformGetStaticProps
|
package/dist/route/index.mjs
CHANGED
|
@@ -342,6 +342,14 @@ var withUniformGetStaticProps = (options) => {
|
|
|
342
342
|
return routeFetcher;
|
|
343
343
|
};
|
|
344
344
|
|
|
345
|
+
// src/route/localePathModifier.ts
|
|
346
|
+
var prependLocale = (path, { locale, defaultLocale, locales }) => {
|
|
347
|
+
if (!(locales == null ? void 0 : locales.length))
|
|
348
|
+
return path;
|
|
349
|
+
const slug = path === "/" ? "" : path;
|
|
350
|
+
return decodeURI(`/${locale || defaultLocale}${slug}`);
|
|
351
|
+
};
|
|
352
|
+
|
|
345
353
|
// src/route/index.ts
|
|
346
354
|
var getServerSideProps = withUniformGetServerSideProps();
|
|
347
355
|
var getStaticProps = withUniformGetStaticProps();
|
|
@@ -350,6 +358,7 @@ export {
|
|
|
350
358
|
getServerSideProps,
|
|
351
359
|
getStaticPaths,
|
|
352
360
|
getStaticProps,
|
|
361
|
+
prependLocale,
|
|
353
362
|
withUniformGetServerSideProps,
|
|
354
363
|
withUniformGetStaticPaths,
|
|
355
364
|
withUniformGetStaticProps
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/canvas-next",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.106.1-alpha.3+47677ea6f",
|
|
4
4
|
"description": "Next.js SDK for Uniform Canvas",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -67,11 +67,11 @@
|
|
|
67
67
|
"document": "api-extractor run --local"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@uniformdev/canvas": "19.
|
|
71
|
-
"@uniformdev/canvas-react": "19.
|
|
72
|
-
"@uniformdev/project-map": "19.
|
|
73
|
-
"@uniformdev/redirect": "19.
|
|
74
|
-
"@uniformdev/richtext": "19.
|
|
70
|
+
"@uniformdev/canvas": "19.106.1-alpha.3+47677ea6f",
|
|
71
|
+
"@uniformdev/canvas-react": "19.106.1-alpha.3+47677ea6f",
|
|
72
|
+
"@uniformdev/project-map": "19.106.1-alpha.3+47677ea6f",
|
|
73
|
+
"@uniformdev/redirect": "19.106.1-alpha.3+47677ea6f",
|
|
74
|
+
"@uniformdev/richtext": "19.106.1-alpha.3+47677ea6f",
|
|
75
75
|
"colorette": "2.0.20"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"publishConfig": {
|
|
92
92
|
"access": "public"
|
|
93
93
|
},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "47677ea6fd6eb707bb30eb20dc67e42573e0516d"
|
|
95
95
|
}
|