@modern-js/utils 2.22.1-alpha.3 → 2.23.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.
Files changed (133) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/cjs/cli/constants/index.js +0 -215
  3. package/dist/cjs/cli/index.js +0 -1
  4. package/dist/cjs/cli/is/project.js +7 -4
  5. package/dist/cjs/cli/logger.js +0 -5
  6. package/dist/cjs/cli/prettyInstructions.js +3 -2
  7. package/dist/cjs/runtime/nestedRoutes.js +3 -1
  8. package/dist/esm/cli/constants/index.js +0 -212
  9. package/dist/esm/cli/index.js +0 -1
  10. package/dist/esm/cli/is/project.js +7 -4
  11. package/dist/esm/cli/logger.js +0 -5
  12. package/dist/esm/cli/prettyInstructions.js +3 -2
  13. package/dist/esm/runtime/nestedRoutes.js +3 -1
  14. package/dist/types/cli/constants/index.d.ts +0 -121
  15. package/dist/types/cli/index.d.ts +0 -1
  16. package/dist/types/cli/is/project.d.ts +11 -1
  17. package/dist/types/runtime/nestedRoutes.d.ts +6 -2
  18. package/package.json +6 -11
  19. package/dist/FileSizeReporter.d.ts +0 -16
  20. package/dist/FileSizeReporter.js +0 -162
  21. package/dist/alias.d.ts +0 -25
  22. package/dist/alias.js +0 -108
  23. package/dist/analyzeProject.d.ts +0 -2
  24. package/dist/analyzeProject.js +0 -71
  25. package/dist/applyOptionsChain.d.ts +0 -3
  26. package/dist/applyOptionsChain.js +0 -58
  27. package/dist/babel.d.ts +0 -3
  28. package/dist/babel.js +0 -136
  29. package/dist/chainId.d.ts +0 -244
  30. package/dist/chainId.js +0 -196
  31. package/dist/cjs/cli/test.js +0 -19
  32. package/dist/clearConsole.d.ts +0 -1
  33. package/dist/clearConsole.js +0 -31
  34. package/dist/commands.d.ts +0 -4
  35. package/dist/commands.js +0 -48
  36. package/dist/compatRequire.d.ts +0 -13
  37. package/dist/compatRequire.js +0 -82
  38. package/dist/compiled.d.ts +0 -43
  39. package/dist/compiled.js +0 -142
  40. package/dist/constants.d.ts +0 -244
  41. package/dist/constants.js +0 -320
  42. package/dist/debug.d.ts +0 -6
  43. package/dist/debug.js +0 -28
  44. package/dist/emptyDir.d.ts +0 -1
  45. package/dist/emptyDir.js +0 -52
  46. package/dist/ensureAbsolutePath.d.ts +0 -7
  47. package/dist/ensureAbsolutePath.js +0 -38
  48. package/dist/ensureArray.d.ts +0 -1
  49. package/dist/ensureArray.js +0 -32
  50. package/dist/esm/cli/test.js +0 -9
  51. package/dist/findExists.d.ts +0 -6
  52. package/dist/findExists.js +0 -45
  53. package/dist/generateMetaTags.d.ts +0 -16
  54. package/dist/generateMetaTags.js +0 -61
  55. package/dist/getBrowserslist.d.ts +0 -2
  56. package/dist/getBrowserslist.js +0 -31
  57. package/dist/getCoreJsVersion.d.ts +0 -1
  58. package/dist/getCoreJsVersion.js +0 -46
  59. package/dist/getEntryOptions.d.ts +0 -1
  60. package/dist/getEntryOptions.js +0 -54
  61. package/dist/getPackageManager.d.ts +0 -1
  62. package/dist/getPackageManager.js +0 -87
  63. package/dist/getPort.d.ts +0 -14
  64. package/dist/getPort.js +0 -112
  65. package/dist/getServerConfig.d.ts +0 -1
  66. package/dist/getServerConfig.js +0 -67
  67. package/dist/getTargetDir.d.ts +0 -1
  68. package/dist/getTargetDir.js +0 -41
  69. package/dist/import.d.ts +0 -5
  70. package/dist/import.js +0 -33
  71. package/dist/index.d.ts +0 -44
  72. package/dist/index.js +0 -60
  73. package/dist/is/index.d.ts +0 -58
  74. package/dist/is/index.js +0 -114
  75. package/dist/is/nodeEnv.d.ts +0 -8
  76. package/dist/is/nodeEnv.js +0 -39
  77. package/dist/is/platform.d.ts +0 -2
  78. package/dist/is/platform.js +0 -30
  79. package/dist/is/type.d.ts +0 -8
  80. package/dist/is/type.js +0 -64
  81. package/dist/logger.d.ts +0 -65
  82. package/dist/logger.js +0 -145
  83. package/dist/monorepo.d.ts +0 -11
  84. package/dist/monorepo.js +0 -137
  85. package/dist/nodeEnv.d.ts +0 -3
  86. package/dist/nodeEnv.js +0 -81
  87. package/dist/path.d.ts +0 -18
  88. package/dist/path.js +0 -92
  89. package/dist/pathSerializer.d.ts +0 -16
  90. package/dist/pathSerializer.js +0 -76
  91. package/dist/plugin.d.ts +0 -2
  92. package/dist/plugin.js +0 -46
  93. package/dist/prettyInstructions.d.ts +0 -9
  94. package/dist/prettyInstructions.js +0 -112
  95. package/dist/printBuildError.d.ts +0 -8
  96. package/dist/printBuildError.js +0 -57
  97. package/dist/react.d.ts +0 -1
  98. package/dist/react.js +0 -64
  99. package/dist/readTsConfig.d.ts +0 -2
  100. package/dist/readTsConfig.js +0 -47
  101. package/dist/removeSlash.d.ts +0 -3
  102. package/dist/removeSlash.js +0 -33
  103. package/dist/resolve.d.ts +0 -13
  104. package/dist/resolve.js +0 -63
  105. package/dist/routes.d.ts +0 -2
  106. package/dist/routes.js +0 -58
  107. package/dist/runtimeExports.d.ts +0 -4
  108. package/dist/runtimeExports.js +0 -73
  109. package/dist/ssr.d.ts +0 -8
  110. package/dist/ssr.js +0 -30
  111. package/dist/storage.d.ts +0 -5
  112. package/dist/storage.js +0 -75
  113. package/dist/testUtils.d.ts +0 -5
  114. package/dist/testUtils.js +0 -38
  115. package/dist/types/cli/test.d.ts +0 -5
  116. package/dist/types.d.ts +0 -1
  117. package/dist/types.js +0 -15
  118. package/dist/universal/constants.d.ts +0 -9
  119. package/dist/universal/constants.js +0 -30
  120. package/dist/universal/formatWebpack.d.ts +0 -13
  121. package/dist/universal/formatWebpack.js +0 -100
  122. package/dist/universal/nestedRoutes.d.ts +0 -8
  123. package/dist/universal/nestedRoutes.js +0 -131
  124. package/dist/universal/remixRouter.d.ts +0 -1
  125. package/dist/universal/remixRouter.js +0 -17
  126. package/dist/universal/serialize.d.ts +0 -1
  127. package/dist/universal/serialize.js +0 -40
  128. package/dist/version.d.ts +0 -2
  129. package/dist/version.js +0 -92
  130. package/dist/wait.d.ts +0 -2
  131. package/dist/wait.js +0 -29
  132. package/dist/watch.d.ts +0 -8
  133. package/dist/watch.js +0 -90
