@modern-js/utils 2.52.0 → 2.54.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.
- package/dist/cjs/cli/constants.js +13 -9
- package/dist/cjs/cli/get/index.js +6 -0
- package/dist/cjs/universal/constants.js +0 -9
- package/dist/esm/cli/constants.js +12 -9
- package/dist/esm/cli/get/index.js +6 -0
- package/dist/esm/universal/constants.js +0 -4
- package/dist/esm-node/cli/constants.js +12 -9
- package/dist/esm-node/cli/get/index.js +5 -0
- package/dist/esm-node/universal/constants.js +0 -8
- package/dist/types/cli/constants.d.ts +6 -1
- package/dist/types/cli/get/index.d.ts +7 -0
- package/dist/types/universal/constants.d.ts +0 -2
- package/package.json +5 -5
@@ -22,6 +22,7 @@ __export(constants_exports, {
|
|
22
22
|
CONFIG_CACHE_DIR: () => CONFIG_CACHE_DIR,
|
23
23
|
CONFIG_FILE_EXTENSIONS: () => CONFIG_FILE_EXTENSIONS,
|
24
24
|
DEFAULT_DEV_HOST: () => DEFAULT_DEV_HOST,
|
25
|
+
DEFAULT_RUNTIME_CONFIG: () => DEFAULT_RUNTIME_CONFIG,
|
25
26
|
DEFAULT_SERVER_CONFIG: () => DEFAULT_SERVER_CONFIG,
|
26
27
|
ENTRY_NAME_PATTERN: () => ENTRY_NAME_PATTERN,
|
27
28
|
INTERNAL_APP_TOOLS_PLUGINS: () => INTERNAL_APP_TOOLS_PLUGINS,
|
@@ -30,7 +31,7 @@ __export(constants_exports, {
|
|
30
31
|
INTERNAL_DOC_TOOLS_PLUGINS: () => INTERNAL_DOC_TOOLS_PLUGINS,
|
31
32
|
INTERNAL_MODULE_TOOLS_PLUGINS: () => INTERNAL_MODULE_TOOLS_PLUGINS,
|
32
33
|
INTERNAL_MONOREPO_TOOLS_PLUGINS: () => INTERNAL_MONOREPO_TOOLS_PLUGINS,
|
33
|
-
|
34
|
+
JS_EXTENSIONS: () => JS_EXTENSIONS,
|
34
35
|
LOADABLE_STATS_FILE: () => LOADABLE_STATS_FILE,
|
35
36
|
LOADER_ROUTES_DIR: () => LOADER_ROUTES_DIR,
|
36
37
|
MAIN_ENTRY_NAME: () => import_constants.MAIN_ENTRY_NAME,
|
@@ -51,6 +52,12 @@ __export(constants_exports, {
|
|
51
52
|
});
|
52
53
|
module.exports = __toCommonJS(constants_exports);
|
53
54
|
var import_constants = require("../universal/constants");
|
55
|
+
const JS_EXTENSIONS = [
|
56
|
+
".js",
|
57
|
+
".ts",
|
58
|
+
".jsx",
|
59
|
+
".tsx"
|
60
|
+
];
|
54
61
|
const SERVER_WORKER_BUNDLE_DIRECTORY = "worker";
|
55
62
|
const ENTRY_NAME_PATTERN = "^[a-zA-Z0-9_-]+$";
|
56
63
|
const LOADABLE_STATS_FILE = "loadable-stats.json";
|
@@ -64,6 +71,7 @@ const CONFIG_FILE_EXTENSIONS = [
|
|
64
71
|
".mjs"
|
65
72
|
];
|
66
73
|
const OUTPUT_CONFIG_FILE = "modern.config.json";
|
74
|
+
const DEFAULT_RUNTIME_CONFIG = "modern.runtime";
|
67
75
|
const DEFAULT_SERVER_CONFIG = "modern.server-runtime.config";
|
68
76
|
const ROUTE_MANIFEST_FILE = "routes-manifest.json";
|
69
77
|
const LOADER_ROUTES_DIR = `loader-routes`;
|
@@ -73,7 +81,6 @@ const INTERNAL_APP_TOOLS_PLUGINS = {
|
|
73
81
|
"@modern-js/plugin-proxy": "@modern-js/plugin-proxy/cli",
|
74
82
|
"@modern-js/plugin-ssg": "@modern-js/plugin-ssg/cli",
|
75
83
|
"@modern-js/plugin-bff": "@modern-js/plugin-bff/cli",
|
76
|
-
"@modern-js/plugin-testing": "@modern-js/plugin-testing/cli",
|
77
84
|
"@modern-js/plugin-storybook": "@modern-js/plugin-storybook/cli",
|
78
85
|
"@modern-js/plugin-express": "@modern-js/plugin-express/cli",
|
79
86
|
"@modern-js/plugin-koa": "@modern-js/plugin-koa/cli",
|
@@ -90,20 +97,17 @@ const INTERNAL_APP_TOOLS_RUNTIME_PLUGINS = {
|
|
90
97
|
const INTERNAL_MODULE_TOOLS_PLUGINS = {
|
91
98
|
"@modern-js/module-tools": "@modern-js/module-tools",
|
92
99
|
"@modern-js/runtime": "@modern-js/runtime/cli",
|
93
|
-
"@modern-js/plugin-testing": "@modern-js/plugin-testing/cli",
|
94
100
|
"@modern-js/plugin-storybook": "@modern-js/plugin-storybook/cli",
|
95
101
|
"@modern-js/plugin-tailwindcss": "@modern-js/plugin-tailwindcss/cli",
|
96
102
|
// legacy router (inner react-router-dom v5)
|
97
103
|
"@modern-js/plugin-router-legacy": "@modern-js/plugin-router-legacy/cli"
|
98
104
|
};
|
99
105
|
const INTERNAL_MONOREPO_TOOLS_PLUGINS = {
|
100
|
-
"@modern-js/monorepo-tools": "@modern-js/monorepo-tools/cli"
|
101
|
-
"@modern-js/plugin-testing": "@modern-js/plugin-testing/cli"
|
106
|
+
"@modern-js/monorepo-tools": "@modern-js/monorepo-tools/cli"
|
102
107
|
};
|
103
108
|
const INTERNAL_DOC_TOOLS_PLUGINS = {
|
104
109
|
"@modern-js/doc-tools": "@modern-js/doc-tools",
|
105
|
-
"@modern-js/runtime": "@modern-js/runtime/cli"
|
106
|
-
"@modern-js/plugin-testing": "@modern-js/plugin-testing/cli"
|
110
|
+
"@modern-js/runtime": "@modern-js/runtime/cli"
|
107
111
|
};
|
108
112
|
const INTERNAL_CLI_PLUGINS = {
|
109
113
|
"@modern-js/app-tools": "@modern-js/app-tools/cli",
|
@@ -114,7 +118,6 @@ const INTERNAL_CLI_PLUGINS = {
|
|
114
118
|
"@modern-js/plugin-proxy": "@modern-js/plugin-proxy/cli",
|
115
119
|
"@modern-js/plugin-ssg": "@modern-js/plugin-ssg/cli",
|
116
120
|
"@modern-js/plugin-bff": "@modern-js/plugin-bff/cli",
|
117
|
-
"@modern-js/plugin-testing": "@modern-js/plugin-testing/cli",
|
118
121
|
"@modern-js/plugin-storybook": "@modern-js/plugin-storybook/cli",
|
119
122
|
"@modern-js/plugin-express": "@modern-js/plugin-express/cli",
|
120
123
|
"@modern-js/plugin-koa": "@modern-js/plugin-koa/cli",
|
@@ -132,6 +135,7 @@ const INTERNAL_CLI_PLUGINS = {
|
|
132
135
|
CONFIG_CACHE_DIR,
|
133
136
|
CONFIG_FILE_EXTENSIONS,
|
134
137
|
DEFAULT_DEV_HOST,
|
138
|
+
DEFAULT_RUNTIME_CONFIG,
|
135
139
|
DEFAULT_SERVER_CONFIG,
|
136
140
|
ENTRY_NAME_PATTERN,
|
137
141
|
INTERNAL_APP_TOOLS_PLUGINS,
|
@@ -140,7 +144,7 @@ const INTERNAL_CLI_PLUGINS = {
|
|
140
144
|
INTERNAL_DOC_TOOLS_PLUGINS,
|
141
145
|
INTERNAL_MODULE_TOOLS_PLUGINS,
|
142
146
|
INTERNAL_MONOREPO_TOOLS_PLUGINS,
|
143
|
-
|
147
|
+
JS_EXTENSIONS,
|
144
148
|
LOADABLE_STATS_FILE,
|
145
149
|
LOADER_ROUTES_DIR,
|
146
150
|
MAIN_ENTRY_NAME,
|
@@ -29,6 +29,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
29
29
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
30
30
|
var get_exports = {};
|
31
31
|
__export(get_exports, {
|
32
|
+
getMeta: () => getMeta,
|
32
33
|
getServerConfig: () => getServerConfig,
|
33
34
|
getTargetDir: () => getTargetDir
|
34
35
|
});
|
@@ -42,12 +43,17 @@ const getServerConfig = async (appDirectory, configFile) => {
|
|
42
43
|
const configFilePath = (0, import_fs.findExists)(import_constants.CONFIG_FILE_EXTENSIONS.map((extension) => import_path.default.resolve(appDirectory, `${configFile}${extension}`)));
|
43
44
|
return configFilePath;
|
44
45
|
};
|
46
|
+
const getMeta = (metaName = "modern-js") => {
|
47
|
+
const meta = metaName.toLowerCase().split("-")[0];
|
48
|
+
return meta;
|
49
|
+
};
|
45
50
|
const getTargetDir = (from, baseDir, targetBaseDir) => {
|
46
51
|
const relativePath = import_path.default.relative(baseDir, from);
|
47
52
|
return import_path.default.resolve(targetBaseDir, relativePath);
|
48
53
|
};
|
49
54
|
// Annotate the CommonJS export names for ESM import in node:
|
50
55
|
0 && (module.exports = {
|
56
|
+
getMeta,
|
51
57
|
getServerConfig,
|
52
58
|
getTargetDir,
|
53
59
|
...require("./data"),
|
@@ -20,7 +20,6 @@ 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,
|
24
23
|
LOADER_REPORTER_NAME: () => LOADER_REPORTER_NAME,
|
25
24
|
MAIN_ENTRY_NAME: () => MAIN_ENTRY_NAME,
|
26
25
|
NESTED_ROUTE_SPEC_FILE: () => NESTED_ROUTE_SPEC_FILE,
|
@@ -51,18 +50,10 @@ const SERVER_PLUGIN_EXPRESS = "@modern-js/plugin-express";
|
|
51
50
|
const SERVER_PLUGIN_KOA = "@modern-js/plugin-koa";
|
52
51
|
const SERVER_PLUGIN_SERVER = "@modern-js/plugin-server";
|
53
52
|
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
|
-
};
|
61
53
|
// Annotate the CommonJS export names for ESM import in node:
|
62
54
|
0 && (module.exports = {
|
63
55
|
HMR_SOCK_PATH,
|
64
56
|
HTML_CHUNKSMAP_SEPARATOR,
|
65
|
-
INTERNAL_SERVER_PLUGINS,
|
66
57
|
LOADER_REPORTER_NAME,
|
67
58
|
MAIN_ENTRY_NAME,
|
68
59
|
NESTED_ROUTE_SPEC_FILE,
|
@@ -1,4 +1,10 @@
|
|
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
|
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 } from "../universal/constants";
|
2
|
+
var JS_EXTENSIONS = [
|
3
|
+
".js",
|
4
|
+
".ts",
|
5
|
+
".jsx",
|
6
|
+
".tsx"
|
7
|
+
];
|
2
8
|
var SERVER_WORKER_BUNDLE_DIRECTORY = "worker";
|
3
9
|
var ENTRY_NAME_PATTERN = "^[a-zA-Z0-9_-]+$";
|
4
10
|
var LOADABLE_STATS_FILE = "loadable-stats.json";
|
@@ -12,6 +18,7 @@ var CONFIG_FILE_EXTENSIONS = [
|
|
12
18
|
".mjs"
|
13
19
|
];
|
14
20
|
var OUTPUT_CONFIG_FILE = "modern.config.json";
|
21
|
+
var DEFAULT_RUNTIME_CONFIG = "modern.runtime";
|
15
22
|
var DEFAULT_SERVER_CONFIG = "modern.server-runtime.config";
|
16
23
|
var ROUTE_MANIFEST_FILE = "routes-manifest.json";
|
17
24
|
var LOADER_ROUTES_DIR = "loader-routes";
|
@@ -21,7 +28,6 @@ var INTERNAL_APP_TOOLS_PLUGINS = {
|
|
21
28
|
"@modern-js/plugin-proxy": "@modern-js/plugin-proxy/cli",
|
22
29
|
"@modern-js/plugin-ssg": "@modern-js/plugin-ssg/cli",
|
23
30
|
"@modern-js/plugin-bff": "@modern-js/plugin-bff/cli",
|
24
|
-
"@modern-js/plugin-testing": "@modern-js/plugin-testing/cli",
|
25
31
|
"@modern-js/plugin-storybook": "@modern-js/plugin-storybook/cli",
|
26
32
|
"@modern-js/plugin-express": "@modern-js/plugin-express/cli",
|
27
33
|
"@modern-js/plugin-koa": "@modern-js/plugin-koa/cli",
|
@@ -38,20 +44,17 @@ var INTERNAL_APP_TOOLS_RUNTIME_PLUGINS = {
|
|
38
44
|
var INTERNAL_MODULE_TOOLS_PLUGINS = {
|
39
45
|
"@modern-js/module-tools": "@modern-js/module-tools",
|
40
46
|
"@modern-js/runtime": "@modern-js/runtime/cli",
|
41
|
-
"@modern-js/plugin-testing": "@modern-js/plugin-testing/cli",
|
42
47
|
"@modern-js/plugin-storybook": "@modern-js/plugin-storybook/cli",
|
43
48
|
"@modern-js/plugin-tailwindcss": "@modern-js/plugin-tailwindcss/cli",
|
44
49
|
// legacy router (inner react-router-dom v5)
|
45
50
|
"@modern-js/plugin-router-legacy": "@modern-js/plugin-router-legacy/cli"
|
46
51
|
};
|
47
52
|
var INTERNAL_MONOREPO_TOOLS_PLUGINS = {
|
48
|
-
"@modern-js/monorepo-tools": "@modern-js/monorepo-tools/cli"
|
49
|
-
"@modern-js/plugin-testing": "@modern-js/plugin-testing/cli"
|
53
|
+
"@modern-js/monorepo-tools": "@modern-js/monorepo-tools/cli"
|
50
54
|
};
|
51
55
|
var INTERNAL_DOC_TOOLS_PLUGINS = {
|
52
56
|
"@modern-js/doc-tools": "@modern-js/doc-tools",
|
53
|
-
"@modern-js/runtime": "@modern-js/runtime/cli"
|
54
|
-
"@modern-js/plugin-testing": "@modern-js/plugin-testing/cli"
|
57
|
+
"@modern-js/runtime": "@modern-js/runtime/cli"
|
55
58
|
};
|
56
59
|
var INTERNAL_CLI_PLUGINS = {
|
57
60
|
"@modern-js/app-tools": "@modern-js/app-tools/cli",
|
@@ -62,7 +65,6 @@ var INTERNAL_CLI_PLUGINS = {
|
|
62
65
|
"@modern-js/plugin-proxy": "@modern-js/plugin-proxy/cli",
|
63
66
|
"@modern-js/plugin-ssg": "@modern-js/plugin-ssg/cli",
|
64
67
|
"@modern-js/plugin-bff": "@modern-js/plugin-bff/cli",
|
65
|
-
"@modern-js/plugin-testing": "@modern-js/plugin-testing/cli",
|
66
68
|
"@modern-js/plugin-storybook": "@modern-js/plugin-storybook/cli",
|
67
69
|
"@modern-js/plugin-express": "@modern-js/plugin-express/cli",
|
68
70
|
"@modern-js/plugin-koa": "@modern-js/plugin-koa/cli",
|
@@ -79,6 +81,7 @@ export {
|
|
79
81
|
CONFIG_CACHE_DIR,
|
80
82
|
CONFIG_FILE_EXTENSIONS,
|
81
83
|
DEFAULT_DEV_HOST,
|
84
|
+
DEFAULT_RUNTIME_CONFIG,
|
82
85
|
DEFAULT_SERVER_CONFIG,
|
83
86
|
ENTRY_NAME_PATTERN,
|
84
87
|
INTERNAL_APP_TOOLS_PLUGINS,
|
@@ -87,7 +90,7 @@ export {
|
|
87
90
|
INTERNAL_DOC_TOOLS_PLUGINS,
|
88
91
|
INTERNAL_MODULE_TOOLS_PLUGINS,
|
89
92
|
INTERNAL_MONOREPO_TOOLS_PLUGINS,
|
90
|
-
|
93
|
+
JS_EXTENSIONS,
|
91
94
|
LOADABLE_STATS_FILE,
|
92
95
|
LOADER_ROUTES_DIR,
|
93
96
|
MAIN_ENTRY_NAME,
|
@@ -20,6 +20,11 @@ var getServerConfig = function() {
|
|
20
20
|
return _ref.apply(this, arguments);
|
21
21
|
};
|
22
22
|
}();
|
23
|
+
var getMeta = function() {
|
24
|
+
var metaName = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "modern-js";
|
25
|
+
var meta = metaName.toLowerCase().split("-")[0];
|
26
|
+
return meta;
|
27
|
+
};
|
23
28
|
var getTargetDir = function(from, baseDir, targetBaseDir) {
|
24
29
|
var relativePath = path.relative(baseDir, from);
|
25
30
|
return path.resolve(targetBaseDir, relativePath);
|
@@ -27,6 +32,7 @@ var getTargetDir = function(from, baseDir, targetBaseDir) {
|
|
27
32
|
export * from "./data";
|
28
33
|
export * from "./config";
|
29
34
|
export {
|
35
|
+
getMeta,
|
30
36
|
getServerConfig,
|
31
37
|
getTargetDir
|
32
38
|
};
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import { _ as _define_property } from "@swc/helpers/_/_define_property";
|
2
1
|
var ROUTE_MANIFEST = "_MODERNJS_ROUTE_MANIFEST";
|
3
2
|
var ROUTE_MODULES = "_routeModules";
|
4
3
|
var HMR_SOCK_PATH = "/webpack-hmr";
|
@@ -14,12 +13,9 @@ var SERVER_PLUGIN_EXPRESS = "@modern-js/plugin-express";
|
|
14
13
|
var SERVER_PLUGIN_KOA = "@modern-js/plugin-koa";
|
15
14
|
var SERVER_PLUGIN_SERVER = "@modern-js/plugin-server";
|
16
15
|
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);
|
19
16
|
export {
|
20
17
|
HMR_SOCK_PATH,
|
21
18
|
HTML_CHUNKSMAP_SEPARATOR,
|
22
|
-
INTERNAL_SERVER_PLUGINS,
|
23
19
|
LOADER_REPORTER_NAME,
|
24
20
|
MAIN_ENTRY_NAME,
|
25
21
|
NESTED_ROUTE_SPEC_FILE,
|
@@ -1,4 +1,10 @@
|
|
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
|
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 } from "../universal/constants";
|
2
|
+
const JS_EXTENSIONS = [
|
3
|
+
".js",
|
4
|
+
".ts",
|
5
|
+
".jsx",
|
6
|
+
".tsx"
|
7
|
+
];
|
2
8
|
const SERVER_WORKER_BUNDLE_DIRECTORY = "worker";
|
3
9
|
const ENTRY_NAME_PATTERN = "^[a-zA-Z0-9_-]+$";
|
4
10
|
const LOADABLE_STATS_FILE = "loadable-stats.json";
|
@@ -12,6 +18,7 @@ const CONFIG_FILE_EXTENSIONS = [
|
|
12
18
|
".mjs"
|
13
19
|
];
|
14
20
|
const OUTPUT_CONFIG_FILE = "modern.config.json";
|
21
|
+
const DEFAULT_RUNTIME_CONFIG = "modern.runtime";
|
15
22
|
const DEFAULT_SERVER_CONFIG = "modern.server-runtime.config";
|
16
23
|
const ROUTE_MANIFEST_FILE = "routes-manifest.json";
|
17
24
|
const LOADER_ROUTES_DIR = `loader-routes`;
|
@@ -21,7 +28,6 @@ const INTERNAL_APP_TOOLS_PLUGINS = {
|
|
21
28
|
"@modern-js/plugin-proxy": "@modern-js/plugin-proxy/cli",
|
22
29
|
"@modern-js/plugin-ssg": "@modern-js/plugin-ssg/cli",
|
23
30
|
"@modern-js/plugin-bff": "@modern-js/plugin-bff/cli",
|
24
|
-
"@modern-js/plugin-testing": "@modern-js/plugin-testing/cli",
|
25
31
|
"@modern-js/plugin-storybook": "@modern-js/plugin-storybook/cli",
|
26
32
|
"@modern-js/plugin-express": "@modern-js/plugin-express/cli",
|
27
33
|
"@modern-js/plugin-koa": "@modern-js/plugin-koa/cli",
|
@@ -38,20 +44,17 @@ const INTERNAL_APP_TOOLS_RUNTIME_PLUGINS = {
|
|
38
44
|
const INTERNAL_MODULE_TOOLS_PLUGINS = {
|
39
45
|
"@modern-js/module-tools": "@modern-js/module-tools",
|
40
46
|
"@modern-js/runtime": "@modern-js/runtime/cli",
|
41
|
-
"@modern-js/plugin-testing": "@modern-js/plugin-testing/cli",
|
42
47
|
"@modern-js/plugin-storybook": "@modern-js/plugin-storybook/cli",
|
43
48
|
"@modern-js/plugin-tailwindcss": "@modern-js/plugin-tailwindcss/cli",
|
44
49
|
// legacy router (inner react-router-dom v5)
|
45
50
|
"@modern-js/plugin-router-legacy": "@modern-js/plugin-router-legacy/cli"
|
46
51
|
};
|
47
52
|
const INTERNAL_MONOREPO_TOOLS_PLUGINS = {
|
48
|
-
"@modern-js/monorepo-tools": "@modern-js/monorepo-tools/cli"
|
49
|
-
"@modern-js/plugin-testing": "@modern-js/plugin-testing/cli"
|
53
|
+
"@modern-js/monorepo-tools": "@modern-js/monorepo-tools/cli"
|
50
54
|
};
|
51
55
|
const INTERNAL_DOC_TOOLS_PLUGINS = {
|
52
56
|
"@modern-js/doc-tools": "@modern-js/doc-tools",
|
53
|
-
"@modern-js/runtime": "@modern-js/runtime/cli"
|
54
|
-
"@modern-js/plugin-testing": "@modern-js/plugin-testing/cli"
|
57
|
+
"@modern-js/runtime": "@modern-js/runtime/cli"
|
55
58
|
};
|
56
59
|
const INTERNAL_CLI_PLUGINS = {
|
57
60
|
"@modern-js/app-tools": "@modern-js/app-tools/cli",
|
@@ -62,7 +65,6 @@ const INTERNAL_CLI_PLUGINS = {
|
|
62
65
|
"@modern-js/plugin-proxy": "@modern-js/plugin-proxy/cli",
|
63
66
|
"@modern-js/plugin-ssg": "@modern-js/plugin-ssg/cli",
|
64
67
|
"@modern-js/plugin-bff": "@modern-js/plugin-bff/cli",
|
65
|
-
"@modern-js/plugin-testing": "@modern-js/plugin-testing/cli",
|
66
68
|
"@modern-js/plugin-storybook": "@modern-js/plugin-storybook/cli",
|
67
69
|
"@modern-js/plugin-express": "@modern-js/plugin-express/cli",
|
68
70
|
"@modern-js/plugin-koa": "@modern-js/plugin-koa/cli",
|
@@ -79,6 +81,7 @@ export {
|
|
79
81
|
CONFIG_CACHE_DIR,
|
80
82
|
CONFIG_FILE_EXTENSIONS,
|
81
83
|
DEFAULT_DEV_HOST,
|
84
|
+
DEFAULT_RUNTIME_CONFIG,
|
82
85
|
DEFAULT_SERVER_CONFIG,
|
83
86
|
ENTRY_NAME_PATTERN,
|
84
87
|
INTERNAL_APP_TOOLS_PLUGINS,
|
@@ -87,7 +90,7 @@ export {
|
|
87
90
|
INTERNAL_DOC_TOOLS_PLUGINS,
|
88
91
|
INTERNAL_MODULE_TOOLS_PLUGINS,
|
89
92
|
INTERNAL_MONOREPO_TOOLS_PLUGINS,
|
90
|
-
|
93
|
+
JS_EXTENSIONS,
|
91
94
|
LOADABLE_STATS_FILE,
|
92
95
|
LOADER_ROUTES_DIR,
|
93
96
|
MAIN_ENTRY_NAME,
|
@@ -5,6 +5,10 @@ const getServerConfig = async (appDirectory, configFile) => {
|
|
5
5
|
const configFilePath = findExists(CONFIG_FILE_EXTENSIONS.map((extension) => path.resolve(appDirectory, `${configFile}${extension}`)));
|
6
6
|
return configFilePath;
|
7
7
|
};
|
8
|
+
const getMeta = (metaName = "modern-js") => {
|
9
|
+
const meta = metaName.toLowerCase().split("-")[0];
|
10
|
+
return meta;
|
11
|
+
};
|
8
12
|
const getTargetDir = (from, baseDir, targetBaseDir) => {
|
9
13
|
const relativePath = path.relative(baseDir, from);
|
10
14
|
return path.resolve(targetBaseDir, relativePath);
|
@@ -12,6 +16,7 @@ const getTargetDir = (from, baseDir, targetBaseDir) => {
|
|
12
16
|
export * from "./data";
|
13
17
|
export * from "./config";
|
14
18
|
export {
|
19
|
+
getMeta,
|
15
20
|
getServerConfig,
|
16
21
|
getTargetDir
|
17
22
|
};
|
@@ -13,17 +13,9 @@ const SERVER_PLUGIN_EXPRESS = "@modern-js/plugin-express";
|
|
13
13
|
const SERVER_PLUGIN_KOA = "@modern-js/plugin-koa";
|
14
14
|
const SERVER_PLUGIN_SERVER = "@modern-js/plugin-server";
|
15
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
|
-
};
|
23
16
|
export {
|
24
17
|
HMR_SOCK_PATH,
|
25
18
|
HTML_CHUNKSMAP_SEPARATOR,
|
26
|
-
INTERNAL_SERVER_PLUGINS,
|
27
19
|
LOADER_REPORTER_NAME,
|
28
20
|
MAIN_ENTRY_NAME,
|
29
21
|
NESTED_ROUTE_SPEC_FILE,
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { InternalPlugins } from '@modern-js/types';
|
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,
|
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, } from '../universal/constants';
|
3
|
+
export declare const JS_EXTENSIONS: string[];
|
3
4
|
/**
|
4
5
|
* server side bundles directory, which relative to dist.
|
5
6
|
*/
|
@@ -27,6 +28,10 @@ export declare const CONFIG_FILE_EXTENSIONS: string[];
|
|
27
28
|
* Serialized config path
|
28
29
|
*/
|
29
30
|
export declare const OUTPUT_CONFIG_FILE = "modern.config.json";
|
31
|
+
/**
|
32
|
+
* Default runtime config filename
|
33
|
+
*/
|
34
|
+
export declare const DEFAULT_RUNTIME_CONFIG = "modern.runtime";
|
30
35
|
/**
|
31
36
|
* Default server config basename
|
32
37
|
*/
|
@@ -1,4 +1,11 @@
|
|
1
1
|
export declare const getServerConfig: (appDirectory: string, configFile: string) => Promise<string | false>;
|
2
|
+
/**
|
3
|
+
* Transform the metaName
|
4
|
+
* @param metaName The name of framework, the default value is 'modern-js'
|
5
|
+
* @returns
|
6
|
+
* modern-js -> modern
|
7
|
+
*/
|
8
|
+
export declare const getMeta: (metaName?: string) => string;
|
2
9
|
export declare const getTargetDir: (from: string, baseDir: string, targetBaseDir: string) => string;
|
3
10
|
export * from './data';
|
4
11
|
export * from './config';
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import { InternalPlugins } from '@modern-js/types';
|
2
1
|
/**
|
3
2
|
* Property mounted on window that describes route manifest
|
4
3
|
*/
|
@@ -44,4 +43,3 @@ export declare const SERVER_PLUGIN_EXPRESS = "@modern-js/plugin-express";
|
|
44
43
|
export declare const SERVER_PLUGIN_KOA = "@modern-js/plugin-koa";
|
45
44
|
export declare const SERVER_PLUGIN_SERVER = "@modern-js/plugin-server";
|
46
45
|
export declare const SERVER_PLUGIN_POLYFILL = "@modern-js/plugin-polyfill";
|
47
|
-
export declare const INTERNAL_SERVER_PLUGINS: InternalPlugins;
|
package/package.json
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "2.
|
18
|
+
"version": "2.54.0",
|
19
19
|
"jsnext:source": "./src/index.ts",
|
20
20
|
"types": "./dist/types/index.d.ts",
|
21
21
|
"main": "./dist/cjs/index.js",
|
@@ -161,10 +161,10 @@
|
|
161
161
|
"@types/node": "^14",
|
162
162
|
"jest": "^29",
|
163
163
|
"typescript": "^5",
|
164
|
-
"webpack": "^5.
|
165
|
-
"@modern-js/types": "2.
|
166
|
-
"@scripts/
|
167
|
-
"@scripts/
|
164
|
+
"webpack": "^5.92.0",
|
165
|
+
"@modern-js/types": "2.54.0",
|
166
|
+
"@scripts/build": "2.54.0",
|
167
|
+
"@scripts/jest-config": "2.54.0"
|
168
168
|
},
|
169
169
|
"sideEffects": false,
|
170
170
|
"scripts": {
|