@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,320 @@
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
+ });
@@ -0,0 +1,6 @@
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 ADDED
@@ -0,0 +1,28 @@
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
+ });
@@ -0,0 +1 @@
1
+ export declare const emptyDir: (dir: string) => Promise<void>;
@@ -0,0 +1,52 @@
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
+ });
@@ -0,0 +1,7 @@
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;
@@ -0,0 +1,38 @@
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
+ });
@@ -0,0 +1 @@
1
+ export declare const ensureArray: <T>(params: T | T[]) => T[];
@@ -0,0 +1,32 @@
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,4 +1,5 @@
1
1
  export const ROUTE_SPEC_FILE = "route.json";
2
+ export const NESTED_ROUTE_SPEC_FILE = "nestedRoutes.json";
2
3
  export const MAIN_ENTRY_NAME = "main";
3
4
  export const SERVER_BUNDLE_DIRECTORY = "bundles";
4
5
  export const SERVER_WORKER_BUNDLE_DIRECTORY = "worker";
File without changes
@@ -1,2 +1,3 @@
1
1
  export const ROUTE_MANIFEST = `_MODERNJS_ROUTE_MANIFEST`;
2
2
  export const HMR_SOCK_PATH = "/webpack-hmr";
3
+ export const HTML_CHUNKSMAP_SEPARATOR = "<!--<?- chunksMap.js ?>-->";
@@ -0,0 +1,6 @@
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;
@@ -0,0 +1,45 @@
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
+ });
@@ -0,0 +1,16 @@
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;
@@ -0,0 +1,61 @@
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
+ });
@@ -0,0 +1,2 @@
1
+ export declare const defaults: string[];
2
+ export declare const getBrowserslist: (appDirectory: string) => string[];