@lynx-js/rspeedy 0.14.2 → 0.14.3
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 +29 -0
- package/dist/0~src_config_validate_ts.js +2229 -2449
- package/dist/0~src_plugins_dev_plugin_ts.js +30 -4
- package/dist/1~src_cli_init_ts-src_create-rspeedy_ts.js +3 -0
- package/dist/1~src_config_validate_ts.js +2229 -2449
- package/dist/1~src_plugins_dev_plugin_ts.js +30 -4
- package/dist/index.d.ts +56 -2
- package/dist/src_cli_main_ts.js +1 -1
- package/dist/src_index_ts.js +4 -1
- package/package.json +4 -3
|
@@ -162,7 +162,10 @@ async function findIp(family, isInternal = false) {
|
|
|
162
162
|
import("node:os")
|
|
163
163
|
]);
|
|
164
164
|
let host;
|
|
165
|
-
const networks = Object.
|
|
165
|
+
const networks = Object.entries(os.networkInterfaces()).flatMap(([name, networks])=>(networks ?? []).map((network)=>({
|
|
166
|
+
name,
|
|
167
|
+
network
|
|
168
|
+
}))).filter(({ network })=>{
|
|
166
169
|
if (!network || !network.address) return false;
|
|
167
170
|
if (network.family !== `IP${family}`) return false;
|
|
168
171
|
if (network.internal !== isInternal) return false;
|
|
@@ -170,13 +173,36 @@ async function findIp(family, isInternal = false) {
|
|
|
170
173
|
const range = ipaddr.parse(network.address).range();
|
|
171
174
|
if ('ipv4Mapped' !== range && 'uniqueLocal' !== range) return false;
|
|
172
175
|
}
|
|
173
|
-
return
|
|
174
|
-
});
|
|
176
|
+
return true;
|
|
177
|
+
}).sort((left, right)=>getNetworkPriority(left.name, left.network.address) - getNetworkPriority(right.name, right.network.address));
|
|
175
178
|
if (networks.length > 0) {
|
|
176
|
-
host = networks[0].address;
|
|
179
|
+
host = networks[0].network.address;
|
|
177
180
|
if (host.includes(':')) host = `[${host}]`;
|
|
178
181
|
}
|
|
179
182
|
if (!host) throw new Error("No valid IP found");
|
|
180
183
|
return host;
|
|
181
184
|
}
|
|
185
|
+
function getNetworkPriority(name, address) {
|
|
186
|
+
const normalizedName = name.toLowerCase();
|
|
187
|
+
if (isPreferredInterface(normalizedName) && !isLinkLocalIpv4(address)) return 0;
|
|
188
|
+
if (!isVirtualInterface(normalizedName) && !isLinkLocalIpv4(address)) return 1;
|
|
189
|
+
if (!isVirtualInterface(normalizedName)) return 2;
|
|
190
|
+
return 3;
|
|
191
|
+
}
|
|
192
|
+
function isPreferredInterface(name) {
|
|
193
|
+
return /^(?:en\d+|eth\d+|eno\d+|enp\w+|wl\w+)$/.test(name);
|
|
194
|
+
}
|
|
195
|
+
function isVirtualInterface(name) {
|
|
196
|
+
return [
|
|
197
|
+
'utun',
|
|
198
|
+
'tun',
|
|
199
|
+
'tap',
|
|
200
|
+
'awdl',
|
|
201
|
+
'llw',
|
|
202
|
+
'lo'
|
|
203
|
+
].some((prefix)=>name.startsWith(prefix));
|
|
204
|
+
}
|
|
205
|
+
function isLinkLocalIpv4(address) {
|
|
206
|
+
return address.startsWith('169.254.');
|
|
207
|
+
}
|
|
182
208
|
export { pluginDev };
|
package/dist/index.d.ts
CHANGED
|
@@ -20,8 +20,10 @@ import type { CreateRsbuildOptions } from '@rsbuild/core';
|
|
|
20
20
|
import type { DataUriLimit } from '@rsbuild/core';
|
|
21
21
|
import type { DistPathConfig } from '@rsbuild/core';
|
|
22
22
|
import type { InlineChunkConfig } from '@rsbuild/core';
|
|
23
|
+
import type { Linter } from '@rsdoctor/types';
|
|
23
24
|
import { logger } from '@rsbuild/core';
|
|
24
25
|
import type { PerformanceConfig } from '@rsbuild/core';
|
|
26
|
+
import type { Plugin } from '@rsdoctor/types';
|
|
25
27
|
import type { ProxyConfig } from '@rsbuild/core';
|
|
26
28
|
import type { RsbuildConfig } from '@rsbuild/core';
|
|
27
29
|
import type { RsbuildInstance } from '@rsbuild/core';
|
|
@@ -29,7 +31,6 @@ import { RsbuildPlugin } from '@rsbuild/core';
|
|
|
29
31
|
import { RsbuildPluginAPI } from '@rsbuild/core';
|
|
30
32
|
import type { RsbuildPlugins } from '@rsbuild/core';
|
|
31
33
|
import { version as rsbuildVersion } from '@rsbuild/core';
|
|
32
|
-
import type { RsdoctorRspackPlugin } from '@rsdoctor/rspack-plugin';
|
|
33
34
|
import { Rspack } from '@rsbuild/core';
|
|
34
35
|
import { rspack } from '@rsbuild/core';
|
|
35
36
|
import type { ServerConfig } from '@rsbuild/core';
|
|
@@ -2775,7 +2776,36 @@ export { RsbuildPluginAPI }
|
|
|
2775
2776
|
|
|
2776
2777
|
export { rsbuildVersion }
|
|
2777
2778
|
|
|
2778
|
-
|
|
2779
|
+
declare interface RsdoctorRspackPluginExperiments {
|
|
2780
|
+
/**
|
|
2781
|
+
* Whether to enable the native plugin to improve the performance.
|
|
2782
|
+
* @default true
|
|
2783
|
+
*/
|
|
2784
|
+
enableNativePlugin?: boolean;
|
|
2785
|
+
}
|
|
2786
|
+
|
|
2787
|
+
/**
|
|
2788
|
+
* Simplified options type for `tools.rsdoctor`.
|
|
2789
|
+
*
|
|
2790
|
+
* Keep this type free of deeply nested/intersection utility types to ensure
|
|
2791
|
+
* typia can generate validators from `Config`.
|
|
2792
|
+
*
|
|
2793
|
+
* @public
|
|
2794
|
+
*/
|
|
2795
|
+
export declare interface RsdoctorRspackPluginOptions extends Omit<RsdoctorRspackPluginOptions_2<[]>, 'linter'> {
|
|
2796
|
+
linter?: {
|
|
2797
|
+
rules?: Record<string, unknown>;
|
|
2798
|
+
level?: 'Ignore' | 'Warn' | 'Error';
|
|
2799
|
+
extends?: unknown[];
|
|
2800
|
+
};
|
|
2801
|
+
}
|
|
2802
|
+
|
|
2803
|
+
declare interface RsdoctorRspackPluginOptions_2<Rules extends Linter.ExtendRuleData[]> extends Plugin.RsdoctorWebpackPluginOptions<Rules> {
|
|
2804
|
+
/**
|
|
2805
|
+
* The experiments of the Rsdoctor Rspack plugin.
|
|
2806
|
+
*/
|
|
2807
|
+
experiments?: RsdoctorRspackPluginExperiments;
|
|
2808
|
+
}
|
|
2779
2809
|
|
|
2780
2810
|
export { Rspack }
|
|
2781
2811
|
|
|
@@ -3500,6 +3530,30 @@ export declare interface SourceMap {
|
|
|
3500
3530
|
* ```
|
|
3501
3531
|
*/
|
|
3502
3532
|
js?: Rspack.DevTool | undefined | `${Exclude<Rspack.DevTool, false | 'eval'>}-debugids`;
|
|
3533
|
+
/**
|
|
3534
|
+
* Whether to generate CSS source maps.
|
|
3535
|
+
*
|
|
3536
|
+
* @remarks
|
|
3537
|
+
*
|
|
3538
|
+
* Defaults to `true`.
|
|
3539
|
+
*
|
|
3540
|
+
* @example
|
|
3541
|
+
*
|
|
3542
|
+
* Disable CSS sourcemap.
|
|
3543
|
+
*
|
|
3544
|
+
* ```js
|
|
3545
|
+
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
3546
|
+
*
|
|
3547
|
+
* export default defineConfig({
|
|
3548
|
+
* output: {
|
|
3549
|
+
* sourceMap: {
|
|
3550
|
+
* css: false,
|
|
3551
|
+
* },
|
|
3552
|
+
* },
|
|
3553
|
+
* })
|
|
3554
|
+
* ```
|
|
3555
|
+
*/
|
|
3556
|
+
css?: boolean | undefined;
|
|
3503
3557
|
}
|
|
3504
3558
|
|
|
3505
3559
|
/**
|
package/dist/src_cli_main_ts.js
CHANGED
|
@@ -192,7 +192,7 @@ async function exit_onExit(signal) {
|
|
|
192
192
|
await Promise.allSettled(exitPromises);
|
|
193
193
|
}
|
|
194
194
|
var package_namespaceObject = {
|
|
195
|
-
rE: "0.14.
|
|
195
|
+
rE: "0.14.3"
|
|
196
196
|
};
|
|
197
197
|
const version_version = package_namespaceObject.rE;
|
|
198
198
|
const rspackVersion = rspack.rspackVersion;
|
package/dist/src_index_ts.js
CHANGED
|
@@ -104,6 +104,9 @@ function applyDefaultRspeedyConfig(config) {
|
|
|
104
104
|
})(),
|
|
105
105
|
output: {
|
|
106
106
|
filename: getFilename(config.output?.filename),
|
|
107
|
+
sourceMap: {
|
|
108
|
+
css: true
|
|
109
|
+
},
|
|
107
110
|
inlineScripts: !enableChunkSplitting,
|
|
108
111
|
cssModules: {
|
|
109
112
|
localIdentName: '[local]-[hash:base64:6]'
|
|
@@ -374,7 +377,7 @@ function isDeno() {
|
|
|
374
377
|
return false;
|
|
375
378
|
}
|
|
376
379
|
var package_namespaceObject = {
|
|
377
|
-
rE: "0.14.
|
|
380
|
+
rE: "0.14.3"
|
|
378
381
|
};
|
|
379
382
|
const version_version = package_namespaceObject.rE;
|
|
380
383
|
const rspackVersion = rspack.rspackVersion;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/rspeedy",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.3",
|
|
4
4
|
"description": "A webpack/rspack-based frontend toolchain for Lynx",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"webpack",
|
|
@@ -50,16 +50,17 @@
|
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@rsbuild/core": "1.7.5",
|
|
52
52
|
"@rsbuild/plugin-css-minimizer": "1.1.1",
|
|
53
|
-
"@rsdoctor/rspack-plugin": "1.
|
|
53
|
+
"@rsdoctor/rspack-plugin": "~1.5.6",
|
|
54
54
|
"@lynx-js/cache-events-webpack-plugin": "^0.0.3",
|
|
55
55
|
"@lynx-js/chunk-loading-webpack-plugin": "^0.3.3",
|
|
56
|
-
"@lynx-js/web-rsbuild-server-middleware": "0.20.
|
|
56
|
+
"@lynx-js/web-rsbuild-server-middleware": "0.20.3",
|
|
57
57
|
"@lynx-js/webpack-dev-transport": "^0.2.0",
|
|
58
58
|
"@lynx-js/websocket": "^0.0.4"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@microsoft/api-extractor": "7.58.2",
|
|
62
62
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
63
|
+
"@rsdoctor/core": "~1.5.6",
|
|
63
64
|
"chokidar": "^4.0.3",
|
|
64
65
|
"commander": "^13.1.0",
|
|
65
66
|
"eventemitter3": "^5.0.4",
|