@modern-js/runtime 2.66.0 → 2.67.1
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/cjs/cli/index.js +2 -7
- package/dist/cjs/cli/template.server.js +4 -10
- package/dist/cjs/router/cli/code/index.js +3 -4
- package/dist/cjs/router/cli/code/templates.js +3 -0
- package/dist/cjs/router/cli/entry.js +2 -2
- package/dist/cjs/router/cli/handler.js +6 -7
- package/dist/cjs/router/cli/index.js +12 -10
- package/dist/esm/cli/index.js +1 -5
- package/dist/esm/cli/template.server.js +4 -4
- package/dist/esm/router/cli/code/index.js +6 -7
- package/dist/esm/router/cli/code/templates.js +13 -6
- package/dist/esm/router/cli/entry.js +3 -4
- package/dist/esm/router/cli/handler.js +9 -11
- package/dist/esm/router/cli/index.js +13 -11
- package/dist/esm-node/cli/index.js +1 -5
- package/dist/esm-node/cli/template.server.js +4 -10
- package/dist/esm-node/router/cli/code/index.js +4 -5
- package/dist/esm-node/router/cli/code/templates.js +3 -0
- package/dist/esm-node/router/cli/entry.js +3 -3
- package/dist/esm-node/router/cli/handler.js +6 -7
- package/dist/esm-node/router/cli/index.js +13 -11
- package/dist/types/cli/index.d.ts +1 -2
- package/dist/types/common.d.ts +0 -6
- package/dist/types/config.d.ts +0 -2
- package/dist/types/core/context/runtime.d.ts +0 -3
- package/dist/types/index.d.ts +1 -2
- package/dist/types/router/cli/code/index.d.ts +1 -1
- package/dist/types/router/cli/entry.d.ts +1 -1
- package/dist/types/router/cli/handler.d.ts +3 -3
- package/package.json +12 -27
- package/types/index.d.ts +1 -13
- package/types/router.d.ts +0 -1
- package/dist/cjs/state/cli/index.js +0 -62
- package/dist/cjs/state/index.js +0 -43
- package/dist/cjs/state/plugins.js +0 -50
- package/dist/cjs/state/runtime/index.js +0 -42
- package/dist/cjs/state/runtime/plugin.js +0 -95
- package/dist/esm/state/cli/index.js +0 -41
- package/dist/esm/state/index.js +0 -7
- package/dist/esm/state/plugins.js +0 -19
- package/dist/esm/state/runtime/index.js +0 -6
- package/dist/esm/state/runtime/plugin.js +0 -93
- package/dist/esm-node/state/cli/index.js +0 -38
- package/dist/esm-node/state/index.js +0 -7
- package/dist/esm-node/state/plugins.js +0 -13
- package/dist/esm-node/state/runtime/index.js +0 -6
- package/dist/esm-node/state/runtime/plugin.js +0 -69
- package/dist/types/state/cli/index.d.ts +0 -3
- package/dist/types/state/index.d.ts +0 -3
- package/dist/types/state/plugins.d.ts +0 -4
- package/dist/types/state/runtime/index.d.ts +0 -3
- package/dist/types/state/runtime/plugin.d.ts +0 -11
- package/types/model.d.ts +0 -7
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import { fs, getEntryOptions,
|
|
2
|
+
import { fs, getEntryOptions, isSSGEntry, isUseSSRBundle, logger } from "@modern-js/utils";
|
|
3
3
|
import { filterRoutesForServer, filterRoutesLoader, markRoutes } from "@modern-js/utils";
|
|
4
4
|
import { cloneDeep } from "@modern-js/utils/lodash";
|
|
5
5
|
import { ENTRY_POINT_RUNTIME_GLOBAL_CONTEXT_FILE_NAME } from "../../../cli/constants";
|
|
@@ -8,11 +8,10 @@ import { getClientRoutes, getClientRoutesLegacy } from "./getClientRoutes";
|
|
|
8
8
|
import { walk } from "./nestedRoutes";
|
|
9
9
|
import * as templates from "./templates";
|
|
10
10
|
import { getServerCombinedModueFile, getServerLoadersFile } from "./utils";
|
|
11
|
-
const generateCode = async (appContext, config, entrypoints, api) => {
|
|
11
|
+
const generateCode = async (appContext, config, entrypoints, api, isRouterV5) => {
|
|
12
12
|
const { internalDirectory, srcDirectory, internalDirAlias, internalSrcAlias, packageName } = appContext;
|
|
13
13
|
const hooks = api.getHooks();
|
|
14
|
-
const
|
|
15
|
-
const getRoutes = isV5 ? getClientRoutesLegacy : getClientRoutes;
|
|
14
|
+
const getRoutes = isRouterV5 ? getClientRoutesLegacy : getClientRoutes;
|
|
16
15
|
const oldVersion = typeof (config === null || config === void 0 ? void 0 : config.runtime.router) === "object" ? Boolean((config === null || config === void 0 ? void 0 : config.runtime.router).oldVersion) : false;
|
|
17
16
|
await Promise.all(entrypoints.map(generateEntryCode));
|
|
18
17
|
async function generateEntryCode(entrypoint) {
|
|
@@ -32,7 +31,7 @@ const generateCode = async (appContext, config, entrypoints, api) => {
|
|
|
32
31
|
internalDirAlias
|
|
33
32
|
});
|
|
34
33
|
}
|
|
35
|
-
if (!
|
|
34
|
+
if (!isRouterV5 && entrypoint.nestedRoutesEntry) {
|
|
36
35
|
nestedRoutes = await walk(entrypoint.nestedRoutesEntry, entrypoint.nestedRoutesEntry, {
|
|
37
36
|
name: internalSrcAlias,
|
|
38
37
|
basename: srcDirectory
|
|
@@ -394,6 +394,9 @@ const runtimeGlobalContext = async ({ entryName, metaName, srcDirectory, nestedR
|
|
|
394
394
|
} else {
|
|
395
395
|
imports.push(`let appInit;`);
|
|
396
396
|
}
|
|
397
|
+
} else {
|
|
398
|
+
imports.push(`let appConfig;`);
|
|
399
|
+
imports.push(`let appInit;`);
|
|
397
400
|
}
|
|
398
401
|
} else {
|
|
399
402
|
imports.push(`let appConfig;`);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import { fs, JS_EXTENSIONS, findExists
|
|
2
|
+
import { fs, JS_EXTENSIONS, findExists } from "@modern-js/utils";
|
|
3
3
|
import { hasApp } from "../../cli/entry";
|
|
4
4
|
import { FILE_SYSTEM_ROUTES_GLOBAL_LAYOUT, NESTED_ROUTES_DIR, PAGES_DIR_NAME } from "./constants";
|
|
5
5
|
const hasPages = (dir) => fs.existsSync(path.join(dir, PAGES_DIR_NAME));
|
|
@@ -13,14 +13,14 @@ const isRouteEntry = (dir) => {
|
|
|
13
13
|
}
|
|
14
14
|
return false;
|
|
15
15
|
};
|
|
16
|
-
const modifyEntrypoints = (entrypoints,
|
|
16
|
+
const modifyEntrypoints = (entrypoints, isRouterV5) => {
|
|
17
17
|
return entrypoints.map((entrypoint) => {
|
|
18
18
|
if (!entrypoint.isAutoMount) {
|
|
19
19
|
return entrypoint;
|
|
20
20
|
}
|
|
21
21
|
if (entrypoint === null || entrypoint === void 0 ? void 0 : entrypoint.isCustomSourceEntry) {
|
|
22
22
|
if (entrypoint.fileSystemRoutes) {
|
|
23
|
-
if (isRouterV5
|
|
23
|
+
if (isRouterV5) {
|
|
24
24
|
throw Error("Custom entries with conventional routing not support use react router v5!");
|
|
25
25
|
}
|
|
26
26
|
entrypoint.nestedRoutesEntry = entrypoint.entry;
|
|
@@ -4,17 +4,16 @@ import * as templates from "./code/templates";
|
|
|
4
4
|
import { isPageComponentFile } from "./code/utils";
|
|
5
5
|
import { modifyEntrypoints } from "./entry";
|
|
6
6
|
let originEntrypoints = [];
|
|
7
|
-
async function handleModifyEntrypoints(
|
|
8
|
-
|
|
9
|
-
return modifyEntrypoints(entrypoints, config);
|
|
7
|
+
async function handleModifyEntrypoints(isRouterV5, entrypoints) {
|
|
8
|
+
return modifyEntrypoints(entrypoints, isRouterV5);
|
|
10
9
|
}
|
|
11
|
-
async function handleGeneratorEntryCode(api, entrypoints) {
|
|
10
|
+
async function handleGeneratorEntryCode(api, entrypoints, isRouterV5) {
|
|
12
11
|
const appContext = api.getAppContext();
|
|
13
12
|
const { internalDirectory } = appContext;
|
|
14
13
|
const resolvedConfig = api.getNormalizedConfig();
|
|
15
14
|
const { generatorRegisterCode, generateCode } = await import("./code");
|
|
16
15
|
originEntrypoints = cloneDeep(entrypoints);
|
|
17
|
-
await generateCode(appContext, resolvedConfig, entrypoints, api);
|
|
16
|
+
await generateCode(appContext, resolvedConfig, entrypoints, api, isRouterV5);
|
|
18
17
|
await Promise.all(entrypoints.map(async (entrypoint) => {
|
|
19
18
|
if (entrypoint.nestedRoutesEntry || entrypoint.pageRoutesEntry) {
|
|
20
19
|
var _entrypoint_fileSystemRoutes;
|
|
@@ -30,7 +29,7 @@ async function handleGeneratorEntryCode(api, entrypoints) {
|
|
|
30
29
|
}));
|
|
31
30
|
return entrypoints;
|
|
32
31
|
}
|
|
33
|
-
async function handleFileChange(api, e) {
|
|
32
|
+
async function handleFileChange(api, isRouterV5, e) {
|
|
34
33
|
const appContext = api.getAppContext();
|
|
35
34
|
const { appDirectory, entrypoints } = appContext;
|
|
36
35
|
const { filename, eventType } = e;
|
|
@@ -43,7 +42,7 @@ async function handleFileChange(api, e) {
|
|
|
43
42
|
const resolvedConfig = api.getNormalizedConfig();
|
|
44
43
|
const { generateCode } = await import("./code");
|
|
45
44
|
const entrypoints2 = cloneDeep(originEntrypoints);
|
|
46
|
-
await generateCode(appContext, resolvedConfig, entrypoints2, api);
|
|
45
|
+
await generateCode(appContext, resolvedConfig, entrypoints2, api, isRouterV5);
|
|
47
46
|
}
|
|
48
47
|
}
|
|
49
48
|
export {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { fs, NESTED_ROUTE_SPEC_FILE, createRuntimeExportsUtils, getEntryOptions
|
|
2
|
+
import { fs, NESTED_ROUTE_SPEC_FILE, createRuntimeExportsUtils, getEntryOptions } from "@modern-js/utils";
|
|
3
3
|
import { filterRoutesForServer } from "@modern-js/utils";
|
|
4
4
|
import { isRouteEntry } from "./entry";
|
|
5
5
|
import { handleFileChange, handleGeneratorEntryCode, handleModifyEntrypoints } from "./handler";
|
|
@@ -13,16 +13,19 @@ const routerPlugin = () => ({
|
|
|
13
13
|
setup: (api) => {
|
|
14
14
|
const nestedRoutes = {};
|
|
15
15
|
const nestedRoutesForServer = {};
|
|
16
|
+
const { metaName } = api.getAppContext();
|
|
17
|
+
const isRouterV5 = api.isPluginExists(`@${metaName}/plugin-router-v5`);
|
|
16
18
|
api._internalRuntimePlugins(({ entrypoint, plugins }) => {
|
|
17
19
|
var _getEntryOptions;
|
|
18
|
-
const {
|
|
20
|
+
const { nestedRoutesEntry, pageRoutesEntry } = entrypoint;
|
|
21
|
+
const { packageName, serverRoutes, metaName: metaName2 } = api.getAppContext();
|
|
19
22
|
const serverBase = serverRoutes.filter((route) => route.entryName === entrypoint.entryName).map((route) => route.urlPath).sort((a, b) => a.length - b.length > 0 ? -1 : 1);
|
|
20
23
|
const userConfig = api.getNormalizedConfig();
|
|
21
24
|
const routerConfig = (_getEntryOptions = getEntryOptions(entrypoint.entryName, entrypoint.isMainEntry, userConfig.runtime, userConfig.runtimeByEntries, packageName)) === null || _getEntryOptions === void 0 ? void 0 : _getEntryOptions.router;
|
|
22
|
-
if (
|
|
25
|
+
if ((nestedRoutesEntry || pageRoutesEntry) && !isRouterV5) {
|
|
23
26
|
plugins.push({
|
|
24
27
|
name: "router",
|
|
25
|
-
path: `@${
|
|
28
|
+
path: `@${metaName2}/runtime/router`,
|
|
26
29
|
config: typeof routerConfig === "boolean" ? {
|
|
27
30
|
serverBase
|
|
28
31
|
} : {
|
|
@@ -57,24 +60,23 @@ const routerPlugin = () => ({
|
|
|
57
60
|
};
|
|
58
61
|
});
|
|
59
62
|
api.modifyEntrypoints(async ({ entrypoints }) => {
|
|
60
|
-
const newEntryPoints = await handleModifyEntrypoints(
|
|
63
|
+
const newEntryPoints = await handleModifyEntrypoints(isRouterV5, entrypoints);
|
|
61
64
|
return {
|
|
62
65
|
entrypoints: newEntryPoints
|
|
63
66
|
};
|
|
64
67
|
});
|
|
65
68
|
api.generateEntryCode(async ({ entrypoints }) => {
|
|
66
|
-
await handleGeneratorEntryCode(api, entrypoints);
|
|
69
|
+
await handleGeneratorEntryCode(api, entrypoints, isRouterV5);
|
|
67
70
|
});
|
|
68
71
|
api.addRuntimeExports(() => {
|
|
69
|
-
const
|
|
70
|
-
const { internalDirectory, metaName } = api.useAppContext();
|
|
72
|
+
const { internalDirectory, metaName: metaName2 } = api.useAppContext();
|
|
71
73
|
const pluginsExportsUtils = createRuntimeExportsUtils(internalDirectory, "plugins");
|
|
72
|
-
if (!
|
|
73
|
-
pluginsExportsUtils.addExport(`export { default as router } from '@${
|
|
74
|
+
if (!isRouterV5) {
|
|
75
|
+
pluginsExportsUtils.addExport(`export { default as router } from '@${metaName2}/runtime/router'`);
|
|
74
76
|
}
|
|
75
77
|
});
|
|
76
78
|
api.onFileChanged(async (e) => {
|
|
77
|
-
await handleFileChange(api, e);
|
|
79
|
+
await handleFileChange(api, isRouterV5, e);
|
|
78
80
|
});
|
|
79
81
|
api.modifyFileSystemRoutes(({ entrypoint, routes }) => {
|
|
80
82
|
nestedRoutes[entrypoint.entryName] = routes;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { AppTools, CliPluginFuture } from '@modern-js/app-tools';
|
|
2
2
|
import { documentPlugin } from '../document/cli';
|
|
3
3
|
import { routerPlugin } from '../router/cli';
|
|
4
|
-
import { statePlugin } from '../state/cli';
|
|
5
4
|
import { ssrPlugin } from './ssr';
|
|
6
5
|
export { isRuntimeEntry } from './entry';
|
|
7
|
-
export {
|
|
6
|
+
export { ssrPlugin, routerPlugin, documentPlugin };
|
|
8
7
|
export declare const runtimePlugin: (params?: {
|
|
9
8
|
plugins?: CliPluginFuture<AppTools<"shared">>[];
|
|
10
9
|
}) => CliPluginFuture<AppTools<"shared">>;
|
package/dist/types/common.d.ts
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
import type { Plugin, RuntimePluginFuture } from './core/plugin';
|
|
2
2
|
import type { RouterConfig } from './router';
|
|
3
|
-
import type { StateConfig } from './state';
|
|
4
3
|
export declare const isBrowser: () => boolean;
|
|
5
4
|
export interface AppConfig {
|
|
6
|
-
state?: StateConfig | boolean;
|
|
7
5
|
router?: Pick<RouterConfig, 'future' | 'basename'>;
|
|
8
6
|
[key: string]: any;
|
|
9
7
|
}
|
|
10
8
|
export interface RuntimeConfig {
|
|
11
|
-
state?: StateConfig;
|
|
12
|
-
stateByEntries?: {
|
|
13
|
-
[name: string]: StateConfig;
|
|
14
|
-
};
|
|
15
9
|
plugins?: (Plugin | RuntimePluginFuture)[];
|
|
16
10
|
[key: string]: any;
|
|
17
11
|
}
|
package/dist/types/config.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Store } from '@modern-js-reduck/store';
|
|
2
1
|
import type { StaticHandlerContext } from '@modern-js/runtime-utils/remix-router';
|
|
3
2
|
import type { RouteManifest } from '../../router/runtime/types';
|
|
4
3
|
import { createLoaderManager } from '../loader/loaderManager';
|
|
@@ -8,7 +7,6 @@ interface BaseRuntimeContext {
|
|
|
8
7
|
loaderManager: ReturnType<typeof createLoaderManager>;
|
|
9
8
|
isBrowser: boolean;
|
|
10
9
|
ssrContext?: SSRServerContext;
|
|
11
|
-
store?: Store;
|
|
12
10
|
routeManifest: RouteManifest;
|
|
13
11
|
routerContext?: StaticHandlerContext;
|
|
14
12
|
context?: TSSRContext;
|
|
@@ -30,7 +28,6 @@ export interface TRuntimeContext extends Partial<BaseRuntimeContext> {
|
|
|
30
28
|
request?: SSRServerContext['request'];
|
|
31
29
|
/** @deprecated use context.response field instead */
|
|
32
30
|
response?: SSRServerContext['response'];
|
|
33
|
-
store?: Store;
|
|
34
31
|
[key: string]: any;
|
|
35
32
|
}
|
|
36
33
|
export declare const getInitialContext: (isBrowser?: boolean, routeManifest?: RouteManifest) => RuntimeContext;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { RouterConfig } from './router';
|
|
2
|
-
import type { StateConfig } from './state';
|
|
3
2
|
export type { Plugin, RuntimePluginFuture } from './core';
|
|
4
3
|
export type { AppConfig, RuntimeConfig } from './common';
|
|
5
4
|
export { isBrowser } from './common';
|
|
@@ -9,4 +8,4 @@ export { getMonitors } from './core/context/monitors';
|
|
|
9
8
|
export { getRequest } from './core/context/request';
|
|
10
9
|
export { setHeaders, setStatus, redirect } from './core/context/response';
|
|
11
10
|
export { createApp, useLoader, bootstrap, RuntimeReactContext, defineConfig, defineRuntimeConfig, useRuntimeContext, } from './core';
|
|
12
|
-
export type {
|
|
11
|
+
export type { RouterConfig };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AppNormalizedConfig, AppTools, AppToolsContext } from '@modern-js/app-tools';
|
|
2
2
|
import type { CLIPluginAPI } from '@modern-js/plugin-v2';
|
|
3
3
|
import type { Entrypoint } from '@modern-js/types';
|
|
4
|
-
export declare const generateCode: (appContext: AppToolsContext<"shared">, config: AppNormalizedConfig<"shared">, entrypoints: Entrypoint[], api: CLIPluginAPI<AppTools<"shared"
|
|
4
|
+
export declare const generateCode: (appContext: AppToolsContext<"shared">, config: AppNormalizedConfig<"shared">, entrypoints: Entrypoint[], api: CLIPluginAPI<AppTools<"shared">>, isRouterV5: boolean) => Promise<void>;
|
|
5
5
|
export declare function generatorRegisterCode(internalDirectory: string, entryName: string, code: string): void;
|
|
@@ -2,4 +2,4 @@ import type { Entrypoint } from '@modern-js/types';
|
|
|
2
2
|
export declare const hasPages: (dir: string) => boolean;
|
|
3
3
|
export declare const hasNestedRoutes: (dir: string) => boolean;
|
|
4
4
|
export declare const isRouteEntry: (dir: string) => string | false;
|
|
5
|
-
export declare const modifyEntrypoints: (entrypoints: Entrypoint[],
|
|
5
|
+
export declare const modifyEntrypoints: (entrypoints: Entrypoint[], isRouterV5: boolean) => Entrypoint[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AppTools } from '@modern-js/app-tools';
|
|
2
2
|
import type { CLIPluginAPI } from '@modern-js/plugin-v2';
|
|
3
3
|
import type { Entrypoint } from '@modern-js/types';
|
|
4
|
-
export declare function handleModifyEntrypoints(
|
|
5
|
-
export declare function handleGeneratorEntryCode(api: CLIPluginAPI<AppTools<'shared'>>, entrypoints: Entrypoint[]): Promise<Entrypoint[]>;
|
|
6
|
-
export declare function handleFileChange(api: CLIPluginAPI<AppTools<'shared'>>, e: any): Promise<void>;
|
|
4
|
+
export declare function handleModifyEntrypoints(isRouterV5: boolean, entrypoints: Entrypoint[]): Promise<Entrypoint[]>;
|
|
5
|
+
export declare function handleGeneratorEntryCode(api: CLIPluginAPI<AppTools<'shared'>>, entrypoints: Entrypoint[], isRouterV5: boolean): Promise<Entrypoint[]>;
|
|
6
|
+
export declare function handleFileChange(api: CLIPluginAPI<AppTools<'shared'>>, isRouterV5: boolean, e: any): Promise<void>;
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.
|
|
18
|
+
"version": "2.67.1",
|
|
19
19
|
"engines": {
|
|
20
20
|
"node": ">=14.17.6"
|
|
21
21
|
},
|
|
@@ -34,7 +34,6 @@
|
|
|
34
34
|
"./types": "./types/index.d.ts",
|
|
35
35
|
"./types/index": "./types/index.d.ts",
|
|
36
36
|
"./types/router": "./types/router.d.ts",
|
|
37
|
-
"./types/model": "./types/model.d.ts",
|
|
38
37
|
"./context": {
|
|
39
38
|
"types": "./dist/types/core/context/index.d.ts",
|
|
40
39
|
"jsnext:source": "./src/core/context/index.ts",
|
|
@@ -92,11 +91,6 @@
|
|
|
92
91
|
"node": "./dist/cjs/document/index.js",
|
|
93
92
|
"default": "./dist/esm/document/index.js"
|
|
94
93
|
},
|
|
95
|
-
"./model": {
|
|
96
|
-
"types": "./types/model.d.ts",
|
|
97
|
-
"jsnext:source": "./src/state/index.ts",
|
|
98
|
-
"default": "./dist/esm/state/index.js"
|
|
99
|
-
},
|
|
100
94
|
"./cli": {
|
|
101
95
|
"types": "./dist/types/cli/index.d.ts",
|
|
102
96
|
"jsnext:source": "./src/cli/index.ts",
|
|
@@ -178,9 +172,6 @@
|
|
|
178
172
|
"ssr/server": [
|
|
179
173
|
"./dist/types/core/server/server.d.ts"
|
|
180
174
|
],
|
|
181
|
-
"model": [
|
|
182
|
-
"./types/model.d.ts"
|
|
183
|
-
],
|
|
184
175
|
"router": [
|
|
185
176
|
"./dist/types/router/index.d.ts"
|
|
186
177
|
],
|
|
@@ -207,12 +198,6 @@
|
|
|
207
198
|
"@loadable/babel-plugin": "5.15.3",
|
|
208
199
|
"@loadable/component": "5.15.3",
|
|
209
200
|
"@loadable/server": "5.15.3",
|
|
210
|
-
"@modern-js-reduck/plugin-auto-actions": "^1.1.10",
|
|
211
|
-
"@modern-js-reduck/plugin-devtools": "^1.1.10",
|
|
212
|
-
"@modern-js-reduck/plugin-effects": "^1.1.10",
|
|
213
|
-
"@modern-js-reduck/plugin-immutable": "^1.1.10",
|
|
214
|
-
"@modern-js-reduck/react": "^1.1.10",
|
|
215
|
-
"@modern-js-reduck/store": "^1.1.10",
|
|
216
201
|
"@swc/helpers": "0.5.13",
|
|
217
202
|
"@types/loadable__component": "^5.13.4",
|
|
218
203
|
"@types/react-helmet": "^6.1.2",
|
|
@@ -226,13 +211,13 @@
|
|
|
226
211
|
"react-is": "^18",
|
|
227
212
|
"react-side-effect": "^2.1.1",
|
|
228
213
|
"styled-components": "^5.3.1",
|
|
229
|
-
"@modern-js/plugin": "2.
|
|
230
|
-
"@modern-js/plugin-
|
|
231
|
-
"@modern-js/plugin-
|
|
232
|
-
"@modern-js/render": "2.
|
|
233
|
-
"@modern-js/runtime-utils": "2.
|
|
234
|
-
"@modern-js/types": "2.
|
|
235
|
-
"@modern-js/utils": "2.
|
|
214
|
+
"@modern-js/plugin": "2.67.1",
|
|
215
|
+
"@modern-js/plugin-data-loader": "2.67.1",
|
|
216
|
+
"@modern-js/plugin-v2": "2.67.1",
|
|
217
|
+
"@modern-js/render": "2.67.1",
|
|
218
|
+
"@modern-js/runtime-utils": "2.67.1",
|
|
219
|
+
"@modern-js/types": "2.67.1",
|
|
220
|
+
"@modern-js/utils": "2.67.1"
|
|
236
221
|
},
|
|
237
222
|
"peerDependencies": {
|
|
238
223
|
"react": ">=17",
|
|
@@ -240,7 +225,7 @@
|
|
|
240
225
|
},
|
|
241
226
|
"devDependencies": {
|
|
242
227
|
"@remix-run/web-fetch": "^4.1.3",
|
|
243
|
-
"@rsbuild/core": "1.
|
|
228
|
+
"@rsbuild/core": "1.3.5",
|
|
244
229
|
"@testing-library/react": "^13.4.0",
|
|
245
230
|
"@types/cookie": "0.6.0",
|
|
246
231
|
"@types/invariant": "^2.2.30",
|
|
@@ -256,9 +241,9 @@
|
|
|
256
241
|
"ts-node": "^10.9.1",
|
|
257
242
|
"typescript": "^5",
|
|
258
243
|
"webpack": "^5.98.0",
|
|
259
|
-
"@modern-js/app-tools": "2.
|
|
260
|
-
"@scripts/
|
|
261
|
-
"@scripts/
|
|
244
|
+
"@modern-js/app-tools": "2.67.1",
|
|
245
|
+
"@scripts/build": "2.66.0",
|
|
246
|
+
"@scripts/jest-config": "2.66.0"
|
|
262
247
|
},
|
|
263
248
|
"sideEffects": false,
|
|
264
249
|
"publishConfig": {
|
package/types/index.d.ts
CHANGED
|
@@ -1,16 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
declare module '@modern-js/app-tools' {
|
|
4
|
-
interface RuntimeUserConfig {
|
|
5
|
-
state?: StateConfig | boolean;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
declare module '@modern-js/module-tools' {
|
|
10
|
-
interface RuntimeUserConfig {
|
|
11
|
-
state?: StateConfig | boolean;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
1
|
+
/// <reference types='@modern-js/plugin-state/types' />
|
|
14
2
|
|
|
15
3
|
declare module 'http' {
|
|
16
4
|
interface ServerResponse {
|
package/types/router.d.ts
CHANGED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var cli_exports = {};
|
|
20
|
-
__export(cli_exports, {
|
|
21
|
-
default: () => cli_default,
|
|
22
|
-
statePlugin: () => statePlugin
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(cli_exports);
|
|
25
|
-
var import_utils = require("@modern-js/utils");
|
|
26
|
-
const PLUGIN_IDENTIFIER = "state";
|
|
27
|
-
const statePlugin = () => ({
|
|
28
|
-
name: "@modern-js/plugin-state",
|
|
29
|
-
required: [
|
|
30
|
-
"@modern-js/runtime"
|
|
31
|
-
],
|
|
32
|
-
setup: (api) => {
|
|
33
|
-
api._internalRuntimePlugins(({ entrypoint, plugins }) => {
|
|
34
|
-
var _getEntryOptions;
|
|
35
|
-
const { entryName, isMainEntry } = entrypoint;
|
|
36
|
-
const userConfig = api.getNormalizedConfig();
|
|
37
|
-
const { packageName, metaName } = api.getAppContext();
|
|
38
|
-
const stateConfig = (_getEntryOptions = (0, import_utils.getEntryOptions)(entryName, isMainEntry, userConfig.runtime, userConfig.runtimeByEntries, packageName)) === null || _getEntryOptions === void 0 ? void 0 : _getEntryOptions.state;
|
|
39
|
-
if (stateConfig) {
|
|
40
|
-
plugins.push({
|
|
41
|
-
name: PLUGIN_IDENTIFIER,
|
|
42
|
-
path: `@${metaName}/runtime/model`,
|
|
43
|
-
config: typeof stateConfig === "boolean" ? {} : stateConfig
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
return {
|
|
47
|
-
entrypoint,
|
|
48
|
-
plugins
|
|
49
|
-
};
|
|
50
|
-
});
|
|
51
|
-
api.addRuntimeExports(() => {
|
|
52
|
-
const { internalDirectory, metaName } = api.useAppContext();
|
|
53
|
-
const pluginsExportsUtils = (0, import_utils.createRuntimeExportsUtils)(internalDirectory, "plugins");
|
|
54
|
-
pluginsExportsUtils.addExport(`export { default as state } from '@${metaName}/runtime/model'`);
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
var cli_default = statePlugin;
|
|
59
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
60
|
-
0 && (module.exports = {
|
|
61
|
-
statePlugin
|
|
62
|
-
});
|
package/dist/cjs/state/index.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
21
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
-
mod
|
|
28
|
-
));
|
|
29
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
-
var state_exports = {};
|
|
31
|
-
__export(state_exports, {
|
|
32
|
-
default: () => import_runtime2.default,
|
|
33
|
-
state: () => import_runtime.default
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(state_exports);
|
|
36
|
-
var import_runtime = __toESM(require("./runtime"));
|
|
37
|
-
var import_runtime2 = __toESM(require("./runtime"));
|
|
38
|
-
__reExport(state_exports, require("./runtime"), module.exports);
|
|
39
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
-
0 && (module.exports = {
|
|
41
|
-
state,
|
|
42
|
-
...require("./runtime")
|
|
43
|
-
});
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var plugins_exports = {};
|
|
30
|
-
__export(plugins_exports, {
|
|
31
|
-
autoActions: () => autoActions,
|
|
32
|
-
devtools: () => import_plugin_devtools.default,
|
|
33
|
-
effects: () => effects,
|
|
34
|
-
immer: () => immer
|
|
35
|
-
});
|
|
36
|
-
module.exports = __toCommonJS(plugins_exports);
|
|
37
|
-
var import_plugin_auto_actions = __toESM(require("@modern-js-reduck/plugin-auto-actions"));
|
|
38
|
-
var import_plugin_effects = require("@modern-js-reduck/plugin-effects");
|
|
39
|
-
var import_plugin_immutable = __toESM(require("@modern-js-reduck/plugin-immutable"));
|
|
40
|
-
var import_plugin_devtools = __toESM(require("@modern-js-reduck/plugin-devtools"));
|
|
41
|
-
const effects = () => import_plugin_effects.plugin;
|
|
42
|
-
const immer = () => import_plugin_immutable.default;
|
|
43
|
-
const autoActions = () => import_plugin_auto_actions.default;
|
|
44
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
45
|
-
0 && (module.exports = {
|
|
46
|
-
autoActions,
|
|
47
|
-
devtools,
|
|
48
|
-
effects,
|
|
49
|
-
immer
|
|
50
|
-
});
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
21
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
-
mod
|
|
28
|
-
));
|
|
29
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
-
var runtime_exports = {};
|
|
31
|
-
__export(runtime_exports, {
|
|
32
|
-
default: () => import_plugin.default
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(runtime_exports);
|
|
35
|
-
__reExport(runtime_exports, require("@modern-js-reduck/react"), module.exports);
|
|
36
|
-
var import_plugin = __toESM(require("./plugin"));
|
|
37
|
-
__reExport(runtime_exports, require("./plugin"), module.exports);
|
|
38
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
-
0 && (module.exports = {
|
|
40
|
-
...require("@modern-js-reduck/react"),
|
|
41
|
-
...require("./plugin")
|
|
42
|
-
});
|