@modern-js/utils 2.4.0 → 2.5.0-alpha.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/FileSizeReporter.d.ts +5 -5
  3. package/dist/FileSizeReporter.js +143 -136
  4. package/dist/alias.d.ts +16 -14
  5. package/dist/alias.js +94 -54
  6. package/dist/analyzeProject.d.ts +1 -1
  7. package/dist/analyzeProject.js +58 -33
  8. package/dist/applyOptionsChain.d.ts +1 -1
  9. package/dist/applyOptionsChain.js +55 -27
  10. package/dist/chainId.d.ts +256 -184
  11. package/dist/chainId.js +132 -187
  12. package/dist/clearConsole.d.ts +1 -1
  13. package/dist/clearConsole.js +29 -7
  14. package/dist/commands.d.ts +1 -1
  15. package/dist/commands.js +33 -10
  16. package/dist/compatRequire.d.ts +3 -3
  17. package/dist/compatRequire.js +74 -38
  18. package/dist/compiled.d.ts +2 -1
  19. package/dist/compiled.js +137 -72
  20. package/dist/constants.d.ts +131 -105
  21. package/dist/constants.js +298 -277
  22. package/dist/debug.d.ts +1 -1
  23. package/dist/debug.js +28 -11
  24. package/dist/emptyDir.d.ts +1 -1
  25. package/dist/emptyDir.js +51 -9
  26. package/dist/ensureAbsolutePath.d.ts +1 -1
  27. package/dist/ensureAbsolutePath.js +33 -14
  28. package/dist/ensureArray.d.ts +1 -1
  29. package/dist/ensureArray.js +30 -8
  30. package/dist/findExists.d.ts +1 -1
  31. package/dist/findExists.js +37 -17
  32. package/dist/format.d.ts +3 -3
  33. package/dist/format.js +93 -81
  34. package/dist/generateMetaTags.d.ts +4 -4
  35. package/dist/generateMetaTags.js +56 -43
  36. package/dist/getBrowserslist.d.ts +1 -1
  37. package/dist/getBrowserslist.js +31 -7
  38. package/dist/getCoreJsVersion.d.ts +1 -1
  39. package/dist/getCoreJsVersion.js +39 -35
  40. package/dist/getEntryOptions.d.ts +1 -1
  41. package/dist/getEntryOptions.js +51 -24
  42. package/dist/getPackageManager.d.ts +1 -1
  43. package/dist/getPackageManager.js +75 -28
  44. package/dist/getPort.d.ts +7 -4
  45. package/dist/getPort.js +104 -58
  46. package/dist/getServerConfig.d.ts +1 -1
  47. package/dist/getServerConfig.js +61 -32
  48. package/dist/import.d.ts +2 -2
  49. package/dist/import.js +31 -8
  50. package/dist/index.d.ts +2 -0
  51. package/dist/index.js +61 -59
  52. package/dist/is/index.d.ts +12 -1
  53. package/dist/is/index.js +83 -82
  54. package/dist/is/node-env.d.ts +1 -1
  55. package/dist/is/node-env.js +39 -17
  56. package/dist/is/platform.d.ts +1 -1
  57. package/dist/is/platform.js +30 -10
  58. package/dist/is/type.d.ts +1 -1
  59. package/dist/is/type.js +48 -22
  60. package/dist/logger.d.ts +51 -51
  61. package/dist/logger.js +127 -95
  62. package/dist/monorepo.d.ts +3 -3
  63. package/dist/monorepo.js +117 -74
  64. package/dist/nestedRoutes.d.ts +9 -0
  65. package/dist/nestedRoutes.js +144 -0
  66. package/dist/nodeEnv.d.ts +1 -1
  67. package/dist/nodeEnv.js +72 -25
  68. package/dist/path.d.ts +3 -1
  69. package/dist/path.js +76 -59
  70. package/dist/pathSerializer.d.ts +7 -7
  71. package/dist/pathSerializer.js +65 -43
  72. package/dist/plugin.d.ts +1 -1
  73. package/dist/plugin.js +45 -26
  74. package/dist/prettyInstructions.d.ts +4 -4
  75. package/dist/prettyInstructions.js +107 -65
  76. package/dist/printBuildError.d.ts +1 -1
  77. package/dist/printBuildError.js +54 -40
  78. package/dist/react.d.ts +1 -1
  79. package/dist/react.js +57 -21
  80. package/dist/readTsConfig.d.ts +1 -1
  81. package/dist/readTsConfig.js +38 -12
  82. package/dist/remix-router.d.ts +1 -0
  83. package/dist/remix-router.js +17 -0
  84. package/dist/removeSlash.d.ts +1 -1
  85. package/dist/removeSlash.js +33 -9
  86. package/dist/routes.d.ts +1 -1
  87. package/dist/routes.js +49 -22
  88. package/dist/runtimeExports.d.ts +3 -3
  89. package/dist/runtimeExports.js +59 -39
  90. package/dist/serialize.d.ts +1 -0
  91. package/dist/serialize.js +36 -0
  92. package/dist/ssr.d.ts +2 -1
  93. package/dist/ssr.js +30 -7
  94. package/dist/storage.d.ts +3 -3
  95. package/dist/storage.js +65 -59
  96. package/dist/test-utils.d.ts +1 -1
  97. package/dist/test-utils.js +30 -24
  98. package/dist/tryResolve.d.ts +2 -1
  99. package/dist/tryResolve.js +45 -33
  100. package/dist/types.d.ts +1 -1
  101. package/dist/types.js +15 -2
  102. package/dist/version.d.ts +1 -1
  103. package/dist/version.js +83 -24
  104. package/dist/wait.d.ts +1 -1
  105. package/dist/wait.js +28 -6
  106. package/dist/watch.d.ts +5 -5
  107. package/dist/watch.js +82 -55
  108. package/package.json +31 -9
