@lynx-js/rspeedy 0.8.2 → 0.8.4
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 +44 -0
- package/README.md +2 -2
- package/lib/config/mergeRspeedyConfig.d.ts +36 -0
- package/lib/config/mergeRspeedyConfig.js +42 -0
- package/lib/config/rsbuild/index.js +1 -0
- package/lib/config/server/index.d.ts +22 -0
- package/lib/config/validate.js +1685 -1456
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/plugins/dev.plugin.d.ts +1 -1
- package/lib/plugins/dev.plugin.js +33 -26
- package/package.json +15 -12
package/lib/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
export type { ExposedAPI } from './api.js';
|
|
18
18
|
export { createRspeedy, type RspeedyInstance, type CreateRspeedyOptions, } from './create-rspeedy.js';
|
|
19
19
|
export { logger } from '@rsbuild/core';
|
|
20
|
+
export { mergeRspeedyConfig } from './config/mergeRspeedyConfig.js';
|
|
20
21
|
export { defineConfig } from './config/defineConfig.js';
|
|
21
22
|
export { loadConfig, type LoadConfigOptions, type LoadConfigResult, } from './config/loadConfig.js';
|
|
22
23
|
export type { Config } from './config/index.js';
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { createRspeedy, } from './create-rspeedy.js';
|
|
2
2
|
export { logger } from '@rsbuild/core';
|
|
3
|
+
export { mergeRspeedyConfig } from './config/mergeRspeedyConfig.js';
|
|
3
4
|
// Config
|
|
4
5
|
export { defineConfig } from './config/defineConfig.js';
|
|
5
6
|
export { loadConfig, } from './config/loadConfig.js';
|
|
@@ -2,4 +2,4 @@ import type { RsbuildPlugin } from '@rsbuild/core';
|
|
|
2
2
|
import type { Dev } from '../config/dev/index.js';
|
|
3
3
|
import type { Server } from '../config/server/index.js';
|
|
4
4
|
export declare function pluginDev(options?: Dev, server?: Server): RsbuildPlugin;
|
|
5
|
-
export declare function findIp(family: 'v4' | 'v6'): Promise<string>;
|
|
5
|
+
export declare function findIp(family: 'v4' | 'v6', isInternal?: boolean): Promise<string>;
|
|
@@ -39,6 +39,12 @@ export function pluginDev(options, server) {
|
|
|
39
39
|
break;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
+
if (server?.base) {
|
|
43
|
+
if (assetPrefix.endsWith('/')) {
|
|
44
|
+
assetPrefix = assetPrefix.slice(0, -1);
|
|
45
|
+
}
|
|
46
|
+
assetPrefix = `${assetPrefix}${server.base}/`;
|
|
47
|
+
}
|
|
42
48
|
debug(`dev.assetPrefix is normalized to ${assetPrefix}`);
|
|
43
49
|
api.modifyRsbuildConfig((config, { mergeRsbuildConfig }) => {
|
|
44
50
|
return mergeRsbuildConfig(config, {
|
|
@@ -91,40 +97,41 @@ export function pluginDev(options, server) {
|
|
|
91
97
|
},
|
|
92
98
|
};
|
|
93
99
|
}
|
|
94
|
-
export async function findIp(family) {
|
|
95
|
-
const [{ default:
|
|
96
|
-
import('default-gateway'),
|
|
100
|
+
export async function findIp(family, isInternal = false) {
|
|
101
|
+
const [{ default: ipaddr }, os,] = await Promise.all([
|
|
97
102
|
import('ipaddr.js'),
|
|
98
103
|
import('node:os'),
|
|
99
104
|
]);
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
105
|
+
let host;
|
|
106
|
+
Object.values(os.networkInterfaces())
|
|
107
|
+
.flatMap((networks) => networks ?? [])
|
|
108
|
+
.filter((network) => {
|
|
109
|
+
if (!network || !network.address) {
|
|
110
|
+
return false;
|
|
104
111
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
return gateway;
|
|
112
|
+
if (network.family !== `IP${family}`) {
|
|
113
|
+
return false;
|
|
108
114
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
// Look for the matching interface in all local interfaces.
|
|
112
|
-
for (const addresses of Object.values(os.networkInterfaces())) {
|
|
113
|
-
if (!addresses) {
|
|
114
|
-
continue;
|
|
115
|
+
if (network.internal !== isInternal) {
|
|
116
|
+
return false;
|
|
115
117
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
const net = ipaddr.parseCIDR(cidr);
|
|
121
|
-
if (net[0]
|
|
122
|
-
&& net[0].kind() === gatewayIp.kind()
|
|
123
|
-
&& gatewayIp.match(net)) {
|
|
124
|
-
return net[0].toString();
|
|
118
|
+
if (family === 'v6') {
|
|
119
|
+
const range = ipaddr.parse(network.address).range();
|
|
120
|
+
if (range !== 'ipv4Mapped' && range !== 'uniqueLocal') {
|
|
121
|
+
return false;
|
|
125
122
|
}
|
|
126
123
|
}
|
|
124
|
+
return network.address;
|
|
125
|
+
})
|
|
126
|
+
.forEach((network) => {
|
|
127
|
+
host = network.address;
|
|
128
|
+
if (host.includes(':')) {
|
|
129
|
+
host = `[${host}]`;
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
if (!host) {
|
|
133
|
+
throw new Error(`No valid IP found`);
|
|
127
134
|
}
|
|
128
|
-
|
|
135
|
+
return host;
|
|
129
136
|
}
|
|
130
137
|
//# sourceMappingURL=dev.plugin.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/rspeedy",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"description": "A webpack/rspack-based frontend toolchain for Lynx",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"webpack",
|
|
@@ -8,6 +8,11 @@
|
|
|
8
8
|
"Lynx",
|
|
9
9
|
"ReactLynx"
|
|
10
10
|
],
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/lynx-family/lynx-stack.git",
|
|
14
|
+
"directory": "packages/rspeedy/core"
|
|
15
|
+
},
|
|
11
16
|
"license": "Apache-2.0",
|
|
12
17
|
"author": {
|
|
13
18
|
"name": "Qingyu Wang",
|
|
@@ -43,31 +48,29 @@
|
|
|
43
48
|
"README.md"
|
|
44
49
|
],
|
|
45
50
|
"dependencies": {
|
|
46
|
-
"@microsoft/api-extractor": "7.51.
|
|
47
|
-
"@rsbuild/core": "1.2.
|
|
51
|
+
"@microsoft/api-extractor": "7.51.1",
|
|
52
|
+
"@rsbuild/core": "1.2.19",
|
|
48
53
|
"@rsbuild/plugin-css-minimizer": "1.0.2",
|
|
49
|
-
"@rsdoctor/rspack-plugin": "
|
|
54
|
+
"@rsdoctor/rspack-plugin": "1.0.0-rc.0",
|
|
50
55
|
"chokidar": "^4.0.3",
|
|
51
56
|
"commander": "^13.1.0",
|
|
52
|
-
"default-gateway": "^7.2.2",
|
|
53
57
|
"exit-hook": "^4.0.0",
|
|
54
58
|
"ipaddr.js": "^2.2.0",
|
|
55
59
|
"javascript-stringify": "^2.1.0",
|
|
56
60
|
"picocolors": "^1.1.1",
|
|
57
61
|
"tiny-invariant": "^1.3.3",
|
|
58
|
-
"ts-blank-space": "^0.6.
|
|
62
|
+
"ts-blank-space": "^0.6.1",
|
|
59
63
|
"typia": "7.6.4",
|
|
60
|
-
"@lynx-js/chunk-loading-webpack-plugin": "^0.1.
|
|
61
|
-
"@lynx-js/webpack-dev-transport": "^0.1.
|
|
62
|
-
"@lynx-js/websocket": "^0.0.
|
|
64
|
+
"@lynx-js/chunk-loading-webpack-plugin": "^0.1.7",
|
|
65
|
+
"@lynx-js/webpack-dev-transport": "^0.1.2",
|
|
66
|
+
"@lynx-js/websocket": "^0.0.4"
|
|
63
67
|
},
|
|
64
68
|
"devDependencies": {
|
|
65
69
|
"@rollup/plugin-typescript": "^12.1.2",
|
|
66
70
|
"@rsbuild/webpack": "1.2.3",
|
|
67
|
-
"@types/default-gateway": "^7.2.2",
|
|
68
71
|
"eventemitter3": "^5.0.1",
|
|
69
|
-
"type-fest": "^4.
|
|
70
|
-
"vitest": "^3.0.
|
|
72
|
+
"type-fest": "^4.37.0",
|
|
73
|
+
"vitest": "^3.0.8",
|
|
71
74
|
"webpack": "^5.98.0",
|
|
72
75
|
"@lynx-js/vitest-setup": "0.0.0"
|
|
73
76
|
},
|