@modern-js/utils 2.5.1-alpha.2 → 2.7.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 +31 -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/getTargetDir.js +4 -0
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -2
- package/dist/is/index.d.ts +8 -1
- package/dist/is/index.js +13 -3
- package/dist/is/{node-env.js → nodeEnv.js} +3 -3
- package/dist/logger.js +4 -0
- package/dist/monorepo.js +10 -3
- package/dist/nestedRoutes.d.ts +11 -0
- package/dist/nestedRoutes.js +129 -0
- 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/remix-router.d.ts +1 -0
- package/dist/remix-router.js +17 -0
- package/dist/routes.js +4 -0
- package/dist/runtimeExports.js +4 -0
- package/dist/serialize.d.ts +1 -0
- package/dist/serialize.js +40 -0
- package/dist/storage.js +4 -0
- package/dist/{test-utils.js → testUtils.js} +10 -4
- package/dist/version.js +4 -0
- package/dist/watch.js +4 -0
- package/package.json +40 -6
- /package/dist/is/{node-env.d.ts → nodeEnv.d.ts} +0 -0
- /package/dist/{test-utils.d.ts → testUtils.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,36 @@
|
|
1
1
|
# @modern-js/utils
|
2
2
|
|
3
|
+
## 2.7.0
|
4
|
+
|
5
|
+
### Minor Changes
|
6
|
+
|
7
|
+
- dcad887024: feat: support deferred data for streaming ssr
|
8
|
+
feat: 流式渲染支持 deferred data
|
9
|
+
- 84bfb439b8: feat: support custom apiDir, lambdaDir and style of writing for bff
|
10
|
+
feat: 支持定制 api 目录,lambda 目录,bff 的写法
|
11
|
+
|
12
|
+
### Patch Changes
|
13
|
+
|
14
|
+
- 0f15fc597c: fix: remove nestedRoutes export
|
15
|
+
fix: 移除 nestedRoutes 导出
|
16
|
+
- a4672f7c16: fix: lock @modern-js/utils/ssr by webpack alias
|
17
|
+
fix: 通过 webpack 别名将 @modern-js/utils/ssr 锁到同一版本
|
18
|
+
- 7fff9020e1: chore: make file naming consistent
|
19
|
+
|
20
|
+
chore: 统一文件命名为小驼峰格式
|
21
|
+
|
22
|
+
## 2.6.0
|
23
|
+
|
24
|
+
### Patch Changes
|
25
|
+
|
26
|
+
- e1f799e: fix: use 0.0.0.0 instead of localhost as the default dev host
|
27
|
+
fix: 使用 0.0.0.0 代替 localhost 作为默认的 dev host
|
28
|
+
- 7915ab3: fix: should not assign nestedRoutesEntry to entrypoint if use v5 router
|
29
|
+
fix: 使用 v5 路由的时候,不应该在 entrypoint 上挂载 nestedRoutesEntry 属性
|
30
|
+
- 0fe658a: feat(builder): support passing URL to html.favicon
|
31
|
+
|
32
|
+
feat(builder): 支持在 html.favicon 中直接传入 URL
|
33
|
+
|
3
34
|
## 2.5.0
|
4
35
|
|
5
36
|
### 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/getTargetDir.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/index.d.ts
CHANGED
@@ -32,14 +32,13 @@ export * from './nodeEnv';
|
|
32
32
|
export * from './wait';
|
33
33
|
export * from './emptyDir';
|
34
34
|
export * from './getServerConfig';
|
35
|
-
export * from './ssr';
|
36
35
|
export * from './tryResolve';
|
37
36
|
export * from './analyzeProject';
|
38
37
|
export * from './chainId';
|
39
38
|
export * from './version';
|
40
39
|
export * from './plugin';
|
41
40
|
export * from './routes';
|
42
|
-
export * from './
|
41
|
+
export * from './testUtils';
|
43
42
|
export * from './getCoreJsVersion';
|
44
43
|
export * from './react';
|
45
44
|
export * from './getTargetDir';
|
package/dist/index.js
CHANGED
@@ -48,14 +48,13 @@ __reExport(src_exports, require("./nodeEnv"), module.exports);
|
|
48
48
|
__reExport(src_exports, require("./wait"), module.exports);
|
49
49
|
__reExport(src_exports, require("./emptyDir"), module.exports);
|
50
50
|
__reExport(src_exports, require("./getServerConfig"), module.exports);
|
51
|
-
__reExport(src_exports, require("./ssr"), module.exports);
|
52
51
|
__reExport(src_exports, require("./tryResolve"), module.exports);
|
53
52
|
__reExport(src_exports, require("./analyzeProject"), module.exports);
|
54
53
|
__reExport(src_exports, require("./chainId"), module.exports);
|
55
54
|
__reExport(src_exports, require("./version"), module.exports);
|
56
55
|
__reExport(src_exports, require("./plugin"), module.exports);
|
57
56
|
__reExport(src_exports, require("./routes"), module.exports);
|
58
|
-
__reExport(src_exports, require("./
|
57
|
+
__reExport(src_exports, require("./testUtils"), module.exports);
|
59
58
|
__reExport(src_exports, require("./getCoreJsVersion"), module.exports);
|
60
59
|
__reExport(src_exports, require("./react"), module.exports);
|
61
60
|
__reExport(src_exports, require("./getTargetDir"), module.exports);
|
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
|
43
|
+
export declare const isRouterV5: (config: {
|
44
|
+
runtime?: {
|
45
|
+
router?: {
|
46
|
+
mode?: string;
|
47
|
+
} | boolean;
|
48
|
+
};
|
49
|
+
}) => boolean;
|
50
|
+
export * from './nodeEnv';
|
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,
|
@@ -36,8 +41,8 @@ module.exports = __toCommonJS(is_exports);
|
|
36
41
|
var import_fs = __toESM(require("fs"));
|
37
42
|
var import_path = __toESM(require("path"));
|
38
43
|
var import_debug = require("../debug");
|
39
|
-
var
|
40
|
-
__reExport(is_exports, require("./
|
44
|
+
var import_nodeEnv = require("./nodeEnv");
|
45
|
+
__reExport(is_exports, require("./nodeEnv"), module.exports);
|
41
46
|
__reExport(is_exports, require("./platform"), module.exports);
|
42
47
|
__reExport(is_exports, require("./type"), module.exports);
|
43
48
|
const debug = (0, import_debug.createDebugger)("judge-depExists");
|
@@ -81,12 +86,17 @@ const isServiceWorker = (config) => {
|
|
81
86
|
}
|
82
87
|
return false;
|
83
88
|
};
|
84
|
-
const isFastRefresh = () => (0,
|
89
|
+
const isFastRefresh = () => (0, import_nodeEnv.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,
|
@@ -15,15 +15,15 @@ var __copyProps = (to, from, except, desc) => {
|
|
15
15
|
return to;
|
16
16
|
};
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
18
|
-
var
|
19
|
-
__export(
|
18
|
+
var nodeEnv_exports = {};
|
19
|
+
__export(nodeEnv_exports, {
|
20
20
|
getNodeEnv: () => getNodeEnv,
|
21
21
|
isDev: () => isDev,
|
22
22
|
isProd: () => isProd,
|
23
23
|
isProdProfile: () => isProdProfile,
|
24
24
|
isTest: () => isTest
|
25
25
|
});
|
26
|
-
module.exports = __toCommonJS(
|
26
|
+
module.exports = __toCommonJS(nodeEnv_exports);
|
27
27
|
const getNodeEnv = () => process.env.NODE_ENV || "development";
|
28
28
|
const isDev = () => getNodeEnv() === "development";
|
29
29
|
const isProd = () => getNodeEnv() === "production";
|
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(
|
@@ -0,0 +1,11 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
|
3
|
+
/**
|
4
|
+
* runtime utils for nested routes generating
|
5
|
+
*/
|
6
|
+
import type { NestedRoute } from '@modern-js/types';
|
7
|
+
export declare const transformNestedRoutes: (routes: NestedRoute[]) => import("react-router-dom").RouteObject[];
|
8
|
+
export declare const renderNestedRoute: (nestedRoute: NestedRoute, options?: {
|
9
|
+
parent?: NestedRoute;
|
10
|
+
DeferredDataComponent?: () => JSX.Element | null;
|
11
|
+
}) => JSX.Element;
|
@@ -0,0 +1,129 @@
|
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __defProps = Object.defineProperties;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
10
|
+
var __spreadValues = (a, b) => {
|
11
|
+
for (var prop in b || (b = {}))
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
14
|
+
if (__getOwnPropSymbols)
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
16
|
+
if (__propIsEnum.call(b, prop))
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
18
|
+
}
|
19
|
+
return a;
|
20
|
+
};
|
21
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
22
|
+
var __export = (target, all) => {
|
23
|
+
for (var name in all)
|
24
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
25
|
+
};
|
26
|
+
var __copyProps = (to, from, except, desc) => {
|
27
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
28
|
+
for (let key of __getOwnPropNames(from))
|
29
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
30
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
31
|
+
}
|
32
|
+
return to;
|
33
|
+
};
|
34
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
35
|
+
var nestedRoutes_exports = {};
|
36
|
+
__export(nestedRoutes_exports, {
|
37
|
+
renderNestedRoute: () => renderNestedRoute,
|
38
|
+
transformNestedRoutes: () => transformNestedRoutes
|
39
|
+
});
|
40
|
+
module.exports = __toCommonJS(nestedRoutes_exports);
|
41
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
42
|
+
var import_react = require("react");
|
43
|
+
var import_react_router_dom = require("react-router-dom");
|
44
|
+
const transformNestedRoutes = (routes) => {
|
45
|
+
const routeElements = [];
|
46
|
+
for (const route of routes) {
|
47
|
+
const routeElement = renderNestedRoute(route);
|
48
|
+
routeElements.push(routeElement);
|
49
|
+
}
|
50
|
+
return (0, import_react_router_dom.createRoutesFromElements)(routeElements);
|
51
|
+
};
|
52
|
+
const renderNestedRoute = (nestedRoute, options = {}) => {
|
53
|
+
const { children, index, id, component, isRoot } = nestedRoute;
|
54
|
+
const Component = component;
|
55
|
+
const { parent, DeferredDataComponent } = options;
|
56
|
+
const routeProps = {
|
57
|
+
caseSensitive: nestedRoute.caseSensitive,
|
58
|
+
path: nestedRoute.path,
|
59
|
+
id: nestedRoute.id,
|
60
|
+
loader: createLoader(nestedRoute),
|
61
|
+
action: nestedRoute.action,
|
62
|
+
hasErrorBoundary: nestedRoute.hasErrorBoundary,
|
63
|
+
shouldRevalidate: nestedRoute.shouldRevalidate,
|
64
|
+
handle: nestedRoute.handle,
|
65
|
+
index: nestedRoute.index,
|
66
|
+
element: nestedRoute.element,
|
67
|
+
errorElement: nestedRoute.errorElement
|
68
|
+
};
|
69
|
+
if (nestedRoute.error) {
|
70
|
+
const errorElement = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(nestedRoute.error, {});
|
71
|
+
routeProps.errorElement = errorElement;
|
72
|
+
}
|
73
|
+
let element;
|
74
|
+
if (Component) {
|
75
|
+
if (parent == null ? void 0 : parent.loading) {
|
76
|
+
const Loading = parent.loading;
|
77
|
+
if (isLoadableComponent(Component)) {
|
78
|
+
element = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { fallback: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Loading, {}) });
|
79
|
+
} else {
|
80
|
+
element = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Loading, {}), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {}) });
|
81
|
+
}
|
82
|
+
} else if (isLoadableComponent(Component)) {
|
83
|
+
element = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {});
|
84
|
+
} else if (isRoot) {
|
85
|
+
element = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
86
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {}),
|
87
|
+
typeof document === "undefined" && DeferredDataComponent && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DeferredDataComponent, {})
|
88
|
+
] });
|
89
|
+
} else {
|
90
|
+
element = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {}) });
|
91
|
+
}
|
92
|
+
} else {
|
93
|
+
nestedRoute.loading = parent == null ? void 0 : parent.loading;
|
94
|
+
}
|
95
|
+
if (element) {
|
96
|
+
routeProps.element = element;
|
97
|
+
}
|
98
|
+
const childElements = children == null ? void 0 : children.map((childRoute) => {
|
99
|
+
return renderNestedRoute(childRoute, { parent: nestedRoute });
|
100
|
+
});
|
101
|
+
const routeElement = index ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Route, __spreadProps(__spreadValues({}, routeProps), { index: true }), id) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Route, __spreadProps(__spreadValues({}, routeProps), { index: false, children: childElements }), id);
|
102
|
+
return routeElement;
|
103
|
+
};
|
104
|
+
function createLoader(route) {
|
105
|
+
const { loader } = route;
|
106
|
+
if (loader) {
|
107
|
+
return (args) => {
|
108
|
+
if (typeof route.lazyImport === "function") {
|
109
|
+
route.lazyImport();
|
110
|
+
}
|
111
|
+
return loader(args);
|
112
|
+
};
|
113
|
+
} else {
|
114
|
+
return () => {
|
115
|
+
if (typeof route.lazyImport === "function") {
|
116
|
+
route.lazyImport();
|
117
|
+
}
|
118
|
+
return null;
|
119
|
+
};
|
120
|
+
}
|
121
|
+
}
|
122
|
+
function isLoadableComponent(component) {
|
123
|
+
return component && component.displayName === "Loadable" && component.preload && typeof component.preload === "function";
|
124
|
+
}
|
125
|
+
// Annotate the CommonJS export names for ESM import in node:
|
126
|
+
0 && (module.exports = {
|
127
|
+
renderNestedRoute,
|
128
|
+
transformNestedRoutes
|
129
|
+
});
|
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
|
));
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from '@remix-run/router';
|
@@ -0,0 +1,17 @@
|
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
7
|
+
for (let key of __getOwnPropNames(from))
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
10
|
+
}
|
11
|
+
return to;
|
12
|
+
};
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
15
|
+
var remix_router_exports = {};
|
16
|
+
module.exports = __toCommonJS(remix_router_exports);
|
17
|
+
__reExport(remix_router_exports, require("@remix-run/router"), module.exports);
|
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
|
));
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const serializeJson: (data: any) => string;
|
@@ -0,0 +1,40 @@
|
|
1
|
+
var __create = Object.create;
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
7
|
+
var __export = (target, all) => {
|
8
|
+
for (var name in all)
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
10
|
+
};
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
13
|
+
for (let key of __getOwnPropNames(from))
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
16
|
+
}
|
17
|
+
return to;
|
18
|
+
};
|
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.
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
25
|
+
mod
|
26
|
+
));
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
28
|
+
var serialize_exports = {};
|
29
|
+
__export(serialize_exports, {
|
30
|
+
serializeJson: () => serializeJson
|
31
|
+
});
|
32
|
+
module.exports = __toCommonJS(serialize_exports);
|
33
|
+
var import_serialize_javascript = __toESM(require("serialize-javascript"));
|
34
|
+
const serializeJson = (data) => {
|
35
|
+
return (0, import_serialize_javascript.default)(data, { isJSON: true });
|
36
|
+
};
|
37
|
+
// Annotate the CommonJS export names for ESM import in node:
|
38
|
+
0 && (module.exports = {
|
39
|
+
serializeJson
|
40
|
+
});
|
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
|
));
|
@@ -15,15 +15,21 @@ var __copyProps = (to, from, except, desc) => {
|
|
15
15
|
return to;
|
16
16
|
};
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
18
|
-
var
|
19
|
-
__export(
|
18
|
+
var testUtils_exports = {};
|
19
|
+
__export(testUtils_exports, {
|
20
20
|
initSnapshotSerializer: () => initSnapshotSerializer
|
21
21
|
});
|
22
|
-
module.exports = __toCommonJS(
|
22
|
+
module.exports = __toCommonJS(testUtils_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.7.0",
|
15
15
|
"jsnext:source": "./src/index.ts",
|
16
16
|
"types": "./dist/index.d.ts",
|
17
17
|
"main": "./dist/index.js",
|
@@ -23,6 +23,9 @@
|
|
23
23
|
"./format": "./dist/format.js",
|
24
24
|
"./logger": "./dist/logger.js",
|
25
25
|
"./constants": "./dist/constants.js",
|
26
|
+
"./serialize": "./dist/serialize.js",
|
27
|
+
"./nestedRoutes": "./dist/nestedRoutes.js",
|
28
|
+
"./remix-router": "./dist/remix-router.js",
|
26
29
|
"./ajv": "./compiled/ajv/index.js",
|
27
30
|
"./glob": "./compiled/glob/index.js",
|
28
31
|
"./chalk": "./compiled/chalk/index.js",
|
@@ -61,6 +64,12 @@
|
|
61
64
|
"constants": [
|
62
65
|
"./dist/constants.d.ts"
|
63
66
|
],
|
67
|
+
"serialize": [
|
68
|
+
"./dist/serialize.d.ts"
|
69
|
+
],
|
70
|
+
"nestedRoutes": [
|
71
|
+
"./dist/nestedRoutes.d.ts"
|
72
|
+
],
|
64
73
|
"ajv": [
|
65
74
|
"./compiled/ajv/types/ajv.d.ts"
|
66
75
|
],
|
@@ -120,22 +129,47 @@
|
|
120
129
|
],
|
121
130
|
"chain-id": [
|
122
131
|
"./dist/chainId.d.ts"
|
132
|
+
],
|
133
|
+
"remix-router": [
|
134
|
+
"./dist/remix-router.d.ts"
|
123
135
|
]
|
124
136
|
}
|
125
137
|
},
|
126
138
|
"dependencies": {
|
127
139
|
"caniuse-lite": "^1.0.30001451",
|
128
|
-
"lodash": "^4.17.21"
|
140
|
+
"lodash": "^4.17.21",
|
141
|
+
"serialize-javascript": "^6.0.0",
|
142
|
+
"@remix-run/router": "^1.3.2"
|
143
|
+
},
|
144
|
+
"peerDependencies": {
|
145
|
+
"react": ">=17.0.0",
|
146
|
+
"react-dom": ">=17.0.0",
|
147
|
+
"react-router-dom": "^6.8.1"
|
148
|
+
},
|
149
|
+
"peerDependenciesMeta": {
|
150
|
+
"react": {
|
151
|
+
"optional": true
|
152
|
+
},
|
153
|
+
"react-dom": {
|
154
|
+
"optional": true
|
155
|
+
},
|
156
|
+
"react-router-dom": {
|
157
|
+
"optional": true
|
158
|
+
}
|
129
159
|
},
|
130
160
|
"devDependencies": {
|
131
|
-
"
|
132
|
-
"
|
133
|
-
"
|
161
|
+
"react": ">=17.0.0",
|
162
|
+
"react-dom": ">=17.0.0",
|
163
|
+
"react-router-dom": "^6.8.1",
|
134
164
|
"@types/jest": "^27",
|
135
165
|
"@types/node": "^14",
|
136
166
|
"jest": "^27",
|
137
167
|
"typescript": "^4",
|
138
|
-
"webpack": "^5.75.0"
|
168
|
+
"webpack": "^5.75.0",
|
169
|
+
"@types/serialize-javascript": "^5.0.1",
|
170
|
+
"@modern-js/types": "2.7.0",
|
171
|
+
"@scripts/jest-config": "2.7.0",
|
172
|
+
"@scripts/build": "2.7.0"
|
139
173
|
},
|
140
174
|
"sideEffects": false,
|
141
175
|
"scripts": {
|
File without changes
|
File without changes
|