@common-stack/frontend-stack-react 4.0.2-alpha.8 → 4.0.2-alpha.9
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/entry.server.js +3 -3
- package/lib/entries/antui/root.js +2 -2
- package/lib/entries/chakraui/entry.server.js +3 -3
- package/lib/entries/chakraui/root.d.ts +1 -1
- package/lib/entries/chakraui/root.js +2 -2
- package/lib/entries/common/AntStyles.js +3 -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.js +12 -0
- package/lib/entries/index.d.ts +1 -0
- package/lib/i18n-localization/i18next.server.d.ts +1 -1
- package/lib/i18n-localization/i18next.server.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
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
|
|
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
2
|
* By default, Remix will handle generating the HTTP Response for you.
|
|
3
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
4
|
* For more information, see https://remix.run/file-conventions/entry.server
|
|
@@ -43,8 +43,8 @@ async function handleRequest(request, responseStatusCode, responseHeaders, remix
|
|
|
43
43
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
44
44
|
loadContext) {
|
|
45
45
|
const instance = createInstance();
|
|
46
|
-
const lng = await
|
|
47
|
-
const ns =
|
|
46
|
+
const lng = await i18nextInstance.getLocale(request);
|
|
47
|
+
const ns = i18nextInstance.getRouteNamespaces(remixContext);
|
|
48
48
|
// First, we create a new instance of i18next so every request will have a
|
|
49
49
|
// completely unique instance and not share any state.
|
|
50
50
|
if (config.i18n.enabled) {
|
|
@@ -1,5 +1,5 @@
|
|
|
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/frontend-stack-react/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
|
|
2
|
-
const locale = await
|
|
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/frontend-stack-react/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
3
|
return json({
|
|
4
4
|
__ENV__: publicEnv,
|
|
5
5
|
locale,
|
|
@@ -1,4 +1,4 @@
|
|
|
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 {initReactI18next,I18nextProvider}from'react-i18next';import {createInstance}from'i18next';import {resolve}from'node:path';import {defaultCache}from'@app/frontend-stack-react/entries/common/createEmotionCache';import config from'@app/cde-webconfig.json';import {Head}from'./root.js';import {ServerStyleContext}from'@app/frontend-stack-react/entries/chakraui/context.js';import
|
|
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
2
|
* By default, Remix will handle generating the HTTP Response for you.
|
|
3
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
4
|
* For more information, see https://remix.run/file-conventions/entry.server
|
|
@@ -58,9 +58,9 @@ function handleBotRequest(request, responseStatusCode, responseHeaders, remixCon
|
|
|
58
58
|
async function handleBrowserRequest(request, responseStatusCode, responseHeaders, remixContext, loadContext) {
|
|
59
59
|
const instance = createInstance();
|
|
60
60
|
// Then we could detect locale from the request
|
|
61
|
-
const lng = await
|
|
61
|
+
const lng = await i18nextInstance.getLocale(request);
|
|
62
62
|
// And here we detect what namespaces the routes about to render want to use
|
|
63
|
-
const ns =
|
|
63
|
+
const ns = i18nextInstance.getRouteNamespaces(remixContext);
|
|
64
64
|
const slotFillContext = { fills: {} };
|
|
65
65
|
const { modules: clientModules, container, apolloClient: client, store, } = loadContext;
|
|
66
66
|
// First, we create a new instance of i18next so every request will have a
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ErrorBoundary } from '@app/frontend-stack-react/entries/chakraui/components/ErrorBoundary';
|
|
2
|
+
import { ErrorBoundary } from '@app/frontend-stack-react/entries/chakraui/components/ErrorBoundary.js';
|
|
3
3
|
interface DocumentProps {
|
|
4
4
|
children: React.ReactNode;
|
|
5
5
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
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
|
|
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
2
|
const Head = createHead(() => (React.createElement(React.Fragment, null,
|
|
3
3
|
React.createElement(Meta, null),
|
|
4
4
|
React.createElement(Links, null))));
|
|
@@ -28,7 +28,7 @@ const Document = withEmotionCache(({ children }, emotionCache) => {
|
|
|
28
28
|
React.createElement(Scripts, null)));
|
|
29
29
|
});
|
|
30
30
|
let loader = async ({ request }) => {
|
|
31
|
-
let locale = await
|
|
31
|
+
let locale = await i18nextInstance.getLocale(request);
|
|
32
32
|
return json({ locale });
|
|
33
33
|
};
|
|
34
34
|
let handle = {
|
|
@@ -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,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};
|
package/lib/entries/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
declare const i18nextInstance: any;
|
|
2
|
-
export
|
|
2
|
+
export { i18nextInstance };
|
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';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'./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 };
|
|
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": "4.0.2-alpha.
|
|
3
|
+
"version": "4.0.2-alpha.9",
|
|
4
4
|
"description": "Client Module for react app",
|
|
5
5
|
"homepage": "https://github.com/cdmbase/fullstack-pro#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"typescript": {
|
|
57
57
|
"definition": "lib/index.d.ts"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "189ea955aa9d476a4b39f1786207ab444e435260"
|
|
60
60
|
}
|