@unpackjs/core 2.3.8 → 2.4.0
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/dist/bundler-config/jsMinify.cjs +1 -1
- package/dist/bundler-config/jsMinify.js +1 -1
- package/dist/config.cjs +43 -22
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +44 -23
- package/dist/createUnpack.cjs +2 -2
- package/dist/createUnpack.js +2 -2
- package/dist/progressBar.cjs +1 -0
- package/dist/progressBar.d.ts.map +1 -1
- package/dist/progressBar.js +2 -1
- package/dist/run/dev.cjs +1 -1
- package/dist/run/dev.js +1 -1
- package/dist/utils.cjs +8 -1
- package/dist/utils.d.ts +1 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +5 -1
- package/package.json +1 -1
package/dist/config.cjs
CHANGED
|
@@ -41,7 +41,9 @@ const external_node_fs_namespaceObject = require("node:fs");
|
|
|
41
41
|
var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
|
|
42
42
|
const external_node_path_namespaceObject = require("node:path");
|
|
43
43
|
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
44
|
+
const external_node_url_namespaceObject = require("node:url");
|
|
44
45
|
const external_jiti_namespaceObject = require("jiti");
|
|
46
|
+
const external_colors_cjs_namespaceObject = require("./colors.cjs");
|
|
45
47
|
const external_logger_cjs_namespaceObject = require("./logger.cjs");
|
|
46
48
|
const external_utils_cjs_namespaceObject = require("./utils.cjs");
|
|
47
49
|
async function loadConfig({ cliOptions, command }) {
|
|
@@ -51,45 +53,64 @@ async function loadConfig({ cliOptions, command }) {
|
|
|
51
53
|
(0, external_utils_cjs_namespaceObject.setDevServer)(true);
|
|
52
54
|
}
|
|
53
55
|
const root = (null == cliOptions ? void 0 : cliOptions.root) ? external_node_path_default().resolve(cliOptions.root) : process.cwd();
|
|
54
|
-
const
|
|
55
|
-
let
|
|
56
|
-
if (
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
56
|
+
const configFilePath = resolveConfigPath(root, null == cliOptions ? void 0 : cliOptions.config);
|
|
57
|
+
let configExport = {};
|
|
58
|
+
if (configFilePath) {
|
|
59
|
+
const canUseNativeLoader = (0, external_utils_cjs_namespaceObject.isNodeVersionAtLeast)(23, 6) || /\.(?:js|mjs|cjs)$/.test(configFilePath);
|
|
60
|
+
if (canUseNativeLoader) {
|
|
61
|
+
external_logger_cjs_namespaceObject.logger.debug('Loading config file with native loader:', external_colors_cjs_namespaceObject.colors.dim(configFilePath));
|
|
62
|
+
try {
|
|
63
|
+
const configFileURL = (0, external_node_url_namespaceObject.pathToFileURL)(configFilePath).href;
|
|
64
|
+
const exportModule = await import(`${configFileURL}?t=${Date.now()}`);
|
|
65
|
+
configExport = exportModule.default ? exportModule.default : exportModule;
|
|
66
|
+
} catch (err) {
|
|
67
|
+
external_logger_cjs_namespaceObject.logger.error(`Failed to load config file with native loader: ${external_colors_cjs_namespaceObject.colors.dim(configFilePath)}`);
|
|
68
|
+
throw err;
|
|
69
|
+
}
|
|
70
|
+
} else {
|
|
71
|
+
external_logger_cjs_namespaceObject.logger.debug('Loading config file with jiti:', external_colors_cjs_namespaceObject.colors.dim(configFilePath));
|
|
72
|
+
try {
|
|
73
|
+
const jiti = (0, external_jiti_namespaceObject.createJiti)(__filename, {
|
|
74
|
+
moduleCache: false,
|
|
75
|
+
interopDefault: true,
|
|
76
|
+
nativeModules: [
|
|
77
|
+
'@rspack/core',
|
|
78
|
+
"typescript"
|
|
79
|
+
]
|
|
80
|
+
});
|
|
81
|
+
configExport = await jiti.import(configFilePath, {
|
|
82
|
+
default: true
|
|
83
|
+
});
|
|
84
|
+
} catch (err) {
|
|
85
|
+
external_logger_cjs_namespaceObject.logger.error(`Failed to load config file with jiti: ${external_colors_cjs_namespaceObject.colors.dim(configFilePath)}`);
|
|
86
|
+
throw err;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if ('function' == typeof configExport) {
|
|
69
90
|
const params = {
|
|
70
91
|
env: (0, external_utils_cjs_namespaceObject.getNodeEnv)(),
|
|
71
92
|
command: process.argv[2]
|
|
72
93
|
};
|
|
73
|
-
|
|
74
|
-
if (void 0 ===
|
|
94
|
+
configExport = await configExport(params);
|
|
95
|
+
if (void 0 === configExport) throw new Error('Unpack config function must return a config object.');
|
|
75
96
|
}
|
|
76
97
|
}
|
|
77
|
-
if (null == cliOptions ? void 0 : cliOptions.port) (0, external_utils_cjs_namespaceObject.setValueByPath)(
|
|
98
|
+
if (null == cliOptions ? void 0 : cliOptions.port) (0, external_utils_cjs_namespaceObject.setValueByPath)(configExport, [
|
|
78
99
|
'server',
|
|
79
100
|
'port'
|
|
80
101
|
], cliOptions.port);
|
|
81
|
-
if (null == cliOptions ? void 0 : cliOptions.open) (0, external_utils_cjs_namespaceObject.setValueByPath)(
|
|
102
|
+
if (null == cliOptions ? void 0 : cliOptions.open) (0, external_utils_cjs_namespaceObject.setValueByPath)(configExport, [
|
|
82
103
|
'server',
|
|
83
104
|
'open'
|
|
84
105
|
], cliOptions.open);
|
|
85
|
-
if (null == cliOptions ? void 0 : cliOptions.analyze) (0, external_utils_cjs_namespaceObject.setValueByPath)(
|
|
106
|
+
if (null == cliOptions ? void 0 : cliOptions.analyze) (0, external_utils_cjs_namespaceObject.setValueByPath)(configExport, [
|
|
86
107
|
'performance',
|
|
87
108
|
'bundleAnalyze'
|
|
88
109
|
], cliOptions.analyze);
|
|
89
|
-
if (null == cliOptions ? void 0 : cliOptions.root) (0, external_utils_cjs_namespaceObject.setValueByPath)(
|
|
110
|
+
if (null == cliOptions ? void 0 : cliOptions.root) (0, external_utils_cjs_namespaceObject.setValueByPath)(configExport, [
|
|
90
111
|
'root'
|
|
91
112
|
], root);
|
|
92
|
-
return
|
|
113
|
+
return configExport;
|
|
93
114
|
}
|
|
94
115
|
function defineConfig(config) {
|
|
95
116
|
return config;
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAKjF,wBAAsB,UAAU,CAAC,EAC/B,UAAU,EACV,OAAO,GACR,EAAE;IACD,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,OAAO,EAAE,OAAO,CAAA;CACjB,GAAG,OAAO,CAAC,YAAY,CAAC,CA4DxB;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,EAAE,OAAO,CAAA;IACZ,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,YAAY,KAAK,OAAO,CAAC,YAAY,CAAC,CAAA;AACjF,MAAM,MAAM,kBAAkB,GAAG,CAAC,MAAM,EAAE,YAAY,KAAK,YAAY,CAAA;AACvE,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,kBAAkB,GAAG,mBAAmB,CAAA;AACxF,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,YAAY,CAAA;AAChE,wBAAgB,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,kBAAkB,CAAA;AAC5E,wBAAgB,YAAY,CAAC,MAAM,EAAE,mBAAmB,GAAG,mBAAmB,CAAA;AAC9E,wBAAgB,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,kBAAkB,CAAA;AAK5E,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,iBAuBpE"}
|
package/dist/config.js
CHANGED
|
@@ -3,9 +3,11 @@ import 'module';
|
|
|
3
3
|
import { fileURLToPath as __webpack_fileURLToPath__ } from "node:url";
|
|
4
4
|
import node_fs from "node:fs";
|
|
5
5
|
import node_path, { isAbsolute, join } from "node:path";
|
|
6
|
+
import { pathToFileURL } from "node:url";
|
|
6
7
|
import { createJiti } from "jiti";
|
|
8
|
+
import { colors } from "./colors.js";
|
|
7
9
|
import { logger } from "./logger.js";
|
|
8
|
-
import { getNodeEnv, setDevServer, setNodeEnv, setValueByPath } from "./utils.js";
|
|
10
|
+
import { getNodeEnv, isNodeVersionAtLeast, setDevServer, setNodeEnv, setValueByPath } from "./utils.js";
|
|
9
11
|
var config_filename = __webpack_fileURLToPath__(import.meta.url);
|
|
10
12
|
async function loadConfig({ cliOptions, command }) {
|
|
11
13
|
if ('build' === command) setNodeEnv((null == cliOptions ? void 0 : cliOptions.watch) ? 'development' : 'production');
|
|
@@ -14,45 +16,64 @@ async function loadConfig({ cliOptions, command }) {
|
|
|
14
16
|
setDevServer(true);
|
|
15
17
|
}
|
|
16
18
|
const root = (null == cliOptions ? void 0 : cliOptions.root) ? node_path.resolve(cliOptions.root) : process.cwd();
|
|
17
|
-
const
|
|
18
|
-
let
|
|
19
|
-
if (
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
19
|
+
const configFilePath = resolveConfigPath(root, null == cliOptions ? void 0 : cliOptions.config);
|
|
20
|
+
let configExport = {};
|
|
21
|
+
if (configFilePath) {
|
|
22
|
+
const canUseNativeLoader = isNodeVersionAtLeast(23, 6) || /\.(?:js|mjs|cjs)$/.test(configFilePath);
|
|
23
|
+
if (canUseNativeLoader) {
|
|
24
|
+
logger.debug('Loading config file with native loader:', colors.dim(configFilePath));
|
|
25
|
+
try {
|
|
26
|
+
const configFileURL = pathToFileURL(configFilePath).href;
|
|
27
|
+
const exportModule = await import(`${configFileURL}?t=${Date.now()}`);
|
|
28
|
+
configExport = exportModule.default ? exportModule.default : exportModule;
|
|
29
|
+
} catch (err) {
|
|
30
|
+
logger.error(`Failed to load config file with native loader: ${colors.dim(configFilePath)}`);
|
|
31
|
+
throw err;
|
|
32
|
+
}
|
|
33
|
+
} else {
|
|
34
|
+
logger.debug('Loading config file with jiti:', colors.dim(configFilePath));
|
|
35
|
+
try {
|
|
36
|
+
const jiti = createJiti(config_filename, {
|
|
37
|
+
moduleCache: false,
|
|
38
|
+
interopDefault: true,
|
|
39
|
+
nativeModules: [
|
|
40
|
+
'@rspack/core',
|
|
41
|
+
"typescript"
|
|
42
|
+
]
|
|
43
|
+
});
|
|
44
|
+
configExport = await jiti.import(configFilePath, {
|
|
45
|
+
default: true
|
|
46
|
+
});
|
|
47
|
+
} catch (err) {
|
|
48
|
+
logger.error(`Failed to load config file with jiti: ${colors.dim(configFilePath)}`);
|
|
49
|
+
throw err;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if ('function' == typeof configExport) {
|
|
32
53
|
const params = {
|
|
33
54
|
env: getNodeEnv(),
|
|
34
55
|
command: process.argv[2]
|
|
35
56
|
};
|
|
36
|
-
|
|
37
|
-
if (void 0 ===
|
|
57
|
+
configExport = await configExport(params);
|
|
58
|
+
if (void 0 === configExport) throw new Error('Unpack config function must return a config object.');
|
|
38
59
|
}
|
|
39
60
|
}
|
|
40
|
-
if (null == cliOptions ? void 0 : cliOptions.port) setValueByPath(
|
|
61
|
+
if (null == cliOptions ? void 0 : cliOptions.port) setValueByPath(configExport, [
|
|
41
62
|
'server',
|
|
42
63
|
'port'
|
|
43
64
|
], cliOptions.port);
|
|
44
|
-
if (null == cliOptions ? void 0 : cliOptions.open) setValueByPath(
|
|
65
|
+
if (null == cliOptions ? void 0 : cliOptions.open) setValueByPath(configExport, [
|
|
45
66
|
'server',
|
|
46
67
|
'open'
|
|
47
68
|
], cliOptions.open);
|
|
48
|
-
if (null == cliOptions ? void 0 : cliOptions.analyze) setValueByPath(
|
|
69
|
+
if (null == cliOptions ? void 0 : cliOptions.analyze) setValueByPath(configExport, [
|
|
49
70
|
'performance',
|
|
50
71
|
'bundleAnalyze'
|
|
51
72
|
], cliOptions.analyze);
|
|
52
|
-
if (null == cliOptions ? void 0 : cliOptions.root) setValueByPath(
|
|
73
|
+
if (null == cliOptions ? void 0 : cliOptions.root) setValueByPath(configExport, [
|
|
53
74
|
'root'
|
|
54
75
|
], root);
|
|
55
|
-
return
|
|
76
|
+
return configExport;
|
|
56
77
|
}
|
|
57
78
|
function defineConfig(config) {
|
|
58
79
|
return config;
|
package/dist/createUnpack.cjs
CHANGED
|
@@ -68,7 +68,7 @@ function createUnpack({ cwd = process.cwd(), config, callerName = 'unpack' }) {
|
|
|
68
68
|
};
|
|
69
69
|
const _context = {
|
|
70
70
|
callerName,
|
|
71
|
-
version: "2.
|
|
71
|
+
version: "2.4.0"
|
|
72
72
|
};
|
|
73
73
|
let { plugins, bundlerConfig, ...rest } = (0, external_utils_cjs_namespaceObject.mergeConfig)(defaultConfig, config);
|
|
74
74
|
for (const plugin of (0, external_plugin_cjs_namespaceObject.getNormalizedPluginsByHook)('config', plugins))rest = await plugin.config(rest, {
|
|
@@ -85,7 +85,7 @@ function createUnpack({ cwd = process.cwd(), config, callerName = 'unpack' }) {
|
|
|
85
85
|
return {
|
|
86
86
|
build: async ({ watch } = {})=>{
|
|
87
87
|
(0, external_utils_cjs_namespaceObject.setNodeEnv)(watch ? 'development' : 'production');
|
|
88
|
-
console.log(external_colors_cjs_namespaceObject.colors.rainbow(`${callerName} v2.
|
|
88
|
+
console.log(external_colors_cjs_namespaceObject.colors.rainbow(`${callerName} v2.4.0`), external_colors_cjs_namespaceObject.colors.green(`building for ${watch ? 'development' : 'production'}...`));
|
|
89
89
|
const config = await resolveConfig();
|
|
90
90
|
(0, index_cjs_namespaceObject.unpackBuild)(config);
|
|
91
91
|
},
|
package/dist/createUnpack.js
CHANGED
|
@@ -42,7 +42,7 @@ function createUnpack({ cwd = process.cwd(), config, callerName = 'unpack' }) {
|
|
|
42
42
|
};
|
|
43
43
|
const _context = {
|
|
44
44
|
callerName,
|
|
45
|
-
version: "2.
|
|
45
|
+
version: "2.4.0"
|
|
46
46
|
};
|
|
47
47
|
let { plugins, bundlerConfig, ...rest } = mergeConfig(defaultConfig, config);
|
|
48
48
|
for (const plugin of getNormalizedPluginsByHook('config', plugins))rest = await plugin.config(rest, {
|
|
@@ -59,7 +59,7 @@ function createUnpack({ cwd = process.cwd(), config, callerName = 'unpack' }) {
|
|
|
59
59
|
return {
|
|
60
60
|
build: async ({ watch } = {})=>{
|
|
61
61
|
setNodeEnv(watch ? 'development' : 'production');
|
|
62
|
-
console.log(colors.rainbow(`${callerName} v2.
|
|
62
|
+
console.log(colors.rainbow(`${callerName} v2.4.0`), colors.green(`building for ${watch ? 'development' : 'production'}...`));
|
|
63
63
|
const config = await resolveConfig();
|
|
64
64
|
unpackBuild(config);
|
|
65
65
|
},
|
package/dist/progressBar.cjs
CHANGED
|
@@ -41,6 +41,7 @@ function _define_property(obj, key, value) {
|
|
|
41
41
|
}
|
|
42
42
|
class ProgressBar {
|
|
43
43
|
update({ current: originalCurrent, message = '' }) {
|
|
44
|
+
if ((0, external_utils_cjs_namespaceObject.isCI)()) return;
|
|
44
45
|
const { columns: terminalWidth } = process.stdout;
|
|
45
46
|
let current = originalCurrent;
|
|
46
47
|
if (originalCurrent >= 0.98) current = 1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progressBar.d.ts","sourceRoot":"","sources":["../src/progressBar.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAGrD,qBAAa,WAAW;IACtB,MAAM,SAAiB;IACvB,gBAAgB,mBAAyB;IAEzC,MAAM,CAAC,EAAE,OAAO,EAAE,eAAe,EAAE,OAAY,EAAE,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE;
|
|
1
|
+
{"version":3,"file":"progressBar.d.ts","sourceRoot":"","sources":["../src/progressBar.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAGrD,qBAAa,WAAW;IACtB,MAAM,SAAiB;IACvB,gBAAgB,mBAAyB;IAEzC,MAAM,CAAC,EAAE,OAAO,EAAE,eAAe,EAAE,OAAY,EAAE,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE;IAexF,IAAI;CAGL"}
|
package/dist/progressBar.js
CHANGED
|
@@ -2,7 +2,7 @@ import 'module';
|
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
3
|
import { colors } from "./colors.js";
|
|
4
4
|
import { LoadingAnimation } from "./loadingAnimation.js";
|
|
5
|
-
import { logUpdate } from "./utils.js";
|
|
5
|
+
import { isCI, logUpdate } from "./utils.js";
|
|
6
6
|
function _define_property(obj, key, value) {
|
|
7
7
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
8
8
|
value: value,
|
|
@@ -15,6 +15,7 @@ function _define_property(obj, key, value) {
|
|
|
15
15
|
}
|
|
16
16
|
class ProgressBar {
|
|
17
17
|
update({ current: originalCurrent, message = '' }) {
|
|
18
|
+
if (isCI()) return;
|
|
18
19
|
const { columns: terminalWidth } = process.stdout;
|
|
19
20
|
let current = originalCurrent;
|
|
20
21
|
if (originalCurrent >= 0.98) current = 1;
|
package/dist/run/dev.cjs
CHANGED
|
@@ -87,7 +87,7 @@ async function unpackDev(originalUnpackConfig) {
|
|
|
87
87
|
};
|
|
88
88
|
const server = new (external_webpack_dev_server_default())(devServerOptions, compiler);
|
|
89
89
|
await server.start();
|
|
90
|
-
external_logger_cjs_namespaceObject.logger.greet(` ${external_colors_cjs_namespaceObject.colors.green(`${external_colors_cjs_namespaceObject.colors.bold(unpackConfig._context.callerName.toUpperCase())} v2.
|
|
90
|
+
external_logger_cjs_namespaceObject.logger.greet(` ${external_colors_cjs_namespaceObject.colors.green(`${external_colors_cjs_namespaceObject.colors.bold(unpackConfig._context.callerName.toUpperCase())} v2.4.0`)} ${external_colors_cjs_namespaceObject.colors.dim(`ready in ${external_colors_cjs_namespaceObject.colors.reset(Math.ceil(performance.now() - global.__unpack_start_time))}ms`)}\n`);
|
|
91
91
|
printAddressUrls(port);
|
|
92
92
|
external_logger_cjs_namespaceObject.logger.wait('building...');
|
|
93
93
|
global.__unpack_dev_server_started = true;
|
package/dist/run/dev.js
CHANGED
|
@@ -50,7 +50,7 @@ async function unpackDev(originalUnpackConfig) {
|
|
|
50
50
|
};
|
|
51
51
|
const server = new webpack_dev_server(devServerOptions, compiler);
|
|
52
52
|
await server.start();
|
|
53
|
-
logger.greet(` ${colors.green(`${colors.bold(unpackConfig._context.callerName.toUpperCase())} v2.
|
|
53
|
+
logger.greet(` ${colors.green(`${colors.bold(unpackConfig._context.callerName.toUpperCase())} v2.4.0`)} ${colors.dim(`ready in ${colors.reset(Math.ceil(performance.now() - global.__unpack_start_time))}ms`)}\n`);
|
|
54
54
|
printAddressUrls(port);
|
|
55
55
|
logger.wait('building...');
|
|
56
56
|
global.__unpack_dev_server_started = true;
|
package/dist/utils.cjs
CHANGED
|
@@ -64,8 +64,9 @@ var __webpack_exports__ = {};
|
|
|
64
64
|
isFunction: ()=>isFunction,
|
|
65
65
|
isWatch: ()=>isWatch,
|
|
66
66
|
isRegExp: ()=>isRegExp,
|
|
67
|
-
|
|
67
|
+
isNodeVersionAtLeast: ()=>isNodeVersionAtLeast,
|
|
68
68
|
isWin: ()=>isWin,
|
|
69
|
+
setNodeEnv: ()=>setNodeEnv,
|
|
69
70
|
isPlainObject: ()=>isPlainObject,
|
|
70
71
|
getCompiledPkgPath: ()=>getCompiledPkgPath,
|
|
71
72
|
isDebug: ()=>isDebug,
|
|
@@ -265,6 +266,10 @@ var __webpack_exports__ = {};
|
|
|
265
266
|
};
|
|
266
267
|
const isDebug = ()=>'unpack' === process.env.DEBUG;
|
|
267
268
|
const isCI = ()=>!!process.env.CI;
|
|
269
|
+
function isNodeVersionAtLeast(major, minor) {
|
|
270
|
+
const [currMajor, currMinor] = process.versions.node.split('.').map(Number);
|
|
271
|
+
return currMajor > major || currMajor === major && currMinor >= minor;
|
|
272
|
+
}
|
|
268
273
|
})();
|
|
269
274
|
exports.clearLine = __webpack_exports__.clearLine;
|
|
270
275
|
exports.debounce = __webpack_exports__.debounce;
|
|
@@ -284,6 +289,7 @@ exports.isDebug = __webpack_exports__.isDebug;
|
|
|
284
289
|
exports.isDev = __webpack_exports__.isDev;
|
|
285
290
|
exports.isDevServer = __webpack_exports__.isDevServer;
|
|
286
291
|
exports.isFunction = __webpack_exports__.isFunction;
|
|
292
|
+
exports.isNodeVersionAtLeast = __webpack_exports__.isNodeVersionAtLeast;
|
|
287
293
|
exports.isObject = __webpack_exports__.isObject;
|
|
288
294
|
exports.isPlainObject = __webpack_exports__.isPlainObject;
|
|
289
295
|
exports.isProd = __webpack_exports__.isProd;
|
|
@@ -318,6 +324,7 @@ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
|
318
324
|
"isDev",
|
|
319
325
|
"isDevServer",
|
|
320
326
|
"isFunction",
|
|
327
|
+
"isNodeVersionAtLeast",
|
|
321
328
|
"isObject",
|
|
322
329
|
"isPlainObject",
|
|
323
330
|
"isProd",
|
package/dist/utils.d.ts
CHANGED
|
@@ -45,5 +45,6 @@ export declare const clearLine: () => void;
|
|
|
45
45
|
export declare const logUpdate: (output: string) => void;
|
|
46
46
|
export declare const isDebug: () => boolean;
|
|
47
47
|
export declare const isCI: () => boolean;
|
|
48
|
+
export declare function isNodeVersionAtLeast(major: number, minor: number): boolean;
|
|
48
49
|
export {};
|
|
49
50
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
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M,WAAW,KAAQ,CAAA;AAEhC,eAAO,MAAM,iBAAiB,GAAI,MAAM,MAAM,EAAE,KAAK,MAAM,QAK1D,CAAA;AAED,eAAO,MAAM,SAAS,YAIrB,CAAA;AAED,eAAO,MAAM,SAAS,GAAI,QAAQ,MAAM,SAGvC,CAAA;AAED,eAAO,MAAM,OAAO,eAAuC,CAAA;AAE3D,eAAO,MAAM,IAAI,eAAyB,CAAA;AAE1C,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAI1E"}
|
package/dist/utils.js
CHANGED
|
@@ -197,4 +197,8 @@ const logUpdate = (output)=>{
|
|
|
197
197
|
};
|
|
198
198
|
const isDebug = ()=>'unpack' === process.env.DEBUG;
|
|
199
199
|
const isCI = ()=>!!process.env.CI;
|
|
200
|
-
|
|
200
|
+
function isNodeVersionAtLeast(major, minor) {
|
|
201
|
+
const [currMajor, currMinor] = process.versions.node.split('.').map(Number);
|
|
202
|
+
return currMajor > major || currMajor === major && currMinor >= minor;
|
|
203
|
+
}
|
|
204
|
+
export { clearLine, debounce, getAddressUrls, getCompiledPkgPath, getIpv4Interfaces, getNodeEnv, getPathInJs, getPort, getTime, getUserDepPath, getUserDepVersion, getValueByPath, isBoolean, isCI, isDebug, isDev, utils_isDevServer as isDevServer, isFunction, isNodeVersionAtLeast, isObject, isPlainObject, isProd, isRegExp, isString, isUndefined, isWatch, isWin, logUpdate, mergeConfig, prettyTime, setDevServer, setNodeEnv, setValueByPath, trackPerformance };
|