ssr-plugin-react 6.2.44 → 6.2.47
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/.turbo/turbo-build.log +3 -3
- package/CHANGELOG.md +434 -0
- package/README.md +46 -43
- package/cjs/config/base.d.ts +1 -1
- package/cjs/config/base.d.ts.map +1 -1
- package/cjs/config/base.js +9 -9
- package/cjs/config/client.js +6 -6
- package/cjs/config/server.js +4 -4
- package/cjs/entry/client-entry.d.ts.map +1 -1
- package/cjs/entry/client-entry.js +2 -3
- package/cjs/entry/client-entry.js.map +1 -1
- package/cjs/entry/context.d.ts +1 -1
- package/cjs/entry/context.d.ts.map +1 -1
- package/cjs/entry/create-context.d.ts +1 -1
- package/cjs/entry/create-context.d.ts.map +1 -1
- package/cjs/entry/create-router.d.ts +1 -1
- package/cjs/entry/create-router.d.ts.map +1 -1
- package/cjs/entry/create-router.js +2 -20
- package/cjs/entry/create-router.js.map +1 -1
- package/cjs/entry/server-entry.d.ts +1 -1
- package/cjs/entry/server-entry.d.ts.map +1 -1
- package/cjs/entry/server-entry.js +7 -8
- package/cjs/entry/server-entry.js.map +1 -1
- package/cjs/index.js +2 -2
- package/cjs/tools/vite.d.ts.map +1 -1
- package/cjs/tools/vite.js +30 -22
- package/cjs/tools/vite.js.map +1 -1
- package/esm/config/base.d.ts +1 -1
- package/esm/config/base.d.ts.map +1 -1
- package/esm/config/base.js +1 -1
- package/esm/config/client.js +1 -1
- package/esm/config/server.js +1 -1
- package/esm/entry/client-entry.d.ts.map +1 -1
- package/esm/entry/client-entry.js +1 -2
- package/esm/entry/client-entry.js.map +1 -1
- package/esm/entry/context.d.ts +1 -1
- package/esm/entry/context.d.ts.map +1 -1
- package/esm/entry/create-context.d.ts +1 -1
- package/esm/entry/create-context.d.ts.map +1 -1
- package/esm/entry/create-router.d.ts +1 -1
- package/esm/entry/create-router.d.ts.map +1 -1
- package/esm/entry/create-router.js +2 -20
- package/esm/entry/create-router.js.map +1 -1
- package/esm/entry/server-entry.d.ts +1 -1
- package/esm/entry/server-entry.d.ts.map +1 -1
- package/esm/entry/server-entry.js +1 -2
- package/esm/entry/server-entry.js.map +1 -1
- package/esm/index.js +1 -1
- package/esm/tools/vite.d.ts.map +1 -1
- package/esm/tools/vite.js +24 -16
- package/esm/tools/vite.js.map +1 -1
- package/package.json +6 -5
- package/src/config/base.ts +2 -2
- package/src/config/client.ts +1 -1
- package/src/config/server.ts +1 -1
- package/src/entry/client-entry.tsx +3 -4
- package/src/entry/context.tsx +1 -1
- package/src/entry/create-context.ts +1 -1
- package/src/entry/create-router.ts +3 -21
- package/src/entry/server-entry.tsx +3 -4
- package/src/index.ts +1 -1
- package/src/tools/vite.ts +9 -1
|
@@ -1,28 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import { combineRoutes } from 'ssr-common-utils'
|
|
2
2
|
import * as declareRoutes from '_build/ssr-declare-routes'
|
|
3
|
-
// @ts-expect-error
|
|
4
3
|
import * as ManualRoutes from '_build/ssr-manual-routes'
|
|
5
|
-
import { ReactRoutesType } from 'ssr-types
|
|
4
|
+
import { ReactRoutesType } from 'ssr-types'
|
|
6
5
|
|
|
7
|
-
const
|
|
8
|
-
const ManualRoutesWithType = ManualRoutes as ReactRoutesType
|
|
6
|
+
const Routes = combineRoutes(declareRoutes, ManualRoutes) as ReactRoutesType
|
|
9
7
|
|
|
10
|
-
const Routes: ReactRoutesType = {
|
|
11
|
-
...declareRoutes,
|
|
12
|
-
...ManualRoutesWithType
|
|
13
|
-
}
|
|
14
|
-
if (ManualRoutesWithType.FeRoutes) {
|
|
15
|
-
// 声明式路由覆盖约定式路由同名path
|
|
16
|
-
const combineRoutes = declareRoutesWithType.FeRoutes.map(route => ManualRoutesWithType.FeRoutes.find(e => e.path === route.path) ?? route)
|
|
17
|
-
ManualRoutesWithType.FeRoutes.forEach(route => {
|
|
18
|
-
// 补充声明式路由新增的配置
|
|
19
|
-
const found = combineRoutes.find(e => e.path === route.path)
|
|
20
|
-
if (!found) {
|
|
21
|
-
combineRoutes.push(route)
|
|
22
|
-
}
|
|
23
|
-
})
|
|
24
|
-
Routes.FeRoutes = combineRoutes
|
|
25
|
-
}
|
|
26
8
|
export {
|
|
27
9
|
Routes
|
|
28
10
|
}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
2
|
import { createElement } from 'react'
|
|
3
3
|
import { StaticRouter } from 'react-router-dom'
|
|
4
|
-
import { findRoute, getManifest, logGreen, normalizePath, getAsyncCssChunk, getAsyncJsChunk, reactRefreshFragment } from 'ssr-
|
|
5
|
-
import { ISSRContext, IConfig,
|
|
6
|
-
import { setStoreContext } from 'ssr-common-utils'
|
|
4
|
+
import { findRoute, getManifest, logGreen, normalizePath, getAsyncCssChunk, getAsyncJsChunk, reactRefreshFragment, setStoreContext } from 'ssr-common-utils'
|
|
5
|
+
import { ISSRContext, IConfig, ReactESMPreloadFeRouteItem, DynamicFC, StaticFC } from 'ssr-types'
|
|
7
6
|
import { serialize } from 'ssr-serialize-javascript'
|
|
8
7
|
import { STORE_CONTEXT as Context } from '_build/create-context'
|
|
9
8
|
import { Routes } from './create-router'
|
|
10
9
|
|
|
11
|
-
const { FeRoutes, layoutFetch, state, Layout } = Routes
|
|
10
|
+
const { FeRoutes, layoutFetch, state, Layout } = Routes
|
|
12
11
|
|
|
13
12
|
const serverRender = async (ctx: ISSRContext, config: IConfig) => {
|
|
14
13
|
const { mode, parallelFetch, prefix, isVite, isDev, clientPrefix } = config
|
package/src/index.ts
CHANGED
package/src/tools/vite.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { build, UserConfig } from 'vite'
|
|
|
2
2
|
import {
|
|
3
3
|
loadConfig, chunkNamePlugin, rollupOutputOptions, manifestPlugin, commonConfig,
|
|
4
4
|
asyncOptimizeChunkPlugin, getOutputPublicPath
|
|
5
|
-
} from 'ssr-
|
|
5
|
+
} from 'ssr-common-utils'
|
|
6
6
|
import react from '@vitejs/plugin-react'
|
|
7
7
|
import { createStyleImportPlugin, AndDesignVueResolve, VantResolve, ElementPlusResolve, NutuiResolve, AntdResolve } from 'ssr-vite-plugin-style-import'
|
|
8
8
|
const { getOutput, reactServerEntry, reactClientEntry, viteConfig, supportOptinalChaining, isDev, define, babelOptions, optimize } = loadConfig()
|
|
@@ -44,6 +44,14 @@ const serverConfig: UserConfig = {
|
|
|
44
44
|
keepNames: true,
|
|
45
45
|
logOverride: { 'this-is-undefined-in-esm': 'silent' }
|
|
46
46
|
},
|
|
47
|
+
optimizeDeps: {
|
|
48
|
+
include: ['react-router'].concat(...viteConfig?.().client?.otherConfig?.optimizeDeps?.include ?? []),
|
|
49
|
+
exclude: ['ssr-hoc-react'].concat(...viteConfig?.().client?.otherConfig?.optimizeDeps?.exclude ?? []),
|
|
50
|
+
esbuildOptions: {
|
|
51
|
+
// @ts-expect-error
|
|
52
|
+
bundle: isDev
|
|
53
|
+
}
|
|
54
|
+
},
|
|
47
55
|
build: {
|
|
48
56
|
...viteConfig?.().server?.otherConfig?.build,
|
|
49
57
|
ssr: reactServerEntry,
|