@variousjs/various 4.1.3 → 4.3.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/README.md +0 -4
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/loader.js +1 -1
- package/dist/loader.js.map +1 -1
- package/index.d.ts +34 -8
- package/package.json +3 -3
package/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
declare module '@variousjs/various' {
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
ComponentType, FC, ReactNode, RefObject,
|
|
4
|
+
} from 'react'
|
|
3
5
|
|
|
4
6
|
export { default as Nycticorax, Dispatch } from 'nycticorax'
|
|
5
7
|
|
|
@@ -14,10 +16,11 @@ declare module '@variousjs/various' {
|
|
|
14
16
|
'SUBMODULE_NOT_DEFINED' |
|
|
15
17
|
'SUBMODULE_SCRIPT_ERROR' |
|
|
16
18
|
'DISPATCH' |
|
|
17
|
-
'I18N'
|
|
19
|
+
'I18N' | (string & {})
|
|
18
20
|
|
|
19
21
|
export interface ComponentDefaultProps {
|
|
20
22
|
$silent?: boolean,
|
|
23
|
+
$ref?: RefObject<unknown>,
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
export interface VariousError extends Error {
|
|
@@ -39,17 +42,27 @@ declare module '@variousjs/various' {
|
|
|
39
42
|
}) => Promise<any>
|
|
40
43
|
type $postMessage = (event: string, value?: any) => void
|
|
41
44
|
|
|
42
|
-
|
|
45
|
+
interface $logger {
|
|
46
|
+
info: (message: any, type?: string) => void,
|
|
47
|
+
warn: (message: any, type?: string) => void,
|
|
48
|
+
error: (message: any, type?: string) => void,
|
|
49
|
+
}
|
|
43
50
|
|
|
44
|
-
export type
|
|
51
|
+
export type Intl = (
|
|
52
|
+
key: string,
|
|
53
|
+
paramsOrDefaultText?: Record<string, string | number> | string,
|
|
54
|
+
defaultText?: string,
|
|
55
|
+
) => string
|
|
45
56
|
|
|
46
57
|
export type PublicAction = (value: any, trigger: ModuleDefined) => any
|
|
47
58
|
|
|
48
|
-
export
|
|
59
|
+
export interface I18nConfig {
|
|
49
60
|
localeKey: string,
|
|
50
61
|
resources: Record<string, Record<string, string>>,
|
|
51
62
|
}
|
|
52
63
|
|
|
64
|
+
export type I18n = () => I18nConfig | Promise<I18nConfig>
|
|
65
|
+
|
|
53
66
|
export type OnMessage = (message: Message) => void
|
|
54
67
|
|
|
55
68
|
export interface StaticProps {
|
|
@@ -66,6 +79,7 @@ declare module '@variousjs/various' {
|
|
|
66
79
|
$dispatch: $dispatch,
|
|
67
80
|
$postMessage: $postMessage,
|
|
68
81
|
$t: Intl,
|
|
82
|
+
$logger: $logger,
|
|
69
83
|
} & P
|
|
70
84
|
|
|
71
85
|
export type ComponentNode<
|
|
@@ -118,10 +132,18 @@ declare module '@variousjs/various' {
|
|
|
118
132
|
beenLoaded: boolean,
|
|
119
133
|
}
|
|
120
134
|
|
|
135
|
+
type LogLevel = 'info' | 'warn' | 'error'
|
|
136
|
+
interface LogArgs extends ModuleDefined {
|
|
137
|
+
level: LogLevel,
|
|
138
|
+
type?: string,
|
|
139
|
+
message: any,
|
|
140
|
+
}
|
|
141
|
+
|
|
121
142
|
export type MessageEvent = (e: MessageEventArgs) => Promise<MessageEventRes> | MessageEventRes
|
|
122
143
|
export type DispatchEvent = (e: DispatchEventArgs) => Promise<DispatchEventRes> | DispatchEventRes
|
|
123
144
|
export type LoadEvent = (e: LoadEventArgs) => void
|
|
124
145
|
export type ErrorEvent = (e: VariousError) => void
|
|
146
|
+
export type LogEvent = (e: LogArgs) => boolean
|
|
125
147
|
|
|
126
148
|
export interface App<S extends object = ObjectAny> {
|
|
127
149
|
store?: readonly S,
|
|
@@ -134,17 +156,20 @@ declare module '@variousjs/various' {
|
|
|
134
156
|
onError?: ErrorEvent,
|
|
135
157
|
onMessage?: MessageEvent,
|
|
136
158
|
onDispatch?: DispatchEvent,
|
|
159
|
+
onLog?: LogEvent,
|
|
137
160
|
},
|
|
161
|
+
i18n?: I18n,
|
|
138
162
|
}
|
|
139
163
|
|
|
140
164
|
export interface Config {
|
|
141
165
|
dependencies: {
|
|
142
166
|
app: string,
|
|
143
167
|
'@variousjs/various'?: string,
|
|
168
|
+
react?: string,
|
|
169
|
+
'react-dom'?: string,
|
|
144
170
|
[x: string]: string,
|
|
145
171
|
},
|
|
146
172
|
root?: string,
|
|
147
|
-
env?: ENV,
|
|
148
173
|
timeout?: number,
|
|
149
174
|
earlyParallelDependencies?: string[],
|
|
150
175
|
}
|
|
@@ -167,7 +192,7 @@ declare module '@variousjs/various' {
|
|
|
167
192
|
target: Element | null,
|
|
168
193
|
renderNode?: (children: ReactNode) => ReactNode,
|
|
169
194
|
onMounted?: () => void,
|
|
170
|
-
}): () => void
|
|
195
|
+
}): () => Promise<void>
|
|
171
196
|
|
|
172
197
|
export const isDependencyLoaded: (name: string) => boolean
|
|
173
198
|
export const getMountedComponents: () => ModuleDefined[]
|
|
@@ -177,10 +202,11 @@ declare module '@variousjs/various' {
|
|
|
177
202
|
) => () => void
|
|
178
203
|
export const defineDependencies: (deps: Record<string, string>) => void
|
|
179
204
|
|
|
180
|
-
export const
|
|
205
|
+
export const version: string
|
|
181
206
|
export function getConfig<C extends object = ObjectAny>(): C
|
|
182
207
|
export function getStore<S extends object = ObjectAny>(): S
|
|
183
208
|
|
|
184
209
|
export const createDispatch: (m: ModuleDefined) => $dispatch
|
|
185
210
|
export const createPostMessage: (m: ModuleDefined) => $postMessage
|
|
211
|
+
export const createLogger: (m: ModuleDefined) => $logger
|
|
186
212
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@variousjs/various",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"description": "RequireJS(AMD) + React",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@babel/preset-env": "^7.22.9",
|
|
49
49
|
"@babel/preset-react": "^7.18.6",
|
|
50
50
|
"@babel/preset-typescript": "^7.18.6",
|
|
51
|
-
"@babel/runtime": "^7.
|
|
51
|
+
"@babel/runtime": "^7.28.2",
|
|
52
52
|
"@cypress/code-coverage": "^3.10.0",
|
|
53
53
|
"@types/react": "^18.0.15",
|
|
54
54
|
"@types/react-dom": "^18.0.6",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
70
70
|
"start-server-and-test": "^2.0.3",
|
|
71
71
|
"typescript": "^4.9.5",
|
|
72
|
-
"webpack": "^5.
|
|
72
|
+
"webpack": "^5.101.0",
|
|
73
73
|
"webpack-bundle-analyzer": "^4.6.1",
|
|
74
74
|
"webpack-cli": "^4.10.0",
|
|
75
75
|
"webpack-dev-server": "^4.9.3"
|