@modern-js/utils 1.7.4 → 1.7.7
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 +21 -0
- package/compiled/inquirer/index.js +2 -2
- package/compiled/webpack-chain/index.js +1 -0
- package/compiled/webpack-chain/license +373 -0
- package/compiled/webpack-chain/package.json +1 -0
- package/compiled/webpack-chain/types/index.d.ts +388 -0
- package/dist/applyOptionsChain.d.ts +2 -6
- package/dist/applyOptionsChain.js +3 -3
- package/dist/chainId.d.ts +116 -0
- package/dist/chainId.js +118 -0
- package/dist/compiled.d.ts +2 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/monorepo.js +5 -1
- package/dist/prettyInstructions.d.ts +3 -0
- package/dist/prettyInstructions.js +11 -4
- package/package.json +10 -2
@@ -1,6 +1,9 @@
|
|
1
|
+
/// <reference types="node" />
|
2
|
+
import os from 'os';
|
1
3
|
interface EntryPoint {
|
2
4
|
entryName: string;
|
3
5
|
}
|
4
6
|
export declare const isSingleEntry: (entrypoints: EntryPoint[]) => boolean;
|
7
|
+
export declare const getIpv4Interfaces: () => os.NetworkInterfaceInfo[];
|
5
8
|
export declare const prettyInstructions: (appContext: any, config: any) => string;
|
6
9
|
export {};
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.prettyInstructions = exports.isSingleEntry = void 0;
|
6
|
+
exports.prettyInstructions = exports.getIpv4Interfaces = exports.isSingleEntry = void 0;
|
7
7
|
const os_1 = __importDefault(require("os"));
|
8
8
|
const compiled_1 = require("./compiled");
|
9
9
|
const is_1 = require("./is");
|
@@ -11,20 +11,27 @@ const is_1 = require("./is");
|
|
11
11
|
const isSingleEntry = (entrypoints) => entrypoints.length === 1 && entrypoints[0].entryName === 'main';
|
12
12
|
exports.isSingleEntry = isSingleEntry;
|
13
13
|
const normalizeUrl = (url) => url.replace(/([^:]\/)\/+/g, '$1');
|
14
|
-
const
|
14
|
+
const getIpv4Interfaces = () => {
|
15
15
|
const interfaces = os_1.default.networkInterfaces();
|
16
16
|
const ipv4Interfaces = [];
|
17
17
|
Object.keys(interfaces).forEach(key => {
|
18
18
|
interfaces[key].forEach(detail => {
|
19
|
-
|
19
|
+
// 'IPv4' is in Node <= 17, from 18 it's a number 4 or 6
|
20
|
+
const familyV4Value = typeof detail.family === 'string' ? 'IPv4' : 4;
|
21
|
+
if (detail.family === familyV4Value) {
|
20
22
|
ipv4Interfaces.push(detail);
|
21
23
|
}
|
22
24
|
});
|
23
25
|
});
|
26
|
+
return ipv4Interfaces;
|
27
|
+
};
|
28
|
+
exports.getIpv4Interfaces = getIpv4Interfaces;
|
29
|
+
const getAddressUrls = (protocol = 'http', port) => {
|
30
|
+
const ipv4Interfaces = (0, exports.getIpv4Interfaces)();
|
24
31
|
return ipv4Interfaces.reduce((memo, detail) => {
|
25
32
|
let type = 'Network: ';
|
26
33
|
let url = `${protocol}://${detail.address}:${port}`;
|
27
|
-
if (detail.address.includes(`localhost`)) {
|
34
|
+
if (detail.address.includes(`localhost`) || detail.internal) {
|
28
35
|
type = 'Local: ';
|
29
36
|
url = `${protocol}://localhost:${port}`;
|
30
37
|
}
|
package/package.json
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
"modern",
|
12
12
|
"modern.js"
|
13
13
|
],
|
14
|
-
"version": "1.7.
|
14
|
+
"version": "1.7.7",
|
15
15
|
"jsnext:source": "./src/index.ts",
|
16
16
|
"types": "./dist/index.d.ts",
|
17
17
|
"main": "./dist/index.js",
|
@@ -23,6 +23,7 @@
|
|
23
23
|
"./format": "./dist/format.js",
|
24
24
|
"./constants": "./dist/constants.js",
|
25
25
|
"./ssr": "./dist/ssr.js",
|
26
|
+
"./glob": "./compiled/glob/index.js",
|
26
27
|
"./chalk": "./compiled/chalk/index.js",
|
27
28
|
"./json5": "./compiled/json5/index.js",
|
28
29
|
"./semver": "./compiled/semver/index.js",
|
@@ -33,6 +34,7 @@
|
|
33
34
|
"./mime-types": "./compiled/mime-types/index.js",
|
34
35
|
"./strip-ansi": "./compiled/strip-ansi/index.js",
|
35
36
|
"./browserslist": "./compiled/browserslist/index.js",
|
37
|
+
"./webpack-chain": "./compiled/webpack-chain/index.js",
|
36
38
|
"./tsconfig-paths": "./compiled/tsconfig-paths/index.js"
|
37
39
|
},
|
38
40
|
"publishConfig": {
|
@@ -50,6 +52,9 @@
|
|
50
52
|
"ssr": [
|
51
53
|
"./dist/ssr.d.ts"
|
52
54
|
],
|
55
|
+
"glob": [
|
56
|
+
"./compiled/glob/index.d.ts"
|
57
|
+
],
|
53
58
|
"chalk": [
|
54
59
|
"./compiled/chalk/index.d.ts"
|
55
60
|
],
|
@@ -80,6 +85,9 @@
|
|
80
85
|
"browserslist": [
|
81
86
|
"./compiled/browserslist/index.d.ts"
|
82
87
|
],
|
88
|
+
"webpack-chain": [
|
89
|
+
"./compiled/webpack-chain/types/index.d.ts"
|
90
|
+
],
|
83
91
|
"tsconfig-paths": [
|
84
92
|
"./compiled/tsconfig-paths/lib/index.d.ts"
|
85
93
|
]
|
@@ -90,7 +98,7 @@
|
|
90
98
|
"lodash": "^4.17.21"
|
91
99
|
},
|
92
100
|
"devDependencies": {
|
93
|
-
"@modern-js/types": "1.5.
|
101
|
+
"@modern-js/types": "1.5.4",
|
94
102
|
"@scripts/build": "0.0.0",
|
95
103
|
"@scripts/jest-config": "0.0.0",
|
96
104
|
"@types/jest": "^27",
|