@rollipop/core 0.1.0-alpha.1 → 0.1.0-alpha.2
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/CHANGELOG.md +11 -0
- package/dist/{chunk-BYW8Mqxw.js → chunk-DJulfCLt.js} +2 -1
- package/dist/hmr-client.cjs +3 -0
- package/dist/index.cjs +2427 -46
- package/dist/index.d.cts +184 -77
- package/dist/index.d.ts +187 -78
- package/dist/index.js +2413 -44
- package/dist/runtime.cjs +18 -0
- package/dist/runtime.d.cts +55 -0
- package/dist/runtime.d.ts +55 -0
- package/dist/runtime.js +17 -0
- package/package.json +24 -3
package/dist/runtime.cjs
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/runtime.ts
|
|
3
|
+
/**
|
|
4
|
+
* Set a custom HMR handler.
|
|
5
|
+
*
|
|
6
|
+
* @param handler - The custom HMR handler to set.
|
|
7
|
+
*/
|
|
8
|
+
function setCustomHMRHandler(handler) {
|
|
9
|
+
if (__DEV__) {
|
|
10
|
+
if (__ROLLIPOP_GLOBAL__.__ROLLIPOP_CUSTOM_HMR_HANDLER__ != null) {
|
|
11
|
+
console.warn("Custom HMR handler already set. replacing existing handler.");
|
|
12
|
+
}
|
|
13
|
+
__ROLLIPOP_GLOBAL__.__ROLLIPOP_CUSTOM_HMR_HANDLER__ = handler;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
exports.setCustomHMRHandler = setCustomHMRHandler;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
//#region src/types/hmr.d.ts
|
|
2
|
+
type HMRClientLogLevel = 'trace' | 'info' | 'warn' | 'error' | 'log' | 'group' | 'groupCollapsed' | 'groupEnd' | 'debug';
|
|
3
|
+
type HMRClientMessage = {
|
|
4
|
+
type: 'hmr:connected';
|
|
5
|
+
bundleEntry: string;
|
|
6
|
+
platform: string;
|
|
7
|
+
} | {
|
|
8
|
+
type: 'hmr:module-registered';
|
|
9
|
+
modules: string[];
|
|
10
|
+
} | {
|
|
11
|
+
type: 'hmr:log';
|
|
12
|
+
level: HMRClientLogLevel;
|
|
13
|
+
data: any[];
|
|
14
|
+
} | {
|
|
15
|
+
type: 'hmr:invalidate';
|
|
16
|
+
moduleId: string;
|
|
17
|
+
};
|
|
18
|
+
type HMRServerMessage = {
|
|
19
|
+
type: 'hmr:update-start';
|
|
20
|
+
} | {
|
|
21
|
+
type: 'hmr:update-done';
|
|
22
|
+
} | {
|
|
23
|
+
type: 'hmr:update';
|
|
24
|
+
code: string;
|
|
25
|
+
} | {
|
|
26
|
+
type: 'hmr:reload';
|
|
27
|
+
} | {
|
|
28
|
+
type: 'hmr:error';
|
|
29
|
+
payload: HMRServerError;
|
|
30
|
+
};
|
|
31
|
+
type HMRCustomServerMessage = {
|
|
32
|
+
type: string;
|
|
33
|
+
payload: unknown;
|
|
34
|
+
};
|
|
35
|
+
type HMRCustomHandler = (message: HMRCustomServerMessage) => void;
|
|
36
|
+
interface HMRServerError {
|
|
37
|
+
type: string;
|
|
38
|
+
message: string;
|
|
39
|
+
errors: {
|
|
40
|
+
description: string;
|
|
41
|
+
}[];
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/runtime.d.ts
|
|
45
|
+
declare global {
|
|
46
|
+
var __ROLLIPOP_CUSTOM_HMR_HANDLER__: HMRCustomHandler | undefined;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Set a custom HMR handler.
|
|
50
|
+
*
|
|
51
|
+
* @param handler - The custom HMR handler to set.
|
|
52
|
+
*/
|
|
53
|
+
declare function setCustomHMRHandler(handler: HMRCustomHandler): void;
|
|
54
|
+
//#endregion
|
|
55
|
+
export { setCustomHMRHandler };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
//#region src/types/hmr.d.ts
|
|
2
|
+
type HMRClientLogLevel = 'trace' | 'info' | 'warn' | 'error' | 'log' | 'group' | 'groupCollapsed' | 'groupEnd' | 'debug';
|
|
3
|
+
type HMRClientMessage = {
|
|
4
|
+
type: 'hmr:connected';
|
|
5
|
+
bundleEntry: string;
|
|
6
|
+
platform: string;
|
|
7
|
+
} | {
|
|
8
|
+
type: 'hmr:module-registered';
|
|
9
|
+
modules: string[];
|
|
10
|
+
} | {
|
|
11
|
+
type: 'hmr:log';
|
|
12
|
+
level: HMRClientLogLevel;
|
|
13
|
+
data: any[];
|
|
14
|
+
} | {
|
|
15
|
+
type: 'hmr:invalidate';
|
|
16
|
+
moduleId: string;
|
|
17
|
+
};
|
|
18
|
+
type HMRServerMessage = {
|
|
19
|
+
type: 'hmr:update-start';
|
|
20
|
+
} | {
|
|
21
|
+
type: 'hmr:update-done';
|
|
22
|
+
} | {
|
|
23
|
+
type: 'hmr:update';
|
|
24
|
+
code: string;
|
|
25
|
+
} | {
|
|
26
|
+
type: 'hmr:reload';
|
|
27
|
+
} | {
|
|
28
|
+
type: 'hmr:error';
|
|
29
|
+
payload: HMRServerError;
|
|
30
|
+
};
|
|
31
|
+
type HMRCustomServerMessage = {
|
|
32
|
+
type: string;
|
|
33
|
+
payload: unknown;
|
|
34
|
+
};
|
|
35
|
+
type HMRCustomHandler = (message: HMRCustomServerMessage) => void;
|
|
36
|
+
interface HMRServerError {
|
|
37
|
+
type: string;
|
|
38
|
+
message: string;
|
|
39
|
+
errors: {
|
|
40
|
+
description: string;
|
|
41
|
+
}[];
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/runtime.d.ts
|
|
45
|
+
declare global {
|
|
46
|
+
var __ROLLIPOP_CUSTOM_HMR_HANDLER__: HMRCustomHandler | undefined;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Set a custom HMR handler.
|
|
50
|
+
*
|
|
51
|
+
* @param handler - The custom HMR handler to set.
|
|
52
|
+
*/
|
|
53
|
+
declare function setCustomHMRHandler(handler: HMRCustomHandler): void;
|
|
54
|
+
//#endregion
|
|
55
|
+
export { setCustomHMRHandler };
|
package/dist/runtime.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/runtime.ts
|
|
2
|
+
/**
|
|
3
|
+
* Set a custom HMR handler.
|
|
4
|
+
*
|
|
5
|
+
* @param handler - The custom HMR handler to set.
|
|
6
|
+
*/
|
|
7
|
+
function setCustomHMRHandler(handler) {
|
|
8
|
+
if (__DEV__) {
|
|
9
|
+
if (__ROLLIPOP_GLOBAL__.__ROLLIPOP_CUSTOM_HMR_HANDLER__ != null) {
|
|
10
|
+
console.warn("Custom HMR handler already set. replacing existing handler.");
|
|
11
|
+
}
|
|
12
|
+
__ROLLIPOP_GLOBAL__.__ROLLIPOP_CUSTOM_HMR_HANDLER__ = handler;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
export { setCustomHMRHandler };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rollipop/core",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -16,6 +16,16 @@
|
|
|
16
16
|
"default": "./dist/index.cjs"
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
|
+
"./runtime": {
|
|
20
|
+
"import": {
|
|
21
|
+
"types": "./dist/runtime.d.ts",
|
|
22
|
+
"default": "./dist/runtime.js"
|
|
23
|
+
},
|
|
24
|
+
"require": {
|
|
25
|
+
"types": "./dist/runtime.d.cts",
|
|
26
|
+
"default": "./dist/runtime.cjs"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
19
29
|
"./hmr-runtime": "./dist/hmr-runtime.js",
|
|
20
30
|
"./hmr-client": "./dist/hmr-client.cjs",
|
|
21
31
|
"./package.json": "./package.json"
|
|
@@ -45,23 +55,34 @@
|
|
|
45
55
|
"@babel/generator": "^7.28.5",
|
|
46
56
|
"@babel/plugin-syntax-typescript": "^7.27.1",
|
|
47
57
|
"@babel/plugin-transform-flow-strip-types": "^7.27.1",
|
|
58
|
+
"@fastify/middie": "^9.0.3",
|
|
48
59
|
"@jridgewell/remapping": "^2.3.5",
|
|
49
60
|
"@node-rs/xxhash": "^1.7.6",
|
|
61
|
+
"@react-native-community/cli-server-api": "^20.0.2",
|
|
50
62
|
"@react-native/babel-plugin-codegen": "^0.83.1",
|
|
63
|
+
"@react-native/dev-middleware": "^0.83.1",
|
|
51
64
|
"@rolldown/pluginutils": "1.0.0-beta.56",
|
|
52
|
-
"@rollipop/common": "0.1.0-alpha.
|
|
65
|
+
"@rollipop/common": "0.1.0-alpha.2",
|
|
53
66
|
"@svgr/core": "^8.1.0",
|
|
54
67
|
"@svgr/plugin-jsx": "^8.1.0",
|
|
55
68
|
"@swc/core": "^1.15.7",
|
|
69
|
+
"ajv": "^8.17.1",
|
|
56
70
|
"babel-plugin-syntax-hermes-parser": "^0.33.0",
|
|
57
71
|
"c12": "^3.3.3",
|
|
58
72
|
"dedent": "^1.7.1",
|
|
59
73
|
"es-toolkit": "1.43.0",
|
|
74
|
+
"fastify": "^5.6.2",
|
|
75
|
+
"fastify-plugin": "^5.1.0",
|
|
60
76
|
"flow-remove-types": "^2.295.0",
|
|
61
77
|
"hermes-parser": "^0.33.0",
|
|
62
78
|
"image-size": "^2.0.2",
|
|
79
|
+
"json-schema-to-ts": "^3.1.1",
|
|
80
|
+
"mime": "^4.1.0",
|
|
63
81
|
"rolldown": "1.0.0-beta.56",
|
|
64
|
-
"
|
|
82
|
+
"source-map": "^0.7.6",
|
|
83
|
+
"url": "^0.11.4",
|
|
84
|
+
"wrap-ansi": "^9.0.2",
|
|
85
|
+
"ws": "^8.18.3"
|
|
65
86
|
},
|
|
66
87
|
"devDependencies": {
|
|
67
88
|
"@babel/code-frame": "^7.27.1",
|