package/dist/constants.js CHANGED
@@ -1,285 +1,306 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PLUGIN_SCHEMAS = exports.INTERNAL_SERVER_PLUGINS = exports.SERVER_PLUGIN_POLYFILL = exports.SERVER_PLUGIN_SERVER = exports.SERVER_PLUGIN_NEST = exports.SERVER_PLUGIN_KOA = exports.SERVER_PLUGIN_EGG = exports.SERVER_PLUGIN_EXPRESS = exports.SERVER_PLUGIN_BFF = exports.INTERNAL_CLI_PLUGINS = exports.INTERNAL_DOC_TOOLS_PLUGINS = exports.INTERNAL_MONOREPO_TOOLS_PLUGINS = exports.INTERNAL_MODULE_TOOLS_PLUGINS = exports.INTERNAL_APP_TOOLS_RUNTIME_PLUGINS = exports.INTERNAL_APP_TOOLS_PLUGINS = exports.LOADER_ROUTES_DIR = exports.ROUTE_MANIFEST = exports.ROUTE_MINIFEST_FILE = exports.DEFAULT_SERVER_CONFIG = exports.OUTPUT_CONFIG_FILE = exports.CONFIG_FILE_EXTENSIONS = exports.CONFIG_CACHE_DIR = exports.SHARED_DIR = exports.SERVER_DIR = exports.API_DIR = exports.LOADABLE_STATS_FILE = exports.SERVER_RENDER_FUNCTION_NAME = exports.ENTRY_NAME_PATTERN = exports.SERVER_BUNDLE_DIRECTORY = exports.LAUNCH_EDITOR_ENDPOINT = exports.MAIN_ENTRY_NAME = exports.ROUTE_SPEC_FILE = exports.HMR_SOCK_PATH = void 0;
4
- /**
5
- * hmr socket connect path
6
- */
7
- exports.HMR_SOCK_PATH = '/webpack-hmr';
8
- /**
9
- * route specification file
10
- */
11
- exports.ROUTE_SPEC_FILE = 'route.json';
12
- /**
13
- * main entry name
14
- */
15
- exports.MAIN_ENTRY_NAME = 'main';
16
- /**
17
- * open editor request path
18
- */
19
- exports.LAUNCH_EDITOR_ENDPOINT = '/__open-stack-frame-in-editor';
20
- /**
21
- * server side bundles directory, which relative to dist.
22
- */
23
- exports.SERVER_BUNDLE_DIRECTORY = 'bundles';
24
- /**
25
- * entry name pattern used for ajv pattern properties.
26
- */
27
- exports.ENTRY_NAME_PATTERN = '^[a-zA-Z0-9_-]+$';
28
- /**
29
- * SSR server render function name
30
- */
31
- exports.SERVER_RENDER_FUNCTION_NAME = 'serverRender';
32
- /**
33
- * loadbale manifest json file
34
- */
35
- exports.LOADABLE_STATS_FILE = 'loadable-stats.json';
36
- /**
37
- * internal specified folder
38
- */
39
- exports.API_DIR = 'api';
40
- exports.SERVER_DIR = 'server';
41
- exports.SHARED_DIR = 'shared';
42
- /**
43
- * Modern.config.ts cached dir
44
- */
45
- exports.CONFIG_CACHE_DIR = './node_modules/.cache/node-bundle-require';
46
- exports.CONFIG_FILE_EXTENSIONS = ['.js', '.ts', '.mjs'];
47
- /**
48
- * Serialized config path
49
- */
50
- exports.OUTPUT_CONFIG_FILE = 'modern.config.json';
51
- /**
52
- * Default server config basename
53
- */
54
- exports.DEFAULT_SERVER_CONFIG = 'modern.server-runtime.config';
55
- /**
56
- * Routes manifest filename
57
- */
58
- exports.ROUTE_MINIFEST_FILE = 'routes-manifest.json';
59
- /**
60
- * Property mounted on window that describes route manifest
61
- */
62
- exports.ROUTE_MANIFEST = `_MODERNJS_ROUTE_MANIFEST`;
63
- /**
64
- * directory name for loader routes
65
- */
66
- exports.LOADER_ROUTES_DIR = `loader-routes`;
67
- /**
68
- * Internal app-tools plugins that work as soon as they are installed.
69
- */
70
- exports.INTERNAL_APP_TOOLS_PLUGINS = {
71
- '@modern-js/app-tools': '@modern-js/app-tools/cli',
72
- '@modern-js/plugin-proxy': '@modern-js/plugin-proxy/cli',
73
- '@modern-js/plugin-ssg': '@modern-js/plugin-ssg/cli',
74
- '@modern-js/plugin-bff': '@modern-js/plugin-bff/cli',
75
- '@modern-js/plugin-testing': '@modern-js/plugin-testing/cli',
76
- '@modern-js/plugin-storybook': '@modern-js/plugin-storybook/cli',
77
- '@modern-js/plugin-express': '@modern-js/plugin-express/cli',
78
- '@modern-js/plugin-egg': '@modern-js/plugin-egg/cli',
79
- '@modern-js/plugin-koa': '@modern-js/plugin-koa/cli',
80
- '@modern-js/plugin-nest': '@modern-js/plugin-nest/cli',
81
- '@modern-js/plugin-server': '@modern-js/plugin-server/cli',
82
- '@modern-js/plugin-garfish': '@modern-js/plugin-garfish/cli',
83
- '@modern-js/plugin-tailwindcss': '@modern-js/plugin-tailwindcss/cli',
84
- '@modern-js/plugin-polyfill': '@modern-js/plugin-polyfill/cli',
85
- // legacy router (inner react-router-dom v5)
86
- '@modern-js/plugin-router-v5': '@modern-js/plugin-router-v5/cli',
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 });
87
8
  };
