@reckona/mreact-router 0.0.87 → 0.0.88
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/client.d.ts.map +1 -1
- package/dist/client.js +68 -5
- package/dist/client.js.map +1 -1
- package/dist/module-runner.d.ts +2 -0
- package/dist/module-runner.d.ts.map +1 -1
- package/dist/module-runner.js +418 -13
- package/dist/module-runner.js.map +1 -1
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +13 -0
- package/dist/render.js.map +1 -1
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +14 -0
- package/dist/vite.js.map +1 -1
- package/package.json +11 -11
- package/src/client.ts +68 -5
- package/src/module-runner.ts +554 -18
- package/src/render.ts +17 -0
- package/src/vite.ts +14 -0
package/src/render.ts
CHANGED
|
@@ -236,10 +236,13 @@ export async function preloadBuiltRequestModules(options: {
|
|
|
236
236
|
|
|
237
237
|
if (route.kind === "server") {
|
|
238
238
|
await loadServerRouteModule({
|
|
239
|
+
appDir: options.appDir,
|
|
239
240
|
file: route.file,
|
|
241
|
+
importPolicy: options.importPolicy,
|
|
240
242
|
serverModules: options.serverModules,
|
|
241
243
|
serverModuleCacheVersion: options.serverModuleCacheVersion,
|
|
242
244
|
serverSourceFiles: options.serverSourceFiles,
|
|
245
|
+
vitePlugins: options.vitePlugins,
|
|
243
246
|
});
|
|
244
247
|
continue;
|
|
245
248
|
}
|
|
@@ -834,7 +837,9 @@ async function renderAppRequestInternal(options: RenderAppRequestOptions): Promi
|
|
|
834
837
|
|
|
835
838
|
if (matched.route.kind === "metadata") {
|
|
836
839
|
return await dispatchMetadataRoute({
|
|
840
|
+
appDir: options.appDir,
|
|
837
841
|
file: matched.route.file,
|
|
842
|
+
importPolicy: options.importPolicy,
|
|
838
843
|
params: matched.params,
|
|
839
844
|
request: options.request,
|
|
840
845
|
route: matched.route,
|
|
@@ -847,6 +852,7 @@ async function renderAppRequestInternal(options: RenderAppRequestOptions): Promi
|
|
|
847
852
|
|
|
848
853
|
if (matched.route.kind === "server") {
|
|
849
854
|
return await dispatchServerRoute({
|
|
855
|
+
appDir: options.appDir,
|
|
850
856
|
env: options.env,
|
|
851
857
|
file: matched.route.file,
|
|
852
858
|
importPolicy: options.importPolicy,
|
|
@@ -1856,6 +1862,7 @@ function errorDebugContext(
|
|
|
1856
1862
|
}
|
|
1857
1863
|
|
|
1858
1864
|
async function dispatchServerRoute(options: {
|
|
1865
|
+
appDir: string;
|
|
1859
1866
|
env?: unknown;
|
|
1860
1867
|
file: string;
|
|
1861
1868
|
importPolicy?: AppRouterImportPolicy | undefined;
|
|
@@ -1944,7 +1951,9 @@ function jsonConventionResponse(body: ManifestDescriptor): Response {
|
|
|
1944
1951
|
}
|
|
1945
1952
|
|
|
1946
1953
|
async function dispatchMetadataRoute(options: {
|
|
1954
|
+
appDir: string;
|
|
1947
1955
|
file: string;
|
|
1956
|
+
importPolicy?: AppRouterImportPolicy | undefined;
|
|
1948
1957
|
params: RouteParams;
|
|
1949
1958
|
request: Request;
|
|
1950
1959
|
route: Extract<AppRoute, { kind: "metadata" }>;
|
|
@@ -2008,6 +2017,7 @@ async function dispatchMetadataRoute(options: {
|
|
|
2008
2017
|
}
|
|
2009
2018
|
|
|
2010
2019
|
async function loadServerRouteModule(options: {
|
|
2020
|
+
appDir: string;
|
|
2011
2021
|
file: string;
|
|
2012
2022
|
importPolicy?: AppRouterImportPolicy | undefined;
|
|
2013
2023
|
serverModules?: ReadonlyMap<string, BuiltServerModuleArtifact> | undefined;
|
|
@@ -2062,6 +2072,13 @@ async function loadServerRouteModule(options: {
|
|
|
2062
2072
|
code: moduleCode,
|
|
2063
2073
|
externalizeAppSourceModuleDirs: externalSourceDirs,
|
|
2064
2074
|
label: `server-route:${options.file}`,
|
|
2075
|
+
plugins: [
|
|
2076
|
+
createAppRouterImportPolicyPlugin({
|
|
2077
|
+
appDir: options.appDir,
|
|
2078
|
+
importPolicy: options.importPolicy,
|
|
2079
|
+
label: "Route handler",
|
|
2080
|
+
}),
|
|
2081
|
+
],
|
|
2065
2082
|
...(moduleCode === code ? { resolveDir: dirname(options.file) } : {}),
|
|
2066
2083
|
sourcefile: options.file,
|
|
2067
2084
|
vitePlugins: options.vitePlugins,
|
package/src/vite.ts
CHANGED
|
@@ -154,6 +154,20 @@ export function createAppRouterVitePlugin(options: AppRouterVitePluginOptions):
|
|
|
154
154
|
[mreactRouterConfigKey]: project,
|
|
155
155
|
enforce: "pre",
|
|
156
156
|
name: "mreact-router",
|
|
157
|
+
config() {
|
|
158
|
+
return {
|
|
159
|
+
optimizeDeps: {
|
|
160
|
+
exclude: [
|
|
161
|
+
"react",
|
|
162
|
+
"react-dom",
|
|
163
|
+
"react-dom/client",
|
|
164
|
+
"react-dom/server",
|
|
165
|
+
"react/jsx-dev-runtime",
|
|
166
|
+
"react/jsx-runtime",
|
|
167
|
+
],
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
},
|
|
157
171
|
configureServer(server) {
|
|
158
172
|
server.middlewares.use(createDevCssProxyMiddleware());
|
|
159
173
|
|