@modern-js/utils 1.3.7-alpha.prebundle.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +20 -0
- package/dist/constants.d.ts +13 -0
- package/dist/constants.js +14 -1
- package/dist/getServerConfig.d.ts +1 -0
- package/dist/{src/watch.js → getServerConfig.js} +8 -34
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/ssrHelpers.d.ts +4 -0
- package/dist/ssrHelpers.js +7 -0
- package/dist/storage.d.ts +5 -0
- package/dist/storage.js +61 -0
- package/package.json +2 -2
- package/dist/compiled/upath/index.d.ts +0 -225
- package/dist/compiled/upath/index.js +0 -1
- package/dist/pkgUp.d.ts +0 -2
- package/dist/pkgUp.js +0 -8
- package/dist/src/FileSizeReporter.d.ts +0 -16
- package/dist/src/FileSizeReporter.js +0 -152
- package/dist/src/alias.d.ts +0 -21
- package/dist/src/alias.js +0 -62
- package/dist/src/applyOptionsChain.d.ts +0 -6
- package/dist/src/applyOptionsChain.js +0 -30
- package/dist/src/clearConsole.d.ts +0 -1
- package/dist/src/clearConsole.js +0 -9
- package/dist/src/compatRequire.d.ts +0 -8
- package/dist/src/compatRequire.js +0 -28
- package/dist/src/compiled.d.ts +0 -7
- package/dist/src/compiled.js +0 -19
- package/dist/src/constants.d.ts +0 -209
- package/dist/src/constants.js +0 -264
- package/dist/src/debug.d.ts +0 -7
- package/dist/src/debug.js +0 -14
- package/dist/src/emptyDir.d.ts +0 -1
- package/dist/src/emptyDir.js +0 -22
- package/dist/src/ensureAbsolutePath.d.ts +0 -7
- package/dist/src/ensureAbsolutePath.js +0 -15
- package/dist/src/findExists.d.ts +0 -6
- package/dist/src/findExists.js +0 -21
- package/dist/src/format.d.ts +0 -16
- package/dist/src/format.js +0 -115
- package/dist/src/generateMetaTags.d.ts +0 -16
- package/dist/src/generateMetaTags.js +0 -48
- package/dist/src/getBrowserslist.d.ts +0 -2
- package/dist/src/getBrowserslist.js +0 -7
- package/dist/src/getCacheIdentifier.d.ts +0 -7
- package/dist/src/getCacheIdentifier.js +0 -24
- package/dist/src/getEntryOptions.d.ts +0 -1
- package/dist/src/getEntryOptions.js +0 -26
- package/dist/src/getPackageManager.d.ts +0 -1
- package/dist/src/getPackageManager.js +0 -47
- package/dist/src/getPort.d.ts +0 -7
- package/dist/src/getPort.js +0 -62
- package/dist/src/import.d.ts +0 -5
- package/dist/src/import.js +0 -10
- package/dist/src/index.d.ts +0 -32
- package/dist/src/index.js +0 -57
- package/dist/src/is/index.d.ts +0 -34
- package/dist/src/is/index.js +0 -82
- package/dist/src/is/node-env.d.ts +0 -4
- package/dist/src/is/node-env.js +0 -12
- package/dist/src/is/platform.d.ts +0 -2
- package/dist/src/is/platform.js +0 -10
- package/dist/src/is/type.d.ts +0 -8
- package/dist/src/is/type.js +0 -38
- package/dist/src/logger.d.ts +0 -63
- package/dist/src/logger.js +0 -129
- package/dist/src/monorepo.d.ts +0 -11
- package/dist/src/monorepo.js +0 -81
- package/dist/src/nodeEnv.d.ts +0 -3
- package/dist/src/nodeEnv.js +0 -52
- package/dist/src/path.d.ts +0 -3
- package/dist/src/path.js +0 -14
- package/dist/src/prettyInstructions.d.ts +0 -6
- package/dist/src/prettyInstructions.js +0 -64
- package/dist/src/printBuildError.d.ts +0 -8
- package/dist/src/printBuildError.js +0 -43
- package/dist/src/readTsConfig.d.ts +0 -2
- package/dist/src/readTsConfig.js +0 -19
- package/dist/src/removeSlash.d.ts +0 -3
- package/dist/src/removeSlash.js +0 -9
- package/dist/src/runtimeExports.d.ts +0 -4
- package/dist/src/runtimeExports.js +0 -53
- package/dist/src/wait.d.ts +0 -2
- package/dist/src/wait.js +0 -7
- package/dist/src/watch.d.ts +0 -8
package/dist/src/alias.d.ts
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
declare type AliasOption = Record<string, string> | ((aliases: Record<string, string>) => Record<string, unknown>) | Record<string, string> | undefined;
|
2
|
-
interface NormalizedConfig {
|
3
|
-
source: {
|
4
|
-
alias?: AliasOption | Array<AliasOption>;
|
5
|
-
};
|
6
|
-
}
|
7
|
-
interface IAliasConfig {
|
8
|
-
absoluteBaseUrl: string;
|
9
|
-
paths?: Record<string, string | string[]>;
|
10
|
-
isTsPath?: boolean;
|
11
|
-
isTsProject?: boolean;
|
12
|
-
}
|
13
|
-
export declare const validAlias: <T extends NormalizedConfig>(modernConfig: T, { tsconfigPath }: {
|
14
|
-
tsconfigPath: string;
|
15
|
-
}) => string | null;
|
16
|
-
export declare const getAlias: (aliasOption: AliasOption | Array<AliasOption>, option: {
|
17
|
-
appDirectory: string;
|
18
|
-
tsconfigPath: string;
|
19
|
-
}) => IAliasConfig;
|
20
|
-
export declare const getUserAlias: (alias?: Record<string, string | string[]>) => Record<string, string | string[]>;
|
21
|
-
export {};
|
package/dist/src/alias.js
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.getUserAlias = exports.getAlias = exports.validAlias = void 0;
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
8
|
-
const path_1 = __importDefault(require("path"));
|
9
|
-
const compiled_1 = require("./compiled");
|
10
|
-
const readTsConfig_1 = require("./readTsConfig");
|
11
|
-
const applyOptionsChain_1 = require("./applyOptionsChain");
|
12
|
-
const validAlias = (modernConfig, { tsconfigPath }) => {
|
13
|
-
const { source: { alias }, } = modernConfig;
|
14
|
-
if (!alias) {
|
15
|
-
return null;
|
16
|
-
}
|
17
|
-
const isTsProject = fs_1.default.existsSync(tsconfigPath);
|
18
|
-
if (!isTsProject) {
|
19
|
-
return null;
|
20
|
-
}
|
21
|
-
const userAlias = (0, exports.getUserAlias)(alias);
|
22
|
-
if (Object.keys(userAlias).length > 0) {
|
23
|
-
return compiled_1.chalk.red('Note: Please use `compilerOptions.paths` in "tsconfig.json" file replace `source.alias` config in "modern.config.js/ts" when project is typescript');
|
24
|
-
}
|
25
|
-
return null;
|
26
|
-
};
|
27
|
-
exports.validAlias = validAlias;
|
28
|
-
const getAlias = (aliasOption, option) => {
|
29
|
-
var _a, _b;
|
30
|
-
const isTsProject = fs_1.default.existsSync(option.tsconfigPath);
|
31
|
-
let aliasConfig;
|
32
|
-
if (!isTsProject) {
|
33
|
-
aliasConfig = {
|
34
|
-
absoluteBaseUrl: option.appDirectory,
|
35
|
-
paths: (0, applyOptionsChain_1.applyOptionsChain)({ '@': ['./src'] }, aliasOption),
|
36
|
-
isTsPath: false,
|
37
|
-
isTsProject,
|
38
|
-
};
|
39
|
-
}
|
40
|
-
else {
|
41
|
-
const tsconfig = (0, readTsConfig_1.readTsConfigByFile)(option.tsconfigPath);
|
42
|
-
const baseUrl = (_a = tsconfig === null || tsconfig === void 0 ? void 0 : tsconfig.compilerOptions) === null || _a === void 0 ? void 0 : _a.baseUrl;
|
43
|
-
aliasConfig = {
|
44
|
-
absoluteBaseUrl: baseUrl
|
45
|
-
? path_1.default.join(option.appDirectory, baseUrl)
|
46
|
-
: option.appDirectory,
|
47
|
-
paths: Object.assign(Object.assign({}, (aliasOption || {})), (_b = tsconfig === null || tsconfig === void 0 ? void 0 : tsconfig.compilerOptions) === null || _b === void 0 ? void 0 : _b.paths),
|
48
|
-
isTsPath: true,
|
49
|
-
isTsProject,
|
50
|
-
};
|
51
|
-
}
|
52
|
-
return aliasConfig;
|
53
|
-
};
|
54
|
-
exports.getAlias = getAlias;
|
55
|
-
// filter invalid ts paths that are not array
|
56
|
-
const getUserAlias = (alias = {}) => Object.keys(alias).reduce((o, k) => {
|
57
|
-
if (Array.isArray(alias[k])) {
|
58
|
-
o[k] = alias[k];
|
59
|
-
}
|
60
|
-
return o;
|
61
|
-
}, {});
|
62
|
-
exports.getUserAlias = getUserAlias;
|
@@ -1,6 +0,0 @@
|
|
1
|
-
export declare const applyOptionsChain: <T, U>(defaults: T, options?: T | (T | ((config: T, utils?: U | undefined) => void | T))[] | ((config: T, utils?: U | undefined) => void | T) | undefined, utils?: U | undefined, mergeFn?: {
|
2
|
-
<T_1, U_1>(target: T_1, source: U_1): T_1 & U_1;
|
3
|
-
<T_2, U_2, V>(target: T_2, source1: U_2, source2: V): T_2 & U_2 & V;
|
4
|
-
<T_3, U_3, V_1, W>(target: T_3, source1: U_3, source2: V_1, source3: W): T_3 & U_3 & V_1 & W;
|
5
|
-
(target: object, ...sources: any[]): any;
|
6
|
-
}) => T;
|
@@ -1,30 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.applyOptionsChain = void 0;
|
4
|
-
// eslint-disable-next-line import/no-useless-path-segments
|
5
|
-
const index_1 = require("./index");
|
6
|
-
const applyOptionsChain = (defaults, options, utils, mergeFn = Object.assign) => {
|
7
|
-
if (!options) {
|
8
|
-
return defaults;
|
9
|
-
}
|
10
|
-
if ((0, index_1.isPlainObject)(options)) {
|
11
|
-
return mergeFn(defaults, options);
|
12
|
-
}
|
13
|
-
else if ((0, index_1.isFunction)(options)) {
|
14
|
-
const ret = options(defaults, utils);
|
15
|
-
if (ret) {
|
16
|
-
if (!(0, index_1.isPlainObject)(ret)) {
|
17
|
-
index_1.logger.warn(`${options.name}: Function should mutate the config and return nothing, Or return a cloned or merged version of config object.`);
|
18
|
-
}
|
19
|
-
return ret;
|
20
|
-
}
|
21
|
-
}
|
22
|
-
else if (Array.isArray(options)) {
|
23
|
-
return options.reduce((memo, cur) => (0, exports.applyOptionsChain)(memo, cur, utils, mergeFn), defaults);
|
24
|
-
}
|
25
|
-
else {
|
26
|
-
throw new Error(`applyOptionsChain error:\ndefault options is: ${JSON.stringify(defaults)}`);
|
27
|
-
}
|
28
|
-
return defaults;
|
29
|
-
};
|
30
|
-
exports.applyOptionsChain = applyOptionsChain;
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare const clearConsole: () => void;
|
package/dist/src/clearConsole.js
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.clearConsole = void 0;
|
4
|
-
const clearConsole = () => {
|
5
|
-
if (process.stdout.isTTY && !process.env.DEBUG) {
|
6
|
-
process.stdout.write('\x1B[H\x1B[2J');
|
7
|
-
}
|
8
|
-
};
|
9
|
-
exports.clearConsole = clearConsole;
|
@@ -1,8 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Require function compatible with esm and cjs module.
|
3
|
-
* @param filePath - File to required.
|
4
|
-
* @returns module export object.
|
5
|
-
*/
|
6
|
-
export declare const compatRequire: (filePath: string) => any;
|
7
|
-
export declare const requireExistModule: (filename: string, extensions?: string[]) => any;
|
8
|
-
export declare const cleanRequireCache: (filelist: string[]) => void;
|
@@ -1,28 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.cleanRequireCache = exports.requireExistModule = exports.compatRequire = void 0;
|
4
|
-
const findExists_1 = require("./findExists");
|
5
|
-
/**
|
6
|
-
* Require function compatible with esm and cjs module.
|
7
|
-
* @param filePath - File to required.
|
8
|
-
* @returns module export object.
|
9
|
-
*/
|
10
|
-
const compatRequire = (filePath) => {
|
11
|
-
const mod = require(filePath);
|
12
|
-
return (mod === null || mod === void 0 ? void 0 : mod.__esModule) ? mod.default : mod;
|
13
|
-
};
|
14
|
-
exports.compatRequire = compatRequire;
|
15
|
-
const requireExistModule = (filename, extensions = ['.ts', '.js']) => {
|
16
|
-
const exist = (0, findExists_1.findExists)(extensions.map(ext => `${filename}${ext}`));
|
17
|
-
if (!exist) {
|
18
|
-
return null;
|
19
|
-
}
|
20
|
-
return (0, exports.compatRequire)(exist);
|
21
|
-
};
|
22
|
-
exports.requireExistModule = requireExistModule;
|
23
|
-
const cleanRequireCache = (filelist) => {
|
24
|
-
filelist.forEach(filepath => {
|
25
|
-
delete require.cache[filepath];
|
26
|
-
});
|
27
|
-
};
|
28
|
-
exports.cleanRequireCache = cleanRequireCache;
|
package/dist/src/compiled.d.ts
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
import chalk from '../compiled/chalk';
|
2
|
-
import upath from '../compiled/upath';
|
3
|
-
import pkgUp from '../compiled/pkg-up';
|
4
|
-
import gzipSize from '../compiled/gzip-size';
|
5
|
-
declare const filesize: typeof import('../compiled/filesize');
|
6
|
-
declare const stripAnsi: typeof import('../compiled/strip-ansi');
|
7
|
-
export { chalk, upath, pkgUp, filesize, stripAnsi, gzipSize };
|
package/dist/src/compiled.js
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.gzipSize = exports.stripAnsi = exports.filesize = exports.pkgUp = exports.upath = exports.chalk = void 0;
|
7
|
-
const chalk_1 = __importDefault(require("../compiled/chalk"));
|
8
|
-
exports.chalk = chalk_1.default;
|
9
|
-
const upath_1 = __importDefault(require("../compiled/upath"));
|
10
|
-
exports.upath = upath_1.default;
|
11
|
-
const pkg_up_1 = __importDefault(require("../compiled/pkg-up"));
|
12
|
-
exports.pkgUp = pkg_up_1.default;
|
13
|
-
const gzip_size_1 = __importDefault(require("../compiled/gzip-size"));
|
14
|
-
exports.gzipSize = gzip_size_1.default;
|
15
|
-
const import_1 = require("./import");
|
16
|
-
const filesize = import_1.Import.lazy('../compiled/filesize', require);
|
17
|
-
exports.filesize = filesize;
|
18
|
-
const stripAnsi = import_1.Import.lazy('../compiled/strip-ansi', require);
|
19
|
-
exports.stripAnsi = stripAnsi;
|
package/dist/src/constants.d.ts
DELETED
@@ -1,209 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* hmr socket connect path
|
3
|
-
*/
|
4
|
-
export declare const HMR_SOCK_PATH = "/_modern_js_hmr_ws";
|
5
|
-
/**
|
6
|
-
* route specification file
|
7
|
-
*/
|
8
|
-
export declare const ROUTE_SPEC_FILE = "route.json";
|
9
|
-
/**
|
10
|
-
* main entry name
|
11
|
-
*/
|
12
|
-
export declare const MAIN_ENTRY_NAME = "main";
|
13
|
-
/**
|
14
|
-
* open editor request path
|
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
|
-
export declare const SERVER_BUNDLE_DIRECTORY = "bundles";
|
21
|
-
/**
|
22
|
-
* entry name pattern used for ajv pattern properties.
|
23
|
-
*/
|
24
|
-
export declare const ENTRY_NAME_PATTERN = "^[a-zA-Z0-9_-]+$";
|
25
|
-
/**
|
26
|
-
* SSR server render function name
|
27
|
-
*/
|
28
|
-
export declare const SERVER_RENDER_FUNCTION_NAME = "serverRender";
|
29
|
-
/**
|
30
|
-
* loadbale manifest json file
|
31
|
-
*/
|
32
|
-
export declare const LOADABLE_STATS_FILE = "loadable-stats.json";
|
33
|
-
/**
|
34
|
-
* internal specified folder
|
35
|
-
*/
|
36
|
-
export declare const API_DIR = "api";
|
37
|
-
export declare const SERVER_DIR = "server";
|
38
|
-
export declare const SHARED_DIR = "shared";
|
39
|
-
/**
|
40
|
-
* Internal plugins that work as soon as they are installed.
|
41
|
-
*/
|
42
|
-
export declare const INTERNAL_PLUGINS: {
|
43
|
-
[name: string]: {
|
44
|
-
cli?: string;
|
45
|
-
server?: string;
|
46
|
-
};
|
47
|
-
};
|
48
|
-
/**
|
49
|
-
* The schema registered in the plugin.
|
50
|
-
*/
|
51
|
-
export declare const PLUGIN_SCHEMAS: {
|
52
|
-
'@modern-js/runtime': ({
|
53
|
-
target: string;
|
54
|
-
schema: {
|
55
|
-
type: string;
|
56
|
-
additionalProperties: boolean;
|
57
|
-
patternProperties?: undefined;
|
58
|
-
};
|
59
|
-
} | {
|
60
|
-
target: string;
|
61
|
-
schema: {
|
62
|
-
type: string;
|
63
|
-
patternProperties: {
|
64
|
-
"^[a-zA-Z0-9_-]+$": {
|
65
|
-
type: string;
|
66
|
-
};
|
67
|
-
};
|
68
|
-
additionalProperties: boolean;
|
69
|
-
};
|
70
|
-
})[];
|
71
|
-
'@modern-js/plugin-bff': {
|
72
|
-
target: string;
|
73
|
-
schema: {
|
74
|
-
type: string;
|
75
|
-
properties: {
|
76
|
-
prefix: {
|
77
|
-
type: string[];
|
78
|
-
items: {
|
79
|
-
type: string;
|
80
|
-
};
|
81
|
-
};
|
82
|
-
fetcher: {
|
83
|
-
type: string;
|
84
|
-
};
|
85
|
-
proxy: {
|
86
|
-
type: string;
|
87
|
-
};
|
88
|
-
requestCreator: {
|
89
|
-
type: string;
|
90
|
-
};
|
91
|
-
};
|
92
|
-
};
|
93
|
-
}[];
|
94
|
-
'@modern-js/plugin-esbuild': {
|
95
|
-
target: string;
|
96
|
-
schema: {
|
97
|
-
typeof: string[];
|
98
|
-
};
|
99
|
-
}[];
|
100
|
-
'@modern-js/plugin-less': {
|
101
|
-
target: string;
|
102
|
-
schema: {
|
103
|
-
typeof: string[];
|
104
|
-
};
|
105
|
-
}[];
|
106
|
-
'@modern-js/plugin-sass': {
|
107
|
-
target: string;
|
108
|
-
schema: {
|
109
|
-
typeof: string[];
|
110
|
-
};
|
111
|
-
}[];
|
112
|
-
'@modern-js/plugin-tailwindcss': {
|
113
|
-
target: string;
|
114
|
-
schema: {
|
115
|
-
typeof: string[];
|
116
|
-
};
|
117
|
-
}[];
|
118
|
-
'@modern-js/plugin-proxy': {
|
119
|
-
target: string;
|
120
|
-
schema: {
|
121
|
-
typeof: string[];
|
122
|
-
};
|
123
|
-
}[];
|
124
|
-
'@modern-js/plugin-unbundle': ({
|
125
|
-
target: string;
|
126
|
-
schema: {
|
127
|
-
type: string;
|
128
|
-
properties?: undefined;
|
129
|
-
};
|
130
|
-
} | {
|
131
|
-
target: string;
|
132
|
-
schema: {
|
133
|
-
type: string;
|
134
|
-
properties: {
|
135
|
-
ignore: {
|
136
|
-
type: string[];
|
137
|
-
items: {
|
138
|
-
type: string;
|
139
|
-
};
|
140
|
-
};
|
141
|
-
ignoreModuleCache: {
|
142
|
-
type: string;
|
143
|
-
};
|
144
|
-
clearPdnCache: {
|
145
|
-
type: string;
|
146
|
-
};
|
147
|
-
pdnHost: {
|
148
|
-
type: string;
|
149
|
-
};
|
150
|
-
};
|
151
|
-
};
|
152
|
-
})[];
|
153
|
-
'@modern-js/plugin-ssg': {
|
154
|
-
target: string;
|
155
|
-
schema: {
|
156
|
-
oneOf: ({
|
157
|
-
type: string;
|
158
|
-
instanceof?: undefined;
|
159
|
-
} | {
|
160
|
-
instanceof: string;
|
161
|
-
type?: undefined;
|
162
|
-
})[];
|
163
|
-
};
|
164
|
-
}[];
|
165
|
-
'@modern-js/plugin-ssr': {
|
166
|
-
target: string;
|
167
|
-
schema: {
|
168
|
-
type: string[];
|
169
|
-
};
|
170
|
-
}[];
|
171
|
-
'@modern-js/plugin-state': {
|
172
|
-
target: string;
|
173
|
-
schema: {
|
174
|
-
type: string[];
|
175
|
-
};
|
176
|
-
}[];
|
177
|
-
'@modern-js/plugin-design-token': ({
|
178
|
-
target: string;
|
179
|
-
schema: {
|
180
|
-
typeof: string[];
|
181
|
-
type?: undefined;
|
182
|
-
};
|
183
|
-
} | {
|
184
|
-
target: string;
|
185
|
-
schema: {
|
186
|
-
type: string[];
|
187
|
-
typeof?: undefined;
|
188
|
-
};
|
189
|
-
})[];
|
190
|
-
'@modern-js/plugin-router': {
|
191
|
-
target: string;
|
192
|
-
schema: {
|
193
|
-
type: string[];
|
194
|
-
};
|
195
|
-
}[];
|
196
|
-
'@modern-js/plugin-testing': {
|
197
|
-
target: string;
|
198
|
-
schema: {
|
199
|
-
typeof: string[];
|
200
|
-
};
|
201
|
-
}[];
|
202
|
-
'@modern-js/plugin-garfish': {
|
203
|
-
target: string;
|
204
|
-
schema: {
|
205
|
-
type: string[];
|
206
|
-
};
|
207
|
-
}[];
|
208
|
-
'@modern-js/plugin-nocode': never[];
|
209
|
-
};
|
package/dist/src/constants.js
DELETED
@@ -1,264 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.PLUGIN_SCHEMAS = exports.INTERNAL_PLUGINS = exports.SHARED_DIR = exports.SERVER_DIR = exports.API_DIR = exports.LOADABLE_STATS_FILE = exports.SERVER_RENDER_FUNCTION_NAME = exports.ENTRY_NAME_PATTERN = exports.SERVER_BUNDLE_DIRECTORY = exports.LAUNCH_EDITOR_ENDPOINT = exports.MAIN_ENTRY_NAME = exports.ROUTE_SPEC_FILE = exports.HMR_SOCK_PATH = void 0;
|
4
|
-
/**
|
5
|
-
* hmr socket connect path
|
6
|
-
*/
|
7
|
-
exports.HMR_SOCK_PATH = '/_modern_js_hmr_ws';
|
8
|
-
/**
|
9
|
-
* route specification file
|
10
|
-
*/
|
11
|
-
exports.ROUTE_SPEC_FILE = 'route.json';
|
12
|
-
/**
|
13
|
-
* main entry name
|
14
|
-
*/
|
15
|
-
exports.MAIN_ENTRY_NAME = 'main';
|
16
|
-
/**
|
17
|
-
* open editor request path
|
18
|
-
*/
|
19
|
-
exports.LAUNCH_EDITOR_ENDPOINT = '/__open-stack-frame-in-editor';
|
20
|
-
/**
|
21
|
-
* server side bundles directory, which relative to dist.
|
22
|
-
*/
|
23
|
-
exports.SERVER_BUNDLE_DIRECTORY = 'bundles';
|
24
|
-
/**
|
25
|
-
* entry name pattern used for ajv pattern properties.
|
26
|
-
*/
|
27
|
-
exports.ENTRY_NAME_PATTERN = '^[a-zA-Z0-9_-]+$';
|
28
|
-
/**
|
29
|
-
* SSR server render function name
|
30
|
-
*/
|
31
|
-
exports.SERVER_RENDER_FUNCTION_NAME = 'serverRender';
|
32
|
-
/**
|
33
|
-
* loadbale manifest json file
|
34
|
-
*/
|
35
|
-
exports.LOADABLE_STATS_FILE = 'loadable-stats.json';
|
36
|
-
/**
|
37
|
-
* internal specified folder
|
38
|
-
*/
|
39
|
-
exports.API_DIR = 'api';
|
40
|
-
exports.SERVER_DIR = 'server';
|
41
|
-
exports.SHARED_DIR = 'shared';
|
42
|
-
/**
|
43
|
-
* Internal plugins that work as soon as they are installed.
|
44
|
-
*/
|
45
|
-
exports.INTERNAL_PLUGINS = {
|
46
|
-
'@modern-js/app-tools': { cli: '@modern-js/app-tools/cli' },
|
47
|
-
'@modern-js/monorepo-tools': { cli: '@modern-js/monorepo-tools/cli' },
|
48
|
-
'@modern-js/module-tools': { cli: '@modern-js/module-tools/cli' },
|
49
|
-
'@modern-js/runtime': { cli: '@modern-js/runtime/cli' },
|
50
|
-
'@modern-js/plugin-less': { cli: '@modern-js/plugin-less/cli' },
|
51
|
-
'@modern-js/plugin-sass': { cli: '@modern-js/plugin-sass/cli' },
|
52
|
-
'@modern-js/plugin-esbuild': { cli: '@modern-js/plugin-esbuild/cli' },
|
53
|
-
'@modern-js/plugin-proxy': { cli: '@modern-js/plugin-proxy/cli' },
|
54
|
-
'@modern-js/plugin-ssg': { cli: '@modern-js/plugin-ssg/cli' },
|
55
|
-
'@modern-js/plugin-bff': {
|
56
|
-
cli: '@modern-js/plugin-bff/cli',
|
57
|
-
server: '@modern-js/plugin-bff/server',
|
58
|
-
},
|
59
|
-
'@modern-js/plugin-electron': { cli: '@modern-js/plugin-electron/cli' },
|
60
|
-
'@modern-js/plugin-testing': { cli: '@modern-js/plugin-testing/cli' },
|
61
|
-
'@modern-js/plugin-storybook': { cli: '@modern-js/plugin-storybook/cli' },
|
62
|
-
'@modern-js/plugin-docsite': { cli: '@modern-js/plugin-docsite/cli' },
|
63
|
-
'@modern-js/plugin-express': {
|
64
|
-
cli: '@modern-js/plugin-express/cli',
|
65
|
-
server: '@modern-js/plugin-express',
|
66
|
-
},
|
67
|
-
'@modern-js/plugin-egg': {
|
68
|
-
cli: '@modern-js/plugin-egg/cli',
|
69
|
-
server: '@modern-js/plugin-egg',
|
70
|
-
},
|
71
|
-
'@modern-js/plugin-koa': {
|
72
|
-
cli: '@modern-js/plugin-koa/cli',
|
73
|
-
server: '@modern-js/plugin-koa',
|
74
|
-
},
|
75
|
-
'@modern-js/plugin-nest': {
|
76
|
-
cli: '@modern-js/plugin-nest/cli',
|
77
|
-
server: '@modern-js/plugin-nest/server',
|
78
|
-
},
|
79
|
-
'@modern-js/plugin-unbundle': { cli: '@modern-js/plugin-unbundle' },
|
80
|
-
'@modern-js/plugin-server-build': { cli: '@modern-js/plugin-server-build' },
|
81
|
-
'@modern-js/plugin-server': {
|
82
|
-
cli: '@modern-js/plugin-server/cli',
|
83
|
-
server: '@modern-js/plugin-server/server',
|
84
|
-
},
|
85
|
-
'@modern-js/plugin-garfish': {
|
86
|
-
cli: '@modern-js/plugin-garfish/cli',
|
87
|
-
},
|
88
|
-
'@modern-js/plugin-jarvis': { cli: '@modern-js/plugin-jarvis/cli' },
|
89
|
-
'@modern-js/plugin-tailwindcss': { cli: '@modern-js/plugin-tailwindcss/cli' },
|
90
|
-
'@modern-js/plugin-lambda-fc': { cli: '@modern-js/plugin-lambda-fc/cli' },
|
91
|
-
'@modern-js/plugin-lambda-scf': { cli: '@modern-js/plugin-lambda-scf/cli' },
|
92
|
-
'@modern-js/plugin-cdn-oss': { cli: '@modern-js/plugin-cdn-oss/cli' },
|
93
|
-
'@modern-js/plugin-cdn-cos': { cli: '@modern-js/plugin-cdn-cos/cli' },
|
94
|
-
'@modern-js/plugin-static-hosting': {
|
95
|
-
cli: '@modern-js/plugin-static-hosting/cli',
|
96
|
-
},
|
97
|
-
'@modern-js/plugin-polyfill': {
|
98
|
-
cli: '@modern-js/plugin-polyfill/cli',
|
99
|
-
server: '@modern-js/plugin-polyfill',
|
100
|
-
},
|
101
|
-
'@modern-js/plugin-multiprocess': {
|
102
|
-
cli: '@modern-js/plugin-multiprocess/cli',
|
103
|
-
},
|
104
|
-
'@modern-js/plugin-nocode': { cli: '@modern-js/plugin-nocode/cli' },
|
105
|
-
'@modern-js/plugin-design-token': {
|
106
|
-
cli: '@modern-js/plugin-design-token/cli',
|
107
|
-
},
|
108
|
-
};
|
109
|
-
/**
|
110
|
-
* The schema registered in the plugin.
|
111
|
-
*/
|
112
|
-
exports.PLUGIN_SCHEMAS = {
|
113
|
-
'@modern-js/runtime': [
|
114
|
-
{
|
115
|
-
target: 'runtime',
|
116
|
-
schema: {
|
117
|
-
type: 'object',
|
118
|
-
additionalProperties: false,
|
119
|
-
},
|
120
|
-
},
|
121
|
-
{
|
122
|
-
target: 'runtimeByEntries',
|
123
|
-
schema: {
|
124
|
-
type: 'object',
|
125
|
-
patternProperties: { [exports.ENTRY_NAME_PATTERN]: { type: 'object' } },
|
126
|
-
additionalProperties: false,
|
127
|
-
},
|
128
|
-
},
|
129
|
-
],
|
130
|
-
'@modern-js/plugin-bff': [
|
131
|
-
{
|
132
|
-
target: 'bff',
|
133
|
-
schema: {
|
134
|
-
type: 'object',
|
135
|
-
properties: {
|
136
|
-
prefix: {
|
137
|
-
type: ['string', 'array'],
|
138
|
-
items: { type: 'string' },
|
139
|
-
},
|
140
|
-
fetcher: { type: 'string' },
|
141
|
-
proxy: { type: 'object' },
|
142
|
-
requestCreator: { type: 'string' },
|
143
|
-
},
|
144
|
-
},
|
145
|
-
},
|
146
|
-
],
|
147
|
-
'@modern-js/plugin-esbuild': [
|
148
|
-
{
|
149
|
-
target: 'tools.esbuild',
|
150
|
-
schema: { typeof: ['object'] },
|
151
|
-
},
|
152
|
-
],
|
153
|
-
'@modern-js/plugin-less': [
|
154
|
-
{
|
155
|
-
target: 'tools.less',
|
156
|
-
schema: { typeof: ['object', 'function'] },
|
157
|
-
},
|
158
|
-
],
|
159
|
-
'@modern-js/plugin-sass': [
|
160
|
-
{
|
161
|
-
target: 'tools.sass',
|
162
|
-
schema: { typeof: ['object', 'function'] },
|
163
|
-
},
|
164
|
-
],
|
165
|
-
'@modern-js/plugin-tailwindcss': [
|
166
|
-
{
|
167
|
-
target: 'tools.tailwindcss',
|
168
|
-
schema: { typeof: ['object', 'function'] },
|
169
|
-
},
|
170
|
-
],
|
171
|
-
'@modern-js/plugin-proxy': [
|
172
|
-
{
|
173
|
-
target: 'dev.proxy',
|
174
|
-
schema: { typeof: ['string', 'object'] },
|
175
|
-
},
|
176
|
-
],
|
177
|
-
'@modern-js/plugin-unbundle': [
|
178
|
-
{
|
179
|
-
target: 'output.disableAutoImportStyle',
|
180
|
-
schema: { type: 'boolean' },
|
181
|
-
},
|
182
|
-
{
|
183
|
-
target: 'dev.unbundle',
|
184
|
-
schema: {
|
185
|
-
type: 'object',
|
186
|
-
properties: {
|
187
|
-
ignore: {
|
188
|
-
type: ['string', 'array'],
|
189
|
-
items: { type: 'string' },
|
190
|
-
},
|
191
|
-
ignoreModuleCache: { type: 'boolean' },
|
192
|
-
clearPdnCache: { type: 'boolean' },
|
193
|
-
pdnHost: { type: 'string' },
|
194
|
-
},
|
195
|
-
},
|
196
|
-
},
|
197
|
-
],
|
198
|
-
'@modern-js/plugin-ssg': [
|
199
|
-
{
|
200
|
-
target: 'output.ssg',
|
201
|
-
schema: {
|
202
|
-
oneOf: [
|
203
|
-
{ type: 'boolean' },
|
204
|
-
{ type: 'object' },
|
205
|
-
{ instanceof: 'Function' },
|
206
|
-
],
|
207
|
-
},
|
208
|
-
},
|
209
|
-
],
|
210
|
-
'@modern-js/plugin-ssr': [
|
211
|
-
{
|
212
|
-
target: 'runtime.ssr',
|
213
|
-
schema: { type: ['boolean', 'object'] },
|
214
|
-
},
|
215
|
-
],
|
216
|
-
'@modern-js/plugin-state': [
|
217
|
-
{
|
218
|
-
target: 'runtime.state',
|
219
|
-
schema: { type: ['boolean', 'object'] },
|
220
|
-
},
|
221
|
-
],
|
222
|
-
'@modern-js/plugin-design-token': [
|
223
|
-
// Legacy Features
|
224
|
-
{
|
225
|
-
target: 'source.designSystem',
|
226
|
-
schema: { typeof: ['object'] },
|
227
|
-
},
|
228
|
-
{
|
229
|
-
target: 'source.designSystem.supportStyledComponents',
|
230
|
-
schema: { type: ['boolean'] },
|
231
|
-
},
|
232
|
-
],
|
233
|
-
'@modern-js/plugin-router': [
|
234
|
-
{
|
235
|
-
target: 'runtime.router',
|
236
|
-
schema: { type: ['boolean', 'object'] },
|
237
|
-
},
|
238
|
-
],
|
239
|
-
'@modern-js/plugin-testing': [
|
240
|
-
{
|
241
|
-
target: 'testing',
|
242
|
-
schema: { typeof: ['object'] },
|
243
|
-
},
|
244
|
-
{
|
245
|
-
target: 'tools.jest',
|
246
|
-
schema: { typeof: ['object', 'function'] },
|
247
|
-
},
|
248
|
-
],
|
249
|
-
'@modern-js/plugin-garfish': [
|
250
|
-
{
|
251
|
-
target: 'runtime.masterApp',
|
252
|
-
schema: { type: ['boolean', 'object'] },
|
253
|
-
},
|
254
|
-
{
|
255
|
-
target: 'dev.withMasterApp',
|
256
|
-
schema: { type: ['object'] },
|
257
|
-
},
|
258
|
-
{
|
259
|
-
target: 'deploy.microFrontend',
|
260
|
-
schema: { type: ['boolean', 'object'] },
|
261
|
-
},
|
262
|
-
],
|
263
|
-
'@modern-js/plugin-nocode': [],
|
264
|
-
};
|
package/dist/src/debug.d.ts
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
import debug from 'debug';
|
2
|
-
/**
|
3
|
-
* Create debug function with unified namespace prefix.
|
4
|
-
* @param scope - Custom module name of your debug function.
|
5
|
-
* @returns Debug function which namespace start with modern-js:.
|
6
|
-
*/
|
7
|
-
export declare const createDebugger: (scope: string) => debug.Debugger;
|