@modern-js/utils 2.22.0 → 2.22.1-alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. package/dist/FileSizeReporter.d.ts +16 -0
  2. package/dist/FileSizeReporter.js +162 -0
  3. package/dist/alias.d.ts +25 -0
  4. package/dist/alias.js +108 -0
  5. package/dist/analyzeProject.d.ts +2 -0
  6. package/dist/analyzeProject.js +71 -0
  7. package/dist/applyOptionsChain.d.ts +3 -0
  8. package/dist/applyOptionsChain.js +58 -0
  9. package/dist/babel.d.ts +3 -0
  10. package/dist/babel.js +136 -0
  11. package/dist/chainId.d.ts +244 -0
  12. package/dist/chainId.js +196 -0
  13. package/dist/cjs/cli/constants/index.js +4 -0
  14. package/dist/cjs/runtime-node/walk.js +1 -0
  15. package/dist/cjs/universal/constants.js +4 -0
  16. package/dist/clearConsole.d.ts +1 -0
  17. package/dist/clearConsole.js +31 -0
  18. package/dist/commands.d.ts +4 -0
  19. package/dist/commands.js +48 -0
  20. package/dist/compatRequire.d.ts +13 -0
  21. package/dist/compatRequire.js +82 -0
  22. package/dist/compiled.d.ts +43 -0
  23. package/dist/compiled.js +142 -0
  24. package/dist/constants.d.ts +244 -0
  25. package/dist/constants.js +320 -0
  26. package/dist/debug.d.ts +6 -0
  27. package/dist/debug.js +28 -0
  28. package/dist/emptyDir.d.ts +1 -0
  29. package/dist/emptyDir.js +52 -0
  30. package/dist/ensureAbsolutePath.d.ts +7 -0
  31. package/dist/ensureAbsolutePath.js +38 -0
  32. package/dist/ensureArray.d.ts +1 -0
  33. package/dist/ensureArray.js +32 -0
  34. package/dist/esm/cli/constants/index.js +1 -0
  35. package/dist/esm/runtime-node/walk.js +0 -0
  36. package/dist/esm/universal/constants.js +1 -0
  37. package/dist/findExists.d.ts +6 -0
  38. package/dist/findExists.js +45 -0
  39. package/dist/generateMetaTags.d.ts +16 -0
  40. package/dist/generateMetaTags.js +61 -0
  41. package/dist/getBrowserslist.d.ts +2 -0
  42. package/dist/getBrowserslist.js +31 -0
  43. package/dist/getCoreJsVersion.d.ts +1 -0
  44. package/dist/getCoreJsVersion.js +46 -0
  45. package/dist/getEntryOptions.d.ts +1 -0
  46. package/dist/getEntryOptions.js +54 -0
  47. package/dist/getPackageManager.d.ts +1 -0
  48. package/dist/getPackageManager.js +87 -0
  49. package/dist/getPort.d.ts +14 -0
  50. package/dist/getPort.js +112 -0
  51. package/dist/getServerConfig.d.ts +1 -0
  52. package/dist/getServerConfig.js +67 -0
  53. package/dist/getTargetDir.d.ts +1 -0
  54. package/dist/getTargetDir.js +41 -0
  55. package/dist/import.d.ts +5 -0
  56. package/dist/import.js +33 -0
  57. package/dist/index.d.ts +44 -0
  58. package/dist/index.js +60 -0
  59. package/dist/is/index.d.ts +58 -0
  60. package/dist/is/index.js +114 -0
  61. package/dist/is/nodeEnv.d.ts +8 -0
  62. package/dist/is/nodeEnv.js +39 -0
  63. package/dist/is/platform.d.ts +2 -0
  64. package/dist/is/platform.js +30 -0
  65. package/dist/is/type.d.ts +8 -0
  66. package/dist/is/type.js +64 -0
  67. package/dist/logger.d.ts +65 -0
  68. package/dist/logger.js +145 -0
  69. package/dist/monorepo.d.ts +11 -0
  70. package/dist/monorepo.js +137 -0
  71. package/dist/nodeEnv.d.ts +3 -0
  72. package/dist/nodeEnv.js +81 -0
  73. package/dist/path.d.ts +18 -0
  74. package/dist/path.js +92 -0
  75. package/dist/pathSerializer.d.ts +16 -0
  76. package/dist/pathSerializer.js +76 -0
  77. package/dist/plugin.d.ts +2 -0
  78. package/dist/plugin.js +46 -0
  79. package/dist/prettyInstructions.d.ts +9 -0
  80. package/dist/prettyInstructions.js +112 -0
  81. package/dist/printBuildError.d.ts +8 -0
  82. package/dist/printBuildError.js +57 -0
  83. package/dist/react.d.ts +1 -0
  84. package/dist/react.js +64 -0
  85. package/dist/readTsConfig.d.ts +2 -0
  86. package/dist/readTsConfig.js +47 -0
  87. package/dist/removeSlash.d.ts +3 -0
  88. package/dist/removeSlash.js +33 -0
  89. package/dist/resolve.d.ts +13 -0
  90. package/dist/resolve.js +63 -0
  91. package/dist/routes.d.ts +2 -0
  92. package/dist/routes.js +58 -0
  93. package/dist/runtimeExports.d.ts +4 -0
  94. package/dist/runtimeExports.js +73 -0
  95. package/dist/ssr.d.ts +8 -0
  96. package/dist/ssr.js +30 -0
  97. package/dist/storage.d.ts +5 -0
  98. package/dist/storage.js +75 -0
  99. package/dist/testUtils.d.ts +5 -0
  100. package/dist/testUtils.js +38 -0
  101. package/dist/types/cli/constants/index.d.ts +4 -0
  102. package/dist/types/runtime-node/walk.d.ts +0 -0
  103. package/dist/types/universal/constants.d.ts +5 -1
  104. package/dist/types.d.ts +1 -0
  105. package/dist/types.js +15 -0
  106. package/dist/universal/constants.d.ts +9 -0
  107. package/dist/universal/constants.js +30 -0
  108. package/dist/universal/formatWebpack.d.ts +13 -0
  109. package/dist/universal/formatWebpack.js +100 -0
  110. package/dist/universal/nestedRoutes.d.ts +8 -0
  111. package/dist/universal/nestedRoutes.js +131 -0
  112. package/dist/universal/remixRouter.d.ts +1 -0
  113. package/dist/universal/remixRouter.js +17 -0
  114. package/dist/universal/serialize.d.ts +1 -0
  115. package/dist/universal/serialize.js +40 -0
  116. package/dist/version.d.ts +2 -0
  117. package/dist/version.js +92 -0
  118. package/dist/wait.d.ts +2 -0
  119. package/dist/wait.js +29 -0
  120. package/dist/watch.d.ts +8 -0
  121. package/dist/watch.js +90 -0
  122. package/package.json +12 -3
