@modern-js/utils 2.4.0 → 2.5.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/CHANGELOG.md +14 -0
- package/dist/FileSizeReporter.d.ts +5 -5
- package/dist/FileSizeReporter.js +143 -136
- package/dist/alias.d.ts +14 -12
- package/dist/alias.js +94 -54
- package/dist/analyzeProject.d.ts +1 -1
- package/dist/analyzeProject.js +58 -33
- package/dist/applyOptionsChain.d.ts +1 -1
- package/dist/applyOptionsChain.js +55 -27
- package/dist/chainId.d.ts +256 -184
- package/dist/chainId.js +132 -187
- package/dist/clearConsole.d.ts +1 -1
- package/dist/clearConsole.js +29 -7
- package/dist/commands.d.ts +1 -1
- package/dist/commands.js +33 -10
- package/dist/compatRequire.d.ts +3 -3
- package/dist/compatRequire.js +74 -38
- package/dist/compiled.d.ts +2 -1
- package/dist/compiled.js +137 -72
- package/dist/constants.d.ts +131 -105
- package/dist/constants.js +298 -277
- package/dist/debug.d.ts +1 -1
- package/dist/debug.js +28 -11
- package/dist/emptyDir.d.ts +1 -1
- package/dist/emptyDir.js +51 -9
- package/dist/ensureAbsolutePath.d.ts +1 -1
- package/dist/ensureAbsolutePath.js +33 -14
- package/dist/ensureArray.d.ts +1 -1
- package/dist/ensureArray.js +30 -8
- package/dist/findExists.d.ts +1 -1
- package/dist/findExists.js +37 -17
- package/dist/format.d.ts +3 -3
- package/dist/format.js +93 -81
- package/dist/generateMetaTags.d.ts +3 -3
- package/dist/generateMetaTags.js +56 -43
- package/dist/getBrowserslist.d.ts +1 -1
- package/dist/getBrowserslist.js +31 -7
- package/dist/getCoreJsVersion.d.ts +1 -1
- package/dist/getCoreJsVersion.js +39 -35
- package/dist/getEntryOptions.d.ts +1 -1
- package/dist/getEntryOptions.js +51 -24
- package/dist/getPackageManager.d.ts +1 -1
- package/dist/getPackageManager.js +75 -28
- package/dist/getPort.d.ts +7 -4
- package/dist/getPort.js +104 -58
- package/dist/getServerConfig.d.ts +1 -1
- package/dist/getServerConfig.js +61 -32
- package/dist/import.d.ts +2 -2
- package/dist/import.js +31 -8
- package/dist/index.d.ts +1 -1
- package/dist/index.js +59 -59
- package/dist/is/index.d.ts +12 -1
- package/dist/is/index.js +83 -82
- package/dist/is/node-env.d.ts +1 -1
- package/dist/is/node-env.js +39 -17
- package/dist/is/platform.d.ts +1 -1
- package/dist/is/platform.js +30 -10
- package/dist/is/type.d.ts +1 -1
- package/dist/is/type.js +48 -22
- package/dist/logger.d.ts +48 -48
- package/dist/logger.js +127 -95
- package/dist/monorepo.d.ts +3 -3
- package/dist/monorepo.js +117 -74
- package/dist/nodeEnv.d.ts +1 -1
- package/dist/nodeEnv.js +72 -25
- package/dist/path.d.ts +3 -1
- package/dist/path.js +76 -59
- package/dist/pathSerializer.d.ts +6 -6
- package/dist/pathSerializer.js +65 -43
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.js +45 -26
- package/dist/prettyInstructions.d.ts +4 -4
- package/dist/prettyInstructions.js +107 -65
- package/dist/printBuildError.d.ts +1 -1
- package/dist/printBuildError.js +54 -40
- package/dist/react.d.ts +1 -1
- package/dist/react.js +57 -21
- package/dist/readTsConfig.d.ts +1 -1
- package/dist/readTsConfig.js +38 -12
- package/dist/removeSlash.d.ts +1 -1
- package/dist/removeSlash.js +33 -9
- package/dist/routes.d.ts +1 -1
- package/dist/routes.js +49 -22
- package/dist/runtimeExports.d.ts +3 -3
- package/dist/runtimeExports.js +59 -39
- package/dist/ssr.d.ts +2 -1
- package/dist/ssr.js +30 -7
- package/dist/storage.d.ts +3 -3
- package/dist/storage.js +65 -59
- package/dist/test-utils.d.ts +1 -1
- package/dist/test-utils.js +30 -24
- package/dist/tryResolve.d.ts +2 -1
- package/dist/tryResolve.js +45 -33
- package/dist/types.d.ts +1 -1
- package/dist/types.js +15 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +83 -24
- package/dist/wait.d.ts +1 -1
- package/dist/wait.js +28 -6
- package/dist/watch.d.ts +3 -3
- package/dist/watch.js +82 -55
- package/package.json +7 -8
package/dist/chainId.js
CHANGED
@@ -1,188 +1,133 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
MJS: 'mjs',
|
9
|
-
/** Rule for predefined loaders */
|
10
|
-
LOADERS: 'loaders',
|
11
|
-
/** Rule for fonts */
|
12
|
-
FONT: 'font',
|
13
|
-
/** Rule for images */
|
14
|
-
IMAGE: 'image',
|
15
|
-
/** Rule for media */
|
16
|
-
MEDIA: 'media',
|
17
|
-
/** Rule for js */
|
18
|
-
JS: 'js',
|
19
|
-
/** Rule for data uri encoded javascript */
|
20
|
-
JS_DATA_URI: 'js-data-uri',
|
21
|
-
/** Rule for ts */
|
22
|
-
TS: 'ts',
|
23
|
-
/** Rule for css */
|
24
|
-
CSS: 'css',
|
25
|
-
/** Rule for less */
|
26
|
-
LESS: 'less',
|
27
|
-
/** Rule for sass */
|
28
|
-
SASS: 'sass',
|
29
|
-
/** Rule for stylus */
|
30
|
-
STYLUS: 'stylus',
|
31
|
-
/** Rule for svg */
|
32
|
-
SVG: 'svg',
|
33
|
-
/** Rule for pug */
|
34
|
-
PUG: 'pug',
|
35
|
-
/** Rule for toml */
|
36
|
-
TOML: 'toml',
|
37
|
-
/** Rule for yaml */
|
38
|
-
YAML: 'yaml',
|
39
|
-
/** Rule for bff */
|
40
|
-
JS_BFF_API: 'js-bff-api',
|
41
|
-
},
|
42
|
-
/** Predefined rule groups */
|
43
|
-
ONE_OF: {
|
44
|
-
JS: 'js',
|
45
|
-
TS: 'ts',
|
46
|
-
CSS: 'css',
|
47
|
-
LESS: 'less',
|
48
|
-
SASS: 'sass',
|
49
|
-
YAML: 'yml',
|
50
|
-
TOML: 'toml',
|
51
|
-
FALLBACK: 'fallback',
|
52
|
-
MARKDOWN: 'markdown',
|
53
|
-
BFF_CLIENT: 'bff-client',
|
54
|
-
CSS_MODULES: 'css-modules',
|
55
|
-
LESS_MODULES: 'less-modules',
|
56
|
-
SASS_MODULES: 'sass-modules',
|
57
|
-
SVG: 'svg',
|
58
|
-
SVG_URL: 'svg-url',
|
59
|
-
SVG_ASSET: 'svg-asset',
|
60
|
-
SVG_INLINE: 'svg-inline',
|
61
|
-
ASSETS: 'assets',
|
62
|
-
ASSETS_URL: 'assets-url',
|
63
|
-
ASSETS_INLINE: 'assets-inline',
|
64
|
-
IMAGE_COMPRESS: 'image-compress',
|
65
|
-
},
|
66
|
-
/** Predefined loaders */
|
67
|
-
USE: {
|
68
|
-
/** ts-loader */
|
69
|
-
TS: 'ts',
|
70
|
-
/** css-loader */
|
71
|
-
CSS: 'css',
|
72
|
-
/** sass-loader */
|
73
|
-
SASS: 'sass',
|
74
|
-
/** less-loader */
|
75
|
-
LESS: 'less',
|
76
|
-
/** stylus-loader */
|
77
|
-
STYLUS: 'stylus',
|
78
|
-
/** url-loader */
|
79
|
-
URL: 'url',
|
80
|
-
/** pug-loader */
|
81
|
-
PUG: 'pug',
|
82
|
-
/** file-loader */
|
83
|
-
FILE: 'file',
|
84
|
-
/** @svgr/webpack */
|
85
|
-
SVGR: 'svgr',
|
86
|
-
/** yaml-loader */
|
87
|
-
YAML: 'yaml',
|
88
|
-
/** toml-loader */
|
89
|
-
TOML: 'toml',
|
90
|
-
/** html-loader */
|
91
|
-
HTML: 'html',
|
92
|
-
/** babel-loader */
|
93
|
-
BABEL: 'babel',
|
94
|
-
/** esbuild-loader */
|
95
|
-
ESBUILD: 'esbuild',
|
96
|
-
/** swc-loader */
|
97
|
-
SWC: 'swc',
|
98
|
-
/** style-loader */
|
99
|
-
STYLE: 'style-loader',
|
100
|
-
/** postcss-loader */
|
101
|
-
POSTCSS: 'postcss',
|
102
|
-
/** markdown-loader */
|
103
|
-
MARKDOWN: 'markdown',
|
104
|
-
/** ignore-css-loader */
|
105
|
-
IGNORE_CSS: 'ignore-css',
|
106
|
-
/** css-modules-typescript-loader */
|
107
|
-
CSS_MODULES_TS: 'css-modules-typescript',
|
108
|
-
/** mini-css-extract-plugin.loader */
|
109
|
-
MINI_CSS_EXTRACT: 'mini-css-extract',
|
110
|
-
/** builder-plugin-image-compress.loader */
|
111
|
-
IMAGE_COMPRESS: 'image-compress',
|
112
|
-
/** builder-plugin-image-compress svgo-loader */
|
113
|
-
SVGO: 'svgo',
|
114
|
-
/** builder-plugin-imagex */
|
115
|
-
IMAGEX: 'imagex',
|
116
|
-
},
|
117
|
-
/** Predefined plugins */
|
118
|
-
PLUGIN: {
|
119
|
-
/** HotModuleReplacementPlugin */
|
120
|
-
HMR: 'hmr',
|
121
|
-
/** CopyWebpackPlugin */
|
122
|
-
COPY: 'copy',
|
123
|
-
/** HtmlWebpackPlugin */
|
124
|
-
HTML: 'html',
|
125
|
-
/** DefinePlugin */
|
126
|
-
DEFINE: 'define',
|
127
|
-
/** IgnorePlugin */
|
128
|
-
IGNORE: 'ignore',
|
129
|
-
/** BannerPlugin */
|
130
|
-
BANNER: 'banner',
|
131
|
-
/** Webpackbar */
|
132
|
-
PROGRESS: 'progress',
|
133
|
-
/** Inspector */
|
134
|
-
INSPECTOR: 'inspector',
|
135
|
-
/** AppIconPlugin */
|
136
|
-
APP_ICON: 'app-icon',
|
137
|
-
/** LoadableWebpackPlugin */
|
138
|
-
LOADABLE: 'loadable',
|
139
|
-
/** WebpackManifestPlugin */
|
140
|
-
MANIFEST: 'webpack-manifest',
|
141
|
-
/** ForkTsCheckerWebpackPlugin */
|
142
|
-
TS_CHECKER: 'ts-checker',
|
143
|
-
/** InlineChunkHtmlPlugin */
|
144
|
-
INLINE_HTML: 'inline-html',
|
145
|
-
/** WebpackBundleAnalyzer */
|
146
|
-
BUNDLE_ANALYZER: 'bundle-analyze',
|
147
|
-
/** BottomTemplatePlugin */
|
148
|
-
BOTTOM_TEMPLATE: 'bottom-template',
|
149
|
-
/** HtmlCrossOriginPlugin */
|
150
|
-
HTML_CROSS_ORIGIN: 'html-cross-origin',
|
151
|
-
/** MiniCssExtractPlugin */
|
152
|
-
MINI_CSS_EXTRACT: 'mini-css-extract',
|
153
|
-
/** ReactFastRefreshPlugin */
|
154
|
-
REACT_FAST_REFRESH: 'react-fast-refresh',
|
155
|
-
/** ProvidePlugin for node polyfill */
|
156
|
-
NODE_POLYFILL_PROVIDE: 'node-polyfill-provide',
|
157
|
-
/** WebpackSRIPlugin */
|
158
|
-
SUBRESOURCE_INTEGRITY: 'subresource-integrity',
|
159
|
-
/** WebpackAssetsRetryPlugin */
|
160
|
-
ASSETS_RETRY: 'ASSETS_RETRY',
|
161
|
-
/** AutoSetRootFontSizePlugin */
|
162
|
-
AUTO_SET_ROOT_SIZE: 'auto-set-root-size',
|
163
|
-
/** HtmlAsyncChunkPlugin */
|
164
|
-
HTML_ASYNC_CHUNK: 'html-async-chunk',
|
165
|
-
/** SWC_POLYFILL_CHECKER */
|
166
|
-
SWC_POLYFILL_CHECKER: 'swc-polyfill-checker-plugin',
|
167
|
-
/** HtmlTagsPlugin */
|
168
|
-
HTML_TAGS: 'html-tags',
|
169
|
-
},
|
170
|
-
/** Predefined minimizers */
|
171
|
-
MINIMIZER: {
|
172
|
-
/** TerserWebpackPlugin */
|
173
|
-
JS: 'js',
|
174
|
-
/** CssMinimizerWebpackPlugin */
|
175
|
-
CSS: 'css',
|
176
|
-
/** ESBuildPlugin */
|
177
|
-
ESBUILD: 'js-css',
|
178
|
-
/** SWCPlugin */
|
179
|
-
SWC: 'swc',
|
180
|
-
},
|
181
|
-
/** Predefined resolve plugins */
|
182
|
-
RESOLVE_PLUGIN: {
|
183
|
-
/** ModuleScopePlugin */
|
184
|
-
MODULE_SCOPE: 'module-scope',
|
185
|
-
/** TsConfigPathsPlugin */
|
186
|
-
TS_CONFIG_PATHS: 'ts-config-paths',
|
187
|
-
},
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
5
|
+
var __export = (target, all) => {
|
6
|
+
for (var name in all)
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
188
8
|
};
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
11
|
+
for (let key of __getOwnPropNames(from))
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
14
|
+
}
|
15
|
+
return to;
|
16
|
+
};
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
18
|
+
var chainId_exports = {};
|
19
|
+
__export(chainId_exports, {
|
20
|
+
CHAIN_ID: () => CHAIN_ID
|
21
|
+
});
|
22
|
+
module.exports = __toCommonJS(chainId_exports);
|
23
|
+
const CHAIN_ID = {
|
24
|
+
RULE: {
|
25
|
+
MJS: "mjs",
|
26
|
+
LOADERS: "loaders",
|
27
|
+
FONT: "font",
|
28
|
+
IMAGE: "image",
|
29
|
+
MEDIA: "media",
|
30
|
+
JS: "js",
|
31
|
+
JS_DATA_URI: "js-data-uri",
|
32
|
+
TS: "ts",
|
33
|
+
CSS: "css",
|
34
|
+
LESS: "less",
|
35
|
+
SASS: "sass",
|
36
|
+
STYLUS: "stylus",
|
37
|
+
SVG: "svg",
|
38
|
+
PUG: "pug",
|
39
|
+
TOML: "toml",
|
40
|
+
YAML: "yaml",
|
41
|
+
JS_BFF_API: "js-bff-api"
|
42
|
+
},
|
43
|
+
ONE_OF: {
|
44
|
+
JS: "js",
|
45
|
+
TS: "ts",
|
46
|
+
CSS: "css",
|
47
|
+
LESS: "less",
|
48
|
+
SASS: "sass",
|
49
|
+
YAML: "yml",
|
50
|
+
TOML: "toml",
|
51
|
+
FALLBACK: "fallback",
|
52
|
+
MARKDOWN: "markdown",
|
53
|
+
BFF_CLIENT: "bff-client",
|
54
|
+
CSS_MODULES: "css-modules",
|
55
|
+
LESS_MODULES: "less-modules",
|
56
|
+
SASS_MODULES: "sass-modules",
|
57
|
+
SVG: "svg",
|
58
|
+
SVG_URL: "svg-url",
|
59
|
+
SVG_ASSET: "svg-asset",
|
60
|
+
SVG_INLINE: "svg-inline",
|
61
|
+
ASSETS: "assets",
|
62
|
+
ASSETS_URL: "assets-url",
|
63
|
+
ASSETS_INLINE: "assets-inline",
|
64
|
+
IMAGE_COMPRESS: "image-compress"
|
65
|
+
},
|
66
|
+
USE: {
|
67
|
+
TS: "ts",
|
68
|
+
CSS: "css",
|
69
|
+
SASS: "sass",
|
70
|
+
LESS: "less",
|
71
|
+
STYLUS: "stylus",
|
72
|
+
URL: "url",
|
73
|
+
PUG: "pug",
|
74
|
+
FILE: "file",
|
75
|
+
SVGR: "svgr",
|
76
|
+
YAML: "yaml",
|
77
|
+
TOML: "toml",
|
78
|
+
HTML: "html",
|
79
|
+
BABEL: "babel",
|
80
|
+
ESBUILD: "esbuild",
|
81
|
+
SWC: "swc",
|
82
|
+
STYLE: "style-loader",
|
83
|
+
POSTCSS: "postcss",
|
84
|
+
MARKDOWN: "markdown",
|
85
|
+
IGNORE_CSS: "ignore-css",
|
86
|
+
CSS_MODULES_TS: "css-modules-typescript",
|
87
|
+
MINI_CSS_EXTRACT: "mini-css-extract",
|
88
|
+
IMAGE_COMPRESS: "image-compress",
|
89
|
+
SVGO: "svgo",
|
90
|
+
IMAGEX: "imagex"
|
91
|
+
},
|
92
|
+
PLUGIN: {
|
93
|
+
HMR: "hmr",
|
94
|
+
COPY: "copy",
|
95
|
+
HTML: "html",
|
96
|
+
DEFINE: "define",
|
97
|
+
IGNORE: "ignore",
|
98
|
+
BANNER: "banner",
|
99
|
+
PROGRESS: "progress",
|
100
|
+
INSPECTOR: "inspector",
|
101
|
+
APP_ICON: "app-icon",
|
102
|
+
LOADABLE: "loadable",
|
103
|
+
MANIFEST: "webpack-manifest",
|
104
|
+
TS_CHECKER: "ts-checker",
|
105
|
+
INLINE_HTML: "inline-html",
|
106
|
+
BUNDLE_ANALYZER: "bundle-analyze",
|
107
|
+
BOTTOM_TEMPLATE: "bottom-template",
|
108
|
+
HTML_CROSS_ORIGIN: "html-cross-origin",
|
109
|
+
MINI_CSS_EXTRACT: "mini-css-extract",
|
110
|
+
REACT_FAST_REFRESH: "react-fast-refresh",
|
111
|
+
NODE_POLYFILL_PROVIDE: "node-polyfill-provide",
|
112
|
+
SUBRESOURCE_INTEGRITY: "subresource-integrity",
|
113
|
+
ASSETS_RETRY: "ASSETS_RETRY",
|
114
|
+
AUTO_SET_ROOT_SIZE: "auto-set-root-size",
|
115
|
+
HTML_ASYNC_CHUNK: "html-async-chunk",
|
116
|
+
SWC_POLYFILL_CHECKER: "swc-polyfill-checker-plugin",
|
117
|
+
HTML_TAGS: "html-tags"
|
118
|
+
},
|
119
|
+
MINIMIZER: {
|
120
|
+
JS: "js",
|
121
|
+
CSS: "css",
|
122
|
+
ESBUILD: "js-css",
|
123
|
+
SWC: "swc"
|
124
|
+
},
|
125
|
+
RESOLVE_PLUGIN: {
|
126
|
+
MODULE_SCOPE: "module-scope",
|
127
|
+
TS_CONFIG_PATHS: "ts-config-paths"
|
128
|
+
}
|
129
|
+
};
|
130
|
+
// Annotate the CommonJS export names for ESM import in node:
|
131
|
+
0 && (module.exports = {
|
132
|
+
CHAIN_ID
|
133
|
+
});
|
package/dist/clearConsole.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export declare const clearConsole: () => void;
|
1
|
+
export declare const clearConsole: () => void;
|
package/dist/clearConsole.js
CHANGED
@@ -1,9 +1,31 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
5
|
+
var __export = (target, all) => {
|
6
|
+
for (var name in all)
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
8
|
+
};
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
11
|
+
for (let key of __getOwnPropNames(from))
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
14
|
+
}
|
15
|
+
return to;
|
16
|
+
};
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
18
|
+
var clearConsole_exports = {};
|
19
|
+
__export(clearConsole_exports, {
|
20
|
+
clearConsole: () => clearConsole
|
21
|
+
});
|
22
|
+
module.exports = __toCommonJS(clearConsole_exports);
|
4
23
|
const clearConsole = () => {
|
5
|
-
|
6
|
-
|
7
|
-
|
24
|
+
if (process.stdout.isTTY && !process.env.DEBUG) {
|
25
|
+
process.stdout.write("\x1B[H\x1B[2J");
|
26
|
+
}
|
8
27
|
};
|
9
|
-
|
28
|
+
// Annotate the CommonJS export names for ESM import in node:
|
29
|
+
0 && (module.exports = {
|
30
|
+
clearConsole
|
31
|
+
});
|
package/dist/commands.d.ts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
export declare const getCommand: () => string;
|
2
|
-
export declare const isDevCommand: () => boolean;
|
2
|
+
export declare const isDevCommand: () => boolean;
|
package/dist/commands.js
CHANGED
@@ -1,14 +1,37 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
5
|
+
var __export = (target, all) => {
|
6
|
+
for (var name in all)
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
8
|
+
};
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
11
|
+
for (let key of __getOwnPropNames(from))
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
14
|
+
}
|
15
|
+
return to;
|
16
|
+
};
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
18
|
+
var commands_exports = {};
|
19
|
+
__export(commands_exports, {
|
20
|
+
getCommand: () => getCommand,
|
21
|
+
isDevCommand: () => isDevCommand
|
22
|
+
});
|
23
|
+
module.exports = __toCommonJS(commands_exports);
|
4
24
|
const getCommand = () => {
|
5
|
-
|
6
|
-
|
7
|
-
|
25
|
+
const args = process.argv.slice(2);
|
26
|
+
const command = args[0];
|
27
|
+
return command;
|
8
28
|
};
|
9
|
-
exports.getCommand = getCommand;
|
10
29
|
const isDevCommand = () => {
|
11
|
-
|
12
|
-
|
30
|
+
const command = getCommand();
|
31
|
+
return command === "dev" || command === "start";
|
13
32
|
};
|
14
|
-
|
33
|
+
// Annotate the CommonJS export names for ESM import in node:
|
34
|
+
0 && (module.exports = {
|
35
|
+
getCommand,
|
36
|
+
isDevCommand
|
37
|
+
});
|
package/dist/compatRequire.d.ts
CHANGED
@@ -6,8 +6,8 @@
|
|
6
6
|
export declare const compatRequire: (filePath: string, interop?: boolean) => any;
|
7
7
|
export declare const dynamicImport: Function;
|
8
8
|
export declare const requireExistModule: (filename: string, opt?: {
|
9
|
-
|
10
|
-
|
9
|
+
extensions?: string[];
|
10
|
+
interop?: boolean;
|
11
11
|
}) => any;
|
12
12
|
export declare const cleanRequireCache: (filelist: string[]) => void;
|
13
|
-
export declare function deleteRequireCache(path: string): void;
|
13
|
+
export declare function deleteRequireCache(path: string): void;
|
package/dist/compatRequire.js
CHANGED
@@ -1,46 +1,82 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
8
|
+
var __spreadValues = (a, b) => {
|
9
|
+
for (var prop in b || (b = {}))
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
12
|
+
if (__getOwnPropSymbols)
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
14
|
+
if (__propIsEnum.call(b, prop))
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
16
|
+
}
|
17
|
+
return a;
|
18
|
+
};
|
19
|
+
var __export = (target, all) => {
|
20
|
+
for (var name in all)
|
21
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
22
|
+
};
|
23
|
+
var __copyProps = (to, from, except, desc) => {
|
24
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
25
|
+
for (let key of __getOwnPropNames(from))
|
26
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
27
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
28
|
+
}
|
29
|
+
return to;
|
30
|
+
};
|
31
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
32
|
+
var compatRequire_exports = {};
|
33
|
+
__export(compatRequire_exports, {
|
34
|
+
cleanRequireCache: () => cleanRequireCache,
|
35
|
+
compatRequire: () => compatRequire,
|
36
|
+
deleteRequireCache: () => deleteRequireCache,
|
37
|
+
dynamicImport: () => dynamicImport,
|
38
|
+
requireExistModule: () => requireExistModule
|
39
|
+
});
|
40
|
+
module.exports = __toCommonJS(compatRequire_exports);
|
41
|
+
var import_findExists = require("./findExists");
|
10
42
|
const compatRequire = (filePath, interop = true) => {
|
11
|
-
|
12
|
-
|
13
|
-
|
43
|
+
const mod = require(filePath);
|
44
|
+
const rtnESMDefault = interop && (mod == null ? void 0 : mod.__esModule);
|
45
|
+
return rtnESMDefault ? mod.default : mod;
|
14
46
|
};
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
47
|
+
const dynamicImport = new Function(
|
48
|
+
"modulePath",
|
49
|
+
"return import(modulePath)"
|
50
|
+
);
|
19
51
|
const requireExistModule = (filename, opt) => {
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
return (0, exports.compatRequire)(exist, final.interop);
|
52
|
+
const final = __spreadValues({
|
53
|
+
extensions: [".ts", ".js"],
|
54
|
+
interop: true
|
55
|
+
}, opt);
|
56
|
+
const exist = (0, import_findExists.findExists)(final.extensions.map((ext) => `${filename}${ext}`));
|
57
|
+
if (!exist) {
|
58
|
+
return null;
|
59
|
+
}
|
60
|
+
return compatRequire(exist, final.interop);
|
30
61
|
};
|
31
|
-
exports.requireExistModule = requireExistModule;
|
32
62
|
const cleanRequireCache = (filelist) => {
|
33
|
-
|
34
|
-
|
35
|
-
|
63
|
+
filelist.forEach((filepath) => {
|
64
|
+
delete require.cache[filepath];
|
65
|
+
});
|
36
66
|
};
|
37
|
-
exports.cleanRequireCache = cleanRequireCache;
|
38
67
|
function deleteRequireCache(path) {
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
68
|
+
if (require.cache[path]) {
|
69
|
+
delete require.cache[path];
|
70
|
+
}
|
71
|
+
if (module.children) {
|
72
|
+
module.children = module.children.filter((item) => item.filename !== path);
|
73
|
+
}
|
45
74
|
}
|
46
|
-
|
75
|
+
// Annotate the CommonJS export names for ESM import in node:
|
76
|
+
0 && (module.exports = {
|
77
|
+
cleanRequireCache,
|
78
|
+
compatRequire,
|
79
|
+
deleteRequireCache,
|
80
|
+
dynamicImport,
|
81
|
+
requireExistModule
|
82
|
+
});
|
package/dist/compiled.d.ts
CHANGED
@@ -37,6 +37,7 @@ export type { default as WebpackChain } from '../compiled/webpack-chain';
|
|
37
37
|
* Lazy import some expensive modules that will slow down startup speed.
|
38
38
|
* Notice that `csmith-tools build` can not bundle lazy imported modules.
|
39
39
|
*/
|
40
|
+
|
40
41
|
export declare const mime: typeof import('../compiled/mime-types');
|
41
42
|
export declare const chokidar: typeof import('../compiled/chokidar');
|
42
|
-
export declare const inquirer: typeof import('../compiled/inquirer');
|
43
|
+
export declare const inquirer: typeof import('../compiled/inquirer');
|