@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,43 @@
1
+ export { default as fs } from '../compiled/fs-extra';
2
+ export { default as ora } from '../compiled/ora';
3
+ export { default as glob } from '../compiled/glob';
4
+ export { default as yaml } from '../compiled/js-yaml';
5
+ export { default as chalk } from '../compiled/chalk';
6
+ export { default as debug } from '../compiled/debug';
7
+ export { default as slash } from '../compiled/slash';
8
+ export { default as execa } from '../compiled/execa';
9
+ export { default as json5 } from '../compiled/json5';
10
+ export { default as upath } from '../compiled/upath';
11
+ export { default as pkgUp } from '../compiled/pkg-up';
12
+ export { nanoid } from '../compiled/nanoid';
13
+ export { default as semver } from '../compiled/semver';
14
+ export { default as dotenv } from '../compiled/dotenv';
15
+ export { default as lodash } from '../compiled/lodash';
16
+ export { default as globby } from '../compiled/globby';
17
+ export { default as address } from '../compiled/address';
18
+ export { default as signale } from '../compiled/signale';
19
+ export { default as urlJoin } from '../compiled/url-join';
20
+ export { default as minimist } from '../compiled/minimist';
21
+ export { default as fastGlob } from '../compiled/fast-glob';
22
+ export { default as filesize } from '../compiled/filesize';
23
+ export { default as gzipSize } from '../compiled/gzip-size';
24
+ export { default as stripAnsi } from '../compiled/strip-ansi';
25
+ export { default as dotenvExpand } from '../compiled/dotenv-expand';
26
+ export { default as browserslist } from '../compiled/browserslist';
27
+ export { default as recursiveReaddir } from '../compiled/recursive-readdir';
28
+ export { program, Command } from '../compiled/commander';
29
+ export { Signale } from '../compiled/signale';
30
+ export type { SignaleOptions } from '../compiled/signale';
31
+ export type { IOptions as GlobOptions } from '../compiled/glob';
32
+ export type { GlobbyOptions } from '../compiled/globby';
33
+ export type { FSWatcher, WatchOptions } from '../compiled/chokidar';
34
+ export type { ExecaError } from '../compiled/execa';
35
+ export type { default as WebpackChain } from '../compiled/webpack-chain';
36
+ /**
37
+ * Lazy import some expensive modules that will slow down startup speed.
38
+ * Notice that `csmith-tools build` can not bundle lazy imported modules.
39
+ */
40
+
41
+ export declare const mime: typeof import('../compiled/mime-types');
42
+ export declare const chokidar: typeof import('../compiled/chokidar');
43
+ export declare const inquirer: typeof import('../compiled/inquirer');
@@ -0,0 +1,142 @@
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 compiled_exports = {};
29
+ __export(compiled_exports, {
30
+ Command: () => import_commander.Command,
31
+ Signale: () => import_signale2.Signale,
32
+ address: () => import_address.default,
33
+ browserslist: () => import_browserslist.default,
34
+ chalk: () => import_chalk.default,
35
+ chokidar: () => chokidar,
36
+ debug: () => import_debug.default,
37
+ dotenv: () => import_dotenv.default,
38
+ dotenvExpand: () => import_dotenv_expand.default,
39
+ execa: () => import_execa.default,
40
+ fastGlob: () => import_fast_glob.default,
41
+ filesize: () => import_filesize.default,
42
+ fs: () => import_fs_extra.default,
43
+ glob: () => import_glob.default,
44
+ globby: () => import_globby.default,
45
+ gzipSize: () => import_gzip_size.default,
46
+ inquirer: () => inquirer,
47
+ json5: () => import_json5.default,
48
+ lodash: () => import_lodash.default,
49
+ mime: () => mime,
50
+ minimist: () => import_minimist.default,
51
+ nanoid: () => import_nanoid.nanoid,
52
+ ora: () => import_ora.default,
53
+ pkgUp: () => import_pkg_up.default,
54
+ program: () => import_commander.program,
55
+ recursiveReaddir: () => import_recursive_readdir.default,
56
+ semver: () => import_semver.default,
57
+ signale: () => import_signale.default,
58
+ slash: () => import_slash.default,
59
+ stripAnsi: () => import_strip_ansi.default,
60
+ upath: () => import_upath.default,
61
+ urlJoin: () => import_url_join.default,
62
+ yaml: () => import_js_yaml.default
63
+ });
64
+ module.exports = __toCommonJS(compiled_exports);
65
+ var import_import = require("./import");
66
+ var import_fs_extra = __toESM(require("../compiled/fs-extra"));
67
+ var import_ora = __toESM(require("../compiled/ora"));
68
+ var import_glob = __toESM(require("../compiled/glob"));
69
+ var import_js_yaml = __toESM(require("../compiled/js-yaml"));
70
+ var import_chalk = __toESM(require("../compiled/chalk"));
71
+ var import_debug = __toESM(require("../compiled/debug"));
72
+ var import_slash = __toESM(require("../compiled/slash"));
73
+ var import_execa = __toESM(require("../compiled/execa"));
74
+ var import_json5 = __toESM(require("../compiled/json5"));
75
+ var import_upath = __toESM(require("../compiled/upath"));
76
+ var import_pkg_up = __toESM(require("../compiled/pkg-up"));
77
+ var import_nanoid = require("../compiled/nanoid");
78
+ var import_semver = __toESM(require("../compiled/semver"));
79
+ var import_dotenv = __toESM(require("../compiled/dotenv"));
80
+ var import_lodash = __toESM(require("../compiled/lodash"));
81
+ var import_globby = __toESM(require("../compiled/globby"));
82
+ var import_address = __toESM(require("../compiled/address"));
83
+ var import_signale = __toESM(require("../compiled/signale"));
84
+ var import_url_join = __toESM(require("../compiled/url-join"));
85
+ var import_minimist = __toESM(require("../compiled/minimist"));
86
+ var import_fast_glob = __toESM(require("../compiled/fast-glob"));
87
+ var import_filesize = __toESM(require("../compiled/filesize"));
88
+ var import_gzip_size = __toESM(require("../compiled/gzip-size"));
89
+ var import_strip_ansi = __toESM(require("../compiled/strip-ansi"));
90
+ var import_dotenv_expand = __toESM(require("../compiled/dotenv-expand"));
91
+ var import_browserslist = __toESM(require("../compiled/browserslist"));
92
+ var import_recursive_readdir = __toESM(require("../compiled/recursive-readdir"));
93
+ var import_commander = require("../compiled/commander");
94
+ var import_signale2 = require("../compiled/signale");
95
+ const mime = import_import.Import.lazy(
96
+ "../compiled/mime-types",
97
+ require
98
+ );
99
+ const chokidar = import_import.Import.lazy(
100
+ "../compiled/chokidar",
101
+ require
102
+ );
103
+ const inquirer = import_import.Import.lazy(
104
+ "../compiled/inquirer",
105
+ require
106
+ );
107
+ // Annotate the CommonJS export names for ESM import in node:
108
+ 0 && (module.exports = {
109
+ Command,
110
+ Signale,
111
+ address,
112
+ browserslist,
113
+ chalk,
114
+ chokidar,
115
+ debug,
116
+ dotenv,
117
+ dotenvExpand,
118
+ execa,
119
+ fastGlob,
120
+ filesize,
121
+ fs,
122
+ glob,
123
+ globby,
124
+ gzipSize,
125
+ inquirer,
126
+ json5,
127
+ lodash,
128
+ mime,
129
+ minimist,
130
+ nanoid,
131
+ ora,
132
+ pkgUp,
133
+ program,
134
+ recursiveReaddir,
135
+ semver,
136
+ signale,
137
+ slash,
138
+ stripAnsi,
139
+ upath,
140
+ urlJoin,
141
+ yaml
142
+ });
@@ -0,0 +1,244 @@
1
+ import { InternalPlugins } from '@modern-js/types';
2
+ /**
3
+ * route specification file
4
+ */
5
+
6
+ export declare const ROUTE_SPEC_FILE = "route.json";
7
+ /**
8
+ * main entry name
9
+ */
10
+
11
+ export declare const MAIN_ENTRY_NAME = "main";
12
+ /**
13
+ * open editor request path
14
+ */
15
+
16
+ export declare const LAUNCH_EDITOR_ENDPOINT = "/__open-stack-frame-in-editor";
17
+ /**
18
+ * server side bundles directory, which relative to dist.
19
+ */
20
+
21
+ export declare const SERVER_BUNDLE_DIRECTORY = "bundles";
22
+ /**
23
+ * server side bundles directory, which relative to dist.
24
+ */
25
+
26
+ export declare const SERVER_WORKER_BUNDLE_DIRECTORY = "worker";
27
+ /**
28
+ * entry name pattern used for ajv pattern properties.
29
+ */
30
+
31
+ export declare const ENTRY_NAME_PATTERN = "^[a-zA-Z0-9_-]+$";
32
+ /**
33
+ * SSR server render function name
34
+ */
35
+
36
+ export declare const SERVER_RENDER_FUNCTION_NAME = "serverRender";
37
+ /**
38
+ * loadbale manifest json file
39
+ */
40
+
41
+ export declare const LOADABLE_STATS_FILE = "loadable-stats.json";
42
+ /**
43
+ * internal specified folder
44
+ */
45
+
46
+ export declare const API_DIR = "api";
47
+ export declare const SERVER_DIR = "server";
48
+ export declare const SHARED_DIR = "shared";
49
+ /**
50
+ * Modern.config.ts cached dir
51
+ */
52
+
53
+ export declare const CONFIG_CACHE_DIR = "./node_modules/.cache/node-bundle-require";
54
+ export declare const CONFIG_FILE_EXTENSIONS: string[];
55
+ /**
56
+ * Serialized config path
57
+ */
58
+
59
+ export declare const OUTPUT_CONFIG_FILE = "modern.config.json";
60
+ /**
61
+ * Default server config basename
62
+ */
63
+
64
+ export declare const DEFAULT_SERVER_CONFIG = "modern.server-runtime.config";
65
+ /**
66
+ * Routes manifest filename
67
+ */
68
+
69
+ export declare const ROUTE_MANIFEST_FILE = "routes-manifest.json";
70
+ /**
71
+ * directory name for loader routes
72
+ */
73
+
74
+ export declare const LOADER_ROUTES_DIR = "loader-routes";
75
+ /**
76
+ * default host for dev
77
+ */
78
+
79
+ export declare const DEFAULT_DEV_HOST = "0.0.0.0";
80
+ /**
81
+ * Internal app-tools plugins that work as soon as they are installed.
82
+ */
83
+
84
+ export declare const INTERNAL_APP_TOOLS_PLUGINS: InternalPlugins;
85
+ export declare const INTERNAL_APP_TOOLS_RUNTIME_PLUGINS: InternalPlugins;
86
+ /**
87
+ * Internal module-tools plugins that work as soon as they are installed.
88
+ */
89
+
90
+ export declare const INTERNAL_MODULE_TOOLS_PLUGINS: InternalPlugins;
91
+ /**
92
+ * Internal monorepo-tools plugins that work as soon as they are installed.
93
+ */
94
+
95
+ export declare const INTERNAL_MONOREPO_TOOLS_PLUGINS: InternalPlugins;
96
+ /**
97
+ * Internal doc-tools plugins that work as soon as they are installed.
98
+ */
99
+
100
+ export declare const INTERNAL_DOC_TOOLS_PLUGINS: InternalPlugins;
101
+ /**
102
+ * Internal plugins that work as soon as they are installed.
103
+ */
104
+
105
+ export declare const INTERNAL_CLI_PLUGINS: InternalPlugins;
106
+ export declare const SERVER_PLUGIN_BFF = "@modern-js/plugin-bff";
107
+ export declare const SERVER_PLUGIN_EXPRESS = "@modern-js/plugin-express";
108
+ export declare const SERVER_PLUGIN_EGG = "@modern-js/plugin-egg";
109
+ export declare const SERVER_PLUGIN_KOA = "@modern-js/plugin-koa";
110
+ export declare const SERVER_PLUGIN_NEST = "@modern-js/plugin-nest";
111
+ export declare const SERVER_PLUGIN_SERVER = "@modern-js/plugin-server";
112
+ export declare const SERVER_PLUGIN_POLYFILL = "@modern-js/plugin-polyfill";
113
+ export declare const INTERNAL_SERVER_PLUGINS: InternalPlugins;
114
+ /**
115
+ * The schema registered in the plugin.
116
+ */
117
+
118
+ export declare const PLUGIN_SCHEMAS: {
119
+ '@modern-js/runtime': ({
120
+ target: string;
121
+ schema: {
122
+ type: string;
123
+ additionalProperties: boolean;
124
+ patternProperties?: undefined;
125
+ };
126
+ } | {
127
+ target: string;
128
+ schema: {
129
+ type: string;
130
+ patternProperties: {
131
+ "^[a-zA-Z0-9_-]+$": {
132
+ type: string;
133
+ };
134
+ };
135
+ additionalProperties: boolean;
136
+ };
137
+ })[];
138
+ '@modern-js/plugin-swc': {
139
+ target: string;
140
+ schema: {
141
+ typeof: string[];
142
+ };
143
+ }[];
144
+ '@modern-js/plugin-bff': {
145
+ target: string;
146
+ schema: {
147
+ type: string;
148
+ properties: {
149
+ prefix: {
150
+ type: string[];
151
+ items: {
152
+ type: string;
153
+ };
154
+ };
155
+ fetcher: {
156
+ type: string;
157
+ };
158
+ proxy: {
159
+ type: string;
160
+ };
161
+ requestCreator: {
162
+ type: string;
163
+ };
164
+ };
165
+ };
166
+ }[];
167
+ '@modern-js/plugin-tailwindcss': {
168
+ target: string;
169
+ schema: {
170
+ typeof: string[];
171
+ };
172
+ }[];
173
+ '@modern-js/plugin-proxy': {
174
+ target: string;
175
+ schema: {
176
+ typeof: string[];
177
+ };
178
+ }[];
179
+ '@modern-js/plugin-ssg': {
180
+ target: string;
181
+ schema: {
182
+ oneOf: ({
183
+ type: string;
184
+ instanceof?: undefined;
185
+ } | {
186
+ instanceof: string;
187
+ type?: undefined;
188
+ })[];
189
+ };
190
+ }[];
191
+ '@modern-js/plugin-state': {
192
+ target: string;
193
+ schema: {
194
+ type: string[];
195
+ };
196
+ }[];
197
+ '@modern-js/plugin-design-token': ({
198
+ target: string;
199
+ schema: {
200
+ typeof: string[];
201
+ type?: undefined;
202
+ };
203
+ } | {
204
+ target: string;
205
+ schema: {
206
+ type: string[];
207
+ typeof?: undefined;
208
+ };
209
+ })[];
210
+ '@modern-js/plugin-router': {
211
+ target: string;
212
+ schema: {
213
+ type: string[];
214
+ };
215
+ }[];
216
+ '@modern-js/plugin-testing': {
217
+ target: string;
218
+ schema: {
219
+ typeof: string[];
220
+ };
221
+ }[];
222
+ '@modern-js/plugin-garfish': {
223
+ target: string;
224
+ schema: {
225
+ type: string[];
226
+ };
227
+ }[];
228
+ '@modern-js/plugin-nocode': never[];
229
+ };
230
+ /**
231
+ * The `@babel/preset-typescript` default options.
232
+ *
233
+ * for:
234
+ * - `@modern-js/builder-rspack-provider`
235
+ * - `@modern-js/babel-preset-base`
236
+ */
237
+
238
+ export declare const DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS: {
239
+ allowNamespaces: boolean;
240
+ allExtensions: boolean;
241
+ allowDeclareFields: boolean;
242
+ optimizeConstEnums: boolean;
243
+ isTSX: boolean;
244
+ };