@reckona/mreact-router 0.0.90 → 0.0.91
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/dev-server.d.ts.map +1 -1
- package/dist/dev-server.js +8 -1
- package/dist/dev-server.js.map +1 -1
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +46 -24
- package/dist/render.js.map +1 -1
- package/dist/vite-config.d.ts +2 -0
- package/dist/vite-config.d.ts.map +1 -1
- package/dist/vite-config.js +2 -0
- package/dist/vite-config.js.map +1 -1
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +9 -2
- package/dist/vite.js.map +1 -1
- package/package.json +11 -11
- package/src/dev-server.ts +9 -1
- package/src/render.ts +53 -3
- package/src/vite-config.ts +6 -0
- package/src/vite.ts +16 -3
package/src/vite-config.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { loadConfigFromFile, type ConfigEnv, type PluginOption, type UserConfig } from "vite";
|
|
2
2
|
import type { ResolvedAppRouterProject } from "./config.js";
|
|
3
|
+
import type { AppRouterImportPolicy } from "./import-policy.js";
|
|
3
4
|
import { mreactRouterConfigFromPlugins } from "./vite.js";
|
|
4
5
|
|
|
5
6
|
export interface LoadedMreactRouterViteConfig {
|
|
7
|
+
importPolicy?: AppRouterImportPolicy | undefined;
|
|
6
8
|
project: ResolvedAppRouterProject;
|
|
7
9
|
serverPort?: number | undefined;
|
|
8
10
|
viteConfig?: UserConfig | undefined;
|
|
@@ -41,8 +43,12 @@ export async function loadMreactRouterViteConfigDetails(options: {
|
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
const serverPort = loaded.config.server?.port;
|
|
46
|
+
const importPolicy = (config as ResolvedAppRouterProject & {
|
|
47
|
+
importPolicy?: AppRouterImportPolicy | undefined;
|
|
48
|
+
}).importPolicy;
|
|
44
49
|
|
|
45
50
|
return {
|
|
51
|
+
...(importPolicy === undefined ? {} : { importPolicy }),
|
|
46
52
|
project: config,
|
|
47
53
|
...(typeof serverPort === "number" ? { serverPort } : {}),
|
|
48
54
|
viteConfig: {
|
package/src/vite.ts
CHANGED
|
@@ -71,8 +71,12 @@ const virtualReactiveCoreId = "\0mreact-router-reactive-core";
|
|
|
71
71
|
const virtualReactiveDevtoolsId = "\0mreact-router-reactive-devtools";
|
|
72
72
|
const mreactRouterConfigKey = "__mreactRouterConfig";
|
|
73
73
|
|
|
74
|
+
type MreactRouterPluginConfig = ResolvedAppRouterProject & {
|
|
75
|
+
importPolicy?: AppRouterImportPolicy | undefined;
|
|
76
|
+
};
|
|
77
|
+
|
|
74
78
|
type MreactRouterPlugin = Plugin & {
|
|
75
|
-
[mreactRouterConfigKey]:
|
|
79
|
+
[mreactRouterConfigKey]: MreactRouterPluginConfig;
|
|
76
80
|
};
|
|
77
81
|
|
|
78
82
|
export function createAppRouterVitePlugin(options: AppRouterVitePluginOptions): Plugin {
|
|
@@ -151,7 +155,10 @@ export function createAppRouterVitePlugin(options: AppRouterVitePluginOptions):
|
|
|
151
155
|
]);
|
|
152
156
|
|
|
153
157
|
const plugin: MreactRouterPlugin = {
|
|
154
|
-
[mreactRouterConfigKey]:
|
|
158
|
+
[mreactRouterConfigKey]: {
|
|
159
|
+
...project,
|
|
160
|
+
...(options.importPolicy === undefined ? {} : { importPolicy: options.importPolicy }),
|
|
161
|
+
},
|
|
155
162
|
enforce: "pre",
|
|
156
163
|
name: "mreact-router",
|
|
157
164
|
config() {
|
|
@@ -351,7 +358,13 @@ export function mreactRouterConfigFromPlugins(
|
|
|
351
358
|
): ResolvedAppRouterProject | undefined {
|
|
352
359
|
for (const plugin of plugins.flat(Infinity)) {
|
|
353
360
|
if (plugin !== null && typeof plugin === "object" && mreactRouterConfigKey in plugin) {
|
|
354
|
-
|
|
361
|
+
const config = (plugin as MreactRouterPlugin)[mreactRouterConfigKey];
|
|
362
|
+
|
|
363
|
+
if ("project" in config) {
|
|
364
|
+
return (config as unknown as { project: ResolvedAppRouterProject }).project;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
return config as unknown as ResolvedAppRouterProject;
|
|
355
368
|
}
|
|
356
369
|
}
|
|
357
370
|
|