@rpack-dev/core 0.1.20-e0d3509 → 0.1.20
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 +3 -1
- package/dist/docs.json +7218 -6348
- package/dist/rpack-core-esm.bundle.js +1 -1
- package/dist/rpack-core-umd.bundle.js +1 -1
- package/dist/rpack-core.d.ts +86 -1
- package/package.json +3 -2
package/dist/rpack-core.d.ts
CHANGED
|
@@ -42,7 +42,18 @@ declare class RPack {
|
|
|
42
42
|
* @return an RPVersion instance
|
|
43
43
|
*/
|
|
44
44
|
getVersion(): RPVersion;
|
|
45
|
+
/**
|
|
46
|
+
* Returns the current ProxyManager instance.
|
|
47
|
+
*
|
|
48
|
+
* This class is used when dealing with proxied objects
|
|
49
|
+
* across threads and the network.
|
|
50
|
+
*/
|
|
45
51
|
getProxyManager(): ProxyManager;
|
|
52
|
+
/**
|
|
53
|
+
* Returns the current RegistryManager instance.
|
|
54
|
+
*
|
|
55
|
+
* This class is used when dealing with Registries.
|
|
56
|
+
*/
|
|
46
57
|
getRegistryManager(): RegistryManager;
|
|
47
58
|
getPluginManager(): PluginManager;
|
|
48
59
|
getNetworkManager(): NetworkManager;
|
|
@@ -381,7 +392,7 @@ export declare class NetworkManager {
|
|
|
381
392
|
private threadId;
|
|
382
393
|
private readonly wellKnownMap;
|
|
383
394
|
private readonly wellKnownReverseMap;
|
|
384
|
-
constructor(rpack: RPack
|
|
395
|
+
constructor(rpack: RPack);
|
|
385
396
|
private mapWellKnown;
|
|
386
397
|
__initPlugin(pluginKey: string, scriptUrl: string): Promise<void>;
|
|
387
398
|
getRPack(): RPack;
|
|
@@ -428,7 +439,31 @@ export declare class RPPlugin {
|
|
|
428
439
|
* @return the RPack instance
|
|
429
440
|
*/
|
|
430
441
|
getRPack(): RPack;
|
|
442
|
+
/**
|
|
443
|
+
* This lifecycle method is called when this plugin is initialized in any environment.
|
|
444
|
+
* Note that this method runs before environment-specific methods.
|
|
445
|
+
* @see onInitHost
|
|
446
|
+
* @see onInitClient
|
|
447
|
+
*/
|
|
431
448
|
onInit(): Promise<void>;
|
|
449
|
+
/**
|
|
450
|
+
* This lifecycle method is called when this plugin is initialized in a client environment.
|
|
451
|
+
* Note that this method runs after the generic {@link onInit} finishes executing.
|
|
452
|
+
*/
|
|
453
|
+
onInitClient(): Promise<void>;
|
|
454
|
+
/**
|
|
455
|
+
* This lifecycle method is called when this plugin is initialized in a host environment.
|
|
456
|
+
* Note that this method runs after the generic {@link onInit} finishes executing.
|
|
457
|
+
*/
|
|
458
|
+
onInitHost(): Promise<void>;
|
|
459
|
+
/**
|
|
460
|
+
* This lifecycle method is called when this plugin is requested to shut down.
|
|
461
|
+
*
|
|
462
|
+
* By default, the plugin will only unload after this method
|
|
463
|
+
* finishes executing. However, if this method is taking too
|
|
464
|
+
* long to finish, the user can choose to terminate the plugin,
|
|
465
|
+
* which will cause the execution to immediately halt.
|
|
466
|
+
*/
|
|
432
467
|
onShutdown(): Promise<void>;
|
|
433
468
|
/**
|
|
434
469
|
* Internal method, do not use.
|
|
@@ -817,6 +852,11 @@ export declare namespace Registry {
|
|
|
817
852
|
function withDefaultOptions(options?: Partial<RegistryOptions>): RegistryOptions;
|
|
818
853
|
function withPublicDefaultOptions(options?: Partial<RegistryOptions>): PublicRegistryOptions;
|
|
819
854
|
}
|
|
855
|
+
export interface C2HHelloRequestPacket extends NoncePacket {
|
|
856
|
+
id: "host:hello_request";
|
|
857
|
+
name: string;
|
|
858
|
+
secret: string;
|
|
859
|
+
}
|
|
820
860
|
export interface C2PHelloRequestPacket extends NoncePacket {
|
|
821
861
|
id: "thread:hello_request";
|
|
822
862
|
threadId: string;
|
|
@@ -873,12 +913,49 @@ export interface DevPluginSourceServerManifest {
|
|
|
873
913
|
};
|
|
874
914
|
websocketRefresh?: boolean;
|
|
875
915
|
}
|
|
916
|
+
/**
|
|
917
|
+
* This class gives some information about the current environment the rPack.dev instance is running in.
|
|
918
|
+
*/
|
|
876
919
|
export interface EnvironmentInfo {
|
|
920
|
+
/**
|
|
921
|
+
* Returns whether the current thread is a plugin thread.
|
|
922
|
+
*/
|
|
877
923
|
isPluginThread(): boolean;
|
|
924
|
+
/**
|
|
925
|
+
* Returns whether this environment is a host.
|
|
926
|
+
*/
|
|
878
927
|
isHost(): boolean;
|
|
928
|
+
/**
|
|
929
|
+
* Returns whether this environment is a client.
|
|
930
|
+
*/
|
|
879
931
|
isClient(): boolean;
|
|
932
|
+
/**
|
|
933
|
+
* Returns the type of environment the current rPack.dev instance is.
|
|
934
|
+
*/
|
|
880
935
|
getEnvironmentType(): EnvironmentType;
|
|
936
|
+
/**
|
|
937
|
+
* Returns the current Thread ID.
|
|
938
|
+
*/
|
|
881
939
|
getThreadId(): string;
|
|
940
|
+
/**
|
|
941
|
+
* Returns the Messenger instance used to
|
|
942
|
+
* communicate with the current core thread.
|
|
943
|
+
*
|
|
944
|
+
* This only works on plugin threads, otherwise returns null.
|
|
945
|
+
*/
|
|
946
|
+
getCoreMessenger(): Messenger<C2PPackets, P2CPackets> | null;
|
|
947
|
+
/**
|
|
948
|
+
* Returns the Messenger interface used to
|
|
949
|
+
* communicate with the current host.
|
|
950
|
+
*
|
|
951
|
+
* If there is no host connected (no project is open),
|
|
952
|
+
* this method will return null.
|
|
953
|
+
*/
|
|
954
|
+
getHostMessenger(): Messenger<H2CPackets, C2HPackets> | null;
|
|
955
|
+
}
|
|
956
|
+
export interface H2CHelloResponsePacket extends NoncePacket {
|
|
957
|
+
id: "host:hello_response";
|
|
958
|
+
accepted: boolean;
|
|
882
959
|
}
|
|
883
960
|
export interface MessageTarget<T = any> {
|
|
884
961
|
postMessage(message: any, options?: {
|
|
@@ -1006,6 +1083,8 @@ export interface ProxyRefreshObjectResponsePacket extends NoncePacket {
|
|
|
1006
1083
|
value?: SerializedData;
|
|
1007
1084
|
error?: SerializedData;
|
|
1008
1085
|
}
|
|
1086
|
+
export interface RPackHost {
|
|
1087
|
+
}
|
|
1009
1088
|
export interface Registry<Data, Key extends JSONLike = string> extends RegistryBase {
|
|
1010
1089
|
get(key: Key): Promise<RegistryDataFiltered<Data> | undefined>;
|
|
1011
1090
|
getEntry(key: Key): Promise<RegistryEntry<Data, Key> | undefined>;
|
|
@@ -1203,6 +1282,9 @@ export type BatchResult<T> = {
|
|
|
1203
1282
|
done: boolean;
|
|
1204
1283
|
values: T[];
|
|
1205
1284
|
};
|
|
1285
|
+
export type C2HPackets = {
|
|
1286
|
+
"host:hello_request": C2HHelloRequestPacket;
|
|
1287
|
+
} & ProxyPackets & RegistryPackets;
|
|
1206
1288
|
export type C2PPackets = {
|
|
1207
1289
|
"thread:hello_request": C2PHelloRequestPacket;
|
|
1208
1290
|
"thread:shutdown_request": C2PShutdownRequestPacket;
|
|
@@ -1237,6 +1319,9 @@ export type FixedLengthArray<T, L extends number, TObj = [
|
|
|
1237
1319
|
[I: number]: T;
|
|
1238
1320
|
[Symbol.iterator]: () => IterableIterator<T>;
|
|
1239
1321
|
};
|
|
1322
|
+
export type H2CPackets = {
|
|
1323
|
+
"host:hello_response": H2CHelloResponsePacket;
|
|
1324
|
+
} & ProxyPackets & RegistryPackets;
|
|
1240
1325
|
export type JSONLike = string | number | boolean | null | {
|
|
1241
1326
|
[key: string]: JSONLike;
|
|
1242
1327
|
} | JSONLike[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rpack-dev/core",
|
|
3
|
-
"version": "0.1.20
|
|
3
|
+
"version": "0.1.20",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "LGPL-3.0-or-later",
|
|
6
6
|
"repository": {
|
|
@@ -52,7 +52,8 @@
|
|
|
52
52
|
"typescript": "^5.0.0",
|
|
53
53
|
"webpack": "^5.90.3",
|
|
54
54
|
"webpack-cli": "^5.1.4",
|
|
55
|
-
"webpack-define-config": "^0.0.1"
|
|
55
|
+
"webpack-define-config": "^0.0.1",
|
|
56
|
+
"@rpack-dev/webpack-plugin": "^0.5.6"
|
|
56
57
|
},
|
|
57
58
|
"dependencies": {
|
|
58
59
|
"jszip": "^3.10.1"
|