@modern-js/utils 2.48.6 → 2.49.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/cli/constants.js +12 -28
- package/dist/cjs/cli/path.js +0 -5
- package/dist/cjs/universal/constants.js +41 -2
- package/dist/cjs/universal/index.js +28 -0
- package/dist/cjs/universal/path.js +30 -0
- package/dist/esm/cli/constants.js +1 -13
- package/dist/esm/cli/path.js +0 -4
- package/dist/esm/universal/constants.js +25 -1
- package/dist/esm/universal/index.js +4 -0
- package/dist/esm/universal/path.js +6 -0
- package/dist/esm-node/cli/constants.js +1 -17
- package/dist/esm-node/cli/path.js +0 -4
- package/dist/esm-node/universal/constants.js +29 -1
- package/dist/esm-node/universal/index.js +4 -0
- package/dist/esm-node/universal/path.js +6 -0
- package/dist/types/cli/constants.d.ts +1 -26
- package/dist/types/cli/path.d.ts +0 -1
- package/dist/types/universal/constants.d.ts +27 -0
- package/dist/types/universal/index.d.ts +1 -0
- package/dist/types/universal/path.d.ts +1 -0
- package/package.json +12 -4
@@ -30,33 +30,29 @@ __export(constants_exports, {
|
|
30
30
|
INTERNAL_DOC_TOOLS_PLUGINS: () => INTERNAL_DOC_TOOLS_PLUGINS,
|
31
31
|
INTERNAL_MODULE_TOOLS_PLUGINS: () => INTERNAL_MODULE_TOOLS_PLUGINS,
|
32
32
|
INTERNAL_MONOREPO_TOOLS_PLUGINS: () => INTERNAL_MONOREPO_TOOLS_PLUGINS,
|
33
|
-
INTERNAL_SERVER_PLUGINS: () => INTERNAL_SERVER_PLUGINS,
|
33
|
+
INTERNAL_SERVER_PLUGINS: () => import_constants.INTERNAL_SERVER_PLUGINS,
|
34
34
|
LOADABLE_STATS_FILE: () => LOADABLE_STATS_FILE,
|
35
35
|
LOADER_ROUTES_DIR: () => LOADER_ROUTES_DIR,
|
36
|
-
MAIN_ENTRY_NAME: () => MAIN_ENTRY_NAME,
|
37
|
-
NESTED_ROUTE_SPEC_FILE: () => NESTED_ROUTE_SPEC_FILE,
|
36
|
+
MAIN_ENTRY_NAME: () => import_constants.MAIN_ENTRY_NAME,
|
37
|
+
NESTED_ROUTE_SPEC_FILE: () => import_constants.NESTED_ROUTE_SPEC_FILE,
|
38
38
|
OUTPUT_CONFIG_FILE: () => OUTPUT_CONFIG_FILE,
|
39
39
|
ROUTE_MANIFEST_FILE: () => ROUTE_MANIFEST_FILE,
|
40
|
-
ROUTE_SPEC_FILE: () => ROUTE_SPEC_FILE,
|
41
|
-
SERVER_BUNDLE_DIRECTORY: () => SERVER_BUNDLE_DIRECTORY,
|
40
|
+
ROUTE_SPEC_FILE: () => import_constants.ROUTE_SPEC_FILE,
|
41
|
+
SERVER_BUNDLE_DIRECTORY: () => import_constants.SERVER_BUNDLE_DIRECTORY,
|
42
42
|
SERVER_DIR: () => SERVER_DIR,
|
43
|
-
SERVER_PLUGIN_BFF: () => SERVER_PLUGIN_BFF,
|
44
|
-
SERVER_PLUGIN_EXPRESS: () => SERVER_PLUGIN_EXPRESS,
|
45
|
-
SERVER_PLUGIN_KOA: () => SERVER_PLUGIN_KOA,
|
46
|
-
SERVER_PLUGIN_POLYFILL: () => SERVER_PLUGIN_POLYFILL,
|
47
|
-
SERVER_PLUGIN_SERVER: () => SERVER_PLUGIN_SERVER,
|
48
|
-
SERVER_RENDER_FUNCTION_NAME: () => SERVER_RENDER_FUNCTION_NAME,
|
43
|
+
SERVER_PLUGIN_BFF: () => import_constants.SERVER_PLUGIN_BFF,
|
44
|
+
SERVER_PLUGIN_EXPRESS: () => import_constants.SERVER_PLUGIN_EXPRESS,
|
45
|
+
SERVER_PLUGIN_KOA: () => import_constants.SERVER_PLUGIN_KOA,
|
46
|
+
SERVER_PLUGIN_POLYFILL: () => import_constants.SERVER_PLUGIN_POLYFILL,
|
47
|
+
SERVER_PLUGIN_SERVER: () => import_constants.SERVER_PLUGIN_SERVER,
|
48
|
+
SERVER_RENDER_FUNCTION_NAME: () => import_constants.SERVER_RENDER_FUNCTION_NAME,
|
49
49
|
SERVER_WORKER_BUNDLE_DIRECTORY: () => SERVER_WORKER_BUNDLE_DIRECTORY,
|
50
50
|
SHARED_DIR: () => SHARED_DIR
|
51
51
|
});
|
52
52
|
module.exports = __toCommonJS(constants_exports);
|
53
|
-
|
54
|
-
const NESTED_ROUTE_SPEC_FILE = "nestedRoutes.json";
|
55
|
-
const MAIN_ENTRY_NAME = "main";
|
56
|
-
const SERVER_BUNDLE_DIRECTORY = "bundles";
|
53
|
+
var import_constants = require("../universal/constants");
|
57
54
|
const SERVER_WORKER_BUNDLE_DIRECTORY = "worker";
|
58
55
|
const ENTRY_NAME_PATTERN = "^[a-zA-Z0-9_-]+$";
|
59
|
-
const SERVER_RENDER_FUNCTION_NAME = "serverRender";
|
60
56
|
const LOADABLE_STATS_FILE = "loadable-stats.json";
|
61
57
|
const API_DIR = "api";
|
62
58
|
const SERVER_DIR = "server";
|
@@ -130,18 +126,6 @@ const INTERNAL_CLI_PLUGINS = {
|
|
130
126
|
// legacy router (inner react-router-dom v5)
|
131
127
|
"@modern-js/plugin-router-v5": "@modern-js/plugin-router-v5/cli"
|
132
128
|
};
|
133
|
-
const SERVER_PLUGIN_BFF = "@modern-js/plugin-bff";
|
134
|
-
const SERVER_PLUGIN_EXPRESS = "@modern-js/plugin-express";
|
135
|
-
const SERVER_PLUGIN_KOA = "@modern-js/plugin-koa";
|
136
|
-
const SERVER_PLUGIN_SERVER = "@modern-js/plugin-server";
|
137
|
-
const SERVER_PLUGIN_POLYFILL = "@modern-js/plugin-polyfill";
|
138
|
-
const INTERNAL_SERVER_PLUGINS = {
|
139
|
-
[SERVER_PLUGIN_BFF]: "@modern-js/plugin-bff/server",
|
140
|
-
[SERVER_PLUGIN_EXPRESS]: "@modern-js/plugin-express/server",
|
141
|
-
[SERVER_PLUGIN_KOA]: "@modern-js/plugin-koa/server",
|
142
|
-
[SERVER_PLUGIN_SERVER]: "@modern-js/plugin-server/server",
|
143
|
-
[SERVER_PLUGIN_POLYFILL]: "@modern-js/plugin-polyfill/server"
|
144
|
-
};
|
145
129
|
// Annotate the CommonJS export names for ESM import in node:
|
146
130
|
0 && (module.exports = {
|
147
131
|
API_DIR,
|
package/dist/cjs/cli/path.js
CHANGED
@@ -28,7 +28,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
29
29
|
var path_exports = {};
|
30
30
|
__export(path_exports, {
|
31
|
-
cutNameByHyphen: () => cutNameByHyphen,
|
32
31
|
getRealTemporaryDirectory: () => getRealTemporaryDirectory,
|
33
32
|
getTemplatePath: () => getTemplatePath,
|
34
33
|
isPathString: () => isPathString,
|
@@ -73,12 +72,8 @@ function splitPathString(str) {
|
|
73
72
|
const removeLeadingSlash = (s) => s.replace(/^\/+/, "");
|
74
73
|
const removeTailSlash = (s) => s.replace(/\/+$/, "");
|
75
74
|
const removeSlash = (s) => removeLeadingSlash(removeTailSlash(s));
|
76
|
-
const cutNameByHyphen = (s) => {
|
77
|
-
return s.split(/[-_]/)[0];
|
78
|
-
};
|
79
75
|
// Annotate the CommonJS export names for ESM import in node:
|
80
76
|
0 && (module.exports = {
|
81
|
-
cutNameByHyphen,
|
82
77
|
getRealTemporaryDirectory,
|
83
78
|
getTemplatePath,
|
84
79
|
isPathString,
|
@@ -20,9 +20,20 @@ var constants_exports = {};
|
|
20
20
|
__export(constants_exports, {
|
21
21
|
HMR_SOCK_PATH: () => HMR_SOCK_PATH,
|
22
22
|
HTML_CHUNKSMAP_SEPARATOR: () => HTML_CHUNKSMAP_SEPARATOR,
|
23
|
+
INTERNAL_SERVER_PLUGINS: () => INTERNAL_SERVER_PLUGINS,
|
23
24
|
LOADER_REPORTER_NAME: () => LOADER_REPORTER_NAME,
|
25
|
+
MAIN_ENTRY_NAME: () => MAIN_ENTRY_NAME,
|
26
|
+
NESTED_ROUTE_SPEC_FILE: () => NESTED_ROUTE_SPEC_FILE,
|
24
27
|
ROUTE_MANIFEST: () => ROUTE_MANIFEST,
|
25
|
-
ROUTE_MODULES: () => ROUTE_MODULES
|
28
|
+
ROUTE_MODULES: () => ROUTE_MODULES,
|
29
|
+
ROUTE_SPEC_FILE: () => ROUTE_SPEC_FILE,
|
30
|
+
SERVER_BUNDLE_DIRECTORY: () => SERVER_BUNDLE_DIRECTORY,
|
31
|
+
SERVER_PLUGIN_BFF: () => SERVER_PLUGIN_BFF,
|
32
|
+
SERVER_PLUGIN_EXPRESS: () => SERVER_PLUGIN_EXPRESS,
|
33
|
+
SERVER_PLUGIN_KOA: () => SERVER_PLUGIN_KOA,
|
34
|
+
SERVER_PLUGIN_POLYFILL: () => SERVER_PLUGIN_POLYFILL,
|
35
|
+
SERVER_PLUGIN_SERVER: () => SERVER_PLUGIN_SERVER,
|
36
|
+
SERVER_RENDER_FUNCTION_NAME: () => SERVER_RENDER_FUNCTION_NAME
|
26
37
|
});
|
27
38
|
module.exports = __toCommonJS(constants_exports);
|
28
39
|
const ROUTE_MANIFEST = `_MODERNJS_ROUTE_MANIFEST`;
|
@@ -30,11 +41,39 @@ const ROUTE_MODULES = `_routeModules`;
|
|
30
41
|
const HMR_SOCK_PATH = "/webpack-hmr";
|
31
42
|
const HTML_CHUNKSMAP_SEPARATOR = "<!--<?- chunksMap.js ?>-->";
|
32
43
|
const LOADER_REPORTER_NAME = `server-loader`;
|
44
|
+
const ROUTE_SPEC_FILE = "route.json";
|
45
|
+
const NESTED_ROUTE_SPEC_FILE = "nestedRoutes.json";
|
46
|
+
const MAIN_ENTRY_NAME = "main";
|
47
|
+
const SERVER_BUNDLE_DIRECTORY = "bundles";
|
48
|
+
const SERVER_RENDER_FUNCTION_NAME = "serverRender";
|
49
|
+
const SERVER_PLUGIN_BFF = "@modern-js/plugin-bff";
|
50
|
+
const SERVER_PLUGIN_EXPRESS = "@modern-js/plugin-express";
|
51
|
+
const SERVER_PLUGIN_KOA = "@modern-js/plugin-koa";
|
52
|
+
const SERVER_PLUGIN_SERVER = "@modern-js/plugin-server";
|
53
|
+
const SERVER_PLUGIN_POLYFILL = "@modern-js/plugin-polyfill";
|
54
|
+
const INTERNAL_SERVER_PLUGINS = {
|
55
|
+
[SERVER_PLUGIN_BFF]: "@modern-js/plugin-bff/server",
|
56
|
+
[SERVER_PLUGIN_EXPRESS]: "@modern-js/plugin-express/server",
|
57
|
+
[SERVER_PLUGIN_KOA]: "@modern-js/plugin-koa/server",
|
58
|
+
[SERVER_PLUGIN_SERVER]: "@modern-js/plugin-server/server",
|
59
|
+
[SERVER_PLUGIN_POLYFILL]: "@modern-js/plugin-polyfill/server"
|
60
|
+
};
|
33
61
|
// Annotate the CommonJS export names for ESM import in node:
|
34
62
|
0 && (module.exports = {
|
35
63
|
HMR_SOCK_PATH,
|
36
64
|
HTML_CHUNKSMAP_SEPARATOR,
|
65
|
+
INTERNAL_SERVER_PLUGINS,
|
37
66
|
LOADER_REPORTER_NAME,
|
67
|
+
MAIN_ENTRY_NAME,
|
68
|
+
NESTED_ROUTE_SPEC_FILE,
|
38
69
|
ROUTE_MANIFEST,
|
39
|
-
ROUTE_MODULES
|
70
|
+
ROUTE_MODULES,
|
71
|
+
ROUTE_SPEC_FILE,
|
72
|
+
SERVER_BUNDLE_DIRECTORY,
|
73
|
+
SERVER_PLUGIN_BFF,
|
74
|
+
SERVER_PLUGIN_EXPRESS,
|
75
|
+
SERVER_PLUGIN_KOA,
|
76
|
+
SERVER_PLUGIN_POLYFILL,
|
77
|
+
SERVER_PLUGIN_SERVER,
|
78
|
+
SERVER_RENDER_FUNCTION_NAME
|
40
79
|
});
|
@@ -0,0 +1,28 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __export = (target, all) => {
|
7
|
+
for (var name in all)
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
+
};
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
+
for (let key of __getOwnPropNames(from))
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
+
}
|
16
|
+
return to;
|
17
|
+
};
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
+
var universal_exports = {};
|
20
|
+
__export(universal_exports, {
|
21
|
+
cutNameByHyphen: () => import_path.cutNameByHyphen
|
22
|
+
});
|
23
|
+
module.exports = __toCommonJS(universal_exports);
|
24
|
+
var import_path = require("./path");
|
25
|
+
// Annotate the CommonJS export names for ESM import in node:
|
26
|
+
0 && (module.exports = {
|
27
|
+
cutNameByHyphen
|
28
|
+
});
|
@@ -0,0 +1,30 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __export = (target, all) => {
|
7
|
+
for (var name in all)
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
+
};
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
+
for (let key of __getOwnPropNames(from))
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
+
}
|
16
|
+
return to;
|
17
|
+
};
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
+
var path_exports = {};
|
20
|
+
__export(path_exports, {
|
21
|
+
cutNameByHyphen: () => cutNameByHyphen
|
22
|
+
});
|
23
|
+
module.exports = __toCommonJS(path_exports);
|
24
|
+
const cutNameByHyphen = (s) => {
|
25
|
+
return s.split(/[-_]/)[0];
|
26
|
+
};
|
27
|
+
// Annotate the CommonJS export names for ESM import in node:
|
28
|
+
0 && (module.exports = {
|
29
|
+
cutNameByHyphen
|
30
|
+
});
|
@@ -1,11 +1,6 @@
|
|
1
|
-
import {
|
2
|
-
var ROUTE_SPEC_FILE = "route.json";
|
3
|
-
var NESTED_ROUTE_SPEC_FILE = "nestedRoutes.json";
|
4
|
-
var MAIN_ENTRY_NAME = "main";
|
5
|
-
var SERVER_BUNDLE_DIRECTORY = "bundles";
|
1
|
+
import { NESTED_ROUTE_SPEC_FILE, MAIN_ENTRY_NAME, ROUTE_SPEC_FILE, SERVER_BUNDLE_DIRECTORY, SERVER_RENDER_FUNCTION_NAME, SERVER_PLUGIN_BFF, SERVER_PLUGIN_EXPRESS, SERVER_PLUGIN_KOA, SERVER_PLUGIN_SERVER, SERVER_PLUGIN_POLYFILL, INTERNAL_SERVER_PLUGINS } from "../universal/constants";
|
6
2
|
var SERVER_WORKER_BUNDLE_DIRECTORY = "worker";
|
7
3
|
var ENTRY_NAME_PATTERN = "^[a-zA-Z0-9_-]+$";
|
8
|
-
var SERVER_RENDER_FUNCTION_NAME = "serverRender";
|
9
4
|
var LOADABLE_STATS_FILE = "loadable-stats.json";
|
10
5
|
var API_DIR = "api";
|
11
6
|
var SERVER_DIR = "server";
|
@@ -79,13 +74,6 @@ var INTERNAL_CLI_PLUGINS = {
|
|
79
74
|
// legacy router (inner react-router-dom v5)
|
80
75
|
"@modern-js/plugin-router-v5": "@modern-js/plugin-router-v5/cli"
|
81
76
|
};
|
82
|
-
var SERVER_PLUGIN_BFF = "@modern-js/plugin-bff";
|
83
|
-
var SERVER_PLUGIN_EXPRESS = "@modern-js/plugin-express";
|
84
|
-
var SERVER_PLUGIN_KOA = "@modern-js/plugin-koa";
|
85
|
-
var SERVER_PLUGIN_SERVER = "@modern-js/plugin-server";
|
86
|
-
var SERVER_PLUGIN_POLYFILL = "@modern-js/plugin-polyfill";
|
87
|
-
var _obj;
|
88
|
-
var INTERNAL_SERVER_PLUGINS = (_obj = {}, _define_property(_obj, SERVER_PLUGIN_BFF, "@modern-js/plugin-bff/server"), _define_property(_obj, SERVER_PLUGIN_EXPRESS, "@modern-js/plugin-express/server"), _define_property(_obj, SERVER_PLUGIN_KOA, "@modern-js/plugin-koa/server"), _define_property(_obj, SERVER_PLUGIN_SERVER, "@modern-js/plugin-server/server"), _define_property(_obj, SERVER_PLUGIN_POLYFILL, "@modern-js/plugin-polyfill/server"), _obj);
|
89
77
|
export {
|
90
78
|
API_DIR,
|
91
79
|
CONFIG_CACHE_DIR,
|
package/dist/esm/cli/path.js
CHANGED
@@ -48,11 +48,7 @@ var removeTailSlash = function(s) {
|
|
48
48
|
var removeSlash = function(s) {
|
49
49
|
return removeLeadingSlash(removeTailSlash(s));
|
50
50
|
};
|
51
|
-
var cutNameByHyphen = function(s) {
|
52
|
-
return s.split(/[-_]/)[0];
|
53
|
-
};
|
54
51
|
export {
|
55
|
-
cutNameByHyphen,
|
56
52
|
getRealTemporaryDirectory,
|
57
53
|
getTemplatePath,
|
58
54
|
isPathString,
|
@@ -1,12 +1,36 @@
|
|
1
|
+
import { _ as _define_property } from "@swc/helpers/_/_define_property";
|
1
2
|
var ROUTE_MANIFEST = "_MODERNJS_ROUTE_MANIFEST";
|
2
3
|
var ROUTE_MODULES = "_routeModules";
|
3
4
|
var HMR_SOCK_PATH = "/webpack-hmr";
|
4
5
|
var HTML_CHUNKSMAP_SEPARATOR = "<!--<?- chunksMap.js ?>-->";
|
5
6
|
var LOADER_REPORTER_NAME = "server-loader";
|
7
|
+
var ROUTE_SPEC_FILE = "route.json";
|
8
|
+
var NESTED_ROUTE_SPEC_FILE = "nestedRoutes.json";
|
9
|
+
var MAIN_ENTRY_NAME = "main";
|
10
|
+
var SERVER_BUNDLE_DIRECTORY = "bundles";
|
11
|
+
var SERVER_RENDER_FUNCTION_NAME = "serverRender";
|
12
|
+
var SERVER_PLUGIN_BFF = "@modern-js/plugin-bff";
|
13
|
+
var SERVER_PLUGIN_EXPRESS = "@modern-js/plugin-express";
|
14
|
+
var SERVER_PLUGIN_KOA = "@modern-js/plugin-koa";
|
15
|
+
var SERVER_PLUGIN_SERVER = "@modern-js/plugin-server";
|
16
|
+
var SERVER_PLUGIN_POLYFILL = "@modern-js/plugin-polyfill";
|
17
|
+
var _obj;
|
18
|
+
var INTERNAL_SERVER_PLUGINS = (_obj = {}, _define_property(_obj, SERVER_PLUGIN_BFF, "@modern-js/plugin-bff/server"), _define_property(_obj, SERVER_PLUGIN_EXPRESS, "@modern-js/plugin-express/server"), _define_property(_obj, SERVER_PLUGIN_KOA, "@modern-js/plugin-koa/server"), _define_property(_obj, SERVER_PLUGIN_SERVER, "@modern-js/plugin-server/server"), _define_property(_obj, SERVER_PLUGIN_POLYFILL, "@modern-js/plugin-polyfill/server"), _obj);
|
6
19
|
export {
|
7
20
|
HMR_SOCK_PATH,
|
8
21
|
HTML_CHUNKSMAP_SEPARATOR,
|
22
|
+
INTERNAL_SERVER_PLUGINS,
|
9
23
|
LOADER_REPORTER_NAME,
|
24
|
+
MAIN_ENTRY_NAME,
|
25
|
+
NESTED_ROUTE_SPEC_FILE,
|
10
26
|
ROUTE_MANIFEST,
|
11
|
-
ROUTE_MODULES
|
27
|
+
ROUTE_MODULES,
|
28
|
+
ROUTE_SPEC_FILE,
|
29
|
+
SERVER_BUNDLE_DIRECTORY,
|
30
|
+
SERVER_PLUGIN_BFF,
|
31
|
+
SERVER_PLUGIN_EXPRESS,
|
32
|
+
SERVER_PLUGIN_KOA,
|
33
|
+
SERVER_PLUGIN_POLYFILL,
|
34
|
+
SERVER_PLUGIN_SERVER,
|
35
|
+
SERVER_RENDER_FUNCTION_NAME
|
12
36
|
};
|
@@ -1,10 +1,6 @@
|
|
1
|
-
|
2
|
-
const NESTED_ROUTE_SPEC_FILE = "nestedRoutes.json";
|
3
|
-
const MAIN_ENTRY_NAME = "main";
|
4
|
-
const SERVER_BUNDLE_DIRECTORY = "bundles";
|
1
|
+
import { NESTED_ROUTE_SPEC_FILE, MAIN_ENTRY_NAME, ROUTE_SPEC_FILE, SERVER_BUNDLE_DIRECTORY, SERVER_RENDER_FUNCTION_NAME, SERVER_PLUGIN_BFF, SERVER_PLUGIN_EXPRESS, SERVER_PLUGIN_KOA, SERVER_PLUGIN_SERVER, SERVER_PLUGIN_POLYFILL, INTERNAL_SERVER_PLUGINS } from "../universal/constants";
|
5
2
|
const SERVER_WORKER_BUNDLE_DIRECTORY = "worker";
|
6
3
|
const ENTRY_NAME_PATTERN = "^[a-zA-Z0-9_-]+$";
|
7
|
-
const SERVER_RENDER_FUNCTION_NAME = "serverRender";
|
8
4
|
const LOADABLE_STATS_FILE = "loadable-stats.json";
|
9
5
|
const API_DIR = "api";
|
10
6
|
const SERVER_DIR = "server";
|
@@ -78,18 +74,6 @@ const INTERNAL_CLI_PLUGINS = {
|
|
78
74
|
// legacy router (inner react-router-dom v5)
|
79
75
|
"@modern-js/plugin-router-v5": "@modern-js/plugin-router-v5/cli"
|
80
76
|
};
|
81
|
-
const SERVER_PLUGIN_BFF = "@modern-js/plugin-bff";
|
82
|
-
const SERVER_PLUGIN_EXPRESS = "@modern-js/plugin-express";
|
83
|
-
const SERVER_PLUGIN_KOA = "@modern-js/plugin-koa";
|
84
|
-
const SERVER_PLUGIN_SERVER = "@modern-js/plugin-server";
|
85
|
-
const SERVER_PLUGIN_POLYFILL = "@modern-js/plugin-polyfill";
|
86
|
-
const INTERNAL_SERVER_PLUGINS = {
|
87
|
-
[SERVER_PLUGIN_BFF]: "@modern-js/plugin-bff/server",
|
88
|
-
[SERVER_PLUGIN_EXPRESS]: "@modern-js/plugin-express/server",
|
89
|
-
[SERVER_PLUGIN_KOA]: "@modern-js/plugin-koa/server",
|
90
|
-
[SERVER_PLUGIN_SERVER]: "@modern-js/plugin-server/server",
|
91
|
-
[SERVER_PLUGIN_POLYFILL]: "@modern-js/plugin-polyfill/server"
|
92
|
-
};
|
93
77
|
export {
|
94
78
|
API_DIR,
|
95
79
|
CONFIG_CACHE_DIR,
|
@@ -30,11 +30,7 @@ function splitPathString(str) {
|
|
30
30
|
const removeLeadingSlash = (s) => s.replace(/^\/+/, "");
|
31
31
|
const removeTailSlash = (s) => s.replace(/\/+$/, "");
|
32
32
|
const removeSlash = (s) => removeLeadingSlash(removeTailSlash(s));
|
33
|
-
const cutNameByHyphen = (s) => {
|
34
|
-
return s.split(/[-_]/)[0];
|
35
|
-
};
|
36
33
|
export {
|
37
|
-
cutNameByHyphen,
|
38
34
|
getRealTemporaryDirectory,
|
39
35
|
getTemplatePath,
|
40
36
|
isPathString,
|
@@ -3,10 +3,38 @@ const ROUTE_MODULES = `_routeModules`;
|
|
3
3
|
const HMR_SOCK_PATH = "/webpack-hmr";
|
4
4
|
const HTML_CHUNKSMAP_SEPARATOR = "<!--<?- chunksMap.js ?>-->";
|
5
5
|
const LOADER_REPORTER_NAME = `server-loader`;
|
6
|
+
const ROUTE_SPEC_FILE = "route.json";
|
7
|
+
const NESTED_ROUTE_SPEC_FILE = "nestedRoutes.json";
|
8
|
+
const MAIN_ENTRY_NAME = "main";
|
9
|
+
const SERVER_BUNDLE_DIRECTORY = "bundles";
|
10
|
+
const SERVER_RENDER_FUNCTION_NAME = "serverRender";
|
11
|
+
const SERVER_PLUGIN_BFF = "@modern-js/plugin-bff";
|
12
|
+
const SERVER_PLUGIN_EXPRESS = "@modern-js/plugin-express";
|
13
|
+
const SERVER_PLUGIN_KOA = "@modern-js/plugin-koa";
|
14
|
+
const SERVER_PLUGIN_SERVER = "@modern-js/plugin-server";
|
15
|
+
const SERVER_PLUGIN_POLYFILL = "@modern-js/plugin-polyfill";
|
16
|
+
const INTERNAL_SERVER_PLUGINS = {
|
17
|
+
[SERVER_PLUGIN_BFF]: "@modern-js/plugin-bff/server",
|
18
|
+
[SERVER_PLUGIN_EXPRESS]: "@modern-js/plugin-express/server",
|
19
|
+
[SERVER_PLUGIN_KOA]: "@modern-js/plugin-koa/server",
|
20
|
+
[SERVER_PLUGIN_SERVER]: "@modern-js/plugin-server/server",
|
21
|
+
[SERVER_PLUGIN_POLYFILL]: "@modern-js/plugin-polyfill/server"
|
22
|
+
};
|
6
23
|
export {
|
7
24
|
HMR_SOCK_PATH,
|
8
25
|
HTML_CHUNKSMAP_SEPARATOR,
|
26
|
+
INTERNAL_SERVER_PLUGINS,
|
9
27
|
LOADER_REPORTER_NAME,
|
28
|
+
MAIN_ENTRY_NAME,
|
29
|
+
NESTED_ROUTE_SPEC_FILE,
|
10
30
|
ROUTE_MANIFEST,
|
11
|
-
ROUTE_MODULES
|
31
|
+
ROUTE_MODULES,
|
32
|
+
ROUTE_SPEC_FILE,
|
33
|
+
SERVER_BUNDLE_DIRECTORY,
|
34
|
+
SERVER_PLUGIN_BFF,
|
35
|
+
SERVER_PLUGIN_EXPRESS,
|
36
|
+
SERVER_PLUGIN_KOA,
|
37
|
+
SERVER_PLUGIN_POLYFILL,
|
38
|
+
SERVER_PLUGIN_SERVER,
|
39
|
+
SERVER_RENDER_FUNCTION_NAME
|
12
40
|
};
|
@@ -1,20 +1,5 @@
|
|
1
1
|
import { InternalPlugins } from '@modern-js/types';
|
2
|
-
|
3
|
-
* route specification file
|
4
|
-
*/
|
5
|
-
export declare const ROUTE_SPEC_FILE = "route.json";
|
6
|
-
/**
|
7
|
-
* Front-end routing metadata
|
8
|
-
*/
|
9
|
-
export declare const NESTED_ROUTE_SPEC_FILE = "nestedRoutes.json";
|
10
|
-
/**
|
11
|
-
* main entry name
|
12
|
-
*/
|
13
|
-
export declare const MAIN_ENTRY_NAME = "main";
|
14
|
-
/**
|
15
|
-
* server side bundles directory, which relative to dist.
|
16
|
-
*/
|
17
|
-
export declare const SERVER_BUNDLE_DIRECTORY = "bundles";
|
2
|
+
export { NESTED_ROUTE_SPEC_FILE, MAIN_ENTRY_NAME, ROUTE_SPEC_FILE, SERVER_BUNDLE_DIRECTORY, SERVER_RENDER_FUNCTION_NAME, SERVER_PLUGIN_BFF, SERVER_PLUGIN_EXPRESS, SERVER_PLUGIN_KOA, SERVER_PLUGIN_SERVER, SERVER_PLUGIN_POLYFILL, INTERNAL_SERVER_PLUGINS, } from '../universal/constants';
|
18
3
|
/**
|
19
4
|
* server side bundles directory, which relative to dist.
|
20
5
|
*/
|
@@ -23,10 +8,6 @@ export declare const SERVER_WORKER_BUNDLE_DIRECTORY = "worker";
|
|
23
8
|
* entry name pattern used for ajv pattern properties.
|
24
9
|
*/
|
25
10
|
export declare const ENTRY_NAME_PATTERN = "^[a-zA-Z0-9_-]+$";
|
26
|
-
/**
|
27
|
-
* SSR server render function name
|
28
|
-
*/
|
29
|
-
export declare const SERVER_RENDER_FUNCTION_NAME = "serverRender";
|
30
11
|
/**
|
31
12
|
* loadbale manifest json file
|
32
13
|
*/
|
@@ -83,9 +64,3 @@ export declare const INTERNAL_DOC_TOOLS_PLUGINS: InternalPlugins;
|
|
83
64
|
* Internal plugins that work as soon as they are installed.
|
84
65
|
*/
|
85
66
|
export declare const INTERNAL_CLI_PLUGINS: InternalPlugins;
|
86
|
-
export declare const SERVER_PLUGIN_BFF = "@modern-js/plugin-bff";
|
87
|
-
export declare const SERVER_PLUGIN_EXPRESS = "@modern-js/plugin-express";
|
88
|
-
export declare const SERVER_PLUGIN_KOA = "@modern-js/plugin-koa";
|
89
|
-
export declare const SERVER_PLUGIN_SERVER = "@modern-js/plugin-server";
|
90
|
-
export declare const SERVER_PLUGIN_POLYFILL = "@modern-js/plugin-polyfill";
|
91
|
-
export declare const INTERNAL_SERVER_PLUGINS: InternalPlugins;
|
package/dist/types/cli/path.d.ts
CHANGED
@@ -8,4 +8,3 @@ export declare function splitPathString(str: string): string[];
|
|
8
8
|
export declare const removeLeadingSlash: (s: string) => string;
|
9
9
|
export declare const removeTailSlash: (s: string) => string;
|
10
10
|
export declare const removeSlash: (s: string) => string;
|
11
|
-
export declare const cutNameByHyphen: (s: string) => string;
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { InternalPlugins } from '@modern-js/types';
|
1
2
|
/**
|
2
3
|
* Property mounted on window that describes route manifest
|
3
4
|
*/
|
@@ -18,3 +19,29 @@ export declare const HTML_CHUNKSMAP_SEPARATOR = "<!--<?- chunksMap.js ?>-->";
|
|
18
19
|
* reporter name for server loader
|
19
20
|
*/
|
20
21
|
export declare const LOADER_REPORTER_NAME = "server-loader";
|
22
|
+
/**
|
23
|
+
* route specification file
|
24
|
+
*/
|
25
|
+
export declare const ROUTE_SPEC_FILE = "route.json";
|
26
|
+
/**
|
27
|
+
* Front-end routing metadata
|
28
|
+
*/
|
29
|
+
export declare const NESTED_ROUTE_SPEC_FILE = "nestedRoutes.json";
|
30
|
+
/**
|
31
|
+
* main entry name
|
32
|
+
*/
|
33
|
+
export declare const MAIN_ENTRY_NAME = "main";
|
34
|
+
/**
|
35
|
+
* server side bundles directory, which relative to dist.
|
36
|
+
*/
|
37
|
+
export declare const SERVER_BUNDLE_DIRECTORY = "bundles";
|
38
|
+
/**
|
39
|
+
* SSR server render function name
|
40
|
+
*/
|
41
|
+
export declare const SERVER_RENDER_FUNCTION_NAME = "serverRender";
|
42
|
+
export declare const SERVER_PLUGIN_BFF = "@modern-js/plugin-bff";
|
43
|
+
export declare const SERVER_PLUGIN_EXPRESS = "@modern-js/plugin-express";
|
44
|
+
export declare const SERVER_PLUGIN_KOA = "@modern-js/plugin-koa";
|
45
|
+
export declare const SERVER_PLUGIN_SERVER = "@modern-js/plugin-server";
|
46
|
+
export declare const SERVER_PLUGIN_POLYFILL = "@modern-js/plugin-polyfill";
|
47
|
+
export declare const INTERNAL_SERVER_PLUGINS: InternalPlugins;
|
@@ -0,0 +1 @@
|
|
1
|
+
export { cutNameByHyphen } from './path';
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const cutNameByHyphen: (s: string) => string;
|
package/package.json
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "2.
|
18
|
+
"version": "2.49.1",
|
19
19
|
"jsnext:source": "./src/index.ts",
|
20
20
|
"types": "./dist/types/index.d.ts",
|
21
21
|
"main": "./dist/cjs/index.js",
|
@@ -34,6 +34,11 @@
|
|
34
34
|
"types": "./dist/types/cli/constants/chainId.d.ts",
|
35
35
|
"default": "./dist/cjs/cli/constants/chainId.js"
|
36
36
|
},
|
37
|
+
"./universal": {
|
38
|
+
"types": "./dist/types/universal/index.d.ts",
|
39
|
+
"import": "./dist/esm/universal/index.js",
|
40
|
+
"default": "./dist/cjs/universal/index.js"
|
41
|
+
},
|
37
42
|
"./universal/constants": {
|
38
43
|
"types": "./dist/types/universal/constants.d.ts",
|
39
44
|
"import": "./dist/esm/universal/constants.js",
|
@@ -80,6 +85,9 @@
|
|
80
85
|
"chain-id": [
|
81
86
|
"./dist/types/cli/constants/chainId.d.ts"
|
82
87
|
],
|
88
|
+
"universal": [
|
89
|
+
"./dist/types/universal/index.d.ts"
|
90
|
+
],
|
83
91
|
"universal/constants": [
|
84
92
|
"./dist/types/universal/constants.d.ts"
|
85
93
|
],
|
@@ -154,9 +162,9 @@
|
|
154
162
|
"jest": "^29",
|
155
163
|
"typescript": "^5",
|
156
164
|
"webpack": "^5.91.0",
|
157
|
-
"@modern-js/types": "2.
|
158
|
-
"@scripts/
|
159
|
-
"@scripts/
|
165
|
+
"@modern-js/types": "2.49.1",
|
166
|
+
"@scripts/build": "2.49.1",
|
167
|
+
"@scripts/jest-config": "2.49.1"
|
160
168
|
},
|
161
169
|
"sideEffects": false,
|
162
170
|
"scripts": {
|