88
- exports.INTERNAL_APP_TOOLS_RUNTIME_PLUGINS = {
89
- '@modern-js/runtime': '@modern-js/runtime/cli',
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;
90
16
  };
91
- /**
92
- * Internal module-tools plugins that work as soon as they are installed.
93
- */
94
- exports.INTERNAL_MODULE_TOOLS_PLUGINS = {
95
- '@modern-js/module-tools': '@modern-js/module-tools',
96
- '@modern-js/doc-tools': '@modern-js/doc-tools',
97
- '@modern-js/runtime': '@modern-js/runtime/cli',
98
- '@modern-js/plugin-testing': '@modern-js/plugin-testing/cli',
99
- '@modern-js/plugin-storybook': '@modern-js/plugin-storybook/cli',
100
- '@modern-js/plugin-tailwindcss': '@modern-js/plugin-tailwindcss/cli',
101
- // TODO: Maybe can remove it
102
- '@modern-js/plugin-nocode': '@modern-js/plugin-nocode/cli',
103
- // legacy router (inner react-router-dom v5)
104
- '@modern-js/plugin-router-legacy': '@modern-js/plugin-router-legacy/cli',
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var constants_exports = {};
19
+ __export(constants_exports, {
20
+ API_DIR: () => API_DIR,
21
+ CONFIG_CACHE_DIR: () => CONFIG_CACHE_DIR,
22
+ CONFIG_FILE_EXTENSIONS: () => CONFIG_FILE_EXTENSIONS,
23
+ DEFAULT_SERVER_CONFIG: () => DEFAULT_SERVER_CONFIG,
24
+ ENTRY_NAME_PATTERN: () => ENTRY_NAME_PATTERN,
25
+ HMR_SOCK_PATH: () => HMR_SOCK_PATH,
26
+ INTERNAL_APP_TOOLS_PLUGINS: () => INTERNAL_APP_TOOLS_PLUGINS,
27
+ INTERNAL_APP_TOOLS_RUNTIME_PLUGINS: () => INTERNAL_APP_TOOLS_RUNTIME_PLUGINS,
28
+ INTERNAL_CLI_PLUGINS: () => INTERNAL_CLI_PLUGINS,
29
+ INTERNAL_DOC_TOOLS_PLUGINS: () => INTERNAL_DOC_TOOLS_PLUGINS,
30
+ INTERNAL_MODULE_TOOLS_PLUGINS: () => INTERNAL_MODULE_TOOLS_PLUGINS,
31
+ INTERNAL_MONOREPO_TOOLS_PLUGINS: () => INTERNAL_MONOREPO_TOOLS_PLUGINS,
32
+ INTERNAL_SERVER_PLUGINS: () => INTERNAL_SERVER_PLUGINS,
33
+ LAUNCH_EDITOR_ENDPOINT: () => LAUNCH_EDITOR_ENDPOINT,
34
+ LOADABLE_STATS_FILE: () => LOADABLE_STATS_FILE,
35
+ LOADER_ROUTES_DIR: () => LOADER_ROUTES_DIR,
36
+ MAIN_ENTRY_NAME: () => MAIN_ENTRY_NAME,
37
+ OUTPUT_CONFIG_FILE: () => OUTPUT_CONFIG_FILE,
38
+ PLUGIN_SCHEMAS: () => PLUGIN_SCHEMAS,
39
+ ROUTE_MANIFEST: () => ROUTE_MANIFEST,
40
+ ROUTE_MINIFEST_FILE: () => ROUTE_MINIFEST_FILE,
41
+ ROUTE_SPEC_FILE: () => ROUTE_SPEC_FILE,
42
+ SERVER_BUNDLE_DIRECTORY: () => SERVER_BUNDLE_DIRECTORY,
43
+ SERVER_DIR: () => SERVER_DIR,
44
+ SERVER_PLUGIN_BFF: () => SERVER_PLUGIN_BFF,
45
+ SERVER_PLUGIN_EGG: () => SERVER_PLUGIN_EGG,
46
+ SERVER_PLUGIN_EXPRESS: () => SERVER_PLUGIN_EXPRESS,
47
+ SERVER_PLUGIN_KOA: () => SERVER_PLUGIN_KOA,
48
+ SERVER_PLUGIN_NEST: () => SERVER_PLUGIN_NEST,
49
+ SERVER_PLUGIN_POLYFILL: () => SERVER_PLUGIN_POLYFILL,
50
+ SERVER_PLUGIN_SERVER: () => SERVER_PLUGIN_SERVER,
51
+ SERVER_RENDER_FUNCTION_NAME: () => SERVER_RENDER_FUNCTION_NAME,
52
+ SERVER_WORKER_BUNDLE_DIRECTORY: () => SERVER_WORKER_BUNDLE_DIRECTORY,
53
+ SHARED_DIR: () => SHARED_DIR
54
+ });
55
+ module.exports = __toCommonJS(constants_exports);
56
+ const HMR_SOCK_PATH = "/webpack-hmr";
57
+ const ROUTE_SPEC_FILE = "route.json";
58
+ const MAIN_ENTRY_NAME = "main";
59
+ const LAUNCH_EDITOR_ENDPOINT = "/__open-stack-frame-in-editor";
60
+ const SERVER_BUNDLE_DIRECTORY = "bundles";
61
+ const SERVER_WORKER_BUNDLE_DIRECTORY = "worker";
62
+ const ENTRY_NAME_PATTERN = "^[a-zA-Z0-9_-]+$";
63
+ const SERVER_RENDER_FUNCTION_NAME = "serverRender";
64
+ const LOADABLE_STATS_FILE = "loadable-stats.json";
65
+ const API_DIR = "api";
66
+ const SERVER_DIR = "server";
67
+ const SHARED_DIR = "shared";
68
+ const CONFIG_CACHE_DIR = "./node_modules/.cache/node-bundle-require";
69
+ const CONFIG_FILE_EXTENSIONS = [".js", ".ts", ".mjs"];
70
+ const OUTPUT_CONFIG_FILE = "modern.config.json";
71
+ const DEFAULT_SERVER_CONFIG = "modern.server-runtime.config";
72
+ const ROUTE_MINIFEST_FILE = "routes-manifest.json";
73
+ const ROUTE_MANIFEST = `_MODERNJS_ROUTE_MANIFEST`;
74
+ const LOADER_ROUTES_DIR = `loader-routes`;
75
+ const INTERNAL_APP_TOOLS_PLUGINS = {
76
+ "@modern-js/app-tools": "@modern-js/app-tools/cli",
77
+ "@modern-js/plugin-proxy": "@modern-js/plugin-proxy/cli",
78
+ "@modern-js/plugin-ssg": "@modern-js/plugin-ssg/cli",
79
+ "@modern-js/plugin-bff": "@modern-js/plugin-bff/cli",
80
+ "@modern-js/plugin-testing": "@modern-js/plugin-testing/cli",
81
+ "@modern-js/plugin-storybook": "@modern-js/plugin-storybook/cli",
82
+ "@modern-js/plugin-express": "@modern-js/plugin-express/cli",
83
+ "@modern-js/plugin-egg": "@modern-js/plugin-egg/cli",
84
+ "@modern-js/plugin-koa": "@modern-js/plugin-koa/cli",
85
+ "@modern-js/plugin-nest": "@modern-js/plugin-nest/cli",
86
+ "@modern-js/plugin-server": "@modern-js/plugin-server/cli",
87
+ "@modern-js/plugin-garfish": "@modern-js/plugin-garfish/cli",
88
+ "@modern-js/plugin-tailwindcss": "@modern-js/plugin-tailwindcss/cli",
89
+ "@modern-js/plugin-polyfill": "@modern-js/plugin-polyfill/cli",
90
+ "@modern-js/plugin-router-v5": "@modern-js/plugin-router-v5/cli"
105
91
  };
106
- /**
107
- * Internal monorepo-tools plugins that work as soon as they are installed.
108
- */
109
- exports.INTERNAL_MONOREPO_TOOLS_PLUGINS = {
110
- '@modern-js/monorepo-tools': '@modern-js/monorepo-tools/cli',
111
- '@modern-js/plugin-testing': '@modern-js/plugin-testing/cli',
92
+ const INTERNAL_APP_TOOLS_RUNTIME_PLUGINS = {
93
+ "@modern-js/runtime": "@modern-js/runtime/cli"
112
94
  };
113
- /**
114
- * Internal doc-tools plugins that work as soon as they are installed.
115
- */
116
- exports.INTERNAL_DOC_TOOLS_PLUGINS = {
117
- '@modern-js/doc-tools': '@modern-js/doc-tools',
118
- '@modern-js/runtime': '@modern-js/runtime/cli',
119
- '@modern-js/plugin-testing': '@modern-js/plugin-testing/cli',
95
+ const INTERNAL_MODULE_TOOLS_PLUGINS = {
96
+ "@modern-js/module-tools": "@modern-js/module-tools",
97
+ "@modern-js/doc-tools": "@modern-js/doc-tools",
98
+ "@modern-js/runtime": "@modern-js/runtime/cli",
99
+ "@modern-js/plugin-testing": "@modern-js/plugin-testing/cli",
100
+ "@modern-js/plugin-storybook": "@modern-js/plugin-storybook/cli",
101
+ "@modern-js/plugin-tailwindcss": "@modern-js/plugin-tailwindcss/cli",
102
+ "@modern-js/plugin-nocode": "@modern-js/plugin-nocode/cli",
103
+ "@modern-js/plugin-router-legacy": "@modern-js/plugin-router-legacy/cli"
120
104
  };
121
- /**
122
- * Internal plugins that work as soon as they are installed.
123
- */
124
- exports.INTERNAL_CLI_PLUGINS = {
125
- '@modern-js/app-tools': '@modern-js/app-tools/cli',
126
- '@modern-js/monorepo-tools': '@modern-js/monorepo-tools/cli',
127
- '@modern-js/module-tools': '@modern-js/module-tools',
128
- '@modern-js/doc-tools': '@modern-js/doc-tools',
129
- '@modern-js/runtime': '@modern-js/runtime/cli',
130
- '@modern-js/plugin-proxy': '@modern-js/plugin-proxy/cli',
131
- '@modern-js/plugin-ssg': '@modern-js/plugin-ssg/cli',
132
- '@modern-js/plugin-bff': '@modern-js/plugin-bff/cli',
133
- '@modern-js/plugin-testing': '@modern-js/plugin-testing/cli',
134
- '@modern-js/plugin-storybook': '@modern-js/plugin-storybook/cli',
135
- '@modern-js/plugin-express': '@modern-js/plugin-express/cli',
136
- '@modern-js/plugin-egg': '@modern-js/plugin-egg/cli',
137
- '@modern-js/plugin-koa': '@modern-js/plugin-koa/cli',
138
- '@modern-js/plugin-nest': '@modern-js/plugin-nest/cli',
139
- '@modern-js/plugin-server': '@modern-js/plugin-server/cli',
140
- '@modern-js/plugin-swc': '@modern-js/plugin-swc',
141
- '@modern-js/plugin-garfish': '@modern-js/plugin-garfish/cli',
142
- '@modern-js/plugin-tailwindcss': '@modern-js/plugin-tailwindcss/cli',
143
- '@modern-js/plugin-polyfill': '@modern-js/plugin-polyfill/cli',
144
- // TODO: Maybe can remove it
145
- '@modern-js/plugin-nocode': '@modern-js/plugin-nocode/cli',
146
- // legacy router (inner react-router-dom v5)
147
- '@modern-js/plugin-router-v5': '@modern-js/plugin-router-v5/cli',
105
+ const INTERNAL_MONOREPO_TOOLS_PLUGINS = {
106
+ "@modern-js/monorepo-tools": "@modern-js/monorepo-tools/cli",
107
+ "@modern-js/plugin-testing": "@modern-js/plugin-testing/cli"
148
108
  };
149
- exports.SERVER_PLUGIN_BFF = '@modern-js/plugin-bff';
150
- exports.SERVER_PLUGIN_EXPRESS = '@modern-js/plugin-express';
151
- exports.SERVER_PLUGIN_EGG = '@modern-js/plugin-egg';
152
- exports.SERVER_PLUGIN_KOA = '@modern-js/plugin-koa';
153
- exports.SERVER_PLUGIN_NEST = '@modern-js/plugin-nest';
154
- exports.SERVER_PLUGIN_SERVER = '@modern-js/plugin-server';
155
- exports.SERVER_PLUGIN_POLYFILL = '@modern-js/plugin-polyfill';
156
- exports.INTERNAL_SERVER_PLUGINS = {
157
- [exports.SERVER_PLUGIN_BFF]: '@modern-js/plugin-bff/server',
158
- [exports.SERVER_PLUGIN_EXPRESS]: '@modern-js/plugin-express/server',
159
- [exports.SERVER_PLUGIN_EGG]: '@modern-js/plugin-egg/server',
160
- [exports.SERVER_PLUGIN_KOA]: '@modern-js/plugin-koa/server',
161
- [exports.SERVER_PLUGIN_NEST]: '@modern-js/plugin-nest/server',
162
- [exports.SERVER_PLUGIN_SERVER]: '@modern-js/plugin-server/server',
163
- [exports.SERVER_PLUGIN_POLYFILL]: '@modern-js/plugin-polyfill/server',
109
+ const INTERNAL_DOC_TOOLS_PLUGINS = {
110
+ "@modern-js/doc-tools": "@modern-js/doc-tools",
111
+ "@modern-js/runtime": "@modern-js/runtime/cli",
112
+ "@modern-js/plugin-testing": "@modern-js/plugin-testing/cli"
164
113
  };
165
- /**
166
- * The schema registered in the plugin.
167
- */
168
- exports.PLUGIN_SCHEMAS = {
169
- '@modern-js/runtime': [
170
- {
171
- target: 'runtime',
172
- schema: {
173
- type: 'object',
174
- additionalProperties: false,
175
- },
176
- },
177
- {
178
- target: 'runtimeByEntries',
179
- schema: {
180
- type: 'object',
181
- patternProperties: { [exports.ENTRY_NAME_PATTERN]: { type: 'object' } },
182
- additionalProperties: false,
183
- },
184
- },
185
- ],
186
- '@modern-js/plugin-swc': [
187
- {
188
- target: 'tools.swc',
189
- schema: { typeof: ['object'] },
190
- },
191
- ],
192
- '@modern-js/plugin-bff': [
193
- {
194
- target: 'bff',
195
- schema: {
196
- type: 'object',
197
- properties: {
198
- prefix: {
199
- type: ['string', 'array'],
200
- items: { type: 'string' },
201
- },
202
- fetcher: { type: 'string' },
203
- proxy: { type: 'object' },
204
- requestCreator: { type: 'string' },
205
- },
206
- },
207
- },
208
- ],
209
- '@modern-js/plugin-tailwindcss': [
210
- {
211
- target: 'tools.tailwindcss',
212
- schema: { typeof: ['object', 'function'] },
213
- },
214
- ],
215
- '@modern-js/plugin-proxy': [
216
- {
217
- target: 'dev.proxy',
218
- schema: { typeof: ['string', 'object'] },
219
- },
220
- ],
221
- '@modern-js/plugin-ssg': [
222
- {
223
- target: 'output.ssg',
224
- schema: {
225
- oneOf: [
226
- { type: 'boolean' },
227
- { type: 'object' },
228
- { instanceof: 'Function' },
229
- ],
230
- },
231
- },
232
- ],
233
- '@modern-js/plugin-state': [
234
- {
235
- target: 'runtime.state',
236
- schema: { type: ['boolean', 'object'] },
237
- },
238
- ],
239
- '@modern-js/plugin-design-token': [
240
- // Legacy Features
241
- {
242
- target: 'source.designSystem',
243
- schema: { typeof: ['object'] },
244
- },
245
- {
246
- target: 'source.designSystem.supportStyledComponents',
247
- schema: { type: ['boolean'] },
248
- },
249
- {
250
- target: 'designSystem',
251
- schema: { typeof: ['object'] },
252
- },
253
- ],
254
- '@modern-js/plugin-router': [
255
- {
256
- target: 'runtime.router',
257
- schema: { type: ['boolean', 'object'] },
258
- },
259
- ],
260
- '@modern-js/plugin-testing': [
261
- {
262
- target: 'testing',
263
- schema: { typeof: ['object'] },
264
- },
265
- {
266
- target: 'tools.jest',
267
- schema: { typeof: ['object', 'function'] },
268
- },
269
- ],
270
- '@modern-js/plugin-garfish': [
271
- {
272
- target: 'runtime.masterApp',
273
- schema: { type: ['boolean', 'object'] },
274
- },
275
- {
276
- target: 'dev.withMasterApp',
277
- schema: { type: ['object'] },
278
- },
279
- {
280
- target: 'deploy.microFrontend',
281
- schema: { type: ['boolean', 'object'] },
282
- },
283
- ],
284
- '@modern-js/plugin-nocode': [],
114
+ const INTERNAL_CLI_PLUGINS = {
115
+ "@modern-js/app-tools": "@modern-js/app-tools/cli",
116
+ "@modern-js/monorepo-tools": "@modern-js/monorepo-tools/cli",
117
+ "@modern-js/module-tools": "@modern-js/module-tools",
118
+ "@modern-js/doc-tools": "@modern-js/doc-tools",
119
+ "@modern-js/runtime": "@modern-js/runtime/cli",
120
+ "@modern-js/plugin-proxy": "@modern-js/plugin-proxy/cli",
121
+ "@modern-js/plugin-ssg": "@modern-js/plugin-ssg/cli",
122
+ "@modern-js/plugin-bff": "@modern-js/plugin-bff/cli",
123
+ "@modern-js/plugin-testing": "@modern-js/plugin-testing/cli",
124
+ "@modern-js/plugin-storybook": "@modern-js/plugin-storybook/cli",
125
+ "@modern-js/plugin-express": "@modern-js/plugin-express/cli",
126
+ "@modern-js/plugin-egg": "@modern-js/plugin-egg/cli",
127
+ "@modern-js/plugin-koa": "@modern-js/plugin-koa/cli",
128
+ "@modern-js/plugin-nest": "@modern-js/plugin-nest/cli",
129
+ "@modern-js/plugin-server": "@modern-js/plugin-server/cli",
130
+ "@modern-js/plugin-swc": "@modern-js/plugin-swc",
131
+ "@modern-js/plugin-garfish": "@modern-js/plugin-garfish/cli",
132
+ "@modern-js/plugin-tailwindcss": "@modern-js/plugin-tailwindcss/cli",
133
+ "@modern-js/plugin-polyfill": "@modern-js/plugin-polyfill/cli",
134
+ "@modern-js/plugin-nocode": "@modern-js/plugin-nocode/cli",
135
+ "@modern-js/plugin-router-v5": "@modern-js/plugin-router-v5/cli"
285
136
  };
137
+ const SERVER_PLUGIN_BFF = "@modern-js/plugin-bff";
138
+ const SERVER_PLUGIN_EXPRESS = "@modern-js/plugin-express";
139
+ const SERVER_PLUGIN_EGG = "@modern-js/plugin-egg";
140
+ const SERVER_PLUGIN_KOA = "@modern-js/plugin-koa";
141
+ const SERVER_PLUGIN_NEST = "@modern-js/plugin-nest";
142
+ const SERVER_PLUGIN_SERVER = "@modern-js/plugin-server";
143
+ const SERVER_PLUGIN_POLYFILL = "@modern-js/plugin-polyfill";
144
+ const INTERNAL_SERVER_PLUGINS = {
145
+ [SERVER_PLUGIN_BFF]: "@modern-js/plugin-bff/server",
146
+ [SERVER_PLUGIN_EXPRESS]: "@modern-js/plugin-express/server",
147
+ [SERVER_PLUGIN_EGG]: "@modern-js/plugin-egg/server",
148
+ [SERVER_PLUGIN_KOA]: "@modern-js/plugin-koa/server",
149
+ [SERVER_PLUGIN_NEST]: "@modern-js/plugin-nest/server",
150
+ [SERVER_PLUGIN_SERVER]: "@modern-js/plugin-server/server",
151
+ [SERVER_PLUGIN_POLYFILL]: "@modern-js/plugin-polyfill/server"
152
+ };
153
+ const PLUGIN_SCHEMAS = {
154
+ "@modern-js/runtime": [
155
+ {
156
+ target: "runtime",
157
+ schema: {
158
+ type: "object",
159
+ additionalProperties: false
160
+ }
161
+ },
162
+ {
163
+ target: "runtimeByEntries",
164
+ schema: {
165
+ type: "object",
166
+ patternProperties: { [ENTRY_NAME_PATTERN]: { type: "object" } },
167
+ additionalProperties: false
168
+ }
169
+ }
170
+ ],
171
+ "@modern-js/plugin-swc": [
172
+ {
173
+ target: "tools.swc",
174
+ schema: { typeof: ["object"] }
175
+ }
176
+ ],
177
+ "@modern-js/plugin-bff": [
178
+ {
179
+ target: "bff",
180
+ schema: {
181
+ type: "object",
182
+ properties: {
183
+ prefix: {
184
+ type: ["string", "array"],
185
+ items: { type: "string" }
186
+ },
187
+ fetcher: { type: "string" },
188
+ proxy: { type: "object" },
189
+ requestCreator: { type: "string" }
190
+ }
191
+ }
192
+ }
193
+ ],
194
+ "@modern-js/plugin-tailwindcss": [
195
+ {
196
+ target: "tools.tailwindcss",
197
+ schema: { typeof: ["object", "function"] }
198
+ }
199
+ ],
200
+ "@modern-js/plugin-proxy": [
201
+ {
202
+ target: "dev.proxy",
203
+ schema: { typeof: ["string", "object"] }
204
+ }
205
+ ],
206
+ "@modern-js/plugin-ssg": [
207
+ {
208
+ target: "output.ssg",
209
+ schema: {
210
+ oneOf: [
211
+ { type: "boolean" },
212
+ { type: "object" },
213
+ { instanceof: "Function" }
214
+ ]
215
+ }
216
+ }
217
+ ],
218
+ "@modern-js/plugin-state": [
219
+ {
220
+ target: "runtime.state",
221
+ schema: { type: ["boolean", "object"] }
222
+ }
223
+ ],
224
+ "@modern-js/plugin-design-token": [
225
+ {
226
+ target: "source.designSystem",
227
+ schema: { typeof: ["object"] }
228
+ },
229
+ {
230
+ target: "source.designSystem.supportStyledComponents",
231
+ schema: { type: ["boolean"] }
232
+ },
233
+ {
234
+ target: "designSystem",
235
+ schema: { typeof: ["object"] }
236
+ }
237
+ ],
238
+ "@modern-js/plugin-router": [
239
+ {
240
+ target: "runtime.router",
241
+ schema: { type: ["boolean", "object"] }
242
+ }
243
+ ],
244
+ "@modern-js/plugin-testing": [
245
+ {
246
+ target: "testing",
247
+ schema: { typeof: ["object"] }
248
+ },
249
+ {
250
+ target: "tools.jest",
251
+ schema: { typeof: ["object", "function"] }
252
+ }
253
+ ],
254
+ "@modern-js/plugin-garfish": [
255
+ {
256
+ target: "runtime.masterApp",
257
+ schema: { type: ["boolean", "object"] }
258
+ },
259
+ {
260
+ target: "dev.withMasterApp",
261
+ schema: { type: ["object"] }
262
+ },
263
+ {
264
+ target: "deploy.microFrontend",
265
+ schema: { type: ["boolean", "object"] }
266
+ }
267
+ ],
268
+ "@modern-js/plugin-nocode": []
269
+ };
270
+ // Annotate the CommonJS export names for ESM import in node:
271
+ 0 && (module.exports = {
272
+ API_DIR,
273
+ CONFIG_CACHE_DIR,
274
+ CONFIG_FILE_EXTENSIONS,
275
+ DEFAULT_SERVER_CONFIG,
276
+ ENTRY_NAME_PATTERN,
277
+ HMR_SOCK_PATH,
278
+ INTERNAL_APP_TOOLS_PLUGINS,
279
+ INTERNAL_APP_TOOLS_RUNTIME_PLUGINS,
280
+ INTERNAL_CLI_PLUGINS,
281
+ INTERNAL_DOC_TOOLS_PLUGINS,
282
+ INTERNAL_MODULE_TOOLS_PLUGINS,
283
+ INTERNAL_MONOREPO_TOOLS_PLUGINS,
284
+ INTERNAL_SERVER_PLUGINS,
285
+ LAUNCH_EDITOR_ENDPOINT,
286
+ LOADABLE_STATS_FILE,
287
+ LOADER_ROUTES_DIR,
288
+ MAIN_ENTRY_NAME,
289
+ OUTPUT_CONFIG_FILE,
290
+ PLUGIN_SCHEMAS,
291
+ ROUTE_MANIFEST,
292
+ ROUTE_MINIFEST_FILE,
293
+ ROUTE_SPEC_FILE,
294
+ SERVER_BUNDLE_DIRECTORY,
295
+ SERVER_DIR,
296
+ SERVER_PLUGIN_BFF,
297
+ SERVER_PLUGIN_EGG,
298
+ SERVER_PLUGIN_EXPRESS,
299
+ SERVER_PLUGIN_KOA,
300
+ SERVER_PLUGIN_NEST,
301
+ SERVER_PLUGIN_POLYFILL,
302
+ SERVER_PLUGIN_SERVER,
303
+ SERVER_RENDER_FUNCTION_NAME,
304
+ SERVER_WORKER_BUNDLE_DIRECTORY,
305
+ SHARED_DIR
306
+ });
package/dist/debug.d.ts CHANGED
@@ -3,4 +3,4 @@
3
3
  * @param scope - Custom module name of your debug function.
4
4
  * @returns Debug function which namespace start with modern-js:.
5
5
  */
6
- export declare const createDebugger: (scope: string) => import("../compiled/debug").Debugger;
6
+ export declare const createDebugger: (scope: string) => import("../compiled/debug").Debugger;
package/dist/debug.js CHANGED
@@ -1,11 +1,28 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createDebugger = void 0;
4
- const debug_1 = require("../compiled/debug");
5
- /**
6
- * Create debug function with unified namespace prefix.
7
- * @param scope - Custom module name of your debug function.
8
- * @returns Debug function which namespace start with modern-js:.
9
- */
10
- const createDebugger = (scope) => (0, debug_1.debug)(`modern-js:${scope}`);
11
- exports.createDebugger = createDebugger;
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 debug_exports = {};
19
+ __export(debug_exports, {
20
+ createDebugger: () => createDebugger
21
+ });
22
+ module.exports = __toCommonJS(debug_exports);
23
+ var import_debug = require("../compiled/debug");
24
+ const createDebugger = (scope) => (0, import_debug.debug)(`modern-js:${scope}`);
25
+ // Annotate the CommonJS export names for ESM import in node:
26
+ 0 && (module.exports = {
27
+ createDebugger
28
+ });
@@ -1 +1 @@
1
- export declare const emptyDir: (dir: string) => Promise<void>;
1
+ export declare const emptyDir: (dir: string) => Promise<void>;