@modern-js/runtime 2.56.2 → 2.57.0
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 +5 -1
- package/dist/cjs/core/browser/hydrate.js +3 -1
- package/dist/cjs/core/browser/index.js +8 -9
- package/dist/cjs/core/compatible.js +28 -48
- package/dist/cjs/core/plugin/base.js +20 -9
- package/dist/cjs/core/plugin/index.js +8 -2
- package/dist/cjs/core/react/index.js +11 -18
- package/dist/cjs/core/server/requestHandler.js +10 -10
- package/dist/cjs/core/server/stream/shared.js +2 -2
- package/dist/cjs/core/server/string/index.js +3 -2
- package/dist/cjs/core/server/utils.js +2 -5
- package/dist/cjs/router/cli/code/index.js +40 -4
- package/dist/cjs/router/cli/code/templates.js +13 -8
- package/dist/cjs/router/cli/index.js +32 -3
- package/dist/cjs/router/runtime/plugin.js +29 -40
- package/dist/cjs/router/runtime/plugin.node.js +27 -38
- package/dist/cjs/state/runtime/plugin.js +10 -21
- package/dist/esm/cli/index.js +10 -11
- package/dist/esm/core/browser/hydrate.js +3 -1
- package/dist/esm/core/browser/index.js +28 -13
- package/dist/esm/core/compatible.js +47 -56
- package/dist/esm/core/plugin/base.js +20 -9
- package/dist/esm/core/plugin/index.js +12 -3
- package/dist/esm/core/react/index.js +12 -20
- package/dist/esm/core/server/requestHandler.js +33 -14
- package/dist/esm/core/server/stream/shared.js +3 -3
- package/dist/esm/core/server/string/index.js +4 -3
- package/dist/esm/core/server/utils.js +2 -5
- package/dist/esm/router/cli/code/index.js +66 -16
- package/dist/esm/router/cli/code/templates.js +13 -8
- package/dist/esm/router/cli/index.js +48 -4
- package/dist/esm/router/runtime/plugin.js +32 -47
- package/dist/esm/router/runtime/plugin.node.js +27 -42
- package/dist/esm/state/runtime/plugin.js +11 -24
- package/dist/esm-node/cli/index.js +5 -1
- package/dist/esm-node/core/browser/hydrate.js +3 -1
- package/dist/esm-node/core/browser/index.js +8 -9
- package/dist/esm-node/core/compatible.js +28 -48
- package/dist/esm-node/core/plugin/base.js +18 -9
- package/dist/esm-node/core/plugin/index.js +10 -4
- package/dist/esm-node/core/react/index.js +11 -18
- package/dist/esm-node/core/server/requestHandler.js +10 -10
- package/dist/esm-node/core/server/stream/shared.js +2 -2
- package/dist/esm-node/core/server/string/index.js +3 -2
- package/dist/esm-node/core/server/utils.js +2 -5
- package/dist/esm-node/router/cli/code/index.js +41 -5
- package/dist/esm-node/router/cli/code/templates.js +13 -8
- package/dist/esm-node/router/cli/index.js +23 -4
- package/dist/esm-node/router/runtime/plugin.js +29 -40
- package/dist/esm-node/router/runtime/plugin.node.js +27 -38
- package/dist/esm-node/state/runtime/plugin.js +10 -21
- package/dist/types/core/compatible.d.ts +1 -1
- package/dist/types/core/context/index.d.ts +1 -1
- package/dist/types/core/context/runtime.d.ts +1 -1
- package/dist/types/core/plugin/base.d.ts +26 -36
- package/dist/types/core/plugin/index.d.ts +5 -12
- package/dist/types/core/plugin/runner.d.ts +4 -11
- package/dist/types/core/react/index.d.ts +1 -5
- package/dist/types/core/server/utils.d.ts +1 -1
- package/dist/types/router/cli/code/templates.d.ts +2 -2
- package/dist/types/router/runtime/plugin.d.ts +1 -1
- package/dist/types/router/runtime/plugin.node.d.ts +1 -1
- package/dist/types/state/runtime/plugin.d.ts +1 -1
- package/package.json +10 -10
- package/dist/cjs/core/utils/merge.js +0 -53
- package/dist/esm/core/utils/merge.js +0 -32
- package/dist/esm-node/core/utils/merge.js +0 -29
- package/dist/types/core/utils/merge.d.ts +0 -6
|
@@ -2,19 +2,12 @@
|
|
|
2
2
|
import { runtime, Plugin } from './base';
|
|
3
3
|
export * from './base';
|
|
4
4
|
export interface RuntimeConfig {
|
|
5
|
-
plugins
|
|
5
|
+
plugins?: Plugin[];
|
|
6
6
|
}
|
|
7
7
|
export declare function registerPlugin(internalPlugins: Plugin[], runtimeConfig?: RuntimeConfig, customRuntime?: typeof runtime): import("@modern-js/plugin").ToRunners<{
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
init: import("@modern-js/plugin").AsyncPipeline<{
|
|
13
|
-
context: import("..").RuntimeContext;
|
|
14
|
-
}, unknown>;
|
|
15
|
-
pickContext: import("@modern-js/plugin").Pipeline<{
|
|
16
|
-
context: import("..").RuntimeContext;
|
|
17
|
-
pickedContext: import("../context/runtime").TRuntimeContext;
|
|
18
|
-
}, import("../context/runtime").TRuntimeContext>;
|
|
8
|
+
beforeRender: import("@modern-js/plugin").AsyncInterruptWorkflow<import("..").RuntimeContext, void>;
|
|
9
|
+
wrapRoot: import("@modern-js/plugin").Waterfall<import("react").ComponentType<any>>;
|
|
10
|
+
pickContext: import("@modern-js/plugin").Waterfall<import("../context/runtime").TRuntimeContext>;
|
|
11
|
+
modifyRuntimeConfig: import("@modern-js/plugin").SyncParallelWorkflow<void, Record<string, any>>;
|
|
19
12
|
}>;
|
|
20
13
|
export declare function mergeConfig(config: Record<string, any>, ...otherConfig: Record<string, any>[]): Record<string, any>;
|
|
@@ -2,15 +2,8 @@
|
|
|
2
2
|
import { PluginRunner } from './base';
|
|
3
3
|
export declare function setGlobalRunner(runner: PluginRunner): void;
|
|
4
4
|
export declare function getGlobalRunner(): import("@modern-js/plugin").ToRunners<{
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
init: import("@modern-js/plugin").AsyncPipeline<{
|
|
10
|
-
context: import("..").RuntimeContext;
|
|
11
|
-
}, unknown>;
|
|
12
|
-
pickContext: import("@modern-js/plugin").Pipeline<{
|
|
13
|
-
context: import("..").RuntimeContext;
|
|
14
|
-
pickedContext: import("../context/runtime").TRuntimeContext;
|
|
15
|
-
}, import("../context/runtime").TRuntimeContext>;
|
|
5
|
+
beforeRender: import("@modern-js/plugin").AsyncInterruptWorkflow<import("..").RuntimeContext, void>;
|
|
6
|
+
wrapRoot: import("@modern-js/plugin").Waterfall<import("react").ComponentType<any>>;
|
|
7
|
+
pickContext: import("@modern-js/plugin").Waterfall<import("../context/runtime").TRuntimeContext>;
|
|
8
|
+
modifyRuntimeConfig: import("@modern-js/plugin").SyncParallelWorkflow<void, Record<string, any>>;
|
|
16
9
|
}>;
|
|
@@ -1,6 +1,2 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export declare function createRoot(UserApp?: React.ComponentType | null,
|
|
3
|
-
router: {
|
|
4
|
-
basename: string;
|
|
5
|
-
};
|
|
6
|
-
}): React.ComponentType<any>;
|
|
2
|
+
export declare function createRoot(UserApp?: React.ComponentType | null): ({ _internal_context, ...props }: any) => JSX.Element;
|
|
@@ -15,5 +15,5 @@ export declare function checkIsNode(): boolean;
|
|
|
15
15
|
* license at https://github.com/remix-run/remix/blob/main/LICENSE.md
|
|
16
16
|
*/
|
|
17
17
|
export declare function serializeErrors(errors: StaticHandlerContext['errors']): StaticHandlerContext['errors'];
|
|
18
|
-
export declare function getSSRConfigByEntry(entryName: string, ssr?: ServerUserConfig['ssr'], ssrByEntries?: ServerUserConfig['ssrByEntries']
|
|
18
|
+
export declare function getSSRConfigByEntry(entryName: string, ssr?: ServerUserConfig['ssr'], ssrByEntries?: ServerUserConfig['ssrByEntries']): import("@modern-js/app-tools").SSR;
|
|
19
19
|
export declare function getSSRMode(ssrConfig?: SSRConfig): 'string' | 'stream' | false;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Entrypoint, NestedRouteForCli, PageRoute, RouteLegacy, SSRMode } from '@modern-js/types';
|
|
2
2
|
import type { AppNormalizedConfig, IAppContext } from '@modern-js/app-tools';
|
|
3
|
-
export declare const routesForServer: ({
|
|
4
|
-
|
|
3
|
+
export declare const routesForServer: ({ routesForServerLoaderMatches, }: {
|
|
4
|
+
routesForServerLoaderMatches: (NestedRouteForCli | PageRoute)[];
|
|
5
5
|
}) => string;
|
|
6
6
|
export declare const fileSystemRoutes: ({ metaName, routes, ssrMode, nestedRoutesEntry, entryName, internalDirectory, splitRouteChunks, }: {
|
|
7
7
|
metaName: string;
|
|
@@ -3,4 +3,4 @@ import type { RouterConfig, Routes } from './types';
|
|
|
3
3
|
export declare let finalRouteConfig: RouterConfig['routesConfig'];
|
|
4
4
|
export declare let beforeCreateRouter: boolean;
|
|
5
5
|
export declare function modifyRoutes(modifyFunction: (routes: Routes) => Routes): void;
|
|
6
|
-
export declare const routerPlugin: (
|
|
6
|
+
export declare const routerPlugin: (userConfig?: Partial<RouterConfig>) => Plugin;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Plugin } from '../../core';
|
|
2
2
|
import type { RouterConfig } from './types';
|
|
3
|
-
export declare const routerPlugin: (
|
|
3
|
+
export declare const routerPlugin: (userConfig?: Partial<RouterConfig>) => Plugin;
|
|
4
4
|
export declare const modifyRoutes: () => void;
|
|
@@ -6,6 +6,6 @@ type StateExtraType = {
|
|
|
6
6
|
models: Array<Model>;
|
|
7
7
|
};
|
|
8
8
|
export type StateConfig = Partial<Record<StatePluginType, boolean> & StateExtraType>;
|
|
9
|
-
export declare const statePlugin: (
|
|
9
|
+
export declare const statePlugin: (userConfig?: StateConfig) => Plugin;
|
|
10
10
|
export default statePlugin;
|
|
11
11
|
export * from '../plugins';
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.
|
|
18
|
+
"version": "2.57.0",
|
|
19
19
|
"engines": {
|
|
20
20
|
"node": ">=14.17.6"
|
|
21
21
|
},
|
|
@@ -199,11 +199,11 @@
|
|
|
199
199
|
"react-side-effect": "^2.1.1",
|
|
200
200
|
"styled-components": "^5.3.1",
|
|
201
201
|
"@swc/helpers": "0.5.3",
|
|
202
|
-
"@modern-js/plugin": "2.
|
|
203
|
-
"@modern-js/utils": "2.
|
|
204
|
-
"@modern-js/
|
|
205
|
-
"@modern-js/
|
|
206
|
-
"@modern-js/
|
|
202
|
+
"@modern-js/plugin": "2.57.0",
|
|
203
|
+
"@modern-js/runtime-utils": "2.57.0",
|
|
204
|
+
"@modern-js/types": "2.57.0",
|
|
205
|
+
"@modern-js/plugin-data-loader": "2.57.0",
|
|
206
|
+
"@modern-js/utils": "2.57.0"
|
|
207
207
|
},
|
|
208
208
|
"peerDependencies": {
|
|
209
209
|
"react": ">=17",
|
|
@@ -226,10 +226,10 @@
|
|
|
226
226
|
"ts-jest": "^29.1.0",
|
|
227
227
|
"typescript": "^5",
|
|
228
228
|
"webpack": "^5.93.0",
|
|
229
|
-
"@modern-js/app-tools": "2.
|
|
230
|
-
"@modern-js/core": "2.
|
|
231
|
-
"@scripts/jest-config": "2.
|
|
232
|
-
"@scripts/build": "2.
|
|
229
|
+
"@modern-js/app-tools": "2.57.0",
|
|
230
|
+
"@modern-js/core": "2.57.0",
|
|
231
|
+
"@scripts/jest-config": "2.57.0",
|
|
232
|
+
"@scripts/build": "2.57.0"
|
|
233
233
|
},
|
|
234
234
|
"sideEffects": false,
|
|
235
235
|
"publishConfig": {
|
|
@@ -1,53 +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 merge_exports = {};
|
|
20
|
-
__export(merge_exports, {
|
|
21
|
-
merge: () => merge
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(merge_exports);
|
|
24
|
-
function isObject(obj) {
|
|
25
|
-
return obj && typeof obj === "object" && !Array.isArray(obj);
|
|
26
|
-
}
|
|
27
|
-
function merge(target, ...sources) {
|
|
28
|
-
if (!sources.length) {
|
|
29
|
-
return target;
|
|
30
|
-
}
|
|
31
|
-
const source = sources.shift();
|
|
32
|
-
if (isObject(target) && isObject(source)) {
|
|
33
|
-
for (const key in source) {
|
|
34
|
-
if (isObject(source[key])) {
|
|
35
|
-
if (!target[key]) {
|
|
36
|
-
Object.assign(target, {
|
|
37
|
-
[key]: {}
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
merge(target[key], source[key]);
|
|
41
|
-
} else {
|
|
42
|
-
Object.assign(target, {
|
|
43
|
-
[key]: source[key]
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return merge(target, ...sources);
|
|
49
|
-
}
|
|
50
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
-
0 && (module.exports = {
|
|
52
|
-
merge
|
|
53
|
-
});
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { _ as _define_property } from "@swc/helpers/_/_define_property";
|
|
2
|
-
import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
|
|
3
|
-
function isObject(obj) {
|
|
4
|
-
return obj && typeof obj === "object" && !Array.isArray(obj);
|
|
5
|
-
}
|
|
6
|
-
function merge(target) {
|
|
7
|
-
for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
8
|
-
sources[_key - 1] = arguments[_key];
|
|
9
|
-
}
|
|
10
|
-
if (!sources.length) {
|
|
11
|
-
return target;
|
|
12
|
-
}
|
|
13
|
-
var source = sources.shift();
|
|
14
|
-
if (isObject(target) && isObject(source)) {
|
|
15
|
-
for (var key in source) {
|
|
16
|
-
if (isObject(source[key])) {
|
|
17
|
-
if (!target[key]) {
|
|
18
|
-
Object.assign(target, _define_property({}, key, {}));
|
|
19
|
-
}
|
|
20
|
-
merge(target[key], source[key]);
|
|
21
|
-
} else {
|
|
22
|
-
Object.assign(target, _define_property({}, key, source[key]));
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return merge.apply(void 0, [
|
|
27
|
-
target
|
|
28
|
-
].concat(_to_consumable_array(sources)));
|
|
29
|
-
}
|
|
30
|
-
export {
|
|
31
|
-
merge
|
|
32
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
function isObject(obj) {
|
|
2
|
-
return obj && typeof obj === "object" && !Array.isArray(obj);
|
|
3
|
-
}
|
|
4
|
-
function merge(target, ...sources) {
|
|
5
|
-
if (!sources.length) {
|
|
6
|
-
return target;
|
|
7
|
-
}
|
|
8
|
-
const source = sources.shift();
|
|
9
|
-
if (isObject(target) && isObject(source)) {
|
|
10
|
-
for (const key in source) {
|
|
11
|
-
if (isObject(source[key])) {
|
|
12
|
-
if (!target[key]) {
|
|
13
|
-
Object.assign(target, {
|
|
14
|
-
[key]: {}
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
merge(target[key], source[key]);
|
|
18
|
-
} else {
|
|
19
|
-
Object.assign(target, {
|
|
20
|
-
[key]: source[key]
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return merge(target, ...sources);
|
|
26
|
-
}
|
|
27
|
-
export {
|
|
28
|
-
merge
|
|
29
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
type PlainObject = {
|
|
2
|
-
[key: string]: any;
|
|
3
|
-
};
|
|
4
|
-
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
5
|
-
export declare function merge<T extends PlainObject, U extends PlainObject[]>(target: T, ...sources: U): T & UnionToIntersection<U[number]>;
|
|
6
|
-
export {};
|