@@ -0,0 +1,244 @@
1
+ export declare const CHAIN_ID: {
2
+ /** Predefined rules */
3
+ readonly RULE: {
4
+ /** Rule for .mjs */
5
+ readonly MJS: "mjs";
6
+ /** Rule for predefined loaders */
7
+
8
+ readonly LOADERS: "loaders";
9
+ /** Rule for fonts */
10
+
11
+ readonly FONT: "font";
12
+ /** Rule for images */
13
+
14
+ readonly IMAGE: "image";
15
+ /** Rule for media */
16
+
17
+ readonly MEDIA: "media";
18
+ /** Rule for js */
19
+
20
+ readonly JS: "js";
21
+ /** Rule for data uri encoded javascript */
22
+
23
+ readonly JS_DATA_URI: "js-data-uri";
24
+ /** Rule for ts */
25
+
26
+ readonly TS: "ts";
27
+ /** Rule for css */
28
+
29
+ readonly CSS: "css";
30
+ /** Rule for less */
31
+
32
+ readonly LESS: "less";
33
+ /** Rule for sass */
34
+
35
+ readonly SASS: "sass";
36
+ /** Rule for stylus */
37
+
38
+ readonly STYLUS: "stylus";
39
+ /** Rule for svg */
40
+
41
+ readonly SVG: "svg";
42
+ /** Rule for pug */
43
+
44
+ readonly PUG: "pug";
45
+ /** Rule for toml */
46
+
47
+ readonly TOML: "toml";
48
+ /** Rule for yaml */
49
+
50
+ readonly YAML: "yaml";
51
+ /** Rule for bff */
52
+
53
+ readonly JS_BFF_API: "js-bff-api";
54
+ };
55
+ /** Predefined rule groups */
56
+
57
+ readonly ONE_OF: {
58
+ readonly SVG: "svg";
59
+ readonly SVG_URL: "svg-url";
60
+ readonly SVG_ASSET: "svg-asset";
61
+ readonly SVG_INLINE: "svg-inline";
62
+ };
63
+ /** Predefined loaders */
64
+
65
+ readonly USE: {
66
+ /** ts-loader */
67
+ readonly TS: "ts";
68
+ /** css-loader */
69
+
70
+ readonly CSS: "css";
71
+ /** sass-loader */
72
+
73
+ readonly SASS: "sass";
74
+ /** less-loader */
75
+
76
+ readonly LESS: "less";
77
+ /** stylus-loader */
78
+
79
+ readonly STYLUS: "stylus";
80
+ /** url-loader */
81
+
82
+ readonly URL: "url";
83
+ /** pug-loader */
84
+
85
+ readonly PUG: "pug";
86
+ /** file-loader */
87
+
88
+ readonly FILE: "file";
89
+ /** @svgr/webpack */
90
+
91
+ readonly SVGR: "svgr";
92
+ /** yaml-loader */
93
+
94
+ readonly YAML: "yaml";
95
+ /** toml-loader */
96
+
97
+ readonly TOML: "toml";
98
+ /** html-loader */
99
+
100
+ readonly HTML: "html";
101
+ /** babel-loader */
102
+
103
+ readonly BABEL: "babel";
104
+ /** esbuild-loader */
105
+
106
+ readonly ESBUILD: "esbuild";
107
+ /** swc-loader */
108
+
109
+ readonly SWC: "swc";
110
+ /** style-loader */
111
+
112
+ readonly STYLE: "style-loader";
113
+ /** postcss-loader */
114
+
115
+ readonly POSTCSS: "postcss";
116
+ /** markdown-loader */
117
+
118
+ readonly MARKDOWN: "markdown";
119
+ /** ignore-css-loader */
120
+
121
+ readonly IGNORE_CSS: "ignore-css";
122
+ /** css-modules-typescript-loader */
123
+
124
+ readonly CSS_MODULES_TS: "css-modules-typescript";
125
+ /** mini-css-extract-plugin.loader */
126
+
127
+ readonly MINI_CSS_EXTRACT: "mini-css-extract";
128
+ /** builder-plugin-image-compress.loader */
129
+
130
+ readonly IMAGE_COMPRESS: "image-compress";
131
+ /** builder-plugin-image-compress svgo-loader */
132
+
133
+ readonly SVGO: "svgo";
134
+ /** builder-plugin-imagex */
135
+
136
+ readonly IMAGEX: "imagex";
137
+ };
138
+ /** Predefined plugins */
139
+
140
+ readonly PLUGIN: {
141
+ /** HotModuleReplacementPlugin */
142
+ readonly HMR: "hmr";
143
+ /** CopyWebpackPlugin */
144
+
145
+ readonly COPY: "copy";
146
+ /** HtmlWebpackPlugin */
147
+
148
+ readonly HTML: "html";
149
+ /** DefinePlugin */
150
+
151
+ readonly DEFINE: "define";
152
+ /** IgnorePlugin */
153
+
154
+ readonly IGNORE: "ignore";
155
+ /** BannerPlugin */
156
+
157
+ readonly BANNER: "banner";
158
+ /** Webpackbar */
159
+
160
+ readonly PROGRESS: "progress";
161
+ /** Inspector */
162
+
163
+ readonly INSPECTOR: "inspector";
164
+ /** AppIconPlugin */
165
+
166
+ readonly APP_ICON: "app-icon";
167
+ /** FaviconUrlPlugin */
168
+
169
+ readonly FAVICON_URL: "favicon-url";
170
+ /** LoadableWebpackPlugin */
171
+
172
+ readonly LOADABLE: "loadable";
173
+ /** WebpackManifestPlugin */
174
+
175
+ readonly MANIFEST: "webpack-manifest";
176
+ /** ForkTsCheckerWebpackPlugin */
177
+
178
+ readonly TS_CHECKER: "ts-checker";
179
+ /** InlineChunkHtmlPlugin */
180
+
181
+ readonly INLINE_HTML: "inline-html";
182
+ /** WebpackBundleAnalyzer */
183
+
184
+ readonly BUNDLE_ANALYZER: "bundle-analyze";
185
+ /** BottomTemplatePlugin */
186
+
187
+ readonly BOTTOM_TEMPLATE: "bottom-template";
188
+ /** HtmlCrossOriginPlugin */
189
+
190
+ readonly HTML_CROSS_ORIGIN: "html-cross-origin";
191
+ /** MiniCssExtractPlugin */
192
+
193
+ readonly MINI_CSS_EXTRACT: "mini-css-extract";
194
+ /** ReactFastRefreshPlugin */
195
+
196
+ readonly REACT_FAST_REFRESH: "react-fast-refresh";
197
+ /** ProvidePlugin for node polyfill */
198
+
199
+ readonly NODE_POLYFILL_PROVIDE: "node-polyfill-provide";
200
+ /** WebpackSRIPlugin */
201
+
202
+ readonly SUBRESOURCE_INTEGRITY: "subresource-integrity";
203
+ /** WebpackAssetsRetryPlugin */
204
+
205
+ readonly ASSETS_RETRY: "ASSETS_RETRY";
206
+ /** AutoSetRootFontSizePlugin */
207
+
208
+ readonly AUTO_SET_ROOT_SIZE: "auto-set-root-size";
209
+ /** HtmlAsyncChunkPlugin */
210
+
211
+ readonly HTML_ASYNC_CHUNK: "html-async-chunk";
212
+ /** SWC_POLYFILL_CHECKER */
213
+
214
+ readonly SWC_POLYFILL_CHECKER: "swc-polyfill-checker-plugin";
215
+ /** HtmlTagsPlugin */
216
+
217
+ readonly HTML_TAGS: "html-tags";
218
+ };
219
+ /** Predefined minimizers */
220
+
221
+ readonly MINIMIZER: {
222
+ /** TerserWebpackPlugin */
223
+ readonly JS: "js";
224
+ /** CssMinimizerWebpackPlugin */
225
+
226
+ readonly CSS: "css";
227
+ /** ESBuildPlugin */
228
+
229
+ readonly ESBUILD: "js-css";
230
+ /** SWCPlugin */
231
+
232
+ readonly SWC: "swc";
233
+ };
234
+ /** Predefined resolve plugins */
235
+
236
+ readonly RESOLVE_PLUGIN: {
237
+ /** ModuleScopePlugin */
238
+ readonly MODULE_SCOPE: "module-scope";
239
+ /** TsConfigPathsPlugin */
240
+
241
+ readonly TS_CONFIG_PATHS: "ts-config-paths";
242
+ };
243
+ };
244
+ export type ChainIdentifier = typeof CHAIN_ID;
@@ -0,0 +1,196 @@
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 chainId_exports = {};
19
+ __export(chainId_exports, {
20
+ CHAIN_ID: () => CHAIN_ID
21
+ });
22
+ module.exports = __toCommonJS(chainId_exports);
23
+ const CHAIN_ID = {
24
+ /** Predefined rules */
25
+ RULE: {
26
+ /** Rule for .mjs */
27
+ MJS: "mjs",
28
+ /** Rule for predefined loaders */
29
+ LOADERS: "loaders",
30
+ /** Rule for fonts */
31
+ FONT: "font",
32
+ /** Rule for images */
33
+ IMAGE: "image",
34
+ /** Rule for media */
35
+ MEDIA: "media",
36
+ /** Rule for js */
37
+ JS: "js",
38
+ /** Rule for data uri encoded javascript */
39
+ JS_DATA_URI: "js-data-uri",
40
+ /** Rule for ts */
41
+ TS: "ts",
42
+ /** Rule for css */
43
+ CSS: "css",
44
+ /** Rule for less */
45
+ LESS: "less",
46
+ /** Rule for sass */
47
+ SASS: "sass",
48
+ /** Rule for stylus */
49
+ STYLUS: "stylus",
50
+ /** Rule for svg */
51
+ SVG: "svg",
52
+ /** Rule for pug */
53
+ PUG: "pug",
54
+ /** Rule for toml */
55
+ TOML: "toml",
56
+ /** Rule for yaml */
57
+ YAML: "yaml",
58
+ /** Rule for bff */
59
+ JS_BFF_API: "js-bff-api"
60
+ },
61
+ /** Predefined rule groups */
62
+ ONE_OF: {
63
+ SVG: "svg",
64
+ SVG_URL: "svg-url",
65
+ SVG_ASSET: "svg-asset",
66
+ SVG_INLINE: "svg-inline"
67
+ },
68
+ /** Predefined loaders */
69
+ USE: {
70
+ /** ts-loader */
71
+ TS: "ts",
72
+ /** css-loader */
73
+ CSS: "css",
74
+ /** sass-loader */
75
+ SASS: "sass",
76
+ /** less-loader */
77
+ LESS: "less",
78
+ /** stylus-loader */
79
+ STYLUS: "stylus",
80
+ /** url-loader */
81
+ URL: "url",
82
+ /** pug-loader */
83
+ PUG: "pug",
84
+ /** file-loader */
85
+ FILE: "file",
86
+ /** @svgr/webpack */
87
+ SVGR: "svgr",
88
+ /** yaml-loader */
89
+ YAML: "yaml",
90
+ /** toml-loader */
91
+ TOML: "toml",
92
+ /** html-loader */
93
+ HTML: "html",
94
+ /** babel-loader */
95
+ BABEL: "babel",
96
+ /** esbuild-loader */
97
+ ESBUILD: "esbuild",
98
+ /** swc-loader */
99
+ SWC: "swc",
100
+ /** style-loader */
101
+ STYLE: "style-loader",
102
+ /** postcss-loader */
103
+ POSTCSS: "postcss",
104
+ /** markdown-loader */
105
+ MARKDOWN: "markdown",
106
+ /** ignore-css-loader */
107
+ IGNORE_CSS: "ignore-css",
108
+ /** css-modules-typescript-loader */
109
+ CSS_MODULES_TS: "css-modules-typescript",
110
+ /** mini-css-extract-plugin.loader */
111
+ MINI_CSS_EXTRACT: "mini-css-extract",
112
+ /** builder-plugin-image-compress.loader */
113
+ IMAGE_COMPRESS: "image-compress",
114
+ /** builder-plugin-image-compress svgo-loader */
115
+ SVGO: "svgo",
116
+ /** builder-plugin-imagex */
117
+ IMAGEX: "imagex"
118
+ },
119
+ /** Predefined plugins */
120
+ PLUGIN: {
121
+ /** HotModuleReplacementPlugin */
122
+ HMR: "hmr",
123
+ /** CopyWebpackPlugin */
124
+ COPY: "copy",
125
+ /** HtmlWebpackPlugin */
126
+ HTML: "html",
127
+ /** DefinePlugin */
128
+ DEFINE: "define",
129
+ /** IgnorePlugin */
130
+ IGNORE: "ignore",
131
+ /** BannerPlugin */
132
+ BANNER: "banner",
133
+ /** Webpackbar */
134
+ PROGRESS: "progress",
135
+ /** Inspector */
136
+ INSPECTOR: "inspector",
137
+ /** AppIconPlugin */
138
+ APP_ICON: "app-icon",
139
+ /** FaviconUrlPlugin */
140
+ FAVICON_URL: "favicon-url",
141
+ /** LoadableWebpackPlugin */
142
+ LOADABLE: "loadable",
143
+ /** WebpackManifestPlugin */
144
+ MANIFEST: "webpack-manifest",
145
+ /** ForkTsCheckerWebpackPlugin */
146
+ TS_CHECKER: "ts-checker",
147
+ /** InlineChunkHtmlPlugin */
148
+ INLINE_HTML: "inline-html",
149
+ /** WebpackBundleAnalyzer */
150
+ BUNDLE_ANALYZER: "bundle-analyze",
151
+ /** BottomTemplatePlugin */
152
+ BOTTOM_TEMPLATE: "bottom-template",
153
+ /** HtmlCrossOriginPlugin */
154
+ HTML_CROSS_ORIGIN: "html-cross-origin",
155
+ /** MiniCssExtractPlugin */
156
+ MINI_CSS_EXTRACT: "mini-css-extract",
157
+ /** ReactFastRefreshPlugin */
158
+ REACT_FAST_REFRESH: "react-fast-refresh",
159
+ /** ProvidePlugin for node polyfill */
160
+ NODE_POLYFILL_PROVIDE: "node-polyfill-provide",
161
+ /** WebpackSRIPlugin */
162
+ SUBRESOURCE_INTEGRITY: "subresource-integrity",
163
+ /** WebpackAssetsRetryPlugin */
164
+ ASSETS_RETRY: "ASSETS_RETRY",
165
+ /** AutoSetRootFontSizePlugin */
166
+ AUTO_SET_ROOT_SIZE: "auto-set-root-size",
167
+ /** HtmlAsyncChunkPlugin */
168
+ HTML_ASYNC_CHUNK: "html-async-chunk",
169
+ /** SWC_POLYFILL_CHECKER */
170
+ SWC_POLYFILL_CHECKER: "swc-polyfill-checker-plugin",
171
+ /** HtmlTagsPlugin */
172
+ HTML_TAGS: "html-tags"
173
+ },
174
+ /** Predefined minimizers */
175
+ MINIMIZER: {
176
+ /** TerserWebpackPlugin */
177
+ JS: "js",
178
+ /** CssMinimizerWebpackPlugin */
179
+ CSS: "css",
180
+ /** ESBuildPlugin */
181
+ ESBUILD: "js-css",
182
+ /** SWCPlugin */
183
+ SWC: "swc"
184
+ },
185
+ /** Predefined resolve plugins */
186
+ RESOLVE_PLUGIN: {
187
+ /** ModuleScopePlugin */
188
+ MODULE_SCOPE: "module-scope",
189
+ /** TsConfigPathsPlugin */
190
+ TS_CONFIG_PATHS: "ts-config-paths"
191
+ }
192
+ };
193
+ // Annotate the CommonJS export names for ESM import in node:
194
+ 0 && (module.exports = {
195
+ CHAIN_ID
196
+ });
@@ -13,6 +13,9 @@ _export(exports, {
13
13
  ROUTE_SPEC_FILE: function() {
14
14
  return ROUTE_SPEC_FILE;
15
15
  },
16
+ NESTED_ROUTE_SPEC_FILE: function() {
17
+ return NESTED_ROUTE_SPEC_FILE;
18
+ },
16
19
  MAIN_ENTRY_NAME: function() {
17
20
  return MAIN_ENTRY_NAME;
18
21
  },
@@ -107,6 +110,7 @@ _export(exports, {
107
110
  const _export_star = require("@swc/helpers/_/_export_star");
108
111
  _export_star._(require("./chainId"), exports);
109
112
  const ROUTE_SPEC_FILE = "route.json";
113
+ const NESTED_ROUTE_SPEC_FILE = "nestedRoutes.json";
110
114
  const MAIN_ENTRY_NAME = "main";
111
115
  const SERVER_BUNDLE_DIRECTORY = "bundles";
112
116
  const SERVER_WORKER_BUNDLE_DIRECTORY = "worker";
@@ -0,0 +1 @@
1
+ "use strict";
@@ -15,7 +15,11 @@ _export(exports, {
15
15
  },
16
16
  HMR_SOCK_PATH: function() {
17
17
  return HMR_SOCK_PATH;
18
+ },
19
+ HTML_CHUNKSMAP_SEPARATOR: function() {
20
+ return HTML_CHUNKSMAP_SEPARATOR;
18
21
  }
19
22
  });
20
23
  const ROUTE_MANIFEST = `_MODERNJS_ROUTE_MANIFEST`;
21
24
  const HMR_SOCK_PATH = "/webpack-hmr";
25
+ const HTML_CHUNKSMAP_SEPARATOR = "<!--<?- chunksMap.js ?>-->";
@@ -0,0 +1 @@
1
+ export declare const clearConsole: () => void;
@@ -0,0 +1,31 @@
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);
23
+ const clearConsole = () => {
24
+ if (process.stdout.isTTY && !process.env.DEBUG) {
25
+ process.stdout.write("\x1B[H\x1B[2J");
26
+ }
27
+ };
28
+ // Annotate the CommonJS export names for ESM import in node:
29
+ 0 && (module.exports = {
30
+ clearConsole
31
+ });
@@ -0,0 +1,4 @@
1
+ export declare const getFullArgv: () => string[];
2
+ export declare const getArgv: () => string[];
3
+ export declare const getCommand: () => string;
4
+ export declare const isDevCommand: () => boolean;
@@ -0,0 +1,48 @@
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
+ getArgv: () => getArgv,
21
+ getCommand: () => getCommand,
22
+ getFullArgv: () => getFullArgv,
23
+ isDevCommand: () => isDevCommand
24
+ });
25
+ module.exports = __toCommonJS(commands_exports);
26
+ const getFullArgv = () => {
27
+ var _a;
28
+ return ((_a = process.env.MODERN_ARGV) == null ? void 0 : _a.split(" ")) || process.argv;
29
+ };
30
+ const getArgv = () => {
31
+ return getFullArgv().slice(2);
32
+ };
33
+ const getCommand = () => {
34
+ const args = getArgv();
35
+ const command = args[0];
36
+ return command;
37
+ };
38
+ const isDevCommand = () => {
39
+ const command = getCommand();
40
+ return command === "dev" || command === "start";
41
+ };
42
+ // Annotate the CommonJS export names for ESM import in node:
43
+ 0 && (module.exports = {
44
+ getArgv,
45
+ getCommand,
46
+ getFullArgv,
47
+ isDevCommand
48
+ });
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Require function compatible with esm and cjs module.
3
+ * @param filePath - File to required.
4
+ * @returns module export object.
5
+ */
6
+ export declare const compatRequire: (filePath: string, interop?: boolean) => any;
7
+ export declare const dynamicImport: Function;
8
+ export declare const requireExistModule: (filename: string, opt?: {
9
+ extensions?: string[];
10
+ interop?: boolean;
11
+ }) => any;
12
+ export declare const cleanRequireCache: (filelist: string[]) => void;
13
+ export declare function deleteRequireCache(path: string): void;
@@ -0,0 +1,82 @@
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");
42
+ const compatRequire = (filePath, interop = true) => {
43
+ const mod = require(filePath);
44
+ const rtnESMDefault = interop && (mod == null ? void 0 : mod.__esModule);
45
+ return rtnESMDefault ? mod.default : mod;
46
+ };
47
+ const dynamicImport = new Function(
48
+ "modulePath",
49
+ "return import(modulePath)"
50
+ );
51
+ const requireExistModule = (filename, opt) => {
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);
61
+ };
62
+ const cleanRequireCache = (filelist) => {
63
+ filelist.forEach((filepath) => {
64
+ delete require.cache[filepath];
65
+ });
66
+ };
67
+ function deleteRequireCache(path) {
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
+ }
74
+ }
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
+ });