@modern-js/utils 2.5.0 → 2.6.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 +12 -0
- package/dist/FileSizeReporter.js +4 -0
- package/dist/alias.js +4 -0
- package/dist/analyzeProject.js +4 -0
- package/dist/chainId.d.ts +3 -0
- package/dist/chainId.js +80 -0
- package/dist/compiled.js +4 -0
- package/dist/constants.d.ts +5 -0
- package/dist/constants.js +9 -0
- package/dist/ensureAbsolutePath.js +4 -0
- package/dist/findExists.js +4 -0
- package/dist/getCoreJsVersion.js +4 -0
- package/dist/getPackageManager.js +4 -0
- package/dist/getPort.js +4 -0
- package/dist/getServerConfig.js +4 -0
- package/dist/is/index.d.ts +7 -0
- package/dist/is/index.js +10 -0
- package/dist/logger.js +4 -0
- package/dist/monorepo.js +10 -3
- package/dist/path.js +4 -0
- package/dist/pathSerializer.js +4 -0
- package/dist/prettyInstructions.js +4 -0
- package/dist/react.js +4 -0
- package/dist/readTsConfig.js +4 -0
- package/dist/routes.js +4 -0
- package/dist/runtimeExports.js +4 -0
- package/dist/storage.js +4 -0
- package/dist/test-utils.js +7 -1
- package/dist/version.js +4 -0
- package/dist/watch.js +4 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# @modern-js/utils
|
2
2
|
|
3
|
+
## 2.6.0
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- e1f799e: fix: use 0.0.0.0 instead of localhost as the default dev host
|
8
|
+
fix: 使用 0.0.0.0 代替 localhost 作为默认的 dev host
|
9
|
+
- 7915ab3: fix: should not assign nestedRoutesEntry to entrypoint if use v5 router
|
10
|
+
fix: 使用 v5 路由的时候,不应该在 entrypoint 上挂载 nestedRoutesEntry 属性
|
11
|
+
- 0fe658a: feat(builder): support passing URL to html.favicon
|
12
|
+
|
13
|
+
feat(builder): 支持在 html.favicon 中直接传入 URL
|
14
|
+
|
3
15
|
## 2.5.0
|
4
16
|
|
5
17
|
### Patch Changes
|
package/dist/FileSizeReporter.js
CHANGED
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
18
18
|
return to;
|
19
19
|
};
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
22
26
|
mod
|
23
27
|
));
|
package/dist/alias.js
CHANGED
@@ -31,6 +31,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
31
31
|
return to;
|
32
32
|
};
|
33
33
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
34
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
35
|
+
// file that has been converted to a CommonJS file using a Babel-
|
36
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
37
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
34
38
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
35
39
|
mod
|
36
40
|
));
|
package/dist/analyzeProject.js
CHANGED
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
17
17
|
return to;
|
18
18
|
};
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
25
|
mod
|
22
26
|
));
|
package/dist/chainId.d.ts
CHANGED
package/dist/chainId.js
CHANGED
@@ -21,25 +21,44 @@ __export(chainId_exports, {
|
|
21
21
|
});
|
22
22
|
module.exports = __toCommonJS(chainId_exports);
|
23
23
|
const CHAIN_ID = {
|
24
|
+
/** Predefined rules */
|
24
25
|
RULE: {
|
26
|
+
/** Rule for .mjs */
|
25
27
|
MJS: "mjs",
|
28
|
+
/** Rule for predefined loaders */
|
26
29
|
LOADERS: "loaders",
|
30
|
+
/** Rule for fonts */
|
27
31
|
FONT: "font",
|
32
|
+
/** Rule for images */
|
28
33
|
IMAGE: "image",
|
34
|
+
/** Rule for media */
|
29
35
|
MEDIA: "media",
|
36
|
+
/** Rule for js */
|
30
37
|
JS: "js",
|
38
|
+
/** Rule for data uri encoded javascript */
|
31
39
|
JS_DATA_URI: "js-data-uri",
|
40
|
+
/** Rule for ts */
|
32
41
|
TS: "ts",
|
42
|
+
/** Rule for css */
|
33
43
|
CSS: "css",
|
44
|
+
/** Rule for less */
|
34
45
|
LESS: "less",
|
46
|
+
/** Rule for sass */
|
35
47
|
SASS: "sass",
|
48
|
+
/** Rule for stylus */
|
36
49
|
STYLUS: "stylus",
|
50
|
+
/** Rule for svg */
|
37
51
|
SVG: "svg",
|
52
|
+
/** Rule for pug */
|
38
53
|
PUG: "pug",
|
54
|
+
/** Rule for toml */
|
39
55
|
TOML: "toml",
|
56
|
+
/** Rule for yaml */
|
40
57
|
YAML: "yaml",
|
58
|
+
/** Rule for bff */
|
41
59
|
JS_BFF_API: "js-bff-api"
|
42
60
|
},
|
61
|
+
/** Predefined rule groups */
|
43
62
|
ONE_OF: {
|
44
63
|
JS: "js",
|
45
64
|
TS: "ts",
|
@@ -63,67 +82,128 @@ const CHAIN_ID = {
|
|
63
82
|
ASSETS_INLINE: "assets-inline",
|
64
83
|
IMAGE_COMPRESS: "image-compress"
|
65
84
|
},
|
85
|
+
/** Predefined loaders */
|
66
86
|
USE: {
|
87
|
+
/** ts-loader */
|
67
88
|
TS: "ts",
|
89
|
+
/** css-loader */
|
68
90
|
CSS: "css",
|
91
|
+
/** sass-loader */
|
69
92
|
SASS: "sass",
|
93
|
+
/** less-loader */
|
70
94
|
LESS: "less",
|
95
|
+
/** stylus-loader */
|
71
96
|
STYLUS: "stylus",
|
97
|
+
/** url-loader */
|
72
98
|
URL: "url",
|
99
|
+
/** pug-loader */
|
73
100
|
PUG: "pug",
|
101
|
+
/** file-loader */
|
74
102
|
FILE: "file",
|
103
|
+
/** @svgr/webpack */
|
75
104
|
SVGR: "svgr",
|
105
|
+
/** yaml-loader */
|
76
106
|
YAML: "yaml",
|
107
|
+
/** toml-loader */
|
77
108
|
TOML: "toml",
|
109
|
+
/** html-loader */
|
78
110
|
HTML: "html",
|
111
|
+
/** babel-loader */
|
79
112
|
BABEL: "babel",
|
113
|
+
/** esbuild-loader */
|
80
114
|
ESBUILD: "esbuild",
|
115
|
+
/** swc-loader */
|
81
116
|
SWC: "swc",
|
117
|
+
/** style-loader */
|
82
118
|
STYLE: "style-loader",
|
119
|
+
/** postcss-loader */
|
83
120
|
POSTCSS: "postcss",
|
121
|
+
/** markdown-loader */
|
84
122
|
MARKDOWN: "markdown",
|
123
|
+
/** ignore-css-loader */
|
85
124
|
IGNORE_CSS: "ignore-css",
|
125
|
+
/** css-modules-typescript-loader */
|
86
126
|
CSS_MODULES_TS: "css-modules-typescript",
|
127
|
+
/** mini-css-extract-plugin.loader */
|
87
128
|
MINI_CSS_EXTRACT: "mini-css-extract",
|
129
|
+
/** builder-plugin-image-compress.loader */
|
88
130
|
IMAGE_COMPRESS: "image-compress",
|
131
|
+
/** builder-plugin-image-compress svgo-loader */
|
89
132
|
SVGO: "svgo",
|
133
|
+
/** builder-plugin-imagex */
|
90
134
|
IMAGEX: "imagex"
|
91
135
|
},
|
136
|
+
/** Predefined plugins */
|
92
137
|
PLUGIN: {
|
138
|
+
/** HotModuleReplacementPlugin */
|
93
139
|
HMR: "hmr",
|
140
|
+
/** CopyWebpackPlugin */
|
94
141
|
COPY: "copy",
|
142
|
+
/** HtmlWebpackPlugin */
|
95
143
|
HTML: "html",
|
144
|
+
/** DefinePlugin */
|
96
145
|
DEFINE: "define",
|
146
|
+
/** IgnorePlugin */
|
97
147
|
IGNORE: "ignore",
|
148
|
+
/** BannerPlugin */
|
98
149
|
BANNER: "banner",
|
150
|
+
/** Webpackbar */
|
99
151
|
PROGRESS: "progress",
|
152
|
+
/** Inspector */
|
100
153
|
INSPECTOR: "inspector",
|
154
|
+
/** AppIconPlugin */
|
101
155
|
APP_ICON: "app-icon",
|
156
|
+
/** FaviconUrlPlugin */
|
157
|
+
FAVICON_URL: "favicon-url",
|
158
|
+
/** LoadableWebpackPlugin */
|
102
159
|
LOADABLE: "loadable",
|
160
|
+
/** WebpackManifestPlugin */
|
103
161
|
MANIFEST: "webpack-manifest",
|
162
|
+
/** ForkTsCheckerWebpackPlugin */
|
104
163
|
TS_CHECKER: "ts-checker",
|
164
|
+
/** InlineChunkHtmlPlugin */
|
105
165
|
INLINE_HTML: "inline-html",
|
166
|
+
/** WebpackBundleAnalyzer */
|
106
167
|
BUNDLE_ANALYZER: "bundle-analyze",
|
168
|
+
/** BottomTemplatePlugin */
|
107
169
|
BOTTOM_TEMPLATE: "bottom-template",
|
170
|
+
/** HtmlCrossOriginPlugin */
|
108
171
|
HTML_CROSS_ORIGIN: "html-cross-origin",
|
172
|
+
/** MiniCssExtractPlugin */
|
109
173
|
MINI_CSS_EXTRACT: "mini-css-extract",
|
174
|
+
/** ReactFastRefreshPlugin */
|
110
175
|
REACT_FAST_REFRESH: "react-fast-refresh",
|
176
|
+
/** ProvidePlugin for node polyfill */
|
111
177
|
NODE_POLYFILL_PROVIDE: "node-polyfill-provide",
|
178
|
+
/** WebpackSRIPlugin */
|
112
179
|
SUBRESOURCE_INTEGRITY: "subresource-integrity",
|
180
|
+
/** WebpackAssetsRetryPlugin */
|
113
181
|
ASSETS_RETRY: "ASSETS_RETRY",
|
182
|
+
/** AutoSetRootFontSizePlugin */
|
114
183
|
AUTO_SET_ROOT_SIZE: "auto-set-root-size",
|
184
|
+
/** HtmlAsyncChunkPlugin */
|
115
185
|
HTML_ASYNC_CHUNK: "html-async-chunk",
|
186
|
+
/** SWC_POLYFILL_CHECKER */
|
116
187
|
SWC_POLYFILL_CHECKER: "swc-polyfill-checker-plugin",
|
188
|
+
/** HtmlTagsPlugin */
|
117
189
|
HTML_TAGS: "html-tags"
|
118
190
|
},
|
191
|
+
/** Predefined minimizers */
|
119
192
|
MINIMIZER: {
|
193
|
+
/** TerserWebpackPlugin */
|
120
194
|
JS: "js",
|
195
|
+
/** CssMinimizerWebpackPlugin */
|
121
196
|
CSS: "css",
|
197
|
+
/** ESBuildPlugin */
|
122
198
|
ESBUILD: "js-css",
|
199
|
+
/** SWCPlugin */
|
123
200
|
SWC: "swc"
|
124
201
|
},
|
202
|
+
/** Predefined resolve plugins */
|
125
203
|
RESOLVE_PLUGIN: {
|
204
|
+
/** ModuleScopePlugin */
|
126
205
|
MODULE_SCOPE: "module-scope",
|
206
|
+
/** TsConfigPathsPlugin */
|
127
207
|
TS_CONFIG_PATHS: "ts-config-paths"
|
128
208
|
}
|
129
209
|
};
|
package/dist/compiled.js
CHANGED
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
17
17
|
return to;
|
18
18
|
};
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
25
|
mod
|
22
26
|
));
|
package/dist/constants.d.ts
CHANGED
@@ -82,6 +82,11 @@ export declare const ROUTE_MANIFEST = "_MODERNJS_ROUTE_MANIFEST";
|
|
82
82
|
*/
|
83
83
|
|
84
84
|
export declare const LOADER_ROUTES_DIR = "loader-routes";
|
85
|
+
/**
|
86
|
+
* default host for dev
|
87
|
+
*/
|
88
|
+
|
89
|
+
export declare const DEFAULT_DEV_HOST = "0.0.0.0";
|
85
90
|
/**
|
86
91
|
* Internal app-tools plugins that work as soon as they are installed.
|
87
92
|
*/
|
package/dist/constants.js
CHANGED
@@ -20,6 +20,7 @@ __export(constants_exports, {
|
|
20
20
|
API_DIR: () => API_DIR,
|
21
21
|
CONFIG_CACHE_DIR: () => CONFIG_CACHE_DIR,
|
22
22
|
CONFIG_FILE_EXTENSIONS: () => CONFIG_FILE_EXTENSIONS,
|
23
|
+
DEFAULT_DEV_HOST: () => DEFAULT_DEV_HOST,
|
23
24
|
DEFAULT_SERVER_CONFIG: () => DEFAULT_SERVER_CONFIG,
|
24
25
|
ENTRY_NAME_PATTERN: () => ENTRY_NAME_PATTERN,
|
25
26
|
HMR_SOCK_PATH: () => HMR_SOCK_PATH,
|
@@ -72,6 +73,7 @@ const DEFAULT_SERVER_CONFIG = "modern.server-runtime.config";
|
|
72
73
|
const ROUTE_MINIFEST_FILE = "routes-manifest.json";
|
73
74
|
const ROUTE_MANIFEST = `_MODERNJS_ROUTE_MANIFEST`;
|
74
75
|
const LOADER_ROUTES_DIR = `loader-routes`;
|
76
|
+
const DEFAULT_DEV_HOST = "0.0.0.0";
|
75
77
|
const INTERNAL_APP_TOOLS_PLUGINS = {
|
76
78
|
"@modern-js/app-tools": "@modern-js/app-tools/cli",
|
77
79
|
"@modern-js/plugin-proxy": "@modern-js/plugin-proxy/cli",
|
@@ -87,6 +89,7 @@ const INTERNAL_APP_TOOLS_PLUGINS = {
|
|
87
89
|
"@modern-js/plugin-garfish": "@modern-js/plugin-garfish/cli",
|
88
90
|
"@modern-js/plugin-tailwindcss": "@modern-js/plugin-tailwindcss/cli",
|
89
91
|
"@modern-js/plugin-polyfill": "@modern-js/plugin-polyfill/cli",
|
92
|
+
// legacy router (inner react-router-dom v5)
|
90
93
|
"@modern-js/plugin-router-v5": "@modern-js/plugin-router-v5/cli"
|
91
94
|
};
|
92
95
|
const INTERNAL_APP_TOOLS_RUNTIME_PLUGINS = {
|
@@ -99,7 +102,9 @@ const INTERNAL_MODULE_TOOLS_PLUGINS = {
|
|
99
102
|
"@modern-js/plugin-testing": "@modern-js/plugin-testing/cli",
|
100
103
|
"@modern-js/plugin-storybook": "@modern-js/plugin-storybook/cli",
|
101
104
|
"@modern-js/plugin-tailwindcss": "@modern-js/plugin-tailwindcss/cli",
|
105
|
+
// TODO: Maybe can remove it
|
102
106
|
"@modern-js/plugin-nocode": "@modern-js/plugin-nocode/cli",
|
107
|
+
// legacy router (inner react-router-dom v5)
|
103
108
|
"@modern-js/plugin-router-legacy": "@modern-js/plugin-router-legacy/cli"
|
104
109
|
};
|
105
110
|
const INTERNAL_MONOREPO_TOOLS_PLUGINS = {
|
@@ -131,7 +136,9 @@ const INTERNAL_CLI_PLUGINS = {
|
|
131
136
|
"@modern-js/plugin-garfish": "@modern-js/plugin-garfish/cli",
|
132
137
|
"@modern-js/plugin-tailwindcss": "@modern-js/plugin-tailwindcss/cli",
|
133
138
|
"@modern-js/plugin-polyfill": "@modern-js/plugin-polyfill/cli",
|
139
|
+
// TODO: Maybe can remove it
|
134
140
|
"@modern-js/plugin-nocode": "@modern-js/plugin-nocode/cli",
|
141
|
+
// legacy router (inner react-router-dom v5)
|
135
142
|
"@modern-js/plugin-router-v5": "@modern-js/plugin-router-v5/cli"
|
136
143
|
};
|
137
144
|
const SERVER_PLUGIN_BFF = "@modern-js/plugin-bff";
|
@@ -222,6 +229,7 @@ const PLUGIN_SCHEMAS = {
|
|
222
229
|
}
|
223
230
|
],
|
224
231
|
"@modern-js/plugin-design-token": [
|
232
|
+
// Legacy Features
|
225
233
|
{
|
226
234
|
target: "source.designSystem",
|
227
235
|
schema: { typeof: ["object"] }
|
@@ -272,6 +280,7 @@ const PLUGIN_SCHEMAS = {
|
|
272
280
|
API_DIR,
|
273
281
|
CONFIG_CACHE_DIR,
|
274
282
|
CONFIG_FILE_EXTENSIONS,
|
283
|
+
DEFAULT_DEV_HOST,
|
275
284
|
DEFAULT_SERVER_CONFIG,
|
276
285
|
ENTRY_NAME_PATTERN,
|
277
286
|
HMR_SOCK_PATH,
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
17
17
|
return to;
|
18
18
|
};
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
25
|
mod
|
22
26
|
));
|
package/dist/findExists.js
CHANGED
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
17
17
|
return to;
|
18
18
|
};
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
25
|
mod
|
22
26
|
));
|
package/dist/getCoreJsVersion.js
CHANGED
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
17
17
|
return to;
|
18
18
|
};
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
25
|
mod
|
22
26
|
));
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
17
17
|
return to;
|
18
18
|
};
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
25
|
mod
|
22
26
|
));
|
package/dist/getPort.js
CHANGED
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
17
17
|
return to;
|
18
18
|
};
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
25
|
mod
|
22
26
|
));
|
package/dist/getServerConfig.js
CHANGED
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
17
17
|
return to;
|
18
18
|
};
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
25
|
mod
|
22
26
|
));
|
package/dist/is/index.d.ts
CHANGED
@@ -40,6 +40,13 @@ export declare const isUseSSRBundle: (config: any) => boolean;
|
|
40
40
|
|
41
41
|
export declare const isServiceWorker: (config: any) => boolean;
|
42
42
|
export declare const isFastRefresh: () => boolean;
|
43
|
+
export declare const isRouterV5: (config: {
|
44
|
+
runtime?: {
|
45
|
+
router?: {
|
46
|
+
mode?: string;
|
47
|
+
} | boolean;
|
48
|
+
};
|
49
|
+
}) => boolean;
|
43
50
|
export * from './node-env';
|
44
51
|
export * from './platform';
|
45
52
|
export * from './type';
|
package/dist/is/index.js
CHANGED
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
18
18
|
};
|
19
19
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
22
26
|
mod
|
23
27
|
));
|
@@ -27,6 +31,7 @@ __export(is_exports, {
|
|
27
31
|
isDepExists: () => isDepExists,
|
28
32
|
isEmpty: () => isEmpty,
|
29
33
|
isFastRefresh: () => isFastRefresh,
|
34
|
+
isRouterV5: () => isRouterV5,
|
30
35
|
isSSR: () => isSSR,
|
31
36
|
isServiceWorker: () => isServiceWorker,
|
32
37
|
isTypescript: () => isTypescript,
|
@@ -82,11 +87,16 @@ const isServiceWorker = (config) => {
|
|
82
87
|
return false;
|
83
88
|
};
|
84
89
|
const isFastRefresh = () => (0, import_node_env.isDev)() && process.env.FAST_REFRESH !== "false";
|
90
|
+
const isRouterV5 = (config) => {
|
91
|
+
var _a, _b, _c;
|
92
|
+
return typeof ((_a = config.runtime) == null ? void 0 : _a.router) !== "boolean" && ((_c = (_b = config == null ? void 0 : config.runtime) == null ? void 0 : _b.router) == null ? void 0 : _c.mode) === "react-router-5";
|
93
|
+
};
|
85
94
|
// Annotate the CommonJS export names for ESM import in node:
|
86
95
|
0 && (module.exports = {
|
87
96
|
isDepExists,
|
88
97
|
isEmpty,
|
89
98
|
isFastRefresh,
|
99
|
+
isRouterV5,
|
90
100
|
isSSR,
|
91
101
|
isServiceWorker,
|
92
102
|
isTypescript,
|
package/dist/logger.js
CHANGED
@@ -31,6 +31,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
31
31
|
return to;
|
32
32
|
};
|
33
33
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
34
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
35
|
+
// file that has been converted to a CommonJS file using a Babel-
|
36
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
37
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
34
38
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
35
39
|
mod
|
36
40
|
));
|
package/dist/monorepo.js
CHANGED
@@ -31,6 +31,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
31
31
|
return to;
|
32
32
|
};
|
33
33
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
34
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
35
|
+
// file that has been converted to a CommonJS file using a Babel-
|
36
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
37
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
34
38
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
35
39
|
mod
|
36
40
|
));
|
@@ -106,9 +110,12 @@ const getMonorepoPackages = (root) => {
|
|
106
110
|
}
|
107
111
|
if (packages) {
|
108
112
|
return packages.map(
|
109
|
-
(name) =>
|
110
|
-
|
111
|
-
|
113
|
+
(name) => (
|
114
|
+
// The trailing / ensures only dirs are picked up
|
115
|
+
import_compiled.glob.sync(import_path.default.join(root, `${name}/`), {
|
116
|
+
ignore: ["**/node_modules/**"]
|
117
|
+
})
|
118
|
+
)
|
112
119
|
).reduce((acc, val) => acc.concat(val), []).filter((filepath) => import_fs.default.existsSync(import_path.default.resolve(filepath, "package.json"))).map((filepath) => ({
|
113
120
|
path: filepath,
|
114
121
|
name: JSON.parse(
|
package/dist/path.js
CHANGED
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
17
17
|
return to;
|
18
18
|
};
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
25
|
mod
|
22
26
|
));
|
package/dist/pathSerializer.js
CHANGED
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
17
17
|
return to;
|
18
18
|
};
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
25
|
mod
|
22
26
|
));
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
17
17
|
return to;
|
18
18
|
};
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
25
|
mod
|
22
26
|
));
|
package/dist/react.js
CHANGED
@@ -31,6 +31,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
31
31
|
return to;
|
32
32
|
};
|
33
33
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
34
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
35
|
+
// file that has been converted to a CommonJS file using a Babel-
|
36
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
37
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
34
38
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
35
39
|
mod
|
36
40
|
));
|
package/dist/readTsConfig.js
CHANGED
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
17
17
|
return to;
|
18
18
|
};
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
25
|
mod
|
22
26
|
));
|
package/dist/routes.js
CHANGED
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
17
17
|
return to;
|
18
18
|
};
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
25
|
mod
|
22
26
|
));
|
package/dist/runtimeExports.js
CHANGED
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
17
17
|
return to;
|
18
18
|
};
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
25
|
mod
|
22
26
|
));
|
package/dist/storage.js
CHANGED
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
17
17
|
return to;
|
18
18
|
};
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
25
|
mod
|
22
26
|
));
|
package/dist/test-utils.js
CHANGED
@@ -23,7 +23,13 @@ module.exports = __toCommonJS(test_utils_exports);
|
|
23
23
|
const initSnapshotSerializer = (root) => {
|
24
24
|
expect.addSnapshotSerializer({
|
25
25
|
test: (val) => typeof val === "string" && (val.includes("modern.js") || val.includes("node_modules") || val.includes(root)),
|
26
|
-
print: (val) =>
|
26
|
+
print: (val) => (
|
27
|
+
// eslint-disable-next-line no-nested-ternary
|
28
|
+
typeof val === "string" ? (
|
29
|
+
// eslint-disable-next-line no-nested-ternary
|
30
|
+
val.includes("node_modules") ? `"${val.replace(/.+node_modules/, ``).replace(/\\/g, "/")}"` : val.includes("modern.js") ? `"${val.replace(/.+modern\.js/, ``).replace(/\\/g, "/")}"` : `"${val.replace(root, "").replace(/\\/g, "/")}"`
|
31
|
+
) : val
|
32
|
+
)
|
27
33
|
});
|
28
34
|
};
|
29
35
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/version.js
CHANGED
@@ -31,6 +31,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
31
31
|
return to;
|
32
32
|
};
|
33
33
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
34
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
35
|
+
// file that has been converted to a CommonJS file using a Babel-
|
36
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
37
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
34
38
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
35
39
|
mod
|
36
40
|
));
|
package/dist/watch.js
CHANGED
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
17
17
|
return to;
|
18
18
|
};
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
25
|
mod
|
22
26
|
));
|
package/package.json
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
"modern",
|
12
12
|
"modern.js"
|
13
13
|
],
|
14
|
-
"version": "2.
|
14
|
+
"version": "2.6.0",
|
15
15
|
"jsnext:source": "./src/index.ts",
|
16
16
|
"types": "./dist/index.d.ts",
|
17
17
|
"main": "./dist/index.js",
|
@@ -133,9 +133,9 @@
|
|
133
133
|
"jest": "^27",
|
134
134
|
"typescript": "^4",
|
135
135
|
"webpack": "^5.75.0",
|
136
|
-
"@modern-js/types": "2.
|
137
|
-
"@scripts/jest-config": "2.
|
138
|
-
"@scripts/build": "2.
|
136
|
+
"@modern-js/types": "2.6.0",
|
137
|
+
"@scripts/jest-config": "2.6.0",
|
138
|
+
"@scripts/build": "2.6.0"
|
139
139
|
},
|
140
140
|
"sideEffects": false,
|
141
141
|
"scripts": {
|