package/dist/constants.js DELETED
@@ -1,320 +0,0 @@
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 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_BABEL_PRESET_TYPESCRIPT_OPTIONS: () => DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS,
24
- DEFAULT_DEV_HOST: () => DEFAULT_DEV_HOST,
25
- DEFAULT_SERVER_CONFIG: () => DEFAULT_SERVER_CONFIG,
26
- ENTRY_NAME_PATTERN: () => ENTRY_NAME_PATTERN,
27
- INTERNAL_APP_TOOLS_PLUGINS: () => INTERNAL_APP_TOOLS_PLUGINS,
28
- INTERNAL_APP_TOOLS_RUNTIME_PLUGINS: () => INTERNAL_APP_TOOLS_RUNTIME_PLUGINS,
29
- INTERNAL_CLI_PLUGINS: () => INTERNAL_CLI_PLUGINS,
30
- INTERNAL_DOC_TOOLS_PLUGINS: () => INTERNAL_DOC_TOOLS_PLUGINS,
31
- INTERNAL_MODULE_TOOLS_PLUGINS: () => INTERNAL_MODULE_TOOLS_PLUGINS,
32
- INTERNAL_MONOREPO_TOOLS_PLUGINS: () => INTERNAL_MONOREPO_TOOLS_PLUGINS,
33
- INTERNAL_SERVER_PLUGINS: () => INTERNAL_SERVER_PLUGINS,
34
- LAUNCH_EDITOR_ENDPOINT: () => LAUNCH_EDITOR_ENDPOINT,
35
- LOADABLE_STATS_FILE: () => LOADABLE_STATS_FILE,
36
- LOADER_ROUTES_DIR: () => LOADER_ROUTES_DIR,
37
- MAIN_ENTRY_NAME: () => MAIN_ENTRY_NAME,
38
- OUTPUT_CONFIG_FILE: () => OUTPUT_CONFIG_FILE,
39
- PLUGIN_SCHEMAS: () => PLUGIN_SCHEMAS,
40
- ROUTE_MANIFEST_FILE: () => ROUTE_MANIFEST_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 ROUTE_SPEC_FILE = "route.json";
57
- const MAIN_ENTRY_NAME = "main";
58
- const LAUNCH_EDITOR_ENDPOINT = "/__open-stack-frame-in-editor";
59
- const SERVER_BUNDLE_DIRECTORY = "bundles";
60
- const SERVER_WORKER_BUNDLE_DIRECTORY = "worker";
61
- const ENTRY_NAME_PATTERN = "^[a-zA-Z0-9_-]+$";
62
- const SERVER_RENDER_FUNCTION_NAME = "serverRender";
63
- const LOADABLE_STATS_FILE = "loadable-stats.json";
64
- const API_DIR = "api";
65
- const SERVER_DIR = "server";
66
- const SHARED_DIR = "shared";
67
- const CONFIG_CACHE_DIR = "./node_modules/.cache/node-bundle-require";
68
- const CONFIG_FILE_EXTENSIONS = [".js", ".ts", ".mjs"];
69
- const OUTPUT_CONFIG_FILE = "modern.config.json";
70
- const DEFAULT_SERVER_CONFIG = "modern.server-runtime.config";
71
- const ROUTE_MANIFEST_FILE = "routes-manifest.json";
72
- const LOADER_ROUTES_DIR = `loader-routes`;
73
- const DEFAULT_DEV_HOST = "0.0.0.0";
74
- const INTERNAL_APP_TOOLS_PLUGINS = {
75
- "@modern-js/app-tools": "@modern-js/app-tools/cli",
76
- "@modern-js/plugin-proxy": "@modern-js/plugin-proxy/cli",
77
- "@modern-js/plugin-ssg": "@modern-js/plugin-ssg/cli",
78
- "@modern-js/plugin-bff": "@modern-js/plugin-bff/cli",
79
- "@modern-js/plugin-testing": "@modern-js/plugin-testing/cli",
80
- "@modern-js/plugin-storybook": "@modern-js/plugin-storybook/cli",
81
- "@modern-js/plugin-express": "@modern-js/plugin-express/cli",
82
- "@modern-js/plugin-egg": "@modern-js/plugin-egg/cli",
83
- "@modern-js/plugin-koa": "@modern-js/plugin-koa/cli",
84
- "@modern-js/plugin-nest": "@modern-js/plugin-nest/cli",
85
- "@modern-js/plugin-server": "@modern-js/plugin-server/cli",
86
- "@modern-js/plugin-garfish": "@modern-js/plugin-garfish/cli",
87
- "@modern-js/plugin-tailwindcss": "@modern-js/plugin-tailwindcss/cli",
88
- "@modern-js/plugin-polyfill": "@modern-js/plugin-polyfill/cli",
89
- // legacy router (inner react-router-dom v5)
90
- "@modern-js/plugin-router-v5": "@modern-js/plugin-router-v5/cli"
91
- };
92
- const INTERNAL_APP_TOOLS_RUNTIME_PLUGINS = {
93
- "@modern-js/runtime": "@modern-js/runtime/cli"
94
- };
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
- // TODO: Maybe can remove it
103
- "@modern-js/plugin-nocode": "@modern-js/plugin-nocode/cli",
104
- // legacy router (inner react-router-dom v5)
105
- "@modern-js/plugin-router-legacy": "@modern-js/plugin-router-legacy/cli"
106
- };
107
- const INTERNAL_MONOREPO_TOOLS_PLUGINS = {
108
- "@modern-js/monorepo-tools": "@modern-js/monorepo-tools/cli",
109
- "@modern-js/plugin-testing": "@modern-js/plugin-testing/cli"
110
- };
111
- const INTERNAL_DOC_TOOLS_PLUGINS = {
112
- "@modern-js/doc-tools": "@modern-js/doc-tools",
113
- "@modern-js/runtime": "@modern-js/runtime/cli",
114
- "@modern-js/plugin-testing": "@modern-js/plugin-testing/cli"
115
- };
116
- const INTERNAL_CLI_PLUGINS = {
117
- "@modern-js/app-tools": "@modern-js/app-tools/cli",
118
- "@modern-js/monorepo-tools": "@modern-js/monorepo-tools/cli",
119
- "@modern-js/module-tools": "@modern-js/module-tools",
120
- "@modern-js/doc-tools": "@modern-js/doc-tools",
121
- "@modern-js/runtime": "@modern-js/runtime/cli",
122
- "@modern-js/plugin-proxy": "@modern-js/plugin-proxy/cli",
123
- "@modern-js/plugin-ssg": "@modern-js/plugin-ssg/cli",
124
- "@modern-js/plugin-bff": "@modern-js/plugin-bff/cli",
125
- "@modern-js/plugin-testing": "@modern-js/plugin-testing/cli",
126
- "@modern-js/plugin-storybook": "@modern-js/plugin-storybook/cli",
127
- "@modern-js/plugin-express": "@modern-js/plugin-express/cli",
128
- "@modern-js/plugin-egg": "@modern-js/plugin-egg/cli",
129
- "@modern-js/plugin-koa": "@modern-js/plugin-koa/cli",
130
- "@modern-js/plugin-nest": "@modern-js/plugin-nest/cli",
131
- "@modern-js/plugin-server": "@modern-js/plugin-server/cli",
132
- "@modern-js/plugin-swc": "@modern-js/plugin-swc",
133
- "@modern-js/plugin-garfish": "@modern-js/plugin-garfish/cli",
134
- "@modern-js/plugin-tailwindcss": "@modern-js/plugin-tailwindcss/cli",
135
- "@modern-js/plugin-polyfill": "@modern-js/plugin-polyfill/cli",
136
- // TODO: Maybe can remove it
137
- "@modern-js/plugin-nocode": "@modern-js/plugin-nocode/cli",
138
- // legacy router (inner react-router-dom v5)
139
- "@modern-js/plugin-router-v5": "@modern-js/plugin-router-v5/cli"
140
- };
141
- const SERVER_PLUGIN_BFF = "@modern-js/plugin-bff";
142
- const SERVER_PLUGIN_EXPRESS = "@modern-js/plugin-express";
143
- const SERVER_PLUGIN_EGG = "@modern-js/plugin-egg";
144
- const SERVER_PLUGIN_KOA = "@modern-js/plugin-koa";
145
- const SERVER_PLUGIN_NEST = "@modern-js/plugin-nest";
146
- const SERVER_PLUGIN_SERVER = "@modern-js/plugin-server";
147
- const SERVER_PLUGIN_POLYFILL = "@modern-js/plugin-polyfill";
148
- const INTERNAL_SERVER_PLUGINS = {
149
- [SERVER_PLUGIN_BFF]: "@modern-js/plugin-bff/server",
150
- [SERVER_PLUGIN_EXPRESS]: "@modern-js/plugin-express/server",
151
- [SERVER_PLUGIN_EGG]: "@modern-js/plugin-egg/server",
152
- [SERVER_PLUGIN_KOA]: "@modern-js/plugin-koa/server",
153
- [SERVER_PLUGIN_NEST]: "@modern-js/plugin-nest/server",
154
- [SERVER_PLUGIN_SERVER]: "@modern-js/plugin-server/server",
155
- [SERVER_PLUGIN_POLYFILL]: "@modern-js/plugin-polyfill/server"
156
- };
157
- const PLUGIN_SCHEMAS = {
158
- "@modern-js/runtime": [
159
- {
160
- target: "runtime",
161
- schema: {
162
- type: "object",
163
- additionalProperties: false
164
- }
165
- },
166
- {
167
- target: "runtimeByEntries",
168
- schema: {
169
- type: "object",
170
- patternProperties: { [ENTRY_NAME_PATTERN]: { type: "object" } },
171
- additionalProperties: false
172
- }
173
- }
174
- ],
175
- "@modern-js/plugin-swc": [
176
- {
177
- target: "tools.swc",
178
- schema: { typeof: ["object"] }
179
- }
180
- ],
181
- "@modern-js/plugin-bff": [
182
- {
183
- target: "bff",
184
- schema: {
185
- type: "object",
186
- properties: {
187
- prefix: {
188
- type: ["string", "array"],
189
- items: { type: "string" }
190
- },
191
- fetcher: { type: "string" },
192
- proxy: { type: "object" },
193
- requestCreator: { type: "string" }
194
- }
195
- }
196
- }
197
- ],
198
- "@modern-js/plugin-tailwindcss": [
199
- {
200
- target: "tools.tailwindcss",
201
- schema: { typeof: ["object", "function"] }
202
- }
203
- ],
204
- "@modern-js/plugin-proxy": [
205
- {
206
- target: "dev.proxy",
207
- schema: { typeof: ["string", "object"] }
208
- }
209
- ],
210
- "@modern-js/plugin-ssg": [
211
- {
212
- target: "output.ssg",
213
- schema: {
214
- oneOf: [
215
- { type: "boolean" },
216
- { type: "object" },
217
- { instanceof: "Function" }
218
- ]
219
- }
220
- }
221
- ],
222
- "@modern-js/plugin-state": [
223
- {
224
- target: "runtime.state",
225
- schema: { type: ["boolean", "object"] }
226
- }
227
- ],
228
- "@modern-js/plugin-design-token": [
229
- // Legacy Features
230
- {
231
- target: "source.designSystem",
232
- schema: { typeof: ["object"] }
233
- },
234
- {
235
- target: "source.designSystem.supportStyledComponents",
236
- schema: { type: ["boolean"] }
237
- },
238
- {
239
- target: "designSystem",
240
- schema: { typeof: ["object"] }
241
- }
242
- ],
243
- "@modern-js/plugin-router": [
244
- {
245
- target: "runtime.router",
246
- schema: { type: ["boolean", "object"] }
247
- }
248
- ],
249
- "@modern-js/plugin-testing": [
250
- {
251
- target: "testing",
252
- schema: { typeof: ["object"] }
253
- },
254
- {
255
- target: "tools.jest",
256
- schema: { typeof: ["object", "function"] }
257
- }
258
- ],
259
- "@modern-js/plugin-garfish": [
260
- {
261
- target: "runtime.masterApp",
262
- schema: { type: ["boolean", "object"] }
263
- },
264
- {
265
- target: "dev.withMasterApp",
266
- schema: { type: ["object"] }
267
- },
268
- {
269
- target: "deploy.microFrontend",
270
- schema: { type: ["boolean", "object"] }
271
- }
272
- ],
273
- "@modern-js/plugin-nocode": []
274
- };
275
- const DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS = {
276
- allowNamespaces: true,
277
- allExtensions: true,
278
- allowDeclareFields: true,
279
- // aligns Babel's behavior with TypeScript's default behavior.
280
- // https://babeljs.io/docs/en/babel-preset-typescript#optimizeconstenums
281
- optimizeConstEnums: true,
282
- isTSX: true
283
- };
284
- // Annotate the CommonJS export names for ESM import in node:
285
- 0 && (module.exports = {
286
- API_DIR,
287
- CONFIG_CACHE_DIR,
288
- CONFIG_FILE_EXTENSIONS,
289
- DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS,
290
- DEFAULT_DEV_HOST,
291
- DEFAULT_SERVER_CONFIG,
292
- ENTRY_NAME_PATTERN,
293
- INTERNAL_APP_TOOLS_PLUGINS,
294
- INTERNAL_APP_TOOLS_RUNTIME_PLUGINS,
295
- INTERNAL_CLI_PLUGINS,
296
- INTERNAL_DOC_TOOLS_PLUGINS,
297
- INTERNAL_MODULE_TOOLS_PLUGINS,
298
- INTERNAL_MONOREPO_TOOLS_PLUGINS,
299
- INTERNAL_SERVER_PLUGINS,
300
- LAUNCH_EDITOR_ENDPOINT,
301
- LOADABLE_STATS_FILE,
302
- LOADER_ROUTES_DIR,
303
- MAIN_ENTRY_NAME,
304
- OUTPUT_CONFIG_FILE,
305
- PLUGIN_SCHEMAS,
306
- ROUTE_MANIFEST_FILE,
307
- ROUTE_SPEC_FILE,
308
- SERVER_BUNDLE_DIRECTORY,
309
- SERVER_DIR,
310
- SERVER_PLUGIN_BFF,
311
- SERVER_PLUGIN_EGG,
312
- SERVER_PLUGIN_EXPRESS,
313
- SERVER_PLUGIN_KOA,
314
- SERVER_PLUGIN_NEST,
315
- SERVER_PLUGIN_POLYFILL,
316
- SERVER_PLUGIN_SERVER,
317
- SERVER_RENDER_FUNCTION_NAME,
318
- SERVER_WORKER_BUNDLE_DIRECTORY,
319
- SHARED_DIR
320
- });
package/dist/debug.d.ts DELETED
@@ -1,6 +0,0 @@
1
- /**
2
- * Create debug function with unified namespace prefix.
3
- * @param scope - Custom module name of your debug function.
4
- * @returns Debug function which namespace start with modern-js:.
5
- */
6
- export declare const createDebugger: (scope: string) => import("../compiled/debug").Debugger;
package/dist/debug.js DELETED
@@ -1,28 +0,0 @@
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 +0,0 @@
1
- export declare const emptyDir: (dir: string) => Promise<void>;
package/dist/emptyDir.js DELETED
@@ -1,52 +0,0 @@
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 __async = (__this, __arguments, generator) => {
19
- return new Promise((resolve, reject) => {
20
- var fulfilled = (value) => {
21
- try {
22
- step(generator.next(value));
23
- } catch (e) {
24
- reject(e);
25
- }
26
- };
27
- var rejected = (value) => {
28
- try {
29
- step(generator.throw(value));
30
- } catch (e) {
31
- reject(e);
32
- }
33
- };
34
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
35
- step((generator = generator.apply(__this, __arguments)).next());
36
- });
37
- };
38
- var emptyDir_exports = {};
39
- __export(emptyDir_exports, {
40
- emptyDir: () => emptyDir
41
- });
42
- module.exports = __toCommonJS(emptyDir_exports);
43
- var import_compiled = require("./compiled");
44
- const emptyDir = (dir) => __async(void 0, null, function* () {
45
- if (yield import_compiled.fs.pathExists(dir)) {
46
- yield import_compiled.fs.emptyDir(dir);
47
- }
48
- });
49
- // Annotate the CommonJS export names for ESM import in node:
50
- 0 && (module.exports = {
51
- emptyDir
52
- });
@@ -1,7 +0,0 @@
1
- /**
2
- * ensure absolute file path.
3
- * @param base - Base path to resolve relative from.
4
- * @param filePath - Absolute or relative file path.
5
- * @returns Resolved absolute file path.
6
- */
7
- export declare const ensureAbsolutePath: (base: string, filePath: string) => string;
@@ -1,38 +0,0 @@
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 ensureAbsolutePath_exports = {};
29
- __export(ensureAbsolutePath_exports, {
30
- ensureAbsolutePath: () => ensureAbsolutePath
31
- });
32
- module.exports = __toCommonJS(ensureAbsolutePath_exports);
33
- var import_path = __toESM(require("path"));
34
- const ensureAbsolutePath = (base, filePath) => import_path.default.isAbsolute(filePath) ? filePath : import_path.default.resolve(base, filePath);
35
- // Annotate the CommonJS export names for ESM import in node:
36
- 0 && (module.exports = {
37
- ensureAbsolutePath
38
- });
@@ -1 +0,0 @@
1
- export declare const ensureArray: <T>(params: T | T[]) => T[];
@@ -1,32 +0,0 @@
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 ensureArray_exports = {};
19
- __export(ensureArray_exports, {
20
- ensureArray: () => ensureArray
21
- });
22
- module.exports = __toCommonJS(ensureArray_exports);
23
- const ensureArray = (params) => {
24
- if (Array.isArray(params)) {
25
- return params;
26
- }
27
- return [params];
28
- };
29
- // Annotate the CommonJS export names for ESM import in node:
30
- 0 && (module.exports = {
31
- ensureArray
32
- });
@@ -1,9 +0,0 @@
1
- export const initSnapshotSerializer = (root) => {
2
- expect.addSnapshotSerializer({
3
- test: (val) => typeof val === "string" && (val.includes("modern.js") || val.includes("node_modules") || val.includes(root)),
4
- print: (val) => (
5
- // eslint-disable-next-line no-nested-ternary
6
- typeof val === "string" ? 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, "/")}"` : val
7
- )
8
- });
9
- };
@@ -1,6 +0,0 @@
1
- /**
2
- * Find first already exists file.
3
- * @param files - Absolute file paths with extension.
4
- * @returns The file path if exists, or false if no file exists.
5
- */
6
- export declare const findExists: (files: string[]) => string | false;
@@ -1,45 +0,0 @@
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 findExists_exports = {};
29
- __export(findExists_exports, {
30
- findExists: () => findExists
31
- });
32
- module.exports = __toCommonJS(findExists_exports);
33
- var import_fs = __toESM(require("fs"));
34
- const findExists = (files) => {
35
- for (const file of files) {
36
- if (import_fs.default.existsSync(file) && import_fs.default.statSync(file).isFile()) {
37
- return file;
38
- }
39
- }
40
- return false;
41
- };
42
- // Annotate the CommonJS export names for ESM import in node:
43
- 0 && (module.exports = {
44
- findExists
45
- });
@@ -1,16 +0,0 @@
1
- /**
2
- * Copyright JS Foundation and other contributors.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file at
6
- * https://github.com/jantimon/html-webpack-plugin/blob/main/LICENSE
7
- *
8
- * Modified from https://github.com/jantimon/html-webpack-plugin/blob/2f5de7ab9e8bca60e9e200f2e4b4cfab90db28d4/index.js#L800
9
- */
10
- export type MetaAttributes = {
11
- [attributeName: string]: string | boolean;
12
- };
13
- export interface MetaOptions {
14
- [name: string]: string | false | MetaAttributes;
15
- }
16
- export declare const generateMetaTags: (metaOptions?: MetaOptions) => string;
@@ -1,61 +0,0 @@
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 generateMetaTags_exports = {};
19
- __export(generateMetaTags_exports, {
20
- generateMetaTags: () => generateMetaTags
21
- });
22
- module.exports = __toCommonJS(generateMetaTags_exports);
23
- const tagObjectToString = (tagDefinition) => {
24
- const attributes = Object.keys(tagDefinition.attributes || {}).filter((attributeName) => tagDefinition.attributes[attributeName] !== false).map((attributeName) => {
25
- if (tagDefinition.attributes[attributeName] === true) {
26
- return attributeName;
27
- }
28
- return `${attributeName}="${tagDefinition.attributes[attributeName]}"`;
29
- });
30
- return `<${[tagDefinition.tagName].concat(attributes).join(" ")}>${tagDefinition.innerHTML || ""}${tagDefinition.voidTag ? "" : `</${tagDefinition.tagName}>`}`;
31
- };
32
- const generateMetaTags = (metaOptions) => {
33
- if (!metaOptions) {
34
- return "";
35
- }
36
- const metaTagAttributeObjects = Object.keys(metaOptions).map((metaName) => {
37
- const metaTagContent = metaOptions[metaName];
38
- return typeof metaTagContent === "string" ? {
39
- name: metaName,
40
- content: metaTagContent
41
- } : metaTagContent;
42
- }).filter((attribute) => attribute !== false);
43
- return metaTagAttributeObjects.map((metaTagAttributes) => {
44
- if (metaTagAttributes === false) {
45
- throw new Error("Invalid meta tag");
46
- }
47
- return {
48
- tagName: "meta",
49
- voidTag: true,
50
- attributes: metaTagAttributes
51
- };
52
- }).reduce(
53
- (memo, tagObject) => `${memo}
54
- ${tagObjectToString(tagObject)}`,
55
- ""
56
- );
57
- };
58
- // Annotate the CommonJS export names for ESM import in node:
59
- 0 && (module.exports = {
60
- generateMetaTags
61
- });
@@ -1,2 +0,0 @@
1
- export declare const defaults: string[];
2
- export declare const getBrowserslist: (appDirectory: string) => string[];
@@ -1,31 +0,0 @@
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 getBrowserslist_exports = {};
19
- __export(getBrowserslist_exports, {
20
- defaults: () => defaults,
21
- getBrowserslist: () => getBrowserslist
22
- });
23
- module.exports = __toCommonJS(getBrowserslist_exports);
24
- var import_compiled = require("./compiled");
25
- const defaults = ["> 0.01%", "not dead", "not op_mini all"];
26
- const getBrowserslist = (appDirectory) => import_compiled.browserslist.loadConfig({ path: appDirectory }) || defaults;
27
- // Annotate the CommonJS export names for ESM import in node:
28
- 0 && (module.exports = {
29
- defaults,
30
- getBrowserslist
31
- });