@modern-js/types 2.55.0 → 2.56.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/cli/index.d.ts +44 -47
- package/package.json +4 -4
- package/server/index.d.ts +1 -0
- package/server/monitor.d.ts +36 -0
package/cli/index.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { Merge } from 'type-fest';
|
|
2
|
-
|
|
3
1
|
import type { Config as JestConfigTypes } from '@jest/types';
|
|
4
2
|
|
|
5
3
|
export type JestConfig = JestConfigTypes.Config;
|
|
@@ -34,7 +32,9 @@ export interface Entrypoint {
|
|
|
34
32
|
* Using customEntry instead.
|
|
35
33
|
*/
|
|
36
34
|
customBootstrap?: string | false;
|
|
37
|
-
|
|
35
|
+
/**
|
|
36
|
+
* use src/{entryName}/entry.tsx to custom entry
|
|
37
|
+
*/
|
|
38
38
|
customEntry?: boolean;
|
|
39
39
|
|
|
40
40
|
customServerEntry?: string | false;
|
|
@@ -44,6 +44,10 @@ export interface Entrypoint {
|
|
|
44
44
|
routes?: any[];
|
|
45
45
|
};
|
|
46
46
|
absoluteEntryDir?: string;
|
|
47
|
+
/**
|
|
48
|
+
* use source.entries to custom entry
|
|
49
|
+
*/
|
|
50
|
+
isCustomSourceEntry?: boolean;
|
|
47
51
|
}
|
|
48
52
|
|
|
49
53
|
/**
|
|
@@ -58,54 +62,47 @@ export type RouteLegacy = {
|
|
|
58
62
|
parent?: RouteLegacy;
|
|
59
63
|
};
|
|
60
64
|
|
|
61
|
-
export
|
|
62
|
-
caseSensitive
|
|
63
|
-
path
|
|
64
|
-
id
|
|
65
|
-
loader
|
|
66
|
-
action
|
|
67
|
-
hasErrorBoundary
|
|
68
|
-
shouldRevalidate
|
|
69
|
-
handle
|
|
70
|
-
index
|
|
71
|
-
children
|
|
72
|
-
element
|
|
73
|
-
errorElement
|
|
74
|
-
}> & {
|
|
65
|
+
export interface Route {
|
|
66
|
+
caseSensitive?: boolean;
|
|
67
|
+
path?: string;
|
|
68
|
+
id?: string;
|
|
69
|
+
loader?: any;
|
|
70
|
+
action?: any;
|
|
71
|
+
hasErrorBoundary?: boolean;
|
|
72
|
+
shouldRevalidate?: any;
|
|
73
|
+
handle?: any;
|
|
74
|
+
index?: boolean;
|
|
75
|
+
children?: Route[] | undefined;
|
|
76
|
+
element?: React.ReactNode | null;
|
|
77
|
+
errorElement?: React.ReactNode | null;
|
|
75
78
|
type: string;
|
|
76
|
-
}
|
|
79
|
+
}
|
|
77
80
|
|
|
78
81
|
export type NestedRouteForCli = NestedRoute<string>;
|
|
79
82
|
|
|
80
|
-
export
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
parent?: PageRoute;
|
|
104
|
-
_component: string;
|
|
105
|
-
component: string;
|
|
106
|
-
children?: PageRoute[];
|
|
107
|
-
}
|
|
108
|
-
>;
|
|
83
|
+
export interface NestedRoute<T = string | (() => JSX.Element)> extends Route {
|
|
84
|
+
type: 'nested';
|
|
85
|
+
parentId?: string;
|
|
86
|
+
data?: string;
|
|
87
|
+
clientData?: string;
|
|
88
|
+
children?: NestedRoute<T>[];
|
|
89
|
+
filename?: string;
|
|
90
|
+
_component?: string;
|
|
91
|
+
component?: T;
|
|
92
|
+
lazyImport?: () => Promise<any>;
|
|
93
|
+
loading?: T;
|
|
94
|
+
error?: T;
|
|
95
|
+
isRoot?: boolean;
|
|
96
|
+
config?: string | Record<string, any>;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface PageRoute extends Route {
|
|
100
|
+
type: 'page';
|
|
101
|
+
parent?: PageRoute;
|
|
102
|
+
_component: string;
|
|
103
|
+
component: string;
|
|
104
|
+
children?: PageRoute[];
|
|
105
|
+
}
|
|
109
106
|
|
|
110
107
|
/**
|
|
111
108
|
* custom html partials.
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.
|
|
18
|
+
"version": "2.56.1",
|
|
19
19
|
"types": "./index.d.ts",
|
|
20
20
|
"exports": {
|
|
21
21
|
".": {
|
|
@@ -39,14 +39,14 @@
|
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@types/babel__core": "^7.20.
|
|
42
|
+
"@types/babel__core": "^7.20.5",
|
|
43
43
|
"@types/jest": "^29",
|
|
44
44
|
"@types/node": "^14",
|
|
45
45
|
"http-proxy-middleware": "^2.0.4",
|
|
46
46
|
"jest": "^29",
|
|
47
47
|
"type-fest": "2.15.0",
|
|
48
|
-
"@scripts/
|
|
49
|
-
"@scripts/
|
|
48
|
+
"@scripts/jest-config": "2.56.1",
|
|
49
|
+
"@scripts/build": "2.56.1"
|
|
50
50
|
},
|
|
51
51
|
"sideEffects": false,
|
|
52
52
|
"publishConfig": {
|
package/server/index.d.ts
CHANGED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/method-signature-style */
|
|
2
|
+
/** Monitor Events */
|
|
3
|
+
export type LogLevel = 'warn' | 'error' | 'debug' | 'info';
|
|
4
|
+
|
|
5
|
+
export interface LogEvent {
|
|
6
|
+
type: 'log';
|
|
7
|
+
payload: {
|
|
8
|
+
level: LogLevel;
|
|
9
|
+
message: string;
|
|
10
|
+
args?: any[];
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface TimingEvent {
|
|
15
|
+
type: 'timing';
|
|
16
|
+
payload: {
|
|
17
|
+
name: string;
|
|
18
|
+
dur: number;
|
|
19
|
+
desc?: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type MonitorEvent = LogEvent | TimingEvent;
|
|
24
|
+
|
|
25
|
+
export type CoreMonitor = (event: MonitorEvent) => void;
|
|
26
|
+
|
|
27
|
+
export interface Monitors {
|
|
28
|
+
push(monitor: CoreMonitor): void;
|
|
29
|
+
|
|
30
|
+
error(message: string, ...args: any[]): void;
|
|
31
|
+
warn(message: string, ...args: any[]): void;
|
|
32
|
+
debug(message: string, ...args: any[]): void;
|
|
33
|
+
info(message: string, ...args: any[]): void;
|
|
34
|
+
|
|
35
|
+
timing(name: string, dur: number, desc?: string): void;
|
|
36
|
+
}
|