@modern-js/utils 2.22.0 → 2.22.1-alpha.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/FileSizeReporter.d.ts +16 -0
- package/dist/FileSizeReporter.js +162 -0
- package/dist/alias.d.ts +25 -0
- package/dist/alias.js +108 -0
- package/dist/analyzeProject.d.ts +2 -0
- package/dist/analyzeProject.js +71 -0
- package/dist/applyOptionsChain.d.ts +3 -0
- package/dist/applyOptionsChain.js +58 -0
- package/dist/babel.d.ts +3 -0
- package/dist/babel.js +136 -0
- package/dist/chainId.d.ts +244 -0
- package/dist/chainId.js +196 -0
- package/dist/clearConsole.d.ts +1 -0
- package/dist/clearConsole.js +31 -0
- package/dist/commands.d.ts +4 -0
- package/dist/commands.js +48 -0
- package/dist/compatRequire.d.ts +13 -0
- package/dist/compatRequire.js +82 -0
- package/dist/compiled.d.ts +43 -0
- package/dist/compiled.js +142 -0
- package/dist/constants.d.ts +244 -0
- package/dist/constants.js +320 -0
- package/dist/debug.d.ts +6 -0
- package/dist/debug.js +28 -0
- package/dist/emptyDir.d.ts +1 -0
- package/dist/emptyDir.js +52 -0
- package/dist/ensureAbsolutePath.d.ts +7 -0
- package/dist/ensureAbsolutePath.js +38 -0
- package/dist/ensureArray.d.ts +1 -0
- package/dist/ensureArray.js +32 -0
- package/dist/findExists.d.ts +6 -0
- package/dist/findExists.js +45 -0
- package/dist/generateMetaTags.d.ts +16 -0
- package/dist/generateMetaTags.js +61 -0
- package/dist/getBrowserslist.d.ts +2 -0
- package/dist/getBrowserslist.js +31 -0
- package/dist/getCoreJsVersion.d.ts +1 -0
- package/dist/getCoreJsVersion.js +46 -0
- package/dist/getEntryOptions.d.ts +1 -0
- package/dist/getEntryOptions.js +54 -0
- package/dist/getPackageManager.d.ts +1 -0
- package/dist/getPackageManager.js +87 -0
- package/dist/getPort.d.ts +14 -0
- package/dist/getPort.js +112 -0
- package/dist/getServerConfig.d.ts +1 -0
- package/dist/getServerConfig.js +67 -0
- package/dist/getTargetDir.d.ts +1 -0
- package/dist/getTargetDir.js +41 -0
- package/dist/import.d.ts +5 -0
- package/dist/import.js +33 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.js +60 -0
- package/dist/is/index.d.ts +58 -0
- package/dist/is/index.js +114 -0
- package/dist/is/nodeEnv.d.ts +8 -0
- package/dist/is/nodeEnv.js +39 -0
- package/dist/is/platform.d.ts +2 -0
- package/dist/is/platform.js +30 -0
- package/dist/is/type.d.ts +8 -0
- package/dist/is/type.js +64 -0
- package/dist/logger.d.ts +65 -0
- package/dist/logger.js +145 -0
- package/dist/monorepo.d.ts +11 -0
- package/dist/monorepo.js +137 -0
- package/dist/nodeEnv.d.ts +3 -0
- package/dist/nodeEnv.js +81 -0
- package/dist/path.d.ts +18 -0
- package/dist/path.js +92 -0
- package/dist/pathSerializer.d.ts +16 -0
- package/dist/pathSerializer.js +76 -0
- package/dist/plugin.d.ts +2 -0
- package/dist/plugin.js +46 -0
- package/dist/prettyInstructions.d.ts +9 -0
- package/dist/prettyInstructions.js +112 -0
- package/dist/printBuildError.d.ts +8 -0
- package/dist/printBuildError.js +57 -0
- package/dist/react.d.ts +1 -0
- package/dist/react.js +64 -0
- package/dist/readTsConfig.d.ts +2 -0
- package/dist/readTsConfig.js +47 -0
- package/dist/removeSlash.d.ts +3 -0
- package/dist/removeSlash.js +33 -0
- package/dist/resolve.d.ts +13 -0
- package/dist/resolve.js +63 -0
- package/dist/routes.d.ts +2 -0
- package/dist/routes.js +58 -0
- package/dist/runtimeExports.d.ts +4 -0
- package/dist/runtimeExports.js +73 -0
- package/dist/ssr.d.ts +8 -0
- package/dist/ssr.js +30 -0
- package/dist/storage.d.ts +5 -0
- package/dist/storage.js +75 -0
- package/dist/testUtils.d.ts +5 -0
- package/dist/testUtils.js +38 -0
- package/dist/types.d.ts +1 -0
- package/dist/types.js +15 -0
- package/dist/universal/constants.d.ts +9 -0
- package/dist/universal/constants.js +30 -0
- package/dist/universal/formatWebpack.d.ts +13 -0
- package/dist/universal/formatWebpack.js +100 -0
- package/dist/universal/nestedRoutes.d.ts +8 -0
- package/dist/universal/nestedRoutes.js +131 -0
- package/dist/universal/remixRouter.d.ts +1 -0
- package/dist/universal/remixRouter.js +17 -0
- package/dist/universal/serialize.d.ts +1 -0
- package/dist/universal/serialize.js +40 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +92 -0
- package/dist/wait.d.ts +2 -0
- package/dist/wait.js +29 -0
- package/dist/watch.d.ts +8 -0
- package/dist/watch.js +90 -0
- package/package.json +3 -3
package/dist/compiled.js
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
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 compiled_exports = {};
|
|
29
|
+
__export(compiled_exports, {
|
|
30
|
+
Command: () => import_commander.Command,
|
|
31
|
+
Signale: () => import_signale2.Signale,
|
|
32
|
+
address: () => import_address.default,
|
|
33
|
+
browserslist: () => import_browserslist.default,
|
|
34
|
+
chalk: () => import_chalk.default,
|
|
35
|
+
chokidar: () => chokidar,
|
|
36
|
+
debug: () => import_debug.default,
|
|
37
|
+
dotenv: () => import_dotenv.default,
|
|
38
|
+
dotenvExpand: () => import_dotenv_expand.default,
|
|
39
|
+
execa: () => import_execa.default,
|
|
40
|
+
fastGlob: () => import_fast_glob.default,
|
|
41
|
+
filesize: () => import_filesize.default,
|
|
42
|
+
fs: () => import_fs_extra.default,
|
|
43
|
+
glob: () => import_glob.default,
|
|
44
|
+
globby: () => import_globby.default,
|
|
45
|
+
gzipSize: () => import_gzip_size.default,
|
|
46
|
+
inquirer: () => inquirer,
|
|
47
|
+
json5: () => import_json5.default,
|
|
48
|
+
lodash: () => import_lodash.default,
|
|
49
|
+
mime: () => mime,
|
|
50
|
+
minimist: () => import_minimist.default,
|
|
51
|
+
nanoid: () => import_nanoid.nanoid,
|
|
52
|
+
ora: () => import_ora.default,
|
|
53
|
+
pkgUp: () => import_pkg_up.default,
|
|
54
|
+
program: () => import_commander.program,
|
|
55
|
+
recursiveReaddir: () => import_recursive_readdir.default,
|
|
56
|
+
semver: () => import_semver.default,
|
|
57
|
+
signale: () => import_signale.default,
|
|
58
|
+
slash: () => import_slash.default,
|
|
59
|
+
stripAnsi: () => import_strip_ansi.default,
|
|
60
|
+
upath: () => import_upath.default,
|
|
61
|
+
urlJoin: () => import_url_join.default,
|
|
62
|
+
yaml: () => import_js_yaml.default
|
|
63
|
+
});
|
|
64
|
+
module.exports = __toCommonJS(compiled_exports);
|
|
65
|
+
var import_import = require("./import");
|
|
66
|
+
var import_fs_extra = __toESM(require("../compiled/fs-extra"));
|
|
67
|
+
var import_ora = __toESM(require("../compiled/ora"));
|
|
68
|
+
var import_glob = __toESM(require("../compiled/glob"));
|
|
69
|
+
var import_js_yaml = __toESM(require("../compiled/js-yaml"));
|
|
70
|
+
var import_chalk = __toESM(require("../compiled/chalk"));
|
|
71
|
+
var import_debug = __toESM(require("../compiled/debug"));
|
|
72
|
+
var import_slash = __toESM(require("../compiled/slash"));
|
|
73
|
+
var import_execa = __toESM(require("../compiled/execa"));
|
|
74
|
+
var import_json5 = __toESM(require("../compiled/json5"));
|
|
75
|
+
var import_upath = __toESM(require("../compiled/upath"));
|
|
76
|
+
var import_pkg_up = __toESM(require("../compiled/pkg-up"));
|
|
77
|
+
var import_nanoid = require("../compiled/nanoid");
|
|
78
|
+
var import_semver = __toESM(require("../compiled/semver"));
|
|
79
|
+
var import_dotenv = __toESM(require("../compiled/dotenv"));
|
|
80
|
+
var import_lodash = __toESM(require("../compiled/lodash"));
|
|
81
|
+
var import_globby = __toESM(require("../compiled/globby"));
|
|
82
|
+
var import_address = __toESM(require("../compiled/address"));
|
|
83
|
+
var import_signale = __toESM(require("../compiled/signale"));
|
|
84
|
+
var import_url_join = __toESM(require("../compiled/url-join"));
|
|
85
|
+
var import_minimist = __toESM(require("../compiled/minimist"));
|
|
86
|
+
var import_fast_glob = __toESM(require("../compiled/fast-glob"));
|
|
87
|
+
var import_filesize = __toESM(require("../compiled/filesize"));
|
|
88
|
+
var import_gzip_size = __toESM(require("../compiled/gzip-size"));
|
|
89
|
+
var import_strip_ansi = __toESM(require("../compiled/strip-ansi"));
|
|
90
|
+
var import_dotenv_expand = __toESM(require("../compiled/dotenv-expand"));
|
|
91
|
+
var import_browserslist = __toESM(require("../compiled/browserslist"));
|
|
92
|
+
var import_recursive_readdir = __toESM(require("../compiled/recursive-readdir"));
|
|
93
|
+
var import_commander = require("../compiled/commander");
|
|
94
|
+
var import_signale2 = require("../compiled/signale");
|
|
95
|
+
const mime = import_import.Import.lazy(
|
|
96
|
+
"../compiled/mime-types",
|
|
97
|
+
require
|
|
98
|
+
);
|
|
99
|
+
const chokidar = import_import.Import.lazy(
|
|
100
|
+
"../compiled/chokidar",
|
|
101
|
+
require
|
|
102
|
+
);
|
|
103
|
+
const inquirer = import_import.Import.lazy(
|
|
104
|
+
"../compiled/inquirer",
|
|
105
|
+
require
|
|
106
|
+
);
|
|
107
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
108
|
+
0 && (module.exports = {
|
|
109
|
+
Command,
|
|
110
|
+
Signale,
|
|
111
|
+
address,
|
|
112
|
+
browserslist,
|
|
113
|
+
chalk,
|
|
114
|
+
chokidar,
|
|
115
|
+
debug,
|
|
116
|
+
dotenv,
|
|
117
|
+
dotenvExpand,
|
|
118
|
+
execa,
|
|
119
|
+
fastGlob,
|
|
120
|
+
filesize,
|
|
121
|
+
fs,
|
|
122
|
+
glob,
|
|
123
|
+
globby,
|
|
124
|
+
gzipSize,
|
|
125
|
+
inquirer,
|
|
126
|
+
json5,
|
|
127
|
+
lodash,
|
|
128
|
+
mime,
|
|
129
|
+
minimist,
|
|
130
|
+
nanoid,
|
|
131
|
+
ora,
|
|
132
|
+
pkgUp,
|
|
133
|
+
program,
|
|
134
|
+
recursiveReaddir,
|
|
135
|
+
semver,
|
|
136
|
+
signale,
|
|
137
|
+
slash,
|
|
138
|
+
stripAnsi,
|
|
139
|
+
upath,
|
|
140
|
+
urlJoin,
|
|
141
|
+
yaml
|
|
142
|
+
});
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { InternalPlugins } from '@modern-js/types';
|
|
2
|
+
/**
|
|
3
|
+
* route specification file
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export declare const ROUTE_SPEC_FILE = "route.json";
|
|
7
|
+
/**
|
|
8
|
+
* main entry name
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export declare const MAIN_ENTRY_NAME = "main";
|
|
12
|
+
/**
|
|
13
|
+
* open editor request path
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
export declare const LAUNCH_EDITOR_ENDPOINT = "/__open-stack-frame-in-editor";
|
|
17
|
+
/**
|
|
18
|
+
* server side bundles directory, which relative to dist.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
export declare const SERVER_BUNDLE_DIRECTORY = "bundles";
|
|
22
|
+
/**
|
|
23
|
+
* server side bundles directory, which relative to dist.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
export declare const SERVER_WORKER_BUNDLE_DIRECTORY = "worker";
|
|
27
|
+
/**
|
|
28
|
+
* entry name pattern used for ajv pattern properties.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
export declare const ENTRY_NAME_PATTERN = "^[a-zA-Z0-9_-]+$";
|
|
32
|
+
/**
|
|
33
|
+
* SSR server render function name
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
export declare const SERVER_RENDER_FUNCTION_NAME = "serverRender";
|
|
37
|
+
/**
|
|
38
|
+
* loadbale manifest json file
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
export declare const LOADABLE_STATS_FILE = "loadable-stats.json";
|
|
42
|
+
/**
|
|
43
|
+
* internal specified folder
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
export declare const API_DIR = "api";
|
|
47
|
+
export declare const SERVER_DIR = "server";
|
|
48
|
+
export declare const SHARED_DIR = "shared";
|
|
49
|
+
/**
|
|
50
|
+
* Modern.config.ts cached dir
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
export declare const CONFIG_CACHE_DIR = "./node_modules/.cache/node-bundle-require";
|
|
54
|
+
export declare const CONFIG_FILE_EXTENSIONS: string[];
|
|
55
|
+
/**
|
|
56
|
+
* Serialized config path
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
export declare const OUTPUT_CONFIG_FILE = "modern.config.json";
|
|
60
|
+
/**
|
|
61
|
+
* Default server config basename
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
export declare const DEFAULT_SERVER_CONFIG = "modern.server-runtime.config";
|
|
65
|
+
/**
|
|
66
|
+
* Routes manifest filename
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
export declare const ROUTE_MANIFEST_FILE = "routes-manifest.json";
|
|
70
|
+
/**
|
|
71
|
+
* directory name for loader routes
|
|
72
|
+
*/
|
|
73
|
+
|
|
74
|
+
export declare const LOADER_ROUTES_DIR = "loader-routes";
|
|
75
|
+
/**
|
|
76
|
+
* default host for dev
|
|
77
|
+
*/
|
|
78
|
+
|
|
79
|
+
export declare const DEFAULT_DEV_HOST = "0.0.0.0";
|
|
80
|
+
/**
|
|
81
|
+
* Internal app-tools plugins that work as soon as they are installed.
|
|
82
|
+
*/
|
|
83
|
+
|
|
84
|
+
export declare const INTERNAL_APP_TOOLS_PLUGINS: InternalPlugins;
|
|
85
|
+
export declare const INTERNAL_APP_TOOLS_RUNTIME_PLUGINS: InternalPlugins;
|
|
86
|
+
/**
|
|
87
|
+
* Internal module-tools plugins that work as soon as they are installed.
|
|
88
|
+
*/
|
|
89
|
+
|
|
90
|
+
export declare const INTERNAL_MODULE_TOOLS_PLUGINS: InternalPlugins;
|
|
91
|
+
/**
|
|
92
|
+
* Internal monorepo-tools plugins that work as soon as they are installed.
|
|
93
|
+
*/
|
|
94
|
+
|
|
95
|
+
export declare const INTERNAL_MONOREPO_TOOLS_PLUGINS: InternalPlugins;
|
|
96
|
+
/**
|
|
97
|
+
* Internal doc-tools plugins that work as soon as they are installed.
|
|
98
|
+
*/
|
|
99
|
+
|
|
100
|
+
export declare const INTERNAL_DOC_TOOLS_PLUGINS: InternalPlugins;
|
|
101
|
+
/**
|
|
102
|
+
* Internal plugins that work as soon as they are installed.
|
|
103
|
+
*/
|
|
104
|
+
|
|
105
|
+
export declare const INTERNAL_CLI_PLUGINS: InternalPlugins;
|
|
106
|
+
export declare const SERVER_PLUGIN_BFF = "@modern-js/plugin-bff";
|
|
107
|
+
export declare const SERVER_PLUGIN_EXPRESS = "@modern-js/plugin-express";
|
|
108
|
+
export declare const SERVER_PLUGIN_EGG = "@modern-js/plugin-egg";
|
|
109
|
+
export declare const SERVER_PLUGIN_KOA = "@modern-js/plugin-koa";
|
|
110
|
+
export declare const SERVER_PLUGIN_NEST = "@modern-js/plugin-nest";
|
|
111
|
+
export declare const SERVER_PLUGIN_SERVER = "@modern-js/plugin-server";
|
|
112
|
+
export declare const SERVER_PLUGIN_POLYFILL = "@modern-js/plugin-polyfill";
|
|
113
|
+
export declare const INTERNAL_SERVER_PLUGINS: InternalPlugins;
|
|
114
|
+
/**
|
|
115
|
+
* The schema registered in the plugin.
|
|
116
|
+
*/
|
|
117
|
+
|
|
118
|
+
export declare const PLUGIN_SCHEMAS: {
|
|
119
|
+
'@modern-js/runtime': ({
|
|
120
|
+
target: string;
|
|
121
|
+
schema: {
|
|
122
|
+
type: string;
|
|
123
|
+
additionalProperties: boolean;
|
|
124
|
+
patternProperties?: undefined;
|
|
125
|
+
};
|
|
126
|
+
} | {
|
|
127
|
+
target: string;
|
|
128
|
+
schema: {
|
|
129
|
+
type: string;
|
|
130
|
+
patternProperties: {
|
|
131
|
+
"^[a-zA-Z0-9_-]+$": {
|
|
132
|
+
type: string;
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
additionalProperties: boolean;
|
|
136
|
+
};
|
|
137
|
+
})[];
|
|
138
|
+
'@modern-js/plugin-swc': {
|
|
139
|
+
target: string;
|
|
140
|
+
schema: {
|
|
141
|
+
typeof: string[];
|
|
142
|
+
};
|
|
143
|
+
}[];
|
|
144
|
+
'@modern-js/plugin-bff': {
|
|
145
|
+
target: string;
|
|
146
|
+
schema: {
|
|
147
|
+
type: string;
|
|
148
|
+
properties: {
|
|
149
|
+
prefix: {
|
|
150
|
+
type: string[];
|
|
151
|
+
items: {
|
|
152
|
+
type: string;
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
fetcher: {
|
|
156
|
+
type: string;
|
|
157
|
+
};
|
|
158
|
+
proxy: {
|
|
159
|
+
type: string;
|
|
160
|
+
};
|
|
161
|
+
requestCreator: {
|
|
162
|
+
type: string;
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
}[];
|
|
167
|
+
'@modern-js/plugin-tailwindcss': {
|
|
168
|
+
target: string;
|
|
169
|
+
schema: {
|
|
170
|
+
typeof: string[];
|
|
171
|
+
};
|
|
172
|
+
}[];
|
|
173
|
+
'@modern-js/plugin-proxy': {
|
|
174
|
+
target: string;
|
|
175
|
+
schema: {
|
|
176
|
+
typeof: string[];
|
|
177
|
+
};
|
|
178
|
+
}[];
|
|
179
|
+
'@modern-js/plugin-ssg': {
|
|
180
|
+
target: string;
|
|
181
|
+
schema: {
|
|
182
|
+
oneOf: ({
|
|
183
|
+
type: string;
|
|
184
|
+
instanceof?: undefined;
|
|
185
|
+
} | {
|
|
186
|
+
instanceof: string;
|
|
187
|
+
type?: undefined;
|
|
188
|
+
})[];
|
|
189
|
+
};
|
|
190
|
+
}[];
|
|
191
|
+
'@modern-js/plugin-state': {
|
|
192
|
+
target: string;
|
|
193
|
+
schema: {
|
|
194
|
+
type: string[];
|
|
195
|
+
};
|
|
196
|
+
}[];
|
|
197
|
+
'@modern-js/plugin-design-token': ({
|
|
198
|
+
target: string;
|
|
199
|
+
schema: {
|
|
200
|
+
typeof: string[];
|
|
201
|
+
type?: undefined;
|
|
202
|
+
};
|
|
203
|
+
} | {
|
|
204
|
+
target: string;
|
|
205
|
+
schema: {
|
|
206
|
+
type: string[];
|
|
207
|
+
typeof?: undefined;
|
|
208
|
+
};
|
|
209
|
+
})[];
|
|
210
|
+
'@modern-js/plugin-router': {
|
|
211
|
+
target: string;
|
|
212
|
+
schema: {
|
|
213
|
+
type: string[];
|
|
214
|
+
};
|
|
215
|
+
}[];
|
|
216
|
+
'@modern-js/plugin-testing': {
|
|
217
|
+
target: string;
|
|
218
|
+
schema: {
|
|
219
|
+
typeof: string[];
|
|
220
|
+
};
|
|
221
|
+
}[];
|
|
222
|
+
'@modern-js/plugin-garfish': {
|
|
223
|
+
target: string;
|
|
224
|
+
schema: {
|
|
225
|
+
type: string[];
|
|
226
|
+
};
|
|
227
|
+
}[];
|
|
228
|
+
'@modern-js/plugin-nocode': never[];
|
|
229
|
+
};
|
|
230
|
+
/**
|
|
231
|
+
* The `@babel/preset-typescript` default options.
|
|
232
|
+
*
|
|
233
|
+
* for:
|
|
234
|
+
* - `@modern-js/builder-rspack-provider`
|
|
235
|
+
* - `@modern-js/babel-preset-base`
|
|
236
|
+
*/
|
|
237
|
+
|
|
238
|
+
export declare const DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS: {
|
|
239
|
+
allowNamespaces: boolean;
|
|
240
|
+
allExtensions: boolean;
|
|
241
|
+
allowDeclareFields: boolean;
|
|
242
|
+
optimizeConstEnums: boolean;
|
|
243
|
+
isTSX: boolean;
|
|
244
|
+
};
|
|
@@ -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
|
+
});
|