@common-stack/frontend-stack-react 6.0.1-alpha.3 → 6.0.1-alpha.5
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/lib/entries/antui/components/ErrorBoundary.d.ts +2 -0
- package/lib/entries/antui/components/ErrorBoundary.js +12 -0
- package/lib/entries/antui/components/ServerError.d.ts +4 -0
- package/lib/entries/antui/components/ServerError.js +9 -0
- package/lib/entries/antui/components/index.d.ts +2 -0
- package/lib/entries/antui/components/index.js +1 -0
- package/lib/entries/antui/entry.client.d.ts +1 -0
- package/lib/entries/antui/entry.client.js +51 -0
- package/lib/entries/antui/entry.server.d.ts +3 -0
- package/lib/entries/antui/entry.server.js +152 -0
- package/lib/entries/antui/root.d.ts +18 -0
- package/lib/entries/antui/root.js +56 -0
- package/lib/entries/chakraui/components/Error500.d.ts +8 -0
- package/lib/entries/chakraui/components/Error500.js +14 -0
- package/lib/entries/chakraui/components/ErrorBoundary.d.ts +2 -0
- package/lib/entries/chakraui/components/ErrorBoundary.js +15 -0
- package/lib/entries/chakraui/components/ServerError.d.ts +4 -0
- package/lib/entries/chakraui/components/ServerError.js +9 -0
- package/lib/entries/chakraui/components/index.d.ts +3 -0
- package/lib/entries/chakraui/components/index.js +1 -0
- package/lib/entries/chakraui/context.d.ts +11 -0
- package/lib/entries/chakraui/context.js +3 -0
- package/lib/entries/chakraui/entry.client.d.ts +1 -0
- package/lib/entries/chakraui/entry.client.js +50 -0
- package/lib/entries/chakraui/entry.server.d.ts +2 -0
- package/lib/entries/chakraui/entry.server.js +151 -0
- package/lib/entries/chakraui/root.d.ts +18 -0
- package/lib/entries/chakraui/root.js +47 -0
- package/lib/entries/common/AntStyles.d.ts +5 -0
- package/lib/entries/common/AntStyles.js +3 -0
- package/lib/entries/common/createEmotionCache.d.ts +2 -0
- package/lib/entries/common/createEmotionCache.js +4 -0
- package/lib/entries/common/index.d.ts +3 -0
- package/lib/entries/common/index.js +1 -0
- package/lib/entries/common/utils.d.ts +1 -0
- package/lib/entries/common/utils.js +12 -0
- package/lib/entries/index.d.ts +7 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import*as React from'react';import {Error500}from'@admin-layout/ant-ui';import {useRouteError,isRouteErrorResponse}from'@remix-run/react';function ErrorBoundary() {
|
|
2
|
+
const error = useRouteError();
|
|
3
|
+
if (isRouteErrorResponse(error)) {
|
|
4
|
+
return React.createElement(Error500, { title: `Route Error: ${error.statusText}`, status: error.status, data: error.data });
|
|
5
|
+
}
|
|
6
|
+
else if (error instanceof Error) {
|
|
7
|
+
return React.createElement(Error500, { title: error.message, status: "500", data: error.stack });
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
return React.createElement(Error500, { title: "Unknown Error", status: "500", data: error });
|
|
11
|
+
}
|
|
12
|
+
}export{ErrorBoundary};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{ErrorBoundary}from'./ErrorBoundary.js';export{ServerError}from'./ServerError.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import*as React from'react';import {startTransition,StrictMode}from'react';import'reflect-metadata';import {RemixBrowser}from'@remix-run/react';import {hydrateRoot}from'react-dom/client';import {createCache,StyleProvider}from'@ant-design/cssinjs';import {ApolloProvider}from'@apollo/client/index.js';import {removeUniversalPortals,SlotFillProvider}from'@common-stack/components-pro';import {InversifyProvider}from'@common-stack/client-react';import {Provider}from'react-redux';import {PersistGate}from'redux-persist/integration/react';import {persistStore}from'redux-persist';import {CacheProvider}from'@emotion/react';import i18next from'i18next';import {initReactI18next,I18nextProvider}from'react-i18next';import LanguageDetector from'i18next-browser-languagedetector';import Backend from'i18next-http-backend';import {getInitialNamespaces}from'remix-i18next/client';import {createReduxStore}from'@app/frontend-stack-react/config/redux-config.js';import {createClientContainer}from'@app/frontend-stack-react/config/client.service';import clientModules from'@app/frontend-stack-react/modules.js';import createEmotionCache from'@app/frontend-stack-react/entries/common/createEmotionCache.js';import config from'@app/cde-webconfig.json';/**
|
|
2
|
+
* By default, Remix will handle hydrating your app on the client for you.
|
|
3
|
+
* You are free to delete this file if you'd like to, but if you ever want it revealed again, you can run `npx remix reveal` ✨
|
|
4
|
+
* For more information, see https://remix.run/file-conventions/entry.client
|
|
5
|
+
*/
|
|
6
|
+
const { apolloClient: client, container, serviceFunc } = createClientContainer();
|
|
7
|
+
const { store } = createReduxStore(client, serviceFunc(), container);
|
|
8
|
+
const persistor = persistStore(store);
|
|
9
|
+
const antCache = createCache();
|
|
10
|
+
const cache = createEmotionCache();
|
|
11
|
+
window.__remixStore = store;
|
|
12
|
+
removeUniversalPortals(window.__SLOT_FILLS__ || []);
|
|
13
|
+
async function hydrate() {
|
|
14
|
+
if (!i18next.isInitialized && config.i18n.enabled) {
|
|
15
|
+
await i18next
|
|
16
|
+
.use(initReactI18next)
|
|
17
|
+
.use(LanguageDetector)
|
|
18
|
+
.use(Backend)
|
|
19
|
+
.init({
|
|
20
|
+
fallbackLng: config.i18n.fallbackLng,
|
|
21
|
+
defaultNS: config.i18n.defaultNS,
|
|
22
|
+
react: config.i18n.react,
|
|
23
|
+
supportedLngs: config.i18n.supportedLngs,
|
|
24
|
+
backend: config.i18n.backend,
|
|
25
|
+
ns: getInitialNamespaces(),
|
|
26
|
+
detection: {
|
|
27
|
+
order: ['htmlTag'],
|
|
28
|
+
caches: [],
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
startTransition(() => {
|
|
33
|
+
hydrateRoot(document, (React.createElement(I18nextProvider, { i18n: i18next },
|
|
34
|
+
React.createElement(StrictMode, null,
|
|
35
|
+
React.createElement(CacheProvider, { value: cache },
|
|
36
|
+
React.createElement(StyleProvider, { cache: antCache },
|
|
37
|
+
React.createElement(Provider, { store: store },
|
|
38
|
+
React.createElement(SlotFillProvider, null,
|
|
39
|
+
React.createElement(InversifyProvider, { container: container, modules: clientModules },
|
|
40
|
+
React.createElement(PersistGate, { loading: null, persistor: persistor }, () => (React.createElement(ApolloProvider, { client: client },
|
|
41
|
+
React.createElement(RemixBrowser, null)))))))))))));
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
if (window.requestIdleCallback) {
|
|
45
|
+
window.requestIdleCallback(hydrate);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
// Safari doesn't support requestIdleCallback
|
|
49
|
+
// https://caniuse.com/requestidlecallback
|
|
50
|
+
window.setTimeout(hydrate, 1);
|
|
51
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { EntryContext } from '@remix-run/node';
|
|
2
|
+
import type { IAppLoadContext } from '@common-stack/client-core';
|
|
3
|
+
export default function handleRequest(request: Request, responseStatusCode: number, responseHeaders: Headers, remixContext: EntryContext, loadContext: IAppLoadContext): Promise<unknown>;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import*as React from'react';import {PassThrough,Transform}from'node:stream';import {createReadableStreamFromReadable}from'@remix-run/node';import {RemixServer}from'@remix-run/react';import {isbot}from'isbot';import {ApolloProvider}from'@apollo/client/index.js';import {SlotFillProvider}from'@common-stack/components-pro';import {InversifyProvider}from'@common-stack/client-react';import {renderToPipeableStream}from'react-dom/server';import {Provider}from'react-redux';import {LOCATION_CHANGE}from'@common-stack/remix-router-redux';import serialize from'serialize-javascript';import {createCache,StyleProvider,extractStyle}from'@ant-design/cssinjs';import {CacheProvider}from'@emotion/react';import {renderStylesToNodeStream}from'@emotion/server';import {createInstance}from'i18next';import {initReactI18next,I18nextProvider}from'react-i18next';import Backend from'i18next-fs-backend';import {resolve}from'node:path';import {i18nextInstance}from'@app/frontend-stack-react/i18n-localization/i18next.server.js';import config from'@app/cde-webconfig.json';import createEmotionCache from'@app/frontend-stack-react/entries/common/createEmotionCache';/**
|
|
2
|
+
* By default, Remix will handle generating the HTTP Response for you.
|
|
3
|
+
* You are free to delete this file if you'd like to, but if you ever want it revealed again, you can run `npx remix reveal` ✨
|
|
4
|
+
* For more information, see https://remix.run/file-conventions/entry.server
|
|
5
|
+
*/
|
|
6
|
+
global.__CLIENT__ = false;
|
|
7
|
+
global.__SERVER__ = true;
|
|
8
|
+
const ABORT_DELAY = 5_000;
|
|
9
|
+
const antdCache = createCache();
|
|
10
|
+
const cache = createEmotionCache();
|
|
11
|
+
class ConstantsTransform extends Transform {
|
|
12
|
+
_fills;
|
|
13
|
+
_apolloState;
|
|
14
|
+
_reduxState;
|
|
15
|
+
_styleSheet;
|
|
16
|
+
constructor(fills, apolloState, reduxState, styleSheet) {
|
|
17
|
+
super();
|
|
18
|
+
this._fills = fills;
|
|
19
|
+
this._apolloState = apolloState;
|
|
20
|
+
this._reduxState = reduxState;
|
|
21
|
+
this._styleSheet = styleSheet;
|
|
22
|
+
}
|
|
23
|
+
_transform(chunk, encoding, callback) {
|
|
24
|
+
let transformedChunk = chunk.toString();
|
|
25
|
+
if (transformedChunk.includes('[__APOLLO_STATE__]')) {
|
|
26
|
+
transformedChunk = transformedChunk.replace('[__APOLLO_STATE__]', serialize(this._apolloState, { isJSON: true }));
|
|
27
|
+
}
|
|
28
|
+
if (transformedChunk.includes('[__PRELOADED_STATE__]')) {
|
|
29
|
+
transformedChunk = transformedChunk.replace('[__PRELOADED_STATE__]', serialize(this._reduxState, { isJSON: true }));
|
|
30
|
+
}
|
|
31
|
+
if (transformedChunk.includes('[__SLOT_FILLS__]')) {
|
|
32
|
+
transformedChunk = transformedChunk.replace('[__SLOT_FILLS__]', serialize(this._fills, { isJSON: true }));
|
|
33
|
+
}
|
|
34
|
+
if (transformedChunk.includes('[__STYLESHEET__]')) {
|
|
35
|
+
transformedChunk = transformedChunk.replace('[__STYLESHEET__]', this._styleSheet);
|
|
36
|
+
}
|
|
37
|
+
callback(null, transformedChunk);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
async function handleRequest(request, responseStatusCode, responseHeaders, remixContext,
|
|
41
|
+
// This is ignored so we can keep it in the template for visibility. Feel
|
|
42
|
+
// free to delete this parameter in your app if you're not using it!
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
44
|
+
loadContext) {
|
|
45
|
+
const instance = createInstance();
|
|
46
|
+
const lng = await i18nextInstance.getLocale(request);
|
|
47
|
+
const ns = i18nextInstance.getRouteNamespaces(remixContext);
|
|
48
|
+
// First, we create a new instance of i18next so every request will have a
|
|
49
|
+
// completely unique instance and not share any state.
|
|
50
|
+
if (config.i18n.enabled) {
|
|
51
|
+
await instance
|
|
52
|
+
.use(initReactI18next) // Tell our instance to use react-i18next
|
|
53
|
+
.use(Backend) // Setup our backend.init({
|
|
54
|
+
.init({
|
|
55
|
+
fallbackLng: config.i18n.fallbackLng,
|
|
56
|
+
defaultNS: config.i18n.defaultNS,
|
|
57
|
+
react: config.i18n.react,
|
|
58
|
+
supportedLngs: config.i18n.supportedLngs,
|
|
59
|
+
lng, // The locale we detected above
|
|
60
|
+
ns, // The namespaces the routes about to render want to use
|
|
61
|
+
backend: {
|
|
62
|
+
loadPath: resolve(config.i18n.backend.loadServerPath),
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
return isbot(request.headers.get('user-agent') || '')
|
|
67
|
+
? handleBotRequest(request, responseStatusCode, responseHeaders, remixContext, loadContext, instance)
|
|
68
|
+
: handleBrowserRequest(request, responseStatusCode, responseHeaders, remixContext, loadContext, instance);
|
|
69
|
+
}
|
|
70
|
+
function handleBotRequest(request, responseStatusCode, responseHeaders, remixContext, loadContext, i18nInstance) {
|
|
71
|
+
return new Promise((resolve, reject) => {
|
|
72
|
+
let shellRendered = false;
|
|
73
|
+
const { pipe, abort } = renderToPipeableStream(React.createElement(I18nextProvider, { i18n: i18nInstance },
|
|
74
|
+
React.createElement(RemixServer, { context: remixContext, url: request.url, abortDelay: ABORT_DELAY })), {
|
|
75
|
+
onAllReady() {
|
|
76
|
+
shellRendered = true;
|
|
77
|
+
const body = new PassThrough();
|
|
78
|
+
const stream = createReadableStreamFromReadable(body);
|
|
79
|
+
responseHeaders.set('Content-Type', 'text/html');
|
|
80
|
+
resolve(new Response(stream, {
|
|
81
|
+
headers: responseHeaders,
|
|
82
|
+
status: responseStatusCode,
|
|
83
|
+
}));
|
|
84
|
+
pipe(body);
|
|
85
|
+
},
|
|
86
|
+
onShellError(error) {
|
|
87
|
+
reject(error);
|
|
88
|
+
},
|
|
89
|
+
onError(error) {
|
|
90
|
+
responseStatusCode = 500;
|
|
91
|
+
// Log streaming rendering errors from inside the shell. Don't log
|
|
92
|
+
// errors encountered during initial shell rendering since they'll
|
|
93
|
+
// reject and get logged in handleDocumentRequest.
|
|
94
|
+
if (shellRendered) {
|
|
95
|
+
console.error(error);
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
setTimeout(abort, ABORT_DELAY);
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
function handleBrowserRequest(request, responseStatusCode, responseHeaders, remixContext, loadContext, i18nInstance) {
|
|
103
|
+
return new Promise((resolve, reject) => {
|
|
104
|
+
let shellRendered = false;
|
|
105
|
+
const slotFillContext = { fills: {} };
|
|
106
|
+
const { modules: clientModules, container, apolloClient: client, store, } = loadContext;
|
|
107
|
+
const { pathname, search, hash } = new URL(request.url);
|
|
108
|
+
store.dispatch({
|
|
109
|
+
type: LOCATION_CHANGE,
|
|
110
|
+
payload: { location: { pathname, search, hash }, action: 'POP' },
|
|
111
|
+
});
|
|
112
|
+
const { pipe, abort } = renderToPipeableStream((React.createElement(I18nextProvider, { i18n: i18nInstance },
|
|
113
|
+
React.createElement(CacheProvider, { value: cache },
|
|
114
|
+
React.createElement(StyleProvider, { cache: antdCache },
|
|
115
|
+
React.createElement(Provider, { store: store },
|
|
116
|
+
React.createElement(SlotFillProvider, { context: slotFillContext },
|
|
117
|
+
React.createElement(InversifyProvider, { container: container, modules: clientModules },
|
|
118
|
+
React.createElement(ApolloProvider, { client: client },
|
|
119
|
+
React.createElement(RemixServer, { context: remixContext, url: request.url, abortDelay: ABORT_DELAY }))))))))), {
|
|
120
|
+
onShellReady() {
|
|
121
|
+
shellRendered = true;
|
|
122
|
+
const body = new PassThrough();
|
|
123
|
+
const stream = createReadableStreamFromReadable(body);
|
|
124
|
+
const apolloState = { ...client.extract() };
|
|
125
|
+
const reduxState = { ...store.getState() };
|
|
126
|
+
const fills = Object.keys(slotFillContext.fills);
|
|
127
|
+
const styleSheet = extractStyle(antdCache);
|
|
128
|
+
const transform = new ConstantsTransform(fills, apolloState, reduxState, styleSheet);
|
|
129
|
+
responseHeaders.set('Content-Type', 'text/html');
|
|
130
|
+
resolve(new Response(stream, {
|
|
131
|
+
headers: responseHeaders,
|
|
132
|
+
status: responseStatusCode,
|
|
133
|
+
}));
|
|
134
|
+
pipe(transform).pipe(renderStylesToNodeStream()).pipe(body);
|
|
135
|
+
},
|
|
136
|
+
onShellError(error) {
|
|
137
|
+
reject(error);
|
|
138
|
+
},
|
|
139
|
+
onError(error) {
|
|
140
|
+
responseStatusCode = 500;
|
|
141
|
+
// Log streaming rendering errors from inside the shell. Don't log
|
|
142
|
+
// errors encountered during initial shell rendering since they'll
|
|
143
|
+
// reject and get logged in handleDocumentRequest.
|
|
144
|
+
if (shellRendered) {
|
|
145
|
+
console.error(error);
|
|
146
|
+
}
|
|
147
|
+
reject(error);
|
|
148
|
+
},
|
|
149
|
+
});
|
|
150
|
+
setTimeout(abort, ABORT_DELAY);
|
|
151
|
+
});
|
|
152
|
+
}export{handleRequest as default};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { ErrorBoundary } from '@app/frontend-stack-react/entries/antui/components/ErrorBoundary';
|
|
4
|
+
export declare const loader: ({ request }: {
|
|
5
|
+
request: any;
|
|
6
|
+
}) => Promise<import("@remix-run/server-runtime").TypedResponse<{
|
|
7
|
+
__ENV__: any;
|
|
8
|
+
locale: any;
|
|
9
|
+
}>>;
|
|
10
|
+
export declare const handle: {
|
|
11
|
+
i18n: string;
|
|
12
|
+
};
|
|
13
|
+
export declare function shouldRevalidate(params: any): boolean;
|
|
14
|
+
export declare function Layout({ children }: {
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
}): React.JSX.Element;
|
|
17
|
+
export default function App(): React.JSX.Element;
|
|
18
|
+
export { ErrorBoundary };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import'reflect-metadata';import*as React from'react';import {Outlet,json,useLoaderData,Meta,Links,ScrollRestoration,Scripts}from'@remix-run/react';import publicEnv from'@src/config/public-config';import {PluginArea}from'@common-stack/client-react';import {subscribeReduxRouter}from'@common-stack/remix-router-redux';import {ApplicationErrorHandler}from'@admin-layout/ant-ui';import {ConfigProvider}from'antd';import clientModules,{plugins}from'@app/frontend-stack-react/modules.js';import {useChangeLanguage}from'remix-i18next/react';import {useTranslation}from'react-i18next';import {i18nextInstance}from'@app/frontend-stack-react/i18n-localization/i18next.server.js';export{ErrorBoundary}from'@app/frontend-stack-react/entries/antui/components/ErrorBoundary';const loader = async ({ request }) => {
|
|
2
|
+
const locale = await i18nextInstance.getLocale(request);
|
|
3
|
+
return json({
|
|
4
|
+
__ENV__: publicEnv,
|
|
5
|
+
locale,
|
|
6
|
+
});
|
|
7
|
+
};
|
|
8
|
+
const handle = {
|
|
9
|
+
i18n: 'common',
|
|
10
|
+
};
|
|
11
|
+
function shouldRevalidate(params) {
|
|
12
|
+
return params.defaultShouldRevalidate && params.currentUrl.pathname !== params.nextUrl.pathname;
|
|
13
|
+
}
|
|
14
|
+
function Layout({ children }) {
|
|
15
|
+
const data = useLoaderData();
|
|
16
|
+
const locale = data?.locale;
|
|
17
|
+
const { i18n } = useTranslation();
|
|
18
|
+
useChangeLanguage(locale);
|
|
19
|
+
React.useEffect(() => {
|
|
20
|
+
subscribeReduxRouter({ store: window.__remixStore, router: window.__remixRouter });
|
|
21
|
+
}, []);
|
|
22
|
+
const getConstants = () => {
|
|
23
|
+
if (typeof window === 'undefined') {
|
|
24
|
+
return (React.createElement(React.Fragment, null,
|
|
25
|
+
React.createElement("script", { dangerouslySetInnerHTML: {
|
|
26
|
+
__html: `window.__ENV__ = ${JSON.stringify(data?.__ENV__)}`,
|
|
27
|
+
} }),
|
|
28
|
+
React.createElement("script", { src: "https://cdnjs.cloudflare.com/ajax/libs/reflect-metadata/0.1.13/Reflect.min.js", integrity: "sha512-jvbPH2TH5BSZumEfOJZn9IV+5bSwwN+qG4dvthYe3KCGC3/9HmxZ4phADbt9Pfcp+XSyyfc2vGZ/RMsSUZ9tbQ==", crossOrigin: "anonymous", referrerPolicy: "no-referrer" }),
|
|
29
|
+
React.createElement("script", null, "window.__APOLLO_STATE__=[__APOLLO_STATE__]"),
|
|
30
|
+
React.createElement("script", null, "window.__PRELOADED_STATE__=[__PRELOADED_STATE__]"),
|
|
31
|
+
React.createElement("script", null, "window.__SLOT_FILLS__=[__SLOT_FILLS__]"),
|
|
32
|
+
React.createElement("script", { dangerouslySetInnerHTML: {
|
|
33
|
+
__html: `if (global === undefined) { var global = window; }`,
|
|
34
|
+
} })));
|
|
35
|
+
}
|
|
36
|
+
return null;
|
|
37
|
+
};
|
|
38
|
+
return (React.createElement("html", { lang: locale, dir: i18n.dir() },
|
|
39
|
+
React.createElement("head", null,
|
|
40
|
+
React.createElement("meta", { charSet: "utf-8" }),
|
|
41
|
+
React.createElement("meta", { name: "viewport", content: "width=device-width, initial-scale=1" }),
|
|
42
|
+
React.createElement(Meta, null),
|
|
43
|
+
React.createElement(Links, null),
|
|
44
|
+
typeof window === 'undefined' ? `[__STYLESHEET__]` : ''),
|
|
45
|
+
React.createElement("body", null,
|
|
46
|
+
React.createElement(PluginArea, null),
|
|
47
|
+
clientModules.getWrappedRoot(children),
|
|
48
|
+
React.createElement(ScrollRestoration, null),
|
|
49
|
+
React.createElement(Scripts, null),
|
|
50
|
+
getConstants())));
|
|
51
|
+
}
|
|
52
|
+
function App() {
|
|
53
|
+
return (React.createElement(ApplicationErrorHandler, { plugins: plugins },
|
|
54
|
+
React.createElement(ConfigProvider, null,
|
|
55
|
+
React.createElement(Outlet, null))));
|
|
56
|
+
}export{Layout,App as default,handle,loader,shouldRevalidate};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import*as React from'react';import {Box,VStack,Heading,Text,Code,Button}from'@chakra-ui/react';const Error500 = ({ title, status, data }) => {
|
|
2
|
+
const handleReload = () => {
|
|
3
|
+
window.location.reload();
|
|
4
|
+
};
|
|
5
|
+
return (React.createElement(Box, { display: "flex", alignItems: "center", justifyContent: "center", height: "100vh" },
|
|
6
|
+
React.createElement(VStack, { spacing: 4, textAlign: "center" },
|
|
7
|
+
React.createElement(Heading, { as: "h1", size: "xl" },
|
|
8
|
+
"Error ",
|
|
9
|
+
status),
|
|
10
|
+
React.createElement(Text, null, title),
|
|
11
|
+
data && (React.createElement(Box, { maxW: "md", mx: "auto", overflow: "auto" },
|
|
12
|
+
React.createElement(Code, { p: 4, display: "block", whiteSpace: "pre", textAlign: "left" }, typeof data === 'string' ? data : JSON.stringify(data, null, 2)))),
|
|
13
|
+
React.createElement(Button, { colorScheme: "teal", onClick: handleReload }, "Reload"))));
|
|
14
|
+
};export{Error500 as default};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import*as React from'react';import {useRouteError,isRouteErrorResponse}from'@remix-run/react';import Error500 from'./Error500.js';function ErrorBoundary() {
|
|
2
|
+
const error = useRouteError();
|
|
3
|
+
React.useEffect(() => {
|
|
4
|
+
console.trace(error);
|
|
5
|
+
}, [error]);
|
|
6
|
+
if (isRouteErrorResponse(error)) {
|
|
7
|
+
return React.createElement(Error500, { title: error.statusText, status: error.status, data: error.data });
|
|
8
|
+
}
|
|
9
|
+
else if (error instanceof Error) {
|
|
10
|
+
return React.createElement(Error500, { title: error.message, status: "500", data: error.stack });
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
return React.createElement(Error500, { title: "Unknown Error", status: "500", data: error });
|
|
14
|
+
}
|
|
15
|
+
}export{ErrorBoundary};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import'react';import'@chakra-ui/react';export{ErrorBoundary}from'./ErrorBoundary.js';export{ServerError}from'./ServerError.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface ServerStyleContextData {
|
|
3
|
+
key: string;
|
|
4
|
+
ids: Array<string>;
|
|
5
|
+
css: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const ServerStyleContext: React.Context<ServerStyleContextData[]>;
|
|
8
|
+
export interface ClientStyleContextData {
|
|
9
|
+
reset: () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const ClientStyleContext: React.Context<ClientStyleContextData>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React__default,{StrictMode,useState}from'react';import'reflect-metadata';import {RemixBrowser}from'@remix-run/react';import {hydrateRoot}from'react-dom/client';import {ApolloProvider}from'@apollo/client/index.js';import {removeUniversalPortals,SlotFillProvider}from'@common-stack/components-pro';import {InversifyProvider}from'@common-stack/client-react';import {Provider}from'react-redux';import {PersistGate}from'redux-persist/integration/react';import {persistStore}from'redux-persist';import {CacheProvider}from'@emotion/react';import createEmotionCache,{defaultCache}from'@app/frontend-stack-react/entries/common/createEmotionCache';import {createReduxStore}from'@app/frontend-stack-react/config/redux-config.js';import {createClientContainer}from'@app/frontend-stack-react/config/client.service';import clientModules from'@app/frontend-stack-react/modules.js';import i18next from'i18next';import {initReactI18next,I18nextProvider}from'react-i18next';import LanguageDetector from'i18next-browser-languagedetector';import Backend from'i18next-http-backend';import {getInitialNamespaces}from'remix-i18next/client';import config from'@app/cde-webconfig.json';import {ClientStyleContext}from'@app/frontend-stack-react/entries/chakraui/context.js';const { apolloClient: client, container, serviceFunc } = createClientContainer();
|
|
2
|
+
const { store } = createReduxStore(client, serviceFunc(), container);
|
|
3
|
+
const persistor = persistStore(store);
|
|
4
|
+
window.__remixStore = store;
|
|
5
|
+
removeUniversalPortals(window.__SLOT_FILLS__ || []);
|
|
6
|
+
function ClientCacheProvider({ children }) {
|
|
7
|
+
const [cache, setCache] = useState(defaultCache);
|
|
8
|
+
function reset() {
|
|
9
|
+
setCache(createEmotionCache());
|
|
10
|
+
}
|
|
11
|
+
return (React__default.createElement(ClientStyleContext.Provider, { value: { reset } },
|
|
12
|
+
React__default.createElement(CacheProvider, { value: cache }, children)));
|
|
13
|
+
}
|
|
14
|
+
async function hydrate() {
|
|
15
|
+
if (!i18next.isInitialized && config.i18n.enabled) {
|
|
16
|
+
await i18next
|
|
17
|
+
.use(initReactI18next)
|
|
18
|
+
.use(LanguageDetector)
|
|
19
|
+
.use(Backend)
|
|
20
|
+
.init({
|
|
21
|
+
fallbackLng: config.i18n.fallbackLng,
|
|
22
|
+
defaultNS: config.i18n.defaultNS,
|
|
23
|
+
react: config.i18n.react,
|
|
24
|
+
supportedLngs: config.i18n.supportedLngs,
|
|
25
|
+
backend: config.i18n.backend,
|
|
26
|
+
ns: getInitialNamespaces(),
|
|
27
|
+
detection: {
|
|
28
|
+
order: ['htmlTag'],
|
|
29
|
+
caches: [],
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
hydrateRoot(document.getElementById('root'), React__default.createElement(StrictMode, null,
|
|
34
|
+
React__default.createElement(I18nextProvider, { i18n: i18next },
|
|
35
|
+
React__default.createElement(ClientCacheProvider, null,
|
|
36
|
+
React__default.createElement(ApolloProvider, { client: client },
|
|
37
|
+
React__default.createElement(Provider, { store: store },
|
|
38
|
+
React__default.createElement(SlotFillProvider, null,
|
|
39
|
+
React__default.createElement(InversifyProvider, { container: container, modules: clientModules },
|
|
40
|
+
React__default.createElement(PersistGate, { loading: null, persistor: persistor }, () => React__default.createElement(RemixBrowser, null))))))))));
|
|
41
|
+
// });
|
|
42
|
+
}
|
|
43
|
+
if (typeof requestIdleCallback === 'function') {
|
|
44
|
+
requestIdleCallback(hydrate);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
// Safari doesn't support requestIdleCallback
|
|
48
|
+
// https://caniuse.com/requestidlecallback
|
|
49
|
+
setTimeout(hydrate, 1);
|
|
50
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import React__default from'react';import {PassThrough}from'node:stream';import {createReadableStreamFromReadable}from'@remix-run/node';import {RemixServer}from'@remix-run/react';import {isbot}from'isbot';import {ApolloProvider}from'@apollo/client/index.js';import {SlotFillProvider}from'@common-stack/components-pro';import {InversifyProvider}from'@common-stack/client-react';import {renderToPipeableStream,renderToString}from'react-dom/server';import {Provider}from'react-redux';import {LOCATION_CHANGE}from'@common-stack/remix-router-redux';import serialize from'serialize-javascript';import {CacheProvider}from'@emotion/react';import createEmotionServer from'@emotion/server/create-instance';import Backend from'i18next-fs-backend';import {renderHeadToString}from'remix-island';import publicEnv from'@src/config/public-config';import {initReactI18next,I18nextProvider}from'react-i18next';import {createInstance}from'i18next';import {resolve}from'node:path';import {defaultCache}from'@app/frontend-stack-react/entries/common/createEmotionCache.js';import config from'@app/cde-webconfig.json';import {Head}from'./root.js';import {ServerStyleContext}from'@app/frontend-stack-react/entries/chakraui/context.js';import {i18nextInstance}from'@app/frontend-stack-react/i18n-localization/i18next.server.js';/**
|
|
2
|
+
* By default, Remix will handle generating the HTTP Response for you.
|
|
3
|
+
* You are free to delete this file if you'd like to, but if you ever want it revealed again, you can run `npx remix reveal` ✨
|
|
4
|
+
* For more information, see https://remix.run/file-conventions/entry.server
|
|
5
|
+
*/
|
|
6
|
+
// @ts-nocheck
|
|
7
|
+
global.__CLIENT__ = false;
|
|
8
|
+
global.__SERVER__ = true;
|
|
9
|
+
const { extractCriticalToChunks } = createEmotionServer(defaultCache);
|
|
10
|
+
const ABORT_DELAY = 5000;
|
|
11
|
+
const COMMON_HEAD = `
|
|
12
|
+
<meta charset="utf-8" />
|
|
13
|
+
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
|
14
|
+
`;
|
|
15
|
+
function handleRequest(request, responseStatusCode, responseHeaders, remixContext,
|
|
16
|
+
// This is ignored so we can keep it in the template for visibility. Feel
|
|
17
|
+
// free to delete this parameter in your app if you're not using it!
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
19
|
+
loadContext) {
|
|
20
|
+
return isbot(request.headers.get('user-agent') || '')
|
|
21
|
+
? handleBotRequest(request, responseStatusCode, responseHeaders, remixContext)
|
|
22
|
+
: handleBrowserRequest(request, responseStatusCode, responseHeaders, remixContext, loadContext);
|
|
23
|
+
}
|
|
24
|
+
function handleBotRequest(request, responseStatusCode, responseHeaders, remixContext, loadContext) {
|
|
25
|
+
return new Promise((resolve, reject) => {
|
|
26
|
+
let shellRendered = false;
|
|
27
|
+
const { pipe, abort } = renderToPipeableStream(React__default.createElement(RemixServer, { context: remixContext, url: request.url, abortDelay: ABORT_DELAY }), {
|
|
28
|
+
onAllReady() {
|
|
29
|
+
shellRendered = true;
|
|
30
|
+
const head = renderHeadToString({ request, remixContext, Head });
|
|
31
|
+
const body = new PassThrough();
|
|
32
|
+
responseHeaders.set('Content-Type', 'text/html');
|
|
33
|
+
const stream = createReadableStreamFromReadable(body);
|
|
34
|
+
resolve(new Response(stream, {
|
|
35
|
+
headers: responseHeaders,
|
|
36
|
+
status: responseStatusCode,
|
|
37
|
+
}));
|
|
38
|
+
body.write(`<!DOCTYPE html><html><head>${COMMON_HEAD}${head}</head><body><div id="root">`);
|
|
39
|
+
pipe(body);
|
|
40
|
+
body.write(`</div></body></html>`);
|
|
41
|
+
},
|
|
42
|
+
onShellError(error) {
|
|
43
|
+
reject(error);
|
|
44
|
+
},
|
|
45
|
+
onError(error) {
|
|
46
|
+
responseStatusCode = 500;
|
|
47
|
+
// Log streaming rendering errors from inside the shell. Don't log
|
|
48
|
+
// errors encountered during initial shell rendering since they'll
|
|
49
|
+
// reject and get logged in handleDocumentRequest.
|
|
50
|
+
if (shellRendered) {
|
|
51
|
+
console.error(error);
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
setTimeout(abort, ABORT_DELAY);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
async function handleBrowserRequest(request, responseStatusCode, responseHeaders, remixContext, loadContext) {
|
|
59
|
+
const instance = createInstance();
|
|
60
|
+
// Then we could detect locale from the request
|
|
61
|
+
const lng = await i18nextInstance.getLocale(request);
|
|
62
|
+
// And here we detect what namespaces the routes about to render want to use
|
|
63
|
+
const ns = i18nextInstance.getRouteNamespaces(remixContext);
|
|
64
|
+
const slotFillContext = { fills: {} };
|
|
65
|
+
const { modules: clientModules, container, apolloClient: client, store, } = loadContext;
|
|
66
|
+
// First, we create a new instance of i18next so every request will have a
|
|
67
|
+
// completely unique instance and not share any state.
|
|
68
|
+
if (config.i18n.enabled) {
|
|
69
|
+
await instance
|
|
70
|
+
.use(initReactI18next) // Tell our instance to use react-i18next
|
|
71
|
+
.use(Backend) // Setup our backend.init({
|
|
72
|
+
.init({
|
|
73
|
+
fallbackLng: config.i18n.fallbackLng,
|
|
74
|
+
defaultNS: config.i18n.defaultNS,
|
|
75
|
+
react: config.i18n.react,
|
|
76
|
+
supportedLngs: config.i18n.supportedLngs,
|
|
77
|
+
lng, // The locale we detected above
|
|
78
|
+
ns, // The namespaces the routes about to render want to use
|
|
79
|
+
backend: {
|
|
80
|
+
loadPath: resolve(config.i18n.backend.loadServerPath),
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
const html = renderToString(React__default.createElement(I18nextProvider, { i18n: instance },
|
|
85
|
+
React__default.createElement(CacheProvider, { value: defaultCache },
|
|
86
|
+
React__default.createElement(ApolloProvider, { client: client },
|
|
87
|
+
React__default.createElement(Provider, { store: store },
|
|
88
|
+
React__default.createElement(SlotFillProvider, { context: slotFillContext },
|
|
89
|
+
React__default.createElement(InversifyProvider, { container: container, modules: clientModules },
|
|
90
|
+
React__default.createElement(RemixServer, { context: remixContext, url: request.url }))))))));
|
|
91
|
+
const chunks = extractCriticalToChunks(html);
|
|
92
|
+
return new Promise((resolve, reject) => {
|
|
93
|
+
let shellRendered = false;
|
|
94
|
+
const { pathname, search, hash } = new URL(request.url);
|
|
95
|
+
store.dispatch({
|
|
96
|
+
type: LOCATION_CHANGE,
|
|
97
|
+
payload: { location: { pathname, search, hash }, action: 'POP' },
|
|
98
|
+
});
|
|
99
|
+
const { pipe, abort } = renderToPipeableStream((React__default.createElement(I18nextProvider, { i18n: instance },
|
|
100
|
+
React__default.createElement(ServerStyleContext.Provider, { value: chunks.styles },
|
|
101
|
+
React__default.createElement(CacheProvider, { value: defaultCache },
|
|
102
|
+
React__default.createElement(ApolloProvider, { client: client },
|
|
103
|
+
React__default.createElement(Provider, { store: store },
|
|
104
|
+
React__default.createElement(SlotFillProvider, { context: slotFillContext },
|
|
105
|
+
React__default.createElement(InversifyProvider, { container: container, modules: clientModules },
|
|
106
|
+
React__default.createElement(RemixServer, { context: remixContext, url: request.url, abortDelay: ABORT_DELAY }))))))))), {
|
|
107
|
+
onShellReady() {
|
|
108
|
+
shellRendered = true;
|
|
109
|
+
const head = renderHeadToString({ request, remixContext, Head });
|
|
110
|
+
const body = new PassThrough();
|
|
111
|
+
const stream = createReadableStreamFromReadable(body);
|
|
112
|
+
const apolloState = { ...client.extract() };
|
|
113
|
+
const reduxState = { ...store.getState() };
|
|
114
|
+
const fills = Object.keys(slotFillContext.fills);
|
|
115
|
+
// const transform = new ConstantsTransform(fills, apolloState, reduxState);
|
|
116
|
+
let customHead = `<script>window.__ENV__=${JSON.stringify(publicEnv)}</script>`;
|
|
117
|
+
customHead += `<script>window.__APOLLO_STATE__=${serialize(apolloState, {
|
|
118
|
+
isJSON: true,
|
|
119
|
+
})}</script>`;
|
|
120
|
+
customHead += `<script>window.__PRELOADED_STATE__=${serialize(reduxState, {
|
|
121
|
+
isJSON: true,
|
|
122
|
+
})}</script>`;
|
|
123
|
+
customHead += `<script>window.__SLOT_FILLS__=${serialize(fills, { isJSON: true })}</script>`;
|
|
124
|
+
customHead += `<script>if (global === undefined) { var global = window; }</script>`;
|
|
125
|
+
responseHeaders.set('Content-Type', 'text/html');
|
|
126
|
+
resolve(new Response(stream, {
|
|
127
|
+
headers: responseHeaders,
|
|
128
|
+
status: responseStatusCode,
|
|
129
|
+
}));
|
|
130
|
+
body.write(`<!DOCTYPE html><html lng=${lng}><head>${COMMON_HEAD}${customHead}${head}</head><body><div id="root">`);
|
|
131
|
+
pipe(body);
|
|
132
|
+
body.write(`</div></body></html>`);
|
|
133
|
+
// pipe(transform).pipe(renderStylesToNodeStream()).pipe(body);
|
|
134
|
+
},
|
|
135
|
+
onShellError(error) {
|
|
136
|
+
reject(error);
|
|
137
|
+
},
|
|
138
|
+
onError(error) {
|
|
139
|
+
responseStatusCode = 500;
|
|
140
|
+
// Log streaming rendering errors from inside the shell. Don't log
|
|
141
|
+
// errors encountered during initial shell rendering since they'll
|
|
142
|
+
// reject and get logged in handleDocumentRequest.
|
|
143
|
+
if (shellRendered) {
|
|
144
|
+
console.error(error);
|
|
145
|
+
}
|
|
146
|
+
reject(error);
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
setTimeout(abort, ABORT_DELAY);
|
|
150
|
+
});
|
|
151
|
+
}export{handleRequest as default};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ErrorBoundary } from '@app/frontend-stack-react/entries/chakraui/components/ErrorBoundary.js';
|
|
3
|
+
interface DocumentProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
}
|
|
6
|
+
export declare const Head: any;
|
|
7
|
+
export declare const Document: React.FC<DocumentProps & React.ClassAttributes<any>>;
|
|
8
|
+
export declare let loader: ({ request }: {
|
|
9
|
+
request: any;
|
|
10
|
+
}) => Promise<import("@remix-run/node").TypedResponse<{
|
|
11
|
+
locale: any;
|
|
12
|
+
}>>;
|
|
13
|
+
export declare let handle: {
|
|
14
|
+
i18n: string;
|
|
15
|
+
};
|
|
16
|
+
export declare function shouldRevalidate(params: any): boolean;
|
|
17
|
+
export default function App(): React.JSX.Element;
|
|
18
|
+
export { ErrorBoundary };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import*as React from'react';import {useContext}from'react';import {Meta,Links,ScrollRestoration,Scripts,useLoaderData,Outlet}from'@remix-run/react';import {json}from'@remix-run/node';import {PluginArea}from'@common-stack/client-react';import {subscribeReduxRouter}from'@common-stack/remix-router-redux';import {ApplicationErrorHandler}from'@admin-layout/chakra-ui';import clientModules,{plugins}from'@app/frontend-stack-react/modules.js';import {createHead}from'remix-island';import {ServerStyleContext,ClientStyleContext}from'./context.js';import {withEmotionCache}from'@emotion/react';import {useChangeLanguage}from'remix-i18next/react';import {i18nextInstance}from'@app/frontend-stack-react/i18n-localization/i18next.server.js';export{ErrorBoundary}from'@app/frontend-stack-react/entries/chakraui/components/ErrorBoundary.js';// @ts-nocheck
|
|
2
|
+
const Head = createHead(() => (React.createElement(React.Fragment, null,
|
|
3
|
+
React.createElement(Meta, null),
|
|
4
|
+
React.createElement(Links, null))));
|
|
5
|
+
const Document = withEmotionCache(({ children }, emotionCache) => {
|
|
6
|
+
const serverStyleData = useContext(ServerStyleContext);
|
|
7
|
+
const clientStyleData = useContext(ClientStyleContext);
|
|
8
|
+
React.useEffect(() => {
|
|
9
|
+
// re-link sheet container
|
|
10
|
+
emotionCache.sheet.container = document.head;
|
|
11
|
+
// re-inject tags
|
|
12
|
+
const tags = emotionCache.sheet.tags;
|
|
13
|
+
emotionCache.sheet.flush();
|
|
14
|
+
tags.forEach((tag) => {
|
|
15
|
+
emotionCache.sheet._insertTag(tag);
|
|
16
|
+
});
|
|
17
|
+
// reset cache to reapply global styles
|
|
18
|
+
clientStyleData?.reset();
|
|
19
|
+
}, []);
|
|
20
|
+
return (React.createElement(React.Fragment, null,
|
|
21
|
+
React.createElement(Head, null),
|
|
22
|
+
serverStyleData?.map(({ key, ids, css }) => (React.createElement("style", { key: key, "data-emotion": `${key} ${ids.join(' ')}`, dangerouslySetInnerHTML: { __html: css } }))),
|
|
23
|
+
React.createElement("script", { src: "https://cdnjs.cloudflare.com/ajax/libs/reflect-metadata/0.1.13/Reflect.min.js", integrity: "sha512-jvbPH2TH5BSZumEfOJZn9IV+5bSwwN+qG4dvthYe3KCGC3/9HmxZ4phADbt9Pfcp+XSyyfc2vGZ/RMsSUZ9tbQ==", crossOrigin: "anonymous", referrerPolicy: "no-referrer" }),
|
|
24
|
+
React.createElement(PluginArea, null),
|
|
25
|
+
children,
|
|
26
|
+
React.createElement(ScrollRestoration, null),
|
|
27
|
+
React.createElement(Scripts, null)));
|
|
28
|
+
});
|
|
29
|
+
let loader = async ({ request }) => {
|
|
30
|
+
let locale = await i18nextInstance.getLocale(request);
|
|
31
|
+
return json({ locale });
|
|
32
|
+
};
|
|
33
|
+
let handle = {
|
|
34
|
+
i18n: 'common',
|
|
35
|
+
};
|
|
36
|
+
function shouldRevalidate(params) {
|
|
37
|
+
return params.defaultShouldRevalidate && params.currentUrl.pathname !== params.nextUrl.pathname;
|
|
38
|
+
}
|
|
39
|
+
function App() {
|
|
40
|
+
let { locale } = useLoaderData();
|
|
41
|
+
useChangeLanguage(locale);
|
|
42
|
+
React.useEffect(() => {
|
|
43
|
+
subscribeReduxRouter({ store: window.__remixStore, router: window.__remixRouter });
|
|
44
|
+
}, []);
|
|
45
|
+
return (React.createElement(ApplicationErrorHandler, { plugins: plugins },
|
|
46
|
+
React.createElement(Document, null, clientModules.getWrappedRoot(React.createElement(Outlet, null)))));
|
|
47
|
+
}export{Document,Head,App as default,handle,loader,shouldRevalidate};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import*as React from'react';import {createCache,extractStyle,StyleProvider}from'@ant-design/cssinjs';const antdCache = createCache();
|
|
2
|
+
const styleSheet = extractStyle(antdCache);
|
|
3
|
+
const AntSytles = ({ children }) => (React.createElement(StyleProvider, { cache: antdCache }, children));export{AntSytles,styleSheet};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{AntSytles,styleSheet}from'./AntStyles.js';export{defaultCache}from'./createEmotionCache.js';export{jsonToString}from'./utils.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function jsonToString(json: any): any;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {isEmpty}from'lodash-es';function jsonToString(json) {
|
|
2
|
+
if (isEmpty(json)) {
|
|
3
|
+
return '';
|
|
4
|
+
}
|
|
5
|
+
if (Array.isArray(json)) {
|
|
6
|
+
let arr = json.map((a) => jsonToString(a));
|
|
7
|
+
return arr.join(' ');
|
|
8
|
+
}
|
|
9
|
+
const str = JSON.stringify(json);
|
|
10
|
+
const arr = str.split(',');
|
|
11
|
+
return Array.isArray(arr) ? arr.join(' ') : str;
|
|
12
|
+
}export{jsonToString};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * as ac from './antui/entry.client';
|
|
2
|
+
export * as as from './antui/entry.server';
|
|
3
|
+
export * as ar from './antui/root';
|
|
4
|
+
export * as cc from './chakraui/entry.client';
|
|
5
|
+
export * as cs from './chakraui/entry.server';
|
|
6
|
+
export * as cr from './chakraui/root';
|
|
7
|
+
export * as common from './common';
|
package/lib/index.d.ts
CHANGED
|
@@ -5,4 +5,7 @@ export * from './backend/middlewares/cors';
|
|
|
5
5
|
export * from './backend/middlewares/container';
|
|
6
6
|
export * from './backend/middlewares/error';
|
|
7
7
|
export * from './load-context.server';
|
|
8
|
+
export * from './entries';
|
|
8
9
|
export * from './i18n-localization/i18next.server';
|
|
10
|
+
export * as au from './entries/antui/components';
|
|
11
|
+
export * as cu from './entries/chakraui/components';
|
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{UtilityClass,logger}from'./utils/index.js';export{createClientContainer}from'./config/client.service.js';export{createReduxStore,epicMiddlewareFunc,persistConfig}from'./config/redux-config.js';export{clientLoaderWithMiddleware}from'./tools/clientLoaderWithMiddleware.js';export{loaderWithMiddleware}from'./tools/loaderWithMiddleware.js';export{corsMiddleware}from'./backend/middlewares/cors.js';export{TYPES,containerMiddleware}from'./backend/middlewares/container.js';export{errorMiddleware}from'./backend/middlewares/error.js';export{loadContext}from'./load-context.server.js';export{i18nextInstance}from'./i18n-localization/i18next.server.js';
|
|
1
|
+
export{UtilityClass,logger}from'./utils/index.js';export{createClientContainer}from'./config/client.service.js';export{createReduxStore,epicMiddlewareFunc,persistConfig}from'./config/redux-config.js';export{clientLoaderWithMiddleware}from'./tools/clientLoaderWithMiddleware.js';export{loaderWithMiddleware}from'./tools/loaderWithMiddleware.js';export{corsMiddleware}from'./backend/middlewares/cors.js';export{TYPES,containerMiddleware}from'./backend/middlewares/container.js';export{errorMiddleware}from'./backend/middlewares/error.js';export{loadContext}from'./load-context.server.js';import*as entry_client from'./entries/antui/entry.client.js';export{entry_client as ac };import*as entry_server from'./entries/antui/entry.server.js';export{entry_server as as };import*as root from'./entries/antui/root.js';export{root as ar };import*as entry_client$1 from'./entries/chakraui/entry.client.js';export{entry_client$1 as cc };import*as entry_server$1 from'./entries/chakraui/entry.server.js';export{entry_server$1 as cs };import*as root$1 from'./entries/chakraui/root.js';export{root$1 as cr };import*as index$2 from'./entries/common/index.js';export{index$2 as common };export{i18nextInstance}from'./i18n-localization/i18next.server.js';import*as index from'./entries/antui/components/index.js';export{index as au };import*as index$1 from'./entries/chakraui/components/index.js';export{index$1 as cu };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@common-stack/frontend-stack-react",
|
|
3
|
-
"version": "6.0.1-alpha.
|
|
3
|
+
"version": "6.0.1-alpha.5",
|
|
4
4
|
"description": "Client Module for react app",
|
|
5
5
|
"homepage": "https://github.com/cdmbase/fullstack-pro#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -29,15 +29,10 @@
|
|
|
29
29
|
"watch": "npm run build:lib:watch"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@chakra-ui/react": "^2.8.2",
|
|
33
32
|
"@common-stack/client-react": "6.0.1-alpha.0",
|
|
34
33
|
"@common-stack/core": "6.0.1-alpha.0",
|
|
35
|
-
"@nx/devkit": "19.5.1",
|
|
36
34
|
"@reduxjs/toolkit": "^2.2.6",
|
|
37
35
|
"@sentry/browser": "~5.11.2",
|
|
38
|
-
"apollo-link-debounce": "^3.0.0",
|
|
39
|
-
"apollo-link-logger": "^2.0.0",
|
|
40
|
-
"apollo-server-errors": "^3.3.1",
|
|
41
36
|
"cors": "^2.8.5",
|
|
42
37
|
"cross-fetch": "^4.0.0",
|
|
43
38
|
"graphql": "^16.0.0",
|
|
@@ -54,6 +49,11 @@
|
|
|
54
49
|
"devDependencies": {
|
|
55
50
|
"@admin-layout/ant-ui": "^7.3.7-alpha.4",
|
|
56
51
|
"@admin-layout/chakra-ui": "^7.3.7-alpha.4",
|
|
52
|
+
"@chakra-ui/react": "^2.8.2",
|
|
53
|
+
"@emotion/react": "^11.0.0",
|
|
54
|
+
"@emotion/server": "^11.0.0",
|
|
55
|
+
"antd": "^5.10.1",
|
|
56
|
+
"isbot": "^4.1.0",
|
|
57
57
|
"jest-fetch-mock": "^3.0.3",
|
|
58
58
|
"vite": "^5.2.12"
|
|
59
59
|
},
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"typescript": {
|
|
70
70
|
"definition": "lib/index.d.ts"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "a8430902d49f77c8e09217250e9a625ec5aac8c1"
|
|
73
73
|
}
|